r7726: - removed some unused variables
authorAndrew Tridgell <tridge@samba.org>
Sat, 18 Jun 2005 13:18:43 +0000 (13:18 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:18:27 +0000 (13:18 -0500)
- handle ldb_errstring() calls on failed connect
(This used to be commit 8698a20fcc6a04ccbe533afd742e7a5df94423ee)

source4/ldap_server/ldap_rootdse.c
source4/lib/ldb/ldb_ildap/ldb_ildap.c
source4/lib/ldb/tools/ldbmodify.c
source4/lib/ldb/tools/ldbtest.c

index d4e11e429a987f38cdd00d772597b62fdbaa2c00..e5c74be78d5acb6ba0010e124dab8d969b53d883 100644 (file)
@@ -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) {
index 3f63af482f413ce7656eb180cdc47693adb23fee..6560485be5580fdddb87266649a5330a71478cc1 100644 (file)
@@ -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;
 }
index 39725b195d79a618324cc6526d1a9619c1f0f30a..8fa0dcf0b6f75a4e25ea10eff6f70430b8c3b0cf 100644 (file)
@@ -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);
index 28ac7545a4eb0f15d28b4c7227393235df9b82c5..7c7164c78599db41584bcc7777defa0b3dd5a091 100644 (file)
@@ -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);