summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-01-25 19:54:23 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-01-25 19:54:23 +0800
commitb8aec7de4e1eb937905cdf8e61bbfbec6b12571d (patch)
treea477557e7c4cf39a754247a13e07d534c016a0e8
parentdc98fd2dabcb26ecb04871b6222d2cdecb488cb2 (diff)
downloadpttbbs-b8aec7de4e1eb937905cdf8e61bbfbec6b12571d.tar
pttbbs-b8aec7de4e1eb937905cdf8e61bbfbec6b12571d.tar.gz
pttbbs-b8aec7de4e1eb937905cdf8e61bbfbec6b12571d.tar.bz2
pttbbs-b8aec7de4e1eb937905cdf8e61bbfbec6b12571d.tar.lz
pttbbs-b8aec7de4e1eb937905cdf8e61bbfbec6b12571d.tar.xz
pttbbs-b8aec7de4e1eb937905cdf8e61bbfbec6b12571d.tar.zst
pttbbs-b8aec7de4e1eb937905cdf8e61bbfbec6b12571d.zip
- bbs: prevent post-reply respond to invalid user
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3864 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/bbs.c40
1 files changed, 28 insertions, 12 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 172ffd8e..34aa40cf 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -1104,19 +1104,23 @@ do_general(int isbid)
/* 回應到原作者信箱 */
if (curredit & EDIT_BOTH) {
- char *str, *msg = "回應至作者信箱";
+ char *str, *msg = "回應至作者信箱";
- if ((str = strchr(quote_user, '.'))) {
- if (
-#ifndef USE_BSMTP
- bbs_sendmail(fpath, save_title, str + 1)
-#else
- bsmtp(fpath, save_title, str + 1)
-#endif
- < 0)
- msg = "作者無法收信";
- } else {
+ genbuf[0] = 0;
+ // XXX quote_user may contain invalid user, like '-' (deleted).
+ if (is_validuserid(quote_user))
+ {
sethomepath(genbuf, quote_user);
+ if (!dashd(genbuf))
+ {
+ genbuf[0] = 0;
+ msg = err_uid;
+ }
+ }
+
+ // now, genbuf[0] = "if user exists".
+ if (genbuf[0])
+ {
stampfile(genbuf, &postfile);
unlink(genbuf);
Copy(fpath, genbuf);
@@ -1128,6 +1132,18 @@ do_general(int isbid)
msg = err_uid;
else
sendalert(quote_user, ALERT_NEW_MAIL);
+ } else if ((str = strchr(quote_user, '.'))) {
+ if (
+#ifndef USE_BSMTP
+ bbs_sendmail(fpath, save_title, str + 1)
+#else
+ bsmtp(fpath, save_title, str + 1)
+#endif
+ < 0)
+ msg = "作者無法收信";
+ } else {
+ // unknown user id
+ msg = "作者無法收信";
}
outs(msg);
curredit ^= EDIT_BOTH;
@@ -3718,7 +3734,7 @@ const onekey_t read_comms[] = {
#else
{ 0, NULL }, // 'J'
#endif
- { 0, NULL }, // 'K'
+ { 0, b_moved_to_config }, // 'K'
{ 1, solve_post }, // 'L'
{ 0, b_moved_to_config }, // 'M'
{ 0, NULL }, // 'N'