cvs commit: apache-1.3/src/main alloc.c util.c

1998-09-26 Thread jim
jim 98/09/25 16:01:55

  Modified:src/main alloc.c util.c
  Log:
  Maintain state of errno in ap_pcfg_openfile
  and the functions that it calls. Needed when parsing .htaccess
  
  Revision  ChangesPath
  1.100 +6 -1  apache-1.3/src/main/alloc.c
  
  Index: alloc.c
  ===
  RCS file: /export/home/cvs/apache-1.3/src/main/alloc.c,v
  retrieving revision 1.99
  retrieving revision 1.100
  diff -u -r1.99 -r1.100
  --- alloc.c   1998/08/14 02:49:47 1.99
  +++ alloc.c   1998/09/25 23:01:49 1.100
  @@ -1744,6 +1744,7 @@
   FILE *fd = NULL;
   int baseFlag, desc;
   int modeFlags = 0;
  +int saved_errno;
   
   #ifdef WIN32
   modeFlags = _S_IREAD | _S_IWRITE;
  @@ -1766,22 +1767,26 @@
   else {
fd = fopen(name, mode);
   }
  -
  +saved_errno = errno;
   if (fd != NULL)
ap_note_cleanups_for_file(a, fd);
   ap_unblock_alarms();
  +errno = saved_errno;
   return fd;
   }
   
   API_EXPORT(FILE *) ap_pfdopen(pool *a, int fd, const char *mode)
   {
   FILE *f;
  +int saved_errno;
   
   ap_block_alarms();
   f = ap_fdopen(fd, mode);
  +saved_errno = errno;
   if (f != NULL)
ap_note_cleanups_for_file(a, f);
   ap_unblock_alarms();
  +errno = saved_errno;
   return f;
   }
   
  
  
  
  1.134 +5 -0  apache-1.3/src/main/util.c
  
  Index: util.c
  ===
  RCS file: /export/home/cvs/apache-1.3/src/main/util.c,v
  retrieving revision 1.133
  retrieving revision 1.134
  diff -u -r1.133 -r1.134
  --- util.c1998/09/17 15:56:08 1.133
  +++ util.c1998/09/25 23:01:49 1.134
  @@ -738,6 +738,7 @@
   poolfile_t *new_pfile;
   FILE *file;
   struct stat stbuf;
  +int saved_errno;
   
   if (name == NULL) {
   ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, NULL,
  @@ -747,9 +748,11 @@
   
   file = ap_pfopen(p, name, r);
   #ifdef DEBUG
  +saved_errno = errno;
   ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, NULL,
   Opening config file %s (%s),
   name, (file == NULL) ? strerror(errno) : successful);
  +errno = saved_errno;
   #endif
   if (file == NULL)
   return NULL;
  @@ -761,10 +764,12 @@
   #else
   strcmp(name, /dev/null) != 0) {
   #endif
  + saved_errno = errno;
   ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, NULL,
   Access to file %s denied by server: not a regular file,
   name);
   ap_pfclose(p, file);
  + errno = saved_errno;
   return NULL;
   }
   
  
  
  


cvs commit: apache-1.3/src CHANGES

1998-09-26 Thread fielding
fielding98/09/25 16:24:19

  Modified:src  CHANGES
  Log:
  Add log entry for the save errno fix that we both committed at the
  same time.
  
  Revision  ChangesPath
  1.1080+4 -2  apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1079
  retrieving revision 1.1080
  diff -u -r1.1079 -r1.1080
  --- CHANGES   1998/09/25 17:17:52 1.1079
  +++ CHANGES   1998/09/25 23:24:18 1.1080
  @@ -1,7 +1,9 @@
   Changes with Apache 1.3.3

  -  *) Non-existant .htaccess files being returned as FORBIDDEN instead
  - of not-existing. [Roy Fielding]
  +  *) The ap_pfopen and ap_pfdopen routines were failing to protect the
  + errno on an error, which leads to one error being mistaken for
  + another when reading non-existant .htaccess files.
  + [Jim Jagielski, Roy Fielding]
   
 *) OS/2: The new header tests get things right, need to update
ap_config.h.  [Brian Havard]
  
  
  


cvs commit: apache-1.3/src/main http_config.c

1998-09-26 Thread fielding
fielding98/09/25 17:07:09

  Modified:src  CHANGES
   src/main http_config.c
  Log:
  Reconstructed the loop through multiple htaccess file names so
  that missing files are not confused with unreadable files.
  
  Revision  ChangesPath
  1.1081+4 -0  apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1080
  retrieving revision 1.1081
  diff -u -r1.1080 -r1.1081
  --- CHANGES   1998/09/25 23:24:18 1.1080
  +++ CHANGES   1998/09/26 00:07:06 1.1081
  @@ -1,5 +1,9 @@
   Changes with Apache 1.3.3

  +  *) Reconstructed the loop through multiple htaccess file names so
  + that missing files are not confused with unreadable files.
  + [Roy Fielding]
  +
 *) The ap_pfopen and ap_pfdopen routines were failing to protect the
