我们的bbs还没成为正式会员……嚎叫一下先。。。
http://bbs.zzu.edu.cn/ZZU/con?B=BBSDev&F=M.1104075813.A
然后再说正事……
以前存在的问题:
1.telnet下能看到有READ限制的“隐藏版面”的精华区
方法:!hasreadperm(&(xdir->header))
2.telnet下任何用户都可以看到所有俱乐部的精华区
方法:!USERPERM(currentuser, PERM_SYSOP) && xdir->header.flag & CLOSECLUB_FLAG
然后!clubtest(xdir->header.filename)
--- announce.c.bak 2004-09-02 18:33:42.000000000 +0800
+++ announce.c 2004-12-26 22:59:33.000000000 +0800
1. int a_loadnames(pm) 函数里。
@@ -244,6 +253,7 @@
ITEM litem;
char buf[PATHLEN], *ptr;
char hostname[STRLEN];
+ static struct boardmem *xdir = NULL;
: 先定义一个boardmem
pm->num = 0;
if (snprintf(buf, PATHLEN, "%s/.Names", pm->path) > PATHLEN - 1)
@@ -259,8 +269,15 @@
strncpy(litem.title, buf + 5, 72);
litem.title[71] = '\0';
} else if (strncmp(buf, "Path=", 5) == 0) {
- if (strncmp(buf, "Path=~/", 7) == 0)
+ if (strncmp(buf, "Path=~/", 7) == 0) {
: 开始干活
strncpy(litem.fname, buf + 7, 80);
+ xdir = getbcache(litem.fname);
+ if (xdir && !hasreadperm(&(xdir->header)))
+ continue;
+ if (xdir && !USERPERM(currentuser, PERM_SYSOP) && xdir->header.flag & CLOSECLUB_FLAG)
+ if (!clubtest(xdir->header.filename))
+ continue;
+ }
else
strncpy(litem.fname, buf + 5, 80);
litem.fname[79] = '\0';
2. int a_menusearch(path, key, level)函数
@@ -602,6 +619,7 @@
char buf[PATHLEN], *ptr;
char found[PATHLEN];
int searchmode = 0;
+ static struct boardmem *xdir = NULL;
: 同上
if (key == NULL) {
key = bname;
@@ -611,6 +629,12 @@
found[0] = '\0';
sprintf(buf, "0Announce/.Search");
if (key[0] != '\0' && (fn = fopen(buf, "r")) != NULL) {
: 干活开始
+ xdir = getbcache(key);
+ if (xdir && !hasreadperm(&(xdir->header)))
+ return 0;
+ if (xdir && !USERPERM(currentuser, PERM_SYSOP) && xdir->header.flag & CLOSECLUB_FLAG)
+ if (!clubtest(xdir->header.filename))
+ return 0;
while (fgets(buf, sizeof (buf), fn) != NULL) {
if (searchmode && !strstr(buf, "groups/"))
continue;
@@ -1490,7 +1514,7 @@
me.page = 999;
break;
}
- if (deny_me(bname)
+ if ((deny_me(bname) || deny_me_global())
&& !USERPERM(currentuser, PERM_SYSOP)) {
move(5, 0);
clrtobot();
@@ -1511,6 +1535,15 @@
me.page = 999;
break;
}
+ if (!strcmp(bname, "syssecurity")) {
+ move(5, 0);
+ clrtobot();
+ prints
+ ("\n\n 很抱歉,您不能修改系统记录区。");
+ pressreturn();
+ me.page = 999;
+ break;
+ }
if (club_board(bname, bnum)) {
if (!clubtest(bname)
&& !USERPERM(currentuser,
@@ -1894,8 +1927,9 @@
{
sprintf(genbuf, "%s 精华区公布栏", MY_BBS_NAME);
a_menu(genbuf, "0Announce", (USERPERM(currentuser, PERM_ANNOUNCE)
- || USERPERM(currentuser, PERM_SYSOP)) ?
- PERM_BOARDS : 0, 0);
+ || USERPERM(currentuser, PERM_SYSOP)
+ || USERPERM(currentuser, PERM_OBOARDS)) ?
+ PERM_BOARDS : 0, 0);
clear();
}
@@ -1983,8 +2017,9 @@
break;
}
a_menu(genbuf, buf, (USERPERM(currentuser, PERM_ANNOUNCE)
- || USERPERM(currentuser,
- PERM_SYSOP)) ? PERM_BOARDS : 0, 0);
+ || USERPERM(currentuser, PERM_SYSOP)
+ || USERPERM(currentuser, PERM_OBOARDS)) ?
+ PERM_BOARDS : 0, 0);
}
--
FROM 222.22.10.*