diff options
-rw-r--r-- | Changes | 1 | ||||
-rw-r--r-- | src/actions.c | 54 | ||||
-rw-r--r-- | src/protocol/ptlink.c | 32 | ||||
-rw-r--r-- | src/protocol/ptlink.h | 3 | ||||
-rw-r--r-- | version.log | 6 |
5 files changed, 50 insertions, 46 deletions
@@ -25,6 +25,7 @@ Provided by Anope Dev. <dev@anope.org> - 2005 02/13 A Internal Event support, see EVENTS in the doc folder for help [ #00] 02/05 A Support for Unreal 3.2 +I channel mode. [ #00] 02/03 A Merged anope-win32 branch into the main, now Win32 ready. [ #00] +05/04 F vHost handling with PTlink was broken in a subtle way. [#352] 05/04 F Missing check for valid ChannelInfo in topic handling. [#363] 05/04 F Module language texts sometimes being mixed. [ #00] 05/04 F Wrong datatype in the config parser for OSInfoDBName. [ #00] diff --git a/src/actions.c b/src/actions.c index bc1d16c1c..5ced638c6 100644 --- a/src/actions.c +++ b/src/actions.c @@ -207,23 +207,13 @@ void common_svsmode(User * u, char *modes, char *arg) */ char *common_get_vhost(User * u) { - if (!u) { + if (!u) return NULL; - } - if (ircd->vhostmode) { - if (u->mode & ircd->vhostmode) { - return u->vhost; - /* ptlink hack since there is no user mode - for vhost, simply compare the host to the - vhost struct memember */ - } else if (stricmp(u->vhost, u->host)) { - return u->vhost; - } else { - return u->host; - } - } else { + + if (ircd->vhostmode && (u->mode & ircd->vhostmode)) + return u->vhost; + else return u->host; - } } /*************************************************************************/ @@ -236,33 +226,11 @@ char *common_get_vhost(User * u) */ char *common_get_vident(User * u) { - if (!u) { + if (!u) return NULL; - } - if (ircd->vhostmode) { - if (u->mode & ircd->vhostmode) { - return u->vident; - /* ptlink hack since there is no user mode - for vhost, simply compare the host to the - vhost struct memember */ - } else if (u->vident) { - if (stricmp(u->vident, u->username)) { - return u->vident; - } else { - return u->username; - } - } else { - return u->username; - } - } else { - if (u->vident) { - if (stricmp(u->vident, u->username)) { - return u->vident; - } else { - return u->username; - } - } else { - return u->username; - } - } + + if (ircd->vhostmode && (u->mode & ircd->vhostmode)) + return u->vident; + else + return u->username; } diff --git a/src/protocol/ptlink.c b/src/protocol/ptlink.c index 1333eb9a6..8a0b55b19 100644 --- a/src/protocol/ptlink.c +++ b/src/protocol/ptlink.c @@ -79,7 +79,7 @@ IRCDVar myIrcd[] = { CMODE_K, /* No Knock */ CMODE_A, /* Admin Only */ DEFAULT_MLOCK, /* Default MLOCK */ - UMODE_o, /* Vhost Mode */ + UMODE_VH, /* Vhost Mode */ 1, /* +f */ 0, /* +L */ CMODE_f, @@ -429,6 +429,18 @@ int anope_event_newmask(char *source, int ac, char **av) } return MOD_CONT; } + + if ((u->mode & (UMODE_NM | UMODE_VH)) == (UMODE_NM | UMODE_VH)) { + /* This NEWMASK should be discarded because it's sent due to a +r by + * someone with a ptlink-masked host. PTlink has our correct host, so + * we can just ignore this :) Or we'll get ptlink's old host which is + * not what we want. -GD + */ + u->mode &= ~UMODE_NM; + if (debug) + alog("debug: Ignoring NEWMASK because it's send because of SVSMODE +r"); + return MOD_CONT; + } newuser = myStrGetOnlyToken(av[0], '@', 0); if (newuser) { @@ -440,7 +452,9 @@ int anope_event_newmask(char *source, int ac, char **av) if (*newhost == '@') newhost++; - + + u->mode |= UMODE_VH; + if (newhost) { change_user_host(u, newhost); } @@ -699,6 +713,15 @@ void ptlink_cmd_svsmode(User * u, int ac, char **av) { send_cmd(ServerName, "SVSMODE %s %s%s%s", u->nick, av[0], (ac == 2 ? " " : ""), (ac == 2 ? av[1] : "")); + + /* If we set +r on someone +NRah (1 or more of those modes), PTlink will + * send us a NEWMASK with their ptlink-masked-host. If we want HostServ + * to work for them, we will need to send our NEWMASK after we receive + * theirs. Thus we make a hack and store in moduleData that we need to + * look out for that. + */ + if (strchr(av[0], 'r') && (u->mode & UMODE_N) || (u->mode & UMODE_R) || (u->mode & UMODE_a) || (u->mode & UMODE_h)) + u->mode |= UMODE_NM; } int anope_event_error(char *source, int ac, char **av) @@ -1180,11 +1203,16 @@ void ptlink_cmd_vhost_off(User * u) void ptlink_cmd_vhost_on(char *nick, char *vIdent, char *vhost) { + User *u; + if (vIdent) { send_cmd(s_HostServ, "NEWMASK %s@%s %s", vIdent, vhost, nick); } else { send_cmd(s_HostServ, "NEWMASK %s %s", vhost, nick); } + + if ((u = finduser(nick))) + u->mode |= UMODE_VH; } /* INVITE */ diff --git a/src/protocol/ptlink.h b/src/protocol/ptlink.h index 2ec8f1181..cda963df4 100644 --- a/src/protocol/ptlink.h +++ b/src/protocol/ptlink.h @@ -31,6 +31,9 @@ #define UMODE_y 0x00002000 #define UMODE_z 0x00004000 +#define UMODE_VH 0x00008000 /* Fake umode used for internal vhost things */ +#define UMODE_NM 0x00010000 /* Fake umode used for internal NEWMASK things */ +/* Let's hope for a better vhost-system with PTlink7 ;) */ #define CMODE_i 0x00000001 diff --git a/version.log b/version.log index 7637f331e..4dc6ac12a 100644 --- a/version.log +++ b/version.log @@ -8,10 +8,14 @@ VERSION_MAJOR="1" VERSION_MINOR="7" VERSION_PATCH="8" -VERSION_BUILD="764" +VERSION_BUILD="765" # $Log$ # +# BUILD : 1.7.8 (765) +# BUGS : 352 +# NOTES : Fixed various PTlink vhost handling bugs. Added a fake umode to indicate we have a vHost, to not break other IRCDs which DO use umodes. Ignoring PTlinks NEWMASK on SVSMODE +r, as that would desynch the services internal vhost. +# # BUILD : 1.7.8 (764) # BUGS : 363 # NOTES : Missing (c->)ci check in do_topic(), causing segfaults... |