Przeglądaj źródła

Fix uid/gid changing in start-stop-daemon

Wichert Akkerman 26 lat temu
rodzic
commit
b5be99fd83
2 zmienionych plików z 9 dodań i 2 usunięć
  1. 5 0
      ChangeLog
  2. 4 2
      utils/start-stop-daemon.c

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+Mon Dec  6 01:37:08 CET 1999 Wichert Akkerman <wakkerma@debian.org>
+
+  * Correct uid/gid-changes in start-stop-daemon, patch from
+    Topi Miettinen <Topi.Miettinen@nic.fi>
+
 Sun Dec  5 18:09:36 CET 1999 Wichert Akkerman <wakkerma@debian.org>
 
   * Add manpages from Josip Rodin <joy@cibalia.gkvk.hr> for

+ 4 - 2
utils/start-stop-daemon.c

@@ -654,10 +654,12 @@ main(int argc, char **argv)
 		printf("Starting %s...\n", startas);
 	*--argv = startas;
 	if (changeuser != NULL) {
+ 		if (setgid(runas_gid))
+ 			fatal("Unable to set gid to %d", runas_gid);
 		if (initgroups(changeuser, runas_gid))
 			fatal("Unable to set initgroups() with gid %d", runas_gid);
-		if (seteuid(runas_uid))
-			fatal("Unable to set effective uid to %s", changeuser);
+		if (setuid(runas_uid))
+			fatal("Unable to set uid to %s", changeuser);
 	}
 	
 	if (background) { /* ok, we need to detach this process */