From 02d1cb8935d5c9b57cd05dfdbfe6ed38e0d61c28 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Wed, 29 May 2013 00:56:18 +0200 Subject: New utility function sss_get_domain_name Instead of copying a block of code that checks whether domain is a subdomain and uses only name of FQDN as appropriate, wrap the logic into a function. --- src/tools/sss_cache.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/tools') diff --git a/src/tools/sss_cache.c b/src/tools/sss_cache.c index f888608a..c9096fa9 100644 --- a/src/tools/sss_cache.c +++ b/src/tools/sss_cache.c @@ -219,14 +219,10 @@ static errno_t update_filter(struct cache_tool_ctx *tctx, } if (parsed_domain) { - if (IS_SUBDOMAIN(dinfo)) { - /* Use fqdn for subdomains */ - use_name = sss_tc_fqname(tmp_ctx, tctx->nctx, dinfo, name); - if (use_name == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Out of memory\n")); - ret = ENOMEM; - goto done; - } + use_name = sss_get_domain_name(tmp_ctx, use_name, dinfo); + if (!use_name) { + ret = ENOMEM; + goto done; } if (!strcasecmp(dinfo->name, parsed_domain)) { -- cgit