diff options
author | Tom Yu <tlyu@mit.edu> | 2007-04-26 00:31:33 +0000 |
---|---|---|
committer | Tom Yu <tlyu@mit.edu> | 2007-04-26 00:31:33 +0000 |
commit | 0eabd7898f8c382382082d96e63a3b96ae737dea (patch) | |
tree | 944e57f0c355bc5869fdd6a05b8a803faff7c13a /src | |
parent | ad50f571d9de4490667f633c6c1b5fc3f1a89b25 (diff) | |
download | krb5-0eabd7898f8c382382082d96e63a3b96ae737dea.zip krb5-0eabd7898f8c382382082d96e63a3b96ae737dea.tar.gz krb5-0eabd7898f8c382382082d96e63a3b96ae737dea.tar.bz2 |
pull up r19529 from trunk
r19529@cathode-dark-space: jaltman | 2007-04-25 18:55:58 -0400
ticket: new
subject: profile stores empty string values without double quotes
tags: pullup
prof_parse.c (need_double_quotes):
The profile library will happily read in right hand values
that represent the empty string by parsing "". However,
when storing the same empty string back to a file, the
empty string is written without the double quotes.
This means that
[section] foo = ""
becomes
[section] foo =
which is invalid input. A subsequent attempt to parse the
profile will result in an invalid input error.
KFW and KFM's realm editors can inadvertently produce an
invalid krb5 profile if one of the ignored sections of the
input profile contains a right hand value that is "".
This patch was produced by Asanka Herath and it was reviewed
by jaltman and lxs.
ticket: 5547
version_fixed: 1.6.2
git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-6@19530 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r-- | src/util/profile/prof_parse.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/util/profile/prof_parse.c b/src/util/profile/prof_parse.c index c5ef4f8..db49159 100644 --- a/src/util/profile/prof_parse.c +++ b/src/util/profile/prof_parse.c @@ -306,8 +306,10 @@ errcode_t profile_parse_file(FILE *f, struct profile_node **root) */ static int need_double_quotes(char *str) { - if (!str || !*str) - return 0; + if (!str) + return 0; + if (*str) + return 1; if (isspace((int) (*str)) ||isspace((int) (*(str + strlen(str) - 1)))) return 1; if (strchr(str, '\n') || strchr(str, '\t') || strchr(str, '\b')) |