diff options
author | Stefan Metzmacher <metze@samba.org> | 2014-01-25 10:39:55 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2014-02-13 11:54:15 +0100 |
commit | 6ce8d761dc60d5a84ca4f11ebb801c0be643ec10 (patch) | |
tree | 21dac538c77e88cfdf6aa65e465046533a9aa5ec /librpc/rpc | |
parent | f066bd7b33e6c44311af7d82835017aac0b85c0d (diff) | |
download | samba-6ce8d761dc60d5a84ca4f11ebb801c0be643ec10.tar.gz |
librpc/rpc: add dcerpc_binding_[g|s]et_transport()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Diffstat (limited to 'librpc/rpc')
-rw-r--r-- | librpc/rpc/binding.c | 36 | ||||
-rw-r--r-- | librpc/rpc/rpc_common.h | 3 |
2 files changed, 37 insertions, 2 deletions
diff --git a/librpc/rpc/binding.c b/librpc/rpc/binding.c index 43bbbce2540..984f5ee8af8 100644 --- a/librpc/rpc/binding.c +++ b/librpc/rpc/binding.c @@ -457,6 +457,39 @@ _PUBLIC_ NTSTATUS dcerpc_binding_set_object(struct dcerpc_binding *b, return NT_STATUS_OK; } +_PUBLIC_ enum dcerpc_transport_t dcerpc_binding_get_transport(const struct dcerpc_binding *b) +{ + return b->transport; +} + +_PUBLIC_ NTSTATUS dcerpc_binding_set_transport(struct dcerpc_binding *b, + enum dcerpc_transport_t transport) +{ + char *tmp = discard_const_p(char, b->endpoint); + + /* + * TODO: we may want to check the transport value is + * wellknown. + */ + if (b->transport == transport) { + return NT_STATUS_OK; + } + + b->transport = transport; + + /* + * This implicitly resets the endpoint + * as the endpoint is transport specific. + * + * TODO: in future we may reset more options + * here. + */ + talloc_free(tmp); + b->endpoint = NULL; + + return NT_STATUS_OK; +} + _PUBLIC_ void dcerpc_binding_get_auth_info(const struct dcerpc_binding *b, enum dcerpc_AuthType *_auth_type, enum dcerpc_AuthLevel *_auth_level) @@ -621,8 +654,7 @@ _PUBLIC_ NTSTATUS dcerpc_binding_set_string_option(struct dcerpc_binding *b, return NT_STATUS_INVALID_PARAMETER_MIX; } - b->transport = t; - return NT_STATUS_OK; + return dcerpc_binding_set_transport(b, t); } ret = strcmp(name, "object"); diff --git a/librpc/rpc/rpc_common.h b/librpc/rpc/rpc_common.h index 473d126a6a4..22bb26a910c 100644 --- a/librpc/rpc/rpc_common.h +++ b/librpc/rpc/rpc_common.h @@ -136,6 +136,9 @@ char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_binding *b) struct GUID dcerpc_binding_get_object(const struct dcerpc_binding *b); NTSTATUS dcerpc_binding_set_object(struct dcerpc_binding *b, struct GUID object); +enum dcerpc_transport_t dcerpc_binding_get_transport(const struct dcerpc_binding *b); +NTSTATUS dcerpc_binding_set_transport(struct dcerpc_binding *b, + enum dcerpc_transport_t transport); void dcerpc_binding_get_auth_info(const struct dcerpc_binding *b, enum dcerpc_AuthType *_auth_type, enum dcerpc_AuthLevel *_auth_level); |