s3: in sys_popen(), improve call to pipe and report error to debug
[Samba.git] / source3 / utils / net_group.c
blob505856a00807e4d5f8e8373a36335140f357cadb
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] "
35 "[-c container] [misc. options] [targets]\n"
36 "\tCreate specified group\n"));
37 d_printf(_("\nnet rpc group MEMBERS <name>\n\tList Group Members\n\n"));
38 d_printf(_("\nnet rpc group ADDMEM <group> <member>\n"
39 "\tAdd Group Members\n\n"));
40 d_printf(_("\nnet rpc group DELMEM <group> <member>\n"
41 "\tDelete Group Members\n\n"));
42 net_common_methods_usage(c, argc, argv);
43 net_common_flags_usage(c, argc, argv);
44 d_printf(_("\t-C or --comment=<comment>\tdescriptive comment "
45 "(for add only)\n"));
46 d_printf(_("\t-c or --container=<container>\tLDAP container, "
47 "defaults to cn=Users (for add in ADS only)\n"));
48 d_printf(_("\t-L or --localgroup\t\tWhen adding groups, "
49 "create a local group (alias)\n"));
50 return -1;
53 int net_group(struct net_context *c, int argc, const char **argv)
55 if (argc < 1)
56 return net_group_usage(c, argc, argv);
58 if (strcasecmp_m(argv[0], "HELP") == 0) {
59 net_group_usage(c, argc, argv);
60 return 0;
63 if (net_ads_check(c) == 0)
64 return net_ads_group(c, argc, argv);
66 return net_rap_group(c, argc, argv);