Skip Menu |
 

To: krb5-bugs@mit.edu
Subject: profile library fails to handle space in front of comments
Date: Sun, 2 Nov 2003 18:48:18 -0500 (EST)
From: hartmans@MIT.EDU (Sam Hartman)


If you put white space in front of comments in krb5.conf,
krb5_init_context fails.
From: Michael Calmer <mc@suse.de>
To: krb5-bugs@mit.edu
Date: Wed, 6 Apr 2005 10:24:00 +0200
Subject: Request to change the comment syntax
Hi,

If i read the source code correct with MIT kerberos a comment sign is only
allowed at the beginning of the line. Is there a reason why spaces before the
comment sign aren't allowed?

I think many people wants do this:

[libdefaults]
#default_realm = EXAMPLE.COM
default_realm = MY.REALM

I think to change this behaviour is very easy.

============= original prof_parse.c ===================
[...]
if (line[0] == ';' || line[0] == '#')
return 0;
strip_line(line);
cp = skip_over_blanks(line);
ch = *cp;
if (ch == 0)
return 0;
[...]
========================================================

The only change is to do "skip_over_blanks(line)" first and after this, check
for a comment sign.

--
MFG

Michael Calmer

--------------------------------------------------------------------------
Michael Calmer
SUSE LINUX Products GmbH, Maxfeldstr. 5, D-90409 Nürnberg
T: +49 (0) 911 74053 0
F: +49 (0) 911 74053575 - Michael.Calmer@suse.com
--------------------------------------------------------------------------
Here's the trivial patch to fix this, courtesy of Jeremie Koenig.

--- krb5/trunk/krb5/src/util/profile/prof_parse.c 2005-07-11 03:25:00
UTC (rev 1924)
+++ krb5/trunk/krb5/src/util/profile/prof_parse.c 2005-07-11 22:48:16
UTC (rev 1925)
@@ -89,10 +89,10 @@

if (*line == 0)
return 0;
- if (line[0] == ';' || line[0] == '#')
+ cp = skip_over_blanks(line);
+ if (cp[0] == ';' || cp[0] == '#')
return 0;
- strip_line(line);
- cp = skip_over_blanks(line);
+ strip_line(cp);
ch = *cp;
if (ch == 0)
return 0;
This patch has been in Debian for a while without any problems. I know
that a new profile rewrite is coming, but it would be nice to put this
trivial patch into the next point release. -- rra@stanford.edu
From: Russ Allbery <rra@stanford.edu>
Subject: CVS Commit
Allow whitespace in front of comments. Patch from Jeremie Koenig.

Commit By: rra



Revision: 18118
Changed Files:
U trunk/src/util/profile/prof_parse.c