diff options
author | Michael Adam <obnox@samba.org> | 2013-01-28 16:31:23 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2013-02-05 17:36:32 +0100 |
commit | 1342bdd55c9759bc23f93298b34ed8d587816e6b (patch) | |
tree | 93264a4bd440357c4a8d525295543ce214fca1f8 /source3/param | |
parent | e7b39fba5e46f01e43250a758c69e3067400a0d3 (diff) | |
download | samba-1342bdd55c9759bc23f93298b34ed8d587816e6b.tar.gz samba-1342bdd55c9759bc23f93298b34ed8d587816e6b.tar.bz2 samba-1342bdd55c9759bc23f93298b34ed8d587816e6b.zip |
s3:param: add a utility function lp_idmap_range() to get the configured range for a given domain.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Christian Ambach <ambi@samba.org>
Diffstat (limited to 'source3/param')
-rw-r--r-- | source3/param/loadparm.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 2408839426..f581c8e1b6 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -2952,6 +2952,46 @@ static bool handle_idmap_gid(struct loadparm_context *unused, int snum, const ch return true; } +bool lp_idmap_range(const char *domain_name, uint32_t *low, uint32_t *high) +{ + char *config_option = NULL; + const char *range = NULL; + bool ret = false; + + SMB_ASSERT(low != NULL); + SMB_ASSERT(high != NULL); + + if ((domain_name == NULL) || (domain_name[0] == '\0')) { + domain_name = "*"; + } + + config_option = talloc_asprintf(talloc_tos(), "idmap config %s", + domain_name); + if (config_option == NULL) { + DEBUG(0, ("out of memory\n")); + return false; + } + + range = lp_parm_const_string(-1, config_option, "range", NULL); + if (range == NULL) { + DEBUG(1, ("idmap range not specified for domain '%s'\n", domain_name)); + goto done; + } + + if (sscanf(range, "%u - %u", low, high) != 2) { + DEBUG(1, ("error parsing idmap range '%s' for domain '%s'\n", + range, domain_name)); + goto done; + } + + ret = true; + +done: + talloc_free(config_option); + return ret; + +} + /*************************************************************************** Handle the DEBUG level list. ***************************************************************************/ |