summaryrefslogtreecommitdiffstats
path: root/src/db
diff options
context:
space:
mode:
authorLukas Slebodnik <lslebodn@redhat.com>2013-11-25 13:43:30 +0100
committerJakub Hrozek <jhrozek@redhat.com>2013-11-28 10:39:06 +0100
commite167b504d0cb3f3e69c9f556fe7dfabacd6bb694 (patch)
treeebb974a95f5ad892a9330703d335b69179de8bf8 /src/db
parentf74d7744f1b12fe0492eadfc8cf30afcb4092e40 (diff)
downloadsssd-e167b504d0cb3f3e69c9f556fe7dfabacd6bb694.tar.gz
sssd-e167b504d0cb3f3e69c9f556fe7dfabacd6bb694.tar.xz
sssd-e167b504d0cb3f3e69c9f556fe7dfabacd6bb694.zip
SYSDB: Sanitize filter before sysdb_search_groups
sysdb_delete_user fails with EIO if user does not exist and contains backslashes. ldb could not parse filter (&(objectclass=group)(ghost=usr\\\\001)), because ghost value was not sanitized 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 c08415b09..b4ed202cc 100644
--- a/src/db/sysdb_ops.c
+++ b/src/db/sysdb_ops.c
@@ -2502,6 +2502,7 @@ int sysdb_delete_user(struct sss_domain_info *domain,
struct ldb_message *msg;
int ret;
int i;
+ char *sanitized_name;
tmp_ctx = talloc_new(NULL);
if (!tmp_ctx) {
@@ -2539,7 +2540,13 @@ int sysdb_delete_user(struct sss_domain_info *domain,
}
} else if (ret == ENOENT && name != NULL) {
/* Perhaps a ghost user? */
- filter = talloc_asprintf(tmp_ctx, "(%s=%s)", SYSDB_GHOST, name);
+ ret = sss_filter_sanitize(tmp_ctx, name, &sanitized_name);
+ if (ret != EOK) {
+ goto fail;
+ }
+
+ filter = talloc_asprintf(tmp_ctx, "(%s=%s)",
+ SYSDB_GHOST, sanitized_name);
if (filter == NULL) {
ret = ENOMEM;
goto fail;