summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-10-16 01:20:31 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:21:06 -0500
commit2ac52f809afcd85ee7ed80bbac64594f1e780942 (patch)
tree92f3ebf5b32b2f2aae56cf6927a444252902f14d
parent379e6598e128e5e63a10bd6a81ede01d3965a8be (diff)
downloadsamba-2ac52f809afcd85ee7ed80bbac64594f1e780942.tar.gz
samba-2ac52f809afcd85ee7ed80bbac64594f1e780942.tar.bz2
samba-2ac52f809afcd85ee7ed80bbac64594f1e780942.zip
r19309: Split out checks for LDB_SUCCESS from checks for the expected number
of returned entries. Andrew Bartlett (This used to be commit 84efd9ecd994b53817dde8c1ad995afb7ebc8192)
-rw-r--r--source4/libnet/libnet_join.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/source4/libnet/libnet_join.c b/source4/libnet/libnet_join.c
index 8112d043f6..96d9e7f0de 100644
--- a/source4/libnet/libnet_join.c
+++ b/source4/libnet/libnet_join.c
@@ -246,15 +246,23 @@ static NTSTATUS libnet_JoinADSDomain(struct libnet_context *ctx, struct libnet_J
/* 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);