s4:libcli/ldap: ldap4_new_connection() requires a valid lp_ctx
authorStefan Metzmacher <metze@samba.org>
Wed, 17 Apr 2024 19:01:08 +0000 (21:01 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 24 Apr 2024 09:17:57 +0000 (11:17 +0200)
Otherwise we'll crash in a lot of places later.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 8007569e9f7d374456a3fbd172a905173462eb5f)

source4/libcli/ldap/ldap_client.c

index a1cb631785842be145d9afd07df7e19ab61fce55..0f606ef255debd3d803e0f78dbebce3c7ec70c89 100644 (file)
@@ -66,6 +66,10 @@ _PUBLIC_ struct ldap_connection *ldap4_new_connection(TALLOC_CTX *mem_ctx,
                return NULL;
        }
 
+       if (lp_ctx == NULL) {
+               return NULL;
+       }
+
        conn = talloc_zero(mem_ctx, struct ldap_connection);
        if (conn == NULL) {
                return NULL;