diff options
author | Stefan Metzmacher <metze@samba.org> | 2014-01-30 23:05:48 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2014-02-11 16:20:31 +0100 |
commit | 98b08dfb6db0accaf7c893adf695e1d0f0b05ade (patch) | |
tree | 0246d7e9b6307abd194570250a1a2ab3bc785c78 /librpc | |
parent | d89ff8575dbc223019ee62fc65ec0ede593635f7 (diff) | |
download | samba-98b08dfb6db0accaf7c893adf695e1d0f0b05ade.tar.gz samba-98b08dfb6db0accaf7c893adf695e1d0f0b05ade.tar.xz samba-98b08dfb6db0accaf7c893adf695e1d0f0b05ade.zip |
librpc/rpc: simplify dcerpc_binding_build_tower()
dcerpc_floor_set_rhs_data() handles the special cases now
and we keep the 'host' part unmodified except
EPM_PROTOCOL_IP addresses. No special '\\' handling anymore.
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 | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/librpc/rpc/binding.c b/librpc/rpc/binding.c index ee9f13d1b7e..cd896b0d71a 100644 --- a/librpc/rpc/binding.c +++ b/librpc/rpc/binding.c @@ -875,35 +875,32 @@ _PUBLIC_ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx, /* Floor 2 to num_protocols */ for (i = 0; i < num_protocols; i++) { tower->floors[2 + i].lhs.protocol = protseq[i]; - tower->floors[2 + i].lhs.lhs_data = data_blob_talloc(tower->floors, NULL, 0); + tower->floors[2 + i].lhs.lhs_data = data_blob_null; ZERO_STRUCT(tower->floors[2 + i].rhs); - dcerpc_floor_set_rhs_data(tower->floors, &tower->floors[2 + i], ""); + status = dcerpc_floor_set_rhs_data(tower->floors, + &tower->floors[2 + i], + NULL); + if (!NT_STATUS_IS_OK(status)) { + return status; + } } /* The 4th floor contains the endpoint */ if (num_protocols >= 2 && binding->endpoint) { - status = dcerpc_floor_set_rhs_data(tower->floors, &tower->floors[3], binding->endpoint); - if (NT_STATUS_IS_ERR(status)) { + status = dcerpc_floor_set_rhs_data(tower->floors, + &tower->floors[3], + binding->endpoint); + if (!NT_STATUS_IS_OK(status)) { return status; } } /* The 5th contains the network address */ if (num_protocols >= 3 && binding->host) { - if (is_ipaddress(binding->host) || - (binding->host[0] == '\\' && binding->host[1] == '\\')) { - status = dcerpc_floor_set_rhs_data(tower->floors, &tower->floors[4], - binding->host); - } else { - /* note that we don't attempt to resolve the - name here - when we get a hostname here we - are in the client code, and want to put in - a wildcard all-zeros IP for the server to - fill in */ - status = dcerpc_floor_set_rhs_data(tower->floors, &tower->floors[4], - "0.0.0.0"); - } - if (NT_STATUS_IS_ERR(status)) { + status = dcerpc_floor_set_rhs_data(tower->floors, + &tower->floors[4], + binding->host); + if (!NT_STATUS_IS_OK(status)) { return status; } } |