summaryrefslogtreecommitdiffstats
path: root/librpc
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-01-24 09:24:49 +0100
committerGünther Deschner <gd@samba.org>2014-02-13 11:54:14 +0100
commitc327a60a027ba06dbc67921055bb88f9a573096d (patch)
tree74bb73da4f5b90cec585f44f3a7abd31cf6d8d1d /librpc
parent91a367dce533929357e27d45d8b58f0f0620772e (diff)
downloadsamba-c327a60a027ba06dbc67921055bb88f9a573096d.tar.gz
samba-c327a60a027ba06dbc67921055bb88f9a573096d.tar.xz
samba-c327a60a027ba06dbc67921055bb88f9a573096d.zip
librpc/rpc: let derpc_binding_string() add ncacn_options before key=value options
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.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/librpc/rpc/binding.c b/librpc/rpc/binding.c
index d55939031f6..975ee554f87 100644
--- a/librpc/rpc/binding.c
+++ b/librpc/rpc/binding.c
@@ -238,28 +238,27 @@ _PUBLIC_ char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_bi
}
}
- /* this is a *really* inefficent way of dealing with strings,
- but this is rarely called and the strings are always short,
- so I don't care */
- for (i=0;b->options && b->options[i];i++) {
+ for (i=0;i<ARRAY_SIZE(ncacn_options);i++) {
+ if (!(b->flags & ncacn_options[i].flag)) {
+ continue;
+ }
+
o = s;
- s = talloc_asprintf_append_buffer(s, ",%s", b->options[i]);
+ if (ncacn_options[i].flag == DCERPC_LOCALADDRESS && b->localaddress) {
+ s = talloc_asprintf_append_buffer(s, ",%s=%s", ncacn_options[i].name,
+ b->localaddress);
+ } else {
+ s = talloc_asprintf_append_buffer(s, ",%s", ncacn_options[i].name);
+ }
if (s == NULL) {
talloc_free(o);
return NULL;
}
}
- for (i=0;i<ARRAY_SIZE(ncacn_options);i++) {
+ for (i=0;b->options && b->options[i];i++) {
o = s;
- if (b->flags & ncacn_options[i].flag) {
- if (ncacn_options[i].flag == DCERPC_LOCALADDRESS && b->localaddress) {
- s = talloc_asprintf_append_buffer(s, ",%s=%s", ncacn_options[i].name,
- b->localaddress);
- } else {
- s = talloc_asprintf_append_buffer(s, ",%s", ncacn_options[i].name);
- }
- }
+ s = talloc_asprintf_append_buffer(s, ",%s", b->options[i]);
if (s == NULL) {
talloc_free(o);
return NULL;