mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	merge r2193 from prepare-0.9.10
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2208 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
		
							parent
							
								
									9f71611ab0
								
							
						
					
					
						commit
						1af0d948d1
					
				
					 2 changed files with 7 additions and 20 deletions
				
			
		| 
						 | 
				
			
			@ -90,8 +90,8 @@ int pa_limit_caps(void) {
 | 
			
		|||
    cap_t caps;
 | 
			
		||||
    cap_value_t nice_cap = CAP_SYS_NICE;
 | 
			
		||||
 | 
			
		||||
    caps = cap_init();
 | 
			
		||||
    pa_assert(caps);
 | 
			
		||||
    pa_assert_se(caps = cap_init());
 | 
			
		||||
 | 
			
		||||
    cap_clear(caps);
 | 
			
		||||
    cap_set_flag(caps, CAP_EFFECTIVE, 1, &nice_cap, CAP_SET);
 | 
			
		||||
    cap_set_flag(caps, CAP_PERMITTED, 1, &nice_cap, CAP_SET);
 | 
			
		||||
| 
						 | 
				
			
			@ -113,28 +113,15 @@ fail:
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
/* Drop all capabilities, effectively becoming a normal user */
 | 
			
		||||
int pa_drop_caps(void) {
 | 
			
		||||
void pa_drop_caps(void) {
 | 
			
		||||
    cap_t caps;
 | 
			
		||||
    int r = -1;
 | 
			
		||||
 | 
			
		||||
    caps = cap_init();
 | 
			
		||||
    pa_assert(caps);
 | 
			
		||||
    pa_assert_se(prctl(PR_SET_KEEPCAPS, 0, 0, 0, 0) == 0);
 | 
			
		||||
 | 
			
		||||
    pa_assert_se(caps = cap_init());
 | 
			
		||||
    cap_clear(caps);
 | 
			
		||||
 | 
			
		||||
    prctl(PR_SET_KEEPCAPS, 0, 0, 0, 0);
 | 
			
		||||
 | 
			
		||||
    if (cap_set_proc(caps) < 0) {
 | 
			
		||||
        pa_log("Failed to drop capabilities: %s", pa_cstrerror(errno));
 | 
			
		||||
        goto fail;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    r = 0;
 | 
			
		||||
 | 
			
		||||
fail:
 | 
			
		||||
    pa_assert_se(cap_set_proc(caps) == 0);
 | 
			
		||||
    cap_free(caps);
 | 
			
		||||
 | 
			
		||||
    return r;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,7 +25,7 @@
 | 
			
		|||
***/
 | 
			
		||||
 | 
			
		||||
void pa_drop_root(void);
 | 
			
		||||
void pa_drop_caps(void);
 | 
			
		||||
int pa_limit_caps(void);
 | 
			
		||||
int pa_drop_caps(void);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue