|
@@ -2239,9 +2239,21 @@ func proxyHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
2239
|
2239
|
clientHostname := client.hostname
|
2240
|
2240
|
for _, address := range server.proxyAllowedFrom {
|
2241
|
2241
|
if clientHostname == address || clientAddress == address {
|
|
2242
|
+ proxiedIP := msg.Params[1]
|
|
2243
|
+
|
|
2244
|
+ // ensure IP is sane
|
|
2245
|
+ parsedProxiedIP := net.ParseIP(proxiedIP)
|
|
2246
|
+ if parsedProxiedIP == nil {
|
|
2247
|
+ client.Quit(fmt.Sprintf("Proxied IP address is not valid: [%s]", proxiedIP))
|
|
2248
|
+ return true
|
|
2249
|
+ }
|
|
2250
|
+
|
2242
|
2251
|
//TODO(dan): check DLINEs and connection throttling/limits
|
|
2252
|
+
|
|
2253
|
+ // override the client's regular IP
|
2243
|
2254
|
client.proxiedIP = msg.Params[1]
|
2244
|
2255
|
client.hostname = LookupHostname(msg.Params[1])
|
|
2256
|
+ client.rawHostname = LookupHostname(msg.Params[1])
|
2245
|
2257
|
return false
|
2246
|
2258
|
}
|
2247
|
2259
|
}
|