martin      98/02/20 02:51:36

  Modified:    .        STATUS
               src      CHANGES
               src/include http_config.h
               src/main http_core.c
  Log:
  The check_cmd_context() function is now globally usable (Ken's suggestion)
  
  Revision  Changes    Path
  1.159     +0 -4      apache-1.3/STATUS
  
  Index: STATUS
  ===================================================================
  RCS file: /home/cvs/apache-1.3/STATUS,v
  retrieving revision 1.158
  retrieving revision 1.159
  diff -u -u -r1.158 -r1.159
  --- STATUS    1998/02/18 22:41:49     1.158
  +++ STATUS    1998/02/20 10:51:29     1.159
  @@ -153,10 +153,6 @@
         appropriate environment. Marc and Alexei don't see any
         big deal. Martin says that not every "env" has a -u flag.
   
  -    * Ken suggests that new check_cmd_context() and related defines
  -      should be non-static and in util_* so modules can use 'em.  (He
  -      didn't notice this flaw during the review.)
  -
       * 206 vs. 200 issue on Content-Length
        See <[EMAIL PROTECTED]>
        Roy says current behavior is correct, but Alexei disagrees.
  
  
  
  1.642     +3 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.641
  retrieving revision 1.642
  diff -u -u -r1.641 -r1.642
  --- CHANGES   1998/02/20 10:44:32     1.641
  +++ CHANGES   1998/02/20 10:51:30     1.642
  @@ -1,5 +1,8 @@
   Changes with Apache 1.3b6
   
  +  *)  As Ken suggested the check_cmd_context() function and related defines
  +      are non-static now so modules can use 'em.  [Martin Kraemer]
  +
     *)  mod_info would occasionally produce an unpaired <tt> in its
         output. Fixed. [Martin Kraemer]
   
  
  
  
  1.68      +13 -0     apache-1.3/src/include/http_config.h
  
  Index: http_config.h
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/include/http_config.h,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -u -r1.67 -r1.68
  --- http_config.h     1998/02/18 10:01:10     1.67
  +++ http_config.h     1998/02/20 10:51:33     1.68
  @@ -328,6 +328,19 @@
                                server_rec *main_server, server_rec **);
   void process_resource_config(server_rec *s, char *fname, pool *p, pool 
*ptemp);
   
  +/* check_cmd_context() definitions: */
  +extern const char *check_cmd_context(cmd_parms *cmd, unsigned forbidden);
  +
  +/* check_cmd_context():                  Forbidden in: */
  +#define  NOT_IN_VIRTUALHOST     0x01 /* <Virtualhost> */
  +#define  NOT_IN_LIMIT           0x02 /* <Limit> */
  +#define  NOT_IN_DIRECTORY       0x04 /* <Directory> */
  +#define  NOT_IN_LOCATION        0x08 /* <Location> */
  +#define  NOT_IN_FILES           0x10 /* <Files> */
  +#define  NOT_IN_DIR_LOC_FILE    
(NOT_IN_DIRECTORY|NOT_IN_LOCATION|NOT_IN_FILES) /* 
<Directory>/<Location>/<Files>*/
  +#define  GLOBAL_ONLY            
(NOT_IN_VIRTUALHOST|NOT_IN_LIMIT|NOT_IN_DIR_LOC_FILE)
  +
  +
   /* Module-method dispatchers, also for http_request.c */
   
   int translate_name(request_rec *);
  
  
  
  1.161     +17 -13    apache-1.3/src/main/http_core.c
  
  Index: http_core.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/main/http_core.c,v
  retrieving revision 1.160
  retrieving revision 1.161
  diff -u -u -r1.160 -r1.161
  --- http_core.c       1998/02/20 07:15:46     1.160
  +++ http_core.c       1998/02/20 10:51:34     1.161
  @@ -652,15 +652,8 @@
   static const char end_virtualhost_section[] = "</VirtualHost>";
   static const char end_ifmodule_section[] = "</IfModule>";
   
  -/* check_cmd_context():                  Forbidden in: */
  -#define  NOT_IN_VIRTUALHOST     0x01U /* <Virtualhost> */
  -#define  NOT_IN_LIMIT           0x02U /* <Limit> */
  -#define  NOT_IN_DIR_LOC_FILE    0x04U /* <Directory>/<Location>/<Files>*/
  -#define  NOT_IN_LOC             0x08U /* <Location> */
  -#define  GLOBAL_ONLY            
(NOT_IN_VIRTUALHOST|NOT_IN_LIMIT|NOT_IN_DIR_LOC_FILE)
   
  -
  -static const char *check_cmd_context(cmd_parms *cmd, unsigned forbidden)
  +const char *check_cmd_context(cmd_parms *cmd, unsigned forbidden)
   {
       const char *gt = (cmd->cmd->name[0] == '<'
                   && cmd->cmd->name[strlen(cmd->cmd->name)-1] != '>') ? ">" : 
"";
  @@ -673,14 +666,20 @@
        return pstrcat(cmd->pool, cmd->cmd->name, gt,
                       " cannot occur within <Limit> section", NULL);
   
  -    if ((forbidden & NOT_IN_DIR_LOC_FILE) && cmd->path != NULL)
  +    if ((forbidden & NOT_IN_DIR_LOC_FILE) == NOT_IN_DIR_LOC_FILE && 
cmd->path != NULL)
        return pstrcat(cmd->pool, cmd->cmd->name, gt,
                       " cannot occur within <Directory/Location/Files> 
section", NULL);
       
  -    if ((forbidden & NOT_IN_LOC) && (cmd->end_token == end_location_section
  -         || cmd->end_token == end_locationmatch_section))
  +    if (((forbidden & NOT_IN_DIRECTORY) && (cmd->end_token == 
end_directory_section
  +         || cmd->end_token == end_directorymatch_section)) ||
  +     ((forbidden & NOT_IN_LOCATION) && (cmd->end_token == 
end_location_section
  +         || cmd->end_token == end_locationmatch_section)) ||
  +     ((forbidden & NOT_IN_FILES) && (cmd->end_token == end_files_section
  +         || cmd->end_token == end_filesmatch_section)))
  +     
        return pstrcat(cmd->pool, cmd->cmd->name, gt,
  -                    " cannot occur within <Location> section", NULL);
  +                    " cannot occur within <", cmd->end_token+2,
  +                    " section", NULL);
   
       return NULL;
   }
  @@ -1085,7 +1084,7 @@
   
       void *new_file_conf = create_per_dir_config (cmd->pool);
   
  -    const char *err = check_cmd_context(cmd, NOT_IN_LIMIT | NOT_IN_LOC);
  +    const char *err = check_cmd_context(cmd, NOT_IN_LIMIT | NOT_IN_LOCATION);
       if (err != NULL) return err;
   
       if (endp) *endp = '\0';
  @@ -1134,6 +1133,11 @@
       return NULL;
   }
   
  +/* XXX: NB: Currently, we have no way of checking
  + * whether <IfModule> sections are closed properly.
  + * Extra (redundant, unpaired) </IfModule> directives are
  + * simply silently ignored.
  + */
   const char *end_ifmod (cmd_parms *cmd, void *dummy) {
       return NULL;
   }
  
  
  

Reply via email to