rse         99/05/21 05:16:28

  Modified:    src      CHANGES
               src/include httpd.h ap_mmn.h ap_compat.h
               src/main util.c http_request.c util_uri.c
               src/support httpd.exp
               src/modules/standard mod_setenvif.c mod_rewrite.c
                        mod_include.c mod_alias.c
  Log:
  Replace regexec() calls with calls to a new API stub function ap_regexec().
  This solves problems with DSO modules which use the regex library.
  
  Submitted by: Jens-Uwe Mager <[EMAIL PROTECTED]>, Ralf S. Engelschall
  Reviewed by: Ralf S. Engelschall
  
  Revision  Changes    Path
  1.1361    +4 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1360
  retrieving revision 1.1361
  diff -u -r1.1360 -r1.1361
  --- CHANGES   1999/05/19 13:26:07     1.1360
  +++ CHANGES   1999/05/21 12:16:14     1.1361
  @@ -1,5 +1,9 @@
   Changes with Apache 1.3.7
   
  +  *) Replace regexec() calls with calls to a new API stub function
  +     ap_regexec().  This solves problems with DSO modules which use the regex
  +     library. [Jens-Uwe Mager <[EMAIL PROTECTED]>, Ralf S. Engelschall]
  +
     *) Add 'Request_Protocol' special keyword to mod_setenvif so that
        environment variables can be set according to the protocol version
        (e.g., HTTP/0.9 or HTTP/1.1) of the request.  [Ken Coar]
  
  
  
  1.277     +3 -1      apache-1.3/src/include/httpd.h
  
  Index: httpd.h
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/include/httpd.h,v
  retrieving revision 1.276
  retrieving revision 1.277
  diff -u -r1.276 -r1.277
  --- httpd.h   1999/03/23 00:36:33     1.276
  +++ httpd.h   1999/05/21 12:16:17     1.277
  @@ -968,8 +968,10 @@
   void os2pathname(char *path);
   #endif
   
  +API_EXPORT(int)    ap_regexec(const regex_t *preg, const char *string,
  +                              size_t nmatch, regmatch_t pmatch[], int 
eflags);
   API_EXPORT(char *) ap_pregsub(pool *p, const char *input, const char *source,
  -                        size_t nmatch, regmatch_t pmatch[]);
  +                              size_t nmatch, regmatch_t pmatch[]);
   
   API_EXPORT(void) ap_content_type_tolower(char *);
   API_EXPORT(void) ap_str_tolower(char *);
  
  
  
  1.35      +2 -1      apache-1.3/src/include/ap_mmn.h
  
  Index: ap_mmn.h
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/include/ap_mmn.h,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- ap_mmn.h  1999/05/07 00:16:09     1.34
  +++ ap_mmn.h  1999/05/21 12:16:17     1.35
  @@ -217,12 +217,13 @@
    * 19990320.1           - add ap_vrprintf()
    * 19990320.2           - add cmd_parms.context, ap_set_config_vectors, 
    *                        export ap_add_file_conf
  + * 19990521             - add ap_regexec()
    */
   
   #define MODULE_MAGIC_COOKIE 0x41503133UL /* "AP13" */
   
   #ifndef MODULE_MAGIC_NUMBER_MAJOR
  -#define MODULE_MAGIC_NUMBER_MAJOR 19990320
  +#define MODULE_MAGIC_NUMBER_MAJOR 19990521
   #endif
   #define MODULE_MAGIC_NUMBER_MINOR 2                     /* 0...n */
   #define MODULE_MAGIC_NUMBER MODULE_MAGIC_NUMBER_MAJOR        /* backward 
