summaryrefslogtreecommitdiffstats
path: root/source/rpc_client/cli_ds.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/rpc_client/cli_ds.c')
-rw-r--r--source/rpc_client/cli_ds.c81
1 files changed, 13 insertions, 68 deletions
diff --git a/source/rpc_client/cli_ds.c b/source/rpc_client/cli_ds.c
index 41063a5d7fb..8d1945f7698 100644
--- a/source/rpc_client/cli_ds.c
+++ b/source/rpc_client/cli_ds.c
@@ -2,6 +2,7 @@
Unix SMB/CIFS implementation.
RPC pipe client
Copyright (C) Gerald Carter 2002,
+ Copyright (C) Jeremy Allison 2005.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -38,30 +39,14 @@ NTSTATUS rpccli_ds_getprimarydominfo(struct rpc_pipe_client *cli,
ZERO_STRUCT(q);
ZERO_STRUCT(r);
- /* Initialise parse structures */
-
- if (!prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL)) {
- return NT_STATUS_NO_MEMORY;
- }
- if (!prs_init(&rbuf, 0, mem_ctx, UNMARSHALL)) {
- prs_mem_free(&qbuf);
- return NT_STATUS_NO_MEMORY;
- }
-
q.level = level;
- if (!ds_io_q_getprimdominfo("", &qbuf, 0, &q)
- || !rpc_api_pipe_req_int(cli, DS_GETPRIMDOMINFO, &qbuf, &rbuf)) {
- result = NT_STATUS_UNSUCCESSFUL;
- goto done;
- }
-
- /* Unmarshall response */
-
- if (!ds_io_r_getprimdominfo("", &rbuf, 0, &r)) {
- result = NT_STATUS_UNSUCCESSFUL;
- goto done;
- }
+ CLI_DO_RPC( cli, mem_ctx, PI_LSARPC_DS, DS_GETPRIMDOMINFO,
+ q, r,
+ qbuf, rbuf,
+ ds_io_q_getprimdominfo,
+ ds_io_r_getprimdominfo,
+ NT_STATUS_UNSUCCESSFUL);
/* Return basic info - if we are requesting at info != 1 then
there could be trouble. */
@@ -76,20 +61,10 @@ NTSTATUS rpccli_ds_getprimarydominfo(struct rpc_pipe_client *cli,
}
done:
- prs_mem_free(&qbuf);
- prs_mem_free(&rbuf);
return result;
}
-NTSTATUS cli_ds_getprimarydominfo(struct cli_state *cli, TALLOC_CTX *mem_ctx,
- uint16 level, DS_DOMINFO_CTR *ctr)
-{
- return rpccli_ds_getprimarydominfo(&cli->pipes[PI_LSARPC_DS], mem_ctx,
- level, ctr);
-}
-
-
/********************************************************************
Enumerate trusted domains in an AD forest
********************************************************************/
@@ -108,30 +83,14 @@ NTSTATUS rpccli_ds_enum_domain_trusts(struct rpc_pipe_client *cli,
ZERO_STRUCT(q);
ZERO_STRUCT(r);
- /* Initialise parse structures */
-
- if (!prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL)) {
- return NT_STATUS_NO_MEMORY;;
- }
- if (!prs_init(&rbuf, 0, mem_ctx, UNMARSHALL)) {
- prs_mem_free(&qbuf);
- return NT_STATUS_NO_MEMORY;
- }
-
init_q_ds_enum_domain_trusts( &q, server, flags );
- if (!ds_io_q_enum_domain_trusts("", &qbuf, 0, &q)
- || !rpc_api_pipe_req_int(cli, DS_ENUM_DOM_TRUSTS, &qbuf, &rbuf)) {
- result = NT_STATUS_UNSUCCESSFUL;
- goto done;
- }
-
- /* Unmarshall response */
-
- if (!ds_io_r_enum_domain_trusts("", &rbuf, 0, &r)) {
- result = NT_STATUS_UNSUCCESSFUL;
- goto done;
- }
+ CLI_DO_RPC( cli, mem_ctx, PI_LSARPC_DS, DS_ENUM_DOM_TRUSTS,
+ q, r,
+ qbuf, rbuf,
+ ds_io_q_enum_domain_trusts,
+ ds_io_r_enum_domain_trusts,
+ NT_STATUS_UNSUCCESSFUL);
result = r.status;
@@ -168,19 +127,5 @@ NTSTATUS rpccli_ds_enum_domain_trusts(struct rpc_pipe_client *cli,
}
}
-done:
- prs_mem_free(&qbuf);
- prs_mem_free(&rbuf);
-
return result;
}
-
-NTSTATUS cli_ds_enum_domain_trusts(struct cli_state *cli, TALLOC_CTX *mem_ctx,
- const char *server, uint32 flags,
- struct ds_domain_trust **trusts,
- uint32 *num_domains)
-{
- return rpccli_ds_enum_domain_trusts(&cli->pipes[PI_NETLOGON], mem_ctx,
- server, flags, trusts,
- num_domains);
-}