[SSSD] [PATCH] UTIL: Sanitize spaces.

Lukas Slebodnik lslebodn at redhat.com
Mon Feb 24 10:48:23 UTC 2014


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

Do we want to escape '\t' (horizontal tab) as well?

LS
-------------- next part --------------
>From 3986e235bb2c253460ff9c2ec8acb2565cb67162 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 spaces.

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 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/util/util.c b/src/util/util.c
index 81ff3df922f9ad7cd26568bdcba2c9b6cff36390..1a1e7e918dcfe267b362be56ec0b68376b553829 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -558,6 +558,11 @@ errno_t sss_filter_sanitize(TALLOC_CTX *mem_ctx,
             output[j++] = '5';
             output[j++] = 'c';
             break;
+        case ' ':
+            output[j++] = '\\';
+            output[j++] = '2';
+            output[j++] = '0';
+            break;
         default:
             output[j++] = input[i];
         }
-- 
1.8.5.3



More information about the sssd-devel mailing list