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_printf("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
= strdup(argv
[0]);
202 p
= strchr(sharename
, '=');
204 strlcpy(sinfo
.share_name
, sharename
, sizeof(sinfo
.share_name
));
205 sinfo
.reserved1
= '\0';
206 sinfo
.share_type
= 0;
207 sinfo
.comment
= smb_xstrdup(opt_comment
);
209 sinfo
.maximum_users
= opt_maxusers
;
210 sinfo
.active_users
= 0;
212 memset(sinfo
.password
, '\0', sizeof(sinfo
.password
));
213 sinfo
.reserved2
= '\0';
215 ret
= cli_NetShareAdd(cli
, &sinfo
);
221 int net_rap_share(int argc
, const char **argv
)
223 struct functable func
[] = {
224 {"DELETE", rap_share_delete
},
225 {"CLOSE", rap_share_delete
},
226 {"ADD", rap_share_add
},
231 struct cli_state
*cli
;
234 if (!(cli
= net_make_ipc_connection(0)))
237 if (opt_long_list_entries
) {
239 "\nEnumerating shared resources (exports) on remote server:\n\n"\
240 "\nShare name Type Description\n"\
241 "---------- ---- -----------\n");
242 ret
= cli_RNetShareEnum(cli
, long_share_fn
, NULL
);
244 ret
= cli_RNetShareEnum(cli
, share_fn
, NULL
);
250 return net_run_function(argc
, argv
, func
, net_rap_share_usage
);
254 int net_rap_session_usage(int argc
, const char **argv
)
257 "\nnet rap session [misc. options] [targets]"\
258 "\n\tenumerates all active SMB/CIFS sessions on target server\n");
260 "\nnet rap session DELETE <client_name> [misc. options] [targets] \n"\
262 "\nnet rap session CLOSE <client_name> [misc. options] [targets]"\
263 "\n\tDeletes (closes) a session from specified client to server\n");
265 "\nnet rap session INFO <client_name>"\
266 "\n\tEnumerates all open files in specified session\n");
268 net_common_flags_usage(argc
, argv
);
272 static void list_sessions_func(char *wsname
, char *username
, uint16 conns
,
273 uint16 opens
, uint16 users
, uint32 sess_time
,
274 uint32 idle_time
, uint32 user_flags
, char *clitype
)
276 int hrs
= idle_time
/ 3600;
277 int min
= (idle_time
/ 60) % 60;
278 int sec
= idle_time
% 60;
280 d_printf("\\\\%-18.18s %-20.20s %-18.18s %5d %2.2d:%2.2d:%2.2d\n",
281 wsname
, username
, clitype
, opens
, hrs
, min
, sec
);
284 static void display_session_func(const char *wsname
, const char *username
,
285 uint16 conns
, uint16 opens
, uint16 users
,
286 uint32 sess_time
, uint32 idle_time
,
287 uint32 user_flags
, const char *clitype
)
289 int ihrs
= idle_time
/ 3600;
290 int imin
= (idle_time
/ 60) % 60;
291 int isec
= idle_time
% 60;
292 int shrs
= sess_time
/ 3600;
293 int smin
= (sess_time
/ 60) % 60;
294 int ssec
= sess_time
% 60;
295 d_printf("User name %-20.20s\n"\
296 "Computer %-20.20s\n"\
297 "Guest logon %-20.20s\n"\
298 "Client Type %-40.40s\n"\
299 "Sess time %2.2d:%2.2d:%2.2d\n"\
300 "Idle time %2.2d:%2.2d:%2.2d\n",
302 (user_flags
&0x0)?"yes":"no", clitype
,
303 shrs
, smin
, ssec
, ihrs
, imin
, isec
);
306 static void display_conns_func(uint16 conn_id
, uint16 conn_type
, uint16 opens
,
307 uint16 users
, uint32 conn_time
,
308 const char *username
, const char *netname
)
310 d_printf("%-14.14s %-8.8s %5d\n",
311 netname
, share_type
[conn_type
], opens
);
314 static int rap_session_info(int argc
, const char **argv
)
316 const char *sessname
;
317 struct cli_state
*cli
;
320 if (!(cli
= net_make_ipc_connection(0)))
324 return net_rap_session_usage(argc
, argv
);
328 ret
= cli_NetSessionGetInfo(cli
, sessname
, display_session_func
);
334 d_printf("Share name Type # Opens\n-------------------------"\
335 "-----------------------------------------------------\n");
336 ret
= cli_NetConnectionEnum(cli
, sessname
, display_conns_func
);
341 static int rap_session_delete(int argc
, const char **argv
)
343 struct cli_state
*cli
;
346 if (!(cli
= net_make_ipc_connection(0)))
350 return net_rap_session_usage(argc
, argv
);
352 ret
= cli_NetSessionDel(cli
, argv
[0]);
357 int net_rap_session(int argc
, const char **argv
)
359 struct functable func
[] = {
360 {"INFO", rap_session_info
},
361 {"DELETE", rap_session_delete
},
362 {"CLOSE", rap_session_delete
},
367 struct cli_state
*cli
;
370 if (!(cli
= net_make_ipc_connection(0)))
373 d_printf("Computer User name "\
374 "Client Type Opens Idle time\n"\
375 "------------------------------------------"\
376 "------------------------------------\n");
377 ret
= cli_NetSessionEnum(cli
, list_sessions_func
);
383 return net_run_function(argc
, argv
, func
, net_rap_session_usage
);
386 /****************************************************************************
388 ****************************************************************************/
389 static void display_server_func(const char *name
, uint32 m
,
390 const char *comment
, void * reserved
)
392 d_printf("\t%-16.16s %s\n", name
, comment
);
396 int net_rap_server_usage(int argc
, const char **argv
)
398 d_printf("net rap server [misc. options] [target]\n\t"\
399 "lists the servers in the specified domain or workgroup.\n");
400 d_printf("\n\tIf domain is not specified, it uses the current"\
401 " domain or workgroup as\n\tthe default.\n");
403 net_common_flags_usage(argc
, argv
);
407 int net_rap_server(int argc
, const char **argv
)
409 struct cli_state
*cli
;
412 if (!(cli
= net_make_ipc_connection(0)))
415 d_printf("\nEnumerating servers in this domain or workgroup: \n\n"\
416 "\tServer name Server description\n"\
417 "\t------------- ----------------------------\n");
419 ret
= cli_NetServerEnum(cli
, cli
->server_domain
, SV_TYPE_ALL
,
420 display_server_func
,NULL
);
425 int net_rap_domain_usage(int argc
, const char **argv
)
427 d_printf("net rap domain [misc. options] [target]\n\tlists the"\
428 " domains or workgroups visible on the current network\n");
430 net_common_flags_usage(argc
, argv
);
435 int net_rap_domain(int argc
, const char **argv
)
437 struct cli_state
*cli
;
440 if (!(cli
= net_make_ipc_connection(0)))
443 d_printf("\nEnumerating domains:\n\n"\
444 "\tDomain name Server name of Browse Master\n"\
445 "\t------------- ----------------------------\n");
447 ret
= cli_NetServerEnum(cli
, cli
->server_domain
, SV_TYPE_DOMAIN_ENUM
,
448 display_server_func
,NULL
);
453 int net_rap_printq_usage(int argc
, const char **argv
)
456 "net rap printq [misc. options] [targets]\n"\
458 "net rap printq list [<queue_name>] [misc. options] [targets]\n"\
459 "\tlists the specified queue and jobs on the target server.\n"\
460 "\tIf the queue name is not specified, all queues are listed.\n\n");
462 "net rap printq delete [<queue name>] [misc. options] [targets]\n"\
463 "\tdeletes the specified job number on the target server, or the\n"\
464 "\tprinter queue if no job number is specified\n");
466 net_common_flags_usage(argc
, argv
);
471 static void enum_queue(const char *queuename
, uint16 pri
, uint16 start
,
472 uint16 until
, const char *sep
, const char *pproc
,
473 const char *dest
, const char *qparms
,
474 const char *qcomment
, uint16 status
, uint16 jobcount
)
476 d_printf("%-17.17s Queue %5d jobs ",
477 queuename
, jobcount
);
481 d_printf("*Printer Active*\n");
484 d_printf("*Printer Paused*\n");
487 d_printf("*Printer error*\n");
490 d_printf("*Delete Pending*\n");
493 d_printf("**UNKNOWN STATUS**\n");
497 static void enum_jobs(uint16 jobid
, const char *ownername
,
498 const char *notifyname
, const char *datatype
,
499 const char *jparms
, uint16 pos
, uint16 status
,
500 const char *jstatus
, unsigned int submitted
, unsigned int jobsize
,
503 d_printf(" %-23.23s %5d %9d ",
504 ownername
, jobid
, jobsize
);
507 d_printf("Waiting\n");
510 d_printf("Held in queue\n");
513 d_printf("Spooling\n");
516 d_printf("Printing\n");
519 d_printf("**UNKNOWN STATUS**\n");
523 #define PRINTQ_ENUM_DISPLAY \
524 "Print queues at \\\\%s\n\n"\
525 "Name Job # Size Status\n\n"\
526 "------------------------------------------------------------------"\
529 static int rap_printq_info(int argc
, const char **argv
)
531 struct cli_state
*cli
;
535 return net_rap_printq_usage(argc
, argv
);
537 if (!(cli
= net_make_ipc_connection(0)))
540 d_printf(PRINTQ_ENUM_DISPLAY
, cli
->desthost
); /* list header */
541 ret
= cli_NetPrintQGetInfo(cli
, argv
[0], enum_queue
, enum_jobs
);
546 static int rap_printq_delete(int argc
, const char **argv
)
548 struct cli_state
*cli
;
552 return net_rap_printq_usage(argc
, argv
);
554 if (!(cli
= net_make_ipc_connection(0)))
557 ret
= cli_printjob_del(cli
, atoi(argv
[0]));
562 int net_rap_printq(int argc
, const char **argv
)
564 struct cli_state
*cli
;
567 struct functable func
[] = {
568 {"INFO", rap_printq_info
},
569 {"DELETE", rap_printq_delete
},
574 if (!(cli
= net_make_ipc_connection(0)))
577 d_printf(PRINTQ_ENUM_DISPLAY
, cli
->desthost
); /* list header */
578 ret
= cli_NetPrintQEnum(cli
, enum_queue
, enum_jobs
);
583 return net_run_function(argc
, argv
, func
, net_rap_printq_usage
);
587 static int net_rap_user_usage(int argc
, const char **argv
)
589 return net_help_user(argc
, argv
);
592 static void user_fn(const char *user_name
, const char *comment
,
593 const char * home_dir
, const char * logon_script
,
596 d_printf("%-21.21s\n", user_name
);
599 static void long_user_fn(const char *user_name
, const char *comment
,
600 const char * home_dir
, const char * logon_script
,
603 d_printf("%-21.21s %s\n",
607 static void group_member_fn(const char *user_name
, void *state
)
609 d_printf("%-21.21s\n", user_name
);
612 static int rap_user_delete(int argc
, const char **argv
)
614 struct cli_state
*cli
;
618 d_printf("\n\nUser name not specified\n");
619 return net_rap_user_usage(argc
, argv
);
622 if (!(cli
= net_make_ipc_connection(0)))
625 ret
= cli_NetUserDelete(cli
, argv
[0]);
630 static int rap_user_add(int argc
, const char **argv
)
632 struct cli_state
*cli
;
634 RAP_USER_INFO_1 userinfo
;
637 d_printf("\n\nUser name not specified\n");
638 return net_rap_user_usage(argc
, argv
);
641 if (!(cli
= net_make_ipc_connection(0)))
644 safe_strcpy(userinfo
.user_name
, argv
[0], sizeof(userinfo
.user_name
)-1);
648 userinfo
.userflags
= opt_flags
;
649 userinfo
.reserved1
= '\0';
650 userinfo
.comment
= smb_xstrdup(opt_comment
);
652 userinfo
.home_dir
= NULL
;
653 userinfo
.logon_script
= NULL
;
655 ret
= cli_NetUserAdd(cli
, &userinfo
);
661 static int rap_user_info(int argc
, const char **argv
)
663 struct cli_state
*cli
;
666 d_printf("\n\nUser name not specified\n");
667 return net_rap_user_usage(argc
, argv
);
670 if (!(cli
= net_make_ipc_connection(0)))
673 ret
= cli_NetUserGetGroups(cli
, argv
[0], group_member_fn
, NULL
);
678 int net_rap_user(int argc
, const char **argv
)
681 struct functable func
[] = {
682 {"ADD", rap_user_add
},
683 {"INFO", rap_user_info
},
684 {"DELETE", rap_user_delete
},
689 struct cli_state
*cli
;
690 if (!(cli
= net_make_ipc_connection(0)))
692 if (opt_long_list_entries
) {
693 d_printf("\nUser name Comment"\
694 "\n-----------------------------\n");
695 ret
= cli_RNetUserEnum(cli
, long_user_fn
, NULL
);
699 ret
= cli_RNetUserEnum(cli
, user_fn
, NULL
);
704 ret
= net_run_function(argc
, argv
, func
, net_rap_user_usage
);
707 DEBUG(1, ("Net user returned: %d\n", ret
));
713 int net_rap_group_usage(int argc
, const char **argv
)
715 return net_help_group(argc
, argv
);
718 static void long_group_fn(const char *group_name
, const char *comment
,
721 d_printf("%-21.21s %s\n", group_name
, comment
);
724 static void group_fn(const char *group_name
, const char *comment
, void *state
)
726 d_printf("%-21.21s\n", group_name
);
729 static int rap_group_delete(int argc
, const char **argv
)
731 struct cli_state
*cli
;
734 d_printf("\n\nGroup name not specified\n");
735 return net_rap_group_usage(argc
, argv
);
738 if (!(cli
= net_make_ipc_connection(0)))
741 ret
= cli_NetGroupDelete(cli
, argv
[0]);
746 static int rap_group_add(int argc
, const char **argv
)
748 struct cli_state
*cli
;
750 RAP_GROUP_INFO_1 grinfo
;
753 d_printf("\n\nGroup name not specified\n");
754 return net_rap_group_usage(argc
, argv
);
757 if (!(cli
= net_make_ipc_connection(0)))
760 /* BB check for length 21 or smaller explicitly ? BB */
761 safe_strcpy(grinfo
.group_name
, argv
[0], sizeof(grinfo
.group_name
)-1);
762 grinfo
.reserved1
= '\0';
763 grinfo
.comment
= smb_xstrdup(opt_comment
);
765 ret
= cli_NetGroupAdd(cli
, &grinfo
);
770 int net_rap_group(int argc
, const char **argv
)
772 struct functable func
[] = {
773 {"ADD", rap_group_add
},
774 {"DELETE", rap_group_delete
},
779 struct cli_state
*cli
;
781 if (!(cli
= net_make_ipc_connection(0)))
783 if (opt_long_list_entries
) {
784 d_printf("Group name Comment\n");
785 d_printf("-----------------------------\n");
786 ret
= cli_RNetGroupEnum(cli
, long_group_fn
, NULL
);
790 ret
= cli_RNetGroupEnum(cli
, group_fn
, NULL
);
795 return net_run_function(argc
, argv
, func
, net_rap_group_usage
);
798 int net_rap_groupmember_usage(int argc
, const char **argv
)
801 "net rap groupmember LIST <group> [misc. options] [targets]"\
802 "\n\t Enumerate users in a group\n"\
803 "\nnet rap groupmember DELETE <group> <user> [misc. options] "\
804 "[targets]\n\t Delete sepcified user from specified group\n"\
805 "\nnet rap groupmember ADD <group> <user> [misc. options] [targets]"\
806 "\n\t Add specified user to specified group\n");
808 net_common_flags_usage(argc
, argv
);
813 static int rap_groupmember_add(int argc
, const char **argv
)
815 struct cli_state
*cli
;
818 d_printf("\n\nGroup or user name not specified\n");
819 return net_rap_groupmember_usage(argc
, argv
);
822 if (!(cli
= net_make_ipc_connection(0)))
825 ret
= cli_NetGroupAddUser(cli
, argv
[0], argv
[1]);
830 static int rap_groupmember_delete(int argc
, const char **argv
)
832 struct cli_state
*cli
;
835 d_printf("\n\nGroup or user name not specified\n");
836 return net_rap_groupmember_usage(argc
, argv
);
839 if (!(cli
= net_make_ipc_connection(0)))
842 ret
= cli_NetGroupDelUser(cli
, argv
[0], argv
[1]);
847 static int rap_groupmember_list(int argc
, const char **argv
)
849 struct cli_state
*cli
;
852 d_printf("\n\nGroup name not specified\n");
853 return net_rap_groupmember_usage(argc
, argv
);
856 if (!(cli
= net_make_ipc_connection(0)))
859 ret
= cli_NetGroupGetUsers(cli
, argv
[0], group_member_fn
, NULL
);
864 int net_rap_groupmember(int argc
, const char **argv
)
866 struct functable func
[] = {
867 {"ADD", rap_groupmember_add
},
868 {"LIST", rap_groupmember_list
},
869 {"DELETE", rap_groupmember_delete
},
873 return net_run_function(argc
, argv
, func
, net_rap_groupmember_usage
);
876 int net_rap_validate_usage(int argc
, const char **argv
)
878 d_printf("net rap validate <username> [password]\n"\
879 "\tValidate user and password to check whether they"\
880 " can access target server or domain\n");
882 net_common_flags_usage(argc
, argv
);
886 int net_rap_validate(int argc
, const char **argv
)
888 return errmsg_not_implemented();
891 int net_rap_service_usage(int argc
, const char **argv
)
893 d_printf("net rap service [misc. options] [targets] \n"\
894 "\tlists all running service daemons on target server\n");
895 d_printf("\nnet rap service START <name> [service startup arguments]"\
896 " [misc. options] [targets]"\
897 "\n\tStart named service on remote server\n");
898 d_printf("\nnet rap service STOP <name> [misc. options] [targets]\n"\
899 "\n\tStop named service on remote server\n");
901 net_common_flags_usage(argc
, argv
);
905 static int rap_service_start(int argc
, const char **argv
)
907 return errmsg_not_implemented();
910 static int rap_service_stop(int argc
, const char **argv
)
912 return errmsg_not_implemented();
915 int net_rap_service(int argc
, const char **argv
)
917 struct functable func
[] = {
918 {"START", rap_service_start
},
919 {"STOP", rap_service_stop
},
924 struct cli_state
*cli
;
926 if (!(cli
= net_make_ipc_connection(0)))
929 if (opt_long_list_entries
) {
930 d_printf("Service name Comment\n");
931 d_printf("-----------------------------\n");
932 ret
= cli_RNetServiceEnum(cli
, long_group_fn
, NULL
);
934 ret
= cli_RNetServiceEnum(cli
, group_fn
, NULL
);
939 return net_run_function(argc
, argv
, func
, net_rap_service_usage
);
942 int net_rap_password_usage(int argc
, const char **argv
)
945 "net rap password <user> <oldpwo> <newpw> [misc. options] [target]\n"\
946 "\tchanges the password for the specified user at target\n");
952 int net_rap_password(int argc
, const char **argv
)
954 struct cli_state
*cli
;
958 return net_rap_password_usage(argc
, argv
);
960 if (!(cli
= net_make_ipc_connection(0)))
963 /* BB Add check for password lengths? */
964 ret
= cli_oem_change_password(cli
, argv
[0], argv
[2], argv
[1]);
969 int net_rap_admin_usage(int argc
, const char **argv
)
972 "net rap admin <remote command> [cmd args [env]] [misc. options] [targets]"\
973 "\n\texecutes a remote command on an os/2 target server\n");
979 int net_rap_admin(int argc
, const char **argv
)
981 return errmsg_not_implemented();
984 /* The help subsystem for the RAP subcommand */
986 int net_rap_usage(int argc
, const char **argv
)
988 d_printf(" net rap domain \tto list domains \n"\
989 " net rap file \t\tto list open files on a server \n"\
990 " net rap group \tto list user groups \n"\
991 " net rap groupmember \tto list users in a group \n"\
992 " net rap password \tto change the password of a user\n"\
993 " net rap printq \tto list the print queues on a server\n"\
994 " net rap server \tto list servers in a domain\n"\
995 " net rap session \tto list clients with open sessions to a server\n"\
996 " net rap share \tto list shares exported by a server\n"\
997 " net rap user \t\tto list users\n"\
998 " net rap validate \tto check whether a user and the corresponding password are valid\n"\
1000 "\nType \"net help <option>\" to get more information on that option\n\n");
1002 net_common_flags_usage(argc
, argv
);
1007 handle "net rap help *" subcommands
1009 int net_rap_help(int argc
, const char **argv
)
1011 struct functable func
[] = {
1012 {"FILE", net_rap_file_usage
},
1013 {"SHARE", net_rap_share_usage
},
1014 {"SESSION", net_rap_session_usage
},
1015 {"SERVER", net_rap_server_usage
},
1016 {"DOMAIN", net_rap_domain_usage
},
1017 {"PRINTQ", net_rap_printq_usage
},
1018 {"USER", net_rap_user_usage
},
1019 {"GROUP", net_rap_group_usage
},
1020 {"VALIDATE", net_rap_validate_usage
},
1021 {"GROUPMEMBER", net_rap_groupmember_usage
},
1022 {"ADMIN", net_rap_admin_usage
},
1023 {"SERVICE", net_rap_service_usage
},
1024 {"PASSWORD", net_rap_password_usage
},
1027 return net_run_function(argc
, argv
, func
, net_rap_usage
);
1030 /* Entry-point for all the RAP functions. */
1032 int net_rap(int argc
, const char **argv
)
1034 struct functable func
[] = {
1035 {"FILE", net_rap_file
},
1036 {"SHARE", net_rap_share
},
1037 {"SESSION", net_rap_session
},
1038 {"SERVER", net_rap_server
},
1039 {"DOMAIN", net_rap_domain
},
1040 {"PRINTQ", net_rap_printq
},
1041 {"USER", net_rap_user
},
1042 {"GROUP", net_rap_group
},
1043 {"VALIDATE", net_rap_validate
},
1044 {"GROUPMEMBER", net_rap_groupmember
},
1045 {"ADMIN", net_rap_admin
},
1046 {"SERVICE", net_rap_service
},
1047 {"PASSWORD", net_rap_password
},
1048 {"HELP", net_rap_help
},
1052 return net_run_function(argc
, argv
, func
, net_rap_usage
);