diff options
author | Sumit Bose <sbose@redhat.com> | 2013-10-24 11:44:11 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-10-25 15:31:15 +0200 |
commit | 3cbbfb4b05d0eb0a0809704e83589d0075e117a0 (patch) | |
tree | c536c69260e2dc6829882649b0933e80264984dc /src/lib/idmap/sss_idmap.c | |
parent | 939246537b0b9a4af6862c513d3919501ad57d92 (diff) | |
download | sssd-3cbbfb4b05d0eb0a0809704e83589d0075e117a0.tar.gz sssd-3cbbfb4b05d0eb0a0809704e83589d0075e117a0.tar.xz sssd-3cbbfb4b05d0eb0a0809704e83589d0075e117a0.zip |
idmap: add sss_idmap_domain_by_name_has_algorithmic_mapping()
Diffstat (limited to 'src/lib/idmap/sss_idmap.c')
-rw-r--r-- | src/lib/idmap/sss_idmap.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/lib/idmap/sss_idmap.c b/src/lib/idmap/sss_idmap.c index 17bd5779e..9278e10d2 100644 --- a/src/lib/idmap/sss_idmap.c +++ b/src/lib/idmap/sss_idmap.c @@ -953,3 +953,36 @@ sss_idmap_domain_has_algorithmic_mapping(struct sss_idmap_ctx *ctx, return IDMAP_SID_UNKNOWN; } + +enum idmap_error_code +sss_idmap_domain_by_name_has_algorithmic_mapping(struct sss_idmap_ctx *ctx, + const char *dom_name, + bool *has_algorithmic_mapping) +{ + struct idmap_domain_info *idmap_domain_info; + + if (dom_name == NULL) { + return IDMAP_ERROR; + } + + CHECK_IDMAP_CTX(ctx, IDMAP_CONTEXT_INVALID); + + if (ctx->idmap_domain_info == NULL) { + return IDMAP_NO_DOMAIN; + } + + idmap_domain_info = ctx->idmap_domain_info; + + while (idmap_domain_info != NULL) { + if (idmap_domain_info->name != NULL + && strcmp(dom_name, idmap_domain_info->name) == 0) { + + *has_algorithmic_mapping = !idmap_domain_info->external_mapping; + return IDMAP_SUCCESS; + } + + idmap_domain_info = idmap_domain_info->next; + } + + return IDMAP_NAME_UNKNOWN; +} |