cvs commit: apachen/src/main http_log.c http_log.h

1998-01-04 Thread pcs
pcs 98/01/04 08:35:29

  Modified:src/main http_log.c http_log.h
  Log:
  Fix removing errno from APLOG_WIN32ERROR error messages.
  
  Revision  ChangesPath
  1.46  +5 -1  apachen/src/main/http_log.c
  
  Index: http_log.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_log.c,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- http_log.c1998/01/03 00:18:38 1.45
  +++ http_log.c1998/01/04 16:35:28 1.46
  @@ -315,7 +315,11 @@
len += ap_snprintf(errstr + len, sizeof(errstr) - len,
%s(%d): , file, line);
   }
  -if (!(level  APLOG_NOERRNO)) {
  +if (!(level  APLOG_NOERRNO)
  +#ifdef WIN32
  +  !(level  APLOG_WIN32ERROR)
  +#endif
  + ) {
len += ap_snprintf(errstr + len, sizeof(errstr) - len,
(%d)%s: , save_errno, strerror(save_errno));
   }
  
  
  
  1.22  +1 -1  apachen/src/main/http_log.h
  
  Index: http_log.h
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_log.h,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- http_log.h1998/01/04 14:21:55 1.21
  +++ http_log.h1998/01/04 16:35:28 1.22
  @@ -84,7 +84,7 @@
   #ifdef WIN32
   /* Set to indicate that error msg should come from Win32's GetLastError(),
* not errno. */
  -#define APLOG_WIN32ERROR ((APLOG_LEVELMASK+1) * 2|APLOG_NOERRNO)
  +#define APLOG_WIN32ERROR ((APLOG_LEVELMASK+1) * 2)
   #endif
   
   #ifndef DEFAULT_LOGLEVEL
  
  
  


cvs commit: apachen/src/main http_log.c

1998-01-04 Thread pcs
pcs 98/01/04 09:03:19

  Modified:src/main http_log.c
  Log:
  Correct  into a 
  
  Revision  ChangesPath
  1.47  +1 -1  apachen/src/main/http_log.c
  
  Index: http_log.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_log.c,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- http_log.c1998/01/04 16:35:28 1.46
  +++ http_log.c1998/01/04 17:03:18 1.47
  @@ -317,7 +317,7 @@
   }
   if (!(level  APLOG_NOERRNO)
   #ifdef WIN32
  -  !(level  APLOG_WIN32ERROR)
  +  !(level  APLOG_WIN32ERROR)
   #endif
) {
len += ap_snprintf(errstr + len, sizeof(errstr) - len,
  
  
  


cvs commit: apachen/src/main http_log.c

1998-01-03 Thread dgaudet
dgaudet 98/01/02 16:18:40

  Modified:src  CHANGES
   src/main http_log.c
  Log:
  Fix buffer overrun in log_printf().
  
  Reviewed by:  Randy Terbush
  
  Revision  ChangesPath
  1.557 +4 -0  apachen/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /export/home/cvs/apachen/src/CHANGES,v
  retrieving revision 1.556
  retrieving revision 1.557
  diff -u -r1.556 -r1.557
  --- CHANGES   1998/01/02 23:58:26 1.556
  +++ CHANGES   1998/01/03 00:18:31 1.557
  @@ -1,5 +1,9 @@
   Changes with Apache 1.3b4
   
  +  *) The aplog_error changes specific to 1.3 introduced a buffer
  + overrun in the (now legacy) log_printf function.  Fixed.
  + [Dean Gaudet]
  +
 *) mod_digest didn't properly deal with proxy authentication.  It
also lacked a case-insensitive comparision of the Digest
token.  [Ronald Tschalaer [EMAIL PROTECTED]] PR#1599
  
  
  
  1.45  +1 -1  apachen/src/main/http_log.c
  
  Index: http_log.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_log.c,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- http_log.c1997/12/07 15:47:59 1.44
  +++ http_log.c1998/01/03 00:18:38 1.45
  @@ -413,7 +413,7 @@
   va_list args;
   
   va_start(args, fmt);
  -vsprintf(buf, fmt, args);
  +ap_vsnprintf(buf, sizeof(buf), fmt, args);
   aplog_error(APLOG_MARK, APLOG_ERR, s, buf);
   va_end(args);
   }
  
  
  


