]> andersk Git - mod-vhost-ldap.git/commitdiff
Refactor code for processing attributes from LDAP.
authorGreg Brockman <gdb@mit.edu>
Thu, 26 Aug 2010 20:28:43 +0000 (20:28 +0000)
committerGreg Brockman <gdb@mit.edu>
Thu, 26 Aug 2010 20:28:43 +0000 (20:28 +0000)
This patch should not change any behavior.  We do this refactoring in
preparation for switching to ap_walk_config.

git-svn-id: svn://scripts.mit.edu/trunk@1604 db9d59ff-b01e-0410-9b1a-cd9a8c06840f

mod_vhost_ldap.c

index 918f5cdbd288b1dacb43b38f26739907d84d4a1c..dc112124dc389b63c406e75c40834f0e13249aa1 100644 (file)
@@ -575,28 +575,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.075694 seconds and 5 git commands to generate.