From d04ab8dd73e4acea32ababa8ef4675bbe08f3597 Mon Sep 17 00:00:00 2001 From: luke Date: Tue, 9 Jul 2002 13:30:31 +0000 Subject: [PATCH] I line password fix attempts, operoverride extension --- Changes | 8 +++++ src/channel.c | 82 +++++++++++++++++++++++++++++++++++++++++++-------- src/s_user.c | 32 ++++++++++---------- 3 files changed, 95 insertions(+), 27 deletions(-) diff --git a/Changes b/Changes index a9f53fd96..16af686e3 100644 --- a/Changes +++ b/Changes @@ -444,3 +444,11 @@ globops. (Thanks to Zerwas) --Luke =================================== +Added additional operoverride capabilities (namely +ability to view banlists, exemptlists, etc.) +--Luke +=================================== + +Played with I line password bug for a while +--Luke +=================================== diff --git a/src/channel.c b/src/channel.c index da98b122a..b1c057ba4 100644 --- a/src/channel.c +++ b/src/channel.c @@ -250,15 +250,34 @@ static int add_exbanid(aClient *cptr, aChannel *chptr, char *banid) if (MyClient(cptr)) (void)collapse(banid); - for (ban = chptr->exlist; ban; ban = ban->next) + + /* I'm not sure wtf MAXBANLENGTH is *supposed* to implement + * but I would guess it's supposed to be the length of an + * individual ban and not the sum of the lengths of all the + * bans in a given list. --Luke + */ + if (strlen(banid) > MAXBANLENGTH) { + sendto_ops("BANLISTFULL: strlen(banid) is > %i [%s, %s]", + MAXBANLENGTH,chptr->chname, banid); + sendto_one(cptr, err_str(ERR_BANLISTFULL), + me.name, cptr->name, chptr->chname, banid); + return -1; + } + + for (ban = chptr->banlist; ban; ban = ban->next) + { + /* wtf is this? len += strlen(ban->banstr); + */ if (MyClient(cptr)) - if ((len > MAXBANLENGTH) || (++cnt >= MAXBANS)) + if (++cnt >= MAXBANS) { - sendto_one(cptr, err_str(ERR_BANLISTFULL), + sendto_ops("BANLISTFULL: Hit MAXBANS (%i) with CNT %i [%s, %s]", + MAXBANS, cnt, chptr->chname, banid); + sendto_one(cptr, err_str(ERR_BANLISTFULL), me.name, cptr->name, chptr->chname, banid); - return -1; + return -1; } else { @@ -326,13 +345,32 @@ static int add_banid(aClient *cptr, aChannel *chptr, char *banid) if (MyClient(cptr)) (void)collapse(banid); - for (ban = chptr->banlist; ban; ban = ban->next) + + /* I'm not sure wtf MAXBANLENGTH is *supposed* to implement + * but I would guess it's supposed to be the length of an + * individual ban and not the sum of the lengths of all the + * bans in a given list. --Luke + */ + if (strlen(banid) > MAXBANLENGTH) + { + sendto_ops("BANLISTFULL: strlen(banid) is > %i [%s, %s]", + MAXBANLENGTH,chptr->chname, banid); + sendto_one(cptr, err_str(ERR_BANLISTFULL), + me.name, cptr->name, chptr->chname, banid); + return -1; + } + + for (ban = chptr->banlist; ban; ban = ban->next) { + /* wtf is this? len += strlen(ban->banstr); + */ if (MyClient(cptr)) - if ((len > MAXBANLENGTH) || (++cnt >= MAXBANS)) + if (++cnt >= MAXBANS) { - sendto_one(cptr, err_str(ERR_BANLISTFULL), + sendto_ops("BANLISTFULL: Hit MAXBANS (%i) with CNT %i [%s, %s]", + MAXBANS, cnt, chptr->chname, banid); + sendto_one(cptr, err_str(ERR_BANLISTFULL), me.name, cptr->name, chptr->chname, banid); return -1; } @@ -1017,7 +1055,11 @@ int m_mode(cptr, sptr, parc, parv) && parv[2][1] == '\0') || (parv[2][1] == 'b' && parv[2][2] == '\0' && (*parv[2] == '+' || *parv[2] == '-')))) { - if (!IsMember(sptr, chptr)) + if (!IsMember(sptr, chptr) +#ifndef NO_OPEROVERRIDE + && !IsOper(sptr) +#endif + ) return 0; /* send ban list */ for (ban = chptr->banlist; ban; ban = ban->next) @@ -1034,7 +1076,11 @@ int m_mode(cptr, sptr, parc, parv) && parv[2][1] == '\0') || (parv[2][1] == 'e' && parv[2][2] == '\0' && (*parv[2] == '+' || *parv[2] == '-')))) { - if (!IsMember(sptr, chptr)) + if (!IsMember(sptr, chptr) +#ifndef NO_OPEROVERRIDE + && !IsOper(sptr) +#endif + ) return 0; /* send exban list */ for (ban = chptr->exlist; ban; ban = ban->next) @@ -1051,7 +1097,11 @@ int m_mode(cptr, sptr, parc, parv) && parv[2][1] == '\0') || (parv[2][1] == 'q' && parv[2][2] == '\0' && (*parv[2] == '+' || *parv[2] == '-')))) { - if (!IsMember(sptr, chptr)) + if (!IsMember(sptr, chptr) +#ifndef NO_OPEROVERRIDE + && !IsOper(sptr) +#endif + ) return 0; { struct SLink *member; @@ -1090,7 +1140,11 @@ int m_mode(cptr, sptr, parc, parv) && parv[2][1] == '\0') || (parv[2][1] == 'a' && parv[2][2] == '\0' && (*parv[2] == '+' || *parv[2] == '-')))) { - if (!IsMember(sptr, chptr)) + if (!IsMember(sptr, chptr) +#ifndef NO_OPEROVERRIDE + && !IsOper(sptr) +#endif + ) return 0; { struct SLink *member; @@ -1130,7 +1184,11 @@ int m_mode(cptr, sptr, parc, parv) && parv[2][1] == '\0') || (parv[2][1] == 'I' && parv[2][2] == '\0' && (*parv[2] == '+' || *parv[2] == '-')))) { - if (!IsMember(sptr, chptr)) + if (!IsMember(sptr, chptr) +#ifndef NO_OPEROVERRIDE + && !IsOper(sptr) +#endif + ) return 0; sendto_one(sptr, rpl_str(RPL_ENDOFINVITELIST), me.name, sptr->name, chptr->chname); diff --git a/src/s_user.c b/src/s_user.c index 033aa1efd..f022215eb 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -838,22 +838,22 @@ static int register_user(cptr, sptr, nick, username, umode, virthost) { /* I:line password encryption --codemastr */ #ifdef CRYPT_ILINE_PASSWORD - if (sptr->passwd) { - char salt[3]; - extern char *crypt(); + if (sptr->passwd) { + char salt[3]; + extern char *crypt(); - salt[0]=aconf->passwd[0]; - salt[1]=aconf->passwd[1]; - salt[3]='\0'; + salt[0]=aconf->passwd[0]; + salt[1]=aconf->passwd[1]; + salt[3]='\0'; - encr = crypt(sptr->passwd, salt); - } - else - encr = ""; + encr = crypt(sptr->passwd, salt); + } + else + encr = ""; #else - encr = sptr->passwd; + encr = sptr->passwd; #endif - if (!encr || !StrEq(encr, aconf->passwd)) + if (BadPtr(sptr->passwd) || !StrEq(encr, aconf->passwd)) { ircstp->is_ref++; sendto_one(sptr, err_str(ERR_PASSWDMISMATCH), @@ -866,7 +866,9 @@ static int register_user(cptr, sptr, nick, username, umode, virthost) * - Wizzu */ else - MyFree(sptr->passwd); + { + MyFree(sptr->passwd); + } } /* @@ -1026,7 +1028,7 @@ static int register_user(cptr, sptr, nick, username, umode, virthost) */ if (MyConnect(sptr)) { - if (sptr->passwd) + if (!BadPtr(sptr->passwd)) if (sptr->passwd && (nsptr = find_person(NickServ, NULL))) sendto_one(nsptr, ":%s PRIVMSG %s@%s :IDENTIFY %s", sptr->name, NickServ, SERVICES_NAME, sptr->passwd); @@ -1712,7 +1714,7 @@ int m_nick(cptr, sptr, parc, parv) /* Copy password to the passwd field if it's given after NICK * - originally by taz, modified by Wizzu */ - if ((parc > 2) && (strlen(parv[2]) < sizeof(sptr->passwd))) + if ((parc > 2) && !BadPtr(sptr->passwd) && (strlen(parv[2]) < sizeof(sptr->passwd))) { if (sptr->passwd) MyFree(sptr->passwd);