summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mbbsd/mbbsd.c15
-rw-r--r--sample/pttbbs.conf5
2 files changed, 20 insertions, 0 deletions
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index bdcbd0a3..b112b821 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -959,7 +959,22 @@ setup_utmp(int mode)
//strlcpy(uinfo.realname, cuser.realname, sizeof(uinfo.realname));
strlcpy(uinfo.nickname, cuser.nickname, sizeof(uinfo.nickname));
strip_nonebig5((unsigned char *)uinfo.nickname, sizeof(uinfo.nickname));
+#ifdef FROMD
+ {
+ int fd;
+ if ( (fd = toconnect(FROMD_HOST, FROMD_PORT)) >= 0 ) {
+ write(fd, fromhost, strlen(fromhost));
+ // uinfo.from is zerod, so we don't care about read length
+ read(fd, uinfo.from, sizeof(uinfo.from));
+ close(fd);
+ }
+ else {
+ strlcpy(uinfo.from, fromhost, sizeof(uinfo.from));
+ }
+ }
+#else
strlcpy(uinfo.from, fromhost, sizeof(uinfo.from));
+#endif
uinfo.five_win = cuser.five_win;
uinfo.five_lose = cuser.five_lose;
uinfo.five_tie = cuser.five_tie;
diff --git a/sample/pttbbs.conf b/sample/pttbbs.conf
index f19f99db..7dc51b56 100644
--- a/sample/pttbbs.conf
+++ b/sample/pttbbs.conf
@@ -273,6 +273,11 @@
/* 在 cacheserver 上面擋掉狂上下站的使用者 */
//#define NOFLOODING
+/* 使用 fromd, 使用外部daemon紀錄上站故鄉名稱 */
+//#define FROMD
+//#define FROMD_HOST "127.0.0.1"
+//#define FROMD_PORT "5130"
+
/* 若定義, 則不允許註冊 guest */
//#define NO_GUEST_ACCOUNT_REG