cvs commit: apachen/src/main http_log.c http_log.h

1997-12-07 Thread pcs
pcs 97/12/07 07:48:01

  Modified:src/main http_log.c http_log.h
  Log:
  The current aplog_error() function cannot report on errors returned by
  Win32 functions. These functions do not bother setting errno - instead,
  you have to make a call to GetLastError() to get the error code, then call
  FormatMessage() to get the corresponding string. I already added code to
  do this in os/win32/service.c, but this was specific to reporting errors
  to standard error during apache -i or -u calls.
  
  The patch below updates aplog_error() to enable generic logging of
  Win32 errors to the same place as other errors. It adds a new flag,
  APLOG_WIN32ERROR which if given in the _second_ argument to aplog_error()
  causes the Win32 error code and error string to be logged. Here is an
  example call (this is from worker_main()):
  
  if (SetEvent(ev[i]) == 0)
  aplog_error(APLOG_MARK,APLOG_WIN32ERROR, server_conf,
  SetEvent for child process in slot #%d, i);
  
  Reviewed by:  Ben Laurie, Martin Kraemer
  
  Revision  ChangesPath
  1.44  +43 -0 apachen/src/main/http_log.c
  
  Index: http_log.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_log.c,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- http_log.c1997/11/06 21:54:08 1.43
  +++ http_log.c1997/12/07 15:47:59 1.44
  @@ -319,6 +319,49 @@
len += ap_snprintf(errstr + len, sizeof(errstr) - len,
(%d)%s: , save_errno, strerror(save_errno));
   }
  +#ifdef WIN32
  +if (level  APLOG_WIN32ERROR) {
  + int nChars;
  + int nErrorCode;
  +
  + nErrorCode = GetLastError();
  + len += ap_snprintf(errstr + len, sizeof(errstr) - len,
  + (%d), nErrorCode);
  +
  + nChars = FormatMessage( 
  + FORMAT_MESSAGE_FROM_SYSTEM,
  + NULL,
  + nErrorCode,
  + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
  + (LPTSTR) errstr + len,
  + sizeof(errstr) - len,
  + NULL 
  + );
  + len += nChars;
  + if (nChars == 0) {
  + /* Um, error occurred, but we can't recurse to log it again
  +  * (and it would probably only fail anyway), so lets just
  +  * log the numeric value.
  +  */
  + nErrorCode = GetLastError();
  + len += ap_snprintf(errstr + len, sizeof(errstr) - len,
  + (FormatMessage failed with code %d): , nErrorCode);
  + }
  + else {
  + /* FormatMessage put the message in the buffer, but it may
  +  * have appended a newline (\r\n). So remove it and use
  +  * :  instead like the Unix errors. The error may also
  +  * end with a . before the return - if so, trash it.
  +  */
  + if (len  1  errstr[len-2] == '\r'  errstr[len-1] == '\n') {
  + if (len  2  errstr[len-3] == '.')
  + len--;
  + errstr[len-2] = ':';
  + errstr[len-1] = ' ';
  + }
  + }
  +}
  +#endif
   
   va_start(args, fmt);
   len += ap_vsnprintf(errstr + len, sizeof(errstr) - len, fmt, args);
  
  
  
  1.20  +5 -0  apachen/src/main/http_log.h
  
  Index: http_log.h
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_log.h,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- http_log.h1997/10/22 20:29:39 1.19
  +++ http_log.h1997/12/07 15:48:00 1.20
  @@ -81,6 +81,11 @@
   #endif
   
   #define APLOG_NOERRNO(APLOG_LEVELMASK + 1)
  +#ifdef WIN32
  +/* Set to indicate that error msg should come from Win32's GetLastError(),
  + * not errno. */
  +#define APLOG_WIN32ERROR ((APLOG_LEVELMASK+1) * 2)
  +#endif
   
   #ifndef DEFAULT_LOGLEVEL
   #define DEFAULT_LOGLEVEL APLOG_ERR
  
  
  


