s3:libsmbconf: use talloc_free instead of TALLOC_FREE in testsuite
[Samba.git] / source3 / utils / net_group.c
blob2d5dba8b5882a4638b23fb22b489c53c794cfa23
1 /*
2 Samba Unix/Linux SMB client library
3 net group 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_group_usage(struct net_context *c, int argc, const char **argv)
27 d_printf("net [<method>] group [misc. options] [targets]"\
28 "\n\tList user groups\n\n");
29 d_printf("net rpc group LIST [global|local|builtin]* [misc. options]"\
30 "\n\tList specific user groups\n\n");
31 d_printf("net [<method>] group DELETE <name> "\
32 "[misc. options] [targets]"\
33 "\n\tDelete specified group\n");
34 d_printf("\nnet [<method>] group ADD <name> [-C comment] [-c container]"\
35 " [misc. options] [targets]\n\tCreate specified group\n");
36 d_printf("\nnet rpc group MEMBERS <name>\n\tList Group Members\n\n");
37 d_printf("\nnet rpc group ADDMEM <group> <member>\n\tAdd Group Members\n\n");
38 d_printf("\nnet rpc group DELMEM <group> <member>\n\tDelete Group Members\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 (for add only)\n");
42 d_printf("\t-c or --container=<container>\tLDAP container, defaults to cn=Users (for add in ADS only)\n");
43 d_printf("\t-L or --localgroup\t\tWhen adding groups, create a local group (alias)\n");
44 return -1;
47 int net_group(struct net_context *c, int argc, const char **argv)
49 if (argc < 1)
50 return net_group_usage(c, argc, argv);
52 if (StrCaseCmp(argv[0], "HELP") == 0) {
53 net_group_usage(c, argc, argv);
54 return 0;
57 if (net_ads_check(c) == 0)
58 return net_ads_group(c, argc, argv);
60 if (argc == 0 && net_rpc_check(c, NET_FLAGS_PDC))
61 return net_rpc_group(c,argc, argv);
63 return net_rap_group(c, argc, argv);