Просмотр исходного кода

s-s-d: Reset the user and group names from the password entry on --chuid

This guarantees the initgroups() call will not fail when the user
specified the user to change to as a uid instead of a username.

Closes: #641834

Reported-by: Andreas Pretzsch <apr@cn-eng.de>
Guillem Jover лет назад: 15
Родитель
Сommit
49ad180074
2 измененных файлов с 4 добавлено и 0 удалено
  1. 2 0
      debian/changelog
  2. 2 0
      utils/start-stop-daemon.c

+ 2 - 0
debian/changelog

@@ -218,6 +218,8 @@ dpkg (1.16.1) UNRELEASED; urgency=low
   * Do not fail on --compare-version when generating parse warnings.
     Existing packages with invalid versions should not fail on their
     maintainer scripts due to that.
+  * Use the user name (instead of the user id) when setting the supplementary
+    groups in start-stop-daemon. Closes: #641834
 
   [ Updated dpkg translations ]
   * German (Sven Joachim). Closes: #620312

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

@@ -1606,6 +1606,7 @@ main(int argc, char **argv)
 		struct group *gr = getgrnam(changegroup);
 		if (!gr)
 			fatal("group '%s' not found", changegroup);
+		changegroup = gr->gr_name;
 		runas_gid = gr->gr_gid;
 	}
 	if (changeuser) {
@@ -1618,6 +1619,7 @@ main(int argc, char **argv)
 			pw = getpwnam(changeuser);
 		if (!pw)
 			fatal("user '%s' not found", changeuser);
+		changeuser = pw->pw_name;
 		runas_uid = pw->pw_uid;
 		if (changegroup == NULL) {
 			/* Pass the default group of this user. */