]> err.no Git - dpkg/commitdiff
s-s-d: Change uid after changing gid and initalizing supplementary groups
authorGuillem Jover <guillem@debian.org>
Tue, 22 Jan 2008 10:57:43 +0000 (12:57 +0200)
committerGuillem Jover <guillem@debian.org>
Tue, 22 Jan 2008 10:57:43 +0000 (12:57 +0200)
Closes: #462018
ChangeLog
debian/changelog
utils/start-stop-daemon.c

index 1cb5c8a170523394582cab33518832424fd26249..f315fa15735c17547c6b697095c41c837606d86f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-01-22  Guillem Jover  <guillem@debian.org>
+
+       * utils/start-stop-daemon.c (main): Move setuid code after initgroups
+       and setgid.
+
 2008-01-21  Frank Lichtenheld  <djpig@debian.org>
 
        * configure.ac: Release 1.14.16.1
index f4145a7e9273075e59eb93d1f9a555a03af40707..625527a54f05d6f242d70cdfa9d85995bcbdb802 100644 (file)
@@ -1,3 +1,10 @@
+dpkg (1.14.16.2) UNRELEASED; urgency=low
+
+  * Change uid after changing gid and initializing supplementary groups in
+    start-stop-daemon. Closes: #462018
+
+ -- Guillem Jover <guillem@debian.org>  Tue, 22 Jan 2008 12:52:11 +0200
+
 dpkg (1.14.16.1) unstable; urgency=low
 
   * Add libtimedate-perl to dpkg-dev's Depends and to Build-Depends.
index ed21c3c2627dea0a19c2689a2927d02955b26760..2a31f73073c981eb1943b8e2f78b41c2c208f55f 100644 (file)
@@ -1413,10 +1413,6 @@ main(int argc, char **argv)
        if (chdir(changedir) < 0)
                fatal("Unable to chdir() to %s", changedir);
 
-       if (changeuser != NULL && getuid() != (uid_t)runas_uid) {
-               if (setuid(runas_uid))
-                       fatal("Unable to set uid to %s", changeuser);
-       }
        if (changegroup != NULL && *changegroup != '\0' &&
            getgid() != (gid_t)runas_gid) {
                if (!gid_in_current_groups(runas_gid))
@@ -1426,6 +1422,10 @@ main(int argc, char **argv)
                if (setgid(runas_gid))
                        fatal("Unable to set gid to %d", runas_gid);
        }
+       if (changeuser != NULL && getuid() != (uid_t)runas_uid) {
+               if (setuid(runas_uid))
+                       fatal("Unable to set uid to %s", changeuser);
+       }
 
        if (background) {
                /* Continue background setup */