Blob Blame History Raw
From a2cbd1f7bf100d11c56b72952b782a37d4a3e9de Mon Sep 17 00:00:00 2001
From: Ewald van Geffen <ewald@abcdef.be>
Date: Fri, 12 Aug 2016 17:41:53 +0200
Subject: [PATCH] config.c: fix parsing of 'su' directive

... to accept usernames starting with numeric symbols

Closes #53

Upstream-commit: 6c0dfc4a3d3b0535a4848d4ccb92631016a20a2d
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
 config.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/config.c b/config.c
index 64bb935..5e7951e 100644
--- a/config.c
+++ b/config.c
@@ -230,7 +230,12 @@ static int readModeUidGid(const char *configFile, int lineNum, char *key,
 	struct group *group;
 	struct passwd *pw = NULL;
 
-	rc = sscanf(key, "%o %199s %199s%c", &m, u, g, &tmp);
+	if (!strcmp("su", directive))
+	    /* do not read <mode> for the 'su' directive */
+	    rc = 0;
+	else
+	    rc = sscanf(key, "%o %199s %199s%c", &m, u, g, &tmp);
+
 	/* We support 'key <owner> <group> notation now */
 	if (rc == 0) {
 		rc = sscanf(key, "%199s %199s%c", u, g, &tmp);
-- 
2.7.4