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
69 const functable net_func
[] = {
72 { SESSIONF
, "SESSION"},
78 { VALIDATEF
, "VALIDATE"},
79 { GROUPMEMBERF
, "GROUPMEMBER"},
81 { SERVICEF
, "SERVICE"},
82 { PASSWORDF
, "PASSWORD"},
86 /* subfunctions available */
88 #define LIST_SF 1 /* enumerate */
89 #define ADD_SF 2 /* also used for create and start */
90 #define DELETE_SF 3 /* also used for close and stop */
91 #define INFO_SF 4 /* get information */
93 const functable net_subfunc
[] = {
95 { LIST_SF
, "ENUMERATE" },
98 { DELETE_SF
, "CLOSE" },
99 { DELETE_SF
, "DELETE" },
103 const char share_type
[][6] = {
110 #define PASSWORD_PROMPT "Password: "
111 #define YES_STRING "Yes"
112 #define NO_STRING "No"
116 " net domain \tto list domains \n"\
117 " net file \tto list open files on a server \n"\
118 " net group \tto list user groups \n"\
119 " net groupmember to list users in a group \n"\
120 " net password to change the password of a user\n"\
121 " net printq \tto list the print queues on a server\n"\
122 " net server \tto list servers in a domain\n"\
123 " net session \tto list clients with open sessions to a server\n"\
124 " net share \tto list shares exported by a server\n"\
125 " net user \tto list users\n"\
126 " net validate \tto check whether a user and the corresponding password are valid\n"\
128 "\nType \"net help <option>\" to get more information on that option\n"
130 #define NET_FILE_USAGE \
131 "\nnet file [misc. options] [targets]"\
132 "\n\tenumerates all open files on file server\n"\
133 "\nnet file <username> [misc. options] [targets]"\
134 "\n\tenumerates all files opened by username on file server\n"\
135 "\nnet file CLOSE <id> [misc. options] [targets]"\
136 "\n\tcloses specified file on target server\n"
138 #define FILE_INFO_DISPLAY \
144 #define FILE_ENUM_DISPLAY \
145 "\nEnumerating open files on remote server:\n\n"\
146 "\n\tFileId Opened by Perms Locks Path \n"\
147 "\t------ --------- ----- ----- ---- \n"
149 #define NET_SHARE_USAGE \
150 "\nnet share [misc. options] [targets] \n"\
151 "\tenumerates all exported resources (network shares) on target server\n"\
152 "\nnet share ADD <name=serverpath> [misc. options] [targets]"\
153 "\n\tAdd a share from a server (makes the export active)\n"\
154 "\nnet share DELETE <sharename> [misc. options] [targets]\n"\
156 "\nnet share CLOSE <sharename> [misc. options] [targets]"\
157 "\n\tDeletes a share from a server (makes the export inactive)\n"
159 #define SHARE_ENUM_DISPLAY \
160 "\nEnumerating shared resources (exports) on remote server:\n\n"\
161 "\nShare name Type Description\n"\
162 "---------- ---- -----------\n"
165 #define NET_SESSION_USAGE \
166 "\nnet session [misc. options] [targets]"\
167 "\n\tenumerates all active SMB/CIFS sessions on target server\n"\
168 "\nnet session DELETE <client_name> [misc. options] [targets] \n"\
170 "\nnet session CLOSE <client_name> [misc. options] [targets]"\
171 "\n\tDeletes (closes) a session from specified client to server\n"
173 #define SESSION_ENUM_DISPLAY \
174 "Computer User name Client Type Opens Idle time\n\n"\
175 "------------------------------------------------------------------------------\n"
178 #define SESSION_DISPLAY_ONE \
179 "User name %-20.20s\n"\
180 "Computer %-20.20s\n"\
181 "Guest logon %-20.20s\n"\
182 "Client Type %-40.40s\n"\
183 "Sess time %2.2d:%2.2d:%2.2d\n"\
184 "Idle time %2.2d:%2.2d:%2.2d\n"
186 #define SESSION_DISPLAY_CONNS \
187 "Share name Type # Opens\n"\
188 "------------------------------------------------------------------------------\n"
190 #define NET_SERVER_USAGE \
192 " net server [domain]\tlists the servers in the specified domain or workgroup.\n"\
193 " If domain is not specified, it uses the current domain or workgroup as\n"\
196 #define SERVER_ENUM_DISPLAY "\nEnumerating servers in this domain or workgroup: \n\n" \
197 "\n\tServer name Server description\n"\
198 "\t------------- ----------------------------\n"
201 #define NET_DOMAIN_USAGE \
203 " net domain [misc. options] [target]\n\tlists the domains "\
204 "or workgroups visible on the current network\n"
206 #define DOMAIN_ENUM_DISPLAY \
207 "\nEnumerating domains:\n\n"\
208 "\n\tDomain name Server name of Browse Master\n"\
209 "\t------------- ----------------------------\n"
211 #define NET_PRINTQ_USAGE \
213 " net printq [misc. options] [targets]\n"\
215 " net printq list [<queue_name>] [misc. options] [targets]\n"\
216 "\tlists the specified queue and jobs on the target server.\n"\
217 "\tIf the queue name is not specified, all queues are listed.\n\n"\
218 " net printq delete [<queue name>] [misc. options] [targets]\n"\
219 "\tdeletes the specified job number on the target server, or the\n"\
220 "\tprinter queue if no job number is specified\n"
221 #define PRINTQ_ENUM_DISPLAY \
222 "Print queues at \\\\%s\n\n"\
223 "Name Job # Size Status\n\n"\
224 "------------------------------------------------------------------"\
226 #define PRINTQ_DISPLAY_ONE "%-23.23s %5d jobs %-22.22s\n"
227 #define PRINTQ_PRINTER_ACTIVE "*Printer Active*"
228 #define PRINTQ_PRINTER_PAUSED "*Printer Paused*"
229 #define PRINTQ_PRINTER_ERROR "*Printer error*"
230 #define PRINTQ_PRINTER_DELPEND "*Delete Pending*"
231 #define PRINTQ_PRINTER_STATUNK "**UNKNOWN STATUS**"
232 #define PRINTQ_DISPLAY_JOB " %-23.23s %5d %9d %-22.22s\n"
233 #define PRINTQ_JOB_PRINTING "Printing"
234 #define PRINTQ_JOB_QUEUED "Waiting"
235 #define PRINTQ_JOB_PAUSED "Held in queue"
236 #define PRINTQ_JOB_SPOOLING "Spooling"
237 #define PRINTQ_QUEUE_WORD " Queue"
239 #define NET_USER_USAGE \
240 "\nnet user [misc. options] [targets]\n\tEnumerate users\n"\
241 "\nnet user DELETE <name> [misc. options] [targets]"\
242 "\n\tDelete specified user\n"\
243 "\nnet user INFO <name> [misc. options] [targets]"\
244 "\n\tList the domain groups of the specified user\n"\
245 "\nnet user ADD <name> [-F user flags] [misc. options] [targets]"\
246 "\n\tAdd specified user\n"
248 #define USER_ENUM_DISPLAY \
249 "\nEnumerating shared resources (exports) on remote server:\n\n"\
250 "\nUser name Description Home Directory Profile Directory\n"\
251 "--------- ----------- -------------- -----------------\n"
253 #define NET_GROUP_USAGE \
254 "\nnet group [misc. options] [targets]"\
255 "\n\tEnumerate user groups\n"\
256 "\nnet group DELETE <name> [misc. options] [targets]"\
257 "\n\tDelete specified group\n"\
258 "\nnet group ADD <name> [-C comment] [misc. options] [targets]"\
259 "\n\tCreate specified group\n"
261 #define NET_GROUPMEMBER_USAGE \
262 "\nnet groupmember LIST <group name> [misc. options] [targets]"\
263 "\n\t Enumerate users in a group\n"\
264 "\nnet groupmember DELETE <group name> <user name> [misc. options] "\
265 "[targets]\n\t Delete sepcified user from specified group\n"\
266 "\nnet groupmember ADD <group name> <user name> [misc. options] [targets]"\
267 "\n\t Add specified user to specified group\n"
270 #define NET_ADMIN_USAGE \
271 "\nnet admin <remote command to execute> [cmd arguments [environment]] [misc_options] [targets]\n"\
272 "\texecutes a remote command on an os/2 target server\n"
274 #define NET_PASSWORD_USAGE \
275 "\nnet password <user> <old password> <new password> [misc_options] [targets]\n"\
276 "\tchanges the password for the specified user on a remote server\n"
278 #define NET_SERVICE_USAGE \
279 "\nnet service [misc. options] [targets] \n"\
280 "\tenumerates all running service daemons on target server\n"\
281 "\nnet service ADD <name> [service startup arguments] [misc. options] [targets]"\
282 "\n\tStart named service on remote server\n"\
283 "\nnet service DELETE <name> [misc. options] [targets]\n"\
284 "\n\tStop named service on remote server\n"
287 #define NET_VALIDATE_USAGE \
288 "\nnet validate <username> [password]\n"\
289 "\tValidate user and password to check whether they can access target server or domain\n"
291 #define TARGET_USAGE "\nValid targets: choose one (none defaults to using the %s)\n"
292 #define GLBL_LCL_MASTER "global browsemaster or local browse master if that is not found"
293 #define DOMAIN_MASTER "local domain browse master"
294 #define LOCAL_HOST "localhost"
295 #define MISC_OPT_USAGE "\nValid miscellaneous options are:\n"
296 #define SERVER_USAGE "\t-S or --server=<server>\t\tserver name\n"
297 #define IPADDRESS_USAGE "\t-I or --ipaddress=<ipaddr>\tip address of target server\n"
298 #define PORT_USAGE "\t-p or --port=<port number>\tconnection port on target server\n"
299 #define WORKGROUP_USAGE "\t-w or --workgroup=<wg>\t\ttarget workgroup or domain name\n"
300 #define COMMENT_USAGE "\t-C or --comment=<comment>\tdescriptive comment (for add only)\n"
301 #define MYWORKGROUP_USAGE "\t-W or --myworkgroup=<wg>\tclient workgroup\n"
302 #define DEBUG_USAGE "\t-d or --debug=<level>\t\tdebug level (1-9)\n"
303 #define MYNAME_USAGE "\t-n or --myname=<name>\t\tclient name\n"
304 #define USER_USAGE "\t-U or --user=<name>\t\tuser name\n"
305 #define CONF_USAGE "\t-s or --conf=<path>\t\tpathname of smb.conf file\n"
306 #define JOBID_USAGE "\t-j or --jobid=<job id>\t\tjob id\n"
307 #define MAXUSERS_USAGE "\t-M or --maxusers=<num>\t\tmax users allowed for share\n"
308 #define LONG_USAGE "\t-l or --long\t\t\tDisplay full information\n"
310 #define ERRMSG_NOCONN_TARGET_SRVR "\nUnable to connect to target server\n"
311 #define ERRMSG_NOCONN_BROWSE_MSTR "\nUnable to connect to browse master\n"
312 #define ERRMSG_NOT_IMPLEMENTED "\nNot implemented\n"
313 #define ERRMSG_FILEID_MISSING "\nMissing fileid of file to close\n\n"
314 #define ERRMSG_GROUPNAME_MISSING "\n\nGroup name not specified\n"
315 #define ERRMSG_USERNAME_MISSING "\n\nUser name not specified\n"
316 #define ERRMSG_SHARENAME_MISSING "\n\nShare name not specified\n"
317 #define ERRMSG_TARGET_WG_NOT_VALID "\nTarget workgroup option not valid "\
318 "except on net server command, ignored"
319 #define ERRMSG_INVALID_HELP_OPTION "\nInvalid help option\n"
320 #define ERRMSG_INVALID_OPTION "\nInvalid option %c (%d)\n"
321 #define ERRMSG_INVALID_IPADDRESS "\nInvalid ip address specified\n"
322 #define ERRMSG_SPURIOUS_PARM "\nInvalid paramater ignored: %s\n"
323 #define ERRMSG_BOTH_SERVER_IPADDRESS "\nTarget server and IP address both "\
324 "specified. Do not set both at the same time. The target IP address was used\n"
325 #define ERRMSG_INVALID_DOMAIN_ACTION "\nInvalid action for NET DOMAIN command"\
326 " ignored. Only listing domains permitted.\n"
329 #define COMMENT_STR "Comment "
330 #define USER_STR "User name "
331 #define GROUP_STR "Group name "
332 #define SERVICE_STR "Service name"
333 #define HOMED_STR "Home directory "
334 #define LOGONS_STR "Logon script "
335 /************************************************************************************/
336 /* end of internationalization section */
337 /************************************************************************************/
339 extern int optind
, opterr
, optopt
;
340 extern struct in_addr ipzero
;
342 struct cli_state
*cli
;
343 static pstring global_requester_name
;
344 static pstring host
; /* target server */
345 static pstring password
;
346 static pstring global_user_name
;
347 static pstring global_workgroup
;
348 static int port
= SMB_PORT
;
349 static int long_list_entries
= 0;
350 static BOOL got_pass
= False
;
351 static BOOL have_ip
= False
;
352 struct in_addr dest_ip
;
354 int get_func(const char *parm
)
358 for (i
=0;i
<=sizeof(net_func
);i
++)
359 if (StrnCaseCmp(parm
, net_func
[i
].funcname
,10) == 0)
360 return net_func
[i
].func
;
364 int get_subfunc(const char *parm
)
368 for (i
=0;i
<=sizeof(net_subfunc
);i
++)
369 if (StrnCaseCmp(parm
, net_subfunc
[i
].funcname
,10) == 0)
370 return net_subfunc
[i
].func
;
374 /****************************************************************************
376 ****************************************************************************/
377 struct cli_state
*connect_to_ipc(char *server
)
380 struct nmb_name called
, calling
;
387 /* make a copy so we don't modify the global string 'service' */
388 safe_strcpy(servicename
, "IPC$", sizeof(servicename
)-1);
389 sharename
= servicename
;
390 if (*sharename
== '\\') {
391 server
= sharename
+2;
392 sharename
= strchr(server
,'\\');
393 if (!sharename
) return NULL
;
399 return NULL
; /* if ip addr specified, ascii version of ip address is used as host name */
404 make_nmb_name(&calling
, global_requester_name
, 0x0);
405 make_nmb_name(&called
, server
, 0x20);
412 DEBUG(3,("Connecting to host=%s\\share=%s\n\n",
415 /* have to open a new connection */
416 if (!(c
=cli_initialise(NULL
)) || (cli_set_port(c
, port
) == 0) ||
417 !cli_connect(c
, server_n
, &ip
)) {
418 DEBUG(1,("Connection to %s failed\n", server_n
));
422 c
->protocol
= PROTOCOL_NT1
;
424 if (!cli_session_request(c
, &calling
, &called
)) {
426 DEBUG(1,("session request to %s failed (%s)\n",
427 called
.name
, cli_errstr(c
)));
430 if ((p
=strchr(called
.name
, '.'))) {
434 if (strcmp(called
.name
, "*SMBSERVER")) {
435 make_nmb_name(&called
, "*SMBSERVER", 0x20);
441 DEBUG(4,(" session request ok\n"));
443 if (!cli_negprot(c
)) {
444 DEBUG(1,("protocol negotiation failed\n"));
451 char *pass
= getpass(PASSWORD_PROMPT
);
453 pstrcpy(password
, pass
);
457 if (!cli_session_setup(c
, global_user_name
,
458 password
, strlen(password
),
459 password
, strlen(password
),
461 /* try again with a null username */
462 if (!cli_session_setup(c
, "", "", 0, "", 0, global_workgroup
)) {
463 DEBUG(1,("session setup failed: %s\n", cli_errstr(c
)));
468 DEBUG(3,("Anonymous login successful\n"));
471 DEBUG(4,(" session setup ok\n"));
472 if (!cli_send_tconX(c
, sharename
, "?????",
473 password
, strlen(password
)+1)) {
474 DEBUG(1,("tree connect failed: %s\n", cli_errstr(c
)));
480 DEBUG(4,(" tconx ok\n"));
491 void file_usage(void)
493 printf(NET_FILE_USAGE
); /* command syntax */
495 printf(TARGET_USAGE
, LOCAL_HOST
); /* target options */
496 printf(SERVER_USAGE
);
497 printf(IPADDRESS_USAGE
);
499 printf(MISC_OPT_USAGE
); /* misc options */
501 printf(MYWORKGROUP_USAGE
);
503 printf(MYNAME_USAGE
);
508 /***************************************************************************
509 list info on an open file
510 ***************************************************************************/
511 static void file_fn(const char * pPath
, const char * pUser
, uint16 perms
, uint16 locks
, uint32 id
)
513 printf("\t%-7.1d %-20.20s 0x%-4.2x %-6.1d %s\n",
514 id
, pUser
, perms
, locks
, pPath
);
517 static void one_file_fn(const char *pPath
, const char *pUser
, uint16 perms
, uint16 locks
, uint32 id
)
519 printf(FILE_INFO_DISPLAY
, id
, pUser
, locks
, pPath
, perms
);
522 int net_file(int subfunct
, char * id
)
524 struct in_addr target_ip
;
526 if((have_ip
== 0) && (host
[0] == 0)) {
527 if (!resolve_name("localhost", &target_ip
, 0x20)) {
528 DEBUG(1,("No remote server specified, unable to resolve connection to localhost via name lookup"));
535 if(host
[0] == 0) strncpy(host
, inet_ntoa(dest_ip
),16);
536 cli
= connect_to_ipc(host
);
538 printf(ERRMSG_NOCONN_TARGET_SRVR
);
542 if(subfunct
== DELETE_SF
) { /* close open file on remote server */
544 printf(ERRMSG_FILEID_MISSING
);
547 return cli_NetFileClose(cli
, atoi(id
));
548 } else if(subfunct
== LIST_SF
) {
549 printf(FILE_ENUM_DISPLAY
); /* file list header */
550 return cli_NetFileEnum(cli
, NULL
, NULL
, file_fn
);
551 } else if ((subfunct
== OTHER_SF
) && id
) {
552 return cli_NetFileGetInfo(cli
, atoi(id
), one_file_fn
);
557 void share_usage(void)
559 printf(NET_SHARE_USAGE
); /* command syntax */
561 printf(TARGET_USAGE
, LOCAL_HOST
); /* target options */
562 printf(SERVER_USAGE
);
563 printf(IPADDRESS_USAGE
);
565 printf(MISC_OPT_USAGE
); /* misc options */
567 printf(COMMENT_USAGE
);
568 printf(MAXUSERS_USAGE
);
569 printf(MYWORKGROUP_USAGE
);
571 printf(MYNAME_USAGE
);
576 void long_share_fn(const char *share_name
, uint32 type
, const char *comment
, void *state
)
578 printf("%-12.12s %-8.8s %-50.50s\n", share_name
, share_type
[type
], comment
);
581 void share_fn(const char *share_name
, uint32 type
, const char *comment
, void *state
)
583 printf("%-12.12s\n", share_name
);
586 int net_share(int subfunct
, char * sharename
, char * comment
, int maxusers
)
588 struct in_addr target_ip
;
590 if((have_ip
== 0) && (host
[0] == 0)) {
591 if (!resolve_name("localhost", &target_ip
, 0x20)) {
592 DEBUG(1,("No remote server specified, unable to resolve connection to localhost via name lookup"));
601 strncpy(host
, inet_ntoa(dest_ip
),16);
602 cli
= connect_to_ipc(host
);
604 printf(ERRMSG_NOCONN_TARGET_SRVR
);
607 if (subfunct
== DELETE_SF
) {
608 if (sharename
== NULL
) {
609 printf(ERRMSG_SHARENAME_MISSING
);
612 return cli_NetShareDelete(cli
, sharename
);
613 } else if (subfunct
== LIST_SF
) {
614 if(long_list_entries
) {
615 printf(SHARE_ENUM_DISPLAY
);
616 return cli_RNetShareEnum(cli
, long_share_fn
, NULL
);
618 return cli_RNetShareEnum(cli
, share_fn
, NULL
);
620 } else if (subfunct
== ADD_SF
) {
621 if (sharename
== NULL
) {
622 printf(ERRMSG_SHARENAME_MISSING
);
625 RAP_SHARE_INFO_2 sinfo
;
628 p
= strchr(sharename
, '=');
629 strncpy(sinfo
.share_name
, sharename
, PTR_DIFF(p
,sharename
));
630 sinfo
.reserved1
= '\0';
631 sinfo
.share_type
= 0;
632 sinfo
.comment
= comment
;
634 sinfo
.maximum_users
= maxusers
;
635 sinfo
.active_users
= 0;
637 bzero(sinfo
.password
, sizeof(sinfo
.password
));
638 sinfo
.reserved2
= '\0';
640 return cli_NetShareAdd(cli
, &sinfo
);
643 printf(ERRMSG_NOT_IMPLEMENTED
);
648 void session_usage(void)
650 printf(NET_SESSION_USAGE
); /* command syntax */
652 printf(TARGET_USAGE
, LOCAL_HOST
); /* Target options */
653 printf(SERVER_USAGE
);
654 printf(IPADDRESS_USAGE
);
656 printf(MISC_OPT_USAGE
); /* Misc options */
658 printf(MYWORKGROUP_USAGE
);
660 printf(MYNAME_USAGE
);
665 void list_sessions_func(char *wsname
, char *username
, uint16 conns
,
666 uint16 opens
, uint16 users
, uint32 sess_time
,
667 uint32 idle_time
, uint32 user_flags
, char *clitype
)
669 int hrs
= idle_time
/ 3600;
670 int min
= (idle_time
/ 60) % 60;
671 int sec
= idle_time
% 60;
673 printf("\\\\%-18.18s %-20.20s %-18.18s %5d %2.2d:%2.2d:%2.2d\n",
674 wsname
, username
, clitype
, opens
, hrs
, min
, sec
);
677 void display_session_func(char *wsname
, char *username
, uint16 conns
,
678 uint16 opens
, uint16 users
, uint32 sess_time
,
679 uint32 idle_time
, uint32 user_flags
, char *clitype
)
681 int ihrs
= idle_time
/ 3600;
682 int imin
= (idle_time
/ 60) % 60;
683 int isec
= idle_time
% 60;
684 int shrs
= sess_time
/ 3600;
685 int smin
= (sess_time
/ 60) % 60;
686 int ssec
= sess_time
% 60;
687 printf(SESSION_DISPLAY_ONE
, username
, wsname
,
688 (user_flags
&0x0)?YES_STRING
:NO_STRING
, clitype
,
689 shrs
, smin
, ssec
, ihrs
, imin
, isec
);
692 void display_conns_func(uint16 conn_id
, uint16 conn_type
, uint16 opens
, uint16 users
, uint32 conn_time
, char *username
, char *netname
)
694 printf("%-14.14s %-8.8s %5d\n", netname
, share_type
[conn_type
], opens
);
697 int net_session(int subfunct
, char * sessname
)
699 struct in_addr target_ip
;
702 if((have_ip
== 0) && (host
[0] == 0)) {
703 if (!resolve_name("localhost", &target_ip
, 0x20)) {
704 DEBUG(1,("No remote server specified, unable to resolve connection to localhost via name lookup"));
713 strncpy(host
, inet_ntoa(dest_ip
),16);
714 cli
= connect_to_ipc(host
);
716 printf(ERRMSG_NOCONN_TARGET_SRVR
);
722 res
= cli_NetSessionGetInfo(cli
, sessname
, display_session_func
);
724 printf(SESSION_DISPLAY_CONNS
);
725 return cli_NetConnectionEnum(cli
, sessname
, display_conns_func
);
729 printf(SESSION_ENUM_DISPLAY
);
730 return cli_NetSessionEnum(cli
, list_sessions_func
);
733 return cli_NetSessionDel(cli
, sessname
);
735 printf(ERRMSG_NOT_IMPLEMENTED
);
741 /****************************************************************************
743 ****************************************************************************/
744 static void display_server_func(const char *name
, uint32 m
, const char *comment
, void * reserved
)
746 printf("\t%-16.16s %s\n", name
, comment
);
750 void server_usage(void)
752 printf(NET_SERVER_USAGE
); /* command syntax */
754 printf(TARGET_USAGE
, DOMAIN_MASTER
); /* Target options */
755 printf(SERVER_USAGE
);
756 printf(IPADDRESS_USAGE
);
757 printf(WORKGROUP_USAGE
);
759 printf(MISC_OPT_USAGE
); /* Misc options */
761 printf(MYWORKGROUP_USAGE
);
763 printf(MYNAME_USAGE
);
768 int net_server(char * temp_workgroup
, int subfunct
)
770 /* try to find master browser for our domain - if we fail try to find pdc */
771 char our_workgroup
[16];
772 struct in_addr brow_ips
;
774 if((have_ip
== 0) && (host
[0] == 0)) {
775 /* find target server based on workgroup or domain */
776 if((temp_workgroup
== 0) || (temp_workgroup
[0] == 0))
777 temp_workgroup
= lp_workgroup(); /* by default enum our local workgroup or domain */
779 safe_strcpy(our_workgroup
, temp_workgroup
,15);
781 if (!resolve_name(our_workgroup
, &brow_ips
, 0x1D)) {
782 /* go looking for workgroups */
783 DEBUG(1,("Unable to resolve master browser via name lookup\n"));
790 if(host
[0] == 0) strncpy(host
, inet_ntoa(dest_ip
),16);
791 cli
= connect_to_ipc(host
);
793 printf(ERRMSG_NOCONN_BROWSE_MSTR
);
796 printf(SERVER_ENUM_DISPLAY
); /* header for list of servers */
797 return cli_NetServerEnum(cli
, cli
->server_domain
, SV_TYPE_ALL
, display_server_func
,NULL
);
799 /* BB add mechanism to find PDC for our domain and send enum to it in this error case */
801 /* BB add server service (smb server daemon) start and stop */
804 void domain_usage(void)
806 printf(NET_DOMAIN_USAGE
); /* command syntax */
808 printf(TARGET_USAGE
, GLBL_LCL_MASTER
); /* target options */
809 printf(SERVER_USAGE
);
810 printf(IPADDRESS_USAGE
);
812 printf(MISC_OPT_USAGE
); /* misc options */
814 printf(MYWORKGROUP_USAGE
);
816 printf(MYNAME_USAGE
);
825 struct in_addr msbrow_ip
;
828 our_workgroup
= lp_workgroup();
829 if((have_ip
== 0) && (host
[0] == 0)) {
830 if (!resolve_name(MSBROWSE
, &msbrow_ip
, 1)) {
831 DEBUG(1,("Unable to resolve global master browser via name lookup"));
832 if (!resolve_name(our_workgroup
, &msbrow_ip
, 0x1D)) {
833 DEBUG(1,("Unable to resolve domain browser via name lookup\n"));
845 strncpy(host
, inet_ntoa(dest_ip
),16);
846 cli
= connect_to_ipc(host
);
848 printf(ERRMSG_NOCONN_BROWSE_MSTR
);
851 printf(DOMAIN_ENUM_DISPLAY
); /* header for list of domains */
852 return cli_NetServerEnum(cli
, cli
->server_domain
, SV_TYPE_DOMAIN_ENUM
, display_server_func
,NULL
);
856 void printq_usage(void)
858 printf(NET_PRINTQ_USAGE
);
860 printf(TARGET_USAGE
, LOCAL_HOST
);
861 printf(SERVER_USAGE
);
862 printf(IPADDRESS_USAGE
);
864 printf(MISC_OPT_USAGE
);
867 printf(MYWORKGROUP_USAGE
);
869 printf(MYNAME_USAGE
);
874 void enum_queue(char *queuename
, uint16 pri
, uint16 start
, uint16 until
, char *sep
, char *pproc
, char *dest
, char *qparms
, char *qcomment
, uint16 status
, uint16 jobcount
) {
878 pstrcpy(queuecol
, queuename
);
879 pstrcat(queuecol
, PRINTQ_QUEUE_WORD
);
883 pstrcpy(statcol
, PRINTQ_PRINTER_ACTIVE
);
886 pstrcpy(statcol
, PRINTQ_PRINTER_PAUSED
);
889 pstrcpy(statcol
, PRINTQ_PRINTER_ERROR
);
892 pstrcpy(statcol
, PRINTQ_PRINTER_DELPEND
);
895 pstrcpy(statcol
, PRINTQ_PRINTER_STATUNK
);
897 printf(PRINTQ_DISPLAY_ONE
, queuecol
, jobcount
, statcol
);
900 void enum_jobs(uint16 jobid
, char *ownername
, char *notifyname
, char *datatype
, char *jparms
, uint16 pos
, uint16 status
, char *jstatus
, uint submitted
, uint jobsize
, char *comment
) {
905 pstrcpy(statcol
, PRINTQ_JOB_QUEUED
);
908 pstrcpy(statcol
, PRINTQ_JOB_PAUSED
);
911 pstrcpy(statcol
, PRINTQ_JOB_SPOOLING
);
914 pstrcpy(statcol
, PRINTQ_JOB_PRINTING
);
917 pstrcpy(statcol
, PRINTQ_PRINTER_STATUNK
);
919 printf(PRINTQ_DISPLAY_JOB
, ownername
, jobid
, jobsize
, statcol
);
922 int net_printq(int subfunct
, char * printq
, int jobid
)
924 struct in_addr target_ip
;
926 if((have_ip
== 0) && (host
[0] == 0)) {
927 if (!resolve_name("localhost", &target_ip
, 0x20)) {
928 DEBUG(1,("No remote server specified, unable to resolve connection to localhost via name lookup"));
937 strncpy(host
, inet_ntoa(dest_ip
),16);
938 cli
= connect_to_ipc(host
);
940 printf(ERRMSG_NOCONN_TARGET_SRVR
);
945 printf(PRINTQ_ENUM_DISPLAY
, host
);
947 return cli_NetPrintQGetInfo(cli
, printq
, enum_queue
, enum_jobs
);
949 return cli_NetPrintQEnum(cli
, enum_queue
, enum_jobs
);
951 return cli_printjob_del(cli
, jobid
);
953 printf(ERRMSG_NOT_IMPLEMENTED
);
960 void user_usage(void)
962 printf(NET_USER_USAGE
); /* command syntax */
964 printf(TARGET_USAGE
, LOCAL_HOST
); /* target options */
965 printf(SERVER_USAGE
);
966 printf(IPADDRESS_USAGE
);
967 printf(WORKGROUP_USAGE
);
969 printf(MISC_OPT_USAGE
); /* misc options */
971 printf(COMMENT_USAGE
);
972 printf(MYWORKGROUP_USAGE
);
974 printf(MYNAME_USAGE
);
980 void user_fn(const char *user_name
, const char *comment
, const char * home_dir
, const char * logon_script
, void *state
)
982 printf("%-21.21s\n", user_name
);
985 void long_user_fn(const char *user_name
, const char *comment
, const char * home_dir
, const char * logon_script
, void *state
)
987 printf("%-21.21s %-47.47s %-35.35s %35.35s\n", user_name
, comment
, home_dir
, logon_script
);
990 void group_member_fn(const char *user_name
, void *state
)
992 printf("%-21.21s\n", user_name
);
995 int net_user(int subfunct
, char * username
, char * comment
, int flags
)
997 struct in_addr target_ip
;
999 if((have_ip
== 0) && (host
[0] == 0)) {
1000 if (!resolve_name("localhost", &target_ip
, 0x20)) {
1001 DEBUG(1,("No remote server specified, unable to resolve connection to localhost via name lookup"));
1006 dest_ip
= target_ip
;
1010 strncpy(host
, inet_ntoa(dest_ip
),16);
1011 cli
= connect_to_ipc(host
);
1013 printf(ERRMSG_NOCONN_TARGET_SRVR
);
1016 if (subfunct
== DELETE_SF
) {
1017 if (username
== NULL
) {
1018 printf(ERRMSG_USERNAME_MISSING
);
1021 return cli_NetUserDelete(cli
, username
);
1022 } else if (subfunct
== LIST_SF
) {
1023 if(long_list_entries
) {
1024 printf(USER_ENUM_DISPLAY
);
1025 return cli_RNetUserEnum(cli
, long_user_fn
, NULL
);
1028 return cli_RNetUserEnum(cli
, user_fn
, NULL
);
1029 } else if (subfunct
== ADD_SF
) {
1030 if (username
== NULL
) {
1031 printf(ERRMSG_USERNAME_MISSING
);
1034 RAP_USER_INFO_1 userinfo
;
1036 safe_strcpy(userinfo
.user_name
, username
, sizeof(userinfo
.user_name
));
1037 if(flags
== -1) flags
= 0x21;
1039 userinfo
.userflags
= flags
;
1040 userinfo
.reserved1
= '\0';
1041 userinfo
.comment
= comment
;
1043 userinfo
.home_dir
= NULL
;
1044 userinfo
.logon_script
= NULL
;
1046 return cli_NetUserAdd(cli
, &userinfo
);
1048 } else if (subfunct
== INFO_SF
) {
1049 if (username
== NULL
) {
1050 printf(ERRMSG_USERNAME_MISSING
);
1053 /* RAP_USER_INFO_1 userinfo;
1054 cli_NetUserInfo (cli, &userinfo); */ /* BB need to add call to get user info level 3 or 4 */
1055 return cli_NetUserGetGroups(cli
, username
, group_member_fn
, NULL
);
1059 printf(ERRMSG_NOT_IMPLEMENTED
);
1065 void group_usage(void)
1067 printf(NET_GROUP_USAGE
); /* command syntax */
1069 printf(TARGET_USAGE
, LOCAL_HOST
); /* target options */
1070 printf(SERVER_USAGE
);
1071 printf(IPADDRESS_USAGE
);
1073 printf(MISC_OPT_USAGE
); /* misc options */
1075 printf(COMMENT_USAGE
);
1076 printf(MYWORKGROUP_USAGE
);
1077 printf(DEBUG_USAGE
);
1078 printf(MYNAME_USAGE
);
1080 printf(WORKGROUP_USAGE
);
1085 void long_group_fn(const char *group_name
, const char *comment
, void *state
)
1087 printf("%-21.21s %-50.50s\n", group_name
, comment
);
1090 void group_fn(const char *group_name
, const char *comment
, void *state
)
1092 printf("%-21.21s\n", group_name
);
1095 int net_group(int subfunct
, char * groupname
, char * comment
)
1097 struct in_addr target_ip
;
1099 if((have_ip
== 0) && (host
[0] == 0)) {
1100 if (!resolve_name("localhost", &target_ip
, 0x20)) {
1101 DEBUG(1,("No remote server specified, unable to resolve connection to localhost via name lookup"));
1106 dest_ip
= target_ip
;
1110 strncpy(host
, inet_ntoa(dest_ip
),16);
1111 cli
= connect_to_ipc(host
);
1113 printf(ERRMSG_NOCONN_TARGET_SRVR
);
1116 if (subfunct
== DELETE_SF
) {
1117 if (groupname
== NULL
) {
1118 printf(ERRMSG_GROUPNAME_MISSING
);
1121 return cli_NetGroupDelete(cli
, groupname
);
1122 } else if (subfunct
== LIST_SF
) {
1123 if(long_list_entries
) {
1124 printf("%-21.21s %-50.50s\n", GROUP_STR
, COMMENT_STR
);
1125 printf("-----------------------------\n");
1126 return cli_RNetGroupEnum(cli
, long_group_fn
, NULL
);
1129 return cli_RNetGroupEnum(cli
, group_fn
, NULL
);
1130 } else if (subfunct
== ADD_SF
) {
1131 if (groupname
== NULL
) {
1132 printf(ERRMSG_GROUPNAME_MISSING
);
1135 RAP_GROUP_INFO_1 grinfo
;
1137 /* BB check for length 21 or smaller explicitly ? BB */
1138 safe_strcpy(grinfo
.group_name
, groupname
, sizeof(grinfo
.group_name
));
1139 grinfo
.reserved1
= '\0';
1140 grinfo
.comment
= comment
;
1142 return cli_NetGroupAdd(cli
, &grinfo
);
1145 printf(ERRMSG_NOT_IMPLEMENTED
);
1149 void groupmember_usage(void)
1151 printf(NET_GROUPMEMBER_USAGE
); /* command syntax */
1153 printf(TARGET_USAGE
, LOCAL_HOST
); /* target options */
1154 printf(SERVER_USAGE
);
1155 printf(IPADDRESS_USAGE
);
1157 printf(MISC_OPT_USAGE
); /* misc options */
1159 printf(MYWORKGROUP_USAGE
);
1160 printf(DEBUG_USAGE
);
1161 printf(MYNAME_USAGE
);
1163 printf(WORKGROUP_USAGE
);
1168 int net_groupmember(int subfunct
, char * groupname
, char * username
)
1170 struct in_addr target_ip
;
1172 if((have_ip
== 0) && (host
[0] == 0)) {
1173 if (!resolve_name("localhost", &target_ip
, 0x20)) {
1174 DEBUG(1,("No remote server specified, unable to resolve connection to localhost via name lookup"));
1178 dest_ip
= target_ip
;
1182 strncpy(host
, inet_ntoa(dest_ip
),16);
1183 cli
= connect_to_ipc(host
);
1185 printf(ERRMSG_NOCONN_TARGET_SRVR
);
1188 if (groupname
== NULL
) {
1189 printf(ERRMSG_GROUPNAME_MISSING
);
1193 if (subfunct
== LIST_SF
)
1194 return cli_NetGroupGetUsers(cli
, groupname
, group_member_fn
, NULL
);
1196 if (username
== NULL
) {
1197 printf(ERRMSG_USERNAME_MISSING
);
1201 if (subfunct
== DELETE_SF
)
1202 return cli_NetGroupDelUser(cli
, groupname
, username
);
1203 else if (subfunct
== ADD_SF
)
1204 return cli_NetGroupAddUser(cli
, groupname
, username
);
1206 printf(ERRMSG_NOT_IMPLEMENTED
);
1211 void validate_usage(void)
1213 printf(NET_VALIDATE_USAGE
); /* command syntax */
1215 printf(TARGET_USAGE
, GLBL_LCL_MASTER
); /* target options */
1216 printf(SERVER_USAGE
);
1217 printf(IPADDRESS_USAGE
);
1218 printf(WORKGROUP_USAGE
);
1220 printf(MISC_OPT_USAGE
); /* misc options */
1222 printf(MYWORKGROUP_USAGE
);
1223 printf(DEBUG_USAGE
);
1224 printf(MYNAME_USAGE
);
1229 int net_validate(char * username
)
1231 printf(ERRMSG_NOT_IMPLEMENTED
);
1235 void service_usage(void)
1237 printf(NET_SERVICE_USAGE
); /* command syntax */
1239 printf(TARGET_USAGE
, GLBL_LCL_MASTER
); /* target options */
1240 printf(SERVER_USAGE
);
1241 printf(IPADDRESS_USAGE
);
1243 printf(MISC_OPT_USAGE
); /* misc options */
1245 printf(MYWORKGROUP_USAGE
);
1246 printf(DEBUG_USAGE
);
1247 printf(MYNAME_USAGE
);
1253 int net_service(int subfunct
, char * servicename
, char * srvc_args
)
1255 struct in_addr target_ip
;
1257 if((have_ip
== 0) && (host
[0] == 0)) {
1258 if (!resolve_name("localhost", &target_ip
, 0x20)) {
1259 DEBUG(1,("No remote server specified, unable to resolve connection to localhost via name lookup"));
1263 dest_ip
= target_ip
;
1267 strncpy(host
, inet_ntoa(dest_ip
),16);
1268 cli
= connect_to_ipc(host
);
1270 printf(ERRMSG_NOCONN_TARGET_SRVR
);
1274 if (subfunct
== LIST_SF
) {
1275 if(long_list_entries
) {
1276 printf("%-15.15s %-50.50s\n", SERVICE_STR
, COMMENT_STR
);
1277 printf("-----------------------------\n");
1278 return cli_RNetServiceEnum(cli
, long_group_fn
, NULL
);
1281 return cli_RNetServiceEnum(cli
, group_fn
, NULL
);
1283 printf(ERRMSG_NOT_IMPLEMENTED
);
1288 int net_password(char * username
, char * old_password
, char * new_password
)
1290 struct in_addr target_ip
;
1292 if((have_ip
== 0) && (host
[0] == 0)) {
1293 if (!resolve_name("localhost", &target_ip
, 0x20)) {
1294 DEBUG(1,("No remote server specified, unable to resolve connection to localhost via name lookup"));
1299 dest_ip
= target_ip
;
1303 strncpy(host
, inet_ntoa(dest_ip
),16);
1304 cli
= connect_to_ipc(host
);
1306 printf(ERRMSG_NOCONN_TARGET_SRVR
);
1310 /* BB Add check for password lengths? */
1311 return cli_oem_change_password(cli
, username
, new_password
, old_password
);
1314 void password_usage(void)
1316 printf(NET_PASSWORD_USAGE
); /* command syntax */
1318 printf(TARGET_USAGE
, GLBL_LCL_MASTER
); /* target options */
1319 printf(SERVER_USAGE
);
1320 printf(IPADDRESS_USAGE
);
1321 printf(WORKGROUP_USAGE
);
1323 printf(MISC_OPT_USAGE
); /* misc options */
1325 printf(MYWORKGROUP_USAGE
);
1326 printf(DEBUG_USAGE
);
1327 printf(MYNAME_USAGE
);
1333 void admin_usage(void)
1335 printf(NET_ADMIN_USAGE
); /* command syntax */
1337 printf(TARGET_USAGE
, GLBL_LCL_MASTER
); /* target options */
1338 printf(SERVER_USAGE
);
1339 printf(IPADDRESS_USAGE
);
1340 printf(WORKGROUP_USAGE
);
1342 printf(MISC_OPT_USAGE
); /* misc options */
1344 printf(MYWORKGROUP_USAGE
);
1345 printf(DEBUG_USAGE
);
1346 printf(MYNAME_USAGE
);
1352 int net_admin(char * command
, char * cmd_args
, char * environment
)
1354 printf(ERRMSG_NOT_IMPLEMENTED
);
1359 /****************************************************************************
1361 ****************************************************************************/
1362 int main(int argc
,char *argv
[])
1368 int subfunc
= LIST_SF
;
1372 static char *servicesf
= CONFIGFILE
;
1373 static char *target_workgroup
= NULL
;
1374 static char *comment
= "";
1375 static char *user_name
= NULL
;
1376 static char *my_workgroup
= NULL
;
1377 static char *requester_name
= NULL
;
1378 static char *dest_host
= NULL
;
1379 static int maxusers
= -1;
1380 static int flagsarg
= -1;
1381 static int jobid
= 0;
1382 static int debuglevel
;
1384 static struct poptOption long_options
[] = {
1385 {"help", 'h', POPT_ARG_NONE
, 0, 'h'},
1386 {"workgroup", 'w', POPT_ARG_STRING
, &target_workgroup
},
1387 {"myworkgroup", 'W', POPT_ARG_STRING
, &my_workgroup
},
1388 {"user", 'U', POPT_ARG_STRING
, &user_name
, 'U'},
1389 {"ipaddress", 'I', POPT_ARG_STRING
, 0, 'I'},
1390 {"port", 'p', POPT_ARG_INT
, &port
},
1391 {"myname", 'n', POPT_ARG_STRING
, &requester_name
},
1392 {"conf", 's', POPT_ARG_STRING
, &servicesf
},
1393 {"debug", 'd', POPT_ARG_INT
, &debuglevel
, 'd'},
1394 {"server", 'S', POPT_ARG_STRING
, &dest_host
},
1395 {"comment", 'C', POPT_ARG_STRING
, &comment
},
1396 {"maxusers", 'M', POPT_ARG_INT
, &maxusers
},
1397 {"flags", 'F', POPT_ARG_INT
, &flagsarg
},
1398 {"jobid", 'j', POPT_ARG_INT
, &jobid
},
1399 {"long", 'l', POPT_ARG_NONE
, &long_list_entries
},
1409 pc
= poptGetContext(NULL
, argc
, (const char **) argv
, long_options
,
1410 POPT_CONTEXT_KEEP_FIRST
);
1412 while((opt
= poptGetNextOpt(pc
)) != -1) {
1419 DEBUGLEVEL
=debuglevel
;
1422 dest_ip
= *interpret_addr2(poptGetOptArg(pc
));
1423 if(zero_ip(dest_ip
))
1424 printf(ERRMSG_INVALID_IPADDRESS
);
1429 p
= strchr(user_name
,'%');
1430 pstrcpy(global_user_name
, user_name
);
1433 pstrcpy(password
,p
+1);
1438 printf(ERRMSG_INVALID_OPTION
, (char)opt
, opt
);
1443 lp_load(servicesf
,True
,False
,False
);
1445 argv_new
= (char **)poptGetArgs(pc
);
1448 for (i
=0; i
<argc
; i
++) {
1449 if (argv_new
[i
] == NULL
) {
1460 func
= get_func(argv_new
[1]);
1466 if (func
== VALIDATEF
) {
1470 if (func
== HELPF
) {
1476 if (func
== HELPF
) {
1477 switch(get_func(argv_new
[2])) {
1512 groupmember_usage();
1521 printf(ERRMSG_INVALID_HELP_OPTION
);
1528 /* parse next parm (argument 2) - i.e. sub function */
1529 subfunc
= get_subfunc(argv_new
[2]);
1531 if (func
== 0) return -1;
1534 pstrcpy(global_requester_name
, requester_name
);
1536 get_myname(global_requester_name
);
1539 pstrcpy(global_user_name
, user_name
);
1540 else if (getenv("LOGNAME"))
1541 pstrcpy(global_user_name
,getenv("LOGNAME"));
1543 fstrcpy(global_workgroup
, my_workgroup
? my_workgroup
:lp_workgroup());
1546 pstrcpy(host
, dest_host
);
1548 if((have_ip
) && (host
[0]))
1549 printf(ERRMSG_BOTH_SERVER_IPADDRESS
);
1551 while (!got_pass
) { /* BB if nulluser operation. why bother to ask for pword BB */
1552 p
= getpass(PASSWORD_PROMPT
);
1554 pstrcpy(password
, p
);
1564 if (subfunc
== OTHER_SF
)
1565 rc
= net_file(subfunc
, argv_new
[2]);
1567 rc
= net_file(subfunc
,NULL
);
1569 rc
= net_file(subfunc
,argv_new
[3]);
1573 rc
= net_share(subfunc
, NULL
, NULL
, 0);
1575 rc
= net_share(subfunc
,argv_new
[3], comment
, maxusers
);
1579 rc
= net_session(subfunc
,NULL
);
1581 rc
= net_session(subfunc
,argv_new
[3]);
1584 rc
= net_server(target_workgroup
, subfunc
);
1587 if(subfunc
!= LIST_SF
)
1588 printf(ERRMSG_INVALID_DOMAIN_ACTION
);
1593 rc
= net_user(subfunc
, NULL
, NULL
, -1);
1594 else if(argc_new
== 3)
1595 rc
= net_user(subfunc
,NULL
, NULL
, -1);
1596 else if(argc_new
> 3)
1597 rc
= net_user(subfunc
,argv_new
[3], comment
, flagsarg
);
1601 rc
= net_group(subfunc
, NULL
, NULL
);
1602 else if(argc_new
== 3)
1603 rc
= net_group(subfunc
,NULL
, NULL
);
1604 else if(argc_new
> 3)
1605 rc
= net_group(subfunc
,argv_new
[3], comment
);
1609 rc
= net_groupmember(subfunc
, argv_new
[3], NULL
);
1610 else if (argc_new
== 5)
1611 rc
= net_groupmember(subfunc
, argv_new
[3], argv_new
[4]);
1613 groupmember_usage();
1618 rc
= net_validate(global_user_name
);
1621 rc
= net_service(subfunc
, argv_new
[3], argv_new
[4]);
1629 else if (argc_new
== 3) {
1630 rc
= net_admin(argv_new
[2], NULL
, NULL
);
1631 } else if (argc_new
== 4) {
1632 rc
= net_admin(argv_new
[2], argv_new
[3], NULL
);
1634 rc
= net_admin(argv_new
[2], argv_new
[3], argv_new
[4]);
1643 rc
= net_password(argv_new
[2], argv_new
[3], argv_new
[4]);
1648 rc
= net_printq(subfunc
, NULL
, jobid
);
1650 rc
= net_printq(subfunc
, argv_new
[3], jobid
);
1656 DEBUG(1,("return code = %d\n", rc
));