From: Jeffrey Altman Date: Wed, 25 Apr 2007 22:55:58 +0000 (+0000) Subject: profile stores empty string values without double quotes X-Git-Tag: krb5-1.7-alpha1~1122 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=25ea5b495029ee066548f6d6c1006c0f938cb9aa;p=krb5.git profile stores empty string values without double quotes 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: new tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19529 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/util/profile/prof_parse.c b/src/util/profile/prof_parse.c index c5ef4f8e7..db491591d 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'))