From 70eaade10feedd7845e39170d0b7eebf3a030af1 Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Thu, 11 Oct 2012 12:35:32 +0200 Subject: Allow extdom exop to return flat domain name as well There are case where the extdom extended operation will return the flat or NetBIOS name of a domain instead of the DNS domain name. If this name is available for the current domain we accept it as well. Related to https://fedorahosted.org/sssd/ticket/1561 --- src/providers/ipa/ipa_subdomains.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/providers/ipa/ipa_subdomains.c') diff --git a/src/providers/ipa/ipa_subdomains.c b/src/providers/ipa/ipa_subdomains.c index 1da2b8cd..36ffafd9 100644 --- a/src/providers/ipa/ipa_subdomains.c +++ b/src/providers/ipa/ipa_subdomains.c @@ -80,6 +80,30 @@ struct ipa_subdomains_ctx { struct sysdb_subdom *subdoms; }; +const char *get_flat_name_from_subdomain_name(struct be_ctx *be_ctx, + const char *name) +{ + size_t c; + struct ipa_subdomains_ctx *ctx; + + ctx = talloc_get_type(be_ctx->bet_info[BET_SUBDOMAINS].pvt_bet_data, + struct ipa_subdomains_ctx); + if (ctx == NULL) { + DEBUG(SSSDBG_TRACE_ALL, ("Subdomains are not configured.\n")); + return NULL; + } + + for (c = 0; c < ctx->num_subdoms; c++) { + if (strcasecmp(ctx->subdoms[c].name, name) == 0 || + (ctx->subdoms[c].flat_name != NULL && + strcasecmp(ctx->subdoms[c].flat_name, name) == 0)) { + return ctx->subdoms[c].flat_name; + } + } + + return NULL; +} + static void ipa_subdomains_reply(struct be_req *be_req, int dp_err, int result) { if (be_req) { -- cgit