summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-10-26 16:38:36 -0400
committerJune McEnroe <june@causal.agency>2019-10-26 16:38:36 -0400
commit78a685fa2293b7797906d3225f7a302ed58ce79e (patch)
treef67c3fdedef853b69412c4c284f0a95f510c1d44
parentTrack channel topics (diff)
downloadpounce-78a685fa2293b7797906d3225f7a302ed58ce79e.tar.gz
pounce-78a685fa2293b7797906d3225f7a302ed58ce79e.zip
Require PASS before USER
Prevent creating a ring consumer without authentication.
-rw-r--r--client.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/client.c b/client.c
index f7fff33..198f1f6 100644
--- a/client.c
+++ b/client.c
@@ -114,9 +114,13 @@ static void handleUser(struct Client *client, struct Message *msg) {
 		client->error = true;
 		return;
 	}
-	client->consumer = ringConsumer(msg->params[0]);
-	client->need &= ~NeedUser;
-	sync(client);
+	if (client->need & NeedPass) {
+		passRequired(client);
+	} else {
+		client->need &= ~NeedUser;
+		client->consumer = ringConsumer(msg->params[0]);
+		sync(client);
+	}
 }
 
 static void handlePass(struct Client *client, struct Message *msg) {