summaryrefslogtreecommitdiff
path: root/src/app.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-03-02 13:05:02 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-03-02 13:05:02 +0200
commitf992ba117fe420a7231f005e62627380689d57ab (patch)
treecd8310f3deafb78f910832aaf47b2ff7ac98aa05 /src/app.c
parentff52105505dfa74fc93016aace904a1f1e86b570 (diff)
Server certificates may also be verified by CAs
If the CA file/path are configured in preferences, trust CA verification over manual TOFU checks.
Diffstat (limited to 'src/app.c')
-rw-r--r--src/app.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/app.c b/src/app.c
index 9a7ced62..29d0dd17 100644
--- a/src/app.c
+++ b/src/app.c
@@ -224,6 +224,8 @@ static iString *serializePrefs_App_(const iApp *d) {
224 appendFormat_String(str, "doctheme.dark.set arg:%d\n", d->prefs.docThemeDark); 224 appendFormat_String(str, "doctheme.dark.set arg:%d\n", d->prefs.docThemeDark);
225 appendFormat_String(str, "doctheme.light.set arg:%d\n", d->prefs.docThemeLight); 225 appendFormat_String(str, "doctheme.light.set arg:%d\n", d->prefs.docThemeLight);
226 appendFormat_String(str, "saturation.set arg:%d\n", (int) ((d->prefs.saturation * 100) + 0.5f)); 226 appendFormat_String(str, "saturation.set arg:%d\n", (int) ((d->prefs.saturation * 100) + 0.5f));
227 appendFormat_String(str, "ca.file noset:1 path:%s\n", cstr_String(&d->prefs.caFile));
228 appendFormat_String(str, "ca.path path:%s\n", cstr_String(&d->prefs.caPath));
227 appendFormat_String(str, "proxy.gemini address:%s\n", cstr_String(&d->prefs.geminiProxy)); 229 appendFormat_String(str, "proxy.gemini address:%s\n", cstr_String(&d->prefs.geminiProxy));
228 appendFormat_String(str, "proxy.gopher address:%s\n", cstr_String(&d->prefs.gopherProxy)); 230 appendFormat_String(str, "proxy.gopher address:%s\n", cstr_String(&d->prefs.gopherProxy));
229 appendFormat_String(str, "proxy.http address:%s\n", cstr_String(&d->prefs.httpProxy)); 231 appendFormat_String(str, "proxy.http address:%s\n", cstr_String(&d->prefs.httpProxy));
@@ -306,6 +308,7 @@ static void loadPrefs_App_(iApp *d) {
306 } 308 }
307 else { 309 else {
308 /* default preference values */ 310 /* default preference values */
311 setCACertificates_TlsRequest(&d->prefs.caFile, &d->prefs.caPath);
309 } 312 }
310#if !defined (LAGRANGE_CUSTOM_FRAME) 313#if !defined (LAGRANGE_CUSTOM_FRAME)
311 d->prefs.customFrame = iFalse; 314 d->prefs.customFrame = iFalse;
@@ -1205,6 +1208,10 @@ static iBool handlePrefsCommands_(iWidget *d, const char *cmd) {
1205 cstr_String(text_InputWidget(findChild_Widget(d, "prefs.searchurl")))); 1208 cstr_String(text_InputWidget(findChild_Widget(d, "prefs.searchurl"))));
1206 postCommandf_App("cachesize.set arg:%d", 1209 postCommandf_App("cachesize.set arg:%d",
1207 toInt_String(text_InputWidget(findChild_Widget(d, "prefs.cachesize")))); 1210 toInt_String(text_InputWidget(findChild_Widget(d, "prefs.cachesize"))));
1211 postCommandf_App("ca.file path:%s",
1212 cstr_String(text_InputWidget(findChild_Widget(d, "prefs.ca.file"))));
1213 postCommandf_App("ca.path path:%s",
1214 cstr_String(text_InputWidget(findChild_Widget(d, "prefs.ca.path"))));
1208 postCommandf_App("proxy.gemini address:%s", 1215 postCommandf_App("proxy.gemini address:%s",
1209 cstr_String(text_InputWidget(findChild_Widget(d, "prefs.proxy.gemini")))); 1216 cstr_String(text_InputWidget(findChild_Widget(d, "prefs.proxy.gemini"))));
1210 postCommandf_App("proxy.gopher address:%s", 1217 postCommandf_App("proxy.gopher address:%s",
@@ -1586,6 +1593,20 @@ iBool handleCommand_App(const char *cmd) {
1586 setCStr_String(&d->prefs.downloadDir, suffixPtr_Command(cmd, "path")); 1593 setCStr_String(&d->prefs.downloadDir, suffixPtr_Command(cmd, "path"));
1587 return iTrue; 1594 return iTrue;
1588 } 1595 }
1596 else if (equal_Command(cmd, "ca.file")) {
1597 setCStr_String(&d->prefs.caFile, suffixPtr_Command(cmd, "path"));
1598 if (!argLabel_Command(cmd, "noset")) {
1599 setCACertificates_TlsRequest(&d->prefs.caFile, &d->prefs.caPath);
1600 }
1601 return iTrue;
1602 }
1603 else if (equal_Command(cmd, "ca.path")) {
1604 setCStr_String(&d->prefs.caPath, suffixPtr_Command(cmd, "path"));
1605 if (!argLabel_Command(cmd, "noset")) {
1606 setCACertificates_TlsRequest(&d->prefs.caFile, &d->prefs.caPath);
1607 }
1608 return iTrue;
1609 }
1589 else if (equal_Command(cmd, "open")) { 1610 else if (equal_Command(cmd, "open")) {
1590 iString *url = collectNewCStr_String(suffixPtr_Command(cmd, "url")); 1611 iString *url = collectNewCStr_String(suffixPtr_Command(cmd, "url"));
1591 const iBool noProxy = argLabel_Command(cmd, "noproxy"); 1612 const iBool noProxy = argLabel_Command(cmd, "noproxy");
@@ -1761,6 +1782,8 @@ iBool handleCommand_App(const char *cmd) {
1761 collectNewFormat_String("%d", d->prefs.maxCacheSize)); 1782 collectNewFormat_String("%d", d->prefs.maxCacheSize));
1762 setToggle_Widget(findChild_Widget(dlg, "prefs.decodeurls"), d->prefs.decodeUserVisibleURLs); 1783 setToggle_Widget(findChild_Widget(dlg, "prefs.decodeurls"), d->prefs.decodeUserVisibleURLs);
1763 setText_InputWidget(findChild_Widget(dlg, "prefs.searchurl"), &d->prefs.searchUrl); 1784 setText_InputWidget(findChild_Widget(dlg, "prefs.searchurl"), &d->prefs.searchUrl);
1785 setText_InputWidget(findChild_Widget(dlg, "prefs.ca.file"), &d->prefs.caFile);
1786 setText_InputWidget(findChild_Widget(dlg, "prefs.ca.path"), &d->prefs.caPath);
1764 setText_InputWidget(findChild_Widget(dlg, "prefs.proxy.gemini"), &d->prefs.geminiProxy); 1787 setText_InputWidget(findChild_Widget(dlg, "prefs.proxy.gemini"), &d->prefs.geminiProxy);
1765 setText_InputWidget(findChild_Widget(dlg, "prefs.proxy.gopher"), &d->prefs.gopherProxy); 1788 setText_InputWidget(findChild_Widget(dlg, "prefs.proxy.gopher"), &d->prefs.gopherProxy);
1766 setText_InputWidget(findChild_Widget(dlg, "prefs.proxy.http"), &d->prefs.httpProxy); 1789 setText_InputWidget(findChild_Widget(dlg, "prefs.proxy.http"), &d->prefs.httpProxy);