summaryrefslogtreecommitdiff
path: root/src/db
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2012-03-19 08:03:32 +0100
committerStephen Gallagher <sgallagh@redhat.com>2012-03-21 11:22:43 -0400
commit5d7831167ccc418f2dec5d6621ea6f5a20874613 (patch)
treecf6f049145105a1b40db2c47e2543f9e3a663c2b /src/db
parent2b4332767d299263a288e0a74bbfbc9de674de95 (diff)
downloadsssd-5d7831167ccc418f2dec5d6621ea6f5a20874613.tar.gz
sssd-5d7831167ccc418f2dec5d6621ea6f5a20874613.tar.bz2
sssd-5d7831167ccc418f2dec5d6621ea6f5a20874613.zip
Save alias of the primary name, too
Diffstat (limited to 'src/db')
-rw-r--r--src/db/sysdb.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/db/sysdb.c b/src/db/sysdb.c
index 1bf18923..5436fb83 100644
--- a/src/db/sysdb.c
+++ b/src/db/sysdb.c
@@ -1731,7 +1731,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;
@@ -1776,8 +1776,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;