Skip to content

Commit

Permalink
Fix parsing of imap.preformattedHTML and imap.sslverify
Browse files Browse the repository at this point in the history
These two variables are boolean and can lack "= value" in the
configuration file.  Do not reject such input early in the
parser callback function.

Also the key are downcased before being given to the callback,
so we should run strcmp() with keyword spelled in all-lowercase.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Feb 8, 2010
1 parent c64d84f commit ace706e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions imap-send.c
Original file line number Diff line number Diff line change
Expand Up @@ -1399,11 +1399,16 @@ static int git_imap_config(const char *key, const char *val, void *cb)
if (strncmp(key, imap_key, sizeof imap_key - 1))
return 0;

if (!val)
return config_error_nonbool(key);

key += sizeof imap_key - 1;

/* check booleans first, and barf on others */
if (!strcmp("sslverify", key))
server.ssl_verify = git_config_bool(key, val);
else if (!strcmp("preformattedhtml", key))
server.use_html = git_config_bool(key, val);
else if (!val)
return config_error_nonbool(key);

if (!strcmp("folder", key)) {
imap_folder = xstrdup(val);
} else if (!strcmp("host", key)) {
Expand All @@ -1424,10 +1429,6 @@ static int git_imap_config(const char *key, const char *val, void *cb)
server.port = git_config_int(key, val);
else if (!strcmp("tunnel", key))
server.tunnel = xstrdup(val);
else if (!strcmp("sslverify", key))
server.ssl_verify = git_config_bool(key, val);
else if (!strcmp("preformattedHTML", key))
server.use_html = git_config_bool(key, val);
return 0;
}

Expand Down

0 comments on commit ace706e

Please sign in to comment.