summaryrefslogtreecommitdiff
path: root/source3/rpcclient/cmd_srvsvc.c
diff options
context:
space:
mode:
authorMatthew Chapman <matty@samba.org>1999-05-01 05:56:55 +0000
committerMatthew Chapman <matty@samba.org>1999-05-01 05:56:55 +0000
commite3a888d5a935047367e531321981cbed8618c5a3 (patch)
treecfbf41483bffd10b3cac43bb1dc76a955a80bb43 /source3/rpcclient/cmd_srvsvc.c
parent89d51caba5bed5c3329b3776e15fce2bb41f7592 (diff)
downloadsamba-e3a888d5a935047367e531321981cbed8618c5a3.tar.gz
samba-e3a888d5a935047367e531321981cbed8618c5a3.tar.bz2
samba-e3a888d5a935047367e531321981cbed8618c5a3.zip
Adding "time" rpcclient command which displays the remote time.
Also added special "now" time to the "at" command, e.g.: at now /i cmd ; pops up a command prompt (This used to be commit f456dcf08ec96c631f5e6f2e857115d4bbf94d1b)
Diffstat (limited to 'source3/rpcclient/cmd_srvsvc.c')
-rw-r--r--source3/rpcclient/cmd_srvsvc.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/source3/rpcclient/cmd_srvsvc.c b/source3/rpcclient/cmd_srvsvc.c
index 1be35608ee..2cb741b966 100644
--- a/source3/rpcclient/cmd_srvsvc.c
+++ b/source3/rpcclient/cmd_srvsvc.c
@@ -331,3 +331,44 @@ void cmd_srv_enum_files(struct client_info *info)
}
}
+/****************************************************************************
+display remote time
+****************************************************************************/
+void cmd_time(struct client_info *info)
+{
+ uint16 nt_pipe_fnum;
+ fstring dest_srv;
+ TIME_OF_DAY_INFO tod;
+ BOOL res = True;
+
+ fstrcpy(dest_srv, "\\\\");
+ fstrcat(dest_srv, info->dest_host);
+ strupper(dest_srv);
+
+ DEBUG(4,("cmd_time: server:%s\n", dest_srv));
+
+ /* open srvsvc session. */
+ res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC, &nt_pipe_fnum) : False;
+
+ /* enumerate files on server */
+ res = res ? do_srv_net_remote_tod(smb_cli, nt_pipe_fnum,
+ dest_srv, &tod) : False;
+
+ if (res)
+ {
+ fprintf(out_hnd, "\tRemote Time:\t%s\n\n",
+ http_timestring(tod.elapsedt));
+ }
+
+ /* Close the session */
+ cli_nt_session_close(smb_cli, nt_pipe_fnum);
+
+ if (res)
+ {
+ DEBUG(5,("cmd_srv_enum_files: query succeeded\n"));
+ }
+ else
+ {
+ DEBUG(5,("cmd_srv_enum_files: query failed\n"));
+ }
+}