Adding LSA_OPENSECRET (-> LsarOpenSecret) and LSA_QUERYSECRET
[samba.git] / source3 / rpcclient / rpcclient.c
1 /* 
2    Unix SMB/Netbios implementation.
3    Version 1.9.
4    SMB client
5    Copyright (C) Andrew Tridgell 1994-1998
6    
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11    
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16    
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22 #ifdef SYSLOG
23 #undef SYSLOG
24 #endif
25
26 #include "includes.h"
27
28 #ifndef REGISTER
29 #define REGISTER 0
30 #endif
31
32 extern pstring debugf;
33 extern pstring scope;
34 extern pstring global_myname;
35
36 extern pstring user_socket_options;
37
38
39 extern int DEBUGLEVEL;
40
41
42 extern file_info def_finfo;
43
44 #define CNV_LANG(s) dos2unix_format(s,False)
45 #define CNV_INPUT(s) unix2dos_format(s,True)
46
47 static int process_tok(fstring tok);
48 static void cmd_help(struct client_info *info);
49 static void cmd_quit(struct client_info *info);
50
51 static struct cli_state smbcli;
52 struct cli_state *smb_cli = &smbcli;
53
54 FILE *out_hnd;
55
56 /****************************************************************************
57 initialise smb client structure
58 ****************************************************************************/
59 void rpcclient_init(void)
60 {
61         bzero(smb_cli, sizeof(smb_cli));
62         cli_initialise(smb_cli);
63         smb_cli->capabilities |= CAP_NT_SMBS | CAP_STATUS32;
64 }
65
66 /****************************************************************************
67 make smb client connection
68 ****************************************************************************/
69 static BOOL rpcclient_connect(struct client_info *info)
70 {
71         struct nmb_name calling;
72         struct nmb_name called;
73
74         make_nmb_name(&called , dns_to_netbios_name(info->dest_host ), info->name_type, scope);
75         make_nmb_name(&calling, dns_to_netbios_name(info->myhostname), 0x0            , scope);
76
77         if (!cli_establish_connection(smb_cli, 
78                                   info->dest_host, &info->dest_ip, 
79                                   &calling, &called,
80                                   info->share, info->svc_type,
81                                   False, True))
82         {
83                 DEBUG(0,("rpcclient_connect: connection failed\n"));
84                 cli_shutdown(smb_cli);
85                 return False;
86         }
87
88         return True;
89 }
90
91 /****************************************************************************
92 stop the smb connection(s?)
93 ****************************************************************************/
94 static void rpcclient_stop(void)
95 {
96         cli_shutdown(smb_cli);
97 }
98 /****************************************************************************
99  This defines the commands supported by this client
100  ****************************************************************************/
101 struct
102 {
103   char *name;
104   void (*fn)(struct client_info*);
105   char *description;
106 } commands[] = 
107 {
108   {"svcenum",    cmd_svc_enum,         "[-i] Lists Services Manager"},
109   {"regenum",    cmd_reg_enum,         "<keyname> Registry Enumeration (keys, values)"},
110   {"regdeletekey",cmd_reg_delete_key,  "<keyname> Registry Key Delete"},
111   {"regcreatekey",cmd_reg_create_key,  "<keyname> [keyclass] Registry Key Create"},
112   {"shutdown",cmd_reg_shutdown,  "[-m message] [-t timeout] [-r or --reboot] Server Shutdown"},
113   {"regquerykey",cmd_reg_query_key,    "<keyname> Registry Key Query"},
114   {"regdeleteval",cmd_reg_delete_val,  "<valname> Registry Value Delete"},
115   {"regcreateval",cmd_reg_create_val,  "<valname> <valtype> <value> Registry Key Create"},
116   {"reggetsec",  cmd_reg_get_key_sec,  "<keyname> Registry Key Security"},
117   {"regtestsec", cmd_reg_test_key_sec, "<keyname> Test Registry Key Security"},
118   {"ntlogin",    cmd_netlogon_login_test, "[username] [password] NT Domain login test"},
119   {"domtrust",    cmd_netlogon_domain_test, "<domain> NT Inter-Domain test"},
120   {"wksinfo",    cmd_wks_query_info,   "Workstation Query Info"},
121   {"srvinfo",    cmd_srv_query_info,   "Server Query Info"},
122   {"srvsessions",cmd_srv_enum_sess,    "List sessions on a server"},
123   {"srvshares",  cmd_srv_enum_shares,  "List shares on a server"},
124   {"srvconnections",cmd_srv_enum_conn, "List connections on a server"},
125   {"srvfiles",   cmd_srv_enum_files,   "List files on a server"},
126   {"lsaquery",   cmd_lsa_query_info,   "Query Info Policy (domain member or server)"},
127   {"lookupsids", cmd_lsa_lookup_sids,  "Resolve names from SIDs"},
128   {"lookupnames",cmd_lsa_lookup_names,  "Resolve SIDs from names"},
129   {"lookupdomain",cmd_sam_lookup_domain, "Obtain SID for a local domain"},
130   {"enumusers",  cmd_sam_enum_users,   "SAM User Database Query (experimental!)"},
131   {"addgroupmem",cmd_sam_add_groupmem,"<group rid> [member rid1] [member rid2] ... SAM Add Domain Group Member"},
132   {"addaliasmem",cmd_sam_add_aliasmem,"<alias rid> [member sid1] [member sid2] ... SAM Add Domain Alias Member"},
133   {"creategroup",cmd_sam_create_dom_group,"SAM Create Domain Group"},
134   {"createalias",cmd_sam_create_dom_alias,"SAM Create Domain Alias"},
135   {"delgroup",   cmd_sam_delete_dom_group,"SAM Delete Domain Group"},
136   {"delalias",   cmd_sam_delete_dom_alias,"SAM Delete Domain Alias"},
137   {"ntpass",     cmd_sam_ntchange_pwd, "NT SAM Password Change"},
138   {"samuser",    cmd_sam_query_user,   "<username> SAM User Query (experimental!)"},
139   {"samtest",    cmd_sam_test      ,   "SAM User Encrypted RPC test (experimental!)"},
140   {"enumaliases",cmd_sam_enum_aliases, "SAM Aliases Database Query (experimental!)"},
141   {"enumgroups", cmd_sam_enum_groups,  "SAM Group Database Query (experimental!)"},
142   {"samgroups",  cmd_sam_query_dominfo, "SAM Query Domain Info(experimental!)"},
143   {"querysecret", cmd_lsa_query_secret, "LSA Query Secret (developer use)"},
144   {"quit",       cmd_quit,        "logoff the server"},
145   {"q",          cmd_quit,        "logoff the server"},
146   {"exit",       cmd_quit,        "logoff the server"},
147   {"bye",        cmd_quit,        "logoff the server"},
148   {"help",       cmd_help,        "[command] give help on a command"},
149   {"?",          cmd_help,        "[command] give help on a command"},
150   {"!",          NULL,            "run a shell command on the local system"},
151   {"",           NULL,            NULL}
152 };
153
154
155 /****************************************************************************
156 do a (presumably graceful) quit...
157 ****************************************************************************/
158 static void cmd_quit(struct client_info *info)
159 {
160         rpcclient_stop();
161 #ifdef MEM_MAN
162         {
163                 extern FILE* dbf;
164                 smb_mem_write_status(dbf);
165                 smb_mem_write_errors(dbf);
166                 smb_mem_write_verbose(dbf);
167                 dbgflush();
168         }
169 #endif
170         exit(0);
171 }
172
173 /****************************************************************************
174 help
175 ****************************************************************************/
176 static void cmd_help(struct client_info *info)
177 {
178   int i=0,j;
179   fstring buf;
180
181   if (next_token(NULL,buf,NULL, sizeof(buf)))
182     {
183       if ((i = process_tok(buf)) >= 0)
184         fprintf(out_hnd, "HELP %s:\n\t%s\n\n",commands[i].name,commands[i].description);                    
185     }
186   else
187     while (commands[i].description)
188       {
189         for (j=0; commands[i].description && (j<5); j++) {
190           fprintf(out_hnd, "%-15s",commands[i].name);
191           i++;
192         }
193         fprintf(out_hnd, "\n");
194       }
195 }
196
197 /*******************************************************************
198   lookup a command string in the list of commands, including 
199   abbreviations
200   ******************************************************************/
201 static int process_tok(fstring tok)
202 {
203   int i = 0, matches = 0;
204   int cmd=0;
205   int tok_len = strlen(tok);
206   
207   while (commands[i].fn != NULL)
208     {
209       if (strequal(commands[i].name,tok))
210         {
211           matches = 1;
212           cmd = i;
213           break;
214         }
215       else if (strnequal(commands[i].name, tok, tok_len))
216         {
217           matches++;
218           cmd = i;
219         }
220       i++;
221     }
222   
223   if (matches == 0)
224     return(-1);
225   else if (matches == 1)
226     return(cmd);
227   else
228     return(-2);
229 }
230
231 /****************************************************************************
232 wait for keyboard activity, swallowing network packets
233 ****************************************************************************/
234 static void wait_keyboard(struct cli_state *cli)
235 {
236   fd_set fds;
237   struct timeval timeout;
238   
239   while (1) 
240     {
241       FD_ZERO(&fds);
242       FD_SET(cli->fd,&fds);
243       FD_SET(fileno(stdin),&fds);
244
245       timeout.tv_sec = 20;
246       timeout.tv_usec = 0;
247       sys_select(MAX(cli->fd,fileno(stdin))+1,&fds,&timeout);
248       
249       if (FD_ISSET(fileno(stdin),&fds))
250         return;
251
252       /* We deliberately use receive_smb instead of
253          client_receive_smb as we want to receive
254          session keepalives and then drop them here.
255        */
256       if (FD_ISSET(cli->fd,&fds))
257         receive_smb(cli->fd,cli->inbuf,0);
258     }  
259 }
260
261 /****************************************************************************
262   process commands from the client
263 ****************************************************************************/
264 static void do_command(struct client_info *info, char *tok, char *line)
265 {
266         int i;
267
268         if ((i = process_tok(tok)) >= 0)
269         {
270                 commands[i].fn(info);
271         }
272         else if (i == -2)
273         {
274                 fprintf(out_hnd, "%s: command abbreviation ambiguous\n", CNV_LANG(tok));
275         }
276         else
277         {
278                 fprintf(out_hnd, "%s: command not found\n", CNV_LANG(tok));
279         }
280 }
281
282 /****************************************************************************
283   process commands from the client
284 ****************************************************************************/
285 static BOOL process( struct client_info *info, char *cmd_str)
286 {
287         pstring line;
288         char *cmd = cmd_str;
289
290         if (cmd[0] != '\0') while (cmd[0] != '\0')
291         {
292                 char *p;
293                 fstring tok;
294
295                 if ((p = strchr(cmd, ';')) == 0)
296                 {
297                         strncpy(line, cmd, 999);
298                         line[1000] = '\0';
299                         cmd += strlen(cmd);
300                 }
301                 else
302                 {
303                         if (p - cmd > 999) p = cmd + 999;
304                         strncpy(line, cmd, p - cmd);
305                         line[p - cmd] = '\0';
306                         cmd = p + 1;
307                 }
308
309                 /* input language code to internal one */
310                 CNV_INPUT (line);
311
312                 /* get the first part of the command */
313                 {
314                         char *ptr = line;
315                         if (!next_token(&ptr,tok,NULL, sizeof(tok))) continue;
316                 }
317
318                 do_command(info, tok, line);
319         }
320         else while (!feof(stdin))
321         {
322                 fstring tok;
323
324                 /* display a prompt */
325                 fprintf(out_hnd, "smb: %s> ", CNV_LANG(info->cur_dir));
326                 fflush(out_hnd);
327
328 #ifdef CLIX
329                 line[0] = wait_keyboard(smb_cli);
330                 /* this might not be such a good idea... */
331                 if ( line[0] == EOF)
332                 {
333                         break;
334                 }
335 #else
336                 wait_keyboard(smb_cli);
337 #endif
338
339                 /* and get a response */
340 #ifdef CLIX
341                 fgets( &line[1],999, stdin);
342 #else
343                 if (!fgets(line,1000,stdin))
344                 {
345                         break;
346                 }
347 #endif
348
349                 /* input language code to internal one */
350                 CNV_INPUT (line);
351
352                 /* special case - first char is ! */
353                 if (*line == '!')
354                 {
355                         system(line + 1);
356                         continue;
357                 }
358
359                 fprintf(out_hnd, "%s\n", line);
360
361                 /* get the first part of the command */
362                 {
363                         char *ptr = line;
364                         if (!next_token(&ptr,tok,NULL, sizeof(tok))) continue;
365                 }
366
367                 do_command(info, tok, line);
368         }
369
370         return(True);
371 }
372
373 /****************************************************************************
374 usage on the program
375 ****************************************************************************/
376 static void usage(char *pname)
377 {
378   fprintf(out_hnd, "Usage: %s service <password> [-d debuglevel] [-l log] ",
379            pname);
380
381   fprintf(out_hnd, "\nVersion %s\n",VERSION);
382   fprintf(out_hnd, "\t-d debuglevel         set the debuglevel\n");
383   fprintf(out_hnd, "\t-l log basename.      Basename for log/debug files\n");
384   fprintf(out_hnd, "\t-n netbios name.      Use this name as my netbios name\n");
385   fprintf(out_hnd, "\t-N                    don't ask for a password\n");
386   fprintf(out_hnd, "\t-m max protocol       set the max protocol level\n");
387   fprintf(out_hnd, "\t-I dest IP            use this IP to connect to\n");
388   fprintf(out_hnd, "\t-E                    write messages to stderr instead of stdout\n");
389   fprintf(out_hnd, "\t-U username           set the network username\n");
390   fprintf(out_hnd, "\t-W workgroup          set the workgroup name\n");
391   fprintf(out_hnd, "\t-c command string     execute semicolon separated commands\n");
392   fprintf(out_hnd, "\t-t terminal code      terminal i/o code {sjis|euc|jis7|jis8|junet|hex}\n");
393   fprintf(out_hnd, "\n");
394 }
395
396 enum client_action
397 {
398         CLIENT_NONE,
399         CLIENT_IPC,
400         CLIENT_SVC
401 };
402
403 /****************************************************************************
404   main program
405 ****************************************************************************/
406  int main(int argc,char *argv[])
407 {
408         BOOL interactive = True;
409
410         int opt;
411         extern FILE *dbf;
412         extern char *optarg;
413         extern int optind;
414         static pstring servicesf = CONFIGFILE;
415         pstring term_code;
416         char *p;
417         BOOL got_pass = False;
418         char *cmd_str="";
419         mode_t myumask = 0755;
420         enum client_action cli_action = CLIENT_NONE;
421
422         struct client_info cli_info;
423
424         pstring password; /* local copy only, if one is entered */
425
426         out_hnd = stdout;
427         fstrcpy(debugf, argv[0]);
428
429         rpcclient_init();
430
431 #ifdef KANJI
432         pstrcpy(term_code, KANJI);
433 #else /* KANJI */
434         *term_code = 0;
435 #endif /* KANJI */
436
437         DEBUGLEVEL = 2;
438
439         cli_info.put_total_size = 0;
440         cli_info.put_total_time_ms = 0;
441         cli_info.get_total_size = 0;
442         cli_info.get_total_time_ms = 0;
443
444         cli_info.dir_total = 0;
445         cli_info.newer_than = 0;
446         cli_info.archive_level = 0;
447         cli_info.print_mode = 1;
448
449         cli_info.translation = False;
450         cli_info.recurse_dir = False;
451         cli_info.lowercase = False;
452         cli_info.prompt = True;
453         cli_info.abort_mget = True;
454
455         cli_info.dest_ip.s_addr = 0;
456         cli_info.name_type = 0x20;
457
458         pstrcpy(cli_info.cur_dir , "\\");
459         pstrcpy(cli_info.file_sel, "");
460         pstrcpy(cli_info.base_dir, "");
461         pstrcpy(smb_cli->domain, "");
462         pstrcpy(smb_cli->user_name, "");
463         pstrcpy(cli_info.myhostname, "");
464         pstrcpy(cli_info.dest_host, "");
465
466         pstrcpy(cli_info.svc_type, "A:");
467         pstrcpy(cli_info.share, "");
468         pstrcpy(cli_info.service, "");
469
470         ZERO_STRUCT(cli_info.dom.level3_sid);
471         ZERO_STRUCT(cli_info.dom.level5_sid);
472         fstrcpy(cli_info.dom.level3_dom, "");
473         fstrcpy(cli_info.dom.level5_dom, "");
474
475         TimeInit();
476         charset_initialise();
477
478         myumask = umask(0);
479         umask(myumask);
480
481         if (!get_myname(global_myname, NULL))
482         {
483                 fprintf(stderr, "Failed to get my hostname.\n");
484         }
485
486         if (getenv("USER"))
487         {
488                 pstrcpy(smb_cli->user_name,getenv("USER"));
489
490                 /* modification to support userid%passwd syntax in the USER var
491                 25.Aug.97, jdblair@uab.edu */
492
493                 if ((p=strchr(smb_cli->user_name,'%')))
494                 {
495                         *p = 0;
496                         pstrcpy(password,p+1);
497                         got_pass = True;
498                         memset(strchr(getenv("USER"),'%')+1,'X',strlen(password));
499                 }
500                 strupper(smb_cli->user_name);
501         }
502
503         password[0] = 0;
504
505         /* modification to support PASSWD environmental var
506            25.Aug.97, jdblair@uab.edu */
507         if (getenv("PASSWD"))
508         {
509                 pstrcpy(password,getenv("PASSWD"));
510         }
511
512         if (*smb_cli->user_name == 0 && getenv("LOGNAME"))
513         {
514                 pstrcpy(smb_cli->user_name,getenv("LOGNAME"));
515                 strupper(smb_cli->user_name);
516         }
517
518         if (argc < 2)
519         {
520                 usage(argv[0]);
521                 exit(1);
522         }
523
524         if (*argv[1] != '-')
525         {
526
527                 pstrcpy(cli_info.service, argv[1]);  
528                 /* Convert any '/' characters in the service name to '\' characters */
529                 string_replace( cli_info.service, '/','\\');
530                 argc--;
531                 argv++;
532
533                 fprintf(out_hnd, "service: %s\n", cli_info.service);
534
535                 if (count_chars(cli_info.service,'\\') < 3)
536                 {
537                         usage(argv[0]);
538                         printf("\n%s: Not enough '\\' characters in service\n", cli_info.service);
539                         exit(1);
540                 }
541
542                 /*
543                 if (count_chars(cli_info.service,'\\') > 3)
544                 {
545                         usage(pname);
546                         printf("\n%s: Too many '\\' characters in service\n", cli_info.service);
547                         exit(1);
548                 }
549                 */
550
551                 if (argc > 1 && (*argv[1] != '-'))
552                 {
553                         got_pass = True;
554                         pstrcpy(password,argv[1]);  
555                         memset(argv[1],'X',strlen(argv[1]));
556                         argc--;
557                         argv++;
558                 }
559
560                 cli_action = CLIENT_SVC;
561         }
562
563         while ((opt = getopt(argc, argv,"s:B:O:M:S:i:N:n:d:l:hI:EB:U:L:t:m:W:T:D:c:")) != EOF)
564         {
565                 switch (opt)
566                 {
567                         case 'm':
568                         {
569                                 /* FIXME ... max_protocol seems to be funny here */
570
571                                 int max_protocol = 0;
572                                 max_protocol = interpret_protocol(optarg,max_protocol);
573                                 fprintf(stderr, "max protocol not currently supported\n");
574                                 break;
575                         }
576
577                         case 'O':
578                         {
579                                 pstrcpy(user_socket_options,optarg);
580                                 break;  
581                         }
582
583                         case 'S':
584                         {
585                                 pstrcpy(cli_info.dest_host,optarg);
586                                 strupper(cli_info.dest_host);
587                                 cli_action = CLIENT_IPC;
588                                 break;
589                         }
590
591                         case 'B':
592                         {
593                                 iface_set_default(NULL,optarg,NULL);
594                                 break;
595                         }
596
597                         case 'i':
598                         {
599                                 pstrcpy(scope, optarg);
600                                 break;
601                         }
602
603                         case 'U':
604                         {
605                                 char *lp;
606                                 pstrcpy(smb_cli->user_name,optarg);
607                                 if ((lp=strchr(smb_cli->user_name,'%')))
608                                 {
609                                         *lp = 0;
610                                         pstrcpy(password,lp+1);
611                                         got_pass = True;
612                                         memset(strchr(optarg,'%')+1,'X',strlen(password));
613                                 }
614                                 break;
615                         }
616
617                         case 'W':
618                         {
619                                 pstrcpy(smb_cli->domain,optarg);
620                                 break;
621                         }
622
623                         case 'E':
624                         {
625                                 dbf = stderr;
626                                 break;
627                         }
628
629                         case 'I':
630                         {
631                                 cli_info.dest_ip = *interpret_addr2(optarg);
632                                 if (zero_ip(cli_info.dest_ip))
633                                 {
634                                         exit(1);
635                                 }
636                                 break;
637                         }
638
639                         case 'n':
640                         {
641                                 fstrcpy(global_myname, optarg);
642                                 break;
643                         }
644
645                         case 'N':
646                         {
647                                 got_pass = True;
648                                 break;
649                         }
650
651                         case 'd':
652                         {
653                                 if (*optarg == 'A')
654                                         DEBUGLEVEL = 10000;
655                                 else
656                                         DEBUGLEVEL = atoi(optarg);
657                                 break;
658                         }
659
660                         case 'l':
661                         {
662                                 slprintf(debugf, sizeof(debugf)-1,
663                                          "%s.client", optarg);
664                                 interactive = False;
665                                 break;
666                         }
667
668                         case 'c':
669                         {
670                                 cmd_str = optarg;
671                                 got_pass = True;
672                                 break;
673                         }
674
675                         case 'h':
676                         {
677                                 usage(argv[0]);
678                                 exit(0);
679                                 break;
680                         }
681
682                         case 's':
683                         {
684                                 pstrcpy(servicesf, optarg);
685                                 break;
686                         }
687
688                         case 't':
689                         {
690                                 pstrcpy(term_code, optarg);
691                                 break;
692                         }
693
694                         default:
695                         {
696                                 usage(argv[0]);
697                                 exit(1);
698                                 break;
699                         }
700                 }
701         }
702
703         setup_logging(debugf, interactive);
704
705         if (cli_action == CLIENT_NONE)
706         {
707                 usage(argv[0]);
708                 exit(1);
709         }
710
711         strupper(global_myname);
712         fstrcpy(cli_info.myhostname, global_myname);
713
714         DEBUG(3,("%s client started (version %s)\n",timestring(),VERSION));
715
716         if (!lp_load(servicesf,True, False, False))
717         {
718                 fprintf(stderr, "Can't load %s - run testparm to debug it\n", servicesf);
719         }
720
721         codepage_initialise(lp_client_code_page());
722
723         if (*smb_cli->domain == 0) pstrcpy(smb_cli->domain,lp_workgroup());
724
725         load_interfaces();
726
727         if (cli_action == CLIENT_IPC)
728         {
729                 pstrcpy(cli_info.share, "IPC$");
730                 pstrcpy(cli_info.svc_type, "IPC");
731         }
732
733         fstrcpy(cli_info.mach_acct, cli_info.myhostname);
734         strupper(cli_info.mach_acct);
735         fstrcat(cli_info.mach_acct, "$");
736
737         /* set the password cache info */
738         if (got_pass)
739         {
740                 if (password[0] == 0)
741                 {
742                         pwd_set_nullpwd(&(smb_cli->pwd));
743                 }
744                 else
745                 {
746                         /* generate 16 byte hashes */
747                         pwd_make_lm_nt_16(&(smb_cli->pwd), password);
748                 }
749         }
750         else 
751         {
752                 pwd_read(&(smb_cli->pwd), "Enter Password:", True);
753         }
754
755         /* paranoia: destroy the local copy of the password */
756         bzero(password, sizeof(password)); 
757
758         /* establish connections.  nothing to stop these being re-established. */
759         rpcclient_connect(&cli_info);
760
761         DEBUG(5,("rpcclient_connect: smb_cli->fd:%d\n", smb_cli->fd));
762         if (smb_cli->fd <= 0)
763         {
764                 fprintf(stderr, "warning: connection could not be established to %s<%02x>\n",
765                                  cli_info.dest_host, cli_info.name_type);
766                 fprintf(stderr, "this version of smbclient may crash if you proceed\n");
767                 exit(-1);
768         }
769
770         switch (cli_action)
771         {
772                 case CLIENT_IPC:
773                 {
774                         process(&cli_info, cmd_str);
775                         break;
776                 }
777
778                 default:
779                 {
780                         fprintf(stderr, "unknown client action requested\n");
781                         break;
782                 }
783         }
784
785         rpcclient_stop();
786
787         return(0);
788 }