]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
wb_dsgetdcname: don't use stack variables for async code
authorStefan Metzmacher <metze@samba.org>
Thu, 29 Jun 2023 12:02:17 +0000 (14:02 +0200)
committerBjoern Jacke <bjacke@samba.org>
Sun, 2 Jul 2023 17:42:56 +0000 (17:42 +0000)
This is not really a problem because we call ndr_push from
with a _send() function, but still we leave dangling pointers
arround...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
Autobuild-User(master): Björn Jacke <bjacke@samba.org>
Autobuild-Date(master): Sun Jul  2 17:42:56 UTC 2023 on atb-devel-224

source3/winbindd/wb_dsgetdcname.c

index 8abf0ee115ead472f288ea01fc45c9d169c004f8..0f6acaae04a02d39a7425812049ef41e0f97ca0b 100644 (file)
@@ -25,6 +25,7 @@
 
 struct wb_dsgetdcname_state {
        const char *domain_name;
+       struct GUID domain_guid;
        struct netr_DsRGetDCNameInfo *dcinfo;
 };
 
@@ -40,7 +41,6 @@ struct tevent_req *wb_dsgetdcname_send(TALLOC_CTX *mem_ctx,
        struct tevent_req *req, *subreq;
        struct wb_dsgetdcname_state *state;
        struct dcerpc_binding_handle *child_binding_handle = NULL;
-       struct GUID guid;
        struct GUID *guid_ptr = NULL;
 
        req = tevent_req_create(mem_ctx, &state, struct wb_dsgetdcname_state);
@@ -86,8 +86,8 @@ struct tevent_req *wb_dsgetdcname_send(TALLOC_CTX *mem_ctx,
 
        if (domain_guid != NULL) {
                /* work around a const issue in rpccli_ autogenerated code */
-               guid = *domain_guid;
-               guid_ptr = &guid;
+               state->domain_guid = *domain_guid;
+               guid_ptr = &state->domain_guid;
        }
 
        state->domain_name = talloc_strdup(state, domain_name);