mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	daemon: unconditionally clean up priviliges
This commit is contained in:
		
							parent
							
								
									facae1f275
								
							
						
					
					
						commit
						9f53aa5546
					
				
					 1 changed files with 2 additions and 5 deletions
				
			
		| 
						 | 
					@ -58,11 +58,8 @@ void pa_drop_root(void) {
 | 
				
			||||||
#ifdef HAVE_GETUID
 | 
					#ifdef HAVE_GETUID
 | 
				
			||||||
    uid_t uid;
 | 
					    uid_t uid;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    pa_log_debug(_("Cleaning up privileges."));
 | 
				
			||||||
    uid = getuid();
 | 
					    uid = getuid();
 | 
				
			||||||
    if (uid == 0 || geteuid() != 0)
 | 
					 | 
				
			||||||
        return;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    pa_log_info(_("Dropping root privileges."));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(HAVE_SETRESUID)
 | 
					#if defined(HAVE_SETRESUID)
 | 
				
			||||||
    pa_assert_se(setresuid(uid, uid, uid) >= 0);
 | 
					    pa_assert_se(setresuid(uid, uid, uid) >= 0);
 | 
				
			||||||
| 
						 | 
					@ -82,7 +79,7 @@ void pa_drop_root(void) {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef HAVE_SYS_CAPABILITY_H
 | 
					#ifdef HAVE_SYS_CAPABILITY_H
 | 
				
			||||||
    {
 | 
					    if (uid != 0) {
 | 
				
			||||||
        cap_t caps;
 | 
					        cap_t caps;
 | 
				
			||||||
        pa_assert_se(caps = cap_init());
 | 
					        pa_assert_se(caps = cap_init());
 | 
				
			||||||
        pa_assert_se(cap_clear(caps) == 0);
 | 
					        pa_assert_se(cap_clear(caps) == 0);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue