summaryrefslogtreecommitdiff
path: root/source3/rpc_client/cli_svcctl.c
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2005-03-24 16:11:23 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:56:17 -0500
commit259d44dbb2c2239339f6888fd5da12632abcbb28 (patch)
tree89c120869821b3b9ee040c1b5c1b404d6c53f56f /source3/rpc_client/cli_svcctl.c
parent987fd2ed97b91804646b8d93fff37d7f2efa6bab (diff)
downloadsamba-259d44dbb2c2239339f6888fd5da12632abcbb28.tar.gz
samba-259d44dbb2c2239339f6888fd5da12632abcbb28.tar.bz2
samba-259d44dbb2c2239339f6888fd5da12632abcbb28.zip
r6038: adding more flesh to 'net rpc service'
open and close the service control manager. Also experimenting with ideas for cli_xxx() interface. (This used to be commit 4da89ef17b8c4644b97b923cebfe8e446b508b4d)
Diffstat (limited to 'source3/rpc_client/cli_svcctl.c')
-rw-r--r--source3/rpc_client/cli_svcctl.c109
1 files changed, 107 insertions, 2 deletions
diff --git a/source3/rpc_client/cli_svcctl.c b/source3/rpc_client/cli_svcctl.c
index afef5f4fbb..7bf7392cd6 100644
--- a/source3/rpc_client/cli_svcctl.c
+++ b/source3/rpc_client/cli_svcctl.c
@@ -21,13 +21,118 @@
#include "includes.h"
+/*******************************************************************
+*******************************************************************/
+
+WERROR cli_svcctl_open_scm( struct cli_state *cli, TALLOC_CTX *mem_ctx,
+ SVCCTL_Q_OPEN_SCMANAGER *in, SVCCTL_R_OPEN_SCMANAGER *out )
+{
+ prs_struct qbuf, rbuf;
+
+ /* Initialise parse structures */
+
+ prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
+ prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
+
+ out->status = WERR_GENERAL_FAILURE;
+
+ /* Marshall data and send request */
+
+ if ( svcctl_io_q_open_scmanager("", in, &qbuf, 0) ) {
+ if ( rpc_api_pipe_req(cli, PI_SVCCTL, SVCCTL_OPEN_SCMANAGER_W, &qbuf, &rbuf) ) {
+ /* Unmarshall response */
+ if (!svcctl_io_r_open_scmanager("", out, &rbuf, 0)) {
+ out->status = WERR_GENERAL_FAILURE;
+ }
+ }
+ }
+
+ prs_mem_free(&qbuf);
+ prs_mem_free(&rbuf);
+
+ return out->status;
+}
/*******************************************************************
*******************************************************************/
-NTSTATUS cli_svcctl_enumerate_services(struct cli_state *cli, TALLOC_CTX *mem_ctx )
+WERROR cli_svcctl_close_service( struct cli_state *cli, TALLOC_CTX *mem_ctx,
+ SVCCTL_Q_CLOSE_SERVICE *in, SVCCTL_R_CLOSE_SERVICE *out )
{
- return NT_STATUS_OK;
+ prs_struct qbuf, rbuf;
+
+ /* Initialise parse structures */
+
+ prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
+ prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
+
+ out->status = WERR_GENERAL_FAILURE;
+
+ /* Marshall data and send request */
+
+ if ( svcctl_io_q_close_service("", in, &qbuf, 0) ) {
+ if ( rpc_api_pipe_req(cli, PI_SVCCTL, SVCCTL_CLOSE_SERVICE, &qbuf, &rbuf) ) {
+ /* Unmarshall response */
+ if (!svcctl_io_r_close_service("", out, &rbuf, 0)) {
+ out->status = WERR_GENERAL_FAILURE;
+ }
+ }
+ }
+
+ prs_mem_free(&qbuf);
+ prs_mem_free(&rbuf);
+
+ return out->status;
+}
+
+/*******************************************************************
+*******************************************************************/
+
+WERROR cli_svcctl_enumerate_services( struct cli_state *cli, TALLOC_CTX *mem_ctx,
+ POLICY_HND *hSCM, uint32 type, uint32 state,
+ uint32 *resume, uint32 buffer_size, RPC_BUFFER *buffer,
+ uint32 returned )
+{
+ prs_struct qbuf, rbuf;
+ SVCCTL_Q_ENUM_SERVICES_STATUS q;
+ SVCCTL_R_ENUM_SERVICES_STATUS r;
+ WERROR result = WERR_GENERAL_FAILURE;
+
+ ZERO_STRUCT(q);
+ ZERO_STRUCT(r);
+
+ /* Initialise parse structures */
+
+ prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
+ prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
+
+ /* Initialise input parameters */
+
+
+ /* Marshall data and send request */
+
+ if (!svcctl_io_q_enum_services_status("", &q, &qbuf, 0) ||
+ !rpc_api_pipe_req(cli, PI_SVCCTL, SVCCTL_ENUM_SERVICES_STATUS_W, &qbuf, &rbuf)) {
+ goto done;
+ }
+
+ /* Unmarshall response */
+
+ if (!svcctl_io_r_enum_services_status("", &r, &rbuf, 0)) {
+ goto done;
+ }
+
+ /* Return output parameters */
+
+ if (W_ERROR_IS_OK(result = r.status)) {
+ *buffer = r.buffer;
+ }
+
+done:
+ prs_mem_free(&qbuf);
+ prs_mem_free(&rbuf);
+
+ return result;
}
/*******************************************************************