compat */
  
  
  
  1.18      +1 -0      apache-1.3/src/include/ap_compat.h
  
  Index: ap_compat.h
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/include/ap_compat.h,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- ap_compat.h       1999/05/07 00:16:09     1.17
  +++ ap_compat.h       1999/05/21 12:16:18     1.18
  @@ -305,6 +305,7 @@
   #define rationalize_mtime              ap_rationalize_mtime
   #define read_config                    ap_read_config
   #define read_request                   ap_read_request
  +#define regexec                        ap_regexec
   #define register_cleanup               ap_register_cleanup
   #define register_other_child           ap_register_other_child
   #define release_mutex                  ap_release_mutex
  
  
  
  1.161     +13 -1     apache-1.3/src/main/util.c
  
  Index: util.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/main/util.c,v
  retrieving revision 1.160
  retrieving revision 1.161
  diff -u -r1.160 -r1.161
  --- util.c    1999/04/21 18:25:44     1.160
  +++ util.c    1999/05/21 12:16:21     1.161
  @@ -281,9 +281,21 @@
       return 0;
   }
   
  +/* 
  + * Apache stub function for the regex libraries regexec() to make sure the
  + * whole regex(3) API is available through the Apache (exported) namespace.
  + * This is especially important for the DSO situations of modules.
  + * DO NOT MAKE A MACRO OUT OF THIS FUNCTION!
  + */
  +API_EXPORT(int) ap_regexec(const regex_t *preg, const char *string,
  +                           size_t nmatch, regmatch_t pmatch[], int eflags)
  +{
  +    return regexec(preg, string, nmatch, pmatch, eflags);
  +}
  +
   /* This function substitutes for $0-$9, filling in regular expression
    * submatches. Pass it the same nmatch and pmatch arguments that you
  - * passed regexec(). pmatch should not be greater than the maximum number
  + * passed ap_regexec(). pmatch should not be greater than the maximum number
    * of subexpressions - i.e. one more than the re_nsub member of regex_t.
    *
    * input should be the string with the $-expressions, source should be the
  
  
  
  1.149     +4 -4      apache-1.3/src/main/http_request.c
  
  Index: http_request.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/main/http_request.c,v
  retrieving revision 1.148
  retrieving revision 1.149
  diff -u -r1.148 -r1.149
  --- http_request.c    1999/05/12 16:50:42     1.148
  +++ http_request.c    1999/05/21 12:16:21     1.149
  @@ -370,7 +370,7 @@
   
               this_conf = NULL;
               if (entry_core->r) {
  -                if (!regexec(entry_core->r, r->filename, 0, NULL, 0))
  +                if (!ap_regexec(entry_core->r, r->filename, 0, NULL, 0))
                       this_conf = entry_config;
               }
               else if (entry_core->d_is_fnmatch) {
  @@ -536,7 +536,7 @@
                        ap_get_module_config(entry_config, &core_module);
   
           if (entry_core->r) {
  -            if (!regexec(entry_core->r, test_dirname, 0, NULL, REG_NOTEOL)) {
  +            if (!ap_regexec(entry_core->r, test_dirname, 0, NULL, 
REG_NOTEOL)) {
                   per_dir_defaults =
                       ap_merge_per_dir_configs(r->pool, per_dir_defaults,
                                             entry_config);
  @@ -612,7 +612,7 @@
        this_conf = NULL;
   
        if (entry_core->r) {
  -         if (!regexec(entry_core->r, r->uri, 0, NULL, 0))
  +         if (!ap_regexec(entry_core->r, r->uri, 0, NULL, 0))
                this_conf = entry_config;
        }
        else if (entry_core->d_is_fnmatch) {
  @@ -673,7 +673,7 @@
               this_conf = NULL;
   
               if (entry_core->r) {
  -                if (!regexec(entry_core->r, test_file, 0, NULL, 0))
  +                if (!ap_regexec(entry_core->r, test_file, 0, NULL, 0))
                       this_conf = entry_config;
               }
               else if (entry_core->d_is_fnmatch) {
  
  
  
  1.24      +4 -4      apache-1.3/src/main/util_uri.c
  
  Index: util_uri.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/main/util_uri.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- util_uri.c        1999/01/01 19:04:54     1.23
  +++ util_uri.c        1999/05/21 12:16:21     1.24
  @@ -306,11 +306,11 @@
       memset (uptr, '\0', sizeof(*uptr));
       uptr->is_initialized = 1;
   
  -    ret = regexec(&re_uri, uri, re_uri.re_nsub + 1, match, 0);
  +    ret = ap_regexec(&re_uri, uri, re_uri.re_nsub + 1, match, 0);
   
       if (ret != 0) {
        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, NULL,
  -                    "regexec() could not parse uri (\"%s\")",
  +                    "ap_regexec() could not parse uri (\"%s\")",
                    uri);
   
        return HTTP_BAD_REQUEST;
  @@ -336,10 +336,10 @@
   
       if (uptr->hostinfo) {
        /* Parse the hostinfo part to extract user, password, host, and port */
  -     ret = regexec(&re_hostpart, uptr->hostinfo, re_hostpart.re_nsub + 1, 
match, 0);
  +     ret = ap_regexec(&re_hostpart, uptr->hostinfo, re_hostpart.re_nsub + 1, 
match, 0);
        if (ret != 0) {
            ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, NULL,
  -                    "regexec() could not parse (\"%s\") as host part",
  +                    "ap_regexec() could not parse (\"%s\") as host part",
                    uptr->hostinfo);
   
            return HTTP_BAD_REQUEST;
  
  
  
  1.19      +1 -0      apache-1.3/src/support/httpd.exp
  
  Index: httpd.exp
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/support/httpd.exp,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- httpd.exp 1999/05/04 19:02:09     1.18
  +++ httpd.exp 1999/05/21 12:16:23     1.19
  @@ -249,6 +249,7 @@
   ap_rationalize_mtime
   ap_read_config
   ap_read_request
  +ap_regexec
   ap_register_cleanup
   ap_register_other_child
   ap_remove_module
  
  
  
  1.28      +1 -1      apache-1.3/src/modules/standard/mod_setenvif.c
  
  Index: mod_setenvif.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_setenvif.c,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- mod_setenvif.c    1999/05/19 13:26:09     1.27
  +++ mod_setenvif.c    1999/05/21 12:16:24     1.28
  @@ -378,7 +378,7 @@
               val = "";
           }
   
  -        if (!regexec(b->preg, val, 0, NULL, 0)) {
  +        if (!ap_regexec(b->preg, val, 0, NULL, 0)) {
            array_header *arr = ap_table_elts(b->features);
               elts = (table_entry *) arr->elts;
   
  
  
  
  1.139     +3 -3      apache-1.3/src/modules/standard/mod_rewrite.c
  
  Index: mod_rewrite.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_rewrite.c,v
  retrieving revision 1.138
  retrieving revision 1.139
  diff -u -r1.138 -r1.139
  --- mod_rewrite.c     1999/04/22 10:48:59     1.138
  +++ mod_rewrite.c     1999/05/21 12:16:24     1.139
  @@ -1799,7 +1799,7 @@
           rewritelog(r, 3, "[per-dir %s] applying pattern '%s' to uri '%s'",
                      perdir, p->pattern, uri);
       }
  -    rc = (regexec(regexp, uri, regexp->re_nsub+1, regmatch, 0) == 0);
  +    rc = (ap_regexec(regexp, uri, regexp->re_nsub+1, regmatch, 0) == 0);
       if (! (( rc && !(p->flags & RULEFLAG_NOTMATCH)) ||
              (!rc &&  (p->flags & RULEFLAG_NOTMATCH))   ) ) {
           return 0;
  @@ -2268,8 +2268,8 @@
       }
       else {
           /* it is really a regexp pattern, so apply it */
  -        rc = (regexec(p->regexp, input,
  -                      p->regexp->re_nsub+1, regmatch,0) == 0);
  +        rc = (ap_regexec(p->regexp, input,
  +                         p->regexp->re_nsub+1, regmatch,0) == 0);
   
           /* if it isn't a negated pattern and really matched
              we update the passed-through regex subst info structure */
  
  
  
  1.117     +1 -1      apache-1.3/src/modules/standard/mod_include.c
  
  Index: mod_include.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_include.c,v
  retrieving revision 1.116
  retrieving revision 1.117
  diff -u -r1.116 -r1.117
  --- mod_include.c     1999/05/13 19:00:41     1.116
  +++ mod_include.c     1999/05/21 12:16:25     1.117
  @@ -1187,7 +1187,7 @@
                       "unable to compile pattern \"%s\"", rexp);
           return -1;
       }
  -    regex_error = regexec(compiled, string, 0, (regmatch_t *) NULL, 0);
  +    regex_error = ap_regexec(compiled, string, 0, (regmatch_t *) NULL, 0);
       ap_pregfree(r->pool, compiled);
       return (!regex_error);
   }
  
  
  
  1.41      +1 -1      apache-1.3/src/modules/standard/mod_alias.c
  
  Index: mod_alias.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_alias.c,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- mod_alias.c       1999/01/01 19:05:06     1.40
  +++ mod_alias.c       1999/05/21 12:16:26     1.41
  @@ -300,7 +300,7 @@
        int l;
   
        if (p->regexp) {
  -         if (!regexec(p->regexp, r->uri, p->regexp->re_nsub + 1, regm, 0)) {
  +         if (!ap_regexec(p->regexp, r->uri, p->regexp->re_nsub + 1, regm, 
0)) {
                if (p->real) {
                    found = ap_pregsub(r->pool, p->real, r->uri,
                                    p->regexp->re_nsub + 1, regm);
  
  
  

Reply via email to