X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=ircd%2Fm_burst.c;h=00e426545003b62c48a8c8738b8862e9a3c9d2f6;hb=2fbe1c3ccc35099d105552c0eef8eb566c97662d;hp=e95a0696971eaf43f9f6c2984602073c7f974e40;hpb=3499d06736c7afcfce2e161d242b854c1692c900;p=ircu2.10.12-pk.git diff --git a/ircd/m_burst.c b/ircd/m_burst.c index e95a069..00e4265 100644 --- a/ircd/m_burst.c +++ b/ircd/m_burst.c @@ -115,6 +115,8 @@ netride_modes(int parc, char **parv, const char *curr_key) assert(modes && modes[0] == '+'); while (*modes) { switch (*modes++) { + case '-': + return -1; case 'i': result |= MODE_INVITEONLY; break; @@ -282,7 +284,13 @@ int ms_burst(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) if (parv[param][0] != '+') continue; check_modes = netride_modes(parc - param, parv + param, chptr->mode.key); - if (check_modes) + if (check_modes < 0) + { + if (chptr->users == 0) + sub1_from_channel(chptr); + return protocol_violation(sptr, "Invalid mode string in BURST"); + } + else if (check_modes) { /* Clear any outstanding rogue invites */ mode_invite_clear(chptr); @@ -328,25 +336,8 @@ int ms_burst(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) modebuf_mode(mbuf, MODE_DEL | chptr->mode.mode); /* wipeout modes */ chptr->mode.mode &= MODE_BURSTADDED | MODE_WASDELJOINS; - /* wipe out modes not represented in chptr->mode.mode */ - if (chptr->mode.limit) { - modebuf_mode_uint(mbuf, MODE_DEL | MODE_LIMIT, chptr->mode.limit); - chptr->mode.limit = 0; - } - if (chptr->mode.key[0]) { - modebuf_mode_string(mbuf, MODE_DEL | MODE_KEY, chptr->mode.key, 0); - chptr->mode.key[0] = '\0'; - } - if (chptr->mode.upass[0]) { - modebuf_mode_string(mbuf, MODE_DEL | MODE_UPASS, chptr->mode.upass, 0); - chptr->mode.upass[0] = '\0'; - } - if (chptr->mode.apass[0]) { - modebuf_mode_string(mbuf, MODE_DEL | MODE_APASS, chptr->mode.apass, 0); - chptr->mode.apass[0] = '\0'; - } - - parse_flags |= (MODE_PARSE_SET | MODE_PARSE_WIPEOUT); /* wipeout keys */ + /* wipeout any limit and keys that are set */ + parse_flags |= (MODE_PARSE_SET | MODE_PARSE_WIPEOUT); /* mark bans for wipeout */ for (lp = chptr->banlist; lp; lp = lp->next) @@ -499,10 +490,18 @@ int ms_burst(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) do { level_increment = 10 * level_increment + *ptr++ - '0'; } while (IsDigit(*ptr)); + --ptr; oplevel += level_increment; + if (oplevel > MAXOPLEVEL) { + protocol_violation(sptr, "Invalid cumulative oplevel %u during burst", oplevel); + oplevel = MAXOPLEVEL; + break; + } } - else /* I don't recognize that flag */ + else { /* I don't recognize that flag */ + protocol_violation(sptr, "Invalid flag '%c' in nick part of burst", *ptr); break; /* so stop processing */ + } } } } @@ -526,7 +525,7 @@ int ms_burst(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) nickstr[nickpos++] = 'v'; if (current_mode & CHFL_CHANOP) { - if (chptr->mode.apass[0]) + if (oplevel != MAXOPLEVEL) nickpos += ircd_snprintf(0, nickstr + nickpos, sizeof(nickstr) - nickpos, "%u", oplevel); else nickstr[nickpos++] = 'o'; @@ -537,7 +536,7 @@ int ms_burst(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) last_oplevel = oplevel; } - if (IsBurst(sptr) || !(member = find_member_link(chptr, acptr))) + if (!(member = find_member_link(chptr, acptr))) { add_user_to_channel(chptr, acptr, current_mode, oplevel); if (!(current_mode & CHFL_DELAYED))