summaryrefslogtreecommitdiff
path: root/source3/rpc_client
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1999-02-16 18:04:21 +0000
committerLuke Leighton <lkcl@samba.org>1999-02-16 18:04:21 +0000
commit52fb07aea26cc3041e571fafdc843622f1741a19 (patch)
tree674846ac410652cfbcdc9cd1827c28e87c5b5b26 /source3/rpc_client
parent78314c2e327ccd67e75dbc92be497ff2852b1817 (diff)
downloadsamba-52fb07aea26cc3041e571fafdc843622f1741a19.tar.gz
samba-52fb07aea26cc3041e571fafdc843622f1741a19.tar.bz2
samba-52fb07aea26cc3041e571fafdc843622f1741a19.zip
rpcclient shutdown command
(This used to be commit 59f081069a58f6a070ed6016c06153d5e695da93)
Diffstat (limited to 'source3/rpc_client')
-rw-r--r--source3/rpc_client/cli_reg.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/source3/rpc_client/cli_reg.c b/source3/rpc_client/cli_reg.c
index 166617ff37..fc7f6a5b53 100644
--- a/source3/rpc_client/cli_reg.c
+++ b/source3/rpc_client/cli_reg.c
@@ -1041,4 +1041,59 @@ BOOL do_reg_close(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd)
return valid_close;
}
+/****************************************************************************
+do a REG Shutdown Server
+****************************************************************************/
+BOOL do_reg_shutdown(struct cli_state *cli, uint16 fnum,
+ char *msg, uint32 timeout, uint16 flags)
+{
+ prs_struct rbuf;
+ prs_struct buf;
+ REG_Q_SHUTDOWN q_o;
+ BOOL valid_shutdown = False;
+
+ if (msg == NULL) return False;
+
+ prs_init(&buf , 1024, 4, SAFETY_MARGIN, False);
+ prs_init(&rbuf, 0 , 4, SAFETY_MARGIN, True );
+
+ /* create and send a MSRPC command with api REG_SHUTDOWN */
+
+ DEBUG(4,("REG Shutdown: (timeout: %d secs) %s\n", timeout, msg));
+
+ make_reg_q_shutdown(&q_o, msg, timeout, flags);
+
+ /* turn parameters into data stream */
+ reg_io_q_shutdown("", &q_o, &buf, 0);
+
+ /* send the data on \PIPE\ */
+ if (rpc_api_pipe_req(cli, fnum, REG_SHUTDOWN, &buf, &rbuf))
+ {
+ REG_R_SHUTDOWN r_o;
+ BOOL p;
+
+ ZERO_STRUCT(r_o);
+
+ reg_io_r_shutdown("", &r_o, &rbuf, 0);
+ p = rbuf.offset != 0;
+
+ if (p && r_o.status != 0)
+ {
+ /* report error code */
+ DEBUG(0,("REG_SHUTDOWN: %s\n", get_nt_error_msg(r_o.status)));
+ p = False;
+ }
+
+ if (p)
+ {
+ valid_shutdown = True;
+ }
+ }
+
+ prs_mem_free(&rbuf);
+ prs_mem_free(&buf );
+
+ return valid_shutdown;
+}
+