diff options
author | Wilco Baan Hofman <wilco@baanhofman.nl> | 2010-05-06 18:42:14 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2010-06-20 17:19:11 +0200 |
commit | 41fae89daf41128debbef4097e8646596441adfb (patch) | |
tree | eeba5e16c3d938aa9bccb9bab64f70a15c163a80 /source4/utils | |
parent | 32ee6f8cfddefff92e59e230c5920afec16ffd7d (diff) | |
download | samba-41fae89daf41128debbef4097e8646596441adfb.tar.gz samba-41fae89daf41128debbef4097e8646596441adfb.tar.bz2 samba-41fae89daf41128debbef4097e8646596441adfb.zip |
Add gpo create functionality. Also fix gPLink handling bugs
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
Diffstat (limited to 'source4/utils')
-rw-r--r-- | source4/utils/net/net_gpo.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/source4/utils/net/net_gpo.c b/source4/utils/net/net_gpo.c index a990098ed9..4a280a239c 100644 --- a/source4/utils/net/net_gpo.c +++ b/source4/utils/net/net_gpo.c @@ -470,7 +470,7 @@ static int net_gpo_fetch(struct net_context *ctx, int argc, const char **argv) return 1; } - rv = gp_fetch_gpo(gp_ctx, gpo, &path); + rv = gp_fetch_gpt(gp_ctx, gpo, &path); if (!NT_STATUS_IS_OK(rv)) { DEBUG(0, ("Failed to fetch GPO: %s\n", get_friendly_nt_error_msg(rv))); return 1; @@ -479,7 +479,38 @@ static int net_gpo_fetch(struct net_context *ctx, int argc, const char **argv) return 0; } +static int net_gpo_create_usage(struct net_context *ctx, int argc, const char **argv) +{ + d_printf("Syntax: net gpo create <displayname> [options]\n"); + d_printf("For a list of available options, please type net gpo create --help\n"); + return 0; +} + +static int net_gpo_create(struct net_context *ctx, int argc, const char **argv) +{ + struct gp_context *gp_ctx; + struct gp_object *gpo; + NTSTATUS rv; + + if (argc != 1) { + return net_gpo_create_usage(ctx, argc, argv); + } + + rv = gp_init(ctx, ctx->lp_ctx, ctx->credentials, ctx->event_ctx, &gp_ctx); + if (!NT_STATUS_IS_OK(rv)) { + DEBUG(0, ("Failed to connect to DC's LDAP: %s\n", get_friendly_nt_error_msg(rv))); + return 1; + } + + rv = gp_create_gpo(gp_ctx, argv[0], &gpo); + if (!NT_STATUS_IS_OK(rv)) { + DEBUG(0, ("Failed to create GPO: %s\n", get_friendly_nt_error_msg(rv))); + return 1; + } + + return 0; +} static const struct net_functable net_gpo_functable[] = { { "listall", "List all GPO's on a DC\n", net_gpo_list_all, net_gpo_list_all_usage }, { "list", "List all active GPO's for a machine/user\n", net_gpo_list, net_gpo_list_usage }, @@ -490,6 +521,7 @@ static const struct net_functable net_gpo_functable[] = { { "getinheritance", "Get inheritance flag from a container\n", net_gpo_inheritance_get, net_gpo_inheritance_get_usage }, { "setinheritance", "Set inheritance flag on a container\n", net_gpo_inheritance_set, net_gpo_inheritance_set_usage }, { "fetch", "Download a GPO\n", net_gpo_fetch, net_gpo_fetch_usage }, + { "create", "Create a GPO\n", net_gpo_create, net_gpo_create_usage }, { NULL, NULL } }; |