about summary refs log tree commit diff stats
path: root/src/event
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-09-22 21:42:05 +0100
committerJames Booth <boothj5@gmail.com>2015-09-22 21:42:05 +0100
commit9414ad268d79ba3d0e75ef5fbe0e379c4462893d (patch)
treef588f8375cc70c89b5ce352e33f834985aa79a5a /src/event
parent74151e6419a606c25b6ea9ad2eed05679f6e8fd9 (diff)
downloadprofani-tty-9414ad268d79ba3d0e75ef5fbe0e379c4462893d.tar.gz
Prompt user to allow or deny untrusted TLS certificates
Diffstat (limited to 'src/event')
-rw-r--r--src/event/server_events.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/event/server_events.c b/src/event/server_events.c
index 6c575179..e8d6a357 100644
--- a/src/event/server_events.c
+++ b/src/event/server_events.c
@@ -650,6 +650,27 @@ sv_ev_certfail(const char * const errormsg, const char * const certname, const c
     cons_show("  Start       : %s", notbefore);
     cons_show("  End         : %s", notafter);
     cons_show("");
+    cons_show("Use '/tls allow' to accept this certificate");
+    cons_show("Use '/tls deny' to reject this certificate");
+    cons_show("");
+    ui_update();
+
+    char *cmd = ui_get_line();
+
+    while ((g_strcmp0(cmd, "/tls allow") != 0) && (g_strcmp0(cmd, "/tls deny") != 0)) {
+        cons_show("Use '/tls allow' to accept this certificate");
+        cons_show("Use '/tls deny' to reject this certificate");
+        cons_show("");
+        ui_update();
+        free(cmd);
+        cmd = ui_get_line();
+    }
 
-    return 1;
+    if (g_strcmp0(cmd, "/tls allow") == 0) {
+        free(cmd);
+        return 1;
+    } else {
+        free(cmd);
+        return 0;
+    }
 }