diff options
author | Lukas Slebodnik <lslebodn@redhat.com> | 2013-11-25 13:43:30 +0100 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-12-02 16:43:16 +0100 |
commit | bd24c6f485ac1421053167eabd6e5e963829403b (patch) | |
tree | b085be2edad75212e29a2396ef1bd4eecf91442d /src/db | |
parent | b7c339c616e88c0e8db5c5a653dacdedf19a147a (diff) | |
download | sssd-bd24c6f485ac1421053167eabd6e5e963829403b.tar.gz sssd-bd24c6f485ac1421053167eabd6e5e963829403b.tar.xz sssd-bd24c6f485ac1421053167eabd6e5e963829403b.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.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c index 094c27b7f..eb88cd256 100644 --- a/src/db/sysdb_ops.c +++ b/src/db/sysdb_ops.c @@ -2539,6 +2539,7 @@ int sysdb_delete_user(struct sysdb_ctx *sysdb, struct ldb_message *msg; int ret; int i; + char *sanitized_name; tmp_ctx = talloc_new(NULL); if (!tmp_ctx) { @@ -2578,7 +2579,13 @@ int sysdb_delete_user(struct sysdb_ctx *sysdb, } } 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; |