summaryrefslogtreecommitdiff
path: root/imap-send.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-02-06 19:26:35 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-02-08 23:08:31 (GMT)
commitace706e2a6213d4252b6862786dd93c71bcbd69f (patch)
tree865f474ae0da8af1e01cf357b6322d35bb146eda /imap-send.c
parentc64d84f1452ec56fd1586493a0b0707bf7442c42 (diff)
downloadgit-ace706e2a6213d4252b6862786dd93c71bcbd69f.zip
git-ace706e2a6213d4252b6862786dd93c71bcbd69f.tar.gz
git-ace706e2a6213d4252b6862786dd93c71bcbd69f.tar.bz2
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>
Diffstat (limited to 'imap-send.c')
-rw-r--r--imap-send.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/imap-send.c b/imap-send.c
index cb518eb..77acd68 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -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)) {
@@ -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;
}