cvs commit: apachen/src/main http_log.c http_log.h http_main.c

1997-10-05 Thread Roy Fielding
fielding97/10/05 00:47:48

  Modified:src  CHANGES
   src/main http_log.c http_log.h http_main.c
  Log:
  Reduce what is written by aplog_error() by excluding filename if it
  is NULL, line number if it is -, and errno if the new APLOG_NOERRNO bit
  is set in level parameter.  Do it all with a lot less string copying --
  use snprintf incrementally to build up the entire buffer.
  When server_conf is NULL use stderr, since that is necessary to do some
  things during startup and other odd cases (i.e. SEGV).
  Fixed a buffer overflow with syslog stuff using sprintf().
  
  Submitted by: Ken Coar and Dean Gaudet
  Reviewed by:  Roy Fielding
  
  Revision  ChangesPath
  1.457 +3 -0  apachen/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /export/home/cvs/apachen/src/CHANGES,v
  retrieving revision 1.456
  retrieving revision 1.457
  diff -u -r1.456 -r1.457
  --- CHANGES   1997/10/05 02:22:22 1.456
  +++ CHANGES   1997/10/05 07:47:41 1.457
  @@ -168,6 +168,9 @@
on a per-server basis using the LogLevel directive. Conversion
of log_*() in progress. [Randy Terbush]
   
  +  *) Further enhance aplog_error() to not log filename, line number, and
  + errno information when it isn't applicable. [Ken Coar, Dean Gaudet]
  +
 *) Canonicalise filenames under Win32. Short filenames are
converted to long ones. Backslashes are converted to forward
slashes. Case is converted to lower. Parts of URLs that do not
  
  
  
  1.36  +37 -29apachen/src/main/http_log.c
  
  Index: http_log.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_log.c,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- http_log.c1997/10/02 05:10:34 1.35
  +++ http_log.c1997/10/05 07:47:45 1.36
  @@ -280,48 +280,56 @@
   va_list args;
   char errstr[MAX_STRING_LEN];
   static TRANS *pname = priorities;
  -
  +size_t len;
  +int save_errno = errno;
  +FILE *logf;
   
  -if (level  s-loglevel)
  +if (s  (level  APLOG_LEVELMASK)  s-loglevel)
