svn commit: samba r16829 - in branches/SAMBA_4_0/source: auth/gensec dsdb/samdb/ldb_modules lib/ldb/common

abartlet at samba.org abartlet at samba.org
Thu Jul 6 05:51:40 GMT 2006


Author: abartlet
Date: 2006-07-06 05:51:39 +0000 (Thu, 06 Jul 2006)
New Revision: 16829

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

Log:
Fix a number of issues raised by the IBM checker, or gcc warnings.

In particular, this removes one use of the LDB_DN_NULL_FAILED macro,
which was being used on more than DNs, had an embedded goto, and
confused the IBM checker.

In the password_hash code, ensure that sambaAttr is not, before
checking the number of values.

In GENSEC, note that this switch value can't occour.  This seems to be
the only way to quiet both the IBM checker and gcc, as well as cope
with possibly invalid inputs.

Andrew Bartlet

Modified:
   branches/SAMBA_4_0/source/auth/gensec/gensec.c
   branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/password_hash.c
   branches/SAMBA_4_0/source/lib/ldb/common/ldb_dn.c


Changeset:
Modified: branches/SAMBA_4_0/source/auth/gensec/gensec.c
===================================================================
--- branches/SAMBA_4_0/source/auth/gensec/gensec.c	2006-07-06 05:25:36 UTC (rev 16828)
+++ branches/SAMBA_4_0/source/auth/gensec/gensec.c	2006-07-06 05:51:39 UTC (rev 16829)
@@ -87,8 +87,9 @@
 				j++;
 			}
 			break;
-		case CRED_AUTO_USE_KERBEROS:
-			break;
+		default:
+			/* Can't happen or invalid parameter */
+			return NULL;
 		}
 	}
 	new_gensec_list[j] = NULL; 

Modified: branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/password_hash.c
===================================================================
--- branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/password_hash.c	2006-07-06 05:25:36 UTC (rev 16828)
+++ branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/password_hash.c	2006-07-06 05:51:39 UTC (rev 16829)
@@ -597,7 +597,7 @@
 
 	/* check sambaPassword is single valued here */
 	/* TODO: remove this when sambaPassword will be single valued in schema */
-	if (sambaAttr->num_values > 1) {
+	if (sambaAttr && sambaAttr->num_values > 1) {
 		ldb_set_errstring(module->ldb, 
 				  talloc_asprintf(req,
 						  "mupltiple values for sambaPassword not allowed!\n"));

Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_dn.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb_dn.c	2006-07-06 05:25:36 UTC (rev 16828)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_dn.c	2006-07-06 05:51:39 UTC (rev 16829)
@@ -578,32 +578,35 @@
 	if (edn == NULL) return NULL;
 
 	cedn = ldb_dn_new(ldb);
-	LDB_DN_NULL_FAILED(cedn);
+	return NULL;
 
 	cedn->comp_num = edn->comp_num;
 	cedn->components = talloc_array(cedn, struct ldb_dn_component, edn->comp_num);
-	LDB_DN_NULL_FAILED(cedn->components);
+	if (!cedn->components) {
+		talloc_free(cedn);
+		return NULL;
+	}
 
 	for (i = 0; i < edn->comp_num; i++) {
 		struct ldb_dn_component dc;
 		const struct ldb_attrib_handler *h;
 
 		dc.name = ldb_attr_casefold(cedn, edn->components[i].name);
-		LDB_DN_NULL_FAILED(dc.name);
+		if (!dc.name) {
+			talloc_free(cedn);
+			return NULL;
+		}
 
 		h = ldb_attrib_handler(ldb, dc.name);
 		if (h->canonicalise_fn(ldb, cedn, &(edn->components[i].value), &(dc.value)) != 0) {
-			goto failed;
+			talloc_free(cedn);
+			return NULL;
 		}
 
 		cedn->components[i] = dc;
 	}
 
 	return cedn;
-
-failed:
-	talloc_free(cedn);
-	return NULL;
 }
 
 struct ldb_dn *ldb_dn_explode_casefold(struct ldb_context *ldb, const char *dn)



More information about the samba-cvs mailing list