From 3a9767c5d41375747393d16612236c2ec6e4740e Mon Sep 17 00:00:00 2001 From: piaip Date: Tue, 30 Jun 2009 06:09:06 +0000 Subject: * add Security and ALLPOST to system internal readonly boards * previously, ALLPOST was set to reject del_post by attr BRD_VOTEBOARD; however this is confusing to admins. * in order to prevent such potential issue, we'd force it to be readonly in source level. (since it has special meaning in the code) git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4716 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- include/proto.h | 1 + mbbsd/board.c | 8 ++++++++ mbbsd/cache.c | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/include/proto.h b/include/proto.h index 54c4d547..96aa0290 100644 --- a/include/proto.h +++ b/include/proto.h @@ -86,6 +86,7 @@ int check_cooldown(boardheader_t *bp); /* board */ #define setutmpbid(bid) currutmp->brc_id=bid; +int is_readonly_board(const char *bname); int enter_board(const char *boardname); int HasBoardPerm(boardheader_t *bptr); void save_brdbuf(void); diff --git a/mbbsd/board.c b/mbbsd/board.c index 17710bf5..10e743a3 100644 --- a/mbbsd/board.c +++ b/mbbsd/board.c @@ -67,6 +67,14 @@ inline boardheader_t *getparent(const boardheader_t *fh) return NULL; } +// 程式中有特別用途所以不得自行 post / 修改的看板 +int +is_readonly_board(const char *bname) +{ + return (strcasecmp(bname, BN_SECURITY) == 0 || + strcasecmp(bname, BN_ALLPOST ) == 0 ); +} + /** * @param[in] boardname board name, case insensitive * @return 0 if success diff --git a/mbbsd/cache.c b/mbbsd/cache.c index 3860dd1f..e56c162a 100644 --- a/mbbsd/cache.c +++ b/mbbsd/cache.c @@ -177,6 +177,10 @@ postperm_msg(const char *bname) if (!(i = getbnum(bname))) return "看板不存在"; + // system internal read only boards (no matter what attribute/flag set) + if (is_readonly_board(bname)) + return "看板唯讀"; + if (HasUserPerm(PERM_SYSOP)) return NULL; -- cgit v1.2.3