From 8698a20fcc6a04ccbe533afd742e7a5df94423ee Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 18 Jun 2005 13:18:43 +0000 Subject: [PATCH] r7726: - removed some unused variables - handle ldb_errstring() calls on failed connect --- source/ldap_server/ldap_rootdse.c | 2 +- source/lib/ldb/ldb_ildap/ldb_ildap.c | 9 ++++++++- source/lib/ldb/tools/ldbmodify.c | 2 +- source/lib/ldb/tools/ldbtest.c | 1 - 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/source/ldap_server/ldap_rootdse.c b/source/ldap_server/ldap_rootdse.c index d4e11e429a9..e5c74be78d5 100644 --- a/source/ldap_server/ldap_rootdse.c +++ b/source/ldap_server/ldap_rootdse.c @@ -270,7 +270,7 @@ static NTSTATUS rootdse_Search(struct ldapsrv_partition *partition, struct ldaps struct ldapsrv_reply *ent_r, *done_r; struct ldb_context *ldb; const char *errstr = NULL; - int count, j, y; + int count, j; const char **attrs = NULL; if (r->scope != LDAP_SEARCH_SCOPE_BASE) { diff --git a/source/lib/ldb/ldb_ildap/ldb_ildap.c b/source/lib/ldb/ldb_ildap/ldb_ildap.c index 3f63af482f4..6560485be55 100644 --- a/source/lib/ldb/ldb_ildap/ldb_ildap.c +++ b/source/lib/ldb/ldb_ildap/ldb_ildap.c @@ -340,7 +340,11 @@ static int ildb_unlock(struct ldb_module *module, const char *lockname) */ static const char *ildb_errstring(struct ldb_module *module) { - struct ildb_private *ildb = module->private_data; + struct ildb_private *ildb = talloc_get_type(module->private_data, + struct ildb_private); + if (ildb == NULL) { + return "ildap not connected"; + } return ldap_errstr(ildb->ldap, ildb->last_rc); } @@ -427,6 +431,9 @@ int ildb_connect(struct ldb_context *ldb, const char *url, return 0; failed: + if (ldb->modules) { + ldb->modules->private_data = NULL; + } talloc_free(ildb); return -1; } diff --git a/source/lib/ldb/tools/ldbmodify.c b/source/lib/ldb/tools/ldbmodify.c index 39725b195d7..8fa0dcf0b6f 100644 --- a/source/lib/ldb/tools/ldbmodify.c +++ b/source/lib/ldb/tools/ldbmodify.c @@ -93,7 +93,7 @@ static int process_file(struct ldb_context *ldb, FILE *f) { struct ldb_context *ldb; int count=0; - int i, ret; + int i; struct ldb_cmdline *options; ldb = ldb_init(NULL); diff --git a/source/lib/ldb/tools/ldbtest.c b/source/lib/ldb/tools/ldbtest.c index 28ac7545a4e..7c7164c7859 100644 --- a/source/lib/ldb/tools/ldbtest.c +++ b/source/lib/ldb/tools/ldbtest.c @@ -353,7 +353,6 @@ static void usage(void) { TALLOC_CTX *mem_ctx = talloc_new(NULL); struct ldb_context *ldb; - int ret; ldb = ldb_init(mem_ctx); -- 2.11.4.GIT