fix vhost /whois

This commit is contained in:
zefie
2025-06-15 00:57:03 -04:00
parent 6e5d610cd7
commit 39a0aa76c7

View File

@@ -1125,7 +1125,7 @@ class WTVIRC {
const whoisSocket = Array.from(this.nicknames.keys()).find(s => this.nicknames.get(s) === whoisNick); const whoisSocket = Array.from(this.nicknames.keys()).find(s => this.nicknames.get(s) === whoisNick);
if (whoisSocket) { if (whoisSocket) {
const whois_username = this.usernames.get(whoisNick); const whois_username = this.usernames.get(whoisNick);
socket.write(`:${this.servername} 311 ${socket.nickname} ${whoisNick} ${whois_username} ${this.filterHostname(whoisSocket, whoisSocket.realhost)} * ${whoisNick}\r\n`); socket.write(`:${this.servername} 311 ${socket.nickname} ${whoisNick} ${whois_username} ${whoisSocket.host} * ${whoisNick}\r\n`);
if (this.awaymsgs.has(whoisNick)) { if (this.awaymsgs.has(whoisNick)) {
socket.write(`:${this.servername} 301 ${socket.nickname} ${whoisNick} :${this.awaymsgs.get(whoisNick)}\r\n`); socket.write(`:${this.servername} 301 ${socket.nickname} ${whoisNick} :${this.awaymsgs.get(whoisNick)}\r\n`);
} }
@@ -1264,11 +1264,16 @@ class WTVIRC {
socket.write(`:${this.servername} 501 ${socket.nickname} :Invalid VHost format\r\n`); socket.write(`:${this.servername} 501 ${socket.nickname} :Invalid VHost format\r\n`);
break; break;
} }
// Set the new VHost for the socket dns.lookup(newVHost, (err, address) => {
socket.host = newVHost; if (!err && address) {
socket.write(`:${this.servername} 396 ${socket.nickname} :Your VHost has been changed to ${newVHost}\r\n`); socket.write(`:${this.servername} 501 ${socket.nickname} :VHost must not resolve to a real IP (resolved to: ${address})\r\n`);
break; return;
}
// Set the new VHost for the socket
socket.host = newVHost;
socket.write(`:${this.servername} 396 ${socket.nickname} :Your VHost has been changed to ${socket.host}\r\n`);
});
return;
default: default:
// Ignore unknown commands // Ignore unknown commands
break; break;