You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Dirk-Willem van Gulik <di...@webweaving.org> on 1999/04/05 17:31:13 UTC

[Patch] chown-ing/chgrp-ing proxycachedir.

Ralf,

Would this make sense ? I just spend a delicious two hours
on a 2400 baud satellite link to track down a failing proxy
cache to something as rudimentary as the file permissions :-)

So this patch adds a conf_user; and does a chown on the
proxycache dir during install.

The patch to 'configure' also does a quick verify to see
if the UID is present; and tries some obvious second best
choises. And flags a warning if needed.

But I admit, Make's and Configures are not my cup of thee.
So could you comment/reject or take it from here ? 

Cheers,

Dw.
-- 
vi rocks.

Index: Makefile.tmpl
===================================================================
RCS file: /x3/home/cvs/apache-1.3/Makefile.tmpl,v
retrieving revision 1.69
diff -u -r1.69 Makefile.tmpl
--- Makefile.tmpl	1999/03/29 11:40:18	1.69
+++ Makefile.tmpl	1999/04/05 15:25:36
@@ -134,6 +134,7 @@
 suexec_safepath = @suexec_safepath@
 
 #   some substituted configuration parameters
+conf_user        = @conf_user@
 conf_group       = @conf_group@
 conf_port        = @conf_port@
 conf_serveradmin = @conf_serveradmin@
@@ -256,6 +257,9 @@
 	$(MKDIR) $(root)$(runtimedir)
 	$(MKDIR) $(root)$(logfiledir)
 	$(MKDIR) $(root)$(proxycachedir)
+	@echo "     Opening up permissions on proxy cache directory to  $(conf_user):$(conf_group)"
+	chown $(conf_user) $(root)$(proxycachedir)
+	chgrp $(conf_group) $(root)$(proxycachedir)
 	@echo "<=== [mktree]"
 
 #   install the server program and optionally corresponding
@@ -442,6 +446,7 @@
 			-e "s;logs/agent_log;$(logfiledir)/$${target_prefix}agent_log;" \
 			-e 's;conf/magic;$(sysconfdir)/magic;' \
 			-e 's;conf/mime\.types;$(sysconfdir)/mime.types;' \
+			-e 's;User nobody;User $(conf_user);' \
 			-e 's;Group #-1;Group $(conf_group);' \
 			-e 's;Port 80;Port $(conf_port);' \
 			-e 's;ServerAdmin you@your.address;ServerAdmin $(conf_serveradmin);' \
Index: configure
===================================================================
RCS file: /x3/home/cvs/apache-1.3/configure,v
retrieving revision 1.79
diff -u -r1.79 configure
--- configure	1999/04/02 10:38:03	1.79
+++ configure	1999/04/05 15:25:42
@@ -1004,7 +1004,13 @@
 
 ##
 ##  determine special configuration parameters
+## 
+##  XXX - the egreps through /etc/group and /etc/passwd
+##  will obviously fail on a NIS system. But then you
+##  propably do not want a uid as production oriented as
+##  a web server in NIS anyway.
 ##
+conf_user="nobody"
 conf_group="#-1"
 conf_port="80"
 conf_serveradmin="you@your.address"
@@ -1017,6 +1023,23 @@
             conf_group="nogroup"
         fi
     fi
+    duid="$conf_user"
+    for uid in $conf_user nobody www daemon demon http
+    do 
+        if [ ".`egrep ^$uid: /etc/passwd`" != . ]; then
+            grpd="x"
+            conf_user="$uid"
+            if [ $conf_user != $duid ]; then
+                echo " + Warning: Server configured to run with 'guessed' User '$conf_user'"
+            fi
+            break;
+        fi
+    done
+
+    if [ "x$grpd" != "xx" ]; then
+        echo " + Warning: Server configured to run with possibly non-existent User '$conf_user'"
+    fi
+
     if [ ".`id | grep root`" = . ]; then
         conf_port="8080"
     fi
@@ -1122,6 +1145,7 @@
 -e "s%@suexec_uidmin@%$suexec_uidmin%g" \
 -e "s%@suexec_gidmin@%$suexec_gidmin%g" \
 -e "s%@suexec_safepath@%$suexec_safepath%g" \
+-e "s%@conf_user@%$conf_user%g" \
 -e "s%@conf_group@%$conf_group%g" \
 -e "s%@conf_port@%$conf_port%g" \
 -e "s%@conf_serveradmin@%$conf_serveradmin%g" \