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

(-)mod_authnz_ldap-old.c (-1 / +39 lines)
Lines 184-189 Link Here
184
    apr_size_t inbytes;
184
    apr_size_t inbytes;
185
    apr_size_t outbytes;
185
    apr_size_t outbytes;
186
    char *outbuf;
186
    char *outbuf;
187
	
188
	time_t			now;
189
    char			formatedtime[1024];
190
    char			outputbuffer[FILTER_LENGTH];
191
    const char		*inp;
192
    int				outi;
193
    struct tm		*tp;
187
194
188
    if (sent_user != NULL) {
195
    if (sent_user != NULL) {
189
        user = apr_pstrdup (r->pool, sent_user);
196
        user = apr_pstrdup (r->pool, sent_user);
Lines 211-222 Link Here
211
            user = apr_pstrdup(r->pool, outbuf);
218
            user = apr_pstrdup(r->pool, outbuf);
212
        }
219
        }
213
    }
220
    }
221
	
222
#define	addstring(w)							\
223
outi += snprintf(&outputbuffer[outi], FILTER_LENGTH - outi, "%s", w)
224
	
225
    memset(outputbuffer, 0, FILTER_LENGTH);
226
    outi = 0; inp = filter;
227
	
228
    while ((*inp) && (outi < (FILTER_LENGTH - 1))) {
229
        if (*inp != '$') {
230
            outputbuffer[outi++] = *inp++;
231
        } else {
232
            inp++;
233
            switch (*inp) {
234
                case 't':
235
                    time(&now);
236
                    tp = localtime(&now);
237
                    strftime(formatedtime, sizeof(formatedtime),
238
                        "%Y%m%d%H%M%S", tp);
239
                    addstring(formatedtime);
240
                    break;
241
                default:
242
					inp--;
243
					outputbuffer[outi++] = *inp;
244
                    break;
245
            }
246
            inp++;
247
        }
248
    }
249
	
250
    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
251
        "[%" APR_PID_T_FMT "] auth_ldap authenticate: filter after template replace %s", getpid(), outputbuffer);
214
252
215
    /*
253
    /*
216
     * Create the first part of the filter, which consists of the
254
     * Create the first part of the filter, which consists of the
217
     * config-supplied portions.
255
     * config-supplied portions.
218
     */
256
     */
219
    apr_snprintf(filtbuf, FILTER_LENGTH, "(&(%s)(%s=", filter, sec->attribute);
257
    apr_snprintf(filtbuf, FILTER_LENGTH, "(&(%s)(%s=", outputbuffer, sec->attribute);
220
258
221
    /*
259
    /*
222
     * Now add the client-supplied username to the filter, ensuring that any
260
     * Now add the client-supplied username to the filter, ensuring that any

Return to bug 47838