From 2cfd9562a4e7fae31c226c12a467d0225d42a89f Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 31 Aug 2009 10:10:59 -0400 Subject: Turn enumeration into a boolean value --- server/confdb/confdb.c | 21 +++++++++++++++++---- server/confdb/confdb.h | 2 +- 2 files changed, 18 insertions(+), 5 deletions(-) (limited to 'server/confdb') diff --git a/server/confdb/confdb.c b/server/confdb/confdb.c index 70710d19f..03d8e67a9 100644 --- a/server/confdb/confdb.c +++ b/server/confdb/confdb.c @@ -683,7 +683,7 @@ int confdb_get_domain(struct confdb_ctx *cdb, TALLOC_CTX *tmp_ctx; struct ldb_dn *dn; const char *tmp; - int ret; + int ret, val; tmp_ctx = talloc_new(mem_ctx); if (!tmp_ctx) return ENOMEM; @@ -744,9 +744,21 @@ int confdb_get_domain(struct confdb_ctx *cdb, "timeout", 0); /* Determine if this domain can be enumerated */ - domain->enumerate = ldb_msg_find_attr_as_int(res->msgs[0], - "enumerate", 0); - if (domain->enumerate == 0) { + + /* TEMP: test if the old bitfield conf value is used and warn it has been + * superceeded. */ + val = ldb_msg_find_attr_as_int(res->msgs[0], "enumerate", 0); + if (val > 0) { /* ok there was a number in here */ + DEBUG(0, ("Warning: enumeration parameter in %s still uses integers! " + "Enumeration is now a boolean and takes true/false values. " + "Interpreting as true\n", domain->name)); + domain->enumerate = true; + } else { /* assume the new format */ + if (ldb_msg_find_attr_as_bool(res->msgs[0], "enumerate", 0)) { + domain->enumerate = true; + } + } + if (!domain->enumerate) { DEBUG(1, ("No enumeration for [%s]!\n", domain->name)); } @@ -782,6 +794,7 @@ int confdb_get_domain(struct confdb_ctx *cdb, } *_domain = domain; + ret = EOK; done: talloc_free(tmp_ctx); diff --git a/server/confdb/confdb.h b/server/confdb/confdb.h index 91eeff72d..f56508877 100644 --- a/server/confdb/confdb.h +++ b/server/confdb/confdb.h @@ -43,7 +43,7 @@ struct sss_domain_info { char *name; char *provider; int timeout; - int enumerate; + bool enumerate; bool fqnames; bool legacy; bool mpg; -- cgit