[SCM] Samba Shared Repository - branch master updated

David Disseldorp ddiss at samba.org
Wed Nov 20 08:13:04 MST 2013


The branch, master has been updated
       via  01cae09 handle later iniparser version assigning a zero length string value for 'key='
      from  3f77bf2 testparm: Warnings should not cause failure

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 01cae099e0aab96fc3d3f21cd19b8925180f0351
Author: Noel Power <noel.power at suse.com>
Date:   Tue Nov 5 17:24:46 2013 +0000

    handle later iniparser version assigning a zero length string value for 'key='
    
    older iniparser versions ( like that used in upstream samba ) ignore 'key='
    entries, the key is not entered into the dictionary at all. Later
    versions of iniparse specifically handle the following special cases
    
    * key=
    * key=;
    * key=#
    
    by assigning a value of "" ( a zero length string ) to the key
    in the dictionary.
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: David Disseldorp <ddiss at samba.org>
    
    Autobuild-User(master): David Disseldorp <ddiss at samba.org>
    Autobuild-Date(master): Wed Nov 20 16:12:13 CET 2013 on sn-devel-104

-----------------------------------------------------------------------

Summary of changes:
 nsswitch/pam_winbind.c |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/nsswitch/pam_winbind.c b/nsswitch/pam_winbind.c
index 9f85556..2e37662 100644
--- a/nsswitch/pam_winbind.c
+++ b/nsswitch/pam_winbind.c
@@ -330,6 +330,21 @@ static void _pam_log_state_datum(struct pwb_context *ctx,
 #define _PAM_LOG_STATE_ITEM_PASSWORD(ctx, item_type) \
 	_pam_log_state_datum(ctx, item_type, #item_type, \
 			     _LOG_PASSWORD_AS_STRING)
+/*
+ * wrapper to preserve old behaviour of iniparser which ignored
+ * key values that had no value assigned like
+ *    key =
+ * for a key like above newer iniparser will return a zero-length
+ * string, previously iniparser would return NULL
+ */
+static char *iniparser_getstring_nonempty(dictionary *d, char *key, char *def)
+{
+	char *ret = iniparser_getstring(d, key, def);
+	if (ret && strlen(ret) == 0) {
+		ret = NULL;
+	}
+	return ret;
+}
 
 static void _pam_log_state(struct pwb_context *ctx)
 {
@@ -418,13 +433,13 @@ static int _pam_parse(const pam_handle_t *pamh,
 		ctrl |= WINBIND_SILENT;
 	}
 
-	if (iniparser_getstring(d, discard_const_p(char, "global:krb5_ccache_type"), NULL) != NULL) {
+	if (iniparser_getstring_nonempty(d, discard_const_p(char, "global:krb5_ccache_type"), NULL) != NULL) {
 		ctrl |= WINBIND_KRB5_CCACHE_TYPE;
 	}
 
-	if ((iniparser_getstring(d, discard_const_p(char, "global:require-membership-of"), NULL)
+	if ((iniparser_getstring_nonempty(d, discard_const_p(char, "global:require-membership-of"), NULL)
 	     != NULL) ||
-	    (iniparser_getstring(d, discard_const_p(char, "global:require_membership_of"), NULL)
+	    (iniparser_getstring_nonempty(d, discard_const_p(char, "global:require_membership_of"), NULL)
 	     != NULL)) {
 		ctrl |= WINBIND_REQUIRED_MEMBERSHIP;
 	}
@@ -2262,7 +2277,7 @@ static const char *get_conf_item_string(struct pwb_context *ctx,
 			goto out;
 		}
 
-		parm_opt = iniparser_getstring(ctx->dict, key, NULL);
+		parm_opt = iniparser_getstring_nonempty(ctx->dict, key, NULL);
 		TALLOC_FREE(key);
 
 		_pam_log_debug(ctx, LOG_INFO, "CONFIG file: %s '%s'\n",


-- 
Samba Shared Repository


More information about the samba-cvs mailing list