diff options
-rw-r--r-- | pttbbs/mbbsd/angel.c | 2 | ||||
-rw-r--r-- | pttbbs/mbbsd/bbs.c | 6 | ||||
-rw-r--r-- | pttbbs/mbbsd/cache.c | 2 | ||||
-rw-r--r-- | pttbbs/mbbsd/mail.c | 34 | ||||
-rw-r--r-- | pttbbs/mbbsd/talk.c | 2 |
5 files changed, 36 insertions, 10 deletions
diff --git a/pttbbs/mbbsd/angel.c b/pttbbs/mbbsd/angel.c index 6d7e7cf6..8cdfc990 100644 --- a/pttbbs/mbbsd/angel.c +++ b/pttbbs/mbbsd/angel.c @@ -656,7 +656,7 @@ void pressanykey_or_callangel(){ int w = t_columns - 2; // see vtuikit.c, SAFE_MAX_COL - if (!HasUserPerm(PERM_LOGINOK) || + if (!HasBasicUserPerm(PERM_LOGINOK) || strcmp(cuser.myangel, "-") == 0) { pressanykey(); return; diff --git a/pttbbs/mbbsd/bbs.c b/pttbbs/mbbsd/bbs.c index e7fe5f16..9409896a 100644 --- a/pttbbs/mbbsd/bbs.c +++ b/pttbbs/mbbsd/bbs.c @@ -1617,7 +1617,11 @@ int b_call_in(int ent GCC_UNUSED, const fileheader_t * fhdr, const char *direct GCC_UNUSED) { - userinfo_t *u = search_ulist(searchuser(fhdr->owner, NULL)); + userinfo_t *u; + if (!HasBasicUserPerm(PERM_LOGINOK)) + return DONOTHING; + + u = search_ulist(searchuser(fhdr->owner, NULL)); if (u) { int fri_stat; fri_stat = friend_stat(currutmp, u); diff --git a/pttbbs/mbbsd/cache.c b/pttbbs/mbbsd/cache.c index e6d256b4..1b403f67 100644 --- a/pttbbs/mbbsd/cache.c +++ b/pttbbs/mbbsd/cache.c @@ -167,7 +167,7 @@ is_BM_cache(int bid) /* bid starts from 1 */ if (!HasUserPerm(PERM_BASIC) || !currutmp->uid || currutmp->uid == -1) return 0; // reject user who haven't complete registration. - if (!HasUserPerm(PERM_LOGINOK)) + if (!HasBasicUserPerm(PERM_LOGINOK)) return 0; // XXX hard coded MAX_BMs=4 if( currutmp->uid == pbm[0] || diff --git a/pttbbs/mbbsd/mail.c b/pttbbs/mbbsd/mail.c index b54c17b1..199db817 100644 --- a/pttbbs/mbbsd/mail.c +++ b/pttbbs/mbbsd/mail.c @@ -665,6 +665,9 @@ built_mail_index(void) { char genbuf[128]; + if (!HasUserPerm(PERM_BASIC)) + return DONOTHING; + move(b_lines - 4, 0); outs("本功\能只在信箱檔毀損時使用," ANSI_COLOR(1;33) "無法" ANSI_RESET "救回被刪除的信件。\n" "除非您清楚這個功\能的作用,否則" ANSI_COLOR(1;33) "請不要使用" ANSI_RESET "。\n" @@ -1601,7 +1604,8 @@ mail_read(int ent, fileheader_t * fhdr, const char *direct) } static int -mail_read_all(int ent GCC_UNUSED, fileheader_t * fhdr GCC_UNUSED, const char *direct GCC_UNUSED) +mail_read_all(int ent GCC_UNUSED, fileheader_t * fhdr GCC_UNUSED, + const char *direct GCC_UNUSED) { off_t i = 0, num = 0; int fd = 0; @@ -1745,17 +1749,24 @@ mail_edit(int ent GCC_UNUSED, fileheader_t * fhdr, const char *direct) } static int -mail_nooutmail(int ent GCC_UNUSED, fileheader_t * fhdr GCC_UNUSED, const char *direct GCC_UNUSED) +mail_nooutmail(int ent GCC_UNUSED, fileheader_t * fhdr GCC_UNUSED, + const char *direct GCC_UNUSED) { + if (!HasBasicUserPerm(PERM_LOGINOK)) + return DONOTHING; + pwcuToggleOutMail(); return FULLUPDATE; - } static int mail_mark(int ent, fileheader_t * fhdr, const char *direct) { - fhdr->filemode ^= FILE_MARKED; + // If user does not have proper permission, he can only unmark iems. + if (HasBasicUserPerm(PERM_LOGINOK)) + fhdr->filemode ^= FILE_MARKED; + else + fhdr->filemode &= (~FILE_MARKED); substitute_ref_record(direct, fhdr, ent); return PART_REDRAW; @@ -1844,6 +1855,9 @@ mail_cross_post(int unused_arg GCC_UNUSED, fileheader_t * fhdr, char genbuf[200]; int xbid; + if (!HasBasicUserPerm(PERM_LOGINOK)) + return DONOTHING; + // XXX TODO 為避免違法使用者大量對申訴板轉文,限定每次發文量。 if (HasUserPerm(PERM_VIOLATELAW)) { @@ -1999,6 +2013,9 @@ mail_cite(int ent GCC_UNUSED, fileheader_t * fhdr, const char *direct GCC_UNUSED char buf[20]; int bid; + if (!HasUserPerm(PERM_BASIC)) + return DONOTHING; + setuserfile(fpath, fhdr->filename); strlcpy(title, "◇ ", sizeof(title)); strlcpy(title + 3, fhdr->title, sizeof(title) - 3); @@ -2092,7 +2109,8 @@ m_read(void) #ifdef OUTJOBSPOOL static int -mail_waterball(int ent GCC_UNUSED, fileheader_t * fhdr, const char *direct GCC_UNUSED) +mail_waterball(int ent GCC_UNUSED, fileheader_t * fhdr, + const char *direct GCC_UNUSED) { static char address[60] = "", cmode = 1; char fname[500], genbuf[200]; @@ -2179,6 +2197,8 @@ mail_waterball(int ent GCC_UNUSED, fileheader_t * fhdr, const char *direct GCC_U static int mail_recycle_bin(int ent GCC_UNUSED, fileheader_t * fhdr GCC_UNUSED, const char *direct) { + if (!HasUserPerm(PERM_BASIC)) + return DONOTHING; return psb_recycle_bin(direct, "個人信箱"); } #else // USE_TIME_CAPSULE @@ -2193,6 +2213,8 @@ mail_recycle_bin(int ent GCC_UNUSED, //////////////////////////////////////////////////////////////////////// // Command List +// CAUTION: Every commands here should check permission. + static const onekey_t mail_comms[] = { { 0, NULL }, // Ctrl('A') { 0, NULL }, // Ctrl('B') @@ -2247,7 +2269,7 @@ static const onekey_t mail_comms[] = { { 0, NULL }, // 'Q' { 1, mail_reply }, // 'R' { 0, NULL }, // 'S' - { 1, edit_title }, // 'T' + { 1, NULL }, // 'T' { 0, NULL }, // 'U' { 0, NULL }, // 'V' { 0, NULL }, // 'W' diff --git a/pttbbs/mbbsd/talk.c b/pttbbs/mbbsd/talk.c index 6d37a0c9..a02df0d4 100644 --- a/pttbbs/mbbsd/talk.c +++ b/pttbbs/mbbsd/talk.c @@ -2693,7 +2693,7 @@ t_users(void) int mode0 = currutmp->mode; int stat0 = currstat; - if (!HasUserPerm(PERM_LOGINOK)) + if (!HasBasicUserPerm(PERM_LOGINOK)) return 0; assert(strncmp(cuser.userid, currutmp->userid, IDLEN)==0); |