ASF Bugzilla – Attachment 24263 Details for
Bug 47838
Ability to Dynamically Inject Current Time Into a Filter
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Better handles dollar sign in filter
mod_authnz-ldap-time-template.diff (text/plain), 1.86 KB, created by
Ray Gauss II
on 2009-09-14 11:51:16 UTC
(
hide
)
Description:
Better handles dollar sign in filter
Filename:
MIME Type:
Creator:
Ray Gauss II
Created:
2009-09-14 11:51:16 UTC
Size:
1.86 KB
patch
obsolete
>--- mod_authnz_ldap-old.c 2009-09-12 08:13:25.000000000 -0400 >+++ mod_authnz_ldap.c 2009-09-14 14:37:13.000000000 -0400 >@@ -184,6 +184,13 @@ > apr_size_t inbytes; > apr_size_t outbytes; > char *outbuf; >+ >+ time_t now; >+ char formatedtime[1024]; >+ char outputbuffer[FILTER_LENGTH]; >+ const char *inp; >+ int outi; >+ struct tm *tp; > > if (sent_user != NULL) { > user = apr_pstrdup (r->pool, sent_user); >@@ -211,12 +218,43 @@ > user = apr_pstrdup(r->pool, outbuf); > } > } >+ >+#define addstring(w) \ >+outi += snprintf(&outputbuffer[outi], FILTER_LENGTH - outi, "%s", w) >+ >+ memset(outputbuffer, 0, FILTER_LENGTH); >+ outi = 0; inp = filter; >+ >+ while ((*inp) && (outi < (FILTER_LENGTH - 1))) { >+ if (*inp != '$') { >+ outputbuffer[outi++] = *inp++; >+ } else { >+ inp++; >+ switch (*inp) { >+ case 't': >+ time(&now); >+ tp = localtime(&now); >+ strftime(formatedtime, sizeof(formatedtime), >+ "%Y%m%d%H%M%S", tp); >+ addstring(formatedtime); >+ break; >+ default: >+ inp--; >+ outputbuffer[outi++] = *inp; >+ break; >+ } >+ inp++; >+ } >+ } >+ >+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, >+ "[%" APR_PID_T_FMT "] auth_ldap authenticate: filter after template replace %s", getpid(), outputbuffer); > > /* > * Create the first part of the filter, which consists of the > * config-supplied portions. > */ >- apr_snprintf(filtbuf, FILTER_LENGTH, "(&(%s)(%s=", filter, sec->attribute); >+ apr_snprintf(filtbuf, FILTER_LENGTH, "(&(%s)(%s=", outputbuffer, sec->attribute); > > /* > * Now add the client-supplied username to the filter, ensuring that any
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 47838
:
24261
| 24263