* Urgh. Do setgid() before setuid(), because the semantics of setgid()
changes completely depending on whether you're root...
This commit is contained in:
		
							parent
							
								
									6f0d050324
								
							
						
					
					
						commit
						44cad9630f
					
				
					 1 changed files with 4 additions and 4 deletions
				
			
		| 
						 | 
					@ -1364,13 +1364,13 @@ void DerivationGoal::startBuilder()
 | 
				
			||||||
                if (setgroups(0, 0) == -1)
 | 
					                if (setgroups(0, 0) == -1)
 | 
				
			||||||
                    throw SysError("cannot clear the set of supplementary groups");
 | 
					                    throw SysError("cannot clear the set of supplementary groups");
 | 
				
			||||||
                
 | 
					                
 | 
				
			||||||
                setuid(buildUser.getUID());
 | 
					 | 
				
			||||||
                assert(getuid() == buildUser.getUID());
 | 
					 | 
				
			||||||
                assert(geteuid() == buildUser.getUID());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                setgid(gidBuildGroup);
 | 
					                setgid(gidBuildGroup);
 | 
				
			||||||
                assert(getgid() == gidBuildGroup);
 | 
					                assert(getgid() == gidBuildGroup);
 | 
				
			||||||
                assert(getegid() == gidBuildGroup);
 | 
					                assert(getegid() == gidBuildGroup);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                setuid(buildUser.getUID());
 | 
				
			||||||
 | 
					                assert(getuid() == buildUser.getUID());
 | 
				
			||||||
 | 
					                assert(geteuid() == buildUser.getUID());
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            /* Execute the program.  This should not return. */
 | 
					            /* Execute the program.  This should not return. */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue