From 4adaddeee1e8a899c4c319b20a79db871873cbed Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Tue, 5 May 2026 09:48:19 +0200 Subject: [PATCH] set_client_ip() was not updating client->sockhost. That meant in WEBIRC situations connect-flood may not be working (it used the webirc ip, which is almost always exempt, instead of the spoofed IP). --- src/socket.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/socket.c b/src/socket.c index 2287f0005..1fe4fe46d 100644 --- a/src/socket.c +++ b/src/socket.c @@ -1645,6 +1645,17 @@ int set_client_ip(Client *client, const char *ip) inetntop(af, client->rawip, newip, sizeof(newip)); safe_strdup(client->ip, newip); + /* We also keep sockhost in sync with the new IP. Otherwise some + * instances of match_user() in pre-reg may match against the old IP. + * Note that this also means we overwrite sockhost if it contained + * a hostname, that is good for e.g. WEBIRC case, since the IP is + * changed and the old hostname is from the WebIRC gateway. + * Fortunately all callers that set hostnames do so after calling + * set_client_ip(), so that is correct. + */ + if (client->local) + set_sockhost(client, client->ip); + /* For IP changes (so not first set), call this hook */ if (*oldip) {