From 5c9590587197dcb95007fdc54318187d5716c7c6 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Tue, 8 Nov 2005 00:11:45 +0000 Subject: r11567: Ldb API change patch. This patch changes the way lsb_search is called and the meaning of the returned integer. The last argument of ldb_search is changed from struct ldb_message to struct ldb_result which contains a pointer to a struct ldb_message list and a count of the number of messages. The return is not the count of messages anymore but instead it is an ldb error value. I tryed to keep the patch as tiny as possible bu as you can guess I had to change a good amount of places. I also tried to double check all my changes being sure that the calling functions would still behave as before. But this patch is big enough that I fear some bug may have been introduced anyway even if it passes the test suite. So if you are currently working on any file being touched please give it a deep look and blame me for any error. Simo. (This used to be commit 22c8c97e6fb466b41859e090e959d7f1134be780) --- source4/libnet/libnet_join.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'source4/libnet') diff --git a/source4/libnet/libnet_join.c b/source4/libnet/libnet_join.c index b487056494..0eb109c2cf 100644 --- a/source4/libnet/libnet_join.c +++ b/source4/libnet/libnet_join.c @@ -227,9 +227,10 @@ static NTSTATUS libnet_JoinADSDomain(struct libnet_context *ctx, struct libnet_J const struct ldb_dn *account_dn; const char *account_dn_str; const char *remote_ldb_url; - struct ldb_message **msgs, *msg; + struct ldb_result *res; + struct ldb_message *msg; - int rtn; + int ret, rtn; unsigned int kvno; @@ -403,9 +404,9 @@ static NTSTATUS libnet_JoinADSDomain(struct libnet_context *ctx, struct libnet_J } /* search for the user's record */ - rtn = ldb_search(remote_ldb, account_dn, LDB_SCOPE_BASE, - NULL, attrs, &msgs); - if (rtn != 1) { + ret = ldb_search(remote_ldb, account_dn, LDB_SCOPE_BASE, + NULL, attrs, &res); + if (ret != LDB_SUCCESS || res->count != 1) { r->out.error_string = talloc_asprintf(r, "ldb_search for %s failed - %s\n", account_dn_str, ldb_errstring(remote_ldb)); talloc_free(tmp_ctx); @@ -413,7 +414,7 @@ static NTSTATUS libnet_JoinADSDomain(struct libnet_context *ctx, struct libnet_J } /* If we have a kvno recorded in AD, we need it locally as well */ - kvno = ldb_msg_find_uint(msgs[0], "msDS-KeyVersionNumber", 0); + kvno = ldb_msg_find_uint(res->msgs[0], "msDS-KeyVersionNumber", 0); /* Prepare a new message, for the modify */ msg = ldb_msg_new(tmp_ctx); @@ -422,7 +423,7 @@ static NTSTATUS libnet_JoinADSDomain(struct libnet_context *ctx, struct libnet_J talloc_free(tmp_ctx); return NT_STATUS_NO_MEMORY; } - msg->dn = msgs[0]->dn; + msg->dn = res->msgs[0]->dn; { int i; -- cgit