httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n.@apache.org
Subject cvs commit: httpd-2.0/support suexec.c
Date Mon, 10 Feb 2003 03:37:23 GMT
nd          2003/02/09 19:37:23

  Modified:    .        CHANGES
               support  suexec.c
  Log:
  Let suexec send a message to stderr, if it failed or its policy
  was violated. This message appears in the error log and allows
  for easier debugging.
  
  PR: 10773
  Proposed again by: Joshua Slive
  
  Revision  Changes    Path
  1.1056    +4 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.1055
  retrieving revision 1.1056
  diff -u -r1.1055 -r1.1056
  --- CHANGES	7 Feb 2003 22:03:47 -0000	1.1055
  +++ CHANGES	10 Feb 2003 03:37:22 -0000	1.1056
  @@ -2,6 +2,10 @@
   
     [Remove entries to the current 2.0 section below, when backported]
   
  +  *) Let suexec send a message to stderr, if it failed or its policy
  +     was violated. This message appears in the error log and allows
  +     for easier debugging. PR 10773.  [André Malo]
  +
     *) Try to log an error if a piped log program fails.  Try to
        restart a piped log program in more failure situations.  PR 15761
        [Jeff Trawick]
  
  
  
  1.23      +24 -7     httpd-2.0/support/suexec.c
  
  Index: suexec.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/support/suexec.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- suexec.c	3 Feb 2003 17:53:27 -0000	1.22
  +++ suexec.c	10 Feb 2003 03:37:22 -0000	1.23
  @@ -170,7 +170,7 @@
   };
   
   
  -static void err_output(const char *fmt, va_list ap)
  +static void err_output(int is_error, const char *fmt, va_list ap)
   {
   #ifdef AP_LOG_EXEC
       time_t timevar;
  @@ -178,12 +178,17 @@
   
       if (!log) {
           if ((log = fopen(AP_LOG_EXEC, "a")) == NULL) {
  -            fprintf(stderr, "failed to open log file\n");
  +            fprintf(stderr, "suexec failure: could not open log file\n");
               perror("fopen");
               exit(1);
           }
       }
   
  +    if (is_error) {
  +        fprintf(stderr, "suexec policy violation: see suexec log for more "
  +                        "details\n");
  +    }
  +
       time(&timevar);
       lt = localtime(&timevar);
   
  @@ -204,7 +209,19 @@
       va_list ap;
   
       va_start(ap, fmt);
  -    err_output(fmt, ap);
  +    err_output(1, fmt, ap); /* 1 == is_error */
  +    va_end(ap);
  +#endif /* AP_LOG_EXEC */
  +    return;
  +}
  +
  +static void log_no_err(const char *fmt,...)
  +{
  +#ifdef AP_LOG_EXEC
  +    va_list ap;
  +
  +    va_start(ap, fmt);
  +    err_output(0, fmt, ap); /* 0 == !is_error */
       va_end(ap);
   #endif /* AP_LOG_EXEC */
       return;
  @@ -441,10 +458,10 @@
        * Log the transaction here to be sure we have an open log 
        * before we setuid().
        */
  -    log_err("uid: (%s/%s) gid: (%s/%s) cmd: %s\n",
  -            target_uname, actual_uname,
  -            target_gname, actual_gname,
  -            cmd);
  +    log_no_err("uid: (%s/%s) gid: (%s/%s) cmd: %s\n",
  +               target_uname, actual_uname,
  +               target_gname, actual_gname,
  +               cmd);
   
       /*
        * Error out if attempt is made to execute as root or as
  
  
  

Mime
View raw message