]> granicus.if.org Git - apache/commitdiff
Bring forward the -V option for suexec from 1.3.20-dev. It looks
authorKen Coar <coar@apache.org>
Fri, 9 Mar 2001 20:20:31 +0000 (20:20 +0000)
committerKen Coar <coar@apache.org>
Fri, 9 Mar 2001 20:20:31 +0000 (20:20 +0000)
like the umask() option needs to be brought forward, as well.
Is this still 2.0.14-dev?

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88483 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
docs/man/suexec.8
support/suexec.c

diff --git a/CHANGES b/CHANGES
index 67bf199dff88216467e457ecce7f23415c888570..8d658beeffa357b0e2fd76ab9a2560bd7abf5875 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,9 @@
 Changes with Apache 2.0.14
 
+  *) Add a -V flag to suexec, which causes it to display the
+     compile-time settings with which it was built.  (Only
+     usable by root or the AP_HTTPD_USER username.)  [Ken Coar]
+
   *) Mod_include should always unset the content-length if the file is
      going to be passed through send_parsed_content.  There is no to
      determine if the content will change before actually scanning the
index 69cb6ed5dde610e27f5af1227be5da8fd32cf429..a9a94feba77345a7b6f03039a7b11e3aa312d4bc 100644 (file)
@@ -1,4 +1,4 @@
-.TH suexec 8 "March 1998"
+.TH suexec 8 "March 2001"
 .\" The Apache Software License, Version 1.1
 .\"
 .\" Copyright (c) 2000-2001 The Apache Software Foundation.  All rights
 .SH NAME
 suexec \- Switch User For Exec
 .SH SYNOPSIS
-No synopsis for usage, because this program
-is used internally by Apache only. 
+.B suexec -V
+.PP
+No other synopsis for usage, because this program
+is otherwise only used internally by the Apache HTTP server. 
 .PP
 .SH DESCRIPTION
 .B suexec
-is the "wrapper" support program for the suEXEC behaviour for Apache.
-It is run from within Apache automatically to switch the user when
-an external program has to be run under a different user. For more
-information about suEXEC see the document `Apache suEXEC Support'
-under http://www.apache.org/docs/suexec.html .
+is the "wrapper" support program for the suexec behaviour for the
+Apache HTTP server.  It is run from within the server automatically
+to switch the user when an external program has to be run under a
+different user. For more information about suexec, see the online
+document `Apache suexec Support' on the HTTP server project's
+Web site at  http://httpd.apache.org/docs/suexec.html .
+.SH OPTIONS
+.IP -V
+Display the list of compile-time settings used when \fBsuexec\fP
+was built.  No other action is taken.
 .PD
 .SH SEE ALSO
 .BR httpd(8)
-.
index 234668dcbb0c6a99872e945f2cef6ab3a906d954..882608ca6f066d4c23b17375471a56f709691250 100644 (file)
@@ -265,11 +265,60 @@ int main(int argc, char *argv[])
     struct stat dir_info;      /* directory info holder     */
     struct stat prg_info;      /* program info holder       */
 
+    prog = argv[0];
+    /*
+     * Check existence/validity of the UID of the user
+     * running this program.  Error out if invalid.
+     */
+    uid = getuid();
+    if ((pw = getpwuid(uid)) == NULL) {
+       log_err("crit: invalid uid: (%ld)\n", uid);
+       exit(102);
+    }
+    /*
+     * See if this is a 'how were you compiled' request, and
+     * comply if so.
+     */
+    if ((argc > 1)
+        && (! strcmp(argv[1], "-V"))
+        && ((uid == 0)
+#ifdef _OSD_POSIX
+        /* User name comparisons are case insensitive on BS2000/OSD */
+            || (! strcasecmp(AP_HTTPD_USER, pw->pw_name)))
+#else  /* _OSD_POSIX */
+            || (! strcmp(AP_HTTPD_USER, pw->pw_name)))
+#endif /* _OSD_POSIX */
+        ) {
+#ifdef AP_DOC_ROOT
+        fprintf(stderr, " -D AP_DOC_ROOT=\"%s\"\n", AP_DOC_ROOT);
+#endif
+#ifdef AP_GID_MIN
+        fprintf(stderr, " -D AP_GID_MID=%d\n", AP_GID_MIN);
+#endif
+#ifdef AP_HTTPD_USER
+        fprintf(stderr, " -D AP_HTTPD_USER=\"%s\"\n", AP_HTTPD_USER);
+#endif
+#ifdef AP_LOG_EXEC
+        fprintf(stderr, " -D AP_LOG_EXEC=\"%s\"\n", AP_LOG_EXEC);
+#endif
+#ifdef SAFE_PATH
+        fprintf(stderr, " -D SAFE_PATH=\"%s\"\n", SAFE_PATH);
+#endif
+#ifdef SUEXEC_UMASK
+        fprintf(stderr, " -D SUEXEC_UMASK=%03o\n", SUEXEC_UMASK);
+#endif
+#ifdef AP_UID_MIN
+        fprintf(stderr, " -D AP_UID_MID=%d\n", AP_UID_MIN);
+#endif
+#ifdef AP_USERDIR_SUFFIX
+        fprintf(stderr, " -D AP_USERDIR_SUFFIX=\"%s\"\n", AP_USERDIR_SUFFIX);
+#endif
+        exit(0);
+    }
     /*
      * If there are a proper number of arguments, set
      * all of them to variables.  Otherwise, error out.
      */
-    prog = argv[0];
     if (argc < 4) {
        log_err("too few arguments\n");
        exit(101);
@@ -278,16 +327,6 @@ int main(int argc, char *argv[])
     target_gname = argv[2];
     cmd = argv[3];
 
-    /*
-     * Check existence/validity of the UID of the user
-     * running this program.  Error out if invalid.
-     */
-    uid = getuid();
-    if ((pw = getpwuid(uid)) == NULL) {
-       log_err("invalid uid: (%ld)\n", uid);
-       exit(102);
-    }
-
     /*
      * Check to see if the user running this program
      * is the user allowed to do so as defined in