mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	Properly check for home directory
This commit is contained in:
		
							parent
							
								
									d0e26a519f
								
							
						
					
					
						commit
						2199b8e1ad
					
				
					 1 changed files with 4 additions and 6 deletions
				
			
		| 
						 | 
					@ -1179,19 +1179,17 @@ static char *get_dir(mode_t m, const char *env_name) {
 | 
				
			||||||
            return NULL;
 | 
					            return NULL;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        d = pa_sprintf_malloc("%s" PA_PATH_SEP ".pulse", h);
 | 
					        if (stat(h, &st) < 0) {
 | 
				
			||||||
 | 
					            pa_log_error("Failed to stat home directory %s: %s", h, pa_cstrerror(errno));
 | 
				
			||||||
        if (stat(d, &st) < 0) {
 | 
					 | 
				
			||||||
            pa_log_error("Failed to state home directory %s: %s", d, pa_cstrerror(errno));
 | 
					 | 
				
			||||||
            pa_xfree(d);
 | 
					 | 
				
			||||||
            return NULL;
 | 
					            return NULL;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (st.st_uid != getuid()) {
 | 
					        if (st.st_uid != getuid()) {
 | 
				
			||||||
            pa_log_error("Home directory %s not ours.", d);
 | 
					            pa_log_error("Home directory %s not ours.", d);
 | 
				
			||||||
            pa_xfree(d);
 | 
					 | 
				
			||||||
            return NULL;
 | 
					            return NULL;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        d = pa_sprintf_malloc("%s" PA_PATH_SEP ".pulse", h);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (pa_make_secure_dir(d, m, (pid_t) -1, (pid_t) -1) < 0)  {
 | 
					    if (pa_make_secure_dir(d, m, (pid_t) -1, (pid_t) -1) < 0)  {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue