Add "net sam createdomaingroup"
authorVolker Lendecke <vl@samba.org>
Sun, 7 Jun 2009 21:11:12 +0000 (23:11 +0200)
committerVolker Lendecke <vl@samba.org>
Sun, 7 Jun 2009 21:14:40 +0000 (23:14 +0200)
source3/utils/net_sam.c

index 6b3f5e572117781bb7c880fa76b214c060748a44..45dfb61cef123b2d4e8e2d3bd3f99c037a315428 100644 (file)
@@ -921,6 +921,34 @@ static int net_sam_unmapunixgroup(struct net_context *c, int argc, const char **
        return 0;
 }
 
+/*
+ * Create a domain group
+ */
+
+static int net_sam_createdomaingroup(struct net_context *c, int argc,
+                                    const char **argv)
+{
+       NTSTATUS status;
+       uint32 rid;
+
+       if (argc != 1 || c->display_usage) {
+               d_fprintf(stderr, "usage: net sam createdomaingroup <name>\n");
+               return -1;
+       }
+
+       status = pdb_create_dom_group(talloc_tos(), argv[0], &rid);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               d_fprintf(stderr, "Creating %s failed with %s\n",
+                         argv[0], nt_errstr(status));
+               return -1;
+       }
+
+       d_printf("Created domain group %s with RID %d\n", argv[0], rid);
+
+       return 0;
+}
+
 /*
  * Create a local group
  */
@@ -1829,6 +1857,14 @@ int net_sam(struct net_context *c, int argc, const char **argv)
                        "net sam createlocalgroup\n"
                        "    Create a new local group"
                },
+               {
+                       "createdomaingroup",
+                       net_sam_createdomaingroup,
+                       NET_TRANSPORT_LOCAL,
+                       "Create a new group",
+                       "net sam createdomaingroup\n"
+                       "    Create a new group"
+               },
                {
                        "deletelocalgroup",
                        net_sam_deletelocalgroup,