From 65490ea4e67bf82cf8fb0b8e4e74047c3f63c509 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 7 Jun 2011 15:16:24 +0200 Subject: [PATCH 1/4] s3:idmap_autorid: add a talloc_stackframe() to idmap_autorid_initialize() --- source3/winbindd/idmap_autorid.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/source3/winbindd/idmap_autorid.c b/source3/winbindd/idmap_autorid.c index 1f4af33..92cc9bc 100644 --- a/source3/winbindd/idmap_autorid.c +++ b/source3/winbindd/idmap_autorid.c @@ -435,11 +435,13 @@ 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(dom, struct autorid_global_config); + config = TALLOC_ZERO_P(frame, struct autorid_global_config); if (!config) { DEBUG(0, ("Out of memory!\n")); - return NT_STATUS_NO_MEMORY; + status = NT_STATUS_NO_MEMORY; + goto error; } status = idmap_autorid_db_init(); @@ -480,7 +482,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(talloc_tos()); + storedconfig = idmap_autorid_loadconfig(frame); if (!dbwrap_fetch_uint32(autorid_db, HWM, &hwm)) { DEBUG(1, ("Fatal error while fetching current " @@ -530,8 +532,7 @@ static NTSTATUS idmap_autorid_initialize(struct idmap_domain *dom) return NT_STATUS_OK; error: - talloc_free(config); - talloc_free(storedconfig); + talloc_free(frame); return status; } -- 1.7.1 From b0b0b625b588057c8c97371934bf21eb1fd985d8 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 7 Jun 2011 13:02:04 +0200 Subject: [PATCH 2/4] s3:idmap_autorid: use "idmap config : rangesize" instead of "autorid:rangesize" --- source3/winbindd/idmap_autorid.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/source3/winbindd/idmap_autorid.c b/source3/winbindd/idmap_autorid.c index 92cc9bc..6252c5d 100644 --- a/source3/winbindd/idmap_autorid.c +++ b/source3/winbindd/idmap_autorid.c @@ -436,6 +436,7 @@ 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) { @@ -449,8 +450,15 @@ 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, "autorid", "rangesize", 100000); + config->rangesize = lp_parm_int(-1, config_option, "rangesize", 100000); if (config->rangesize < 2000) { DEBUG(1, ("autorid rangesize must be at least 2000\n")); -- 1.7.1 From 95d35dde9cecac120c0a9bcd06957cd3748b15a0 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 7 Jun 2011 15:21:34 +0200 Subject: [PATCH 3/4] s3:docs: fix the example in the idmap_autorid manpage to use "idmap config * : rangesize" --- docs-xml/manpages-3/idmap_autorid.8.xml | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/docs-xml/manpages-3/idmap_autorid.8.xml b/docs-xml/manpages-3/idmap_autorid.8.xml index ac66384..b5a9bde 100644 --- a/docs-xml/manpages-3/idmap_autorid.8.xml +++ b/docs-xml/manpages-3/idmap_autorid.8.xml @@ -109,7 +109,7 @@ idmap config * : backend = autorid idmap config * : range = 1000000-19999999 - autorid:rangesize = 1000000 + idmap config * : rangesize = 1000000 idmap config TRUSTED : backend = ad idmap config TRUSTED : range = 50000 - 99999 -- 1.7.1 From 45b1818c1f562ac32bee97a66ac2de3861e6aef6 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 7 Jun 2011 15:53:49 +0200 Subject: [PATCH 4/4] 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 | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/source3/winbindd/idmap_autorid.c b/source3/winbindd/idmap_autorid.c index 6252c5d..80d8ed1 100644 --- a/source3/winbindd/idmap_autorid.c +++ b/source3/winbindd/idmap_autorid.c @@ -438,6 +438,14 @@ 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