diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2015-08-18 15:15:44 +0000 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2015-09-21 17:03:01 +0200 |
commit | b5825c74b6bf7a99ae2172392dbecb51179013a6 (patch) | |
tree | 54b4e9904ed901c13cccbacad5b62c0a824205df /src/util | |
parent | 2cec08a3174bff951c048c57b4b0e4517ad6b7b1 (diff) | |
download | sssd-b5825c74b6bf7a99ae2172392dbecb51179013a6.tar.gz sssd-b5825c74b6bf7a99ae2172392dbecb51179013a6.tar.xz sssd-b5825c74b6bf7a99ae2172392dbecb51179013a6.zip |
UTIL: Convert domain->disabled into tri-state with domain states
Required for:
https://fedorahosted.org/sssd/ticket/2637
This is a first step towards making it possible for domain to be around,
but not contacted by Data Provider.
Also explicitly create domains as active, previously we only relied on
talloc_zero marking dom->disabled as false.
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/domain_info_utils.c | 20 | ||||
-rw-r--r-- | src/util/util.h | 3 | ||||
-rw-r--r-- | src/util/util_errors.c | 1 | ||||
-rw-r--r-- | src/util/util_errors.h | 1 |
4 files changed, 22 insertions, 3 deletions
diff --git a/src/util/domain_info_utils.c b/src/util/domain_info_utils.c index 4eabcff7a..ffbb9475b 100644 --- a/src/util/domain_info_utils.c +++ b/src/util/domain_info_utils.c @@ -50,7 +50,10 @@ struct sss_domain_info *get_next_domain(struct sss_domain_info *domain, } else { dom = NULL; } - if (dom && !dom->disabled) break; + + if (dom && sss_domain_get_state(dom) != DOM_DISABLED) { + break; + } } return dom; @@ -91,7 +94,7 @@ struct sss_domain_info *find_domain_by_name(struct sss_domain_info *domain, return NULL; } - while (dom && dom->disabled) { + while (dom && sss_domain_get_state(dom) == DOM_DISABLED) { dom = get_next_domain(dom, true); } while (dom) { @@ -119,7 +122,7 @@ struct sss_domain_info *find_domain_by_sid(struct sss_domain_info *domain, sid_len = strlen(sid); - while (dom && dom->disabled) { + while (dom && sss_domain_get_state(dom) == DOM_DISABLED) { dom = get_next_domain(dom, true); } @@ -730,3 +733,14 @@ done: return ret; } + +enum sss_domain_state sss_domain_get_state(struct sss_domain_info *dom) +{ + return dom->state; +} + +void sss_domain_set_state(struct sss_domain_info *dom, + enum sss_domain_state state) +{ + dom->state = state; +} diff --git a/src/util/util.h b/src/util/util.h index 3e29e7487..f9fe1ca71 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -566,6 +566,9 @@ struct sss_domain_info *find_domain_by_name(struct sss_domain_info *domain, bool match_any); struct sss_domain_info *find_domain_by_sid(struct sss_domain_info *domain, const char *sid); +enum sss_domain_state sss_domain_get_state(struct sss_domain_info *dom); +void sss_domain_set_state(struct sss_domain_info *dom, + enum sss_domain_state state); struct sss_domain_info* sss_get_domain_by_sid_ldap_fallback(struct sss_domain_info *domain, diff --git a/src/util/util_errors.c b/src/util/util_errors.c index fd6b9fbfe..ed19346d9 100644 --- a/src/util/util_errors.c +++ b/src/util/util_errors.c @@ -81,6 +81,7 @@ struct err_string error_to_str[] = { { "p11_child failed" }, /* ERR_P11_CHILD */ { "Address family not supported" }, /* ERR_ADDR_FAMILY_NOT_SUPPORTED */ { "Message sender is the bus" }, /* ERR_SBUS_SENDER_BUS */ + { "Subdomain is inactive" }, /* ERR_SUBDOM_INACTIVE */ { "ERR_LAST" } /* ERR_LAST */ }; diff --git a/src/util/util_errors.h b/src/util/util_errors.h index bda0c9b7d..c1d081912 100644 --- a/src/util/util_errors.h +++ b/src/util/util_errors.h @@ -103,6 +103,7 @@ enum sssd_errors { ERR_P11_CHILD, ERR_ADDR_FAMILY_NOT_SUPPORTED, ERR_SBUS_SENDER_BUS, + ERR_SUBDOM_INACTIVE, ERR_LAST /* ALWAYS LAST */ }; |