summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOndrej Kos <okos@redhat.com>2012-11-23 10:21:45 +0100
committerJakub Hrozek <jhrozek@redhat.com>2012-11-27 11:21:38 +0100
commitf3d76a84c5cb9fe872114824018d9fbee52f691a (patch)
tree79f688d5ae2a86cfbb1486fdf8db6786de6075ed /src
parent2730efc0dedd834aa1bc5c0c42f73ec6a945b4c8 (diff)
downloadsssd-f3d76a84c5cb9fe872114824018d9fbee52f691a.tar.gz
sssd-f3d76a84c5cb9fe872114824018d9fbee52f691a.tar.xz
sssd-f3d76a84c5cb9fe872114824018d9fbee52f691a.zip
SYSDB: Don't operate with aliases same as name
fixes https://fedorahosted.org/sssd/ticket/1628 When user's alias is same as it's name, don't use it for searching in sysdb, and for deleting.
Diffstat (limited to 'src')
-rw-r--r--src/db/sysdb_ops.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
index 0eef6d039..80a323b12 100644
--- a/src/db/sysdb_ops.c
+++ b/src/db/sysdb_ops.c
@@ -1000,6 +1000,9 @@ int sysdb_add_user(struct sysdb_ctx *sysdb,
}
for (i = 0; i < alias_el->num_values; i++) {
+ if (strcmp((const char *)alias_el->values[i].data, name) == 0) {
+ continue;
+ }
filter = talloc_asprintf_append(filter, "(%s=%s)",
SYSDB_GHOST, alias_el->values[i].data);
if (filter == NULL) {
@@ -1083,6 +1086,9 @@ int sysdb_add_user(struct sysdb_ctx *sysdb,
/* Delete aliases from the ghost attribute as well */
for (j = 0; j < alias_el->num_values; j++) {
+ if (strcmp((const char *)alias_el->values[j].data, name) == 0) {
+ continue;
+ }
ret = ldb_msg_add_string(msg, SYSDB_GHOST,
(char *) alias_el->values[j].data);
if (ret != LDB_SUCCESS) {