summaryrefslogtreecommitdiffstats
path: root/mbbsd/record.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-06-18 11:47:32 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-06-18 11:47:32 +0800
commit1ec23af080cec423ced22f77d2fccdb87c8feba9 (patch)
tree76d12061c970a01931ce7276f21a971f542055b2 /mbbsd/record.c
parentdf5492a36f163bb6dd7649bcde7bfdb237f84bf6 (diff)
downloadpttbbs-1ec23af080cec423ced22f77d2fccdb87c8feba9.tar
pttbbs-1ec23af080cec423ced22f77d2fccdb87c8feba9.tar.gz
pttbbs-1ec23af080cec423ced22f77d2fccdb87c8feba9.tar.bz2
pttbbs-1ec23af080cec423ced22f77d2fccdb87c8feba9.tar.lz
pttbbs-1ec23af080cec423ced22f77d2fccdb87c8feba9.tar.xz
pttbbs-1ec23af080cec423ced22f77d2fccdb87c8feba9.tar.zst
pttbbs-1ec23af080cec423ced22f77d2fccdb87c8feba9.zip
some idiots autoforward to themselves
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2845 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/record.c')
-rw-r--r--mbbsd/record.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/mbbsd/record.c b/mbbsd/record.c
index 7d57e471..00c8f11e 100644
--- a/mbbsd/record.c
+++ b/mbbsd/record.c
@@ -579,10 +579,30 @@ append_record_forward(char *fpath, fileheader_t * record, int size, const char *
for (m = strlen(buf) - 2; buf[m] != '/' && m > 0; m--);
strcat(buf, ".forward"); // XXX check buffer size
if ((fp = fopen(buf, "r"))) {
+
+ int flIdiotSent2Self = 0;
+ int oidlen = origid ? strlen(origid) : 0;
+
address[0] = 0;
fscanf(fp, "%s", address); // XXX check buffer size
fclose(fp);
- if (buf[0] != 0 && buf[0] != ' ' && strcmp(address, origid) != 0) {
+ /* some idiots just set forwarding to themselves.
+ * and even after we checked "sameid", some still
+ * set STUPID_ID.bbs@host <- "¦Û¥H¬°Áo©ú"
+ * damn it, we have a complex rule now.
+ */
+ if(oidlen > 0) {
+ if (strncasecmp(address, origid, oidlen) == 0)
+ {
+ int addrlen = strlen(address);
+ if( addrlen == oidlen ||
+ (addrlen > oidlen &&
+ strcasecmp(address + oidlen, str_mail_address) == 0))
+ flIdiotSent2Self = 1;
+ }
+ }
+
+ if (buf[0] && buf[0] != ' ' && !flIdiotSent2Self) {
buf[n + 1] = 0;
strcat(buf, record->filename);
append_record(fpath, record, size);