From 7b293a5095ef3e63cd2e3f2ff01b7484bf6dcd38 Mon Sep 17 00:00:00 2001 From: Pavel Březina Date: Tue, 22 Nov 2016 12:07:04 +0100 Subject: sss_output_name: do not require fq name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now, we return the original name, assuming it is a shortname, instead of returning an error. Reviewed-by: Lukáš Slebodník --- src/util/usertools.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/util') diff --git a/src/util/usertools.c b/src/util/usertools.c index 12fc85b8f..7b87c567a 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; } -- cgit