summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/bbs/Makefile1
-rw-r--r--common/bbs/string.c13
-rw-r--r--include/cmbbs.h3
-rw-r--r--include/config.h6
-rw-r--r--mbbsd/Makefile2
-rw-r--r--mbbsd/bbs.c8
-rw-r--r--mbbsd/board.c5
-rw-r--r--mbbsd/edit.c7
-rw-r--r--mbbsd/mbbsd.c10
-rw-r--r--mbbsd/register.c12
-rw-r--r--mbbsd/talk.c30
-rw-r--r--mbbsd/var.c1
12 files changed, 74 insertions, 24 deletions
diff --git a/common/bbs/Makefile b/common/bbs/Makefile
index ce53c79a..e3aae6e0 100644
--- a/common/bbs/Makefile
+++ b/common/bbs/Makefile
@@ -5,6 +5,7 @@ SRCROOT= ../..
CFLAGS+= -I$(SRCROOT)/include
OBJS= log.o file.o money.o names.o path.o string.o
+# record.o
TARGET= libcmbbs.a
diff --git a/common/bbs/string.c b/common/bbs/string.c
index 8b137891..60b03b37 100644
--- a/common/bbs/string.c
+++ b/common/bbs/string.c
@@ -1 +1,14 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "cmbbs.h"
+void obfuscate_ipstr(char *s)
+{
+ s = strrchr(s, '.');
+ if (!s) return;
+ if (!*++s) return;
+ // s points to a.'b'
+ *s++ = '*';
+ *s = 0;
+}
diff --git a/include/cmbbs.h b/include/cmbbs.h
index b6c69adb..a7416a36 100644
--- a/include/cmbbs.h
+++ b/include/cmbbs.h
@@ -31,4 +31,7 @@ extern int belong(const char *filelist, const char *key);
extern int give_tax(int money);
extern const char* money_level(int money);
+/* string.c */
+extern void obfuscate_ipstr(char *s);
+
#endif
diff --git a/include/config.h b/include/config.h
index 825b1ec4..28b547a1 100644
--- a/include/config.h
+++ b/include/config.h
@@ -304,4 +304,10 @@
#define MAXTAGS 255
#define WRAPMARGIN (511)
+#ifdef USE_MASKED_FROMHOST
+#define FROMHOST fromhost_masked
+#else
+#define FROMHOST fromhost
+#endif
+
#endif
diff --git a/mbbsd/Makefile b/mbbsd/Makefile
index c0e920e9..17156401 100644
--- a/mbbsd/Makefile
+++ b/mbbsd/Makefile
@@ -118,7 +118,7 @@ initemaildb: emaildb.c
$(CC) -DINIT_MAIN $(CFLAGS) $(LDFLAGS) -o initemaildb emaildb.c $(LIBS)
ctags:
- exctags *.c ../include/*.h ../common/sys/*.c ../common/bbs/*.c
+ ctags *.c ../include/*.h ../common/sys/*.c ../common/bbs/*.c
test: $(PROG)
killall -9 testmbbsd || true
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index cce0ff26..a2cfb0bd 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -1880,7 +1880,7 @@ cross_post(int ent, fileheader_t * fhdr, const char *direct)
#ifdef GUESTRECOMMEND
snprintf(tail, sizeof(tail),
"%15s %02d/%02d",
- fromhost,
+ FROMHOST,
ptime->tm_mon + 1, ptime->tm_mday);
#else
maxlength += (15 - 6);
@@ -2933,7 +2933,7 @@ recommend(int ent, fileheader_t * fhdr, const char *direct)
{
snprintf(tail, sizeof(tail),
"%15s %02d/%02d %02d:%02d",
- fromhost,
+ FROMHOST,
ptime->tm_mon+1, ptime->tm_mday,
ptime->tm_hour, ptime->tm_min);
} else {
@@ -3062,10 +3062,8 @@ del_range(int ent, const fileheader_t *fhdr, const char *direct)
if(bp && !(currmode & MODE_DIGEST) && bp->nuser > 30 )
safe_article_delete_range(direct, inum1, inum2);
else
- delete_range(direct, inum1, inum2);
-#else
- delete_range(direct, inum1, inum2);
#endif
+ delete_range(direct, inum1, inum2);
fixkeep(direct, inum1);
if ((curredit & EDIT_MAIL)==0 && (currmode & MODE_BOARD)) // Ptt:update cache
diff --git a/mbbsd/board.c b/mbbsd/board.c
index bc7ae394..cc8304c9 100644
--- a/mbbsd/board.c
+++ b/mbbsd/board.c
@@ -1879,7 +1879,10 @@ choose_board(int newflag)
brc_finalize();
last_save_fav_and_brc = now;
- }
+ vmsg("已儲存看板閱\讀記錄");
+ } else
+ vmsgf("間隔時間太近,未儲存看板閱\讀記錄 [請等 %d 秒後再試]",
+ 600 - (now-last_save_fav_and_brc));
break;
///////////////////////////////////////////////////////
diff --git a/mbbsd/edit.c b/mbbsd/edit.c
index c6b3a544..9b4f9d2a 100644
--- a/mbbsd/edit.c
+++ b/mbbsd/edit.c
@@ -1577,7 +1577,7 @@ addsignature(FILE * fp, int ifuseanony)
if (!strcmp(cuser.userid, STR_GUEST)) {
fprintf(fp, "\n--\n※ 發信站 :" BBSNAME "(" MYHOSTNAME
- ") \n◆ From: %s\n", fromhost);
+ ") \n◆ From: %s\n", FROMHOST);
return;
}
if (!ifuseanony) {
@@ -1646,7 +1646,7 @@ browse_sigs:
{
char temp[33];
- strlcpy(temp, fromhost, sizeof(temp));
+ strlcpy(temp, FROMHOST, sizeof(temp));
fprintf(fp, "\n--\n※ 發信站: " BBSNAME "(" MYHOSTNAME
") \n◆ From: %s\n", temp);
}
@@ -1826,7 +1826,8 @@ write_file(char *fpath, int saveheader, int *islocal, char *mytitle, int upload,
ptime = localtime4(&now);
fprintf(fp,
"※ 編輯: %-15s 來自: %-20s (%02d/%02d %02d:%02d)\n",
- cuser.userid, fromhost,
+ cuser.userid,
+ FROMHOST,
ptime->tm_mon + 1, ptime->tm_mday,
ptime->tm_hour, ptime->tm_min);
}
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index 0c561ed1..a8e6e453 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -983,8 +983,8 @@ setup_utmp(int mode)
#ifndef FAST_LOGIN
setuserfile(buf, "remoteuser");
- strlcpy(remotebuf, fromhost, sizeof(fromhost));
- strcat(remotebuf, ctime4(&now));
+ strlcpy(remotebuf, fromhost, sizeof(remotebuf));
+ strlcat(remotebuf, ctime4(&now), sizeof(remotebuf));
chomp(remotebuf);
add_distinct(buf, remotebuf);
#endif
@@ -1147,6 +1147,10 @@ user_login(void)
lasttime = *localtime4(&cuser.lastlogin);
redrawwin();
+ /* mask fromhost a.b.c.d to a.b.c.* */
+ strlcpy(fromhost_masked, fromhost, sizeof(fromhost_masked));
+ obfuscate_ipstr(fromhost_masked);
+
/* show welcome_login */
if( (ifbirth = (ptime.tm_mday == cuser.day &&
ptime.tm_mon + 1 == cuser.month)) ){
@@ -1584,7 +1588,7 @@ shell_login(int argc, char *argv[], char *envp[])
* original "bbs"
*/
if (argc > 1) {
- strcpy(fromhost, argv[1]);
+ strlcpy(fromhost, argv[1], sizeof(fromhost));
if (argc > 3)
strlcpy(remoteusername, argv[3], sizeof(remoteusername));
}
diff --git a/mbbsd/register.c b/mbbsd/register.c
index d78d2144..230c1d9a 100644
--- a/mbbsd/register.c
+++ b/mbbsd/register.c
@@ -1914,7 +1914,7 @@ regform2_validate_single()
}
// TODO check if user is already registered
-#if 0
+#ifdef DBG_DRYRUN
if (muser.userlevel & PERM_LOGINOK)
{
regfrm_delete(uid);
@@ -2028,7 +2028,15 @@ regform2_validate_page(int dryrun)
regq_delete(uid);
continue;
}
-
+
+ // TODO check if user is already registered
+#ifdef DBG_DRYRUN
+ if (muser.userlevel & PERM_LOGINOK)
+ {
+ regfrm_delete(uid);
+ continue;
+ }
+#endif
// check if regform exists.
if (!regfrm_exist(uid))
{
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index 70bcdb97..aab25b28 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -14,9 +14,10 @@ static char * const withme_str[] = {
};
#define MAX_SHOW_MODE 6
-#define M_INT 15 /* monitor mode update interval */
-#define P_INT 20 /* interval to check for page req. in
- * talk/chat */
+/* M_INT: monitor mode update interval */
+#define M_INT 15
+/* P_INT: interval to check for page req. in talk/chat */
+#define P_INT 20
#define BOARDFRI 1
#define TALK_MAXCOL (78)
@@ -461,17 +462,21 @@ my_query(const char *uident)
if ((uentp = (userinfo_t *) search_ulist(tuid)))
fri_stat = friend_stat(currutmp, uentp);
- prints("《ID暱稱》%s(%s)%*s《經濟狀況》%s",
+ prints("《ID暱稱》%s (%s)%*s《經濟狀況》%s",
muser.userid,
muser.nickname,
- strlen(muser.userid) + strlen(muser.nickname) >= 26 ? 0 :
- (int)(26 - strlen(muser.userid) - strlen(muser.nickname)), "",
+ strlen(muser.userid) + strlen(muser.nickname) >= 25 ? 0 :
+ (int)(25 - strlen(muser.userid) - strlen(muser.nickname)), "",
money_level(muser.money));
if (uentp && ((fri_stat & HFM && !uentp->invisible) || strcmp(muser.userid,cuser.userid) == 0))
prints(" ($%d)", muser.money);
outc('\n');
prints("《上站次數》%d次", muser.numlogins);
+#ifdef SHOW_LOGINOK
+ if (!(muser.userlevel & PERM_LOGINOK))
+ outs(" (尚未通過認證)");
+#endif
move(2, 40);
#ifdef ASSESS
prints("《文章篇數》%d篇 (優:%d/劣:%d)\n", muser.numposts, muser.goodpost, muser.badpost);
@@ -486,9 +491,16 @@ my_query(const char *uident)
outs(((uentp && ISNEWMAIL(uentp)) || load_mailalert(muser.userid))
? "《私人信箱》有新進信件還沒看\n" :
"《私人信箱》所有信件都看過了\n");
- prints("《上次上站》%-28.28s《上次故鄉》%s\n",
- Cdate(&muser.lastlogin),
- (muser.lasthost[0] ? muser.lasthost : "(不詳)"));
+ prints("《上次上站》%-28.28s《上次故鄉》",
+ Cdate(&muser.lastlogin));
+ // print out muser.lasthost
+#ifdef USE_MASKED_FROMHOST
+ if(!HasUserPerm(PERM_SYSOP|PERM_ACCOUNTS))
+ obfuscate_ipstr(muser.lasthost);
+#endif // !USE_MASKED_FROMHOST
+ outs(muser.lasthost[0] ? muser.lasthost : "(不詳)");
+ outs("\n");
+
prints("《五子棋戰績》%3d 勝 %3d 敗 %3d 和 "
"《象棋戰績》%3d 勝 %3d 敗 %3d 和\n",
muser.five_win, muser.five_lose, muser.five_tie,
diff --git a/mbbsd/var.c b/mbbsd/var.c
index 9f1932cb..d467f811 100644
--- a/mbbsd/var.c
+++ b/mbbsd/var.c
@@ -379,6 +379,7 @@ char local_article;
/* mbbsd.c */
char raw_connection = 0;
char fromhost[STRLEN] = "\0";
+char fromhost_masked[32] = "\0"; // masked 'fromhost'
char water_usies = 0;
FILE *fp_writelog = NULL;
water_t *water, *swater[6], *water_which;