Skip to content

Commit ace706e

Browse files
committed
Fix parsing of imap.preformattedHTML and imap.sslverify
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 <[email protected]>
1 parent c64d84f commit ace706e

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

imap-send.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,11 +1399,16 @@ static int git_imap_config(const char *key, const char *val, void *cb)
13991399
if (strncmp(key, imap_key, sizeof imap_key - 1))
14001400
return 0;
14011401

1402-
if (!val)
1403-
return config_error_nonbool(key);
1404-
14051402
key += sizeof imap_key - 1;
14061403

1404+
/* check booleans first, and barf on others */
1405+
if (!strcmp("sslverify", key))
1406+
server.ssl_verify = git_config_bool(key, val);
1407+
else if (!strcmp("preformattedhtml", key))
1408+
server.use_html = git_config_bool(key, val);
1409+
else if (!val)
1410+
return config_error_nonbool(key);
1411+
14071412
if (!strcmp("folder", key)) {
14081413
imap_folder = xstrdup(val);
14091414
} else if (!strcmp("host", key)) {
@@ -1424,10 +1429,6 @@ static int git_imap_config(const char *key, const char *val, void *cb)
14241429
server.port = git_config_int(key, val);
14251430
else if (!strcmp("tunnel", key))
14261431
server.tunnel = xstrdup(val);
1427-
else if (!strcmp("sslverify", key))
1428-
server.ssl_verify = git_config_bool(key, val);
1429-
else if (!strcmp("preformattedHTML", key))
1430-
server.use_html = git_config_bool(key, val);
14311432
return 0;
14321433
}
14331434

0 commit comments

Comments
 (0)