diff options
author | Gerald Carter <jerry@samba.org> | 2007-02-06 15:31:17 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:17:46 -0500 |
commit | d3b3e028818c80404e053ff0280c051d99728a69 (patch) | |
tree | 7b6151508f401987fbb183fe12d3be65ad91b26a | |
parent | 5f8840ec844067dba987e8e28d8e96b90338d15c (diff) | |
download | samba-d3b3e028818c80404e053ff0280c051d99728a69.tar.gz samba-d3b3e028818c80404e053ff0280c051d99728a69.tar.bz2 samba-d3b3e028818c80404e053ff0280c051d99728a69.zip |
r21180: fix backwards compatible idmap backends parameter parsing
(This used to be commit 01af19cc9d8e282ffd6ff6b52699ed2d0369ff69)
-rw-r--r-- | source3/nsswitch/idmap.c | 23 |
1 files 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: |