From a27f24a9b3df42c2e5abaa3d4e878357145cddea Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Mon, 19 Mar 2012 08:03:32 +0100 Subject: Save alias of the primary name, too --- src/db/sysdb.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/db/sysdb.c') diff --git a/src/db/sysdb.c b/src/db/sysdb.c index c29382fe7..d3b479aa2 100644 --- a/src/db/sysdb.c +++ b/src/db/sysdb.c @@ -1680,7 +1680,7 @@ errno_t sysdb_attrs_get_aliases(TALLOC_CTX *mem_ctx, { TALLOC_CTX *tmp_ctx = NULL; struct ldb_message_element *sysdb_name_el; - size_t i, ai; + size_t i, j, ai; errno_t ret; const char **aliases = NULL; const char *name; @@ -1725,8 +1725,14 @@ errno_t sysdb_attrs_get_aliases(TALLOC_CTX *mem_ctx, goto done; } - if (sss_utf8_case_eq((const uint8_t *) primary, - (const uint8_t *) lower) == ENOMATCH) { + for (j=0; j < ai; j++) { + if (sss_utf8_case_eq((const uint8_t *) aliases[j], + (const uint8_t *) lower) == ENOMATCH) { + break; + } + } + + if (ai == 0 || j < ai) { aliases[ai] = talloc_strdup(aliases, lower); if (!aliases[ai]) { ret = ENOMEM; -- cgit