tldap: Allow dropping messages in tldap_search()
authorVolker Lendecke <vl@samba.org>
Fri, 27 Jan 2017 15:03:03 +0000 (16:03 +0100)
committerJeremy Allison <jra@samba.org>
Sat, 18 Mar 2017 04:05:24 +0000 (05:05 +0100)
For probing whether a connection is a live a rootdse search might be
interesting where we don't really care for the result, only success or
failure of the operation.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/tldap.c

index 5fcb43c29f4e75dbb62d812f374c558b75eef6ff..40064fdeeed3d6ce9e3c56f09a2564f600685197 100644 (file)
@@ -1995,7 +1995,7 @@ TLDAPRC tldap_search(struct tldap_context *ld,
                rc = TLDAP_OPERATIONS_ERROR;
                goto fail;
        }
-       rc = tldap_search_all_recv(req, mem_ctx, &msgs, &result);
+       rc = tldap_search_all_recv(req, frame, &msgs, &result);
        TALLOC_FREE(req);
        if (!TLDAP_RC_IS_SUCCESS(rc)) {
                goto fail;
@@ -2004,7 +2004,9 @@ TLDAPRC tldap_search(struct tldap_context *ld,
        TALLOC_FREE(ld->last_msg);
        ld->last_msg = talloc_move(ld, &result);
 
-       *pmsgs = msgs;
+       if (pmsgs != NULL) {
+               *pmsgs = talloc_move(mem_ctx, &msgs);
+       }
 fail:
        TALLOC_FREE(frame);
        return rc;