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

(-)mod_authnz_ldap.c.orig (-2 / +20 lines)
Lines 76-81 Link Here
76
                                        it's the exact string passed by the HTTP client */
76
                                        it's the exact string passed by the HTTP client */
77
77
78
    int secure;                     /* True if SSL connections are requested */
78
    int secure;                     /* True if SSL connections are requested */
79
80
    char *prepend_string;           /* String to prepend to the beginning of the search attribute */
81
    char *append_string;            /* String to append to the end of the search attribute */
79
} authn_ldap_config_t;
82
} authn_ldap_config_t;
80
83
81
typedef struct {
84
typedef struct {
Lines 214-223 Link Here
214
    }
217
    }
215
218
216
    /*
219
    /*
217
     * Create the first part of the filter, which consists of the
220
     * Create the first part or the filter, which consists of the
218
     * config-supplied portions.
221
     * config-supplied portions.
219
     */
222
     */
220
    apr_snprintf(filtbuf, FILTER_LENGTH, "(&(%s)(%s=", filter, sec->attribute);
223
224
    /* Added prepend_string to attribute */
225
    apr_snprintf(filtbuf, FILTER_LENGTH, "(&(%s)(%s=%s", filter, sec->attribute, sec->prepend_string);
221
226
222
    /*
227
    /*
223
     * Now add the client-supplied username to the filter, ensuring that any
228
     * Now add the client-supplied username to the filter, ensuring that any
Lines 267-272 Link Here
267
#endif
272
#endif
268
    *q = '\0';
273
    *q = '\0';
269
274
275
    if (q + strlen(sec->append_string) <= filtbuf_end)
276
	    strcat(filtbuf, sec->append_string);
277
270
    /*
278
    /*
271
     * Append the closing parens of the filter, unless doing so would
279
     * Append the closing parens of the filter, unless doing so would
272
     * overrun the buffer.
280
     * overrun the buffer.
Lines 309-314 Link Here
309
    sec->user_is_dn = 0;
317
    sec->user_is_dn = 0;
310
    sec->remote_user_attribute = NULL;
318
    sec->remote_user_attribute = NULL;
311
    sec->compare_dn_on_server = 0;
319
    sec->compare_dn_on_server = 0;
320
    sec->prepend_string = "";
321
    sec->append_string = "";
312
322
313
    return sec;
323
    return sec;
314
}
324
}
Lines 1129-1134 Link Here
1129
                  "Character set conversion configuration file. If omitted, character set"
1139
                  "Character set conversion configuration file. If omitted, character set"
1130
                  "conversion is disabled."),
1140
                  "conversion is disabled."),
1131
1141
1142
    AP_INIT_TAKE1("AuthLDAPAttrPrependString", ap_set_string_slot,
1143
                  (void *)APR_OFFSETOF(authn_ldap_config_t, prepend_string), OR_AUTHCFG,
1144
                  "String to prepend to beginning of the attribute we are searching for."),
1145
1146
    AP_INIT_TAKE1("AuthLDAPAttrAppendString", ap_set_string_slot,
1147
                  (void *)APR_OFFSETOF(authn_ldap_config_t, append_string), OR_AUTHCFG,
1148
                  "String to append to end of the attribute we are searching for."),
1149
1132
    {NULL}
1150
    {NULL}
1133
};
1151
};
1134
1152

Return to bug 51322