2 Samba Unix/Linux SMB client library
3 Distributed SMB/CIFS Server Management Utility
4 Copyright (C) 2001 Steve French (sfrench@us.ibm.com)
5 Copyright (C) 2001 Jim McDonough (jmcd@us.ibm.com)
6 Copyright (C) 2001 Andrew Tridgell (tridge@samba.org)
7 Copyright (C) 2001 Andrew Bartlett (abartlet@samba.org)
9 Originally written by Steve and Jim. Largely rewritten by tridge in
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
27 #include "utils/net.h"
29 /* The following messages were for error checking that is not properly
30 reported at the moment. Which should be reinstated? */
31 #define ERRMSG_TARGET_WG_NOT_VALID "\nTarget workgroup option not valid "\
32 "except on net rap server command, ignored"
33 #define ERRMSG_INVALID_HELP_OPTION "\nInvalid help option\n"
35 #define ERRMSG_BOTH_SERVER_IPADDRESS "\nTarget server and IP address both "\
36 "specified. Do not set both at the same time. The target IP address was used\n"
38 const char *share_type
[] = {
45 static int errmsg_not_implemented(void)
47 d_printf("\nNot implemented\n");
51 int net_rap_file_usage(int argc
, const char **argv
)
53 return net_help_file(argc
, argv
);
56 /***************************************************************************
57 list info on an open file
58 ***************************************************************************/
59 static void file_fn(const char * pPath
, const char * pUser
, uint16 perms
,
60 uint16 locks
, uint32 id
)
62 d_printf("%-7.1d %-20.20s 0x%-4.2x %-6.1d %s\n",
63 id
, pUser
, perms
, locks
, pPath
);
66 static void one_file_fn(const char *pPath
, const char *pUser
, uint16 perms
,
67 uint16 locks
, uint32 id
)
69 d_printf("File ID %d\n"\
74 id
, pUser
, locks
, pPath
, perms
);
78 static int rap_file_close(int argc
, const char **argv
)
80 struct cli_state
*cli
;
83 d_printf("\nMissing fileid of file to close\n\n");
84 return net_rap_file_usage(argc
, argv
);
87 if (!(cli
= net_make_ipc_connection(0)))
90 ret
= cli_NetFileClose(cli
, atoi(argv
[0]));
95 static int rap_file_info(int argc
, const char **argv
)
97 struct cli_state
*cli
;
100 return net_rap_file_usage(argc
, argv
);
102 if (!(cli
= net_make_ipc_connection(0)))
105 ret
= cli_NetFileGetInfo(cli
, atoi(argv
[0]), one_file_fn
);
110 static int rap_file_user(int argc
, const char **argv
)
113 return net_rap_file_usage(argc
, argv
);
115 d_fprintf(stderr
, "net rap file user not implemented yet\n");
119 int net_rap_file(int argc
, const char **argv
)
121 struct functable func
[] = {
122 {"CLOSE", rap_file_close
},
123 {"USER", rap_file_user
},
124 {"INFO", rap_file_info
},
129 struct cli_state
*cli
;
132 if (!(cli
= net_make_ipc_connection(0)))
135 /* list open files */
137 "\nEnumerating open files on remote server:\n\n"\
138 "\nFileId Opened by Perms Locks Path \n"\
139 "------ --------- ----- ----- ---- \n");
140 ret
= cli_NetFileEnum(cli
, NULL
, NULL
, file_fn
);
145 return net_run_function(argc
, argv
, func
, net_rap_file_usage
);
148 int net_rap_share_usage(int argc
, const char **argv
)
150 return net_help_share(argc
, argv
);
153 static void long_share_fn(const char *share_name
, uint32 type
,
154 const char *comment
, void *state
)
156 d_printf("%-12s %-8.8s %-50s\n",
157 share_name
, share_type
[type
], comment
);
160 static void share_fn(const char *share_name
, uint32 type
,
161 const char *comment
, void *state
)
163 d_printf("%s\n", share_name
);
166 static int rap_share_delete(int argc
, const char **argv
)
168 struct cli_state
*cli
;
172 d_printf("\n\nShare name not specified\n");
173 return net_rap_share_usage(argc
, argv
);
176 if (!(cli
= net_make_ipc_connection(0)))
179 ret
= cli_NetShareDelete(cli
, argv
[0]);
184 static int rap_share_add(int argc
, const char **argv
)
186 struct cli_state
*cli
;
189 RAP_SHARE_INFO_2 sinfo
;
194 d_printf("\n\nShare name not specified\n");
195 return net_rap_share_usage(argc
, argv
);
198 if (!(cli
= net_make_ipc_connection(0)))
201 sharename
= SMB_STRDUP(argv
[0]);
202 p
= strchr(sharename
, '=');
204 d_printf("Server path not specified\n");
205 return net_rap_share_usage(argc
, argv
);
208 strlcpy(sinfo
.share_name
, sharename
, sizeof(sinfo
.share_name
));
209 sinfo
.reserved1
= '\0';
210 sinfo
.share_type
= 0;
211 sinfo
.comment
= smb_xstrdup(opt_comment
);
213 sinfo
.maximum_users
= opt_maxusers
;
214 sinfo
.active_users
= 0;
216 memset(sinfo
.password
, '\0', sizeof(sinfo
.password
));
217 sinfo
.reserved2
= '\0';
219 ret
= cli_NetShareAdd(cli
, &sinfo
);
225 int net_rap_share(int argc
, const char **argv
)
227 struct functable func
[] = {
228 {"DELETE", rap_share_delete
},
229 {"CLOSE", rap_share_delete
},
230 {"ADD", rap_share_add
},
235 struct cli_state
*cli
;
238 if (!(cli
= net_make_ipc_connection(0)))
241 if (opt_long_list_entries
) {
243 "\nEnumerating shared resources (exports) on remote server:\n\n"\
244 "\nShare name Type Description\n"\
245 "---------- ---- -----------\n");
246 ret
= cli_RNetShareEnum(cli
, long_share_fn
, NULL
);
248 ret
= cli_RNetShareEnum(cli
, share_fn
, NULL
);
254 return net_run_function(argc
, argv
, func
, net_rap_share_usage
);
258 int net_rap_session_usage(int argc
, const char **argv
)
261 "\nnet rap session [misc. options] [targets]"\
262 "\n\tenumerates all active SMB/CIFS sessions on target server\n");
264 "\nnet rap session DELETE <client_name> [misc. options] [targets] \n"\
266 "\nnet rap session CLOSE <client_name> [misc. options] [targets]"\
267 "\n\tDeletes (closes) a session from specified client to server\n");
269 "\nnet rap session INFO <client_name>"\
270 "\n\tEnumerates all open files in specified session\n");
272 net_common_flags_usage(argc
, argv
);
276 static void list_sessions_func(char *wsname
, char *username
, uint16 conns
,
277 uint16 opens
, uint16 users
, uint32 sess_time
,
278 uint32 idle_time
, uint32 user_flags
, char *clitype
)
280 int hrs
= idle_time
/ 3600;
281 int min
= (idle_time
/ 60) % 60;
282 int sec
= idle_time
% 60;
284 d_printf("\\\\%-18.18s %-20.20s %-18.18s %5d %2.2d:%2.2d:%2.2d\n",
285 wsname
, username
, clitype
, opens
, hrs
, min
, sec
);
288 static void display_session_func(const char *wsname
, const char *username
,
289 uint16 conns
, uint16 opens
, uint16 users
,
290 uint32 sess_time
, uint32 idle_time
,
291 uint32 user_flags
, const char *clitype
)
293 int ihrs
= idle_time
/ 3600;
294 int imin
= (idle_time
/ 60) % 60;
295 int isec
= idle_time
% 60;
296 int shrs
= sess_time
/ 3600;
297 int smin
= (sess_time
/ 60) % 60;
298 int ssec
= sess_time
% 60;
299 d_printf("User name %-20.20s\n"\
300 "Computer %-20.20s\n"\
301 "Guest logon %-20.20s\n"\
302 "Client Type %-40.40s\n"\
303 "Sess time %2.2d:%2.2d:%2.2d\n"\
304 "Idle time %2.2d:%2.2d:%2.2d\n",
306 (user_flags
&0x0)?"yes":"no", clitype
,
307 shrs
, smin
, ssec
, ihrs
, imin
, isec
);
310 static void display_conns_func(uint16 conn_id
, uint16 conn_type
, uint16 opens
,
311 uint16 users
, uint32 conn_time
,
312 const char *username
, const char *netname
)
314 d_printf("%-14.14s %-8.8s %5d\n",
315 netname
, share_type
[conn_type
], opens
);
318 static int rap_session_info(int argc
, const char **argv
)
320 const char *sessname
;
321 struct cli_state
*cli
;
324 if (!(cli
= net_make_ipc_connection(0)))
328 return net_rap_session_usage(argc
, argv
);
332 ret
= cli_NetSessionGetInfo(cli
, sessname
, display_session_func
);
338 d_printf("Share name Type # Opens\n-------------------------"\
339 "-----------------------------------------------------\n");
340 ret
= cli_NetConnectionEnum(cli
, sessname
, display_conns_func
);
345 static int rap_session_delete(int argc
, const char **argv
)
347 struct cli_state
*cli
;
350 if (!(cli
= net_make_ipc_connection(0)))
354 return net_rap_session_usage(argc
, argv
);
356 ret
= cli_NetSessionDel(cli
, argv
[0]);
361 int net_rap_session(int argc
, const char **argv
)
363 struct functable func
[] = {
364 {"INFO", rap_session_info
},
365 {"DELETE", rap_session_delete
},
366 {"CLOSE", rap_session_delete
},
371 struct cli_state
*cli
;
374 if (!(cli
= net_make_ipc_connection(0)))
377 d_printf("Computer User name "\
378 "Client Type Opens Idle time\n"\
379 "------------------------------------------"\
380 "------------------------------------\n");
381 ret
= cli_NetSessionEnum(cli
, list_sessions_func
);
387 return net_run_function(argc
, argv
, func
, net_rap_session_usage
);
390 /****************************************************************************
392 ****************************************************************************/
393 static void display_server_func(const char *name
, uint32 m
,
394 const char *comment
, void * reserved
)
396 d_printf("\t%-16.16s %s\n", name
, comment
);
400 int net_rap_server_usage(int argc
, const char **argv
)
402 d_printf("net rap server [misc. options] [target]\n\t"\
403 "lists the servers in the specified domain or workgroup.\n");
404 d_printf("\n\tIf domain is not specified, it uses the current"\
405 " domain or workgroup as\n\tthe default.\n");
407 net_common_flags_usage(argc
, argv
);
411 int net_rap_server(int argc
, const char **argv
)
413 struct cli_state
*cli
;
416 if (!(cli
= net_make_ipc_connection(0)))
419 d_printf("\nEnumerating servers in this domain or workgroup: \n\n"\
420 "\tServer name Server description\n"\
421 "\t------------- ----------------------------\n");
423 ret
= cli_NetServerEnum(cli
, cli
->server_domain
, SV_TYPE_ALL
,
424 display_server_func
,NULL
);
429 int net_rap_domain_usage(int argc
, const char **argv
)
431 d_printf("net rap domain [misc. options] [target]\n\tlists the"\
432 " domains or workgroups visible on the current network\n");
434 net_common_flags_usage(argc
, argv
);
439 int net_rap_domain(int argc
, const char **argv
)
441 struct cli_state
*cli
;
444 if (!(cli
= net_make_ipc_connection(0)))
447 d_printf("\nEnumerating domains:\n\n"\
448 "\tDomain name Server name of Browse Master\n"\
449 "\t------------- ----------------------------\n");
451 ret
= cli_NetServerEnum(cli
, cli
->server_domain
, SV_TYPE_DOMAIN_ENUM
,
452 display_server_func
,NULL
);
457 int net_rap_printq_usage(int argc
, const char **argv
)
460 "net rap printq [misc. options] [targets]\n"\
462 "net rap printq list [<queue_name>] [misc. options] [targets]\n"\
463 "\tlists the specified queue and jobs on the target server.\n"\
464 "\tIf the queue name is not specified, all queues are listed.\n\n");
466 "net rap printq delete [<queue name>] [misc. options] [targets]\n"\
467 "\tdeletes the specified job number on the target server, or the\n"\
468 "\tprinter queue if no job number is specified\n");
470 net_common_flags_usage(argc
, argv
);
475 static void enum_queue(const char *queuename
, uint16 pri
, uint16 start
,
476 uint16 until
, const char *sep
, const char *pproc
,
477 const char *dest
, const char *qparms
,
478 const char *qcomment
, uint16 status
, uint16 jobcount
)
480 d_printf("%-17.17s Queue %5d jobs ",
481 queuename
, jobcount
);
485 d_printf("*Printer Active*\n");
488 d_printf("*Printer Paused*\n");
491 d_printf("*Printer error*\n");
494 d_printf("*Delete Pending*\n");
497 d_printf("**UNKNOWN STATUS**\n");
501 static void enum_jobs(uint16 jobid
, const char *ownername
,
502 const char *notifyname
, const char *datatype
,
503 const char *jparms
, uint16 pos
, uint16 status
,
504 const char *jstatus
, unsigned int submitted
, unsigned int jobsize
,
507 d_printf(" %-23.23s %5d %9d ",
508 ownername
, jobid
, jobsize
);
511 d_printf("Waiting\n");
514 d_printf("Held in queue\n");
517 d_printf("Spooling\n");
520 d_printf("Printing\n");
523 d_printf("**UNKNOWN STATUS**\n");
527 #define PRINTQ_ENUM_DISPLAY \
528 "Print queues at \\\\%s\n\n"\
529 "Name Job # Size Status\n\n"\
530 "------------------------------------------------------------------"\
533 static int rap_printq_info(int argc
, const char **argv
)
535 struct cli_state
*cli
;
539 return net_rap_printq_usage(argc
, argv
);
541 if (!(cli
= net_make_ipc_connection(0)))
544 d_printf(PRINTQ_ENUM_DISPLAY
, cli
->desthost
); /* list header */
545 ret
= cli_NetPrintQGetInfo(cli
, argv
[0], enum_queue
, enum_jobs
);
550 static int rap_printq_delete(int argc
, const char **argv
)
552 struct cli_state
*cli
;
556 return net_rap_printq_usage(argc
, argv
);
558 if (!(cli
= net_make_ipc_connection(0)))
561 ret
= cli_printjob_del(cli
, atoi(argv
[0]));
566 int net_rap_printq(int argc
, const char **argv
)
568 struct cli_state
*cli
;
571 struct functable func
[] = {
572 {"INFO", rap_printq_info
},
573 {"DELETE", rap_printq_delete
},
578 if (!(cli
= net_make_ipc_connection(0)))
581 d_printf(PRINTQ_ENUM_DISPLAY
, cli
->desthost
); /* list header */
582 ret
= cli_NetPrintQEnum(cli
, enum_queue
, enum_jobs
);
587 return net_run_function(argc
, argv
, func
, net_rap_printq_usage
);
591 static int net_rap_user_usage(int argc
, const char **argv
)
593 return net_help_user(argc
, argv
);
596 static void user_fn(const char *user_name
, void *state
)
598 d_printf("%-21.21s\n", user_name
);
601 static void long_user_fn(const char *user_name
, const char *comment
,
602 const char * home_dir
, const char * logon_script
,
605 d_printf("%-21.21s %s\n",
609 static void group_member_fn(const char *user_name
, void *state
)
611 d_printf("%-21.21s\n", user_name
);
614 static int rap_user_delete(int argc
, const char **argv
)
616 struct cli_state
*cli
;
620 d_printf("\n\nUser name not specified\n");
621 return net_rap_user_usage(argc
, argv
);
624 if (!(cli
= net_make_ipc_connection(0)))
627 ret
= cli_NetUserDelete(cli
, argv
[0]);
632 static int rap_user_add(int argc
, const char **argv
)
634 struct cli_state
*cli
;
636 RAP_USER_INFO_1 userinfo
;
639 d_printf("\n\nUser name not specified\n");
640 return net_rap_user_usage(argc
, argv
);
643 if (!(cli
= net_make_ipc_connection(0)))
646 safe_strcpy(userinfo
.user_name
, argv
[0], sizeof(userinfo
.user_name
)-1);
650 userinfo
.userflags
= opt_flags
;
651 userinfo
.reserved1
= '\0';
652 userinfo
.comment
= smb_xstrdup(opt_comment
);
654 userinfo
.home_dir
= NULL
;
655 userinfo
.logon_script
= NULL
;
657 ret
= cli_NetUserAdd(cli
, &userinfo
);
663 static int rap_user_info(int argc
, const char **argv
)
665 struct cli_state
*cli
;
668 d_printf("\n\nUser name not specified\n");
669 return net_rap_user_usage(argc
, argv
);
672 if (!(cli
= net_make_ipc_connection(0)))
675 ret
= cli_NetUserGetGroups(cli
, argv
[0], group_member_fn
, NULL
);
680 int net_rap_user(int argc
, const char **argv
)
683 struct functable func
[] = {
684 {"ADD", rap_user_add
},
685 {"INFO", rap_user_info
},
686 {"DELETE", rap_user_delete
},
691 struct cli_state
*cli
;
692 if (!(cli
= net_make_ipc_connection(0)))
694 if (opt_long_list_entries
) {
695 d_printf("\nUser name Comment"\
696 "\n-----------------------------\n");
697 ret
= cli_RNetUserEnum(cli
, long_user_fn
, NULL
);
701 ret
= cli_RNetUserEnum0(cli
, user_fn
, NULL
);
706 ret
= net_run_function(argc
, argv
, func
, net_rap_user_usage
);
709 DEBUG(1, ("Net user returned: %d\n", ret
));
715 int net_rap_group_usage(int argc
, const char **argv
)
717 return net_help_group(argc
, argv
);
720 static void long_group_fn(const char *group_name
, const char *comment
,
723 d_printf("%-21.21s %s\n", group_name
, comment
);
726 static void group_fn(const char *group_name
, void *state
)
728 d_printf("%-21.21s\n", group_name
);
731 static int rap_group_delete(int argc
, const char **argv
)
733 struct cli_state
*cli
;
736 d_printf("\n\nGroup name not specified\n");
737 return net_rap_group_usage(argc
, argv
);
740 if (!(cli
= net_make_ipc_connection(0)))
743 ret
= cli_NetGroupDelete(cli
, argv
[0]);
748 static int rap_group_add(int argc
, const char **argv
)
750 struct cli_state
*cli
;
752 RAP_GROUP_INFO_1 grinfo
;
755 d_printf("\n\nGroup name not specified\n");
756 return net_rap_group_usage(argc
, argv
);
759 if (!(cli
= net_make_ipc_connection(0)))
762 /* BB check for length 21 or smaller explicitly ? BB */
763 safe_strcpy(grinfo
.group_name
, argv
[0], sizeof(grinfo
.group_name
)-1);
764 grinfo
.reserved1
= '\0';
765 grinfo
.comment
= smb_xstrdup(opt_comment
);
767 ret
= cli_NetGroupAdd(cli
, &grinfo
);
772 int net_rap_group(int argc
, const char **argv
)
774 struct functable func
[] = {
775 {"ADD", rap_group_add
},
776 {"DELETE", rap_group_delete
},
781 struct cli_state
*cli
;
783 if (!(cli
= net_make_ipc_connection(0)))
785 if (opt_long_list_entries
) {
786 d_printf("Group name Comment\n");
787 d_printf("-----------------------------\n");
788 ret
= cli_RNetGroupEnum(cli
, long_group_fn
, NULL
);
792 ret
= cli_RNetGroupEnum0(cli
, group_fn
, NULL
);
797 return net_run_function(argc
, argv
, func
, net_rap_group_usage
);
800 int net_rap_groupmember_usage(int argc
, const char **argv
)
803 "net rap groupmember LIST <group> [misc. options] [targets]"\
804 "\n\t Enumerate users in a group\n"\
805 "\nnet rap groupmember DELETE <group> <user> [misc. options] "\
806 "[targets]\n\t Delete sepcified user from specified group\n"\
807 "\nnet rap groupmember ADD <group> <user> [misc. options] [targets]"\
808 "\n\t Add specified user to specified group\n");
810 net_common_flags_usage(argc
, argv
);
815 static int rap_groupmember_add(int argc
, const char **argv
)
817 struct cli_state
*cli
;
820 d_printf("\n\nGroup or user name not specified\n");
821 return net_rap_groupmember_usage(argc
, argv
);
824 if (!(cli
= net_make_ipc_connection(0)))
827 ret
= cli_NetGroupAddUser(cli
, argv
[0], argv
[1]);
832 static int rap_groupmember_delete(int argc
, const char **argv
)
834 struct cli_state
*cli
;
837 d_printf("\n\nGroup or user name not specified\n");
838 return net_rap_groupmember_usage(argc
, argv
);
841 if (!(cli
= net_make_ipc_connection(0)))
844 ret
= cli_NetGroupDelUser(cli
, argv
[0], argv
[1]);
849 static int rap_groupmember_list(int argc
, const char **argv
)
851 struct cli_state
*cli
;
854 d_printf("\n\nGroup name not specified\n");
855 return net_rap_groupmember_usage(argc
, argv
);
858 if (!(cli
= net_make_ipc_connection(0)))
861 ret
= cli_NetGroupGetUsers(cli
, argv
[0], group_member_fn
, NULL
);
866 int net_rap_groupmember(int argc
, const char **argv
)
868 struct functable func
[] = {
869 {"ADD", rap_groupmember_add
},
870 {"LIST", rap_groupmember_list
},
871 {"DELETE", rap_groupmember_delete
},
875 return net_run_function(argc
, argv
, func
, net_rap_groupmember_usage
);
878 int net_rap_validate_usage(int argc
, const char **argv
)
880 d_printf("net rap validate <username> [password]\n"\
881 "\tValidate user and password to check whether they"\
882 " can access target server or domain\n");
884 net_common_flags_usage(argc
, argv
);
888 int net_rap_validate(int argc
, const char **argv
)
890 return errmsg_not_implemented();
893 int net_rap_service_usage(int argc
, const char **argv
)
895 d_printf("net rap service [misc. options] [targets] \n"\
896 "\tlists all running service daemons on target server\n");
897 d_printf("\nnet rap service START <name> [service startup arguments]"\
898 " [misc. options] [targets]"\
899 "\n\tStart named service on remote server\n");
900 d_printf("\nnet rap service STOP <name> [misc. options] [targets]\n"\
901 "\n\tStop named service on remote server\n");
903 net_common_flags_usage(argc
, argv
);
907 static int rap_service_start(int argc
, const char **argv
)
909 return errmsg_not_implemented();
912 static int rap_service_stop(int argc
, const char **argv
)
914 return errmsg_not_implemented();
917 static void service_fn(const char *service_name
, const char *dummy
,
920 d_printf("%-21.21s\n", service_name
);
923 int net_rap_service(int argc
, const char **argv
)
925 struct functable func
[] = {
926 {"START", rap_service_start
},
927 {"STOP", rap_service_stop
},
932 struct cli_state
*cli
;
934 if (!(cli
= net_make_ipc_connection(0)))
937 if (opt_long_list_entries
) {
938 d_printf("Service name Comment\n");
939 d_printf("-----------------------------\n");
940 ret
= cli_RNetServiceEnum(cli
, long_group_fn
, NULL
);
942 ret
= cli_RNetServiceEnum(cli
, service_fn
, NULL
);
947 return net_run_function(argc
, argv
, func
, net_rap_service_usage
);
950 int net_rap_password_usage(int argc
, const char **argv
)
953 "net rap password <user> <oldpwo> <newpw> [misc. options] [target]\n"\
954 "\tchanges the password for the specified user at target\n");
960 int net_rap_password(int argc
, const char **argv
)
962 struct cli_state
*cli
;
966 return net_rap_password_usage(argc
, argv
);
968 if (!(cli
= net_make_ipc_connection(0)))
971 /* BB Add check for password lengths? */
972 ret
= cli_oem_change_password(cli
, argv
[0], argv
[2], argv
[1]);
977 int net_rap_admin_usage(int argc
, const char **argv
)
980 "net rap admin <remote command> [cmd args [env]] [misc. options] [targets]"\
981 "\n\texecutes a remote command on an os/2 target server\n");
987 int net_rap_admin(int argc
, const char **argv
)
989 return errmsg_not_implemented();
992 /* The help subsystem for the RAP subcommand */
994 int net_rap_usage(int argc
, const char **argv
)
996 d_printf(" net rap domain \tto list domains \n"\
997 " net rap file \t\tto list open files on a server \n"\
998 " net rap group \tto list user groups \n"\
999 " net rap groupmember \tto list users in a group \n"\
1000 " net rap password \tto change the password of a user\n"\
1001 " net rap printq \tto list the print queues on a server\n"\
1002 " net rap server \tto list servers in a domain\n"\
1003 " net rap session \tto list clients with open sessions to a server\n"\
1004 " net rap share \tto list shares exported by a server\n"\
1005 " net rap user \t\tto list users\n"\
1006 " net rap validate \tto check whether a user and the corresponding password are valid\n"\
1008 "\nType \"net help <option>\" to get more information on that option\n\n");
1010 net_common_flags_usage(argc
, argv
);
1015 handle "net rap help *" subcommands
1017 int net_rap_help(int argc
, const char **argv
)
1019 struct functable func
[] = {
1020 {"FILE", net_rap_file_usage
},
1021 {"SHARE", net_rap_share_usage
},
1022 {"SESSION", net_rap_session_usage
},
1023 {"SERVER", net_rap_server_usage
},
1024 {"DOMAIN", net_rap_domain_usage
},
1025 {"PRINTQ", net_rap_printq_usage
},
1026 {"USER", net_rap_user_usage
},
1027 {"GROUP", net_rap_group_usage
},
1028 {"VALIDATE", net_rap_validate_usage
},
1029 {"GROUPMEMBER", net_rap_groupmember_usage
},
1030 {"ADMIN", net_rap_admin_usage
},
1031 {"SERVICE", net_rap_service_usage
},
1032 {"PASSWORD", net_rap_password_usage
},
1035 return net_run_function(argc
, argv
, func
, net_rap_usage
);
1038 /* Entry-point for all the RAP functions. */
1040 int net_rap(int argc
, const char **argv
)
1042 struct functable func
[] = {
1043 {"FILE", net_rap_file
},
1044 {"SHARE", net_rap_share
},
1045 {"SESSION", net_rap_session
},
1046 {"SERVER", net_rap_server
},
1047 {"DOMAIN", net_rap_domain
},
1048 {"PRINTQ", net_rap_printq
},
1049 {"USER", net_rap_user
},
1050 {"GROUP", net_rap_group
},
1051 {"VALIDATE", net_rap_validate
},
1052 {"GROUPMEMBER", net_rap_groupmember
},
1053 {"ADMIN", net_rap_admin
},
1054 {"SERVICE", net_rap_service
},
1055 {"PASSWORD", net_rap_password
},
1056 {"HELP", net_rap_help
},
1060 return net_run_function(argc
, argv
, func
, net_rap_usage
);