Author: lmuelle
Date: 2007-07-04 19:52:51 +0000 (Wed, 04 Jul 2007)
New Revision: 23707

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23707

Log:
- Move the asprintf() call to create the key even in
  get_conf_item_string() to the later if statement.
- Also move the key definition to the later if statement in
  get_conf_item_string() and get_conf_item_int().

Modified:
   branches/SAMBA_3_0/source/nsswitch/pam_winbind.c
   branches/SAMBA_3_0_26/source/nsswitch/pam_winbind.c


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/pam_winbind.c
===================================================================
--- branches/SAMBA_3_0/source/nsswitch/pam_winbind.c    2007-07-04 16:17:48 UTC 
(rev 23706)
+++ branches/SAMBA_3_0/source/nsswitch/pam_winbind.c    2007-07-04 19:52:51 UTC 
(rev 23707)
@@ -1491,24 +1491,12 @@
 {
        int i = 0;
        const char *parm_opt = NULL;
-       char *key = NULL;
 
        if (!(ctrl & config_flag)) {
                goto out;
        }
 
        /* let the pam opt take precedence over the pam_winbind.conf option */
-
-       if (d != NULL) {
-
-               if (!asprintf(&key, "global:%s", item)) {
-                       goto out;
-               }
-
-               parm_opt = iniparser_getstr(d, key);
-               SAFE_FREE(key);
-       }
-
        for ( i=0; i<argc; i++ ) {
 
                if ((strncmp(argv[i], item, strlen(item)) == 0)) {
@@ -1524,6 +1512,15 @@
        }
 
        if (d != NULL) {
+               char *key = NULL;
+
+               if (!asprintf(&key, "global:%s", item)) {
+                       goto out;
+               }
+
+               parm_opt = iniparser_getstr(d, key);
+               SAFE_FREE(key);
+
                _pam_log_debug(pamh, ctrl, LOG_INFO, "CONFIG file: %s '%s'\n", 
item, parm_opt);
        }
 out:
@@ -1537,8 +1534,7 @@
                              dictionary *d,
                              const char *item)
 {
-       int parm_opt = -1, i = 0;
-       char *key = NULL;
+       int i, parm_opt = -1;
 
        /* let the pam opt take precedence over the pam_winbind.conf option */
        for (i = 0; i < argc; i++) {
@@ -1561,6 +1557,8 @@
        }
 
        if (d != NULL) {
+               char *key = NULL;
+
                if (!asprintf(&key, "global:%s", item)) {
                        goto out;
                }

Modified: branches/SAMBA_3_0_26/source/nsswitch/pam_winbind.c
===================================================================
--- branches/SAMBA_3_0_26/source/nsswitch/pam_winbind.c 2007-07-04 16:17:48 UTC 
(rev 23706)
+++ branches/SAMBA_3_0_26/source/nsswitch/pam_winbind.c 2007-07-04 19:52:51 UTC 
(rev 23707)
@@ -1491,24 +1491,12 @@
 {
        int i = 0;
        const char *parm_opt = NULL;
-       char *key = NULL;
 
        if (!(ctrl & config_flag)) {
                goto out;
        }
 
        /* let the pam opt take precedence over the pam_winbind.conf option */
-
-       if (d != NULL) {
-
-               if (!asprintf(&key, "global:%s", item)) {
-                       goto out;
-               }
-
-               parm_opt = iniparser_getstr(d, key);
-               SAFE_FREE(key);
-       }
-
        for ( i=0; i<argc; i++ ) {
 
                if ((strncmp(argv[i], item, strlen(item)) == 0)) {
@@ -1524,6 +1512,15 @@
        }
 
        if (d != NULL) {
+               char *key = NULL;
+
+               if (!asprintf(&key, "global:%s", item)) {
+                       goto out;
+               }
+
+               parm_opt = iniparser_getstr(d, key);
+               SAFE_FREE(key);
+
                _pam_log_debug(pamh, ctrl, LOG_INFO, "CONFIG file: %s '%s'\n", 
item, parm_opt);
        }
 out:
@@ -1537,8 +1534,7 @@
                              dictionary *d,
                              const char *item)
 {
-       int parm_opt = -1, i = 0;
-       char *key = NULL;
+       int i, parm_opt = -1;
 
        /* let the pam opt take precedence over the pam_winbind.conf option */
        for (i = 0; i < argc; i++) {
@@ -1561,6 +1557,8 @@
        }
 
        if (d != NULL) {
+               char *key = NULL;
+
                if (!asprintf(&key, "global:%s", item)) {
                        goto out;
                }

Reply via email to