From a08c8bcc605dd0ae6592b1d34500a8fe363f1980 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 10 Jun 2011 00:36:17 +0200 Subject: [PATCH 1/7] Revert "s3:idmap_autorid: fail initialization if the domain is not "*"" This reverts commit cd8dc47bf17d2cdb1558dc6ab49320ba12af8f34. --- source3/winbindd/idmap_autorid.c | 8 -------- 1 files changed, 0 insertions(+), 8 deletions(-) diff --git a/source3/winbindd/idmap_autorid.c b/source3/winbindd/idmap_autorid.c index 80d8ed1..6252c5d 100644 --- a/source3/winbindd/idmap_autorid.c +++ b/source3/winbindd/idmap_autorid.c @@ -438,14 +438,6 @@ static NTSTATUS idmap_autorid_initialize(struct idmap_domain *dom) TALLOC_CTX *frame = talloc_stackframe(); char *config_option = NULL; - if (!strequal(dom->name, "*")) { - DEBUG(0, ("idmap_autorid_initialize: Error: autorid configured " - "for domain '%s'. But autorid can only be used for " - "the default idmap configuration.\n", dom->name)); - status = NT_STATUS_INVALID_PARAMETER; - goto error; - } - config = TALLOC_ZERO_P(frame, struct autorid_global_config); if (!config) { DEBUG(0, ("Out of memory!\n")); -- 1.7.1 From 93fa85632c0e913326c172a1dbedfc618b788559 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 10 Jun 2011 00:36:27 +0200 Subject: [PATCH 2/7] Revert "s3:idmap_autorid: use "idmap config : rangesize" instead of "autorid:rangesize"" This reverts commit b0b0b625b588057c8c97371934bf21eb1fd985d8. --- source3/winbindd/idmap_autorid.c | 10 +--------- 1 files changed, 1 insertions(+), 9 deletions(-) diff --git a/source3/winbindd/idmap_autorid.c b/source3/winbindd/idmap_autorid.c index 6252c5d..92cc9bc 100644 --- a/source3/winbindd/idmap_autorid.c +++ b/source3/winbindd/idmap_autorid.c @@ -436,7 +436,6 @@ static NTSTATUS idmap_autorid_initialize(struct idmap_domain *dom) NTSTATUS status; uint32_t hwm; TALLOC_CTX *frame = talloc_stackframe(); - char *config_option = NULL; config = TALLOC_ZERO_P(frame, struct autorid_global_config); if (!config) { @@ -450,15 +449,8 @@ static NTSTATUS idmap_autorid_initialize(struct idmap_domain *dom) goto error; } - config_option = talloc_asprintf(frame, "idmap config %s", dom->name); - if (config_option == NULL) { - DEBUG(0, ("Out of memory!\n")); - status = NT_STATUS_NO_MEMORY; - goto error; - } - config->minvalue = dom->low_id; - config->rangesize = lp_parm_int(-1, config_option, "rangesize", 100000); + config->rangesize = lp_parm_int(-1, "autorid", "rangesize", 100000); if (config->rangesize < 2000) { DEBUG(1, ("autorid rangesize must be at least 2000\n")); -- 1.7.1 From 5ca9a9d274554a94d8d56ecf7ecd0fbb3e5fae9c Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 10 Jun 2011 00:36:38 +0200 Subject: [PATCH 3/7] Revert "s3:idmap_autorid: add a talloc_stackframe() to idmap_autorid_initialize()" This reverts commit 65490ea4e67bf82cf8fb0b8e4e74047c3f63c509. --- source3/winbindd/idmap_autorid.c | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-) diff --git a/source3/winbindd/idmap_autorid.c b/source3/winbindd/idmap_autorid.c index 92cc9bc..1f4af33 100644 --- a/source3/winbindd/idmap_autorid.c +++ b/source3/winbindd/idmap_autorid.c @@ -435,13 +435,11 @@ static NTSTATUS idmap_autorid_initialize(struct idmap_domain *dom) struct autorid_global_config *storedconfig = NULL; NTSTATUS status; uint32_t hwm; - TALLOC_CTX *frame = talloc_stackframe(); - config = TALLOC_ZERO_P(frame, struct autorid_global_config); + config = TALLOC_ZERO_P(dom, struct autorid_global_config); if (!config) { DEBUG(0, ("Out of memory!\n")); - status = NT_STATUS_NO_MEMORY; - goto error; + return NT_STATUS_NO_MEMORY; } status = idmap_autorid_db_init(); @@ -482,7 +480,7 @@ static NTSTATUS idmap_autorid_initialize(struct idmap_domain *dom) config->minvalue, config->rangesize, config->maxranges)); /* read previously stored config and current HWM */ - storedconfig = idmap_autorid_loadconfig(frame); + storedconfig = idmap_autorid_loadconfig(talloc_tos()); if (!dbwrap_fetch_uint32(autorid_db, HWM, &hwm)) { DEBUG(1, ("Fatal error while fetching current " @@ -532,7 +530,8 @@ static NTSTATUS idmap_autorid_initialize(struct idmap_domain *dom) return NT_STATUS_OK; error: - talloc_free(frame); + talloc_free(config); + talloc_free(storedconfig); return status; } -- 1.7.1 From bcb3cfd862f316371ed2c0e4a04880938c43efc3 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 7 Jun 2011 15:53:49 +0200 Subject: [PATCH 4/7] s3:idmap_autorid: fail initialization if the domain is not "*" autorid can only be used as a backend for the default idmap configuration. --- source3/winbindd/idmap_autorid.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/source3/winbindd/idmap_autorid.c b/source3/winbindd/idmap_autorid.c index 1f4af33..7f93b78 100644 --- a/source3/winbindd/idmap_autorid.c +++ b/source3/winbindd/idmap_autorid.c @@ -436,6 +436,13 @@ static NTSTATUS idmap_autorid_initialize(struct idmap_domain *dom) NTSTATUS status; uint32_t hwm; + if (!strequal(dom->name, "*")) { + DEBUG(0, ("idmap_autorid_initialize: Error: autorid configured " + "for domain '%s'. But autorid can only be used for " + "the default idmap configuration.\n", dom->name)); + return NT_STATUS_INVALID_PARAMETER; + } + config = TALLOC_ZERO_P(dom, struct autorid_global_config); if (!config) { DEBUG(0, ("Out of memory!\n")); -- 1.7.1 From c5d10576dcb0f8c503d3aa25a493eceb49269950 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 10 Jun 2011 00:46:19 +0200 Subject: [PATCH 5/7] s3:idmap_autorid: use "idmap config * : rangesize" instead of "autorid : rangesize" --- source3/winbindd/idmap_autorid.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/source3/winbindd/idmap_autorid.c b/source3/winbindd/idmap_autorid.c index 7f93b78..ee6e54f 100644 --- a/source3/winbindd/idmap_autorid.c +++ b/source3/winbindd/idmap_autorid.c @@ -455,7 +455,7 @@ static NTSTATUS idmap_autorid_initialize(struct idmap_domain *dom) } config->minvalue = dom->low_id; - config->rangesize = lp_parm_int(-1, "autorid", "rangesize", 100000); + config->rangesize = lp_parm_int(-1, "idmap config *", "rangesize", 100000); if (config->rangesize < 2000) { DEBUG(1, ("autorid rangesize must be at least 2000\n")); -- 1.7.1 From 1fcb2a7a7ab5077d1de14716a47e08186d4848d6 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 10 Jun 2011 00:49:37 +0200 Subject: [PATCH 6/7] s3:idmap_autorid: in initialize, don't leak storedconfig to talloc_tos() in the success case --- source3/winbindd/idmap_autorid.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/source3/winbindd/idmap_autorid.c b/source3/winbindd/idmap_autorid.c index ee6e54f..39f6731 100644 --- a/source3/winbindd/idmap_autorid.c +++ b/source3/winbindd/idmap_autorid.c @@ -534,10 +534,12 @@ static NTSTATUS idmap_autorid_initialize(struct idmap_domain *dom) goto error; } - return NT_STATUS_OK; + goto done; - error: +error: talloc_free(config); + +done: talloc_free(storedconfig); return status; -- 1.7.1 From 496d513fa2b78fc927afa1a6c90acfa810e9504a Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 10 Jun 2011 00:50:42 +0200 Subject: [PATCH 7/7] s3:idmap_autorid: remove redundant code --- source3/winbindd/idmap_autorid.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/source3/winbindd/idmap_autorid.c b/source3/winbindd/idmap_autorid.c index 39f6731..4028a46 100644 --- a/source3/winbindd/idmap_autorid.c +++ b/source3/winbindd/idmap_autorid.c @@ -530,10 +530,6 @@ static NTSTATUS idmap_autorid_initialize(struct idmap_domain *dom) dom->private_data = config; - if (!NT_STATUS_IS_OK(status)) { - goto error; - } - goto done; error: -- 1.7.1