aboutsummaryrefslogtreecommitdiff
path: root/titan.c
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2023-07-24 09:28:01 +0000
committerOmar Polo <op@omarpolo.com>2023-07-24 09:28:01 +0000
commit32b1638ebc95d2808f7531d51850a385ee74db2b (patch)
treeb8fa52607eed1bd64717715920425a1e32b8f615 /titan.c
parent9888507cd4212b360fc15e4262e5fd95844efc7c (diff)
run tls_connect_socket() after dropping the "inet dns" pledge promises
Diffstat (limited to 'titan.c')
-rw-r--r--titan.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/titan.c b/titan.c
index f76deeb..d3b781a 100644
--- a/titan.c
+++ b/titan.c
@@ -293,14 +293,15 @@ main(int argc, char **argv)
errx(1, "tls_configure: %s", tls_error(ctx));
sock = dial(iri.host, iri.port);
- if (tls_connect_socket(ctx, sock, iri.host) == -1)
- errx(1, "failed to connect to %s:%s: %s", iri.host,
- *iri.port == '\0' ? "1965" : iri.port, tls_error(ctx));
/* drop inet tls */
if (pledge("stdio", NULL) == -1)
err(1, "pledge");
+ if (tls_connect_socket(ctx, sock, iri.host) == -1)
+ errx(1, "failed to connect to %s:%s: %s", iri.host,
+ *iri.port == '\0' ? "1965" : iri.port, tls_error(ctx));
+
/* send request */
if (iomux(ctx, sock, req, strlen(req), NULL, 0) == -1)
errx(1, "I/O error: %s", tls_error(ctx));