* Start of the setuid helper (the program that performs the operations
that have to be done as root: running builders under different uids, changing ownership of build results, and deleting paths in the store with the wrong ownership).
This commit is contained in:
		
							parent
							
								
									2b558843a2
								
							
						
					
					
						commit
						9f0efa6611
					
				
					 5 changed files with 18 additions and 4 deletions
				
			
		|  | @ -271,6 +271,7 @@ AC_CONFIG_FILES([Makefile | |||
|    src/nix-instantiate/Makefile | ||||
|    src/nix-env/Makefile | ||||
|    src/nix-worker/Makefile | ||||
|    src/nix-setuid-helper/Makefile | ||||
|    src/nix-log2xml/Makefile | ||||
|    src/bsdiff-4.3/Makefile | ||||
|    scripts/Makefile | ||||
|  |  | |||
|  | @ -1,4 +1,5 @@ | |||
| SUBDIRS = bin2c boost libutil libstore libmain nix-store nix-hash \ | ||||
|  libexpr nix-instantiate nix-env nix-worker nix-log2xml bsdiff-4.3 | ||||
|  libexpr nix-instantiate nix-env nix-worker nix-setuid-helper \ | ||||
|  nix-log2xml bsdiff-4.3 | ||||
| 
 | ||||
| EXTRA_DIST = aterm-helper.pl | ||||
|  |  | |||
|  | @ -454,11 +454,12 @@ static void killUser(uid_t uid) | |||
| 		if (kill(-1, SIGKILL) == 0) break; | ||||
| 		if (errno == ESRCH) break; /* no more processes */ | ||||
| 		if (errno != EINTR) | ||||
| 		    throw SysError(format("cannot kill processes for UID `%1%'") % uid); | ||||
| 		    throw SysError(format("cannot kill processes for uid `%1%'") % uid); | ||||
| 	    } | ||||
|          | ||||
|         } catch (std::exception & e) { | ||||
|             std::cerr << format("killing build users: %1%\n") % e.what(); | ||||
|             std::cerr << format("killing processes beloging to uid `%1%': %1%\n") | ||||
|                 % uid % e.what(); | ||||
|             quickExit(1); | ||||
|         } | ||||
|         quickExit(0); | ||||
|  | @ -466,7 +467,7 @@ static void killUser(uid_t uid) | |||
|      | ||||
|     /* parent */ | ||||
|     if (pid.wait(true) != 0) | ||||
|         throw Error(format("cannot kill processes for UID `%1%'") % uid); | ||||
|         throw Error(format("cannot kill processes for uid `%1%'") % uid); | ||||
| 
 | ||||
|     /* !!! We should really do some check to make sure that there are
 | ||||
|        no processes left running under `uid', but there is no portable | ||||
|  |  | |||
							
								
								
									
										8
									
								
								src/nix-setuid-helper/Makefile.am
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								src/nix-setuid-helper/Makefile.am
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,8 @@ | |||
| libexec_PROGRAMS = nix-setuid-helper | ||||
| 
 | ||||
| nix_setuid_helper_SOURCES = main.cc | ||||
| nix_setuid_helper_LDADD = ../libutil/libutil.la \ | ||||
|  ../boost/format/libformat.la ${aterm_lib} | ||||
| 
 | ||||
| AM_CXXFLAGS = \ | ||||
|  -I$(srcdir)/.. $(aterm_include) -I$(srcdir)/../libutil | ||||
							
								
								
									
										3
									
								
								src/nix-setuid-helper/main.cc
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								src/nix-setuid-helper/main.cc
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,3 @@ | |||
| int main(int argc, char * * argv) | ||||
| { | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue