r15964: fix error handling in ldb_ildap backend
authorStefan Metzmacher <metze@samba.org>
Tue, 30 May 2006 19:41:29 +0000 (19:41 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:08:45 +0000 (14:08 -0500)
metze
(This used to be commit 54e5aeff87b859960dfc5e4b6e3ab026ce5470ff)

source4/lib/ldb/ldb_ildap/ldb_ildap.c

index 8929428494aac3488a8af8aa6a7a014d54c261e9..003c6c011e00075f49e80c39285760c3c121382e 100644 (file)
@@ -696,7 +696,7 @@ static int ildb_async_wait(struct ldb_async_handle *handle, enum ldb_async_wait_
                return LDB_ERR_OPERATIONS_ERROR;
        }
        
-       return LDB_SUCCESS;
+       return handle->status;
 }
 
 static int ildb_rootdse_callback(struct ldb_context *ldb, void *context, struct ldb_async_result *ares)
@@ -710,14 +710,21 @@ static int ildb_rootdse_callback(struct ldb_context *ldb, void *context, struct
 
        ildb = talloc_get_type(context, struct ildb_private);
 
-       if (ildb->rootDSE != NULL) {
-               /* what ? more than one rootdse entry ?! */
-               goto error;
-       }
-
        /* we are interested only in the single reply (rootdse) we receive here */
-       if (ares->type == LDB_REPLY_ENTRY) {
+       switch (ares->type) {
+       case LDB_REPLY_ENTRY:
+               if (ildb->rootDSE != NULL) {
+                       /* what ? more than one rootdse entry ?! */
+                       goto error;
+               }
                ildb->rootDSE = talloc_steal(ildb, ares->message);
+               break;
+
+       case LDB_REPLY_REFERRAL:
+               goto error;
+
+       case LDB_REPLY_DONE:
+               break;
        }
        
        talloc_free(ares);