svn commit: samba r19309 - in branches/SAMBA_4_0/source/libnet: .

abartlet at samba.org abartlet at samba.org
Mon Oct 16 01:20:32 GMT 2006


Author: abartlet
Date: 2006-10-16 01:20:31 +0000 (Mon, 16 Oct 2006)
New Revision: 19309

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

Log:
Split out checks for LDB_SUCCESS from checks for the expected number
of returned entries.

Andrew Bartlett


Modified:
   branches/SAMBA_4_0/source/libnet/libnet_join.c


Changeset:
Modified: branches/SAMBA_4_0/source/libnet/libnet_join.c
===================================================================
--- branches/SAMBA_4_0/source/libnet/libnet_join.c	2006-10-16 01:19:01 UTC (rev 19308)
+++ branches/SAMBA_4_0/source/libnet/libnet_join.c	2006-10-16 01:20:31 UTC (rev 19309)
@@ -246,15 +246,23 @@
 
 	/* search for the user's record */
 	ret = ldb_search(remote_ldb, account_dn, LDB_SCOPE_BASE, 
-			     NULL, attrs, &res);
-	talloc_steal(tmp_ctx, res);
-	if (ret != LDB_SUCCESS || res->count != 1) {
+			 NULL, attrs, &res);
+	if (ret != LDB_SUCCESS) {
 		r->out.error_string = talloc_asprintf(r, "ldb_search for %s failed - %s",
 						      account_dn_str, ldb_errstring(remote_ldb));
 		talloc_free(tmp_ctx);
 		return NT_STATUS_UNSUCCESSFUL;
 	}
 
+	talloc_steal(tmp_ctx, res);
+
+	if (res->count != 1) {
+		r->out.error_string = talloc_asprintf(r, "ldb_search for %s failed - found %d entries",
+						      account_dn_str, res->count);
+		talloc_free(tmp_ctx);
+		return NT_STATUS_UNSUCCESSFUL;
+	}
+
 	/* If we have a kvno recorded in AD, we need it locally as well */
 	kvno = ldb_msg_find_attr_as_uint(res->msgs[0], "msDS-KeyVersionNumber", 0);
 



More information about the samba-cvs mailing list