diff options
author | Stefan Metzmacher <metze@samba.org> | 2014-01-23 14:59:48 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2014-02-13 11:54:14 +0100 |
commit | 7c0985bb352ce0d4bc896e951fee73ae32322d82 (patch) | |
tree | 701e8252d72ef144cec6a279e8f114dc848e10e9 /librpc | |
parent | 8dfba57c339f7dd54a5440113da8959cc581cf79 (diff) | |
download | samba-7c0985bb352ce0d4bc896e951fee73ae32322d82.tar.gz samba-7c0985bb352ce0d4bc896e951fee73ae32322d82.tar.xz samba-7c0985bb352ce0d4bc896e951fee73ae32322d82.zip |
librpc/rpc: add dcerpc_binding_copy_string_option()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Diffstat (limited to 'librpc')
-rw-r--r-- | librpc/rpc/binding.c | 21 | ||||
-rw-r--r-- | librpc/rpc/rpc_common.h | 3 |
2 files changed, 24 insertions, 0 deletions
diff --git a/librpc/rpc/binding.c b/librpc/rpc/binding.c index 2866dda5664..e81cd4d2b14 100644 --- a/librpc/rpc/binding.c +++ b/librpc/rpc/binding.c @@ -457,6 +457,27 @@ _PUBLIC_ const char *dcerpc_binding_get_string_option(const struct dcerpc_bindin return NULL; } +_PUBLIC_ char *dcerpc_binding_copy_string_option(TALLOC_CTX *mem_ctx, + const struct dcerpc_binding *b, + const char *name) +{ + const char *c = dcerpc_binding_get_string_option(b, name); + char *v; + + if (c == NULL) { + errno = ENOENT; + return NULL; + } + + v = talloc_strdup(mem_ctx, c); + if (v == NULL) { + errno = ENOMEM; + return NULL; + } + + return v; +} + _PUBLIC_ NTSTATUS dcerpc_binding_set_string_option(struct dcerpc_binding *b, const char *name, const char *value) diff --git a/librpc/rpc/rpc_common.h b/librpc/rpc/rpc_common.h index 136f9a90a77..98be80eb226 100644 --- a/librpc/rpc/rpc_common.h +++ b/librpc/rpc/rpc_common.h @@ -138,6 +138,9 @@ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_ char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_binding *b); const char *dcerpc_binding_get_string_option(const struct dcerpc_binding *b, const char *name); +char *dcerpc_binding_copy_string_option(TALLOC_CTX *mem_ctx, + const struct dcerpc_binding *b, + const char *name); NTSTATUS dcerpc_binding_set_string_option(struct dcerpc_binding *b, const char *name, const char *value); |