summaryrefslogtreecommitdiff
path: root/src/db
diff options
context:
space:
mode:
authorOndrej Kos <okos@redhat.com>2012-11-23 10:21:45 +0100
committerJakub Hrozek <jhrozek@redhat.com>2012-11-23 16:41:49 +0100
commit2e7a2bece1b00022f826d511a3eb87453e285862 (patch)
treede719189410d3f5683bcc8f70b8e6168612ee616 /src/db
parent28761d3c03e0758dc6a5a76b406f23532d15d143 (diff)
downloadsssd-2e7a2bece1b00022f826d511a3eb87453e285862.tar.gz
sssd-2e7a2bece1b00022f826d511a3eb87453e285862.tar.bz2
sssd-2e7a2bece1b00022f826d511a3eb87453e285862.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/db')
-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 0eef6d03..80a323b1 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) {