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 static int net_rap_server_name(int argc
, const char *argv
[])
413 struct cli_state
*cli
;
416 if (!(cli
= net_make_ipc_connection(0)))
419 if (!cli_get_server_name(NULL
, cli
, &name
)) {
420 d_fprintf(stderr
, "cli_get_server_name failed\n");
425 d_printf("Server name = %s\n", name
);
432 int net_rap_server(int argc
, const char **argv
)
434 struct cli_state
*cli
;
438 if (strequal(argv
[0], "name")) {
439 return net_rap_server_name(argc
, argv
);
441 /* smb4k uses 'net [rap|rpc] server domain' to query servers in a domain */
442 /* Fall through for 'domain', any other forms will cause to show usage message */
443 if (!strequal(argv
[0], "domain")) {
444 return net_rap_server_usage(argc
-1, argv
+1);
448 if (!(cli
= net_make_ipc_connection(0)))
451 d_printf("\nEnumerating servers in this domain or workgroup: \n\n"\
452 "\tServer name Server description\n"\
453 "\t------------- ----------------------------\n");
455 ret
= cli_NetServerEnum(cli
, cli
->server_domain
, SV_TYPE_ALL
,
456 display_server_func
,NULL
);
461 int net_rap_domain_usage(int argc
, const char **argv
)
463 d_printf("net rap domain [misc. options] [target]\n\tlists the"\
464 " domains or workgroups visible on the current network\n");
466 net_common_flags_usage(argc
, argv
);
471 int net_rap_domain(int argc
, const char **argv
)
473 struct cli_state
*cli
;
476 if (!(cli
= net_make_ipc_connection(0)))
479 d_printf("\nEnumerating domains:\n\n"\
480 "\tDomain name Server name of Browse Master\n"\
481 "\t------------- ----------------------------\n");
483 ret
= cli_NetServerEnum(cli
, cli
->server_domain
, SV_TYPE_DOMAIN_ENUM
,
484 display_server_func
,NULL
);
489 int net_rap_printq_usage(int argc
, const char **argv
)
492 "net rap printq [misc. options] [targets]\n"\
494 "net rap printq list [<queue_name>] [misc. options] [targets]\n"\
495 "\tlists the specified queue and jobs on the target server.\n"\
496 "\tIf the queue name is not specified, all queues are listed.\n\n");
498 "net rap printq delete [<queue name>] [misc. options] [targets]\n"\
499 "\tdeletes the specified job number on the target server, or the\n"\
500 "\tprinter queue if no job number is specified\n");
502 net_common_flags_usage(argc
, argv
);
507 static void enum_queue(const char *queuename
, uint16 pri
, uint16 start
,
508 uint16 until
, const char *sep
, const char *pproc
,
509 const char *dest
, const char *qparms
,
510 const char *qcomment
, uint16 status
, uint16 jobcount
)
512 d_printf("%-17.17s Queue %5d jobs ",
513 queuename
, jobcount
);
517 d_printf("*Printer Active*\n");
520 d_printf("*Printer Paused*\n");
523 d_printf("*Printer error*\n");
526 d_printf("*Delete Pending*\n");
529 d_printf("**UNKNOWN STATUS**\n");
533 static void enum_jobs(uint16 jobid
, const char *ownername
,
534 const char *notifyname
, const char *datatype
,
535 const char *jparms
, uint16 pos
, uint16 status
,
536 const char *jstatus
, unsigned int submitted
, unsigned int jobsize
,
539 d_printf(" %-23.23s %5d %9d ",
540 ownername
, jobid
, jobsize
);
543 d_printf("Waiting\n");
546 d_printf("Held in queue\n");
549 d_printf("Spooling\n");
552 d_printf("Printing\n");
555 d_printf("**UNKNOWN STATUS**\n");
559 #define PRINTQ_ENUM_DISPLAY \
560 "Print queues at \\\\%s\n\n"\
561 "Name Job # Size Status\n\n"\
562 "------------------------------------------------------------------"\
565 static int rap_printq_info(int argc
, const char **argv
)
567 struct cli_state
*cli
;
571 return net_rap_printq_usage(argc
, argv
);
573 if (!(cli
= net_make_ipc_connection(0)))
576 d_printf(PRINTQ_ENUM_DISPLAY
, cli
->desthost
); /* list header */
577 ret
= cli_NetPrintQGetInfo(cli
, argv
[0], enum_queue
, enum_jobs
);
582 static int rap_printq_delete(int argc
, const char **argv
)
584 struct cli_state
*cli
;
588 return net_rap_printq_usage(argc
, argv
);
590 if (!(cli
= net_make_ipc_connection(0)))
593 ret
= cli_printjob_del(cli
, atoi(argv
[0]));
598 int net_rap_printq(int argc
, const char **argv
)
600 struct cli_state
*cli
;
603 struct functable func
[] = {
604 {"INFO", rap_printq_info
},
605 {"DELETE", rap_printq_delete
},
610 if (!(cli
= net_make_ipc_connection(0)))
613 d_printf(PRINTQ_ENUM_DISPLAY
, cli
->desthost
); /* list header */
614 ret
= cli_NetPrintQEnum(cli
, enum_queue
, enum_jobs
);
619 return net_run_function(argc
, argv
, func
, net_rap_printq_usage
);
623 static int net_rap_user_usage(int argc
, const char **argv
)
625 return net_help_user(argc
, argv
);
628 static void user_fn(const char *user_name
, void *state
)
630 d_printf("%-21.21s\n", user_name
);
633 static void long_user_fn(const char *user_name
, const char *comment
,
634 const char * home_dir
, const char * logon_script
,
637 d_printf("%-21.21s %s\n",
641 static void group_member_fn(const char *user_name
, void *state
)
643 d_printf("%-21.21s\n", user_name
);
646 static int rap_user_delete(int argc
, const char **argv
)
648 struct cli_state
*cli
;
652 d_printf("\n\nUser name not specified\n");
653 return net_rap_user_usage(argc
, argv
);
656 if (!(cli
= net_make_ipc_connection(0)))
659 ret
= cli_NetUserDelete(cli
, argv
[0]);
664 static int rap_user_add(int argc
, const char **argv
)
666 struct cli_state
*cli
;
668 RAP_USER_INFO_1 userinfo
;
671 d_printf("\n\nUser name not specified\n");
672 return net_rap_user_usage(argc
, argv
);
675 if (!(cli
= net_make_ipc_connection(0)))
678 safe_strcpy(userinfo
.user_name
, argv
[0], sizeof(userinfo
.user_name
)-1);
682 userinfo
.userflags
= opt_flags
;
683 userinfo
.reserved1
= '\0';
684 userinfo
.comment
= smb_xstrdup(opt_comment
);
686 userinfo
.home_dir
= NULL
;
687 userinfo
.logon_script
= NULL
;
689 ret
= cli_NetUserAdd(cli
, &userinfo
);
695 static int rap_user_info(int argc
, const char **argv
)
697 struct cli_state
*cli
;
700 d_printf("\n\nUser name not specified\n");
701 return net_rap_user_usage(argc
, argv
);
704 if (!(cli
= net_make_ipc_connection(0)))
707 ret
= cli_NetUserGetGroups(cli
, argv
[0], group_member_fn
, NULL
);
712 int net_rap_user(int argc
, const char **argv
)
715 struct functable func
[] = {
716 {"ADD", rap_user_add
},
717 {"INFO", rap_user_info
},
718 {"DELETE", rap_user_delete
},
723 struct cli_state
*cli
;
724 if (!(cli
= net_make_ipc_connection(0)))
726 if (opt_long_list_entries
) {
727 d_printf("\nUser name Comment"\
728 "\n-----------------------------\n");
729 ret
= cli_RNetUserEnum(cli
, long_user_fn
, NULL
);
733 ret
= cli_RNetUserEnum0(cli
, user_fn
, NULL
);
738 ret
= net_run_function(argc
, argv
, func
, net_rap_user_usage
);
741 DEBUG(1, ("Net user returned: %d\n", ret
));
747 int net_rap_group_usage(int argc
, const char **argv
)
749 return net_help_group(argc
, argv
);
752 static void long_group_fn(const char *group_name
, const char *comment
,
755 d_printf("%-21.21s %s\n", group_name
, comment
);
758 static void group_fn(const char *group_name
, void *state
)
760 d_printf("%-21.21s\n", group_name
);
763 static int rap_group_delete(int argc
, const char **argv
)
765 struct cli_state
*cli
;
768 d_printf("\n\nGroup name not specified\n");
769 return net_rap_group_usage(argc
, argv
);
772 if (!(cli
= net_make_ipc_connection(0)))
775 ret
= cli_NetGroupDelete(cli
, argv
[0]);
780 static int rap_group_add(int argc
, const char **argv
)
782 struct cli_state
*cli
;
784 RAP_GROUP_INFO_1 grinfo
;
787 d_printf("\n\nGroup name not specified\n");
788 return net_rap_group_usage(argc
, argv
);
791 if (!(cli
= net_make_ipc_connection(0)))
794 /* BB check for length 21 or smaller explicitly ? BB */
795 safe_strcpy(grinfo
.group_name
, argv
[0], sizeof(grinfo
.group_name
)-1);
796 grinfo
.reserved1
= '\0';
797 grinfo
.comment
= smb_xstrdup(opt_comment
);
799 ret
= cli_NetGroupAdd(cli
, &grinfo
);
804 int net_rap_group(int argc
, const char **argv
)
806 struct functable func
[] = {
807 {"ADD", rap_group_add
},
808 {"DELETE", rap_group_delete
},
813 struct cli_state
*cli
;
815 if (!(cli
= net_make_ipc_connection(0)))
817 if (opt_long_list_entries
) {
818 d_printf("Group name Comment\n");
819 d_printf("-----------------------------\n");
820 ret
= cli_RNetGroupEnum(cli
, long_group_fn
, NULL
);
824 ret
= cli_RNetGroupEnum0(cli
, group_fn
, NULL
);
829 return net_run_function(argc
, argv
, func
, net_rap_group_usage
);
832 int net_rap_groupmember_usage(int argc
, const char **argv
)
835 "net rap groupmember LIST <group> [misc. options] [targets]"\
836 "\n\t Enumerate users in a group\n"\
837 "\nnet rap groupmember DELETE <group> <user> [misc. options] "\
838 "[targets]\n\t Delete sepcified user from specified group\n"\
839 "\nnet rap groupmember ADD <group> <user> [misc. options] [targets]"\
840 "\n\t Add specified user to specified group\n");
842 net_common_flags_usage(argc
, argv
);
847 static int rap_groupmember_add(int argc
, const char **argv
)
849 struct cli_state
*cli
;
852 d_printf("\n\nGroup or user name not specified\n");
853 return net_rap_groupmember_usage(argc
, argv
);
856 if (!(cli
= net_make_ipc_connection(0)))
859 ret
= cli_NetGroupAddUser(cli
, argv
[0], argv
[1]);
864 static int rap_groupmember_delete(int argc
, const char **argv
)
866 struct cli_state
*cli
;
869 d_printf("\n\nGroup or user name not specified\n");
870 return net_rap_groupmember_usage(argc
, argv
);
873 if (!(cli
= net_make_ipc_connection(0)))
876 ret
= cli_NetGroupDelUser(cli
, argv
[0], argv
[1]);
881 static int rap_groupmember_list(int argc
, const char **argv
)
883 struct cli_state
*cli
;
886 d_printf("\n\nGroup name not specified\n");
887 return net_rap_groupmember_usage(argc
, argv
);
890 if (!(cli
= net_make_ipc_connection(0)))
893 ret
= cli_NetGroupGetUsers(cli
, argv
[0], group_member_fn
, NULL
);
898 int net_rap_groupmember(int argc
, const char **argv
)
900 struct functable func
[] = {
901 {"ADD", rap_groupmember_add
},
902 {"LIST", rap_groupmember_list
},
903 {"DELETE", rap_groupmember_delete
},
907 return net_run_function(argc
, argv
, func
, net_rap_groupmember_usage
);
910 int net_rap_validate_usage(int argc
, const char **argv
)
912 d_printf("net rap validate <username> [password]\n"\
913 "\tValidate user and password to check whether they"\
914 " can access target server or domain\n");
916 net_common_flags_usage(argc
, argv
);
920 int net_rap_validate(int argc
, const char **argv
)
922 return errmsg_not_implemented();
925 int net_rap_service_usage(int argc
, const char **argv
)
927 d_printf("net rap service [misc. options] [targets] \n"\
928 "\tlists all running service daemons on target server\n");
929 d_printf("\nnet rap service START <name> [service startup arguments]"\
930 " [misc. options] [targets]"\
931 "\n\tStart named service on remote server\n");
932 d_printf("\nnet rap service STOP <name> [misc. options] [targets]\n"\
933 "\n\tStop named service on remote server\n");
935 net_common_flags_usage(argc
, argv
);
939 static int rap_service_start(int argc
, const char **argv
)
941 return errmsg_not_implemented();
944 static int rap_service_stop(int argc
, const char **argv
)
946 return errmsg_not_implemented();
949 static void service_fn(const char *service_name
, const char *dummy
,
952 d_printf("%-21.21s\n", service_name
);
955 int net_rap_service(int argc
, const char **argv
)
957 struct functable func
[] = {
958 {"START", rap_service_start
},
959 {"STOP", rap_service_stop
},
964 struct cli_state
*cli
;
966 if (!(cli
= net_make_ipc_connection(0)))
969 if (opt_long_list_entries
) {
970 d_printf("Service name Comment\n");
971 d_printf("-----------------------------\n");
972 ret
= cli_RNetServiceEnum(cli
, long_group_fn
, NULL
);
974 ret
= cli_RNetServiceEnum(cli
, service_fn
, NULL
);
979 return net_run_function(argc
, argv
, func
, net_rap_service_usage
);
982 int net_rap_password_usage(int argc
, const char **argv
)
985 "net rap password <user> <oldpwo> <newpw> [misc. options] [target]\n"\
986 "\tchanges the password for the specified user at target\n");
992 int net_rap_password(int argc
, const char **argv
)
994 struct cli_state
*cli
;
998 return net_rap_password_usage(argc
, argv
);
1000 if (!(cli
= net_make_ipc_connection(0)))
1003 /* BB Add check for password lengths? */
1004 ret
= cli_oem_change_password(cli
, argv
[0], argv
[2], argv
[1]);
1009 int net_rap_admin_usage(int argc
, const char **argv
)
1012 "net rap admin <remote command> [cmd args [env]] [misc. options] [targets]"\
1013 "\n\texecutes a remote command on an os/2 target server\n");
1019 int net_rap_admin(int argc
, const char **argv
)
1021 return errmsg_not_implemented();
1024 /* The help subsystem for the RAP subcommand */
1026 int net_rap_usage(int argc
, const char **argv
)
1028 d_printf(" net rap domain \tto list domains \n"\
1029 " net rap file \t\tto list open files on a server \n"\
1030 " net rap group \tto list user groups \n"\
1031 " net rap groupmember \tto list users in a group \n"\
1032 " net rap password \tto change the password of a user\n"\
1033 " net rap printq \tto list the print queues on a server\n"\
1034 " net rap server \tto list servers in a domain\n"\
1035 " net rap session \tto list clients with open sessions to a server\n"\
1036 " net rap share \tto list shares exported by a server\n"\
1037 " net rap user \t\tto list users\n"\
1038 " net rap validate \tto check whether a user and the corresponding password are valid\n"\
1040 "\nType \"net help <option>\" to get more information on that option\n\n");
1042 net_common_flags_usage(argc
, argv
);
1047 handle "net rap help *" subcommands
1049 int net_rap_help(int argc
, const char **argv
)
1051 struct functable func
[] = {
1052 {"FILE", net_rap_file_usage
},
1053 {"SHARE", net_rap_share_usage
},
1054 {"SESSION", net_rap_session_usage
},
1055 {"SERVER", net_rap_server_usage
},
1056 {"DOMAIN", net_rap_domain_usage
},
1057 {"PRINTQ", net_rap_printq_usage
},
1058 {"USER", net_rap_user_usage
},
1059 {"GROUP", net_rap_group_usage
},
1060 {"VALIDATE", net_rap_validate_usage
},
1061 {"GROUPMEMBER", net_rap_groupmember_usage
},
1062 {"ADMIN", net_rap_admin_usage
},
1063 {"SERVICE", net_rap_service_usage
},
1064 {"PASSWORD", net_rap_password_usage
},
1067 return net_run_function(argc
, argv
, func
, net_rap_usage
);
1070 /* Entry-point for all the RAP functions. */
1072 int net_rap(int argc
, const char **argv
)
1074 struct functable func
[] = {
1075 {"FILE", net_rap_file
},
1076 {"SHARE", net_rap_share
},
1077 {"SESSION", net_rap_session
},
1078 {"SERVER", net_rap_server
},
1079 {"DOMAIN", net_rap_domain
},
1080 {"PRINTQ", net_rap_printq
},
1081 {"USER", net_rap_user
},
1082 {"GROUP", net_rap_group
},
1083 {"VALIDATE", net_rap_validate
},
1084 {"GROUPMEMBER", net_rap_groupmember
},
1085 {"ADMIN", net_rap_admin
},
1086 {"SERVICE", net_rap_service
},
1087 {"PASSWORD", net_rap_password
},
1088 {"HELP", net_rap_help
},
1092 return net_run_function(argc
, argv
, func
, net_rap_usage
);