summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_client/cli_samr.c53
-rw-r--r--source3/rpc_client/cli_samr.h25
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,