2 Samba Unix/Linux SMB client library
4 Distributed SMB/CIFS Server Management Utility
5 Copyright (C) 2001 Steve French (sfrench@us.ibm.com)
6 Copyright (C) 2001 Jim McDonough (jmcd@us.ibm.com)
8 connect_to_ipc based on similar routine
9 Copyright (C) Andrew Tridgell 1994-1998
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 /*****************************************************/
28 /* Distributed SMB/CIFS Server Management Utility */
30 /* The intent was to make the syntax similar */
31 /* to the NET utility (first developed in DOS */
32 /* with additional interesting & useful functions */
33 /* added in later SMB server network operating */
36 /*****************************************************/
40 /***********************************************************************/
41 /* Beginning of internationalization section. Translatable constants */
42 /* should be kept in this area and referenced in the rest of the code. */
44 /* No functions, outside of Samba or LSB (Linux Standards Base) should */
45 /* be used (if possible). */
46 /***********************************************************************/
48 typedef struct _functable {
53 /* functions available */
63 #define GROUPMEMBERF 10
70 const functable net_func[] = {
73 { SESSIONF, "SESSION"},
79 { VALIDATEF, "VALIDATE"},
80 { GROUPMEMBERF, "GROUPMEMBER"},
82 { SERVICEF, "SERVICE"},
83 { PASSWORDF, "PASSWORD"},
85 { DOMJOINF, "DOMAINMEMBER"},
89 /* subfunctions available */
91 #define LIST_SF 1 /* enumerate */
92 #define ADD_SF 2 /* also used for create and start */
93 #define DELETE_SF 3 /* also used for close and stop */
94 #define INFO_SF 4 /* get information */
96 const functable net_subfunc[] = {
98 { LIST_SF, "ENUMERATE" },
100 { ADD_SF, "CREATE" },
101 { DELETE_SF, "CLOSE" },
102 { DELETE_SF, "DELETE" },
106 const char share_type[][6] = {
113 #define PASSWORD_PROMPT "Password: "
114 #define YES_STRING "Yes"
115 #define NO_STRING "No"
119 " net domain \tto list domains \n"\
120 " net file \tto list open files on a server \n"\
121 " net group \tto list user groups \n"\
122 " net groupmember to list users in a group \n"\
123 " net password\t to change the password of a user\n"\
124 " net printq \tto list the print queues on a server\n"\
125 " net server \tto list servers in a domain\n"\
126 " net session \tto list clients with open sessions to a server\n"\
127 " net share \tto list shares exported by a server\n"\
128 " net user \tto list users\n"\
129 " net validate \tto check whether a user and the corresponding password are valid\n"\
131 "\nType \"net help <option>\" to get more information on that option\n"
133 #define NET_FILE_USAGE \
134 "\nnet file [misc. options] [targets]"\
135 "\n\tenumerates all open files on file server\n"\
136 "\nnet file <username> [misc. options] [targets]"\
137 "\n\tenumerates all files opened by username on file server\n"\
138 "\nnet file CLOSE <id> [misc. options] [targets]"\
139 "\n\tcloses specified file on target server\n"
141 #define FILE_INFO_DISPLAY \
147 #define FILE_ENUM_DISPLAY \
148 "\nEnumerating open files on remote server:\n\n"\
149 "\n\tFileId Opened by Perms Locks Path \n"\
150 "\t------ --------- ----- ----- ---- \n"
152 #define NET_SHARE_USAGE \
153 "\nnet share [misc. options] [targets] \n"\
154 "\tenumerates all exported resources (network shares) on target server\n"\
155 "\nnet share ADD <name=serverpath> [misc. options] [targets]"\
156 "\n\tAdd a share from a server (makes the export active)\n"\
157 "\nnet share DELETE <sharename> [misc. options] [targets]\n"\
159 "\nnet share CLOSE <sharename> [misc. options] [targets]"\
160 "\n\tDeletes a share from a server (makes the export inactive)\n"
162 #define SHARE_ENUM_DISPLAY \
163 "\nEnumerating shared resources (exports) on remote server:\n\n"\
164 "\nShare name Type Description\n"\
165 "---------- ---- -----------\n"
168 #define NET_SESSION_USAGE \
169 "\nnet session [misc. options] [targets]"\
170 "\n\tenumerates all active SMB/CIFS sessions on target server\n"\
171 "\nnet session DELETE <client_name> [misc. options] [targets] \n"\
173 "\nnet session CLOSE <client_name> [misc. options] [targets]"\
174 "\n\tDeletes (closes) a session from specified client to server\n"
176 #define SESSION_ENUM_DISPLAY \
177 "Computer User name Client Type Opens Idle time\n\n"\
178 "------------------------------------------------------------------------------\n"
181 #define SESSION_DISPLAY_ONE \
182 "User name %-20.20s\n"\
183 "Computer %-20.20s\n"\
184 "Guest logon %-20.20s\n"\
185 "Client Type %-40.40s\n"\
186 "Sess time %2.2d:%2.2d:%2.2d\n"\
187 "Idle time %2.2d:%2.2d:%2.2d\n"
189 #define SESSION_DISPLAY_CONNS \
190 "Share name Type # Opens\n"\
191 "------------------------------------------------------------------------------\n"
193 #define NET_SERVER_USAGE \
195 " net server [domain]\tlists the servers in the specified domain or workgroup.\n"\
196 " If domain is not specified, it uses the current domain or workgroup as\n"\
199 #define SERVER_ENUM_DISPLAY "\nEnumerating servers in this domain or workgroup: \n\n" \
200 "\n\tServer name Server description\n"\
201 "\t------------- ----------------------------\n"
204 #define NET_DOMAIN_USAGE \
206 " net domain [misc. options] [target]\n\tlists the domains "\
207 "or workgroups visible on the current network\n"
209 #define DOMAIN_ENUM_DISPLAY \
210 "\nEnumerating domains:\n\n"\
211 "\n\tDomain name Server name of Browse Master\n"\
212 "\t------------- ----------------------------\n"
214 #define NET_PRINTQ_USAGE \
216 " net printq [misc. options] [targets]\n"\
218 " net printq list [<queue_name>] [misc. options] [targets]\n"\
219 "\tlists the specified queue and jobs on the target server.\n"\
220 "\tIf the queue name is not specified, all queues are listed.\n\n"\
221 " net printq delete [<queue name>] [misc. options] [targets]\n"\
222 "\tdeletes the specified job number on the target server, or the\n"\
223 "\tprinter queue if no job number is specified\n"
224 #define PRINTQ_ENUM_DISPLAY \
225 "Print queues at \\\\%s\n\n"\
226 "Name Job # Size Status\n\n"\
227 "------------------------------------------------------------------"\
229 #define PRINTQ_DISPLAY_ONE "%-23.23s %5d jobs %-22.22s\n"
230 #define PRINTQ_PRINTER_ACTIVE "*Printer Active*"
231 #define PRINTQ_PRINTER_PAUSED "*Printer Paused*"
232 #define PRINTQ_PRINTER_ERROR "*Printer error*"
233 #define PRINTQ_PRINTER_DELPEND "*Delete Pending*"
234 #define PRINTQ_PRINTER_STATUNK "**UNKNOWN STATUS**"
235 #define PRINTQ_DISPLAY_JOB " %-23.23s %5d %9d %-22.22s\n"
236 #define PRINTQ_JOB_PRINTING "Printing"
237 #define PRINTQ_JOB_QUEUED "Waiting"
238 #define PRINTQ_JOB_PAUSED "Held in queue"
239 #define PRINTQ_JOB_SPOOLING "Spooling"
240 #define PRINTQ_QUEUE_WORD " Queue"
242 #define NET_USER_USAGE \
243 "\nnet user [misc. options] [targets]\n\tEnumerate users\n"\
244 "\nnet user DELETE <name> [misc. options] [targets]"\
245 "\n\tDelete specified user\n"\
246 "\nnet user INFO <name> [misc. options] [targets]"\
247 "\n\tList the domain groups of the specified user\n"\
248 "\nnet user ADD <name> [-F user flags] [misc. options] [targets]"\
249 "\n\tAdd specified user\n"
251 #define USER_ENUM_DISPLAY \
252 "\nEnumerating shared resources (exports) on remote server:\n\n"\
253 "\nUser name Description Home Directory Profile Directory\n"\
254 "--------- ----------- -------------- -----------------\n"
256 #define NET_GROUP_USAGE \
257 "\nnet group [misc. options] [targets]"\
258 "\n\tEnumerate user groups\n"\
259 "\nnet group DELETE <name> [misc. options] [targets]"\
260 "\n\tDelete specified group\n"\
261 "\nnet group ADD <name> [-C comment] [misc. options] [targets]"\
262 "\n\tCreate specified group\n"
264 #define NET_GROUPMEMBER_USAGE \
265 "\nnet groupmember LIST <group name> [misc. options] [targets]"\
266 "\n\t Enumerate users in a group\n"\
267 "\nnet groupmember DELETE <group name> <user name> [misc. options] "\
268 "[targets]\n\t Delete sepcified user from specified group\n"\
269 "\nnet groupmember ADD <group name> <user name> [misc. options] [targets]"\
270 "\n\t Add specified user to specified group\n"
273 #define NET_ADMIN_USAGE \
274 "\nnet admin <remote command to execute> [cmd arguments [environment]] [misc_options] [targets]\n"\
275 "\texecutes a remote command on an os/2 target server\n"
277 #define NET_PASSWORD_USAGE \
278 "\nnet password <user> <old password> <new password> [misc_options] [targets]\n"\
279 "\tchanges the password for the specified user on a remote server\n"
281 #define NET_SERVICE_USAGE \
282 "\nnet service [misc. options] [targets] \n"\
283 "\tenumerates all running service daemons on target server\n"\
284 "\nnet service ADD <name> [service startup arguments] [misc. options] [targets]"\
285 "\n\tStart named service on remote server\n"\
286 "\nnet service DELETE <name> [misc. options] [targets]\n"\
287 "\n\tStop named service on remote server\n"
290 #define NET_VALIDATE_USAGE \
291 "\nnet validate <username> [password]\n"\
292 "\tValidate user and password to check whether they can access target server or domain\n"
294 #define TARGET_USAGE "\nValid targets: choose one (none defaults to using the %s)\n"
295 #define GLBL_LCL_MASTER "global browsemaster or local browse master if that is not found"
296 #define DOMAIN_MASTER "local domain browse master"
297 #define LOCAL_HOST "localhost"
298 #define MISC_OPT_USAGE "\nValid miscellaneous options are:\n"
299 #define SERVER_USAGE "\t-S or --server=<server>\t\tserver name\n"
300 #define IPADDRESS_USAGE "\t-I or --ipaddress=<ipaddr>\tip address of target server\n"
301 #define PORT_USAGE "\t-p or --port=<port number>\tconnection port on target server\n"
302 #define WORKGROUP_USAGE "\t-w or --workgroup=<wg>\t\ttarget workgroup or domain name\n"
303 #define COMMENT_USAGE "\t-C or --comment=<comment>\tdescriptive comment (for add only)\n"
304 #define MYWORKGROUP_USAGE "\t-W or --myworkgroup=<wg>\tclient workgroup\n"
305 #define DEBUG_USAGE "\t-d or --debug=<level>\t\tdebug level (0-10)\n"
306 #define MYNAME_USAGE "\t-n or --myname=<name>\t\tclient name\n"
307 #define USER_USAGE "\t-U or --user=<name>\t\tuser name\n"
308 #define CONF_USAGE "\t-s or --conf=<path>\t\tpathname of smb.conf file\n"
309 #define JOBID_USAGE "\t-j or --jobid=<job id>\t\tjob id\n"
310 #define MAXUSERS_USAGE "\t-M or --maxusers=<num>\t\tmax users allowed for share\n"
311 #define LONG_USAGE "\t-l or --long\t\t\tDisplay full information\n"
313 #define ERRMSG_NOCONN_TARGET_SRVR "\nUnable to connect to target server\n"
314 #define ERRMSG_NOCONN_BROWSE_MSTR "\nUnable to connect to browse master\n"
315 #define ERRMSG_NOT_IMPLEMENTED "\nNot implemented\n"
316 #define ERRMSG_FILEID_MISSING "\nMissing fileid of file to close\n\n"
317 #define ERRMSG_GROUPNAME_MISSING "\n\nGroup name not specified\n"
318 #define ERRMSG_USERNAME_MISSING "\n\nUser name not specified\n"
319 #define ERRMSG_SHARENAME_MISSING "\n\nShare name not specified\n"
320 #define ERRMSG_TARGET_WG_NOT_VALID "\nTarget workgroup option not valid "\
321 "except on net server command, ignored"
322 #define ERRMSG_INVALID_HELP_OPTION "\nInvalid help option\n"
323 #define ERRMSG_INVALID_OPTION "\nInvalid option %c (%d)\n"
324 #define ERRMSG_INVALID_IPADDRESS "\nInvalid ip address specified\n"
325 #define ERRMSG_SPURIOUS_PARM "\nInvalid paramater ignored: %s\n"
326 #define ERRMSG_BOTH_SERVER_IPADDRESS "\nTarget server and IP address both "\
327 "specified. Do not set both at the same time. The target IP address was used\n"
328 #define ERRMSG_INVALID_DOMAIN_ACTION "\nInvalid action for NET DOMAIN command"\
329 " ignored. Only listing domains permitted.\n"
332 #define COMMENT_STR "Comment "
333 #define USER_STR "User name "
334 #define GROUP_STR "Group name "
335 #define SERVICE_STR "Service name"
336 #define HOMED_STR "Home directory "
337 #define LOGONS_STR "Logon script "
338 /************************************************************************************/
339 /* end of internationalization section */
340 /************************************************************************************/
342 extern int optind, opterr, optopt;
343 extern struct in_addr ipzero;
345 struct cli_state *cli;
346 static pstring global_requester_name;
347 static pstring host; /* target server */
348 static pstring password;
349 static pstring global_user_name;
350 static pstring global_workgroup;
351 static int port = SMB_PORT;
352 static int long_list_entries = 0;
353 static BOOL got_pass = False;
354 static BOOL have_ip = False;
355 struct in_addr dest_ip;
357 int get_func(const char *parm)
361 for (i=0;i<=sizeof(net_func);i++)
362 if (StrnCaseCmp(parm, net_func[i].funcname,10) == 0)
363 return net_func[i].func;
367 int get_subfunc(const char *parm)
371 for (i=0;i<=sizeof(net_subfunc);i++)
372 if (StrnCaseCmp(parm, net_subfunc[i].funcname,10) == 0)
373 return net_subfunc[i].func;
377 /****************************************************************************
379 ****************************************************************************/
380 struct cli_state *connect_to_ipc(char *server)
383 struct nmb_name called, calling;
390 /* make a copy so we don't modify the global string 'service' */
391 safe_strcpy(servicename, "IPC$", sizeof(servicename)-1);
392 sharename = servicename;
393 if (*sharename == '\\') {
394 server = sharename+2;
395 sharename = strchr(server,'\\');
396 if (!sharename) return NULL;
402 return NULL; /* if ip addr specified, ascii version of ip address is used as host name */
407 make_nmb_name(&calling, global_requester_name, 0x0);
408 make_nmb_name(&called , server, 0x20);
415 DEBUG(3,("Connecting to host=%s\\share=%s\n\n",
418 /* have to open a new connection */
419 if (!(c=cli_initialise(NULL)) || (cli_set_port(c, port) == 0) ||
420 !cli_connect(c, server_n, &ip)) {
421 DEBUG(1,("Connection to %s failed\n", server_n));
425 c->protocol = PROTOCOL_NT1;
427 if (!cli_session_request(c, &calling, &called)) {
429 DEBUG(1,("session request to %s failed (%s)\n",
430 called.name, cli_errstr(c)));
433 if ((p=strchr(called.name, '.'))) {
437 if (strcmp(called.name, "*SMBSERVER")) {
438 make_nmb_name(&called , "*SMBSERVER", 0x20);
444 DEBUG(4,(" session request ok\n"));
446 if (!cli_negprot(c)) {
447 DEBUG(1,("protocol negotiation failed\n"));
454 char *pass = getpass(PASSWORD_PROMPT);
456 pstrcpy(password, pass);
460 if (!cli_session_setup(c, global_user_name,
461 password, strlen(password),
462 password, strlen(password),
464 /* try again with a null username */
465 if (!cli_session_setup(c, "", "", 0, "", 0, global_workgroup)) {
466 DEBUG(1,("session setup failed: %s\n", cli_errstr(c)));
471 DEBUG(3,("Anonymous login successful\n"));
474 DEBUG(4,(" session setup ok\n"));
475 if (!cli_send_tconX(c, sharename, "?????",
476 password, strlen(password)+1)) {
477 DEBUG(1,("tree connect failed: %s\n", cli_errstr(c)));
483 DEBUG(4,(" tconx ok\n"));
494 void file_usage(void)
496 d_printf(NET_FILE_USAGE); /* command syntax */
498 d_printf(TARGET_USAGE, LOCAL_HOST); /* target options */
499 d_printf(SERVER_USAGE);
500 d_printf(IPADDRESS_USAGE);
502 d_printf(MISC_OPT_USAGE); /* misc options */
503 d_printf(PORT_USAGE);
504 d_printf(MYWORKGROUP_USAGE);
505 d_printf(DEBUG_USAGE);
506 d_printf(MYNAME_USAGE);
507 d_printf(USER_USAGE);
508 d_printf(CONF_USAGE);
511 /***************************************************************************
512 list info on an open file
513 ***************************************************************************/
514 static void file_fn(const char * pPath, const char * pUser, uint16 perms, uint16 locks, uint32 id)
516 d_printf("\t%-7.1d %-20.20s 0x%-4.2x %-6.1d %s\n",
517 id, pUser, perms, locks, pPath);
520 static void one_file_fn(const char *pPath, const char *pUser, uint16 perms, uint16 locks, uint32 id)
522 d_printf(FILE_INFO_DISPLAY, id, pUser, locks, pPath, perms);
525 int net_file(int subfunct, const char * id)
527 struct in_addr target_ip;
529 if((have_ip == 0) && (host[0] == 0)) {
530 if (!resolve_name("localhost", &target_ip, 0x20)) {
531 DEBUG(1,("No remote server specified, unable to resolve connection to localhost via name lookup"));
538 if(host[0] == 0) strncpy(host, inet_ntoa(dest_ip),16);
539 cli = connect_to_ipc(host);
541 d_printf(ERRMSG_NOCONN_TARGET_SRVR);
545 if(subfunct == DELETE_SF) { /* close open file on remote server */
547 d_printf(ERRMSG_FILEID_MISSING);
550 return cli_NetFileClose(cli, atoi(id));
551 } else if(subfunct == LIST_SF) {
552 d_printf(FILE_ENUM_DISPLAY); /* file list header */
553 return cli_NetFileEnum(cli, NULL, NULL, file_fn);
554 } else if ((subfunct == OTHER_SF) && id) {
555 return cli_NetFileGetInfo(cli, atoi(id), one_file_fn);
560 void share_usage(void)
562 d_printf(NET_SHARE_USAGE); /* command syntax */
564 d_printf(TARGET_USAGE, LOCAL_HOST); /* target options */
565 d_printf(SERVER_USAGE);
566 d_printf(IPADDRESS_USAGE);
568 d_printf(MISC_OPT_USAGE); /* misc options */
569 d_printf(PORT_USAGE);
570 d_printf(COMMENT_USAGE);
571 d_printf(MAXUSERS_USAGE);
572 d_printf(MYWORKGROUP_USAGE);
573 d_printf(DEBUG_USAGE);
574 d_printf(MYNAME_USAGE);
575 d_printf(USER_USAGE);
576 d_printf(CONF_USAGE);
579 void long_share_fn(const char *share_name, uint32 type, const char *comment, void *state)
581 d_printf("%-12.12s %-8.8s %-50.50s\n", share_name, share_type[type], comment);
584 void share_fn(const char *share_name, uint32 type, const char *comment, void *state)
586 d_printf("%-12.12s\n", share_name);
589 int net_share(int subfunct, const char * sharename, const char * comment, int maxusers)
591 struct in_addr target_ip;
593 if((have_ip == 0) && (host[0] == 0)) {
594 if (!resolve_name("localhost", &target_ip, 0x20)) {
595 DEBUG(1,("No remote server specified, unable to resolve connection to localhost via name lookup"));
604 strncpy(host, inet_ntoa(dest_ip),16);
605 cli = connect_to_ipc(host);
607 d_printf(ERRMSG_NOCONN_TARGET_SRVR);
610 if (subfunct == DELETE_SF) {
611 if (sharename == NULL) {
612 d_printf(ERRMSG_SHARENAME_MISSING);
615 return cli_NetShareDelete(cli, sharename);
616 } else if (subfunct == LIST_SF) {
617 if(long_list_entries) {
618 d_printf(SHARE_ENUM_DISPLAY);
619 return cli_RNetShareEnum(cli, long_share_fn, NULL);
621 return cli_RNetShareEnum(cli, share_fn, NULL);
623 } else if (subfunct == ADD_SF) {
624 if (sharename == NULL) {
625 d_printf(ERRMSG_SHARENAME_MISSING);
628 RAP_SHARE_INFO_2 sinfo;
631 p = strchr(sharename, '=');
632 strncpy(sinfo.share_name, sharename, PTR_DIFF(p,sharename));
633 sinfo.reserved1 = '\0';
634 sinfo.share_type = 0;
635 sinfo.comment = comment;
637 sinfo.maximum_users = maxusers;
638 sinfo.active_users = 0;
640 memset(sinfo.password, '\0', sizeof(sinfo.password));
641 sinfo.reserved2 = '\0';
643 return cli_NetShareAdd(cli, &sinfo);
646 d_printf(ERRMSG_NOT_IMPLEMENTED);
651 void session_usage(void)
653 d_printf(NET_SESSION_USAGE); /* command syntax */
655 d_printf(TARGET_USAGE, LOCAL_HOST); /* Target options */
656 d_printf(SERVER_USAGE);
657 d_printf(IPADDRESS_USAGE);
659 d_printf(MISC_OPT_USAGE); /* Misc options */
660 d_printf(PORT_USAGE);
661 d_printf(MYWORKGROUP_USAGE);
662 d_printf(DEBUG_USAGE);
663 d_printf(MYNAME_USAGE);
664 d_printf(USER_USAGE);
665 d_printf(CONF_USAGE);
668 void list_sessions_func(char *wsname, char *username, uint16 conns,
669 uint16 opens, uint16 users, uint32 sess_time,
670 uint32 idle_time, uint32 user_flags, char *clitype)
672 int hrs = idle_time / 3600;
673 int min = (idle_time / 60) % 60;
674 int sec = idle_time % 60;
676 d_printf("\\\\%-18.18s %-20.20s %-18.18s %5d %2.2d:%2.2d:%2.2d\n",
677 wsname, username, clitype, opens, hrs, min, sec);
680 void display_session_func(const char *wsname, const char *username, uint16 conns,
681 uint16 opens, uint16 users, uint32 sess_time,
682 uint32 idle_time, uint32 user_flags, const char *clitype)
684 int ihrs = idle_time / 3600;
685 int imin = (idle_time / 60) % 60;
686 int isec = idle_time % 60;
687 int shrs = sess_time / 3600;
688 int smin = (sess_time / 60) % 60;
689 int ssec = sess_time % 60;
690 d_printf(SESSION_DISPLAY_ONE, username, wsname,
691 (user_flags&0x0)?YES_STRING:NO_STRING, clitype,
692 shrs, smin, ssec, ihrs, imin, isec);
695 void display_conns_func(uint16 conn_id, uint16 conn_type, uint16 opens, uint16 users, uint32 conn_time, const char *username, const char *netname)
697 d_printf("%-14.14s %-8.8s %5d\n", netname, share_type[conn_type], opens);
700 int net_session(int subfunct, const char * sessname)
702 struct in_addr target_ip;
705 if((have_ip == 0) && (host[0] == 0)) {
706 if (!resolve_name("localhost", &target_ip, 0x20)) {
707 DEBUG(1,("No remote server specified, unable to resolve connection to localhost via name lookup"));
716 strncpy(host, inet_ntoa(dest_ip),16);
717 cli = connect_to_ipc(host);
719 d_printf(ERRMSG_NOCONN_TARGET_SRVR);
725 res = cli_NetSessionGetInfo(cli, sessname, display_session_func);
727 d_printf(SESSION_DISPLAY_CONNS);
728 return cli_NetConnectionEnum(cli, sessname, display_conns_func);
732 d_printf(SESSION_ENUM_DISPLAY);
733 return cli_NetSessionEnum(cli, list_sessions_func);
736 return cli_NetSessionDel(cli, sessname);
738 d_printf(ERRMSG_NOT_IMPLEMENTED);
744 /****************************************************************************
746 ****************************************************************************/
747 static void display_server_func(const char *name, uint32 m, const char *comment, void * reserved)
749 d_printf("\t%-16.16s %s\n", name, comment);
753 void server_usage(void)
755 d_printf(NET_SERVER_USAGE); /* command syntax */
757 d_printf(TARGET_USAGE, DOMAIN_MASTER); /* Target options */
758 d_printf(SERVER_USAGE);
759 d_printf(IPADDRESS_USAGE);
760 d_printf(WORKGROUP_USAGE);
762 d_printf(MISC_OPT_USAGE); /* Misc options */
763 d_printf(PORT_USAGE);
764 d_printf(MYWORKGROUP_USAGE);
765 d_printf(DEBUG_USAGE);
766 d_printf(MYNAME_USAGE);
767 d_printf(USER_USAGE);
768 d_printf(CONF_USAGE);
771 int net_server(char * temp_workgroup, int subfunct)
773 /* try to find master browser for our domain - if we fail try to find pdc */
774 char our_workgroup[16];
775 struct in_addr brow_ips;
777 if((have_ip == 0) && (host[0] == 0)) {
778 /* find target server based on workgroup or domain */
779 if((temp_workgroup == 0) || (temp_workgroup[0] == 0))
780 temp_workgroup = lp_workgroup(); /* by default enum our local workgroup or domain */
782 safe_strcpy(our_workgroup, temp_workgroup,15);
784 if (!resolve_name(our_workgroup, &brow_ips, 0x1D)) {
785 /* go looking for workgroups */
786 DEBUG(1,("Unable to resolve master browser via name lookup\n"));
793 if(host[0] == 0) strncpy(host, inet_ntoa(dest_ip),16);
794 cli = connect_to_ipc(host);
796 d_printf(ERRMSG_NOCONN_BROWSE_MSTR);
799 d_printf(SERVER_ENUM_DISPLAY); /* header for list of servers */
800 return cli_NetServerEnum(cli, cli->server_domain, SV_TYPE_ALL, display_server_func,NULL);
802 /* BB add mechanism to find PDC for our domain and send enum to it in the error case */
805 void domain_usage(void)
807 d_printf(NET_DOMAIN_USAGE); /* command syntax */
809 d_printf(TARGET_USAGE, GLBL_LCL_MASTER); /* target options */
810 d_printf(SERVER_USAGE);
811 d_printf(IPADDRESS_USAGE);
813 d_printf(MISC_OPT_USAGE); /* misc options */
814 d_printf(PORT_USAGE);
815 d_printf(MYWORKGROUP_USAGE);
816 d_printf(DEBUG_USAGE);
817 d_printf(MYNAME_USAGE);
818 d_printf(USER_USAGE);
819 d_printf(CONF_USAGE);
826 struct in_addr msbrow_ip;
827 struct in_addr * ip_list = NULL;
831 our_workgroup = lp_workgroup();
832 if((have_ip == 0) && (host[0] == 0)) {
833 /* if (!resolve_name(MSBROWSE, &msbrow_ip, 1)) */
834 if (!get_dmb_list(&ip_list,&addr_count)){
835 DEBUG(1,("Unable to resolve global master browser via name lookup"));
836 if (!resolve_name(our_workgroup, &msbrow_ip, 0x1D)) {
837 DEBUG(1,("Unable to resolve domain browser via name lookup\n"));
849 strncpy(host, inet_ntoa(dest_ip),16);
850 cli = connect_to_ipc(host); /* BB fix two common failures i.e. to os2 due to *SMBSERVER and also due to access denied by picking wrong starting DMB */
852 d_printf(ERRMSG_NOCONN_BROWSE_MSTR);
855 d_printf(DOMAIN_ENUM_DISPLAY); /* header for list of domains */
856 return cli_NetServerEnum(cli, cli->server_domain, SV_TYPE_DOMAIN_ENUM, display_server_func,NULL);
860 void printq_usage(void)
862 d_printf(NET_PRINTQ_USAGE);
864 d_printf(TARGET_USAGE, LOCAL_HOST);
865 d_printf(SERVER_USAGE);
866 d_printf(IPADDRESS_USAGE);
868 d_printf(MISC_OPT_USAGE);
869 d_printf(PORT_USAGE);
870 d_printf(JOBID_USAGE);
871 d_printf(MYWORKGROUP_USAGE);
872 d_printf(DEBUG_USAGE);
873 d_printf(MYNAME_USAGE);
874 d_printf(USER_USAGE);
875 d_printf(CONF_USAGE);
878 void enum_queue(const char *queuename, uint16 pri, uint16 start, uint16 until, const char *sep, const char *pproc, const char *dest, const char *qparms, const char *qcomment, uint16 status, uint16 jobcount) {
882 pstrcpy(queuecol, queuename);
883 pstrcat(queuecol, PRINTQ_QUEUE_WORD);
887 pstrcpy(statcol, PRINTQ_PRINTER_ACTIVE);
890 pstrcpy(statcol, PRINTQ_PRINTER_PAUSED);
893 pstrcpy(statcol, PRINTQ_PRINTER_ERROR);
896 pstrcpy(statcol, PRINTQ_PRINTER_DELPEND);
899 pstrcpy(statcol, PRINTQ_PRINTER_STATUNK);
901 d_printf(PRINTQ_DISPLAY_ONE, queuecol, jobcount, statcol);
904 void enum_jobs(uint16 jobid, const char *ownername, const char *notifyname, const char *datatype, const char *jparms, uint16 pos, uint16 status, const char *jstatus, uint submitted, uint jobsize, const char *comment) {
909 pstrcpy(statcol, PRINTQ_JOB_QUEUED);
912 pstrcpy(statcol, PRINTQ_JOB_PAUSED);
915 pstrcpy(statcol, PRINTQ_JOB_SPOOLING);
918 pstrcpy(statcol, PRINTQ_JOB_PRINTING);
921 pstrcpy(statcol, PRINTQ_PRINTER_STATUNK);
923 d_printf(PRINTQ_DISPLAY_JOB, ownername, jobid, jobsize, statcol);
926 int net_printq(int subfunct, const char *printq, int jobid)
928 struct in_addr target_ip;
930 if((have_ip == 0) && (host[0] == 0)) {
931 if (!resolve_name("localhost", &target_ip, 0x20)) {
932 DEBUG(1,("No remote server specified, unable to resolve connection to localhost via name lookup"));
941 strncpy(host, inet_ntoa(dest_ip),16);
942 cli = connect_to_ipc(host);
944 d_printf(ERRMSG_NOCONN_TARGET_SRVR);
949 d_printf(PRINTQ_ENUM_DISPLAY, host);
951 return cli_NetPrintQGetInfo(cli, printq, enum_queue, enum_jobs);
953 return cli_NetPrintQEnum(cli, enum_queue, enum_jobs);
955 return cli_printjob_del(cli, jobid);
957 d_printf(ERRMSG_NOT_IMPLEMENTED);
964 void user_usage(void)
966 d_printf(NET_USER_USAGE); /* command syntax */
968 d_printf(TARGET_USAGE, LOCAL_HOST); /* target options */
969 d_printf(SERVER_USAGE);
970 d_printf(IPADDRESS_USAGE);
971 d_printf(WORKGROUP_USAGE);
973 d_printf(MISC_OPT_USAGE); /* misc options */
974 d_printf(PORT_USAGE);
975 d_printf(COMMENT_USAGE);
976 d_printf(MYWORKGROUP_USAGE);
977 d_printf(DEBUG_USAGE);
978 d_printf(MYNAME_USAGE);
979 d_printf(USER_USAGE);
980 d_printf(CONF_USAGE);
981 d_printf(LONG_USAGE);
984 void user_fn(const char *user_name, const char *comment, const char * home_dir, const char * logon_script, void *state)
986 d_printf("%-21.21s\n", user_name);
989 void long_user_fn(const char *user_name, const char *comment, const char * home_dir, const char * logon_script, void *state)
991 d_printf("%-21.21s %-47.47s %-35.35s %35.35s\n", user_name, comment, home_dir, logon_script);
994 void group_member_fn(const char *user_name, void *state)
996 d_printf("%-21.21s\n", user_name);
999 int net_user(int subfunct, const char * username, const char * comment, int flags)
1001 struct in_addr target_ip;
1003 if((have_ip == 0) && (host[0] == 0)) {
1004 if (!resolve_name("localhost", &target_ip, 0x20)) {
1005 DEBUG(1,("No remote server specified, unable to resolve connection to localhost via name lookup"));
1010 dest_ip = target_ip;
1014 strncpy(host, inet_ntoa(dest_ip),16);
1015 cli = connect_to_ipc(host);
1017 d_printf(ERRMSG_NOCONN_TARGET_SRVR);
1020 if (subfunct == DELETE_SF) {
1021 if (username == NULL) {
1022 d_printf(ERRMSG_USERNAME_MISSING);
1025 return cli_NetUserDelete(cli, username);
1026 } else if (subfunct == LIST_SF) {
1027 if(long_list_entries) {
1028 d_printf(USER_ENUM_DISPLAY);
1029 return cli_RNetUserEnum(cli, long_user_fn, NULL);
1032 return cli_RNetUserEnum(cli, user_fn, NULL);
1033 } else if (subfunct == ADD_SF) {
1034 if (username == NULL) {
1035 d_printf(ERRMSG_USERNAME_MISSING);
1038 RAP_USER_INFO_1 userinfo;
1040 safe_strcpy(userinfo.user_name, username, sizeof(userinfo.user_name));
1041 if(flags == -1) flags = 0x21;
1043 userinfo.userflags = flags;
1044 userinfo.reserved1 = '\0';
1045 userinfo.comment = comment;
1047 userinfo.home_dir = NULL;
1048 userinfo.logon_script = NULL;
1050 return cli_NetUserAdd(cli, &userinfo);
1052 } else if (subfunct == INFO_SF) {
1053 if (username == NULL) {
1054 d_printf(ERRMSG_USERNAME_MISSING);
1057 /* RAP_USER_INFO_1 userinfo;
1058 cli_NetUserInfo (cli, &userinfo); */ /* BB need to add call to get user info level 3 or 4 */
1059 return cli_NetUserGetGroups(cli, username, group_member_fn, NULL );
1063 d_printf(ERRMSG_NOT_IMPLEMENTED);
1069 void group_usage(void)
1071 d_printf(NET_GROUP_USAGE); /* command syntax */
1073 d_printf(TARGET_USAGE, LOCAL_HOST); /* target options */
1074 d_printf(SERVER_USAGE);
1075 d_printf(IPADDRESS_USAGE);
1077 d_printf(MISC_OPT_USAGE); /* misc options */
1078 d_printf(PORT_USAGE);
1079 d_printf(COMMENT_USAGE);
1080 d_printf(MYWORKGROUP_USAGE);
1081 d_printf(DEBUG_USAGE);
1082 d_printf(MYNAME_USAGE);
1083 d_printf(USER_USAGE);
1084 d_printf(WORKGROUP_USAGE);
1085 d_printf(CONF_USAGE);
1086 d_printf(LONG_USAGE);
1089 void long_group_fn(const char *group_name, const char *comment, void *state)
1091 d_printf("%-21.21s %-50.50s\n", group_name, comment);
1094 void group_fn(const char *group_name, const char *comment, void *state)
1096 d_printf("%-21.21s\n", group_name);
1099 int net_group(int subfunct, const char * groupname, const char * comment)
1101 struct in_addr target_ip;
1103 if((have_ip == 0) && (host[0] == 0)) {
1104 if (!resolve_name("localhost", &target_ip, 0x20)) {
1105 DEBUG(1,("No remote server specified, unable to resolve connection to localhost via name lookup"));
1110 dest_ip = target_ip;
1114 strncpy(host, inet_ntoa(dest_ip),16);
1115 cli = connect_to_ipc(host);
1117 d_printf(ERRMSG_NOCONN_TARGET_SRVR);
1120 if (subfunct == DELETE_SF) {
1121 if (groupname == NULL) {
1122 d_printf(ERRMSG_GROUPNAME_MISSING);
1125 return cli_NetGroupDelete(cli, groupname);
1126 } else if (subfunct == LIST_SF) {
1127 if(long_list_entries) {
1128 d_printf("%-21.21s %-50.50s\n", GROUP_STR, COMMENT_STR);
1129 d_printf("-----------------------------\n");
1130 return cli_RNetGroupEnum(cli, long_group_fn, NULL);
1133 return cli_RNetGroupEnum(cli, group_fn, NULL);
1134 } else if (subfunct == ADD_SF) {
1135 if (groupname == NULL) {
1136 d_printf(ERRMSG_GROUPNAME_MISSING);
1139 RAP_GROUP_INFO_1 grinfo;
1141 /* BB check for length 21 or smaller explicitly ? BB */
1142 safe_strcpy(grinfo.group_name, groupname, sizeof(grinfo.group_name));
1143 grinfo.reserved1 = '\0';
1144 grinfo.comment = comment;
1146 return cli_NetGroupAdd(cli, &grinfo);
1149 d_printf(ERRMSG_NOT_IMPLEMENTED);
1153 void groupmember_usage(void)
1155 d_printf(NET_GROUPMEMBER_USAGE); /* command syntax */
1157 d_printf(TARGET_USAGE, LOCAL_HOST); /* target options */
1158 d_printf(SERVER_USAGE);
1159 d_printf(IPADDRESS_USAGE);
1161 d_printf(MISC_OPT_USAGE); /* misc options */
1162 d_printf(PORT_USAGE);
1163 d_printf(MYWORKGROUP_USAGE);
1164 d_printf(DEBUG_USAGE);
1165 d_printf(MYNAME_USAGE);
1166 d_printf(USER_USAGE);
1167 d_printf(WORKGROUP_USAGE);
1168 d_printf(CONF_USAGE);
1172 int net_groupmember(int subfunct, const char * groupname, const char * username)
1174 struct in_addr target_ip;
1176 if((have_ip == 0) && (host[0] == 0)) {
1177 if (!resolve_name("localhost", &target_ip, 0x20)) {
1178 DEBUG(1,("No remote server specified, unable to resolve connection to localhost via name lookup"));
1182 dest_ip = target_ip;
1186 strncpy(host, inet_ntoa(dest_ip),16);
1187 cli = connect_to_ipc(host);
1189 d_printf(ERRMSG_NOCONN_TARGET_SRVR);
1192 if (groupname == NULL) {
1193 d_printf(ERRMSG_GROUPNAME_MISSING);
1197 if (subfunct == LIST_SF)
1198 return cli_NetGroupGetUsers(cli, groupname, group_member_fn, NULL );
1200 if (username == NULL) {
1201 d_printf(ERRMSG_USERNAME_MISSING);
1205 if (subfunct == DELETE_SF)
1206 return cli_NetGroupDelUser(cli, groupname, username);
1207 else if (subfunct == ADD_SF)
1208 return cli_NetGroupAddUser(cli, groupname, username);
1210 d_printf(ERRMSG_NOT_IMPLEMENTED);
1215 void validate_usage(void)
1217 d_printf(NET_VALIDATE_USAGE); /* command syntax */
1219 d_printf(TARGET_USAGE, GLBL_LCL_MASTER); /* target options */
1220 d_printf(SERVER_USAGE);
1221 d_printf(IPADDRESS_USAGE);
1222 d_printf(WORKGROUP_USAGE);
1224 d_printf(MISC_OPT_USAGE); /* misc options */
1225 d_printf(PORT_USAGE);
1226 d_printf(MYWORKGROUP_USAGE);
1227 d_printf(DEBUG_USAGE);
1228 d_printf(MYNAME_USAGE);
1229 d_printf(USER_USAGE);
1230 d_printf(CONF_USAGE);
1233 int net_validate(char * username)
1235 d_printf(ERRMSG_NOT_IMPLEMENTED);
1239 void service_usage(void)
1241 d_printf(NET_SERVICE_USAGE); /* command syntax */
1243 d_printf(TARGET_USAGE, GLBL_LCL_MASTER); /* target options */
1244 d_printf(SERVER_USAGE);
1245 d_printf(IPADDRESS_USAGE);
1247 d_printf(MISC_OPT_USAGE); /* misc options */
1248 d_printf(PORT_USAGE);
1249 d_printf(MYWORKGROUP_USAGE);
1250 d_printf(DEBUG_USAGE);
1251 d_printf(MYNAME_USAGE);
1252 d_printf(USER_USAGE);
1253 d_printf(CONF_USAGE);
1257 int net_service(int subfunct, const char * servicename, const char * srvc_args)
1259 struct in_addr target_ip;
1261 if((have_ip == 0) && (host[0] == 0)) {
1262 if (!resolve_name("localhost", &target_ip, 0x20)) {
1263 DEBUG(1,("No remote server specified, unable to resolve connection to localhost via name lookup"));
1267 dest_ip = target_ip;
1271 strncpy(host, inet_ntoa(dest_ip),16);
1272 cli = connect_to_ipc(host);
1274 d_printf(ERRMSG_NOCONN_TARGET_SRVR);
1278 if (subfunct == LIST_SF) {
1279 if(long_list_entries) {
1280 d_printf("%-15.15s %-50.50s\n", SERVICE_STR, COMMENT_STR);
1281 d_printf("-----------------------------\n");
1282 return cli_RNetServiceEnum(cli, long_group_fn, NULL);
1285 return cli_RNetServiceEnum(cli, group_fn, NULL);
1287 d_printf(ERRMSG_NOT_IMPLEMENTED);
1292 int net_password(const char * username, const char * old_password, const char * new_password)
1294 struct in_addr target_ip;
1296 if((have_ip == 0) && (host[0] == 0)) {
1297 if (!resolve_name("localhost", &target_ip, 0x20)) {
1298 DEBUG(1,("No remote server specified, unable to resolve connection to localhost via name lookup"));
1303 dest_ip = target_ip;
1307 strncpy(host, inet_ntoa(dest_ip),16);
1308 cli = connect_to_ipc(host);
1310 d_printf(ERRMSG_NOCONN_TARGET_SRVR);
1314 /* BB Add check for password lengths? */
1315 return cli_oem_change_password(cli, username, new_password, old_password);
1318 void password_usage(void)
1320 d_printf(NET_PASSWORD_USAGE); /* command syntax */
1322 d_printf(TARGET_USAGE, GLBL_LCL_MASTER); /* target options */
1323 d_printf(SERVER_USAGE);
1324 d_printf(IPADDRESS_USAGE);
1325 d_printf(WORKGROUP_USAGE);
1327 d_printf(MISC_OPT_USAGE); /* misc options */
1328 d_printf(PORT_USAGE);
1329 d_printf(MYWORKGROUP_USAGE);
1330 d_printf(DEBUG_USAGE);
1331 d_printf(MYNAME_USAGE);
1332 d_printf(USER_USAGE);
1333 d_printf(CONF_USAGE);
1337 void admin_usage(void)
1339 d_printf(NET_ADMIN_USAGE); /* command syntax */
1341 d_printf(TARGET_USAGE, GLBL_LCL_MASTER); /* target options */
1342 d_printf(SERVER_USAGE);
1343 d_printf(IPADDRESS_USAGE);
1344 d_printf(WORKGROUP_USAGE);
1346 d_printf(MISC_OPT_USAGE); /* misc options */
1347 d_printf(PORT_USAGE);
1348 d_printf(MYWORKGROUP_USAGE);
1349 d_printf(DEBUG_USAGE);
1350 d_printf(MYNAME_USAGE);
1351 d_printf(USER_USAGE);
1352 d_printf(CONF_USAGE);
1356 int net_admin(const char * command, const char * cmd_args, const char * environment)
1358 d_printf(ERRMSG_NOT_IMPLEMENTED);
1363 void join_usage(void)
1365 d_printf(ERRMSG_NOT_IMPLEMENTED);
1369 /****************************************************************************
1371 ****************************************************************************/
1372 int main(int argc,char *argv[])
1378 int subfunc = LIST_SF;
1380 const char ** argv_new;
1382 static char *servicesf = CONFIGFILE;
1383 static char *target_workgroup = NULL;
1384 static char *comment = "";
1385 static char *user_name = NULL;
1386 static char *my_workgroup = NULL;
1387 static char *requester_name = NULL;
1388 static char *dest_host = NULL;
1389 static int maxusers = -1;
1390 static int flagsarg = -1;
1391 static int jobid = 0;
1392 static int debuglevel;
1394 static struct poptOption long_options[] = {
1395 {"help", 'h', POPT_ARG_NONE, 0, 'h'},
1396 {"workgroup", 'w', POPT_ARG_STRING, &target_workgroup},
1397 {"myworkgroup", 'W', POPT_ARG_STRING, &my_workgroup},
1398 {"user", 'U', POPT_ARG_STRING, &user_name, 'U'},
1399 {"ipaddress", 'I', POPT_ARG_STRING, 0, 'I'},
1400 {"port", 'p', POPT_ARG_INT, &port},
1401 {"myname", 'n', POPT_ARG_STRING, &requester_name},
1402 {"conf", 's', POPT_ARG_STRING, &servicesf},
1403 {"debug", 'd', POPT_ARG_INT, &debuglevel, 'd'},
1404 {"debuglevel", 'd', POPT_ARG_INT, &debuglevel, 'd'},
1405 {"server", 'S', POPT_ARG_STRING, &dest_host},
1406 {"comment", 'C', POPT_ARG_STRING, &comment},
1407 {"maxusers", 'M', POPT_ARG_INT, &maxusers},
1408 {"flags", 'F', POPT_ARG_INT, &flagsarg},
1409 {"jobid", 'j', POPT_ARG_INT, &jobid},
1410 {"long", 'l', POPT_ARG_NONE, &long_list_entries},
1420 pc = poptGetContext(NULL, argc, (const char **) argv, long_options,
1421 POPT_CONTEXT_KEEP_FIRST);
1423 while((opt = poptGetNextOpt(pc)) != -1) {
1430 DEBUGLEVEL=debuglevel;
1433 dest_ip = *interpret_addr2(poptGetOptArg(pc));
1434 if(zero_ip(dest_ip))
1435 d_printf(ERRMSG_INVALID_IPADDRESS);
1440 p = strchr(user_name,'%');
1441 pstrcpy(global_user_name, user_name);
1444 pstrcpy(password,p+1);
1449 d_printf(ERRMSG_INVALID_OPTION, (char)opt, opt);
1454 lp_load(servicesf,True,False,False);
1456 argv_new = (const char **)poptGetArgs(pc);
1459 for (i=0; i<argc; i++) {
1460 if (argv_new[i] == NULL) {
1471 func = get_func(argv_new[1]);
1477 if (func == VALIDATEF) {
1481 if (func == HELPF) {
1487 if (func == HELPF) {
1488 switch(get_func(argv_new[2])) {
1523 groupmember_usage();
1535 d_printf(ERRMSG_INVALID_HELP_OPTION);
1542 /* parse next parm (argument 2) - i.e. sub function */
1543 subfunc = get_subfunc(argv_new[2]);
1545 if (func == 0) return -1;
1548 pstrcpy(global_requester_name, requester_name);
1550 get_myname(global_requester_name);
1553 pstrcpy(global_user_name, user_name);
1554 else if (getenv("LOGNAME"))
1555 pstrcpy(global_user_name,getenv("LOGNAME"));
1557 fstrcpy(global_workgroup, my_workgroup ? my_workgroup :lp_workgroup());
1560 pstrcpy(host, dest_host);
1562 if((have_ip) && (host[0]))
1563 d_printf(ERRMSG_BOTH_SERVER_IPADDRESS);
1565 while (!got_pass) { /* BB if nulluser operation. why bother to ask for pword BB */
1566 p = getpass(PASSWORD_PROMPT);
1568 pstrcpy(password, p);
1578 if (subfunc == OTHER_SF)
1579 rc = net_file(subfunc, argv_new[2]);
1581 rc = net_file(subfunc,NULL);
1583 rc = net_file(subfunc,argv_new[3]);
1587 rc = net_share(subfunc, NULL, NULL, 0);
1589 rc = net_share(subfunc,argv_new[3], comment, maxusers);
1593 rc = net_session(subfunc,NULL);
1595 rc = net_session(subfunc,argv_new[3]);
1598 rc = net_server(target_workgroup, subfunc);
1601 if(subfunc != LIST_SF)
1602 d_printf(ERRMSG_INVALID_DOMAIN_ACTION);
1607 rc = net_user(subfunc, NULL, NULL, -1);
1608 else if(argc_new == 3)
1609 rc = net_user(subfunc,NULL, NULL, -1);
1610 else if(argc_new > 3)
1611 rc = net_user(subfunc,argv_new[3], comment, flagsarg);
1615 rc = net_group(subfunc, NULL, NULL);
1616 else if(argc_new == 3)
1617 rc = net_group(subfunc,NULL, NULL);
1618 else if(argc_new > 3)
1619 rc = net_group(subfunc,argv_new[3], comment);
1623 rc = net_groupmember(subfunc, argv_new[3], NULL);
1624 else if (argc_new == 5)
1625 rc = net_groupmember(subfunc, argv_new[3], argv_new[4]);
1627 groupmember_usage();
1632 rc = net_validate(global_user_name);
1635 rc = net_service(subfunc, argv_new[3], argv_new[4]);
1643 else if (argc_new == 3) {
1644 rc = net_admin(argv_new[2], NULL, NULL);
1645 } else if (argc_new == 4) {
1646 rc = net_admin(argv_new[2], argv_new[3], NULL);
1648 rc = net_admin(argv_new[2], argv_new[3], argv_new[4]);
1657 rc = net_password(argv_new[2], argv_new[3], argv_new[4]);
1662 rc = net_printq(subfunc, NULL, jobid);
1664 rc = net_printq(subfunc, argv_new[3], jobid);
1667 break; */ /* not implemented yet */
1672 DEBUG(1,("return code = %d\n", rc));