]> granicus.if.org Git - apache/commitdiff
Rationalisation suggested by rpluem
authorNick Kew <niq@apache.org>
Thu, 26 Jul 2007 21:41:43 +0000 (21:41 +0000)
committerNick Kew <niq@apache.org>
Thu, 26 Jul 2007 21:41:43 +0000 (21:41 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@559999 13f79535-47bb-0310-9956-ffa450edef68

modules/filters/mod_filter.c

index 7b634106da7a17a8c87a0a69593380447ff576e5..778895b46897288a903a75c9ab3d9bf46588de0b 100644 (file)
@@ -201,23 +201,16 @@ static int filter_lookup(ap_filter_t *f, ap_filter_rec_t *filter)
             }
         }
         /* we can't check for NULL in provider as that kills integer 0
-        * so we have to test each string/regexp case in the switch
-        */
+         * so we have to test each string/regexp case in the switch
+         */
         else {
             switch (provider->match_type) {
             case STRING_MATCH:
-                if (!provider->match.string) {
-                    match = 0;
-                }
-               else if (strcasecmp(str, provider->match.string)) {
+                if (strcasecmp(str, provider->match.string)) {
                     match = 0;
                 }
                 break;
             case STRING_CONTAINS:
-                if (!provider->match.string) {
-                    match = 0;
-                    break;
-                }
                 str1 = apr_pstrdup(r->pool, str);
                 ap_str_tolower(str1);
                 if (!strstr(str1, provider->match.string)) {
@@ -225,11 +218,8 @@ static int filter_lookup(ap_filter_t *f, ap_filter_rec_t *filter)
                 }
                 break;
             case REGEX_MATCH:
-                if (!provider->match.string) {
-                    match = 0;
-                }
-               else if (ap_regexec(provider->match.regex, str, 0, NULL, 0)
-                         == AP_REG_NOMATCH) {
+                if (ap_regexec(provider->match.regex, str, 0, NULL, 0)
+                    == AP_REG_NOMATCH) {
                     match = 0;
                 }
                 break;
@@ -601,6 +591,9 @@ static const char *filter_provider(cmd_parms *cmd, void *CFG, const char *args)
                                                          match,
                                                          rxend-match),
                                             flags);
+        if (provider->match.regex == NULL) {
+            return "Bad regexp";
+        }
         break;
     case '*':
         provider->match_type = DEFINED;