first pass at updating head branch to be to be the same as the SAMBA_2_0 branch
[bbaumbach/samba-autobuild/.git] / source3 / rpcclient / cmd_wkssvc.c
index 474c53f347ee8716ca4cdbe2dccab2ccab481422..0b8f469af372625d51857c29e5feedeaba92d0ec 100644 (file)
@@ -33,36 +33,48 @@ extern int DEBUGLEVEL;
 
 #define DEBUG_TESTING
 
+extern struct cli_state *smb_cli;
+
 extern FILE* out_hnd;
 
 
 /****************************************************************************
 workstation get info query
 ****************************************************************************/
-void cmd_wks_query_info(struct client_info *info, int argc, char *argv[])
+void cmd_wks_query_info(struct client_info *info)
 {
        fstring dest_wks;
+       fstring tmp;
        WKS_INFO_100 ctr;
        uint32 info_level = 100;
 
        BOOL res = True;
 
-       bzero(&ctr, sizeof(ctr));
+       memset((char *)&ctr, '\0', sizeof(ctr));
 
        fstrcpy(dest_wks, "\\\\");
        fstrcat(dest_wks, info->dest_host);
        strupper(dest_wks);
 
-       if (argc > 1)
+       if (next_token(NULL, tmp, NULL, sizeof(tmp)))
        {
-               info_level = (uint32)strtol(argv[1], (char**)NULL, 10);
+               info_level = (uint32)strtol(tmp, (char**)NULL, 10);
        }
 
        DEBUG(4,("cmd_wks_query_info: server:%s info level: %d\n",
                                dest_wks, info_level));
 
+       DEBUG(5, ("cmd_wks_query_info: smb_cli->fd:%d\n", smb_cli->fd));
+
+       /* open LSARPC session. */
+       res = res ? cli_nt_session_open(smb_cli, PIPE_WKSSVC) : False;
+
        /* send info level: receive requested info.  hopefully. */
-       res = res ? wks_query_info( dest_wks, info_level, &ctr) : False;
+       res = res ? do_wks_query_info(smb_cli, 
+                               dest_wks, info_level, &ctr) : False;
+
+       /* close the session */
+       cli_nt_session_close(smb_cli);
 
        if (res)
        {