summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-04-16 18:53:40 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-04-16 18:53:40 +0800
commite20bd69d66148c34fee47e1f1f372963a871c047 (patch)
tree96f18d561f95892630b60c4f9ab0f7135c312d61
parente9c609d85c53f5a03a08942d65432bb7880b28ed (diff)
downloadpttbbs-e20bd69d66148c34fee47e1f1f372963a871c047.tar
pttbbs-e20bd69d66148c34fee47e1f1f372963a871c047.tar.gz
pttbbs-e20bd69d66148c34fee47e1f1f372963a871c047.tar.bz2
pttbbs-e20bd69d66148c34fee47e1f1f372963a871c047.tar.lz
pttbbs-e20bd69d66148c34fee47e1f1f372963a871c047.tar.xz
pttbbs-e20bd69d66148c34fee47e1f1f372963a871c047.tar.zst
pttbbs-e20bd69d66148c34fee47e1f1f372963a871c047.zip
- change sender address of auto forward to forwarder, to prevent confusion caused by incorrect forward settings.
- (internal) change bsmtp to allow assigning from address git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4173 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--include/proto.h2
-rw-r--r--mbbsd/bbs.c11
-rw-r--r--mbbsd/cal.c6
-rw-r--r--mbbsd/mail.c25
-rw-r--r--mbbsd/record.c8
-rw-r--r--mbbsd/register.c8
-rw-r--r--util/outmail.c2
7 files changed, 21 insertions, 41 deletions
diff --git a/include/proto.h b/include/proto.h
index 0b7f99ff..0b2cebde 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -368,7 +368,7 @@ int mail_id(const char* id, const char *title, const char *filename, const char
int m_read(void);
int doforward(const char *direct, const fileheader_t *fh, int mode);
int mail_reply(int ent, fileheader_t *fhdr, const char *direct);
-int bsmtp(const char *fpath, const char *title, const char *rcpt);
+int bsmtp(const char *fpath, const char *title, const char *rcpt, const char *from);
void hold_mail(const char *fpath, const char *receiver);
void m_init(void);
int chkmailbox(void);
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index ec4a3aa1..dcd485f4 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -1237,13 +1237,7 @@ do_general(int isbid)
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)
+ if ( bsmtp(fpath, save_title, str + 1, NULL) < 0)
msg = "作者無法收信";
} else {
// unknown user id
@@ -4117,6 +4111,7 @@ Select(void)
void
mobile_message(const char *mobile, char *message)
{
- bsmtp(fpath, title, rcpt);
+ // this is for validation.
+ bsmtp(fpath, title, rcpt, "non-exist");
}
#endif
diff --git a/mbbsd/cal.c b/mbbsd/cal.c
index c593d82d..4480b1bd 100644
--- a/mbbsd/cal.c
+++ b/mbbsd/cal.c
@@ -227,11 +227,7 @@ osong(void)
hold_mail(filename, receiver);
if (address[0]) {
-#ifndef USE_BSMTP
- bbs_sendmail(filename, save_title, address);
-#else
- bsmtp(filename, save_title, address);
-#endif
+ bsmtp(filename, save_title, address, NULL);
}
clear();
outs(
diff --git a/mbbsd/mail.c b/mbbsd/mail.c
index 6cde69f7..2fa6f894 100644
--- a/mbbsd/mail.c
+++ b/mbbsd/mail.c
@@ -422,12 +422,7 @@ do_send(const char *userid, const char *title)
break;
default:
outs("Y\n請稍候, 信件傳遞中...\n");
- res =
-#ifndef USE_BSMTP
- bbs_sendmail(fpath, save_title, userid);
-#else
- bsmtp(fpath, save_title, userid);
-#endif
+ res = bsmtp(fpath, save_title, userid, NULL);
hold_mail(fpath, userid);
}
unlink(fpath);
@@ -1901,12 +1896,15 @@ bbs_sendmail(const char *fpath, const char *title, char *receiver)
#else /* USE_BSMTP */
int
-bsmtp(const char *fpath, const char *title, const char *rcpt)
+bsmtp(const char *fpath, const char *title, const char *rcpt, const char *from)
{
char buf[80], *ptr;
time4_t chrono;
MailQueue mqueue;
+ if (!from)
+ from = cuser.userid;
+
/* check if the mail is a inner mail */
if ((ptr = strstr(rcpt, str_mail_address)) || !strchr(rcpt, '@')) {
char hacker[20];
@@ -1939,8 +1937,10 @@ bsmtp(const char *fpath, const char *title, const char *rcpt)
// XXX (unused) mqueue.method = method;
strlcpy(mqueue.filepath, fpath, sizeof(mqueue.filepath));
strlcpy(mqueue.subject, title, sizeof(mqueue.subject));
- strlcpy(mqueue.sender, cuser.userid, sizeof(mqueue.sender));
- strlcpy(mqueue.username, cuser.nickname, sizeof(mqueue.username));
+ strlcpy(mqueue.sender, from, sizeof(mqueue.sender));
+ // username is deprecated: why use it?
+ // strlcpy(mqueue.username, username, sizeof(mqueue.username));
+ strlcpy(mqueue.username, "", sizeof(mqueue.username));
strlcpy(mqueue.rcpt, rcpt, sizeof(mqueue.rcpt));
if (append_record("out/" FN_DIR, (fileheader_t *) & mqueue, sizeof(mqueue)) < 0)
@@ -2035,12 +2035,7 @@ doforward(const char *direct, const fileheader_t * fh, int mode)
} else
return -1;
- return_no =
-#ifndef USE_BSMTP
- bbs_sendmail(fname, fh->title, address);
-#else
- bsmtp(fname, fh->title, address);
-#endif
+ return_no = bsmtp(fname, fh->title, address, NULL);
unlink(fname);
return (return_no);
}
diff --git a/mbbsd/record.c b/mbbsd/record.c
index d6269ce3..0afba2c7 100644
--- a/mbbsd/record.c
+++ b/mbbsd/record.c
@@ -636,11 +636,9 @@ append_record_forward(char *fpath, fileheader_t * record, int size, const char *
buf[n + 1] = 0;
strcat(buf, record->filename);
append_record(fpath, record, size);
-#ifndef USE_BSMTP
- bbs_sendmail(buf, record->title, address);
-#else
- bsmtp(buf, record->title, address);
-#endif
+ // because too many user set wrong forward address,
+ // let's but them instead.
+ bsmtp(buf, record->title, address, origid);
return 0;
}
}
diff --git a/mbbsd/register.c b/mbbsd/register.c
index 673baed4..519e47f5 100644
--- a/mbbsd/register.c
+++ b/mbbsd/register.c
@@ -388,7 +388,7 @@ justify_wait(char *userid, char *phone, char *career,
static void
email_justify(const userec_t *muser)
{
- char tmp[IDLEN + 1], buf[256], genbuf[256];
+ char buf[256], genbuf[256];
/*
* It is intended to use BBSENAME instead of BBSNAME here.
* Because recently many poor users with poor mail clients
@@ -401,16 +401,12 @@ email_justify(const userec_t *muser)
snprintf(buf, sizeof(buf),
" " BBSENAME " - [ %s ]", makeregcode(genbuf));
- strlcpy(tmp, cuser.userid, sizeof(tmp));
- // XXX dirty, set userid=SYSOP
- strlcpy(cuser.userid, str_sysop, sizeof(cuser.userid));
#ifdef HAVEMOBILE
if (strcmp(muser->email, "m") == 0 || strcmp(muser->email, "M") == 0)
mobile_message(mobile, buf);
else
#endif
- bsmtp("etc/registermail", buf, muser->email);
- strlcpy(cuser.userid, tmp, sizeof(cuser.userid));
+ bsmtp("etc/registermail", buf, muser->email, "non-exist");
move(20,0);
clrtobot();
outs("我們即將寄出認證信 (您應該會在 10 分鐘內收到)\n"
diff --git a/util/outmail.c b/util/outmail.c
index 4cf161d9..fe2d05f6 100644
--- a/util/outmail.c
+++ b/util/outmail.c
@@ -180,7 +180,7 @@ void listQueue() {
flock(fd, LOCK_EX);
while(read(fd, &mq, sizeof(mq)) > 0) {
- printf("%s:%s -> %s:%s\n", mq.filepath, mq.username, mq.rcpt,
+ printf("%s:%s -> %s:%s\n", mq.filepath, mq.sender, mq.rcpt,
mq.subject);
counter++;
}