I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Unverified Commit e54f5ffa authored by zzz's avatar zzz
Browse files

i2ptunnel: Fix IRC USER filtering

Wasn't passing through user and realname fields
Pass through RFC 2812 mode field if present
reported by RN
parent 7b75ee5a
No related branches found
No related tags found
No related merge requests found
......@@ -389,15 +389,35 @@ abstract class IRCFilter {
}
return s;
}
if("USER".equals(command)) {
if (field.length < idx + 2)
// USER <username> <hostname> <servername> <realname> (RFC 1459)
// USER <user> <mode> <unused> <realname> (RFC 2812)
// <realname> may contain spaces, and thus must be prefixed with a colon.
if (field.length < idx + 3)
return s; // invalid, allow server response
int cidx = field[idx + 1].lastIndexOf(':');
// Replace hostname/servername; pass numeric mode and unused '*' through unchanged
String hostname = field[idx + 1];
try {
Integer.parseInt(hostname);
// mode
} catch (NumberFormatException nfe) {
hostname = "hostname";
}
// Warning: max field size is 4, so servername or unused is combined with realname
// in field[idx + 2]
String servername;
if (field[idx + 2].startsWith("* "))
servername = "*";
else
servername = "localhost";
String realname;
int cidx = field[idx + 2].lastIndexOf(':');
if (cidx < 0)
return "USER user hostname localhost :realname";
String realname = field[idx + 1].substring(cidx + 1);
String ret = "USER " + field[idx] + " hostname localhost :" + realname;
realname = "realname";
else
realname = field[idx + 2].substring(cidx + 1);
String ret = "USER " + field[idx] + ' ' + hostname + ' ' + servername + " :" + realname;
return ret;
}
......
2022-11-12 zzz
* i2ptunnel: Fix IRC USER filtering
2022-11-09 zzz
* SAM: Add warning at startup if not bound to localhost
2022-11-01 zzz
* GeoIP 2022-11-01
* SSU:
......
......@@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Git";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 14;
public final static long BUILD = 15;
/** for example "-test" */
public final static String EXTRA = "-rc";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment