From c4868005f3d81b62892593532e3a8dc53361da0b 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 | 10 +--------- 1 files changed, 1 insertions(+), 9 deletions(-) diff --git a/source3/winbindd/idmap_autorid.c b/source3/winbindd/idmap_autorid.c index 0e1750d..b28382f 100644 --- a/source3/winbindd/idmap_autorid.c +++ b/source3/winbindd/idmap_autorid.c @@ -438,15 +438,7 @@ 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(dom, struct autorid_global_config); + config = talloc_zero(frame, struct autorid_global_config); if (!config) { DEBUG(0, ("Out of memory!\n")); status = NT_STATUS_NO_MEMORY; -- 1.7.1 From 8278c43cf9eda25207385ead901b788f0353effd 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 b28382f..4e0fdff 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(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 951e64a57341d71b4bb53645ac9cf00fb5628b41 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 4e0fdff..e9048d8 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(frame, struct autorid_global_config); + config = talloc_zero(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 f0426d1b856689050d20aec6633862721c8be72d 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 e9048d8..f4ab754 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(dom, struct autorid_global_config); if (!config) { DEBUG(0, ("Out of memory!\n")); -- 1.7.1 From ad3ee62ad677a28b40ab4d75c43cfe687baf52cd 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 f4ab754..ef6c524 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 fadfeef20980139bb20c8fe39ba010acd08ba38c 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 ef6c524..ab533d9 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 9b5d3b2471105dabd1abdc7757378db2fb448397 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 ab533d9..cddbff2 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