summaryrefslogtreecommitdiff
path: root/source3/winbindd
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2011-06-07 18:00:36 +0200
committerMichael Adam <obnox@samba.org>2011-07-27 04:29:05 +0200
commitb6c82f18f17cdded771d285930566c1d104686aa (patch)
tree10a5ca5ac2a7f0d86a1db4c3ab598315474cb303 /source3/winbindd
parente98e0cf785ec1269cb5ab9f761d951d35d6792a1 (diff)
downloadsamba-b6c82f18f17cdded771d285930566c1d104686aa.tar.gz
samba-b6c82f18f17cdded771d285930566c1d104686aa.tar.bz2
samba-b6c82f18f17cdded771d285930566c1d104686aa.zip
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.
Diffstat (limited to 'source3/winbindd')
-rw-r--r--source3/winbindd/idmap_tdb2.c39
1 files changed, 21 insertions, 18 deletions
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);