svn commit: samba r1728 - trunk/source/passdb

mimir at samba.org mimir at samba.org
Wed Aug 11 16:27:31 GMT 2004


Author: mimir
Date: 2004-08-11 16:27:31 +0000 (Wed, 11 Aug 2004)
New Revision: 1728
WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/&rev=1728&nolog=1
Log:
1) Domain name field in ldap mod structure should be changed only when
   the actual field has changed (as is the case with sid, flags, etc.).
2) Quiet const-related compiler warnings.


rafal


Modified:
   trunk/source/passdb/pdb_ldap.c

Changeset:
Modified: trunk/source/passdb/pdb_ldap.c
===================================================================
--- trunk/source/passdb/pdb_ldap.c	2004-08-11 16:17:43 UTC (rev 1727)
+++ trunk/source/passdb/pdb_ldap.c	2004-08-11 16:27:31 UTC (rev 1728)
@@ -3286,12 +3286,14 @@
 
 	/* Domain name of the trust */
 	if (entry) {
-		ret = smbldap_get_single_attribute(ldap_state->smbldap_state->ldap_struct, entry,
-						   attr_domain, attr_val, sizeof(attr_val));
-		if (ret)
-			if (strncmp(pdb_get_tp_domain_name_c(trustpw), attr_val, sizeof(attr_val)))
-				smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, entry, mod,
-						 attr_domain, pdb_get_tp_domain_name_c(trustpw));
+		if (strlen(pdb_get_tp_domain_name_c(trustpw))) {
+			ret = smbldap_get_single_attribute(ldap_state->smbldap_state->ldap_struct, entry,
+							   attr_domain, attr_val, sizeof(attr_val));
+			if (ret)
+				if (strncmp(pdb_get_tp_domain_name_c(trustpw), attr_val, sizeof(attr_val)))
+					smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, entry, mod,
+							 attr_domain, pdb_get_tp_domain_name_c(trustpw));
+		}
 	} else {
 		smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, entry, mod,
 				 attr_domain, pdb_get_tp_domain_name_c(trustpw));
@@ -3323,10 +3325,11 @@
 						   attr_sid, attr_val, sizeof(attr_val));
 		if (ret) {
 			/* pattern of "empty sid compare" */
-			DOM_SID empty;
-			memset(&empty, 0, sizeof(empty));
+			DOM_SID empty_sid;
+			memset(&empty_sid, 0, sizeof(empty_sid));
+			const void *empty = &empty_sid, *new = &sid;
 
-			if (memcmp((void*)sid, (void*)&empty, sizeof(DOM_SID)) &&
+			if (memcmp(new, empty, sizeof(DOM_SID)) &&
 			    strncmp(sid_to_string(sidstr, sid), attr_val, sizeof(attr_val)))
 				smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, entry, mod,
 						 attr_sid, sidstr);



More information about the samba-cvs mailing list