diff options
Diffstat (limited to 'server/confdb')
-rw-r--r-- | server/confdb/confdb.c | 44 | ||||
-rw-r--r-- | server/confdb/confdb.h | 3 |
2 files changed, 46 insertions, 1 deletions
diff --git a/server/confdb/confdb.c b/server/confdb/confdb.c index 4c895d5f..f86df6ca 100644 --- a/server/confdb/confdb.c +++ b/server/confdb/confdb.c @@ -333,7 +333,7 @@ int confdb_get_int(struct confdb_ctx *cdb, TALLOC_CTX *ctx, int defval, int *result) { char **values; - long int val; + long val; int ret; ret = confdb_get_param(cdb, ctx, section, attribute, &values); @@ -370,6 +370,43 @@ int confdb_get_int(struct confdb_ctx *cdb, TALLOC_CTX *ctx, return EOK; } +long confdb_get_long(struct confdb_ctx *cdb, TALLOC_CTX *ctx, + const char *section, const char *attribute, + long defval, long *result) +{ + char **values; + long val; + int ret; + + ret = confdb_get_param(cdb, ctx, section, attribute, &values); + if (ret != EOK) { + return ret; + } + + if (values[0]) { + if (values[1] != NULL) { + /* too many values */ + talloc_free(values); + return EINVAL; + } + + errno = 0; + val = strtol(values[0], NULL, 0); + if (errno) { + talloc_free(values); + return errno; + } + + } else { + val = defval; + } + + talloc_free(values); + + *result = val; + return EOK; +} + int confdb_get_bool(struct confdb_ctx *cdb, TALLOC_CTX *ctx, const char *section, const char *attribute, bool defval, bool *result) @@ -680,6 +717,11 @@ int confdb_get_domains(struct confdb_ctx *cdb, domain->legacy = true; } + domain->id_min = ldb_msg_find_attr_as_uint(res->msgs[i], + "minId", SSSD_MIN_ID); + domain->id_max = ldb_msg_find_attr_as_uint(res->msgs[i], + "maxId", 0); + ret = btreemap_set_value(mem_ctx, &domain_map, domain->name, domain, _domain_comparator); diff --git a/server/confdb/confdb.h b/server/confdb/confdb.h index de679035..dbddcecf 100644 --- a/server/confdb/confdb.h +++ b/server/confdb/confdb.h @@ -28,12 +28,15 @@ #include "util/btreemap.h" #define CONFDB_FILE "config.ldb" +#define SSSD_MIN_ID 1000 struct sss_domain_info { char *name; int timeout; int enumerate; bool legacy; + uint32_t id_min; + uint32_t id_max; }; struct confdb_ctx; |