From: Michael Poole Date: Tue, 3 May 2005 03:47:42 +0000 (+0000) Subject: Prohibit same +A and +U pass; fix IAuth crash (#1193808), invite X-Git-Url: http://git.pk910.de/?p=ircu2.10.12-pk.git;a=commitdiff_plain;h=e9d777c29b0fed2ab484a62d2e2422a02d074d3b Prohibit same +A and +U pass; fix IAuth crash (#1193808), invite forwarding bug (also reported by jast), and IP numnick parsing bug. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1393 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- diff --git a/ChangeLog b/ChangeLog index 106d3c5..bca220a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2005-05-02 Michael Poole + + * include/numeric.h (ERR_UPASS_SAME_APASS): New error message when + trying to set +U pass to the same as the +A pass. + + * ircd/channel.c (mode_parse_upass): Use it. + + * ircd/ircd_auth.c (iauth_exit_client): Only send ExitUser if + there is an active IAuth connection, fixing PR#1193808. + (iauth_dispose_request): Only delete the timer if it is active. + + * ircd/m_invite.c (m_invite): Always forward the invite in the + correct direction, and then skip it as 'one' if announcing. + (ms_invite): Likewise. + + * ircd/numnicks.c (base64toip): Do not interpret AAAAAA as + ::ffff:0.0.0.0; keep it as ::. + + * ircd/s_err.c (replyTable): Add ERR_UPASS_SAME_APASS. + 2005-05-01 Michael Poole * doc/readme.log: Document IAUTH log target, remove docs for diff --git a/include/numeric.h b/include/numeric.h index bf82848..c3bbfab 100644 --- a/include/numeric.h +++ b/include/numeric.h @@ -463,7 +463,8 @@ extern const struct Numeric* get_error_numeric(int err); #define ERR_UPASSNOTSET 554 /* Undernet extension */ #define ERR_NOMANAGER_LONG 555 /* Undernet extension */ #define ERR_NOMANAGER_SHORT 556 /* Undernet extension */ -#define ERR_LASTERROR 557 +#define ERR_UPASS_SAME_APASS 557 /* Undernet extension */ +#define ERR_LASTERROR 558 /* RPL_LOGON 600 dalnet,unreal RPL_LOGOFF 601 dalnet,unreal diff --git a/ircd/channel.c b/ircd/channel.c index 2d6ce01..f5d78ad 100644 --- a/ircd/channel.c +++ b/ircd/channel.c @@ -2484,6 +2484,11 @@ mode_parse_upass(struct ParseState *state, int *flag_p) send_reply(state->sptr, ERR_UPASSNOTSET, state->chptr->chname, state->chptr->chname); return; } + /* cannot set a +U password that is the same as +A */ + if (state->dir == MODE_ADD && !ircd_strcmp(state->chptr->mode.apass, t_str)) { + send_reply(state->sptr, ERR_UPASS_SAME_APASS, state->chptr->chname); + return; + } /* can't add a upass if one is set, nor can one remove the wrong upass */ if ((state->dir == MODE_ADD && *state->chptr->mode.upass) || (state->dir == MODE_DEL && diff --git a/ircd/ircd_auth.c b/ircd/ircd_auth.c index 8b76a16..29affee 100644 --- a/ircd/ircd_auth.c +++ b/ircd/ircd_auth.c @@ -721,10 +721,10 @@ void iauth_exit_client(struct Client *cptr) iauth_dispose_request(iauth_active, cli_iauth(cptr)); cli_iauth(cptr) = NULL; } - if (!i_GetConnected(iauth_active)) - return; - iauth_send(iauth_active, "ExitUser %x", cptr); - iauth_write(iauth_active); + if (iauth_active && i_GetConnected(iauth_active)) { + iauth_send(iauth_active, "ExitUser %x", cptr); + iauth_write(iauth_active); + } } /** Find pending request with a particular ID. @@ -754,7 +754,7 @@ static struct IAuthRequest *iauth_find_request(struct IAuth *iauth, char *id) static void iauth_dispose_request(struct IAuth *iauth, struct IAuthRequest *iar) { assert(iar->iar_client != NULL); - if (iar->iar_timed) + if (iar->iar_timed && t_active(&i_request_timer(iauth))) timer_del(&i_request_timer(iauth)); cli_iauth(iar->iar_client) = NULL; iar->iar_prev->iar_next = iar->iar_next; diff --git a/ircd/m_invite.c b/ircd/m_invite.c index 478ff5b..c550263 100644 --- a/ircd/m_invite.c +++ b/ircd/m_invite.c @@ -180,6 +180,9 @@ int m_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (MyConnect(acptr)) { add_invite(acptr, chptr); sendcmdto_one(sptr, CMD_INVITE, acptr, "%s %H", cli_name(acptr), chptr); + } else { + sendcmdto_one(sptr, CMD_INVITE, acptr, "%s %H %Tu", cli_name(acptr), chptr, + chptr->creationtime); } if (!IsLocalChannel(chptr->chname) || MyConnect(acptr)) { @@ -190,7 +193,7 @@ int m_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) "%H %C %C :%C has been invited by %C", chptr, acptr, sptr, acptr, sptr); /* Announce to servers with channel operators. */ - sendcmdto_channel_servers_butone(sptr, NULL, TOK_INVITE, chptr, NULL, SKIP_NONOPS, + sendcmdto_channel_servers_butone(sptr, NULL, TOK_INVITE, chptr, acptr, SKIP_NONOPS, "%s %H %Tu", cli_name(acptr), chptr, chptr->creationtime); } @@ -280,8 +283,11 @@ int ms_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) return 0; if (MyConnect(acptr)) { - add_invite(acptr, chptr); - sendcmdto_one(sptr, CMD_INVITE, acptr, "%s %H", cli_name(acptr), chptr); + add_invite(acptr, chptr); + sendcmdto_one(sptr, CMD_INVITE, acptr, "%s %H", cli_name(acptr), chptr); + } else { + sendcmdto_one(sptr, CMD_INVITE, acptr, "%s %H %Tu", cli_name(acptr), chptr, + chptr->creationtime); } if (feature_bool(FEAT_ANNOUNCE_INVITES)) { @@ -291,12 +297,10 @@ int ms_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) "%H %C %C :%C has been invited by %C", chptr, acptr, sptr, acptr, sptr); /* Announce to servers with channel operators. */ - sendcmdto_channel_servers_butone(sptr, NULL, TOK_INVITE, chptr, NULL, SKIP_NONOPS, + sendcmdto_channel_servers_butone(sptr, NULL, TOK_INVITE, chptr, acptr, SKIP_NONOPS, "%s %H %Tu", cli_name(acptr), chptr, chptr->creationtime); } return 0; } - - diff --git a/ircd/numnicks.c b/ircd/numnicks.c index bf11b7e..9dd051d 100644 --- a/ircd/numnicks.c +++ b/ircd/numnicks.c @@ -502,9 +502,12 @@ void base64toip(const char* input, struct irc_in_addr* addr) memset(addr, 0, sizeof(*addr)); if (strlen(input) == 6) { unsigned int in = base64toint(input); - addr->in6_16[5] = htons(65535); - addr->in6_16[6] = htons(in >> 16); - addr->in6_16[7] = htons(in & 65535); + /* An all-zero address should stay that way. */ + if (in) { + addr->in6_16[5] = htons(65535); + addr->in6_16[6] = htons(in >> 16); + addr->in6_16[7] = htons(in & 65535); + } } else { unsigned int pos = 0; do { diff --git a/ircd/s_err.c b/ircd/s_err.c index 4b03b3d..d834944 100644 --- a/ircd/s_err.c +++ b/ircd/s_err.c @@ -1146,7 +1146,7 @@ static Numeric replyTable[] = { /* 556 */ { ERR_NOMANAGER_SHORT, "%s :Re-create the channel. The channel must be *empty* for a minute or two before it can be recreated.", "556" }, /* 557 */ - { 0 }, + { ERR_UPASS_SAME_APASS, "%s :Cannot use the same pass for both admin (+A) and user (+U) pass.", "557" }, /* 558 */ { 0 }, /* 559 */