summaryrefslogtreecommitdiff
path: root/source3/rpc_client/cli_svcctl.c
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1999-10-31 05:23:32 +0000
committerLuke Leighton <lkcl@samba.org>1999-10-31 05:23:32 +0000
commite7a9b398c79cb77678de18f3fc448131e1d6eb25 (patch)
treeafe7bc2d01eeeccfea36d075a4d74c178a718c65 /source3/rpc_client/cli_svcctl.c
parentce31503de55ffeaa6e694b9177890943442e41c0 (diff)
downloadsamba-e7a9b398c79cb77678de18f3fc448131e1d6eb25.tar.gz
samba-e7a9b398c79cb77678de18f3fc448131e1d6eb25.tar.bz2
samba-e7a9b398c79cb77678de18f3fc448131e1d6eb25.zip
added yet another rpcclient command: svcstart <service name> [arg0] [arg1] ...
works with command-line completion on the service name (ohh yesss, this is becoming my favourite bit of functionality-on-the-side hee hee :) had to fix the svc_io_q_start_service() code which was missing the ptr_argv[] array in between the array-size and the UNISTR2-array. i.e it's actually an array of _pointers_ to unicode strings... (This used to be commit 2903f22e7ed9306229035accfa757fd810645820)
Diffstat (limited to 'source3/rpc_client/cli_svcctl.c')
-rw-r--r--source3/rpc_client/cli_svcctl.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/source3/rpc_client/cli_svcctl.c b/source3/rpc_client/cli_svcctl.c
index f161e4207f..1e1fe884ff 100644
--- a/source3/rpc_client/cli_svcctl.c
+++ b/source3/rpc_client/cli_svcctl.c
@@ -230,6 +230,65 @@ BOOL svc_enum_svcs(struct cli_state *cli, uint16 fnum,
/****************************************************************************
+do a SVC Start Service
+****************************************************************************/
+BOOL svc_start_service(struct cli_state *cli, uint16 fnum,
+ POLICY_HND *hnd,
+ uint32 argc,
+ char **argv)
+{
+ prs_struct rbuf;
+ prs_struct buf;
+ SVC_Q_START_SERVICE q_c;
+ BOOL valid_cfg = False;
+
+ if (hnd == NULL) return False;
+
+ /* create and send a MSRPC command with api SVC_START_SERVICE */
+
+ prs_init(&buf , 1024, 4, SAFETY_MARGIN, False);
+ prs_init(&rbuf, 0 , 4, SAFETY_MARGIN, True );
+
+ DEBUG(4,("SVC Start Service\n"));
+
+ /* store the parameters */
+ make_svc_q_start_service(&q_c, hnd, argc, argv);
+
+ /* turn parameters into data stream */
+ svc_io_q_start_service("", &q_c, &buf, 0);
+
+ /* send the data on \PIPE\ */
+ if (rpc_api_pipe_req(cli, fnum, SVC_START_SERVICE, &buf, &rbuf))
+ {
+ SVC_R_START_SERVICE r_c;
+ BOOL p;
+
+ ZERO_STRUCT (r_c);
+
+ svc_io_r_start_service("", &r_c, &rbuf, 0);
+ p = rbuf.offset != 0;
+
+ if (p && r_c.status != 0)
+ {
+ /* report error code */
+ DEBUG(1,("SVC_START_SERVICE: %s\n", get_nt_error_msg(r_c.status)));
+ p = False;
+ }
+
+ if (p)
+ {
+ valid_cfg = True;
+ }
+ }
+
+ prs_mem_free(&rbuf);
+ prs_mem_free(&buf );
+
+ return valid_cfg;
+}
+
+
+/****************************************************************************
do a SVC Query Service Config
****************************************************************************/
BOOL svc_query_svc_cfg(struct cli_state *cli, uint16 fnum,