cvs commit: apachen/src/main http_config.c util.c

1998-01-21 Thread dgaudet
dgaudet 98/01/21 14:11:04

  Modified:src  CHANGES
   src/main http_config.c util.c
  Log:
  Clean up the -C/-c implementation.
  
  Submitted by: Martin Kraemer
  Reviewed by:  Dean Gaudet, Doug MacEachern, Jim Jagielski
  
  Revision  ChangesPath
  1.577 +1 -1  apachen/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /export/home/cvs/apachen/src/CHANGES,v
  retrieving revision 1.576
  retrieving revision 1.577
  diff -u -r1.576 -r1.577
  --- CHANGES   1998/01/21 22:05:43 1.576
  +++ CHANGES   1998/01/21 22:10:59 1.577
  @@ -78,7 +78,7 @@
-c directive : process directive after reading config files
example:
httpd -C PerlModule Apache::httpd_conf
  - [Doug MacEachern]
  + [Doug MacEachern, Martin Kraemer]
   
 *) WIN32: Fix the execution of CGIs that are scripts and called 
with path info that does not have an '=' in.
  
  
  
  1.94  +54 -21apachen/src/main/http_config.c
  
  Index: http_config.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_config.c,v
  retrieving revision 1.93
  retrieving revision 1.94
  diff -u -r1.93 -r1.94
  --- http_config.c 1998/01/13 23:11:09 1.93
  +++ http_config.c 1998/01/21 22:11:01 1.94
  @@ -908,40 +908,73 @@
   return make_full_path(p, server_root, file);
   }
   
  +
  +/* This structure and the following functions are needed for the
  + * table-based config file reading. They are passed to the
  + * cfg_open_custom() routine.
  + */
  +
  +/* Structure to be passed to cfg_open_custom(): it contains an
  + * index which is incremented from 0 to nelts on each call to
  + * cfg_getline() (which in turn calls arr_elts_getstr())
  + * and an array_header pointer for the string array.
  + */
  +typedef struct {
  +array_header *array;
  +int curr_idx;
  +} arr_elts_param_t;
  +
  +
  +/* arr_elts_getstr() returns the next line from the string array. */
  +static void *arr_elts_getstr(void *buf, size_t bufsiz, void *param)
  +{
  +arr_elts_param_t *arr_param = (arr_elts_param_t *) param;
  +
  +/* End of array reached? */
  +if (++arr_param-curr_idx  arr_param-array-nelts)
  +return NULL;
  +
  +/* return the line */
  +ap_cpystrn(buf, ((char **) arr_param-array-elts)[arr_param-curr_idx - 
1], bufsiz);
  +
  +return buf;
  +}
  +
  +
  +/* arr_elts_close(): dummy close routine (makes sure no more lines can be 
read) */
  +static int arr_elts_close(void *param)
  +{
  +arr_elts_param_t *arr_param = (arr_elts_param_t *) param;
  +arr_param-curr_idx = arr_param-array-nelts;
  +return 0;
  +}
  +
   void process_command_config(server_rec *s, array_header *arr, pool *p, pool 
*ptemp)
   {
   const char *errmsg;
   cmd_parms parms;
  -int i;
  -char **lines = (char **)arr-elts;
  +arr_elts_param_t arr_parms;
  +
  +arr_parms.curr_idx = 0;
  +arr_parms.array = arr;
   
   parms = default_parms;
   parms.pool = p;
   parms.temp_pool = ptemp;
   parms.server = s;
   parms.override = (RSRC_CONF | OR_ALL)  ~(OR_AUTHCFG | OR_LIMIT);
  -parms.config_file = pcfg_openfile(p, NULL);
  +parms.config_file = pcfg_open_custom(p, -c/-C directives,
  + arr_parms, NULL,
  + arr_elts_getstr, arr_elts_close);
   
  -for (i = 0; i  arr-nelts; ++i) {
  - char *line = lines[i];
  +errmsg = srm_command_loop(parms, s-lookup_defaults);
   
  -#ifdef MOD_PERL
  - if(!(strncmp(line, PerlModule , 11))) {
  - const char *perl_cmd_module(cmd_parms *parms, void *dummy, char 
*arg);
  - line += 11;
  - (void)perl_cmd_module(parms, s-lookup_defaults, line);
  - continue;
  - }
  -#endif
  - 
  - errmsg = handle_command(parms, s-lookup_defaults, line);
  -
  - if (errmsg) {
  - fprintf(stderr, Syntax error in command: `%s'\n, lines[i]);
  - fprintf(stderr, %s\n, errmsg);
  - exit(1);
  - }
  +if (errmsg) {
  +fprintf(stderr, Syntax error in -C/-c directive:\n%s\n, errmsg);
  +exit(1);
   }
  +
  +cfg_closefile(parms.config_file);
   }
   
   void process_resource_config(server_rec *s, char *fname, pool *p, pool 
*ptemp)
  
  
  
  1.89  +33 -16apachen/src/main/util.c
  
  Index: util.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/util.c,v
  retrieving revision 1.88
  retrieving revision 1.89
  diff -u -r1.88 -r1.89
  --- util.c1998/01/20 01:48:47 1.88
  +++ util.c1998/01/21 22:11:02 1.89
  @@ -674,26 +674,43 @@
   {
   configfile_t *new_cfg;
   FILE *file;
  +#ifdef unvoted_DISALLOW_DEVICE_ACCESS
  +struct stat stbuf;
  +#endif
  +
  +if (name == 

cvs commit: apachen/src/main http_config.c

1997-12-16 Thread dgaudet
dgaudet 97/12/15 23:36:31

  Modified:src/main http_config.c
  Log:
  Yet another 64-bit tweak like all the others... I'm too lazy to post it and
  wait for votes.
  
  Revision  ChangesPath
  1.89  +1 -1  apachen/src/main/http_config.c
  
  Index: http_config.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_config.c,v
  retrieving revision 1.88
  retrieving revision 1.89
  diff -u -r1.88 -r1.89
  --- http_config.c 1997/12/14 14:39:37 1.88
  +++ http_config.c 1997/12/16 07:36:30 1.89
  @@ -876,7 +876,7 @@
  This allows .htaccess to be independent of server_root,
  so the server can be moved or mirrored with less pain.  */
   char *p;
  -int offset = (int) cmd-info;
  +int offset = (int) (long) cmd-info;
   if (os_is_path_absolute(arg))
p = pstrdup(cmd-pool, arg);
   else
  
  
  


cvs commit: apachen/src/main http_config.c

1997-12-14 Thread ben
ben 97/12/14 06:39:38

  Modified:src  CHANGES
   src/main http_config.c
  Log:
  Make set_file_slot() use os_is_path_absolute().
  PR: 1511
  
  Revision  ChangesPath
  1.527 +3 -0  apachen/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /export/home/cvs/apachen/src/CHANGES,v
  retrieving revision 1.526
  retrieving revision 1.527
  diff -u -r1.526 -r1.527
  --- CHANGES   1997/12/14 14:26:11 1.526
  +++ CHANGES   1997/12/14 14:39:35 1.527
  @@ -1,5 +1,8 @@
   Changes with Apache 1.3b4
   
  +  *) WIN32: set_file_slot() didn't detect absolute paths. [Ben Laurie]
  + PR#1511
  +
 *) WIN32: mod_status display header didn't match fields. [Ben Laurie]
   
 *) The pthread_mutex_* functions return an error code, and don't
  
  
  
  1.88  +1 -1  apachen/src/main/http_config.c
  
  Index: http_config.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_config.c,v
  retrieving revision 1.87
  retrieving revision 1.88
  diff -u -r1.87 -r1.88
  --- http_config.c 1997/11/29 05:51:52 1.87
  +++ http_config.c 1997/12/14 14:39:37 1.88
  @@ -877,7 +877,7 @@
  so the server can be moved or mirrored with less pain.  */
   char *p;
   int offset = (int) cmd-info;
  -if (*arg == '/')
  +if (os_is_path_absolute(arg))
p = pstrdup(cmd-pool, arg);
   else
p = make_full_path(cmd-pool, server_root, arg);
  
  
  


cvs commit: apachen/src/main http_config.c

1997-11-29 Thread dgaudet
dgaudet 97/11/28 21:51:53

  Modified:src/main http_config.c
  Log:
  style tweaks
  
  Revision  ChangesPath
  1.87  +2 -2  apachen/src/main/http_config.c
  
  Index: http_config.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_config.c,v
  retrieving revision 1.86
  retrieving revision 1.87
  diff -u -r1.86 -r1.87
  --- http_config.c 1997/11/27 16:10:45 1.86
  +++ http_config.c 1997/11/29 05:51:52 1.87
  @@ -811,7 +811,7 @@
else {
void *mconfig = get_module_config(config, mod);
void *sconfig =
  - get_module_config(parms-server-module_config, mod);
  + get_module_config(parms-server-module_config, mod);
   
if (!mconfig  mod-create_dir_config) {
mconfig = (*mod-create_dir_config) (parms-pool, parms-path);
  @@ -840,7 +840,7 @@
const char *errmsg = handle_command(parms, config, l);
   if (errmsg) {
return errmsg;
  -}
  + }
   }
   
   return NULL;
  
  
  


cvs commit: apachen/src/main http_config.c

1997-11-27 Thread coar
coar97/11/27 08:10:46

  Modified:src/main http_config.c
  Log:
Enhance the unknown directive error message to indicate some
reasons *why* it might be invalid.
  
  PR:   1479, 1480, and lots of others
  Reviewed by:  Dean Gaudet, Martin Kraemer
  
  Revision  ChangesPath
  1.86  +3 -2  apachen/src/main/http_config.c
  
  Index: http_config.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_config.c,v
  retrieving revision 1.85
  retrieving revision 1.86
  diff -u -r1.85 -r1.86
  --- http_config.c 1997/11/06 20:40:42 1.85
  +++ http_config.c 1997/11/27 16:10:45 1.86
  @@ -804,8 +804,9 @@
   do {
if (!(cmd = find_command_in_modules(cmd_name, mod))) {
   errno = EINVAL;
  -return pstrcat(parms-pool, Invalid command ', cmd_name, ',
  -   NULL);
  +return pstrcat(parms-pool, Invalid command ', cmd_name,
  +   ', perhaps mis-spelled or defined by a module 
  +   not included in the server configuration, NULL);
}
else {
void *mconfig = get_module_config(config, mod);
  
  
  


cvs commit: apachen/src/main http_config.c

1997-11-06 Thread coar
coar97/11/06 12:40:43

  Modified:src/main http_config.c
  Log:
Set errno to something reasonable when reporting an invalid
directive.
  
  Reviewed by:  Dean Gaudet, Jim Jagielski, Martin Kraemer
  
  Revision  ChangesPath
  1.85  +8 -4  apachen/src/main/http_config.c
  
  Index: http_config.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_config.c,v
  retrieving revision 1.84
  retrieving revision 1.85
  diff -u -r1.84 -r1.85
  --- http_config.c 1997/10/26 20:19:37 1.84
  +++ http_config.c 1997/11/06 20:40:42 1.85
  @@ -803,7 +803,9 @@
   
   do {
if (!(cmd = find_command_in_modules(cmd_name, mod))) {
  - return pstrcat(parms-pool, Invalid command , cmd_name, NULL);
  +errno = EINVAL;
  +return pstrcat(parms-pool, Invalid command ', cmd_name, ',
  +   NULL);
}
else {
void *mconfig = get_module_config(config, mod);
  @@ -835,9 +837,10 @@
   
   while (!(cfg_getline(l, MAX_STRING_LEN, parms-config_file))) {
const char *errmsg = handle_command(parms, config, l);
  - if (errmsg)
  +if (errmsg) {
return errmsg;
   }
  +}
   
   return NULL;
   }
  @@ -980,8 +983,9 @@
cfg_closefile(f);
   
if (errmsg) {
  - aplog_error(APLOG_MARK, APLOG_ALERT, r-server, %s: %s, filename, 
errmsg);
  - return SERVER_ERROR;
  +aplog_error(APLOG_MARK, APLOG_ALERT, r-server, %s: %s,
  +filename, errmsg);
  +return HTTP_INTERNAL_SERVER_ERROR;
}
   
*result = dc;
  
  
  


cvs commit: apachen/src/main http_config.c

1997-10-20 Thread ben
ben 97/10/20 05:06:36

  Modified:src/main http_config.c
  Log:
  Fix absolute path detection.
  
  Revision  ChangesPath
  1.82  +1 -7  apachen/src/main/http_config.c
  
  Index: http_config.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_config.c,v
  retrieving revision 1.81
  retrieving revision 1.82
  diff -u -r1.81 -r1.82
  --- http_config.c 1997/10/07 19:33:58 1.81
  +++ http_config.c 1997/10/20 12:06:34 1.82
  @@ -891,14 +891,8 @@
   
   API_EXPORT(char *) server_root_relative(pool *p, char *file)
   {
  -#ifdef __EMX__
  -/* Add support for OS/2 drive names */
  -if ((file[0] == '/') || (file[1] == ':'))
  +if(os_is_path_absolute(file))
return file;
  -#else
  -if (file[0] == '/')
  - return file;
  -#endif
   return make_full_path(p, server_root, file);
   }
   
  
  
  


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

1997-09-15 Thread Dean Gaudet
dgaudet 97/09/15 17:18:06

  Modified:src  INDENT
   src/main http_config.c http_config.h
  Log:
  indent
  
  Revision  ChangesPath
  1.18  +6 -8  apachen/src/INDENT
  
  Index: INDENT
  ===
  RCS file: /export/home/cvs/apachen/src/INDENT,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- INDENT1997/09/15 23:58:10 1.17
  +++ INDENT1997/09/16 00:17:55 1.18
  @@ -8,16 +8,16 @@
  alloc.h   DONE by Dean
  buff.cDONE by Dean
  buff.hDONE by Dean
  -   conf.h
  +   conf.hRESERVED by Dean
  dummy.c
  explain.c
  explain.h
  fnmatch.c
  fnmatch.h
  http_bprintf.c
  -   http_conf_globals.h
  -   http_config.c RESERVED by Dean
  -   http_config.h RESERVED by Dean
  +   http_conf_globals.h   RESERVED by Dean
  +   http_config.c DONE by Dean
  +   http_config.h DONE by Dean
  http_core.c   RESERVED by Randy
  http_core.h   RESERVED by Randy
  http_log.cRESERVED by Randy
  @@ -28,15 +28,13 @@
  http_protocol.h   DONE by Roy
  http_request.cDONE by Roy
  http_request.hDONE by Roy
  -   httpd.h
  +   httpd.h   RESERVED by Dean
  md5.h
  md5c.c
  multithread.h
  -   os-inline.c
  -   os.h
  rfc1413.c
  rfc1413.h
  -   scoreboard.h
  +   scoreboard.h  RESERVED by Dean
  util.cDONE by Randy
  util_date.c   DONE by Randy
  util_date.h   DONE by Randy
  
  
  
  1.80  +540 -503  apachen/src/main/http_config.c
  
  Index: http_config.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_config.c,v
  retrieving revision 1.79
  retrieving revision 1.80
  diff -u -r1.79 -r1.80
  --- http_config.c 1997/09/12 22:55:15 1.79
  +++ http_config.c 1997/09/16 00:17:59 1.80
  @@ -93,10 +93,10 @@
*/
   static int dynamic_modules = 0;
   module *top_module = NULL;
  -
  -typedef int (*handler_func)(request_rec *);
  -typedef void *(*dir_maker_func)(pool *, char *);
  -typedef void *(*merger_func)(pool *, void *, void *);
  +
  +typedef int (*handler_func) (request_rec *);
  +typedef void *(*dir_maker_func) (pool *, char *);
  +typedef void *(*merger_func) (pool *, void *, void *);
   
   /* Dealing with config vectors.  These are associated with per-directory,
* per-server, and per-request configuration, and have a void* pointer for
  @@ -109,86 +109,87 @@
* overridden).
*/
   
  -API_EXPORT(void *) get_module_config (void *conf_vector, module *m)
  +API_EXPORT(void *) get_module_config(void *conf_vector, module *m)
   {
  -   void **confv = (void**)conf_vector;
  -   return confv[m-module_index];
  +void **confv = (void **) conf_vector;
  +return confv[m-module_index];
   }
   
  -API_EXPORT(void) set_module_config (void *conf_vector, module *m, void *val)
  +API_EXPORT(void) set_module_config(void *conf_vector, module *m, void *val)
   {
  -   void **confv = (void**)conf_vector;
  -   confv[m-module_index] = val;
  +void **confv = (void **) conf_vector;
  +confv[m-module_index] = val;
   }
   
   void *
  -create_empty_config (pool *p)
  + create_empty_config(pool *p)
   {
  -   void **conf_vector = (void **)pcalloc(p, sizeof(void*) *
  -  (total_modules+DYNAMIC_MODULE_LIMIT));
  -   return (void *)conf_vector;
  +void **conf_vector = (void **) pcalloc(p, sizeof(void *) *
  + (total_modules + DYNAMIC_MODULE_LIMIT));
  +return (void *) conf_vector;
   }
   
   void *
  -create_default_per_dir_config (pool *p)
  + create_default_per_dir_config(pool *p)
   {
  -   void **conf_vector = (void **)pcalloc(p, sizeof(void*) * 
(total_modules+DYNAMIC_MODULE_LIMIT));
  -   module *modp;
  +void **conf_vector = (void **) pcalloc(p, sizeof(void *) * 
(total_modules + DYNAMIC_MODULE_LIMIT));
  +module *modp;
   
  -   for (modp = top_module; modp; modp = modp-next) {
  -   dir_maker_func df = modp-create_dir_config;
  +for (modp = top_module; modp; modp = modp-next) {
  + dir_maker_func df = modp-create_dir_config;
   
  -   if (df) conf_vector[modp-module_index] = (*df)(p, NULL);
  -   }
  + if (df)
  + conf_vector[modp-module_index] = (*df) (p, NULL);
  +}
   
  -   return (void*)conf_vector;
  +return (void *) conf_vector;
   }
   
   void *
  -merge_per_dir_configs (pool *p, void *base, void *new)
  + merge_per_dir_configs(pool *p, void *base, void *new)
   {
  -   void **conf_vector = (void **)palloc(p, sizeof(void*) * 

cvs commit: apachen/src/main http_config.c

1997-09-12 Thread Alexei Kosut
akosut  97/09/12 15:55:17

  Modified:src/main http_config.c
  Log:
  Have create_empty_config() create DYNAMIC_MODULE_LIMIT more vector space
  than it needs, in case you put LoadModule after a Directory or
  VirtualHost in a config file.
  
  Also have add_module() complain and exit if you try and load more than
  DYNAMIC_MODULE_LIMIT module.
  
  Revision  ChangesPath
  1.79  +20 -3 apachen/src/main/http_config.c
  
  Index: http_config.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_config.c,v
  retrieving revision 1.78
  retrieving revision 1.79
  diff -u -u -r1.78 -r1.79
  --- http_config.c 1997/08/31 21:28:49 1.78
  +++ http_config.c 1997/09/12 22:55:15 1.79
  @@ -83,8 +83,15 @@
* of modules which control just about all of the server operation.
*/
   
  -/* total_modules is the number of modules linked in.  */
  +/* total_modules is the number of modules that have been linked
  + * into the server.
  + */
   static int total_modules = 0;
  +/* dynamic_modules is the number of modules that have been added
  + * after the pre-linked ones have been set up. It shouldn't be larger
  + * than DYNAMIC_MODULE_LIMIT.
  + */
  +static int dynamic_modules = 0;
   module *top_module = NULL;
   
   typedef int (*handler_func)(request_rec *);
  @@ -117,7 +124,8 @@
   void *
   create_empty_config (pool *p)
   {
  -   void **conf_vector = (void **)pcalloc(p, sizeof(void*) * total_modules);
  +   void **conf_vector = (void **)pcalloc(p, sizeof(void*) *
  +  (total_modules+DYNAMIC_MODULE_LIMIT));
  return (void *)conf_vector;
   }
   
  @@ -472,8 +480,17 @@
   }
   if (m-module_index == -1) {
m-module_index = total_modules++;
  + dynamic_modules++;
  +
  + if (dynamic_modules  DYNAMIC_MODULE_LIMIT) {
  + fprintf(stderr, httpd: module \%s\ could not be loaded, because
  +  the dynamic\n, m-name);
  + fprintf(stderr, module limit was reached. Please increase 
  + DYNAMIC_MODULE_LIMIT and recompile.\n);
  + exit(1);
  + }
   }
  -
  +
   /* Some C compilers put a complete path into __FILE__, but we want
* only the filename (e.g. mod_includes.c). So check for path
* components (Unix and DOS), and remove them.
  
  
  


cvs commit: apachen/src/main http_config.c http_core.c http_log.c http_protocol.c http_request.c rfc1413.c util_script.c

1997-08-31 Thread Randy Terbush
randy   97/08/31 14:28:59

  Modified:src/main http_config.c http_core.c http_log.c
http_protocol.c http_request.c rfc1413.c
util_script.c
  Log:
  Complete conversion of src/main/* to aplog_error(). On to the modules...
  
  Revision  ChangesPath
  1.78  +8 -7  apachen/src/main/http_config.c
  
  Index: http_config.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_config.c,v
  retrieving revision 1.77
  retrieving revision 1.78
  diff -u -r1.77 -r1.78
  --- http_config.c 1997/08/27 05:45:34 1.77
  +++ http_config.c 1997/08/31 21:28:49 1.78
  @@ -934,9 +934,9 @@
   while (!f  access_name[0]) {
char *w = getword_conf(r-pool, access_name);
filename = make_full_path(r-pool, d, w);
  - f=pfopen(r-pool, filename, r);
  + f = pfopen(r-pool, filename, r);
   }
  -if(f) {
  +if (f) {
   dc = create_per_dir_config (r-pool);

   parms.infile = f;
  @@ -947,18 +947,19 @@
   pfclose(r-pool, f);
   
if (errmsg) {
  - log_reason (errmsg, filename, r);
  + aplog_error(APLOG_MARK, APLOG_ALERT, r-server, %s: %s, filename, 
errmsg);
return SERVER_ERROR;
}

*result = dc;
  -} else {
  +}
  +else {
if (errno == ENOENT || errno == ENOTDIR)
dc = NULL;
else {
  - log_unixerr(pfopen, filename, 
  - unable to check htaccess file, ensure it is readable,
  - r-server);
  + aplog_error(APLOG_MARK, APLOG_CRIT, r-server,
  + %s pfopen: unable to check htaccess file, ensure it is 
readable,
  + filename);
return HTTP_FORBIDDEN;
}
   }
  
  
  
  1.116 +23 -18apachen/src/main/http_core.c
  
  Index: http_core.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_core.c,v
  retrieving revision 1.115
  retrieving revision 1.116
  diff -u -r1.115 -r1.116
  --- http_core.c   1997/08/27 05:45:35 1.115
  +++ http_core.c   1997/08/31 21:28:50 1.116
  @@ -1224,14 +1224,14 @@
   rlim_t cur = 0;
   rlim_t max = 0;
   
  -*plimit=(struct rlimit *)pcalloc(cmd-pool,sizeof **plimit);
  -limit=*plimit;
  -if ((getrlimit(type, limit)) != 0)
  - {
  +*plimit = (struct rlimit *)pcalloc(cmd-pool,sizeof **plimit);
  +limit = *plimit;
  +if ((getrlimit(type, limit)) != 0)   {
*plimit = NULL;
  - log_unixerr(getrlimit,cmd-cmd-name,failed,cmd-server);
  + aplog_error(APLOG_MARK, APLOG_ERR, cmd-server,
  + %s: getrlimit failed, cmd-cmd-name);
return;
  - }
  +}
   
   if ((str = getword_conf(cmd-pool, arg)))
if (!strcasecmp(str, max))
  @@ -1239,7 +1239,8 @@
else
cur = atol(str);
   else {
  - log_printf(cmd-server, Invalid parameters for %s, cmd-cmd-name);
  + aplog_error(APLOG_MARK, APLOG_ERR, cmd-server,
  + Invalid parameters for %s, cmd-cmd-name);
return;
   }
   
  @@ -1250,8 +1251,8 @@
   if (geteuid()) {
limit-rlim_cur = cur;
if (max)
  - log_printf(cmd-server, Must be uid 0 to raise maximum %s,
  -   cmd-cmd-name);
  + aplog_error(APLOG_MARK, APLOG_ERR, cmd-server,
  + Must be uid 0 to raise maximum %s, cmd-cmd-name);
   }
   else {
if (cur)
  @@ -1266,8 +1267,8 @@
   static const char *no_set_limit (cmd_parms *cmd, core_dir_config *conf,
 char *arg, char *arg2)
   {
  -log_printf(cmd-server, %s not supported on this platform,
  -cmd-cmd-name);
  +aplog_error(APLOG_MARK, APLOG_ERR, cmd-server,
  + %s not supported on this platform, cmd-cmd-name);
   return NULL;
   }
   #endif
  @@ -1542,7 +1543,8 @@
 
   if (r-proxyreq) return HTTP_FORBIDDEN;
   if ((r-uri[0] != '/')  strcmp(r-uri, *)) {
  - log_printf(r-server, Invalid URI in request %s, r-the_request);
  + aplog_error(APLOG_MARK, APLOG_ERR, r-server,
  + Invalid URI in request %s, r-the_request);
return BAD_REQUEST;
   }
   
  @@ -1603,16 +1605,17 @@
   r-allowed |= (1  M_OPTIONS);
   
   if (r-method_number == M_INVALID) {
  - log_printf(r-server, Invalid method in request %s, r-the_request);
  + aplog_error(APLOG_MARK, APLOG_ERR, r-server,
  + Invalid method in request %s, r-the_request);
return NOT_IMPLEMENTED;
   }
   if (r-method_number == M_OPTIONS) return send_http_options(r);
   if (r-method_number == M_PUT) return METHOD_NOT_ALLOWED;
   
   if (r-finfo.st_mode == 0 || (r-path_info  *r-path_info)) {
  - log_reason(File does not exist,
  - 

cvs commit: apachen/src/main http_config.c http_core.c http_log.c http_log.h httpd.h

1997-08-26 Thread Randy Terbush
randy   97/08/26 22:45:41

  Modified:src  CHANGES
   src/main http_config.c http_core.c http_log.c http_log.h
httpd.h
  Log:
  Backoff aplog_error() to be configureable on a per-server basis.
  Attempt to fix portability issues with syslog().
  Convert existing log functions to wrappers for aplog_error().
  Add #ifdef USE_SYSLOG
  
  Revision  ChangesPath
  1.423 +1 -1  apachen/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /export/home/cvs/apachen/src/CHANGES,v
  retrieving revision 1.422
  retrieving revision 1.423
  diff -u -r1.422 -r1.423
  --- CHANGES   1997/08/27 01:12:18 1.422
  +++ CHANGES   1997/08/27 05:45:14 1.423
  @@ -22,7 +22,7 @@
 *) Add aplog_error() providing a mechanism to define levels of
verbosity to the server error logging. This addition also provides
the ablity to log errors using syslogd. Error logging is configurable
  - on a per-directory basis using the LogLevel directive. Conversion
  + on a per-server basis using the LogLevel directive. Conversion
of log_*() in progress. [Randy Terbush]
   
 *) Canonicalise filenames under Win32. Short filenames are
  
  
  
  1.77  +3 -0  apachen/src/main/http_config.c
  
  Index: http_config.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_config.c,v
  retrieving revision 1.76
  retrieving revision 1.77
  diff -u -r1.76 -r1.77
  --- http_config.c 1997/08/26 00:00:54 1.76
  +++ http_config.c 1997/08/27 05:45:34 1.77
  @@ -1081,6 +1081,8 @@
   s-keep_alive = -1;
   s-keep_alive_max = -1;
   s-error_log = main_server-error_log;
  +s-loglevel = main_server-loglevel;
  +
   /* start the list of addreses */
   addrs = s-addrs;
   while( hostname[0] ) {
  @@ -1201,6 +1203,7 @@
   s-server_hostname = NULL; 
   s-error_fname = DEFAULT_ERRORLOG;
   s-error_log = stderr;
  +s-loglevel = DEFAULT_LOGLEVEL;
   s-srm_confname = RESOURCE_CONFIG_FILE;
   s-access_confname = ACCESS_CONFIG_FILE;
   s-timeout = DEFAULT_TIMEOUT;
  
  
  
  1.115 +10 -12apachen/src/main/http_core.c
  
  Index: http_core.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_core.c,v
  retrieving revision 1.114
  retrieving revision 1.115
  diff -u -r1.114 -r1.115
  --- http_core.c   1997/08/25 02:00:38 1.114
  +++ http_core.c   1997/08/27 05:45:35 1.115
  @@ -130,8 +130,6 @@
   conf-limit_nproc = NULL;
   #endif
   
  -conf-loglevel = DEFAULT_LOGLEVEL;
  -
   conf-sec = make_array (a, 2, sizeof(void *));
   
   return (void *)conf;
  @@ -1374,27 +1372,27 @@
   return NULL;
   }
   
  -const char *set_loglevel (cmd_parms *cmd, core_dir_config *conf, const char 
*arg) 
  +const char *set_loglevel (cmd_parms *cmd, void *dummy, const char *arg) 
   {
  char *str;
   
  if ((str = getword_conf(cmd-pool, arg))) {
  if (!strcasecmp(str, emerg))
  -conf-loglevel = APLOG_EMERG;
  +cmd-server-loglevel = APLOG_EMERG;
  else if (!strcasecmp(str, alert))
  -conf-loglevel = APLOG_ALERT;
  +cmd-server-loglevel = APLOG_ALERT;
  else if (!strcasecmp(str, crit))
  -conf-loglevel = APLOG_CRIT;
  +cmd-server-loglevel = APLOG_CRIT;
  else if (!strcasecmp(str, error))
  -conf-loglevel = APLOG_ERR;
  +cmd-server-loglevel = APLOG_ERR;
  else if (!strcasecmp(str, warn))
  -conf-loglevel = APLOG_WARNING;
  +cmd-server-loglevel = APLOG_WARNING;
  else if (!strcasecmp(str, notice))
  -conf-loglevel = APLOG_NOTICE;
  +cmd-server-loglevel = APLOG_NOTICE;
  else if (!strcasecmp(str, info))
  -conf-loglevel = APLOG_INFO;
  +cmd-server-loglevel = APLOG_INFO;
  else if (!strcasecmp(str, debug))
  -conf-loglevel = APLOG_DEBUG;
  +cmd-server-loglevel = APLOG_DEBUG;
  }
  else
  return LogLevel requires level keyword;
  @@ -1528,7 +1526,7 @@
   { ListenBacklog, set_listenbacklog, NULL, RSRC_CONF, TAKE1, maximum 
length of the queue of pending connections, as used by listen(2) },
   { CoreDumpDirectory, set_coredumpdir, NULL, RSRC_CONF, TAKE1, The 
location of the directory Apache changes to before dumping core },
   { Include, include_config, NULL, RSRC_CONF, TAKE1, config file to be 
included },
  -{ LogLevel, set_loglevel, (void*)XtOffsetOf(core_dir_config, loglevel), 
OR_ALL, TAKE1, set level of verbosity in error logging },
  +{ LogLevel, set_loglevel, NULL, RSRC_CONF, TAKE1, set level of verbosity 
in error logging },
   { NULL },
   };
   
  
  
  
  1.26  +44 -63apachen/src/main/http_log.c
  
  Index: http_log.c
  

cvs commit: apachen/src/main http_config.c

1997-08-24 Thread Marc Slemko
marc97/08/24 19:26:58

  Modified:src  CHANGES
   src/main http_config.c
  Log:
  If a htaccess file is unreadable, deny access with a HTTP_FORBIDDEN
  error.  The previous behavior of ignoring it if it could not be read is
  not good from a security viewpoint.  The ENOTDIR check is necessary for
  path_info to work correctly in the current implementation.
  
  PR: 817
  Reviewed by:  Randy Terbush, Paul Sutton
  
  Revision  ChangesPath
  1.419 +6 -0  apachen/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /export/home/cvs/apachen/src/CHANGES,v
  retrieving revision 1.418
  retrieving revision 1.419
  diff -u -r1.418 -r1.419
  --- CHANGES   1997/08/25 02:00:27 1.418
  +++ CHANGES   1997/08/25 02:26:52 1.419
  @@ -1,5 +1,11 @@
   Changes with Apache 1.3a2
   
  +  *) If a htaccess file can not be read due to bad permissions, deny
  + access to the directory with a HTTP_FORBIDDEN.  The previous
  + behavior was to ignore the htaccess file if it could not
  + be read.  This change may make some setups with unreadable
  + htaccess files stop working.  PR#817  [Marc Slemko]
  +
 *) Add aplog_error() providing a mechanism to define levels of
verbosity to the server error logging. This addition also provides
the ablity to log errors using syslogd. Error logging is configurable
  
  
  
  1.75  +10 -2 apachen/src/main/http_config.c
  
  Index: http_config.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_config.c,v
  retrieving revision 1.74
  retrieving revision 1.75
  diff -u -r1.74 -r1.75
  --- http_config.c 1997/08/23 04:00:27 1.74
  +++ http_config.c 1997/08/25 02:26:57 1.75
  @@ -952,8 +952,16 @@
}

*result = dc;
  -} else
  - dc = NULL;
  +} else {
  + if (errno == ENOENT || errno == ENOTDIR)
  + dc = NULL;
  + else {
  + log_unixerr(pfopen, filename, 
  + unable to check htaccess file, ensure it is readable,
  + r-server);
  + return HTTP_FORBIDDEN;
  + }
  +}
   
   /* cache it */
   new = palloc(r-pool, sizeof(struct htaccess_result));