1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-26 21:57:41 +03:00

librpc/rpc: use dcerpc_binding_set_string_option(b, "endpoint", NULL) to reset the endpoint

We should always go through just one code path to [re]set a value.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Stefan Metzmacher 2014-03-18 07:07:13 +01:00 committed by Andrew Bartlett
parent 7782fbe12b
commit 002a0fb86e

View File

@ -532,7 +532,7 @@ _PUBLIC_ enum dcerpc_transport_t dcerpc_binding_get_transport(const struct dcerp
_PUBLIC_ NTSTATUS dcerpc_binding_set_transport(struct dcerpc_binding *b,
enum dcerpc_transport_t transport)
{
char *tmp = discard_const_p(char, b->endpoint);
NTSTATUS status;
/*
* TODO: we may want to check the transport value is
@ -542,8 +542,6 @@ _PUBLIC_ NTSTATUS dcerpc_binding_set_transport(struct dcerpc_binding *b,
return NT_STATUS_OK;
}
b->transport = transport;
/*
* This implicitly resets the endpoint
* as the endpoint is transport specific.
@ -554,11 +552,14 @@ _PUBLIC_ NTSTATUS dcerpc_binding_set_transport(struct dcerpc_binding *b,
* TODO: in future we may reset more options
* here.
*/
talloc_free(tmp);
b->endpoint = NULL;
status = dcerpc_binding_set_string_option(b, "endpoint", NULL);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
b->assoc_group_id = 0;
b->transport = transport;
return NT_STATUS_OK;
}