summaryrefslogtreecommitdiff
path: root/source3/winbindd/winbindd_util.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-07-13 12:07:40 +0200
committerVolker Lendecke <vl@samba.org>2008-08-12 11:28:29 +0200
commit340ab6a256802a22c11b7f707748397249075b65 (patch)
tree20d297829eb3e27c6c80ad537712627ae845a4ef /source3/winbindd/winbindd_util.c
parent8d4bd2d960ebf11bc85891210c6f72a371e08417 (diff)
downloadsamba-340ab6a256802a22c11b7f707748397249075b65.tar.gz
samba-340ab6a256802a22c11b7f707748397249075b65.tar.bz2
samba-340ab6a256802a22c11b7f707748397249075b65.zip
idmap rewrite
(This used to be commit 30a180f2fce8cf6a3e5548f6bba453272ba70b33)
Diffstat (limited to 'source3/winbindd/winbindd_util.c')
-rw-r--r--source3/winbindd/winbindd_util.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c
index a35ba7bc06..f1da5780aa 100644
--- a/source3/winbindd/winbindd_util.c
+++ b/source3/winbindd/winbindd_util.c
@@ -109,6 +109,8 @@ static struct winbindd_domain *add_trusted_domain(const char *domain_name, const
{
struct winbindd_domain *domain;
const char *alternative_name = NULL;
+ char *idmap_config_option;
+ const char *param;
/* ignore alt_name if we are not in an AD domain */
@@ -181,12 +183,44 @@ static struct winbindd_domain *add_trusted_domain(const char *domain_name, const
if (sid) {
sid_copy(&domain->sid, sid);
}
+
/* Link to domain list */
DLIST_ADD_END(_domain_list, domain, struct winbindd_domain *);
wcache_tdc_add_domain( domain );
+ idmap_config_option = talloc_asprintf(talloc_tos(), "idmap config %s",
+ domain->name);
+ if (idmap_config_option == NULL) {
+ DEBUG(0, ("talloc failed, not looking for idmap config\n"));
+ goto done;
+ }
+
+ param = lp_parm_const_string(-1, idmap_config_option, "range", NULL);
+
+ DEBUG(10, ("%s : range = %s\n", idmap_config_option,
+ param ? param : "not defined"));
+
+ if (param != NULL) {
+ unsigned low_id, high_id;
+ if (sscanf(param, "%u - %u", &low_id, &high_id) != 2) {
+ DEBUG(1, ("invalid range syntax in %s: %s\n",
+ idmap_config_option, param));
+ goto done;
+ }
+ if (low_id > high_id) {
+ DEBUG(1, ("invalid range in %s: %s\n",
+ idmap_config_option, param));
+ goto done;
+ }
+ domain->have_idmap_config = true;
+ domain->id_range_low = low_id;
+ domain->id_range_high = high_id;
+ }
+
+done:
+
DEBUG(2,("Added domain %s %s %s\n",
domain->name, domain->alt_name,
&domain->sid?sid_string_dbg(&domain->sid):""));