summary refs log tree commit diff
path: root/state.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-07-06 15:06:17 -0400
committerJune McEnroe <june@causal.agency>2020-07-06 15:08:08 -0400
commitd09477b58e39bb9a301a592e9bc7505b046660e1 (patch)
tree76864f0fa404480e685e94b3748d2ecdf30e3a91 /state.c
parentGrant CAP_SETSOCKOPT in dispatch (diff)
downloadpounce-d09477b58e39bb9a301a592e9bc7505b046660e1.tar.gz
pounce-d09477b58e39bb9a301a592e9bc7505b046660e1.zip
Add -R blind-req option
Allows requesting userhost-in-names on freenode, which is available but
hidden.
Diffstat (limited to 'state.c')
-rw-r--r--state.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/state.c b/state.c
index ff05638..f35f29f 100644
--- a/state.c
+++ b/state.c
@@ -56,26 +56,24 @@ enum { AuthLen = 299 };
 static char plainBase64[BASE64_SIZE(AuthLen)];
 
 void stateLogin(
-	const char *pass, bool sasl, const char *plain,
+	const char *pass, enum Cap blind, const char *plain,
 	const char *nick, const char *user, const char *real
 ) {
 	serverFormat("CAP LS 302\r\n");
 	if (pass) serverFormat("PASS :%s\r\n", pass);
-	if (sasl) {
-		serverFormat("CAP REQ :%s\r\n", capList(CapSASL, NULL));
-		if (plain) {
-			byte buf[AuthLen];
-			size_t len = 1 + strlen(plain);
-			if (sizeof(buf) < len) {
-				errx(EX_SOFTWARE, "SASL PLAIN is too long");
-			}
-			buf[0] = 0;
-			for (size_t i = 0; plain[i]; ++i) {
-				buf[1 + i] = (plain[i] == ':' ? 0 : plain[i]);
-			}
-			base64(plainBase64, buf, len);
-			explicit_bzero(buf, sizeof(buf));
+	if (blind) serverFormat("CAP REQ :%s\r\n", capList(blind, NULL));
+	if (plain) {
+		byte buf[AuthLen];
+		size_t len = 1 + strlen(plain);
+		if (sizeof(buf) < len) {
+			errx(EX_SOFTWARE, "SASL PLAIN is too long");
 		}
+		buf[0] = 0;
+		for (size_t i = 0; plain[i]; ++i) {
+			buf[1 + i] = (plain[i] == ':' ? 0 : plain[i]);
+		}
+		base64(plainBase64, buf, len);
+		explicit_bzero(buf, sizeof(buf));
 	}
 	serverFormat("NICK %s\r\n", nick);
 	serverFormat("USER %s 0 * :%s\r\n", user, real);