summary refs log tree commit diff
path: root/irc.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-01-10 18:00:41 -0500
committerJune McEnroe <june@causal.agency>2021-01-10 18:00:41 -0500
commitc6cd90c2dd491d31d7bf8cff3e31bf361a955b1b (patch)
treecc5a4a3fda384d63db43a25112349e41fe3fe8ba /irc.c
parentAllow interspersing flags and config files (diff)
downloadcatgirl-c6cd90c2dd491d31d7bf8cff3e31bf361a955b1b.tar.gz
catgirl-c6cd90c2dd491d31d7bf8cff3e31bf361a955b1b.zip
Print chain to stdout with -o
Diffstat (limited to '')
-rw-r--r--irc.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/irc.c b/irc.c
index cbe1808..c98193a 100644
--- a/irc.c
+++ b/irc.c
@@ -160,20 +160,11 @@ int ircConnect(const char *bindHost, const char *host, const char *port) {
 	return sock;
 }
 
-void ircWriteChain(const char *path) {
-	FILE *file = fopen(path, "w");
-	if (!file) err(EX_CANTCREAT, "%s", path);
-
-	int n = fprintf(file, "subject= %s\n", tls_peer_cert_subject(client));
-	if (n < 0) err(EX_IOERR, "%s", path);
-
+void ircPrintCert(void) {
 	size_t len;
 	const byte *pem = tls_peer_cert_chain_pem(client, &len);
-	len = fwrite(pem, len, 1, file);
-	if (!len) err(EX_IOERR, "%s", path);
-
-	int error = fclose(file);
-	if (error) err(EX_IOERR, "%s", path);
+	printf("subject= %s\n", tls_peer_cert_subject(client));
+	fwrite(pem, len, 1, stdout);
 }
 
 enum { MessageCap = 8191 + 512 };