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 <gitster@pobox.com>
Junio C Hamano committed
Feb 6, 2010 at 11:26 UTC
ace706e2a6213d4252b6862786dd93c71bcbd69f
1 file changed
+8
-7
imap-send.c
+8
-7
@@ -1399,11 +1399,16 @@ static int git_imap_config(const char *key, const char *val, void *cb)
1399
if (strncmp(key, imap_key, sizeof imap_key - 1))
1400
return 0;
1401
1402
- if (!val)
1403
- return config_error_nonbool(key);
1404
-
1402
key += sizeof imap_key - 1;
1403
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
+
1412
if (!strcmp("folder", key)) {
1413
imap_folder = xstrdup(val);
1414
} else if (!strcmp("host", key)) {
@@ -1424,10 +1429,6 @@ static int git_imap_config(const char *key, const char *val, void *cb)
1429
server.port = git_config_int(key, val);
1430
else if (!strcmp("tunnel", key))
1431
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);
1432
return 0;
1433
}
1434