]> andersk Git - mod-vhost-ldap.git/commitdiff
Refactor code for processing attributes from LDAP.
authorGreg Brockman <gdb@mit.edu>
Sun, 15 Aug 2010 14:40:23 +0000 (10:40 -0400)
committerAnders Kaseorg <andersk@mit.edu>
Fri, 18 Mar 2011 06:30:16 +0000 (02:30 -0400)
This patch should not change any behavior.  We do this refactoring in
preparation for switching to ap_walk_config.

mod_vhost_ldap.c

index 54decbf43a376b1c527782b4626e63aa4684fa2f..5ff766cc0163d46c9cc067816078365050df03d6 100644 (file)
@@ -573,28 +573,28 @@ null:
 
     /* Optimize */
     if (vals) {
-       int i = 0;
-       while (attributes[i]) {
+       int i;
+       for (i = 0; attributes[i]; i++) {
 
+           char *val = apr_pstrdup (r->pool, vals[i]);
            if (strcasecmp (attributes[i], "apacheServerName") == 0) {
-               reqc->name = apr_pstrdup (r->pool, vals[i]);
+               reqc->name = val;
            }
            else if (strcasecmp (attributes[i], "apacheServerAdmin") == 0) {
-               reqc->admin = apr_pstrdup (r->pool, vals[i]);
+               reqc->admin = val;
            }
            else if (strcasecmp (attributes[i], "apacheDocumentRoot") == 0) {
-               reqc->docroot = apr_pstrdup (r->pool, vals[i]);
+               reqc->docroot = val;
            }
            else if (strcasecmp (attributes[i], "apacheScriptAlias") == 0) {
-               reqc->cgiroot = apr_pstrdup (r->pool, vals[i]);
+               reqc->cgiroot = val;
            }
            else if (strcasecmp (attributes[i], "apacheSuexecUid") == 0) {
-               reqc->uid = apr_pstrdup(r->pool, vals[i]);
+               reqc->uid = val;
            }
            else if (strcasecmp (attributes[i], "apacheSuexecGid") == 0) {
-               reqc->gid = apr_pstrdup(r->pool, vals[i]);
+               reqc->gid = val;
            }
-           i++;
        }
     }
 
This page took 0.170755 seconds and 5 git commands to generate.