diff options
author | Stefan Metzmacher <metze@samba.org> | 2014-01-23 13:55:10 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2014-02-13 11:54:14 +0100 |
commit | ed8adc292047112d41fc2de0e77f76fcbdc7daac (patch) | |
tree | 3b7067d7bf54b0a3734b2b05c8552b9143778e88 /librpc/rpc | |
parent | 017338a180c87e938af5215720bf59610f4ddbb1 (diff) | |
download | samba-ed8adc292047112d41fc2de0e77f76fcbdc7daac.tar.gz samba-ed8adc292047112d41fc2de0e77f76fcbdc7daac.tar.xz samba-ed8adc292047112d41fc2de0e77f76fcbdc7daac.zip |
librpc/rpc: handle ncacn_options in dcerpc_binding_[s|g]et_string_option()
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 | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/librpc/rpc/binding.c b/librpc/rpc/binding.c index 8c17b226a1e..2d9014e524b 100644 --- a/librpc/rpc/binding.c +++ b/librpc/rpc/binding.c @@ -459,6 +459,8 @@ _PUBLIC_ const char *dcerpc_binding_get_string_option(const struct dcerpc_bindin _SPECIAL(target_principal), #undef _SPECIAL }; + const struct ncacn_option *no = NULL; + size_t name_len = strlen(name); size_t i; int ret; @@ -476,6 +478,15 @@ _PUBLIC_ const char *dcerpc_binding_get_string_option(const struct dcerpc_bindin return specials[i].value; } + no = ncacn_option_by_name(name); + if (no != NULL) { + if (b->flags & no->flag) { + return no->name; + } + + return NULL; + } + if (b->options == NULL) { return NULL; } @@ -483,7 +494,6 @@ _PUBLIC_ const char *dcerpc_binding_get_string_option(const struct dcerpc_bindin for (i=0; b->options[i]; i++) { const char *o = b->options[i]; const char *vs = NULL; - size_t name_len = strlen(name); ret = strncmp(name, o, name_len); if (ret != 0) { @@ -538,9 +548,10 @@ _PUBLIC_ NTSTATUS dcerpc_binding_set_string_option(struct dcerpc_binding *b, _SPECIAL(target_principal), #undef _SPECIAL }; + const struct ncacn_option *no = NULL; + size_t name_len = strlen(name); const char *opt = NULL; char *tmp; - size_t name_len = strlen(name); size_t i; int ret; @@ -626,6 +637,22 @@ _PUBLIC_ NTSTATUS dcerpc_binding_set_string_option(struct dcerpc_binding *b, return NT_STATUS_OK; } + no = ncacn_option_by_name(name); + if (no != NULL) { + if (value == NULL) { + b->flags &= ~no->flag; + return NT_STATUS_OK; + } + + ret = strcasecmp(no->name, value); + if (ret != 0) { + return NT_STATUS_INVALID_PARAMETER_MIX; + } + + b->flags |= no->flag; + return NT_STATUS_OK; + } + for (i=0; b->options && b->options[i]; i++) { const char *o = b->options[i]; |