summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2007-04-20 12:23:36 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:19:32 -0500
commit956a5ce7d52f9f7d14c39e4086970a36b5871cd3 (patch)
tree7b55089944b4c05cdff8dee9c1530be0285e89dd
parente95c34dc6bbfd16f2f0a0cafa3c89ce0c20b8b06 (diff)
downloadsamba-956a5ce7d52f9f7d14c39e4086970a36b5871cd3.tar.gz
samba-956a5ce7d52f9f7d14c39e4086970a36b5871cd3.tar.bz2
samba-956a5ce7d52f9f7d14c39e4086970a36b5871cd3.zip
r22412: Add a "deletelocalgroup" subcommand to net sam.
Thanks to Karolin Seeger <ks@sernet.de>. (This used to be commit 1499c50513c091c06cc96e813856b3cdbebfe407)
-rw-r--r--source3/utils/net_sam.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/source3/utils/net_sam.c b/source3/utils/net_sam.c
index 3b7d604dc6..4d3102b51f 100644
--- a/source3/utils/net_sam.c
+++ b/source3/utils/net_sam.c
@@ -572,6 +572,46 @@ static int net_sam_createlocalgroup(int argc, const char **argv)
}
/*
+ * Delete a local group
+ */
+
+static int net_sam_deletelocalgroup(int argc, const char **argv)
+{
+ DOM_SID sid;
+ enum lsa_SidType type;
+ const char *dom, *name;
+ int ret;
+
+ if (argc != 1) {
+ d_fprintf(stderr, "usage: net sam deletelocalgroup <name>\n");
+ return -1;
+ }
+
+ if (!lookup_name(tmp_talloc_ctx(), argv[0], LOOKUP_NAME_ISOLATED,
+ &dom, &name, &sid, &type)) {
+ d_fprintf(stderr, "Could not find name %s.\n", argv[0]);
+ return -1;
+ }
+
+ if (type != SID_NAME_ALIAS) {
+ d_fprintf(stderr, "%s is a %s, not a local group.\n", argv[0],
+ sid_type_lookup(type));
+ return -1;
+ }
+
+ ret = pdb_delete_alias(&sid);
+
+ if ( !ret ) {
+ d_fprintf(stderr, "Could not delete local group %s.\n", argv[0]);
+ return -1;
+ }
+
+ d_printf("Deleted local group %s.\n", argv[0]);
+
+ return 0;
+}
+
+/*
* Create a local group
*/
@@ -1341,6 +1381,8 @@ int net_sam(int argc, const char **argv)
"Create a new BUILTIN group" },
{ "createlocalgroup", net_sam_createlocalgroup,
"Create a new local group" },
+ { "deletelocalgroup", net_sam_deletelocalgroup,
+ "Delete an existing local group" },
{ "mapunixgroup", net_sam_mapunixgroup,
"Map a unix group to a domain group" },
{ "addmem", net_sam_addmem,