From c61f9fe1781fc4da2fc9e7f11071a4827cb0e463 Mon Sep 17 00:00:00 2001 From: Pavel Březina Date: Jan 10 2017 07:52:29 +0000 Subject: sss_output_name: do not require fq name Now, we return the original name, assuming it is a shortname, instead of returning an error. Reviewed-by: Lukáš Slebodník (cherry picked from commit 7b293a5095ef3e63cd2e3f2ff01b7484bf6dcd38) --- diff --git a/src/util/usertools.c b/src/util/usertools.c index 12fc85b..7b87c56 100644 --- a/src/util/usertools.c +++ b/src/util/usertools.c @@ -787,7 +787,13 @@ char *sss_output_name(TALLOC_CTX *mem_ctx, if (!tmp_ctx) return NULL; ret = sss_parse_internal_fqname(tmp_ctx, name, &shortname, NULL); - if (ret != EOK) { + if (ret == ERR_WRONG_NAME_FORMAT) { + /* There is no domain name. */ + shortname = talloc_strdup(tmp_ctx, name); + if (shortname == NULL) { + goto done; + } + } else if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, "sss_parse_internal_fqname failed\n"); goto done; } @@ -796,14 +802,12 @@ char *sss_output_name(TALLOC_CTX *mem_ctx, if (outname == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, "sss_get_cased_name failed, skipping\n"); - ret = EIO; goto done; } outname = sss_replace_space(tmp_ctx, outname, replace_space); if (outname == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, "sss_replace_space failed\n"); - ret = EIO; goto done; }