View | Details | Raw Unified | Return to bug 56528
Collapse All | Expand All

(-)a/modules/mappers/mod_rewrite.c (-11 / +24 lines)
Lines 2657-2663 static apr_status_t rewritelock_remove(void *data) Link Here
2657
 * XXX: what an inclined parser. Seems we have to leave it so
2657
 * XXX: what an inclined parser. Seems we have to leave it so
2658
 *      for backwards compat. *sigh*
2658
 *      for backwards compat. *sigh*
2659
 */
2659
 */
2660
static int parseargline(char *str, char **a1, char **a2, char **a3)
2660
static char *parseargline(apr_pool_t *p, char *str, char **a1, char **a2, char **a3)
2661
{
2661
{
2662
    char quote;
2662
    char quote;
2663
2663
Lines 2682-2688 static int parseargline(char *str, char **a1, char **a2, char **a3) Link Here
2682
    }
2682
    }
2683
2683
2684
    if (!*str) {
2684
    if (!*str) {
2685
        return 1;
2685
        return "bad argument line: at least two arguments required";
2686
    }
2686
    }
2687
    *str++ = '\0';
2687
    *str++ = '\0';
2688
2688
Lines 2708-2714 static int parseargline(char *str, char **a1, char **a2, char **a3) Link Here
2708
2708
2709
    if (!*str) {
2709
    if (!*str) {
2710
        *a3 = NULL; /* 3rd argument is optional */
2710
        *a3 = NULL; /* 3rd argument is optional */
2711
        return 0;
2711
        return NULL;
2712
    }
2712
    }
2713
    *str++ = '\0';
2713
    *str++ = '\0';
2714
2714
Lines 2718-2724 static int parseargline(char *str, char **a1, char **a2, char **a3) Link Here
2718
2718
2719
    if (!*str) {
2719
    if (!*str) {
2720
        *a3 = NULL; /* 3rd argument is still optional */
2720
        *a3 = NULL; /* 3rd argument is still optional */
2721
        return 0;
2721
        return NULL;
2722
    }
2722
    }
2723
2723
2724
    /*
2724
    /*
Lines 2737-2743 static int parseargline(char *str, char **a1, char **a2, char **a3) Link Here
2737
    }
2737
    }
2738
    *str = '\0';
2738
    *str = '\0';
2739
2739
2740
    return 0;
2740
    if (**a3 != '[') {
2741
        return apr_psprintf(p, "bad flag delimiters: third argument must begin "
2742
               "with '[' but found '%s' - too many arguments or rogue "
2743
               "whitespace?", *a3);
2744
    }
2745
    else if (*a3[strlen(*a3)-1] != ']') {
2746
        return apr_psprintf(p, "bad flag delimiters: third argument must end "
2747
                "with ']' but found %s - unintended whitespace within the "
2748
                "flags definition?", *a3);
2749
    }
2750
    return NULL;
2741
}
2751
}
2742
2752
2743
static void *config_server_create(apr_pool_t *p, server_rec *s)
2753
static void *config_server_create(apr_pool_t *p, server_rec *s)
Lines 3159-3164 static const char *cmd_parseflagfield(apr_pool_t *p, void *cfg, char *key, Link Here
3159
    const char *err;
3169
    const char *err;
3160
3170
3161
    endp = key + strlen(key) - 1;
3171
    endp = key + strlen(key) - 1;
3172
    /* This should have been checked before, but just in case... */
3162
    if (*key != '[' || *endp != ']') {
3173
    if (*key != '[' || *endp != ']') {
3163
        return "bad flag delimiters";
3174
        return "bad flag delimiters";
3164
    }
3175
    }
Lines 3256-3264 static const char *cmd_rewritecond(cmd_parms *cmd, void *in_dconf, Link Here
3256
     * of the argument line. So we can use a1 .. a3 without
3267
     * of the argument line. So we can use a1 .. a3 without
3257
     * copying them again.
3268
     * copying them again.
3258
     */
3269
     */
3259
    if (parseargline(str, &a1, &a2, &a3)) {
3270
    if ((err = parseargline(cmd->pool, str, &a1, &a2, &a3))) {
3260
        return apr_pstrcat(cmd->pool, "RewriteCond: bad argument line '", str,
3271
        return apr_psprintf(cmd->pool, "RewriteCond: %s "
3261
                           "'", NULL);
3272
                "(TestString=%s, CondPattern=%s, flags=%s)",
3273
                err, a1, a2, a3);
3262
    }
3274
    }
3263
3275
3264
    /* arg1: the input string */
3276
    /* arg1: the input string */
Lines 3671-3679 static const char *cmd_rewriterule(cmd_parms *cmd, void *in_dconf, Link Here
3671
    }
3683
    }
3672
3684
3673
    /*  parse the argument line ourself */
3685
    /*  parse the argument line ourself */
3674
    if (parseargline(str, &a1, &a2, &a3)) {
3686
    if ((err = parseargline(cmd->pool, str, &a1, &a2, &a3))) {
3675
        return apr_pstrcat(cmd->pool, "RewriteRule: bad argument line '", str,
3687
        return apr_psprintf(cmd->pool, "RewriteRule: %s "
3676
                           "'", NULL);
3688
                "(pattern='%s', substitution='%s', flags='%s')",
3689
                err, a1, a2, a3);
3677
    }
3690
    }
3678
3691
3679
    /* arg3: optional flags field */
3692
    /* arg3: optional flags field */

Return to bug 56528