svn commit: samba r22768 - in branches/SAMBA_3_0_26/source/utils: .

vlendec at samba.org vlendec at samba.org
Wed May 9 11:41:34 GMT 2007


Author: vlendec
Date: 2007-05-09 11:41:32 +0000 (Wed, 09 May 2007)
New Revision: 22768

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=22768

Log:
Merge from 3_0:

r22412 | obnox | 2007-04-20 14:23:36 +0200 (Fr, 20 Apr 2007) | 5 lines

Add a "deletelocalgroup" subcommand to net sam.

Thanks to Karolin Seeger <ks at sernet.de>.


Modified:
   branches/SAMBA_3_0_26/source/utils/net_sam.c


Changeset:
Modified: branches/SAMBA_3_0_26/source/utils/net_sam.c
===================================================================
--- branches/SAMBA_3_0_26/source/utils/net_sam.c	2007-05-09 11:40:48 UTC (rev 22767)
+++ branches/SAMBA_3_0_26/source/utils/net_sam.c	2007-05-09 11:41:32 UTC (rev 22768)
@@ -572,6 +572,46 @@
 }
 
 /*
+ * 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 @@
 		  "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,



More information about the samba-cvs mailing list