return;
   
  -switch (s-loglevel) {
  -case APLOG_DEBUG:
  - ap_snprintf(errstr, sizeof(errstr), [%s] %d: %s: %s: %d: ,
  - pname[level].t_name, errno, strerror(errno), file, line);
  - break;
  -case APLOG_EMERG:
  -case APLOG_CRIT:
  -case APLOG_ALERT:
  - ap_snprintf(errstr, sizeof(errstr), [%s] %d: %s: ,
  - pname[level].t_name, errno, strerror(errno));
  - break;
  -case APLOG_INFO:
  -case APLOG_ERR:
  -case APLOG_WARNING:
  -case APLOG_NOTICE:
  - ap_snprintf(errstr, sizeof(errstr), [%s] , pname[level].t_name);
  - break;
  +if (!s) {
  + logf = stderr;
  +} else if (s  s-error_log) {
  + logf = s-error_log;
  +} else {
  + logf = NULL;
  +}
  +
  +if (logf) {
  + len = ap_snprintf(errstr, sizeof(errstr), [%s] , get_time());
  +} else {
  + len = 0;
  +}
  +
  +len += ap_snprintf(errstr + len, sizeof(errstr) - len,
  + [%s] , pname[level  APLOG_LEVELMASK].t_name);
  +
  +if (!(level  APLOG_NOERRNO)) {
  + len += ap_snprintf(errstr + len, sizeof(errstr) - len,
  + %d: %s: , save_errno, strerror(save_errno));
   }
  - 
  +if (file  (level  APLOG_LEVELMASK) == APLOG_DEBUG) {
  + len += ap_snprintf(errstr + len, sizeof(errstr) - len,
  + %s: %d: , file, line);
  +}
  +
   va_start(args, fmt);
  +len += ap_vsnprintf(errstr + len, sizeof(errstr) - len, fmt, args);
  +va_end(args);
   
   /* NULL if we are logging to syslog */
  -if (s-error_log) {
  - fprintf(s-error_log, [%s] %s, get_time(), errstr);
  - vfprintf(s-error_log, fmt, args);
  - fprintf(s-error_log, \n);
  - fflush(s-error_log);
  +if (logf) {
  + fputs(errstr, logf);
  + fputc('\n', logf);
  + fflush(logf);
   }
   #ifdef HAVE_SYSLOG
   else {
  - vsprintf(errstr + strlen(errstr), fmt, args);
  - syslog(level, %s, errstr);
  + syslog(level  APLOG_LEVELMASK, %s, errstr);
   }
   #endif
  -
  -va_end(args);
   }
  +
   
   void log_pid (pool *p, char *pid_fname)
   {
  
  
  
  1.14  +2 -0  apachen/src/main/http_log.h
  
  Index: http_log.h
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_log.h,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- http_log.h1997/09/12 20:13:08 1.13
  +++ http_log.h1997/10/05 07:47:45 1.14
  @@ -59,6 +59,8 @@
   #define  APLOG_INFO  6   /* informational */
   #define  APLOG_DEBUG 7   /* debug-level messages */
   #define DEFAULT_LOGLEVEL APLOG_ERR
  

cvs commit: apachen/src/main http_log.c

1997-09-09 Thread Randy Terbush
randy   97/09/09 19:35:39

  Modified:src/main http_log.c
  Log:
  Attempt to make syslog support more portable as suggested by Alexei.
  
  Revision  ChangesPath
  1.32  +34 -0 apachen/src/main/http_log.c
  
  Index: http_log.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_log.c,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- http_log.c1997/08/31 22:14:07 1.31
  +++ http_log.c1997/09/10 02:35:37 1.32
  @@ -75,26 +75,60 @@
   #ifdef LOG_AUTHPRIV
   {authpriv,LOG_AUTHPRIV},
   #endif
  +#ifdef LOG_CRON
   {cron, LOG_CRON},
  +#endif
  +#ifdef LOG_DAEMON
   {daemon,   LOG_DAEMON},
  +#endif
   #ifdef LOG_FTP
   {ftp,  LOG_FTP},
   #endif
  +#ifdef LOG_KERN
   {kern, LOG_KERN},
  +#endif
  +#ifdef LOG_LPR
   {lpr,  LOG_LPR},
  +#endif
  +#ifdef LOG_MAIL
   {mail, LOG_MAIL},
  +#endif
  +#ifdef LOG_NEWS
   {news, LOG_NEWS},
  +#endif
  +#ifdef LOG_SYSLOG
   {syslog,   LOG_SYSLOG},
  +#endif
  +#ifdef LOG_USER
   {user, LOG_USER},
  +#endif
  +#ifdef LOG_UUCP
   {uucp, LOG_UUCP},
  +#endif
  +#ifdef LOG_LOCAL0
   {local0,   LOG_LOCAL0},
  +#endif
  +#ifdef LOG_LOCAL1
   {local1,   LOG_LOCAL1},
  +#endif
  +#ifdef LOG_LOCAL2
   {local2,   LOG_LOCAL2},
  +#endif
  +#ifdef LOG_LOCAL3
   {local3,   LOG_LOCAL3},
  +#endif
  +#ifdef LOG_LOCAL4
   {local4,   LOG_LOCAL4},
  +#endif
  +#ifdef LOG_LOCAL5
   {local5,   LOG_LOCAL5},
  +#endif
  +#ifdef LOG_LOCAL6
   {local6,   LOG_LOCAL6},
  +#endif
  +#ifdef LOG_LOCAL7
   {local7,   LOG_LOCAL7},
  +#endif
   {NULL,   -1},
   };
   #endif
  
  
  


cvs commit: apachen/src/main http_log.c

1997-08-31 Thread Randy Terbush
randy   97/08/31 15:14:09

  Modified:src/main http_log.c
  Log:
  Fix a warning.
  
  Revision  ChangesPath
  1.31  +0 -1  apachen/src/main/http_log.c
  
  Index: http_log.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_log.c,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- http_log.c1997/08/31 21:28:51 1.30
  +++ http_log.c1997/08/31 22:14:07 1.31
  @@ -160,7 +160,6 @@
   
   #ifdef HAVE_SYSLOG
   else if (!strncasecmp(s-error_fname, syslog, 6)) {
  - register TRANS *fac;
if ((fname = strchr(s-error_fname, ':'))) {
fname++;
for (fac = facilities; fac-t_name; fac++) {
  
  
  


cvs commit: apachen/src/main http_log.c

1997-08-27 Thread Randy Terbush
randy   97/08/27 08:49:14

  Modified:src/main http_log.c
  Log:
  
  
  Revision  ChangesPath
  1.28  +1 -0  apachen/src/main/http_log.c
  
  Index: http_log.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_log.c,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- http_log.c1997/08/27 14:22:07 1.27
  +++ http_log.c1997/08/27 15:49:13 1.28
  @@ -246,6 +246,7 @@
   if (s-error_log) {
fprintf(s-error_log, [%s] %s, get_time(), errstr);
vfprintf(s-error_log, fmt, args);
  + fprintf(s-error_log, \n);
fflush(s-error_log);
   }
   #ifdef HAVE_SYSLOG
  
  
  


cvs commit: apachen/src/main http_log.c

1997-08-25 Thread Dean Gaudet
dgaudet 97/08/25 01:24:16

  Modified:src/main http_log.c
  Log:
  not everything has LOG_FTP
  
  Revision  ChangesPath
  1.23  +2 -0  apachen/src/main/http_log.c
  
  Index: http_log.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_log.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- http_log.c1997/08/25 02:00:40 1.22
  +++ http_log.c1997/08/25 08:24:15 1.23
  @@ -72,7 +72,9 @@
   {authpriv,LOG_AUTHPRIV},
   {cron, LOG_CRON},
   {daemon,   LOG_DAEMON},
  +#ifdef LOG_FTP
   {ftp,  LOG_FTP},
  +#endif
   {kern, LOG_KERN},
   {lpr,  LOG_LPR},
   {mail, LOG_MAIL},
  
  
  


cvs commit: apachen/src/main http_log.c

1997-08-25 Thread Rodent of Unusual Size
coar97/08/25 07:26:31

  Modified:src/main http_log.c
  Log:
#ifdef LOG_AUTHPRIV, since it isn't available on Digital UNIX 3.2.
  
  Revision  ChangesPath
  1.24  +2 -0  apachen/src/main/http_log.c
  
  Index: http_log.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_log.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- http_log.c1997/08/25 08:24:15 1.23
  +++ http_log.c1997/08/25 14:26:29 1.24
  @@ -69,7 +69,9 @@
   
   static TRANS facilities[] = {
   {auth, LOG_AUTH},
  +#ifdef LOG_AUTHPRIV
   {authpriv,LOG_AUTHPRIV},
  +#endif
   {cron, LOG_CRON},
   {daemon,   LOG_DAEMON},
   #ifdef LOG_FTP
  
  
  


cvs commit: apachen/src/main http_log.c

1997-08-25 Thread Randy Terbush
randy   97/08/25 07:53:41

  Modified:src/main http_log.c
  Log:
  Comment out syslog support temporarily until I can come up with a more
  portable option.
  
  Revision  ChangesPath
  1.25  +2 -0  apachen/src/main/http_log.c
  
  Index: http_log.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_log.c,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- http_log.c1997/08/25 14:26:29 1.24
  +++ http_log.c1997/08/25 14:53:39 1.25
  @@ -248,12 +248,14 @@
vfprintf(r-server-error_log, fmt, args);
fflush(r-server-error_log);
   }
  +#ifdef NOTYET
   else {
if (errstr)
syslog(level, %s, errstr);
   
vsyslog(level, fmt, args);
   }
  +#endif
   
   va_end(args);
   }