summaryrefslogtreecommitdiffstats
path: root/src/db
diff options
context:
space:
mode:
authorLukas Slebodnik <lslebodn@redhat.com>2013-11-25 16:01:59 +0100
committerJakub Hrozek <jhrozek@redhat.com>2013-12-02 16:43:16 +0100
commit0a509d518dd5d17e32e3a4c34b319a38210ba17b (patch)
tree61f8fa1f01c369123b05d882b7ef411952d5aa1b /src/db
parentbd24c6f485ac1421053167eabd6e5e963829403b (diff)
downloadsssd-0a509d518dd5d17e32e3a4c34b319a38210ba17b.tar.gz
sssd-0a509d518dd5d17e32e3a4c34b319a38210ba17b.tar.xz
sssd-0a509d518dd5d17e32e3a4c34b319a38210ba17b.zip
SYSDB: Sanitize filter before removing ghost attrs
sysdb_add_user fails with EIO if enumeration is disabled and user contains backslashes. We try to remove ghost attributes from groups with disabled enumeration, but unsanitized filter is used to find ghost attributes "(|(ghost=usr\\\\002)" and ldb cannot parse this filter. Resolves: https://fedorahosted.org/sssd/ticket/2163
Diffstat (limited to 'src/db')
-rw-r--r--src/db/sysdb_ops.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
index eb88cd256..890bf1eb3 100644
--- a/src/db/sysdb_ops.c
+++ b/src/db/sysdb_ops.c
@@ -1091,6 +1091,7 @@ sysdb_remove_ghostattr_from_groups(struct sysdb_ctx *sysdb,
struct ldb_dn *tmpdn;
const char *group_attrs[] = {SYSDB_NAME, SYSDB_GHOST, SYSDB_ORIG_MEMBER, NULL};
const char *userdn;
+ char *sanitized_name;
char *filter;
errno_t ret = EOK;
size_t group_count = 0;
@@ -1101,7 +1102,13 @@ sysdb_remove_ghostattr_from_groups(struct sysdb_ctx *sysdb,
return ENOENT;
}
- filter = talloc_asprintf(tmp_ctx, "(|(%s=%s)", SYSDB_GHOST, name);
+ ret = sss_filter_sanitize(tmp_ctx, name, &sanitized_name);
+ if (ret != EOK) {
+ goto done;
+ }
+
+ filter = talloc_asprintf(tmp_ctx, "(|(%s=%s)",
+ SYSDB_GHOST, sanitized_name);
if (!filter) {
ret = ENOMEM;
goto done;