diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-02-24 11:34:47 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-02-24 11:34:47 +0800 |
commit | 0bf17643b07798d26cadeb927bde8db6c4f9fd0d (patch) | |
tree | f9f5a9338ffdd064b642a9d74e8aa618414b0f47 | |
parent | db0578da3212c0aeac388ac5f4a504462e1c82ac (diff) | |
download | pttbbs-0bf17643b07798d26cadeb927bde8db6c4f9fd0d.tar pttbbs-0bf17643b07798d26cadeb927bde8db6c4f9fd0d.tar.gz pttbbs-0bf17643b07798d26cadeb927bde8db6c4f9fd0d.tar.bz2 pttbbs-0bf17643b07798d26cadeb927bde8db6c4f9fd0d.tar.lz pttbbs-0bf17643b07798d26cadeb927bde8db6c4f9fd0d.tar.xz pttbbs-0bf17643b07798d26cadeb927bde8db6c4f9fd0d.tar.zst pttbbs-0bf17643b07798d26cadeb927bde8db6c4f9fd0d.zip |
- admin: fixed: searching user generates wrong unum
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3945 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | mbbsd/admin.c | 15 | ||||
-rw-r--r-- | mbbsd/user.c | 10 |
2 files changed, 18 insertions, 7 deletions
diff --git a/mbbsd/admin.c b/mbbsd/admin.c index e1851202..82b8b9b1 100644 --- a/mbbsd/admin.c +++ b/mbbsd/admin.c @@ -94,7 +94,7 @@ search_key_user(const char *passwdfile, int mode) { userec_t user; int ch; - int coun = 0; + int unum = 0; FILE *fp1 = fopen(passwdfile, "r"); char friendfile[128]="", key[22], *keymatch; int keytype = 0; @@ -120,15 +120,15 @@ search_key_user(const char *passwdfile, int mode) fclose(fp1); return 0; } - while ((fread(&user, sizeof(user), 1, fp1)) > 0 && coun < MAX_USERS) { + while ((fread(&user, sizeof(user), 1, fp1)) > 0 && unum++ < MAX_USERS) { // skip empty records if (!user.userid[0]) continue; - if (!(++coun & 0xFF)) { + if (!(unum & 0xFF)) { move(1, 0); - prints("第 [%d] 筆資料\n", coun); + prints("第 [%d] 筆資料\n", unum); refresh(); } @@ -169,14 +169,14 @@ search_key_user(const char *passwdfile, int mode) if(keymatch) { move(1, 0); - prints("第 [%d] 筆資料\n", coun); + prints("第 [%d] 筆資料\n", unum); refresh(); user_display(&user, 1); // user_display does not have linefeed in tail. - // + if (HasUserPerm(PERM_ACCOUNTS)) - uinfo_query(&user, 1, coun); + uinfo_query(&user, 1, unum); else outs("\n"); @@ -1623,6 +1623,7 @@ typedef struct { // [5] email: x (50) (deprecated) // [6] mobile: (deprecated) // [7] ---- + // lasthost: 16 char userid[IDLEN+1]; char exist; diff --git a/mbbsd/user.c b/mbbsd/user.c index 45b162d7..cfcc168a 100644 --- a/mbbsd/user.c +++ b/mbbsd/user.c @@ -681,6 +681,16 @@ uinfo_query(userec_t *u, int adminmode, int unum) fail = 0; mail_changed = money_changed = perm_changed = 0; + { + // verify unum + int xuid = getuser(u->userid, &x); + if (xuid != unum) + { + vmsg("系統錯誤: 使用者資料號碼 (unum) 不合。請至 " GLOBAL_BUGREPORT "報告。"); + return; + } + } + memcpy(&x, u, sizeof(userec_t)); ans = getans(adminmode ? "(1)改資料(2)密碼(3)權限(4)砍帳號(5)改ID(6)寵物(7)審判(M)信箱 [0]結束 " : |