diff options
author | Andreas Schneider <asn@samba.org> | 2011-01-12 15:51:49 +0100 |
---|---|---|
committer | Andreas Schneider <asn@samba.org> | 2011-01-21 15:19:01 +0100 |
commit | 5db115a3041faee7c924cf26c1635f6028ae7df8 (patch) | |
tree | 7896f4dd5343fd701a7a3fe2b49ac0371009ef67 /source3 | |
parent | 089c25cbbb44547bbb03d54ec4e2c1f5ebd10f86 (diff) | |
download | samba-5db115a3041faee7c924cf26c1635f6028ae7df8.tar.gz samba-5db115a3041faee7c924cf26c1635f6028ae7df8.tar.bz2 samba-5db115a3041faee7c924cf26c1635f6028ae7df8.zip |
s3-rpc_client: Added dcerpc_try_samr_connects.
Autobuild-User: Andreas Schneider <asn@samba.org>
Autobuild-Date: Fri Jan 21 15:19:01 CET 2011 on sn-devel-104
Diffstat (limited to 'source3')
-rw-r--r-- | source3/rpc_client/cli_samr.c | 53 | ||||
-rw-r--r-- | source3/rpc_client/cli_samr.h | 25 |
2 files changed, 67 insertions, 11 deletions
diff --git a/source3/rpc_client/cli_samr.c b/source3/rpc_client/cli_samr.c index 79cc757d00..2716a7425f 100644 --- a/source3/rpc_client/cli_samr.c +++ b/source3/rpc_client/cli_samr.c @@ -418,10 +418,12 @@ void dcerpc_get_query_dispinfo_params(int loop_count, } } -NTSTATUS rpccli_try_samr_connects(struct rpc_pipe_client *cli, +NTSTATUS dcerpc_try_samr_connects(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, + const char *srv_name_slash, uint32_t access_mask, - struct policy_handle *connect_pol) + struct policy_handle *connect_pol, + NTSTATUS *presult) { NTSTATUS status; union samr_ConnectInfo info_in, info_out; @@ -433,31 +435,60 @@ NTSTATUS rpccli_try_samr_connects(struct rpc_pipe_client *cli, info1.client_version = SAMR_CONNECT_W2K; info_in.info1 = info1; - status = rpccli_samr_Connect5(cli, mem_ctx, - cli->srv_name_slash, + status = dcerpc_samr_Connect5(h, + mem_ctx, + srv_name_slash, access_mask, 1, &info_in, &lvl_out, &info_out, - connect_pol); + connect_pol, + presult); if (NT_STATUS_IS_OK(status)) { return status; } - status = rpccli_samr_Connect4(cli, mem_ctx, - cli->srv_name_slash, + status = dcerpc_samr_Connect4(h, + mem_ctx, + srv_name_slash, SAMR_CONNECT_W2K, access_mask, - connect_pol); + connect_pol, + presult); if (NT_STATUS_IS_OK(status)) { return status; } - status = rpccli_samr_Connect2(cli, mem_ctx, - cli->srv_name_slash, + status = dcerpc_samr_Connect2(h, + mem_ctx, + srv_name_slash, access_mask, - connect_pol); + connect_pol, + presult); + return status; } +NTSTATUS rpccli_try_samr_connects(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32_t access_mask, + struct policy_handle *connect_pol) +{ + NTSTATUS status; + NTSTATUS result = NT_STATUS_UNSUCCESSFUL; + + status = dcerpc_try_samr_connects(cli->binding_handle, + mem_ctx, + cli->srv_name_slash, + access_mask, + connect_pol, + &result); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + return result; +} + +/* vim: set ts=8 sw=8 noet cindent: */ diff --git a/source3/rpc_client/cli_samr.h b/source3/rpc_client/cli_samr.h index 18e6328bba..76993fb7c8 100644 --- a/source3/rpc_client/cli_samr.h +++ b/source3/rpc_client/cli_samr.h @@ -193,6 +193,31 @@ void dcerpc_get_query_dispinfo_params(int loop_count, uint32_t *max_entries, uint32_t *max_size); +/** + * @brief Try if we can connnect to samr. + * + * @param[in] h The dcerpc binding hanlde to use. + * + * @param[in] mem_ctx The memory context to use. + * + * @param[in] srv_name_slash The server name with leading slashes. + * + * @param[in] access_mask The access mask to use to open the connection. + * + * @param[in] connect_pol A pointer to store the policy handle for the + * connection. + * + * @param[out] presult A pointer for the NDR NTSTATUS error code. + * + * @return A corresponding NTSTATUS error code for the connection. + */ +NTSTATUS dcerpc_try_samr_connects(struct dcerpc_binding_handle *h, + TALLOC_CTX *mem_ctx, + const char *srv_name_slash, + uint32_t access_mask, + struct policy_handle *connect_pol, + NTSTATUS *presult); + NTSTATUS rpccli_try_samr_connects(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t access_mask, |