Changeset f3c60e6 in code


Ignore:
Timestamp:
Mar 6, 2014, 3:30:44 PM (11 years ago)
Author:
Mike Belopuhov <mike@…>
Branches:
master
Children:
460786f
Parents:
3fdebb8
git-author:
Mike Belopuhov <mike@…> (03/06/14 15:27:45)
git-committer:
Mike Belopuhov <mike@…> (03/06/14 15:30:44)
Message:

After some deliberation we have decided that if modtab is enabled
then it should be possible to steal the moderation.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cmd.c

    r3fdebb8 rf3c60e6  
    303303        char whom[ICB_MAXNICKLEN];
    304304
    305         if (!ig->mod) {         /* if there is no mod, let anyone grab it */
    306                 if (icb_pass(ig, ig->mod, is) < 0)
     305        if (!ig->mod) {         /* if there is no mod, try grabbing it */
     306                if (icb_modpermit(is, 0) && icb_pass(ig, ig->mod, is) < 0)
    307307                        icb_error(is, "Acquiring group moderation failed.");
    308308        } else if (icb_ismod(ig, is)) {
     
    321321                        return;
    322322                }
    323                 if (icb_pass(ig, ig->mod, s) < 0)
     323                if (icb_modpermit(s, 0) && icb_pass(ig, ig->mod, s) < 0)
    324324                        icb_error(s, "Acquiring group moderation failed.");
     325        } else {
     326                /*
     327                 * if group is moderated and we're not the moderator,
     328                 * but modtab is enabled, then check the permission
     329                 * and pass moderation if successful.
     330                 */
     331                if (icb_modpermit(is, 1) && icb_pass(ig, ig->mod, is) < 0)
     332                        icb_error(is, "Acquiring group moderation failed.");
    325333        }
    326334}
  • icb.c

    r3fdebb8 rf3c60e6  
    3737void   icb_login(struct icb_session *, char *, char *, char *);
    3838int    icb_dowho(struct icb_session *, struct icb_group *);
    39 int    icb_modpermit(struct icb_session *);
    4039char  *icb_nextfield(char **);
    4140
     
    547546 */
    548547int
    549 icb_modpermit(struct icb_session *is)
     548icb_modpermit(struct icb_session *is, int enforce)
    550549{
    551550        extern char modtab[ICB_MTABLEN][ICB_MAXNICKLEN];
    552551        extern int modtabcnt;
    553552
    554         if (modtabcnt == 0 ||
     553        if ((enforce ? 0 : modtabcnt == 0) ||
    555554            bsearch(is->nick, modtab, modtabcnt, ICB_MAXNICKLEN,
    556555            (int (*)(const void *, const void *))strcmp))
     
    572571                return (-1);
    573572        if (!from && !to)
    574                 return (-1);
    575         if (to && !icb_modpermit(to))
    576573                return (-1);
    577574        ig->mod = to;
  • icb.h

    r3fdebb8 rf3c60e6  
    129129void             icb_input(struct icb_session *);
    130130inline int       icb_ismod(struct icb_group *, struct icb_session *);
    131 int              icb_modpermit(struct icb_session *);
     131int              icb_modpermit(struct icb_session *, int);
    132132int              icb_pass(struct icb_group *, struct icb_session *,
    133133                     struct icb_session *);
Note: See TracChangeset for help on using the changeset viewer.