errno on an error, which leads to one error being mistaken for
another when reading non-existant .htaccess files.
  
  
  
  1.134 +33 -35apache-1.3/src/main/http_config.c
  
  Index: http_config.c
  ===
  RCS file: /home/cvs/apache-1.3/src/main/http_config.c,v
  retrieving revision 1.133
  retrieving revision 1.134
  diff -u -r1.133 -r1.134
  --- http_config.c 1998/09/25 23:39:50 1.133
  +++ http_config.c 1998/09/26 00:07:08 1.134
  @@ -1206,7 +1206,7 @@
   char *filename = NULL;
   const struct htaccess_result *cache;
   struct htaccess_result *new;
  -void *dc;
  +void *dc = NULL;
   
   /* firstly, search cache */
   for (cache = r-htaccess; cache != NULL; cache = cache-next)
  @@ -1224,41 +1224,39 @@
   parms.path = ap_pstrdup(r-pool, d);
   
   /* loop through the access names and find the first one */
  -while (!f  access_name[0]) {
  - char *w = ap_getword_conf(r-pool, access_name);
  - filename = ap_make_full_path(r-pool, d, w);
  - f = ap_pcfg_openfile(r-pool, filename);
  -}
  -if (f) {
  - dc = ap_create_per_dir_config(r-pool);
  -
  - parms.config_file = f;
  -
  - errmsg = ap_srm_command_loop(parms, dc);
  -
  - ap_cfg_closefile(f);
  -
  - if (errmsg) {
  - ap_log_rerror(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, r, %s: %s,
  -   filename, errmsg);
  -return HTTP_INTERNAL_SERVER_ERROR;
  - }
   
  - *result = dc;
  -}
  -else {
  - if (errno == ENOENT || errno == ENOTDIR)
  - dc = NULL;
  - else {
  - ap_log_rerror(APLOG_MARK, APLOG_CRIT, r,
  -   %s pcfg_openfile: unable to check htaccess file, 
  -   ensure it is readable,
  -   filename);
  - ap_table_setn(r-notes, error-notes,
  -   Server unable to read htaccess file, denying 
  -   access to be safe);
  - return HTTP_FORBIDDEN;
  - }
  +while (access_name[0]) {
  +filename = ap_make_full_path(r-pool, d,
  + ap_getword_conf(r-pool, access_name));
  +
  +if ((f = ap_pcfg_openfile(r-pool, filename)) != NULL) {
  +
  +dc = ap_create_per_dir_config(r-pool);
  +
  +parms.config_file = f;
  +
  +errmsg = ap_srm_command_loop(parms, dc);
  +
  +ap_cfg_closefile(f);
  +
  +if (errmsg) {
  +ap_log_rerror(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, r,
  +  %s: %s, filename, errmsg);
  +return HTTP_INTERNAL_SERVER_ERROR;
  +}
  +*result = dc;
  +break;
  +}
  +else if (errno != ENOENT  errno != ENOTDIR) {
  +ap_log_rerror(APLOG_MARK, APLOG_CRIT, r,
  +  %s pcfg_openfile: unable to check htaccess file, 
  +  ensure it is readable,
  +  filename);
  +ap_table_setn(r-notes, error-notes,
  +  Server unable to read htaccess file, denying 
  +  access to be safe);
  +return HTTP_FORBIDDEN;
  +}
   }
   
   /* cache it */
  
  
  


cvs commit: apache-2.0/apache-nspr/main Makefile.tmpl

1998-09-26 Thread ben
ben 98/09/26 04:38:57

  Modified:apache-nspr/main Makefile.tmpl
  Log:
  Fail properly when header generation fails. Remove the right headers!
  
  Revision  ChangesPath
  1.4   +2 -2  apache-2.0/apache-nspr/main/Makefile.tmpl
  
  Index: Makefile.tmpl
  ===
  RCS file: /export/home/cvs/apache-2.0/apache-nspr/main/Makefile.tmpl,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Makefile.tmpl 1998/09/22 18:05:15 1.3
  +++ Makefile.tmpl 1998/09/26 11:38:56 1.4
  @@ -30,13 +30,13 @@
-rm -f Makefile
   
   uri_delims.h: gen_uri_delims
  - ./gen_uri_delims uri_delims.h || rm test_char.h
  + ./gen_uri_delims uri_delims.h || (rm uri_delims.h; false)
   
   gen_uri_delims: gen_uri_delims.o
$(CC) $(CFLAGS) $(LDFLAGS) -o gen_uri_delims gen_uri_delims.o $(LIBS)
   
   test_char.h: gen_test_char
  - ./gen_test_char test_char.h || rm test_char.h
  + ./gen_test_char test_char.h || (rm test_char.h; false)
   
   gen_test_char: gen_test_char.o
$(CC) $(CFLAGS) $(LDFLAGS) -o gen_test_char gen_test_char.o $(LIBS)
  
  
  


cvs commit: apache-1.3/src/support dbmmanage

1998-09-26 Thread ben
ben 98/09/26 07:47:50

  Modified:src/support dbmmanage
  Log:
  Make read-only commands work. Maybe improve diagnostics.
  
  Revision  ChangesPath
  1.12  +2 -2  apache-1.3/src/support/dbmmanage
  
  Index: dbmmanage
  ===
  RCS file: /export/home/cvs/apache-1.3/src/support/dbmmanage,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- dbmmanage 1998/05/18 11:24:21 1.11
  +++ dbmmanage 1998/09/26 14:47:49 1.12
  @@ -89,9 +89,9 @@
   my %DB = ();
   my @range = ();
   my($mode, $flags) = $command =~ 
  -/^(?:view|check)$/ ? (undef, O_RDONLY) : (0644, O_RDWR|O_CREAT);
  +/^(?:view|check)$/ ? (0644, O_RDONLY) : (0644, O_RDWR|O_CREAT);
   
  -tie %DB, AnyDBM_File, $file, $flags, $mode;
  +tie %DB, AnyDBM_File, $file, $flags, $mode || die Can't tie $file: $!;
   dbmc-$command();
   untie %DB;