From b6c82f18f17cdded771d285930566c1d104686aa Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 7 Jun 2011 18:00:36 +0200 Subject: s3:idmap_tdb2: deprecate the idmap:script parameter and use "idmap config * : script" instead With this patch, "idmap config * : script" will override "idmap : script". If "idmap : script" is present, a deprecation warning will be printed in any case. If "idmap config * : script" is not set, then the value of "idmap :script" will be used for backwards compatibility. --- source3/winbindd/idmap_tdb2.c | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'source3/winbindd/idmap_tdb2.c') diff --git a/source3/winbindd/idmap_tdb2.c b/source3/winbindd/idmap_tdb2.c index 2a15244459..5612d57da7 100644 --- a/source3/winbindd/idmap_tdb2.c +++ b/source3/winbindd/idmap_tdb2.c @@ -279,6 +279,8 @@ static NTSTATUS idmap_tdb2_db_init(struct idmap_domain *dom) { NTSTATUS ret; struct idmap_tdb2_context *ctx; + char *config_option = NULL; + const char * idmap_script = NULL; ctx = talloc_zero(dom, struct idmap_tdb2_context); if ( ! ctx) { @@ -286,27 +288,28 @@ static NTSTATUS idmap_tdb2_db_init(struct idmap_domain *dom) return NT_STATUS_NO_MEMORY; } - if (strequal(dom->name, "*")) { - ctx->script = lp_parm_const_string(-1, "idmap", "script", NULL); - if (ctx->script) { - DEBUG(1, ("using idmap script '%s'\n", ctx->script)); - } - } else { - char *config_option = NULL; + config_option = talloc_asprintf(ctx, "idmap config %s", dom->name); + if (config_option == NULL) { + DEBUG(0, ("Out of memory!\n")); + ret = NT_STATUS_NO_MEMORY; + goto failed; + } + ctx->script = lp_parm_const_string(-1, config_option, "script", "NULL"); + talloc_free(config_option); - config_option = talloc_asprintf(ctx, "idmap config %s", dom->name); - if ( ! config_option) { - DEBUG(0, ("Out of memory!\n")); - ret = NT_STATUS_NO_MEMORY; - goto failed; - } + idmap_script = lp_parm_const_string(-1, "idmap", "script", NULL); + if (idmap_script != NULL) { + DEBUG(0, ("Warning: 'idmap:script' is deprecated. " + " Please use 'idmap config * : script' instead!\n")); + } - ctx->script = lp_parm_const_string(-1, config_option, "script", NULL); - if (ctx->script) { - DEBUG(1, ("using idmap script '%s'\n", ctx->script)); - } + if (strequal(dom->name, "*") && ctx->script == NULL) { + /* fall back to idmap:script for backwards compatibility */ + ctx->script = idmap_script; + } - talloc_free(config_option); + if (ctx->script) { + DEBUG(1, ("using idmap script '%s'\n", ctx->script)); } ctx->rw_ops = talloc_zero(ctx, struct idmap_rw_ops); -- cgit