diff options
author | Wilco Baan Hofman <wilco@baanhofman.nl> | 2010-04-27 21:06:11 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2010-06-20 17:19:11 +0200 |
commit | 3b11a53304df29ebe2f2bfdeb5a6f0bf66553013 (patch) | |
tree | d21f56fb3f19ebba384c41ee898da3631d3e6b74 /source4/utils | |
parent | 698144851a07f66e7b786f5e1eb08d4670ddb619 (diff) | |
download | samba-3b11a53304df29ebe2f2bfdeb5a6f0bf66553013.tar.gz samba-3b11a53304df29ebe2f2bfdeb5a6f0bf66553013.tar.bz2 samba-3b11a53304df29ebe2f2bfdeb5a6f0bf66553013.zip |
Add fetch function for GPO which fetches all relevant files from the sysvol share.
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
Diffstat (limited to 'source4/utils')
-rw-r--r-- | source4/utils/net/net_gpo.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/source4/utils/net/net_gpo.c b/source4/utils/net/net_gpo.c index bfcb0f0ad2..386c48662a 100644 --- a/source4/utils/net/net_gpo.c +++ b/source4/utils/net/net_gpo.c @@ -440,6 +440,35 @@ static int net_gpo_inheritance_set(struct net_context *ctx, int argc, const char return 0; } +static int net_gpo_fetch(struct net_context *ctx, int argc, const char **argv) +{ + struct gp_context *gp_ctx; + struct gp_object *gpo; + const char *path; + NTSTATUS rv; + + 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_get_gpo_info(gp_ctx, argv[0], &gpo); + if (!NT_STATUS_IS_OK(rv)) { + DEBUG(0, ("Failed to get GPO: %s\n", get_friendly_nt_error_msg(rv))); + return 1; + } + + rv = gp_fetch_gpo(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; + } + d_printf("%s\n", path); + + 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 }, { "getgpo", "List specificied GPO\n", net_gpo_get_gpo, net_gpo_get_gpo_usage }, @@ -449,6 +478,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 }, { "list", "List all GPO's for a machine/user\n", net_gpo_list, net_gpo_list_usage }, + { "fetch", "Download a GPO\n", net_gpo_fetch, net_gpo_usage }, /* { "apply", "Apply GPO to container\n", net_gpo_apply, net_gpo_usage }, */ // { "refresh", "List all GPO's for machine/user and download them\n", net_gpo_refresh, net_gpo_refresh_usage }, { NULL, NULL } |