diff options
author | Lukas Slebodnik <lslebodn@redhat.com> | 2014-02-24 11:37:52 +0100 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2014-03-31 17:18:20 +0200 |
commit | 7885e87ae46bf1bba0882d42335587df576272cf (patch) | |
tree | 850c19789fdd83cd7ef0bc2c3cb0d8b97447de16 | |
parent | 6e8c466a16db3a29063eb3dfe2141acc5f6b876b (diff) | |
download | sssd-7885e87ae46bf1bba0882d42335587df576272cf.tar.gz sssd-7885e87ae46bf1bba0882d42335587df576272cf.tar.xz sssd-7885e87ae46bf1bba0882d42335587df576272cf.zip |
UTIL: Sanitize whitespaces.
Original patches submitted by: mpesari(Thanks!!)
It can cause problems if user will hit spaces before entering username.
(e.g in gdm). Spaces are ignored by LDAP; it's better to escape them.
Resolves:
https://fedorahosted.org/sssd/ticket/1955
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
(cherry picked from commit 2b8208b45feb2aab64d560d3e12e01e7b6d00d39)
-rw-r--r-- | src/util/util.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/util/util.c b/src/util/util.c index ab980775a..efa7e8650 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -557,6 +557,16 @@ errno_t sss_filter_sanitize(TALLOC_CTX *mem_ctx, while (input[i]) { switch(input[i]) { + case '\t': + output[j++] = '\\'; + output[j++] = '0'; + output[j++] = '9'; + break; + case ' ': + output[j++] = '\\'; + output[j++] = '2'; + output[j++] = '0'; + break; case '*': output[j++] = '\\'; output[j++] = '2'; |