1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-30 19:42:05 +03:00

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>
This commit is contained in:
Stefan Metzmacher
2014-01-24 09:24:49 +01:00
committed by Günther Deschner
parent 91a367dce5
commit c327a60a02
2 changed files with 14 additions and 15 deletions

View File

@ -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;

View File

@ -82,7 +82,7 @@ static const char *test_strings[] = {
"ncacn_ip_tcp:127.0.0.1",
"ncacn_ip_tcp:127.0.0.1[20]",
"ncacn_ip_tcp:127.0.0.1[20,sign]",
"ncacn_ip_tcp:127.0.0.1[20,Security=Foobar,sign]",
"ncacn_ip_tcp:127.0.0.1[20,sign,Security=Foobar]",
"ncacn_http:127.0.0.1",
"ncacn_http:127.0.0.1[78]",
"ncacn_http:127.0.0.1[78,ProxyServer=myproxy:3128]",