diff options
author | Stefan Metzmacher <metze@samba.org> | 2011-01-04 13:33:46 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2011-01-04 21:28:54 +0100 |
commit | 697d4ea8fff6fbc48aa59b17fa0ecc91bf1d233d (patch) | |
tree | 41a9b2236f153bd919161fe975a74139c25e861a | |
parent | fba2fdf2651bd4ffaabb41d5e0506cbf3bcb0699 (diff) | |
download | samba-697d4ea8fff6fbc48aa59b17fa0ecc91bf1d233d.tar.gz samba-697d4ea8fff6fbc48aa59b17fa0ecc91bf1d233d.tar.bz2 samba-697d4ea8fff6fbc48aa59b17fa0ecc91bf1d233d.zip |
s3:rpcclient: use dcerpc_binding_handle bases client stubs in cmd_epmapper.c
metze
-rw-r--r-- | source3/rpcclient/cmd_epmapper.c | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/source3/rpcclient/cmd_epmapper.c b/source3/rpcclient/cmd_epmapper.c index 3ee0120838..2c830e2d35 100644 --- a/source3/rpcclient/cmd_epmapper.c +++ b/source3/rpcclient/cmd_epmapper.c @@ -27,6 +27,7 @@ static NTSTATUS cmd_epmapper_map(struct rpc_pipe_client *p, TALLOC_CTX *mem_ctx, int argc, const char **argv) { + struct dcerpc_binding_handle *b = p->binding_handle; struct dcerpc_binding map_binding; struct epm_twr_t map_tower; struct epm_twr_t res_tower; @@ -36,6 +37,7 @@ static NTSTATUS cmd_epmapper_map(struct rpc_pipe_client *p, uint32_t num_towers; TALLOC_CTX *tmp_ctx = talloc_stackframe(); NTSTATUS status; + uint32_t result; abstract_syntax = ndr_table_lsarpc.syntax_id; @@ -55,18 +57,30 @@ static NTSTATUS cmd_epmapper_map(struct rpc_pipe_client *p, towers.twr = &res_tower; ZERO_STRUCT(entry_handle); - status = rpccli_epm_Map( - p, tmp_ctx, &abstract_syntax.uuid, + status = dcerpc_epm_Map( + b, tmp_ctx, &abstract_syntax.uuid, &map_tower, &entry_handle, 1, - &num_towers, &towers); + &num_towers, &towers, &result); + if (!NT_STATUS_IS_OK(status)) { + d_fprintf(stderr, "dcerpc_epm_Map returned %s\n", + nt_errstr(status)); + return status; + } - return status; + if (result != EPMAPPER_STATUS_OK) { + d_fprintf(stderr, "epm_Map returned %u (0x%08X)\n", + result, result); + return NT_STATUS_UNSUCCESSFUL; + } + + return NT_STATUS_OK; } static NTSTATUS cmd_epmapper_lookup(struct rpc_pipe_client *p, TALLOC_CTX *mem_ctx, int argc, const char **argv) { + struct dcerpc_binding_handle *b = p->binding_handle; struct policy_handle entry_handle; ZERO_STRUCT(entry_handle); @@ -78,23 +92,36 @@ static NTSTATUS cmd_epmapper_lookup(struct rpc_pipe_client *p, NTSTATUS status; char *guid_string; struct dcerpc_binding *binding; + uint32_t result; - status = rpccli_epm_Lookup(p, tmp_ctx, + status = dcerpc_epm_Lookup(b, tmp_ctx, 0, /* rpc_c_ep_all */ NULL, NULL, 0, /* rpc_c_vers_all */ &entry_handle, 1, /* max_ents */ - &num_entries, &entry); + &num_entries, &entry, + &result); if (!NT_STATUS_IS_OK(status)) { - d_fprintf(stderr, "rpccli_epm_Lookup returned %s\n", + d_fprintf(stderr, "dcerpc_epm_Lookup returned %s\n", nt_errstr(status)); break; } + if (result == EPMAPPER_STATUS_NO_MORE_ENTRIES) { + d_fprintf(stderr, "epm_Lookup no more entries\n"); + break; + } + + if (result != EPMAPPER_STATUS_OK) { + d_fprintf(stderr, "epm_Lookup returned %u (0x%08X)\n", + result, result); + break; + } + if (num_entries != 1) { - d_fprintf(stderr, "rpccli_epm_Lookup returned %d " + d_fprintf(stderr, "epm_Lookup returned %d " "entries, expected one\n", (int)num_entries); break; } |