diff options
author | Fabiano FidĂȘncio <fidencio@redhat.com> | 2017-06-20 14:22:48 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2017-06-21 11:28:15 +0200 |
commit | fa2fc8a2908619031292eaf375eb1a510b8b2eba (patch) | |
tree | 2585a8120be8bfabac34af65cb2ef5ced35dd6e9 | |
parent | 86526891366c4bc3e1ee861143b736d2670a6ba8 (diff) | |
download | sssd-fa2fc8a2908619031292eaf375eb1a510b8b2eba.tar.gz sssd-fa2fc8a2908619031292eaf375eb1a510b8b2eba.tar.xz sssd-fa2fc8a2908619031292eaf375eb1a510b8b2eba.zip |
DOMAIN: Add sss_domain_info_{get,set}_output_fqnames()
Let's avoid setting a domain's property directly from cr_domain code.
In order to do so, let's introduce a setter, which may help us in the
future whenever we decide to make sss_domain_info an opaque structure.
For completeness, a getter has also been introduced and used in the
usertools code.
Related:
https://pagure.io/SSSD/sssd/issue/3403
Signed-off-by: Fabiano FidĂȘncio <fidencio@redhat.com>
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
-rw-r--r-- | src/confdb/confdb.h | 5 | ||||
-rw-r--r-- | src/responder/common/cache_req/cache_req_domain.c | 4 | ||||
-rw-r--r-- | src/util/domain_info_utils.c | 11 | ||||
-rw-r--r-- | src/util/usertools.c | 2 | ||||
-rw-r--r-- | src/util/util.h | 5 |
5 files changed, 23 insertions, 4 deletions
diff --git a/src/confdb/confdb.h b/src/confdb/confdb.h index 32a422155..2ba1bc47e 100644 --- a/src/confdb/confdb.h +++ b/src/confdb/confdb.h @@ -291,7 +291,6 @@ struct sss_domain_info { bool enumerate; char **sd_enumerate; bool fqnames; - bool output_fqnames; bool mpg; bool ignore_group_members; uint32_t id_min; @@ -355,6 +354,10 @@ struct sss_domain_info { struct certmap_info **certmaps; bool user_name_hint; + + /* Do not use the _output_fqnames property directly in new code, but rather + * use sss_domain_info_{get,set}_output_fqnames(). */ + bool output_fqnames; }; /** diff --git a/src/responder/common/cache_req/cache_req_domain.c b/src/responder/common/cache_req/cache_req_domain.c index bad4bf9a6..7b58f7c94 100644 --- a/src/responder/common/cache_req/cache_req_domain.c +++ b/src/responder/common/cache_req/cache_req_domain.c @@ -136,7 +136,7 @@ cache_req_domain_new_list_from_string_list(TALLOC_CTX *mem_ctx, * input is allowed by default. However, we really want to use * the fully qualified name as output in order to avoid * conflicts whith users who have the very same name. */ - cr_domain->domain->output_fqnames = true; + sss_domain_info_set_output_fqnames(cr_domain->domain, true); DLIST_ADD_END(cr_domains, cr_domain, struct cache_req_domain *); @@ -166,7 +166,7 @@ cache_req_domain_new_list_from_string_list(TALLOC_CTX *mem_ctx, * qualified name as output in order to avoid conflicts whith users * who have the very same name. */ if (resolution_order != NULL) { - cr_domain->domain->output_fqnames = true; + sss_domain_info_set_output_fqnames(cr_domain->domain, true); } DLIST_ADD_END(cr_domains, cr_domain, struct cache_req_domain *); diff --git a/src/util/domain_info_utils.c b/src/util/domain_info_utils.c index 46375656c..1aacfa283 100644 --- a/src/util/domain_info_utils.c +++ b/src/util/domain_info_utils.c @@ -905,3 +905,14 @@ const char *sss_domain_type_str(struct sss_domain_info *dom) } return "Unknown"; } + +void sss_domain_info_set_output_fqnames(struct sss_domain_info *domain, + bool output_fqnames) +{ + domain->output_fqnames = output_fqnames; +} + +bool sss_domain_info_get_output_fqnames(struct sss_domain_info *domain) +{ + return domain->output_fqnames; +} diff --git a/src/util/usertools.c b/src/util/usertools.c index 83131da1c..33f4f7811 100644 --- a/src/util/usertools.c +++ b/src/util/usertools.c @@ -867,7 +867,7 @@ int sss_output_fqname(TALLOC_CTX *mem_ctx, goto done; } - if (domain->output_fqnames || domain->fqnames) { + if (sss_domain_info_get_output_fqnames(domain) || domain->fqnames) { output_name = sss_tc_fqname(tmp_ctx, domain->names, domain, output_name); if (output_name == NULL) { diff --git a/src/util/util.h b/src/util/util.h index 2434d9b3c..934fae37d 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -562,6 +562,11 @@ errno_t sssd_domain_init(TALLOC_CTX *mem_ctx, const char *db_path, struct sss_domain_info **_domain); +void sss_domain_info_set_output_fqnames(struct sss_domain_info *domain, + bool output_fqname); + +bool sss_domain_info_get_output_fqnames(struct sss_domain_info *domain); + #define IS_SUBDOMAIN(dom) ((dom)->parent != NULL) #define DOM_HAS_VIEWS(dom) ((dom)->has_views) |