diff options
author | Volker Lendecke <vl@samba.org> | 2009-06-09 14:46:43 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2009-06-09 14:49:33 +0200 |
commit | 7e1470001613795a7699d5b11ac14e66c6ce76ce (patch) | |
tree | f38b8fc621de9747772bc3c9a61d95cfd15ea0f9 | |
parent | b5ca5412d86bd054b0865a3644c71624f3a8d017 (diff) | |
download | samba-7e1470001613795a7699d5b11ac14e66c6ce76ce.tar.gz samba-7e1470001613795a7699d5b11ac14e66c6ce76ce.tar.bz2 samba-7e1470001613795a7699d5b11ac14e66c6ce76ce.zip |
Implement "net sam deletedomaingroup"
-rw-r--r-- | source3/utils/net_sam.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/source3/utils/net_sam.c b/source3/utils/net_sam.c index ddf4d4e162..1919b40605 100644 --- a/source3/utils/net_sam.c +++ b/source3/utils/net_sam.c @@ -950,6 +950,51 @@ static int net_sam_createdomaingroup(struct net_context *c, int argc, } /* + * Delete a domain group + */ + +static int net_sam_deletedomaingroup(struct net_context *c, int argc, + const char **argv) +{ + DOM_SID sid; + uint32_t rid; + enum lsa_SidType type; + const char *dom, *name; + NTSTATUS status; + + if (argc != 1 || c->display_usage) { + d_fprintf(stderr, "usage: net sam deletelocalgroup <name>\n"); + return -1; + } + + if (!lookup_name(talloc_tos(), argv[0], LOOKUP_NAME_LOCAL, + &dom, &name, &sid, &type)) { + d_fprintf(stderr, "Could not find %s.\n", argv[0]); + return -1; + } + + if (type != SID_NAME_DOM_GRP) { + d_fprintf(stderr, "%s is a %s, not a domain group.\n", argv[0], + sid_type_lookup(type)); + return -1; + } + + sid_peek_rid(&sid, &rid); + + status = pdb_delete_dom_group(talloc_tos(), rid); + + if (!NT_STATUS_IS_OK(status)) { + d_fprintf(stderr, "Deleting domain group %s failed with %s\n", + argv[0], nt_errstr(status)); + return -1; + } + + d_printf("Deleted domain group %s.\n", argv[0]); + + return 0; +} + +/* * Create a local group */ @@ -1895,6 +1940,14 @@ int net_sam(struct net_context *c, int argc, const char **argv) " Delete an existing local group" }, { + "deletedomaingroup", + net_sam_deletedomaingroup, + NET_TRANSPORT_LOCAL, + "Delete a domain group", + "net sam deletedomaingroup\n" + " Delete a group" + }, + { "mapunixgroup", net_sam_mapunixgroup, NET_TRANSPORT_LOCAL, |