From d3b3e028818c80404e053ff0280c051d99728a69 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 6 Feb 2007 15:31:17 +0000 Subject: r21180: fix backwards compatible idmap backends parameter parsing (This used to be commit 01af19cc9d8e282ffd6ff6b52699ed2d0369ff69) --- source3/nsswitch/idmap.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/source3/nsswitch/idmap.c b/source3/nsswitch/idmap.c index 6e3e125ae4..4652980807 100644 --- a/source3/nsswitch/idmap.c +++ b/source3/nsswitch/idmap.c @@ -229,8 +229,8 @@ NTSTATUS idmap_init(void) { NTSTATUS ret; struct idmap_domain *dom; - const char *compat_backend = NULL; - const char *compat_params = NULL; + char *compat_backend = NULL; + char *compat_params = NULL; const char **dom_list = NULL; char *alloc_backend; BOOL default_already_defined = False; @@ -260,22 +260,30 @@ NTSTATUS idmap_init(void) DEBUGADD(0,("idmap backend option will be IGNORED!\n")); } else if ( lp_idmap_backend() ) { const char **compat_list = lp_idmap_backend(); - const char *p; + char *p; + const char *q; DEBUG(0, ("WARNING: idmap backend is deprecated!\n")); compat = 1; + if ( (compat_backend = talloc_strdup( idmap_ctx, *compat_list )) == NULL ) { + ret = NT_STATUS_NO_MEMORY; + goto done; + } + /* strip any leading idmap_ prefix of */ if (strncmp(*compat_list, "idmap_", 6) == 0 ) { - p = *compat_list += 6; + q = *compat_list += 6; DEBUG(0, ("WARNING: idmap backend uses obsolete and deprecated 'idmap_' prefix.\n")); DEBUGADD(0, (" Please replace 'idmap_%s' by '%s' in %s\n", p, p, dyn_CONFIGFILE)); - compat_backend = p; + compat_backend = talloc_strdup( idmap_ctx, q); } else { - compat_backend = *compat_list; + compat_backend = talloc_strdup( idmap_ctx, *compat_list); } + /* separate the backend and module arguements */ if ((p = strchr(compat_backend, ':')) != NULL) { + *p = '\0'; compat_params = p + 1; } } @@ -545,6 +553,9 @@ NTSTATUS idmap_init(void) goto done; } + /* cleanpu temporary strings */ + TALLOC_FREE( compat_backend ); + return NT_STATUS_OK; done: -- cgit