From 2b8208b45feb2aab64d560d3e12e01e7b6d00d39 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Mon, 24 Feb 2014 11:37:52 +0100 Subject: 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 --- src/util/util.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/util/util.c b/src/util/util.c index 81ff3df92..fc37aad22 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -538,6 +538,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'; -- cgit