From 99b0a1a8c53a7eef4347c7d9be8c425abaa4efbf Mon Sep 17 00:00:00 2001 From: scw Date: Thu, 16 Sep 2004 03:18:25 +0000 Subject: Check angel permission before starting conversation. Adding MAP_PRIVATE flag when getting MAP_ANON from mmap(). (on Linux, without this flag causes EINVAL) git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2197 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/stuff.c | 3 ++- mbbsd/talk.c | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'mbbsd') diff --git a/mbbsd/stuff.c b/mbbsd/stuff.c index d35be51b..2f41f536 100644 --- a/mbbsd/stuff.c +++ b/mbbsd/stuff.c @@ -719,7 +719,8 @@ show_help(char * const helptext[]) void *MALLOC(int size) { int *p; - p = (int *)mmap(NULL, (size + 4), PROT_READ | PROT_WRITE, MAP_ANON, -1, 0); + p = (int *)mmap(NULL, (size + 4), PROT_READ | PROT_WRITE, + MAP_ANON | MAP_PRIVATE, -1, 0); p[0] = size; #if defined(DEBUG) && !defined(_BBS_UTIL_C_) vmsg("critical malloc %d bytes", size); diff --git a/mbbsd/talk.c b/mbbsd/talk.c index 40d44668..39e142ae 100644 --- a/mbbsd/talk.c +++ b/mbbsd/talk.c @@ -3028,6 +3028,14 @@ AngelNotOnline(){ static void TalkToAngel(){ userinfo_t* uent; + static int AngelPermChecked = 0; + + if (cuser.myangel[0] && !AngelPermChecked) { + getuser(cuser.myangel); + if (!(xuser.userlevel & PERM_ANGEL)) + cuser.myangel[0] = 0; + } + AngelPermChecked = 1; if (cuser.myangel[0] == 0 && ! FindAngel()){ NoAngelFound("現在沒有小天使在線上"); -- cgit v1.2.3