The following commit has been merged in the master branch:
commit 5ea9550838a25852086e20cffa6c74ed3ccc7375
Author: Guillem Jover <[email protected]>
Date:   Sat Jan 10 21:38:38 2009 +0200

    s-s-d: Behave the same way whether --chuid gets a user name or a uid
    
    Otherwise it was failing to setup the default group for the user if it
    had not been specified and the HOME environment variable.
    
    Closes: #368000

diff --git a/ChangeLog b/ChangeLog
index ca0a86e..29dbab5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-01-10  Guillem Jover  <[email protected]>
+
+       * utils/start-stop-daemon.c (main): If changeuser is a uid, call
+       getpwuid to get the passwd entry and do the same setup as if it is
+       a username.
+
 2009-01-07  Guillem Jover  <[email protected]>
 
        * man/dpkg-deb.1: Document that -x will modify the extraction
diff --git a/debian/changelog b/debian/changelog
index 2537bc0..1340300 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -48,6 +48,8 @@ dpkg (1.15.0) UNRELEASED; urgency=low
     is TERM not KILL. Closes: #507568
   * Warn in dpkg-deb man page that -x will modify the extraction directory
     permissions. Closes: #502496
+  * Make start-stop-daemon behave the same way whether --chuid gets a user
+    name or a uid. Closes: #368000
 
   [ Raphael Hertzog ]
   * Enhance dpkg-shlibdeps's error message when a library can't be found to
diff --git a/utils/start-stop-daemon.c b/utils/start-stop-daemon.c
index 5a5c921..40366c6 100644
--- a/utils/start-stop-daemon.c
+++ b/utils/start-stop-daemon.c
@@ -1267,8 +1267,13 @@ main(int argc, char **argv)
                        fatal("group `%s' not found\n", changegroup);
                runas_gid = gr->gr_gid;
        }
-       if (changeuser && sscanf(changeuser, "%d", &runas_uid) != 1) {
-               struct passwd *pw = getpwnam(changeuser);
+       if (changeuser) {
+               struct passwd *pw;
+
+               if (sscanf(changeuser, "%d", &runas_uid) == 1)
+                       pw = getpwuid(runas_uid);
+               else
+                       pw = getpwnam(changeuser);
                if (!pw)
                        fatal("user `%s' not found\n", changeuser);
                runas_uid = pw->pw_uid;

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to