]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Add -V option to suexec, to list compile-time settings with
authorKen Coar <coar@apache.org>
Thu, 8 Mar 2001 18:11:48 +0000 (18:11 +0000)
committerKen Coar <coar@apache.org>
Thu, 8 Mar 2001 18:11:48 +0000 (18:11 +0000)
which it was built.  Only usable by root and the HTTPD_USER.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@88475 13f79535-47bb-0310-9956-ffa450edef68

src/CHANGES
src/support/suexec.8
src/support/suexec.c

index 3736fc9cff314ae99ababad8ac692221fcd26cbd..99bcc3808372900c5e86ce65c64bab8484e9ea1d 100644 (file)
@@ -1,5 +1,9 @@
 Changes with Apache 1.3.20
 
+  *) 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 HTTPD_USER username.)  [Ken Coar]
+
   *) Set the Win32 service description in the Services control panel to 
      the server_version string from Apache and the loaded modules.
      [William Rowe]
index ad1f7a07593fa318e360dd1ca6ac6b5814e1aed3..1d95c0fc1230f5ba2d0dec7489ea01aa247810d9 100644 (file)
@@ -1,4 +1,4 @@
-.TH suexec 8 "March 1998"
+.TH suexec 8 "March 2001"
 .\" ====================================================================
 .\" The Apache Software License, Version 1.1
 .\"
 .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://httpd.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 2e3ff4e3de9fd4ab184419e6be638f06efb12640..d4330d721c121ea924135377d936d9b2f462d576 100644 (file)
@@ -268,11 +268,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(HTTPD_USER, pw->pw_name)))
+#else  /* _OSD_POSIX */
+            || (! strcmp(HTTPD_USER, pw->pw_name)))
+#endif /* _OSD_POSIX */
+        ) {
+#ifdef DOC_ROOT
+        fprintf(stderr, " -D DOC_ROOT=\"%s\"\n", DOC_ROOT);
+#endif
+#ifdef GID_MIN
+        fprintf(stderr, " -D GID_MID=%d\n", GID_MIN);
+#endif
+#ifdef HTTPD_USER
+        fprintf(stderr, " -D HTTPD_USER=\"%s\"\n", HTTPD_USER);
+#endif
+#ifdef LOG_EXEC
+        fprintf(stderr, " -D LOG_EXEC=\"%s\"\n", 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 UID_MIN
+        fprintf(stderr, " -D UID_MID=%d\n", UID_MIN);
+#endif
+#ifdef USERDIR_SUFFIX
+        fprintf(stderr, " -D USERDIR_SUFFIX=\"%s\"\n", 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("alert: too few arguments\n");
        exit(101);
@@ -281,16 +330,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("crit: 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