Package: chrootuid
Version: 1.3-3
Severity: normal

[EMAIL PROTECTED]:jek# chrootuid / root /bin/foo ; echo $? 
0
[EMAIL PROTECTED]:jek# ls -l /bin/foo
ls: /bin/foo: No such file or directory

This behaviour is not good when chrootuid used in scripts.

Below goes patch from ALT Linux distribuition:

--- chrootuid-1.3/chrootuid.c.orig      2002-12-11 15:28:44 +0200
+++ chrootuid-1.3/chrootuid.c   2002-12-11 15:42:57 +0200
@@ -50,9 +50,11 @@

 #include <unistd.h>
 #include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
 #include <pwd.h>
 #include <grp.h>
-#include <syslog.h> 

 int     main(argc, argv)
 int     argc;
@@ -65,12 +67,6 @@
      * require only two arguments.
      */

-#ifdef LOG_DAEMON
-    (void) openlog(argv[0], LOG_PID | LOG_NDELAY, LOG_DAEMON);
-#else
-    (void) openlog(argv[0], LOG_PID);
-#endif 
-
     /*
      * Require proper amount of arguments. In all cases of error, exit with
      * zero status because we have already reported the problem via syslogd.
@@ -78,44 +74,44 @@
      */

     if (argc < 4) {
-       syslog(LOG_ERR, "usage: %s path user command", argv[0]);
-       return (0);
+       fprintf(stderr,"usage: %s path user command\n", argv[0]);
+       return (1);
     }
     /* Must step into the new subtree. */
 
     if (chdir(argv[1])) {
-       syslog(LOG_ERR, "chdir(%s): %m", argv[1]);
-       return (0);
+       fprintf(stderr, "chdir(%s): %s\n", argv[1], strerror(errno));
+       return (1);
     }
     /* The user must be known in the *unrestricted* universe... */

     if ((pwd = getpwnam(argv[2])) == 0) {
-       syslog(LOG_ERR, "%s: user unknown", argv[2]);
-       return (0);
+       fprintf(stderr, "%s: user unknown\n", argv[2]);
+       return (1);
     }
     /* initgroups() accesses the group file in the unrestricted universe... */

     if (initgroups(pwd->pw_name, pwd->pw_gid) < 0) {
-       syslog(LOG_ERR, "initgroups: %m");
-       return (0);
+       fprintf(stderr, "initgroups: %s\n", strerror(errno));
+       return (1);
     }
     endgrent();

     /* Do the chroot() before giving away root privileges. */

     if (chroot(argv[1])) {
-       syslog(LOG_ERR, "chroot(%s): %m", argv[1]);
-       return (0);
+       fprintf(stderr, "chroot(%s): %s\n", argv[1], strerror(errno));
+       return (1);
     }
     /* Switch group id then user id. */

     if (setgid(pwd->pw_gid)) {
-       syslog(LOG_ERR, "setgid(%d): %m", pwd->pw_gid);
-       return (0);
+       fprintf(stderr, "setgid(%d): %s\n", pwd->pw_gid, strerror(errno));
+       return (1);
     }
     if (setuid(pwd->pw_uid)) {
-       syslog(LOG_ERR, "setuid(%d): %m", pwd->pw_uid);
-       return (0);
+       fprintf(stderr, "setuid(%d): %s\n", pwd->pw_uid, strerror(errno));
+       return (1);
     }
     /* In case we still have the /etc/passwd file still open. */

@@ -124,6 +120,6 @@
     /* Run the command and hope for the best. */

     (void) execv(argv[3], argv + 3);
-    syslog(LOG_ERR, "%s: %m", argv[3]);
-    return (0);
+    fprintf(stderr, "%s: %s", argv[3], strerror(errno));
+    return (1);
 }


-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.11-1-686
Locale: LANG=be_BY.CP1251, LC_CTYPE=be_BY.CP1251 (charmap=CP1251)

Versions of packages chrootuid depends on:
ii  libc6                         2.3.5-3    GNU C Library: Shared libraries an

chrootuid recommends no packages.

-- no debconf information


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

Reply via email to