From: Egor Date: Sun, 8 May 2022 11:06:11 +0000 (+0300) Subject: check channel key and member limit X-Git-Url: https://git.patchysicp.xyz/?a=commitdiff_plain;h=1a882580340a113fd0bc8d7945f7ed949866db94;p=patchyircd.git check channel key and member limit --- diff --git a/irc.c b/irc.c index e4768b8..4cab9fa 100644 --- a/irc.c +++ b/irc.c @@ -871,7 +871,6 @@ void channel_sendnames(struct client_data *client, struct channel *chan) } void channel_join(struct client_data *client, const char *channel, const char *chankey) { - (void)chankey; // TODO: check channel limit? if (channel[0] != '#' && channel[0] != '&') return; // FIXME: error @@ -901,12 +900,16 @@ void channel_join(struct client_data *client, const char *channel, const char *c } else { if (trie_get(&chan->members, client->key)) return; - // TODO: check key - // TODO: check limit - // TODO: check ban - // TODO: check ban exemption - // TODO: check invite - // TODO: check invite exemption + if (!(client->umode & UMODE_OPER)) { + if (chan->chankey && (!chankey || strcmp(chan->chankey, chankey) == 0)) + return; // error 475 + if (chan->member_limit != -1 && chan->member_count >= chan->member_limit) + return; // error 471 + // TODO: check ban + // TODO: check ban exemption + // TODO: check invite + // TODO: check invite exemption + } } if (trie_set(&chan->members, client->key, client, NULL) == -1) abort();