[SSSD] [PATCH] UTIL: Sanitize spaces.
Lukas Slebodnik
lslebodn at redhat.com
Tue Feb 25 18:07:28 UTC 2014
On (25/02/14 14:23), Jakub Hrozek wrote:
>On Mon, Feb 24, 2014 at 11:48:23AM +0100, Lukas Slebodnik wrote:
>> ehlo,
>>
>> resendig patch from trac to review.
>>
>> 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
>
>I tested that the issue the ticket describes is resolved and normal
>functionality (including lookups of groups with spaces, tested with
>"domain users") still works.
>
>So ACK to the patch
>
>>
>> Do we want to escape '\t' (horizontal tab) as well?
>>
>> LS
>
>We could, for completeness' sake, but I don't think that users would run
>into the issue described originally. The spacebar is much easier target
>than tab key :-)
Updated patch is attached.
LS
-------------- next part --------------
>From 1b61574e591d01904dcf527177ed24f4854cf556 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Mon, 24 Feb 2014 11:37:52 +0100
Subject: [PATCH] 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
---
src/util/util.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/util/util.c b/src/util/util.c
index 81ff3df922f9ad7cd26568bdcba2c9b6cff36390..fc37aad229813f328c9af007a005569bb02c5091 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';
--
1.8.5.3
More information about the sssd-devel
mailing list