Author: jfclere
Date: Tue May 17 01:02:30 2005
New Revision: 170536

URL: http://svn.apache.org/viewcvs?rev=170536&view=rev
Log:
Allow jsvc to start as normal user in linux.

Modified:
    jakarta/commons/proper/daemon/trunk/src/native/unix/native/jsvc-unix.c

Modified: jakarta/commons/proper/daemon/trunk/src/native/unix/native/jsvc-unix.c
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/daemon/trunk/src/native/unix/native/jsvc-unix.c?rev=170536&r1=170535&r2=170536&view=diff
==============================================================================
--- jakarta/commons/proper/daemon/trunk/src/native/unix/native/jsvc-unix.c 
(original)
+++ jakarta/commons/proper/daemon/trunk/src/native/unix/native/jsvc-unix.c Tue 
May 17 01:02:30 2005
@@ -142,8 +142,13 @@
 static int linuxset_user_group(char *user, int uid, int gid)
 {
     /* set capabilities enough for binding port 80 setuid/getuid */
-    if (set_caps(CAPS)!=0)
-        return(-1);
+    if (set_caps(CAPS)!=0) {
+        if (getuid()!= uid) {
+            log_error("set_caps(CAPS) failed");
+            return(-1);
+        }
+        log_debug("set_caps(CAPS) failed");
+    }
 
     /* make sure they are kept after setuid */ 
     if (prctl(PR_SET_KEEPCAPS,1,0,0,0) < 0) {
@@ -158,8 +163,13 @@
     }
 
     /* set capability to binding port 80 read conf */
-    if (set_caps(CAPSMIN)!=0)
-        return(-1);
+    if (set_caps(CAPSMIN)!=0) {
+        if (getuid()!= uid) {
+            log_error("set_caps(CAPSMIN) failed");
+            return(-1);
+        }
+        log_debug("set_caps(CAPSMIN) failed");
+    }
 
     return(0);
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to