From 2e7a2bece1b00022f826d511a3eb87453e285862 Mon Sep 17 00:00:00 2001 From: Ondrej Kos Date: Fri, 23 Nov 2012 10:21:45 +0100 Subject: 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. --- src/db/sysdb_ops.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/db') 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) { -- cgit