talloc_zero libnet_context on init
authorSwen Schillig <swen@vnet.ibm.com>
Fri, 26 Jan 2018 08:12:12 +0000 (09:12 +0100)
committerJeremy Allison <jra@samba.org>
Wed, 31 Jan 2018 23:33:34 +0000 (00:33 +0100)
Zero the libnet_context on initialization
preventing an uninitalized cli_credentials struct.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Feb  1 00:33:34 CET 2018 on sn-devel-144

source4/libnet/libnet.c

index 32df85d5279d9a4d3ca9a7b07bf4f3a9bc6d9734..a590893bee21ab31c1da8bacc4eda1c7519c5652 100644 (file)
@@ -33,8 +33,8 @@ struct libnet_context *libnet_context_init(struct tevent_context *ev,
                return NULL;
        }
 
-       /* create brand new libnet context */ 
-       ctx = talloc(ev, struct libnet_context);
+       /* create brand new libnet context */
+       ctx = talloc_zero(ev, struct libnet_context);
        if (!ctx) {
                return NULL;
        }
@@ -48,14 +48,8 @@ struct libnet_context *libnet_context_init(struct tevent_context *ev,
        /* name resolution methods */
        ctx->resolve_ctx = lpcfg_resolve_context(lp_ctx);
 
-       /* connected services' params */
-       ZERO_STRUCT(ctx->samr);
-       ZERO_STRUCT(ctx->lsa);  
-
        /* default buffer size for various operations requiring specifying a buffer */
        ctx->samr.buf_size = 128;
 
-       ctx->server_address = NULL;
-
        return ctx;
 }