summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorvictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-02-18 14:00:40 +0800
committervictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-02-18 14:00:40 +0800
commit09dcd2bcb7d36c679d54aaf5339d71b289495be3 (patch)
tree972386cda82b8a4ef5b869c42242fca2e347d891 /mbbsd
parentf7f6cc32eb4cc5c7a508046381fe4e4aa6992c2e (diff)
downloadpttbbs-09dcd2bcb7d36c679d54aaf5339d71b289495be3.tar
pttbbs-09dcd2bcb7d36c679d54aaf5339d71b289495be3.tar.gz
pttbbs-09dcd2bcb7d36c679d54aaf5339d71b289495be3.tar.bz2
pttbbs-09dcd2bcb7d36c679d54aaf5339d71b289495be3.tar.lz
pttbbs-09dcd2bcb7d36c679d54aaf5339d71b289495be3.tar.xz
pttbbs-09dcd2bcb7d36c679d54aaf5339d71b289495be3.tar.zst
pttbbs-09dcd2bcb7d36c679d54aaf5339d71b289495be3.zip
fix domenu's bug
limit some function to permission PERM_LOGINOK git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2517 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/menu.c18
-rw-r--r--mbbsd/talk.c10
2 files changed, 20 insertions, 8 deletions
diff --git a/mbbsd/menu.c b/mbbsd/menu.c
index 6b45d528..7543ae8d 100644
--- a/mbbsd/menu.c
+++ b/mbbsd/menu.c
@@ -171,9 +171,10 @@ domenu(int cmdmode, char *cmdtitle, int cmd, const commands_t cmdtable[])
int lastcmdptr;
int n, pos, total, i;
int err;
+
+ // XXX do we really need this ?
static char cmd0[MODE_MAX];
- /* XXX: 傳進來的 cmd 若權限不足, 則不知 cursor 在哪, 導致 crash */
if (cmd0[cmdmode])
cmd = cmd0[cmdmode];
@@ -271,6 +272,15 @@ domenu(int cmdmode, char *cmdtitle, int cmd, const commands_t cmdtable[])
while (++i <= total)
if (cmdtable[i].desc[1] == cmd)
break;
+
+ if (!HAS_PERM(cmdtable[i].level)) {
+ for (i = 0; cmdtable[i].desc; i++)
+ if (HAS_PERM(cmdtable[i].level))
+ break;
+ if (!cmdtable[i].desc)
+ return;
+ }
+
if (cmd == 'H' && i > total){
/* TODO: Add menu help */
}
@@ -324,10 +334,10 @@ const static commands_t adminlist[] = {
const static commands_t maillist[] = {
{m_new, PERM_READMAIL, "RNew 閱\讀新進郵件"},
{m_read, PERM_READMAIL, "RRead 多功\能讀信選單"},
- {m_send, PERM_BASIC, "RSend 站內寄信"},
+ {m_send, PERM_LOGINOK, "RSend 站內寄信"},
{x_love, PERM_LOGINOK, "PPaper \033[1;32m情書產生器\033[m "},
- {mail_list, PERM_BASIC, "RMail List 群組寄信"},
- {setforward, PERM_LOGINOK,"FForward \033[32m設定信箱自動轉寄\033[m"},
+ {mail_list, PERM_LOGINOK, "RMail List 群組寄信"},
+ {setforward, PERM_LOGINOK, "FForward \033[32m設定信箱自動轉寄\033[m"},
{m_sysop, 0, "YYes, sir! 諂媚站長"},
{m_internet, PERM_INTERNET, "RInternet 寄信到 Internet"},
{mail_mbox, PERM_INTERNET, "RZip UserHome 把所有私人資料打包回去"},
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index c7db75f1..6d14f4c9 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -2647,10 +2647,12 @@ userlist(void)
break;
case 'N':
- oldgetdata(1, 0, "新的暱稱: ",
- cuser.username, sizeof(cuser.username), DOECHO);
- strcpy(currutmp->username, cuser.username);
- redrawall = redraw = 1;
+ if (HAS_PERM(PERM_LOGINOK)) {
+ oldgetdata(1, 0, "新的暱稱: ",
+ cuser.username, sizeof(cuser.username), DOECHO);
+ strcpy(currutmp->username, cuser.username);
+ redrawall = redraw = 1;
+ }
break;
case 'y':