summaryrefslogtreecommitdiffstats
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-30 08:31:03 -0400
commita27f24a9b3df42c2e5abaa3d4e878357145cddea (patch)
treedf41c214760da6bb27f524fa509899fd8586dee3 /src/db
parent8659882d100484a26a02a2e4dd1e4f2d424363a8 (diff)
downloadsssd-a27f24a9b3df42c2e5abaa3d4e878357145cddea.tar.gz
sssd-a27f24a9b3df42c2e5abaa3d4e878357145cddea.tar.xz
sssd-a27f24a9b3df42c2e5abaa3d4e878357145cddea.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 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;