1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

ldb_ildap: require ldb_get_opaque(ldb, "loadparm") to be valid

Without a valid loadparm_context we can't connect.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 2435ab1ad7)
This commit is contained in:
Stefan Metzmacher 2024-04-17 21:02:03 +02:00 committed by Jule Anger
parent 07e707c4de
commit 5545d934ec

View File

@ -917,6 +917,12 @@ static int ildb_connect(struct ldb_context *ldb, const char *url,
struct cli_credentials *creds;
struct loadparm_context *lp_ctx;
lp_ctx = talloc_get_type(ldb_get_opaque(ldb, "loadparm"),
struct loadparm_context);
if (lp_ctx == NULL) {
return ldb_operr(ldb);
}
module = ldb_module_new(ldb, ldb, "ldb_ildap backend", &ildb_ops);
if (!module) return LDB_ERR_OPERATIONS_ERROR;
@ -929,9 +935,6 @@ static int ildb_connect(struct ldb_context *ldb, const char *url,
ildb->event_ctx = ldb_get_event_context(ldb);
lp_ctx = talloc_get_type(ldb_get_opaque(ldb, "loadparm"),
struct loadparm_context);
ildb->ldap = ldap4_new_connection(ildb, lp_ctx,
ildb->event_ctx);
if (!ildb->ldap) {