s3-spoolss: move SPL_ARCH_X defines to IDL.
[Samba.git] / source3 / utils / net_user.c
blobb98b6a13a7e9f4fac376de21312a325d4faa763d
1 /*
2 Samba Unix/Linux SMB client library
3 net user commands
4 Copyright (C) 2002 Jim McDonough (jmcd@us.ibm.com)
5 Copyright (C) 2002 Andrew Tridgell (tridge@samba.org)
6 Copyright (C) 2008 Kai Blin (kai@samba.org)
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "includes.h"
23 #include "utils/net.h"
25 int net_user_usage(struct net_context *c, int argc, const char **argv)
27 d_printf("\nnet [<method>] user [misc. options] [targets]"\
28 "\n\tList users\n\n");
29 d_printf("net [<method>] user DELETE <name> [misc. options] [targets]"\
30 "\n\tDelete specified user\n");
31 d_printf("\nnet [<method>] user INFO <name> [misc. options] [targets]"\
32 "\n\tList the domain groups of the specified user\n");
33 d_printf("\nnet [<method>] user ADD <name> [password] [-c container] "\
34 "[-F user flags] [misc. options]"\
35 " [targets]\n\tAdd specified user\n");
36 d_printf("\nnet [<method>] user RENAME <oldusername> <newusername>"\
37 " [targets]\n\tRename specified user\n\n");
39 net_common_methods_usage(c, argc, argv);
40 net_common_flags_usage(c, argc, argv);
41 d_printf("\t-C or --comment=<comment>\tdescriptive comment "\
42 "(for add only)\n");
43 d_printf("\t-c or --container=<container>\tLDAP container, defaults "\
44 "to cn=Users (for add in ADS only)\n");
45 return -1;
48 int net_user(struct net_context *c, int argc, const char **argv)
50 if (argc < 1)
51 return net_user_usage(c, argc, argv);
53 if (StrCaseCmp(argv[0], "HELP") == 0) {
54 net_user_usage(c, argc, argv);
55 return 0;
58 if (net_ads_check(c) == 0)
59 return net_ads_user(c, argc, argv);
61 /* if server is not specified, default to PDC? */
62 if (net_rpc_check(c, NET_FLAGS_PDC))
63 return net_rpc_user(c, argc, argv);
65 return net_rap_user(c, argc, argv);