Debian release 2.13tx8.7-1
Marco d'Itri
26 years ago
26 | 26 | CONFIGFILE = $(BUILD_ROOT)"/etc/ifmail/config" |
27 | 27 | |
28 | 28 | # Where translations tables reside |
29 | MAPTABDIR = $(BUILD_ROOT)"/etc/ifmail/maptabs" | |
29 | MAPTABDIR = $(BUILD_ROOT)"/usr/lib/ifmail/maptabs" | |
30 | 30 | |
31 | 31 | # Debug messages turned on by -x key are written here. |
32 | 32 | # Some error messages may occationally appear here too. |
43 | 43 | # Use syslog() facility codes for mail gate, news gate and ifcico. |
44 | 44 | # Define -DHAS_SYSLOG (see below) |
45 | 45 | #MAILLOG = LOG_MAIL |
46 | MAILLOG = LOG_LOCAL0 | |
46 | #MAILLOG = LOG_LOCAL0 | |
47 | 47 | #NEWSLOG = LOG_NEWS |
48 | NEWSLOG = LOG_LOCAL0 | |
48 | #NEWSLOG = LOG_LOCAL0 | |
49 | 49 | #CICOLOG = LOG_UUCP |
50 | CICOLOG = LOG_LOCAL0 | |
50 | #CICOLOG = LOG_LOCAL0 | |
51 | 51 | |
52 | 52 | # Directory where UUCP lock files reside. |
53 | 53 | #LOCKDIR = $(BUILD_ROOT)"/var/spool/uucp" |
55 | 55 | |
56 | 56 | # Directory from which file requests are resolved. |
57 | 57 | # This may be changed from the 'config' file. |
58 | #PUBDIR = $(BUILD_ROOT)"/home/ftp/pub" | |
59 | PUBDIR = $(BUILD_ROOT)"/var/spool/uucppublic" | |
58 | PUBDIR = $(BUILD_ROOT)"/home/ftp/pub" | |
59 | #PUBDIR = $(BUILD_ROOT)"/var/spool/uucppublic" | |
60 | 60 | |
61 | 61 | # News spool directory (to check space only) |
62 | 62 | #NEWSSPOOL = $(BUILD_ROOT)"/usr/spool/news" |
81 | 81 | # see iflib/ref.c for more complete info |
82 | 82 | # |
83 | 83 | # if you don't want it comment out or delete the line |
84 | REFERENCES_MSC96 = yes | |
84 | #REFERENCES_MSC96 = yes | |
85 | 85 | |
86 | 86 | # Compile-time system-dependant options. |
87 | 87 | |
291 | 291 | |
292 | 292 | #General options: |
293 | 293 | # These are not machine dependent, and describe only ifmail/ifcico features |
294 | OPTS = -DFORCE_REPLYTO -DTERMAIL_HACK \ | |
294 | OPTS = -DTERMAIL_HACK \ | |
295 | 295 | -DDONT_REGATE -DSLAVE_SENDS_NAK_TOO \ |
296 | -DPUDDLE_GATE -DPCBOARD_GATE -DRNEWSB -DJE \ | |
296 | -DRNEWSB -DJE \ | |
297 | 297 | -DRESTAMP_OLD_POSTINGS=25 -DBELEIVE_ZFIN=1 \ |
298 | -DKEEP_MSGID_ON_SPLIT -DIGNORE_SOFTCR \ | |
299 | -DRELAXED -DFORCEINTL -DHAS_TCP -DAREAS_HACKING \ | |
298 | -DRELAXED -DHAS_TCP -DAREAS_HACKING \ | |
300 | 299 | -DRESTAMP_FUTURE_POSTINGS -DFSCHTML -DMACHIGAI \ |
301 | 300 | -DALLOW_RETURNPATH -DGATEBAU_MSGID \ |
302 | -DDIRTY_CHRS \ | |
301 | -DDIRTY_CHRS -DADD_PID -DLEVEL=0 \ | |
303 | 302 | -DAREAS_NUMERAL_COMMENTS |
304 | 303 | |
305 | 304 | # -DAREAS_NUMERAL_COMPATIBILITY |
312 | 311 | OPTS += -DHAS_STATFS -DSTATFS_IN_VFS_H -DHAS_SETSID -DHAS_NDBM_H \ |
313 | 312 | -DDONT_HAVE_TM_GMTOFF -DHAS_TERMIOS_H -DASCII_LOCKFILES \ |
314 | 313 | -DHAS_FSYNC -DHAS_IOCTL_H -DHAS_REGEX_H \ |
315 | -DHAS_SYSLOG -DNEED_BSY \ | |
316 | -DNEED_FORK -DHAS_BSD_SIGNALS \ | |
314 | -DNEED_BSY \ | |
315 | -DNEED_FORK -DNEED_TRAP \ | |
317 | 316 | -DINT32=long -DINT16=short |
318 | 317 | |
319 | 318 | # 386BSD: |
412 | 411 | SHELL = /bin/sh |
413 | 412 | ECHO = echo -e |
414 | 413 | CC = gcc |
415 | #YACC = bison -y | |
416 | YACC = yacc | |
414 | YACC = bison -y | |
415 | #YACC = yacc | |
417 | 416 | #LEX = flex |
418 | 417 | LEX = lex |
419 | 418 | AWK = awk |
421 | 420 | |
422 | 421 | #CFLAGS = -g -Wall |
423 | 422 | # Linux, 386BSD, SunOS: |
424 | CFLAGS = -O2 -Wall | |
423 | CFLAGS = -g -O2 -Wall | |
425 | 424 | # SVR4: |
426 | 425 | #CFLAGS = -O -Xa |
427 | 426 | # NeXTSTEP |
0 | ifmail-tx for DEBIAN | |
1 | ---------------------- | |
2 | ||
3 | The programs are compiled with the following #defines: | |
4 | ||
5 | OPTS = -DTERMAIL_HACK \ | |
6 | -DDONT_REGATE -DSLAVE_SENDS_NAK_TOO \ | |
7 | -DRNEWSB -DJE \ | |
8 | -DRESTAMP_OLD_POSTINGS=25 -DBELEIVE_ZFIN=1 \ | |
9 | -DRELAXED -DHAS_TCP -DAREAS_HACKING \ | |
10 | -DRESTAMP_FUTURE_POSTINGS -DFSCHTML -DMACHIGAI \ | |
11 | -DALLOW_RETURNPATH -DGATEBAU_MSGID \ | |
12 | -DDIRTY_CHRS -DADD_PID -DLEVEL=0 \ | |
13 | -DAREAS_NUMERAL_COMMENTS | |
14 | ||
15 | If you use sendmail and a modern enough version of sendmailconfig you | |
16 | will have to run it again and it will automatically add the new mailers | |
17 | "ifmail", "ifmail-h" and "ifmail-c" (for normal, hold and crash mail). | |
18 | Then you will have to add to the mailertable some entries like ones in | |
19 | examples/mailertable. | |
20 | ||
21 | My rules will try hard to guess which addresses in the fidonet.org domain | |
22 | are real internet machines that should be reached via the internet. | |
23 | If some addresses are incorrectly sent to ifmail you can write them as | |
24 | *.ip.fidonet.org, i.e. if you want to send mail to user@www.n1.z1.fidonet.org | |
25 | you have to address it to user@www.n1.z1.ip.fidonet.org. | |
26 | ||
27 | You will probably want to add ftn in the dialout group: | |
28 | adduser ftn dialout | |
29 |
0 | ifmail (2.13tx8.7-1) unstable; urgency=low | |
1 | ||
2 | * Fixed segmentation fault on broken ^AMSGID. | |
3 | * Fixed double ^APID bug. | |
4 | ||
5 | -- Marco d'Itri <md@linux.it> Thu, 12 Mar 1998 19:31:24 +0100 | |
6 | ||
7 | ifmail (2.13tx8.7) unstable; urgency=low | |
8 | ||
9 | * New upstream release | |
10 | ||
11 | -- Marco d'Itri <md@linux.it> Mon, 26 Jan 1998 10:52:58 +0100 | |
12 | ||
13 | ifmail (2.12tx8.6-4) unstable; urgency=low | |
14 | ||
15 | * Package splitted in ifmail, ifcico and ifgate. | |
16 | ||
17 | -- Marco d'Itri <md@linux.it> Mon, 29 Dec 1997 16:39:25 +0100 | |
18 | ||
19 | ifmail (2.12tx8.6-3) unstable; urgency=low | |
20 | ||
21 | * Fixed buggy postinst | |
22 | * Removed from postinst the broken format converter of /etc/ifmail/Areas | |
23 | ||
24 | -- Marco d'Itri <md@linux.it> Sun, 28 Dec 1997 13:58:28 +0100 | |
25 | ||
26 | ifmail (2.12tx8.6-2) unstable; urgency=low | |
27 | ||
28 | * Removed old dynamic ftn user for ftn.ftn static user and group (#15155). | |
29 | * Removed changelog from /usr/doc/ftn | |
30 | ||
31 | ifmail (2.12tx8.6-1) unstable; urgency=low | |
32 | ||
33 | * Now NLS support is compiled in | |
34 | * Postinst will automatically convert the format of /etc/ifmail/Areas | |
35 | * New upstream version | |
36 | * Removed my patches to message.c and defined ADD_PID in CONFIG | |
37 | ||
38 | -- Marco d'Itri <md@linux.it> Thu, 9 Oct 1997 23:12:58 +0200 | |
39 | ||
40 | ifmail (2.11tx8.5-1) unstable; urgency=low | |
41 | ||
42 | * Patched message.c: at level 0 X-Newsreader is converted to ^APID. | |
43 | * Charset mapping tables are stored in /usr/lib/ifmail/maptabs/. | |
44 | * The full list of configured #defines can be found in README.Debian. | |
45 | * Initial Release. | |
46 | ||
47 | -- Marco d'Itri <md@linux.it> Sun, 3 Aug 1997 20:26:53 +0200 | |
48 | ||
49 | Local variables: | |
50 | mode: debian-changelog | |
51 | add-log-mailing-address: "md@linux.it" | |
52 | End: |
0 | Source: ifmail | |
1 | Section: contrib | |
2 | Priority: optional | |
3 | Maintainer: Marco d'Itri <md@linux.it> | |
4 | Standards-Version: 2.3.1.0 | |
5 | ||
6 | Package: ifmail | |
7 | Architecture: any | |
8 | Depends: mail-transport-agent, news-transport-system | |
9 | Suggests: ifcico, ifgate | |
10 | Description: Internet to Fidonet gateway | |
11 | The package contains common files needed by ifcico and ifgate packages. | |
12 | This version includes the "tx" patches. | |
13 | ||
14 | Package: ifgate | |
15 | Architecture: any | |
16 | Depends: ${shlibs:Depends}, ifmail, mail-transport-agent, news-transport-system | |
17 | Description: Internet to Fidonet gateway | |
18 | The package can act as a gateway between email and netmail and Usenet | |
19 | newsgroups and echomail. | |
20 | This version includes the "tx" patches. | |
21 | ||
22 | Package: ifcico | |
23 | Architecture: any | |
24 | Depends: ${shlibs:Depends}, ifmail, netbase (>= 2.18) | |
25 | Description: Fidonet Technology transport package | |
26 | Ifcico is a FidoTech mailer for connecting to other nodes via the phone | |
27 | or the Internet. | |
28 | This version includes the "tx" patches. | |
29 | . | |
30 | If you don't have the last netbase package you can install ifcico with | |
31 | dpkg --force-depends and add in /etc/services the lines: | |
32 | tfido 60177/tcp | |
33 | fido 60179/tcp |
0 | This is the Debianized version of the ifmail-tx package (by Eugene Crosser | |
1 | and Pablo Saratxaga). | |
2 | This package was debianized by Marco d'Itri <md@linux.it>. | |
3 | ||
4 | It was downloaded from ftp://ftp.z2.fidonet.org/pub/linux/Fido/ | |
5 | ||
6 | For details about the modifications I made to the source please read the | |
7 | file README.debian | |
8 | ||
9 | ||
10 | This is the copyright notice of the original ifmail: | |
11 | ||
12 | You may do virtually what you wish with this software, as long as the | |
13 | explicit reference to its original author is retained: | |
14 | ||
15 | Eugene G. Crosser <crosser@average.org>, 2:5020/230@FidoNet | |
16 | ||
17 | THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, | |
18 | EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDER BE | |
19 | LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. | |
20 | ||
21 | This is freeware. Except for the modules taken from the other packages, | |
22 | (which may be subject to different distributing policy), you may use | |
23 | this software for any purpose, commercial or noncommercial, including | |
24 | even selling it, without paying anything. | |
25 | ||
26 | ||
27 | ||
28 | This is the copyright notice of ifmail-tx: | |
29 | ||
30 | Included a lot of code from version 2.8c-JE13JUL1995 | |
31 | which is copyrighted by Tsuneo Tanaka <tt@efnet.com> | |
32 | ||
33 | conversion code for japanese in kconv.c and kconv.h | |
34 | is copyrighted by Ken Lunde <lunde@adobe.com> | |
35 | ||
36 | Programs in misc/contrib are copyrighted by their authors | |
37 | ||
38 | The "tx" versions also includes ideas and patches from | |
39 | several other people, see file Credits.TX | |
40 | ||
41 | Other modifications are from Pablo Saratxaga <srtxg@linux.chanae.stben.be> | |
42 |
0 | #!/bin/sh -e | |
1 | ||
2 | . /etc/ifmail/ifshellvars | |
3 | ||
4 | cd $IFLOGDIR | |
5 | ||
6 | # Rotate the logfiles. | |
7 | for LOG in ifdebug iflog; do | |
8 | if [ -s $LOG ]; then | |
9 | savelog -u $IFUSER -g adm -m 600 -c 4 $LOG > /dev/null | |
10 | fi | |
11 | done | |
12 | $IFBIN/fido.daily iflog.0 | mail -s "Ifmail logs report" $IFUSER | |
13 | ||
14 | # remove old files and directories | |
15 | #find $IFSPOOL/ -type f -atime +14 -print0 \ | |
16 | # -name '*.sts' \ | |
17 | # | xargs --no-run-if-empty --null rm -f | |
18 | ||
19 | #find $IFSPOOL/ -type d -mtime +30 -print0 \ | |
20 | # -name '*.*' -not -name $IFNLDIRNAME\ | |
21 | # | xargs --no-run-if-empty --null rmdir | |
22 |
0 | usr/doc/ifcico | |
1 | usr/lib/ifmail/ifcico | |
2 | usr/lib/ifmail/ifindex | |
3 | usr/lib/ifmail/ifstat | |
4 | usr/lib/ifmail/nlpatch | |
5 | usr/man/man8/ifcico.8 | |
6 | usr/man/fr_FR/man8/ifcico.8 |
0 | #:OTHER: | |
1 | tfido stream tcp nowait ftn /usr/sbin/tcpd /usr/lib/ifmail/ifcico -r 0 -t | |
2 | fido stream tcp nowait ftn /usr/sbin/tcpd /usr/lib/ifmail/ifcico -r 0 |
0 | /var/spool/ftn/nl.d/index.* |
0 | etc/ifmail/aliases | |
1 | etc/ifmail/Areas | |
2 | etc/news/scripts/fidosend | |
3 | usr/doc/ifgate | |
4 | usr/lib/ifmail/maptabs/cp424__cp862 | |
5 | usr/lib/ifmail/maptabs/cp424__iso-8859-8 | |
6 | usr/lib/ifmail/maptabs/cp437__iso-8859-1 | |
7 | usr/lib/ifmail/maptabs/cp437__mac | |
8 | usr/lib/ifmail/maptabs/cp852__fidomazovia | |
9 | usr/lib/ifmail/maptabs/cp852__iso-8859-2 | |
10 | usr/lib/ifmail/maptabs/cp862__iso-8859-8 | |
11 | usr/lib/ifmail/maptabs/cp866__koi8 | |
12 | usr/lib/ifmail/maptabs/cp895__cp437 | |
13 | usr/lib/ifmail/maptabs/cp895__iso-8859-2 | |
14 | usr/lib/ifmail/maptabs/fidomazovia__cp852 | |
15 | usr/lib/ifmail/maptabs/fidomazovia__iso-8859-2 | |
16 | usr/lib/ifmail/maptabs/iso-11__iso-8859-1 | |
17 | usr/lib/ifmail/maptabs/iso-4__iso-8859-1 | |
18 | usr/lib/ifmail/maptabs/iso-60__iso-8859-1 | |
19 | usr/lib/ifmail/maptabs/iso-8859-1__cp437 | |
20 | usr/lib/ifmail/maptabs/iso-8859-2__cp852 | |
21 | usr/lib/ifmail/maptabs/iso-8859-2__cp895 | |
22 | usr/lib/ifmail/maptabs/iso-8859-2__fidomazovia | |
23 | usr/lib/ifmail/maptabs/iso-8859-5__mik | |
24 | usr/lib/ifmail/maptabs/koi8__cp866 | |
25 | usr/lib/ifmail/maptabs/koi8__mik | |
26 | usr/lib/ifmail/maptabs/mac__cp437 | |
27 | usr/lib/ifmail/maptabs/mac__iso-8859-1 | |
28 | usr/lib/ifmail/maptabs/mik__iso-8859-5 | |
29 | usr/lib/ifmail/maptabs/mik__koi8 | |
30 | usr/lib/ifmail/ifmail | |
31 | usr/lib/ifmail/ifpack | |
32 | usr/lib/ifmail/iftoss | |
33 | usr/lib/ifmail/ifunpack | |
34 | usr/lib/ifmail/ifnews | |
35 | usr/lib/sendmail.cf/mailer/ifmail.m4 | |
36 | usr/man/man8/iftoss.8 | |
37 | usr/man/man8/ifmail.8 |
0 | #!/bin/sh -e | |
1 | ||
2 | # delete old dynamic ftn user | |
3 | if grep -q ftn /etc/passwd; then | |
4 | if ! grep -q "ftn:.*:64000" /etc/passwd; then | |
5 | echo 'Removing the old ftn user...' | |
6 | deluser ftn | |
7 | fi | |
8 | fi | |
9 | ||
10 | if id ftn >/dev/null 2>&1; then | |
11 | : | |
12 | else | |
13 | adduser --system --home /var/spool/ftn --group --uid 64000 --gid 64000 \ | |
14 | --disabled-password --gecos Fidonet ftn | |
15 | chsh -s /bin/sh ftn | |
16 | ||
17 | # make binkd happy | |
18 | if [ -f /etc/binkd/binkd.inc ]; then | |
19 | chown ftn.ftn /etc/binkd/binkd.inc | |
20 | chown -R ftn.adm /var/log/binkd/ | |
21 | fi | |
22 | ||
23 | fi | |
24 | ||
25 | chown -R ftn.ftn /var/spool/ftn/ | |
26 | chown -R ftn.adm /var/log/ifmail/ | |
27 | ||
28 | cat <<'EOF' | |
29 | WARNING! | |
30 | ||
31 | You MUST configure /etc/ifmail/config and probably /etc/ifmail/Areas, | |
32 | otherwise you will generate messages with a wrong origin address. | |
33 | ||
34 | Press Enter key to continue. | |
35 | EOF | |
36 | read | |
37 |
0 | #!/usr/bin/make -f | |
1 | # Made with the aid of debmake, by Christoph Lameter, | |
2 | # based on the sample debian/rules file for GNU hello by Ian Jackson. | |
3 | ||
4 | build: | |
5 | $(checkdir) | |
6 | ||
7 | make -j4 #CFLAGS="-O2 -g -Wall" | |
8 | ||
9 | touch build | |
10 | ||
11 | clean: | |
12 | $(checkdir) | |
13 | -rm -f build | |
14 | -make clean | |
15 | -rm -rf debian/tmp `find debian/* -type d` debian/files* core | |
16 | -rm -f debian/*substvars | |
17 | ||
18 | #binary-indep: checkroot build | |
19 | # $(checkdir) | |
20 | # There are no architecture-independent files to be uploaded | |
21 | # generated by this package. If there were any they would be | |
22 | # made here. | |
23 | # -rm -rf debian/tmp debian/files* core debian/substvars | |
24 | ||
25 | binary-arch: checkroot build | |
26 | $(checkdir) | |
27 | -rm -rf debian/tmp | |
28 | install -d debian/tmp | |
29 | cd debian/tmp && install -d etc/ifmail \ | |
30 | etc/news/scripts \ | |
31 | usr/doc/ifmail \ | |
32 | usr/lib/ifmail \ | |
33 | usr/lib/ifmail/maptabs \ | |
34 | usr/lib/sendmail.cf/mailer \ | |
35 | usr/man/man8 \ | |
36 | usr/man/fr_FR/man8 \ | |
37 | var/log/ifmail \ | |
38 | var/spool/ \ | |
39 | var/spool/ftn/BAK \ | |
40 | var/spool/ftn/nl.d | |
41 | ||
42 | install --strip ifcico/ifcico ifcico/ifindex ifgate/ifmail \ | |
43 | ifgate/ifpack ifgate/ifstat ifgate/iftoss ifgate/ifunpack \ | |
44 | ifcico/nlpatch ifcico/nlookup debian/tmp/usr/lib/ifmail/ | |
45 | ln -s ifmail debian/tmp/usr/lib/ifmail/ifnews | |
46 | # Compatibility symlink | |
47 | ln -s ftn debian/tmp/var/spool/ifmail | |
48 | chown ftn.news debian/tmp/usr/lib/ifmail/ifmail | |
49 | chmod 4754 debian/tmp/usr/lib/ifmail/ifmail | |
50 | cp misc/contrib/fido.daily debian/tmp/usr/lib/ifmail/ | |
51 | cp misc/maptabs/[a-z]* debian/tmp/usr/lib/ifmail/maptabs/ | |
52 | ||
53 | cp ifcico/ifcico.8 ifgate/if{mail,toss}.8 debian/tmp/usr/man/man8/ | |
54 | cp ifcico/ifcico.8.fr debian/tmp/usr/man/fr_FR/man8/ifcico.8 | |
55 | cp Changelog.TX debian/tmp/usr/doc/ifmail/changelog | |
56 | ||
57 | touch debian/tmp/etc/ifmail/aliases | |
58 | cp misc/config debian/tmp/etc/ifmail/config | |
59 | cp misc/Areas debian/tmp/etc/ifmail/ | |
60 | cp md/ifshellvars debian/tmp/etc/ifmail/ifshellvars | |
61 | cp md/ifmail.m4 debian/tmp/usr/lib/sendmail.cf/mailer/ | |
62 | cp md/fidosend debian/tmp/etc/news/scripts/ | |
63 | ||
64 | cd po && \ | |
65 | NLSPACKAGE=ifmail BUILD_ROOT=../debian/tmp NLSDIR=/usr/share/locale \ | |
66 | make install | |
67 | ||
68 | debstd -m | |
69 | dpkg-gencontrol -pifmail | |
70 | ln -s ifmail debian/ifcico/usr/doc/ifcico | |
71 | ln -s ifmail debian/ifgate/usr/doc/ifgate | |
72 | chown -R root.root debian/tmp debian/ifcico/ debian/ifgate/ | |
73 | chmod -R go=rX debian/tmp debian/ifcico/ debian/ifgate/ | |
74 | rm -rf debian/tmp/{etc/news/,usr/man/,usr/lib/sendmail.cf/} | |
75 | dpkg --build debian/tmp .. | |
76 | ||
77 | define checkdir | |
78 | test -f debian/rules | |
79 | endef | |
80 | ||
81 | binary: binary-arch #binary-indep | |
82 | ||
83 | checkroot: | |
84 | $(checkdir) | |
85 | test root = "`whoami`" | |
86 | ||
87 | .PHONY: binary binary-arch binary-indep clean checkroot |
0 | # Example watch control file for uscan | |
1 | # Rename this file to "watch" and then you can run the "uscan" command | |
2 | # to check for upstream updates and more. | |
3 | # Site Directory Pattern Version Script | |
4 | ftp.z2.fidonet.org /pub/linux/Fido/ ifmail-*-tx*.tar.gz debian uupdate | |
5 |
89 | 89 | |
90 | 90 | if (!strcasecmp(msg->key,"X-UUCP-From")) return (rfclevel-2); |
91 | 91 | if (!strcasecmp(msg->key,"X-Body-Start")) return (rfclevel-2); |
92 | if (!strncasecmp(msg->key,".",1)) return 0; | |
92 | 93 | if (!strncasecmp(msg->key,"X-FTN-",6)) return 0; |
93 | 94 | if (!strncasecmp(msg->key,"X-Fsc-",6)) return 0; |
94 | 95 | if (!strncasecmp(msg->key,"X-ZC-",5)) return 0; |
130 | 131 | } |
131 | 132 | if (!strcasecmp(msg->key,"From")) |
132 | 133 | { |
134 | if (italianpoint) return 0; | |
133 | 135 | if ((ta=parsefaddr(msg->val))) |
134 | 136 | { |
135 | 137 | tidy_faddr(ta); |
636 | 638 | } |
637 | 639 | |
638 | 640 | #ifndef ADD_PID |
639 | if (rfclevel==1) | |
640 | #endif | |
641 | { | |
642 | p=hdr("X-FTN-PID", msg); | |
643 | if (p==NULL) p=hdr("User-Agent", msg); | |
644 | if (p==NULL) p=hdr("X-Newsreader", msg); | |
645 | if (p==NULL) p=hdr("X-Mailer", msg); | |
646 | if (p) | |
647 | { | |
648 | hdrsize += 4 + strlen(p); | |
649 | fprintf(pkt, "\1PID:"); | |
650 | kwrite(p, pkt); | |
651 | } | |
652 | } | |
641 | if (rfclevel==1) | |
642 | #endif | |
643 | if (!hdr("X-FTN-PID", msg)) { | |
644 | p=hdr("User-Agent", msg); | |
645 | if (p==NULL) p=hdr("X-Newsreader", msg); | |
646 | if (p==NULL) p=hdr("X-Mailer", msg); | |
647 | if (p) | |
648 | { | |
649 | hdrsize += 4 + strlen(p); | |
650 | fprintf(pkt, "\1PID:"); | |
651 | kwrite(p, pkt); | |
652 | } | |
653 | } | |
653 | 654 | |
654 | 655 | hdrsize += 15; |
655 | 656 | writechrs(outcode,pkt,1); |
790 | 791 | fprintf(pkt,"\1%s:",tmp->key+2); |
791 | 792 | kwrite(tmp->val,pkt); |
792 | 793 | } |
794 | /* mondo.org gateway uses ".MSGID: ..." in usenet */ | |
795 | for (tmp=msg;tmp;tmp=tmp->next) | |
796 | if ((!strncmp(tmp->key,".",1)) && | |
797 | (strcasecmp(tmp->key,".MSGID"))) | |
798 | { | |
799 | hdrsize += strlen(tmp->key)+strlen(tmp->val); | |
800 | fprintf(pkt,"\1%s:",tmp->key+1); | |
801 | kwrite(tmp->val,pkt); | |
802 | } | |
793 | 803 | #ifdef GATEBAU_MSGID |
794 | 804 | if ((!ftnorigin) && (rfclevel > 0) && |
795 | 805 | (areagatebau(fmsg->area))) |
0 | /* ### Modified by P.Saratxaga on 7 Aug 1995 ### | |
1 | * - Newsgroups: line is now gated if there is more than one newsgroup | |
2 | * - Added support for X-FTN-To and X-FTN-From generated by other gates | |
3 | * - modified removemime to kludgerise lines if charset != us-ascii | |
4 | * - creation of ^aACUPDATE kludges from Supersedes: and cancel's | |
5 | * - added charset support (see Changelog for details) | |
6 | * - added recognition of X-Fsc- | |
7 | * - added support to dequote MIME quoted printable messages. Code by T.Tanaka | |
8 | * - added removemsgid and removeinreply | |
9 | * - added rfclevel stuff. | |
10 | * - added DEFAULT_ORIGIN from an idea of "Marco d'Itri" <md@linux.it> | |
11 | */ | |
12 | #include <stdlib.h> | |
13 | #include <stdio.h> | |
14 | #include <string.h> | |
15 | #include <ctype.h> | |
16 | #include <time.h> | |
17 | #include <unistd.h> | |
18 | #include <sys/param.h> | |
19 | #include "xutil.h" | |
20 | #include "lutil.h" | |
21 | #include "ftn.h" | |
22 | #include "rfcaddr.h" | |
23 | #include "ftnmsg.h" | |
24 | #include "rfcmsg.h" | |
25 | #include "config.h" | |
26 | #include "bwrite.h" | |
27 | #include "falists.h" | |
28 | #include "version.h" | |
29 | #include "hash.h" | |
30 | #include "needed.h" | |
31 | #include "mkftnhdr.h" | |
32 | #ifdef JE | |
33 | #include "areas.h" | |
34 | #endif /* JE */ | |
35 | #include "charset.h" | |
36 | #include "charconv.h" | |
37 | #include "mime.h" | |
38 | #ifdef REFERENCES_MSC96 | |
39 | #include "ref_interface.h" | |
40 | ref_private_t *ref_dbase; | |
41 | #endif | |
42 | ||
43 | #define MAXHDRSIZE 2048 | |
44 | #define MAXSEEN 70 | |
45 | #define MAXPATH 73 | |
46 | ||
47 | #ifndef DEFAULT_ORIGIN | |
48 | #define DEFAULT_ORIGIN "Unknown" | |
49 | #endif | |
50 | ||
51 | extern time_t now; | |
52 | extern int newsmode; | |
53 | extern char *replyaddr; | |
54 | extern faddr *bestaka; | |
55 | extern int rfclevel; | |
56 | extern int nosplitmode; | |
57 | extern int pgpsigned; | |
58 | ||
59 | #ifdef HAS_NDBM_H | |
60 | extern char *idlookup(char *); | |
61 | #endif | |
62 | extern char *bgets(char *,int,FILE *); | |
63 | extern long sequencer(void); | |
64 | extern unsigned INT32 crc32(char*,int); | |
65 | extern char *strip_flags(char *); | |
66 | extern void putbody(int,rfcmsg*,FILE*,FILE*,int,int,int,int,int,int*); | |
67 | ||
68 | static int removemime; | |
69 | static int removeorg; | |
70 | static int removemsgid; | |
71 | static int removeref; | |
72 | static int removeinreply; | |
73 | static int removesupersedes; | |
74 | static int removeapproved; | |
75 | static int removefrom; | |
76 | static int removereplyto; | |
77 | static int removereturnto; | |
78 | static int ftnorigin; | |
79 | ||
80 | static int isftnpath(char*); | |
81 | ||
82 | int needputrfc(rfcmsg*); | |
83 | int needputrfc(msg) | |
84 | rfcmsg *msg; | |
85 | { | |
86 | faddr *ta; | |
87 | ||
88 | /* 0-junk, 1-kludge, 2-pass */ | |
89 | ||
90 | if (!strcasecmp(msg->key,"X-UUCP-From")) return (rfclevel-2); | |
91 | if (!strcasecmp(msg->key,"X-Body-Start")) return (rfclevel-2); | |
92 | if (!strncasecmp(msg->key,"X-FTN-",6)) return 0; | |
93 | if (!strncasecmp(msg->key,"X-Fsc-",6)) return 0; | |
94 | if (!strncasecmp(msg->key,"X-ZC-",5)) return 0; | |
95 | if (!strcasecmp(msg->key,"X-Gateway")) return 0; | |
96 | if (!strcasecmp(msg->key,"Path")) return isftnpath(msg->val)?rfclevel-2:rfclevel-1; | |
97 | if (!strcasecmp(msg->key,"Newsgroups")) | |
98 | { | |
99 | if ((!newsmode) || (newsmode && strstr(msg->val,","))) | |
100 | return rfclevel; | |
101 | else return (rfclevel-1); | |
102 | } | |
103 | if (!strcasecmp(msg->key,"Control")) | |
104 | { | |
105 | #ifdef ALLOW_CONTROL | |
106 | if (strstr(msg->val,"cancel")) return rfclevel; | |
107 | else return (rfclevel-4); | |
108 | #else | |
109 | if (strstr(msg->val,"cancel")) return (rfclevel-3); | |
110 | else return (rfclevel-4); | |
111 | } | |
112 | #endif | |
113 | #ifdef ALLOW_RETURNPATH | |
114 | if (!strcasecmp(msg->key,"Return-Path")) return rfclevel; | |
115 | #else | |
116 | if (!strcasecmp(msg->key,"Return-Path")) return (rfclevel-1); | |
117 | #endif | |
118 | if (!strcasecmp(msg->key,"Xref")) return (rfclevel-2); | |
119 | if (!strcasecmp(msg->key,"Approved")) | |
120 | return removeapproved?(rfclevel-2):(rfclevel+1); | |
121 | if (!strcasecmp(msg->key,"X-URL")) return (rfclevel-2); | |
122 | if (!strcasecmp(msg->key,"Return-Receipt-To")) | |
123 | return removereturnto?(rfclevel-1):rfclevel; | |
124 | if (!strcasecmp(msg->key,"Notice-Requested-Upon-Delivery-To")) | |
125 | return (rfclevel-2); | |
126 | if (!strcasecmp(msg->key,"Received")) | |
127 | { | |
128 | if (newsmode) return (rfclevel-2); | |
129 | else return ftnorigin?(rfclevel-1):rfclevel; | |
130 | } | |
131 | if (!strcasecmp(msg->key,"From")) | |
132 | { | |
133 | if (italianpoint) return 0; | |
134 | if ((ta=parsefaddr(msg->val))) | |
135 | { | |
136 | tidy_faddr(ta); | |
137 | return (rfclevel-2); | |
138 | } | |
139 | else return removefrom?(rfclevel-1):(rfclevel+3); | |
140 | } | |
141 | if (!strcasecmp(msg->key,"To")) | |
142 | { | |
143 | if (newsmode) return (rfclevel-2); | |
144 | if ((ta=parsefaddr(msg->val))) | |
145 | { | |
146 | tidy_faddr(ta); | |
147 | return (rfclevel-2); | |
148 | } | |
149 | else return (rfclevel+3); | |
150 | } | |
151 | if (!strcasecmp(msg->key,"Cc")) return (rfclevel+1); | |
152 | if (!strcasecmp(msg->key,"Bcc")) return (rfclevel-1); | |
153 | if (!strcasecmp(msg->key,"Reply-To")) | |
154 | { | |
155 | if ((ta=parsefaddr(msg->val))) | |
156 | { | |
157 | tidy_faddr(ta); | |
158 | return (rfclevel-2); | |
159 | } | |
160 | else return removereplyto?(rfclevel-1):(rfclevel+3); | |
161 | } | |
162 | if (!strcasecmp(msg->key,"Lines")) return (rfclevel-2); | |
163 | if (!strcasecmp(msg->key,"Date")) return (rfclevel-2); | |
164 | if (!strcasecmp(msg->key,"Subject")) | |
165 | { | |
166 | if ((msg->val) && (strlen(msg->val) > MAXSUBJ)) return (rfclevel+1); | |
167 | else return (rfclevel-1); | |
168 | } | |
169 | if (!strcasecmp(msg->key,"Organization")) return removeorg?(rfclevel-1):rfclevel; | |
170 | if (!strcasecmp(msg->key,"Comment-To")) return (rfclevel-1); | |
171 | if (!strcasecmp(msg->key,"X-Comment-To")) return (rfclevel-1); | |
172 | if (!strcasecmp(msg->key,"X-Apparently-To")) return (rfclevel-1); | |
173 | if (!strcasecmp(msg->key,"Apparently-To")) return (rfclevel-1); | |
174 | if (!strcasecmp(msg->key,"X-Fidonet-Comment-To")) return (rfclevel-2); | |
175 | if (!strcasecmp(msg->key,"Keywords")) return (rfclevel+1); | |
176 | if (!strcasecmp(msg->key,"Summary")) return (rfclevel+1); | |
177 | if (!strcasecmp(msg->key,"MIME-Version")) return removemime?(rfclevel-1):rfclevel; | |
178 | if (!strcasecmp(msg->key,"Content-Type")) return removemime?(rfclevel-1):rfclevel; | |
179 | if (!strcasecmp(msg->key,"Content-Length")) return removemime?(rfclevel-1):rfclevel; | |
180 | if (!strcasecmp(msg->key,"Content-Transfer-Encoding")) return removemime?(rfclevel-1):rfclevel; | |
181 | if (!strcasecmp(msg->key,"Content-Name")) return (rfclevel+1); | |
182 | if (!strcasecmp(msg->key,"Content-Description")) return (rfclevel+1); | |
183 | if (!strcasecmp(msg->key,"Message-ID")) return removemsgid?(rfclevel-2):rfclevel; | |
184 | if (!strcasecmp(msg->key,"References")) return removeref?(rfclevel-2):rfclevel; | |
185 | if (!strcasecmp(msg->key,"In-Reply-To")) return removeinreply?(rfclevel-2):rfclevel; | |
186 | if (!strcasecmp(msg->key,"Supersedes")) return removesupersedes?(rfclevel-1):rfclevel; | |
187 | if (!strcasecmp(msg->key,"Distribution")) return ftnorigin?(rfclevel-2):(rfclevel-1); | |
188 | if (!strcasecmp(msg->key,"X-Newsreader")) return (rfclevel-1); | |
189 | if (!strcasecmp(msg->key,"X-Mailer")) return (rfclevel-1); | |
190 | if (!strcasecmp(msg->key,"User-Agent")) return (rfclevel-1); | |
191 | if (!strncasecmp(msg->key,"NNTP-",5)) return (rfclevel-1); | |
192 | if (!strncasecmp(msg->key,"X-MSMail",9)) return 0; | |
193 | if (!strncasecmp(msg->key,"X-MimeOLE",9)) return 0; | |
194 | if (!strncasecmp(msg->key,"X-MIME-Autoconverted",20)) return 0; | |
195 | if (!strcasecmp(msg->key,"X-Origin-Date")) return (rfclevel-2); | |
196 | if (!strncasecmp(msg->key,"X-PGP-",6)) return (rfclevel-4); | |
197 | /*if (!strcasecmp(msg->key,"")) return ;*/ | |
198 | return rfclevel; | |
199 | } | |
200 | ||
201 | /* in real life, this never happens... I probably should drop it... */ | |
202 | int isftnpath(path) | |
203 | char *path; | |
204 | { | |
205 | char *p,*q,*r; | |
206 | faddr *fa; | |
207 | int nextftn=1,prevftn=1; | |
208 | ||
209 | debug(3,"checking path \"%s\" for being clear ftn",S(path)); | |
210 | p=xstrcpy(path); | |
211 | if (p == NULL) return 0; | |
212 | for (q=p,r=strchr(q,'!');*q;q=r,r=strchr(q,'!')) | |
213 | { | |
214 | if (r == NULL) r=q+strlen(q); | |
215 | else *r++='\0'; | |
216 | while ((*q) && (isspace(*q))) q++; | |
217 | prevftn=nextftn; | |
218 | if ((fa=parsefaddr(q))) | |
219 | { | |
220 | debug(3,"\"%s\" is ftn address",q); | |
221 | tidy_faddr(fa); | |
222 | } | |
223 | else | |
224 | { | |
225 | debug(3,"\"%s\" is not ftn address",q); | |
226 | nextftn=0; | |
227 | } | |
228 | } | |
229 | free(p); | |
230 | debug(3,"this is%s clear ftn path",prevftn?"":" not"); | |
231 | return prevftn; | |
232 | } | |
233 | ||
234 | static char *months[] = { | |
235 | "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" | |
236 | }; | |
237 | static char *weekday[] = { | |
238 | "Sun","Mon","Tue","Wed","Thu","Fri","Sat" | |
239 | }; | |
240 | ||
241 | char *viadate(void); | |
242 | char *viadate(void) | |
243 | { | |
244 | static char buf[64]; | |
245 | time_t t; | |
246 | struct tm *ptm; | |
247 | ||
248 | time(&t); | |
249 | ptm=localtime(&t); | |
250 | sprintf(buf,"%s %s %d %d at %02d:%02d", | |
251 | weekday[ptm->tm_wday],months[ptm->tm_mon], | |
252 | ptm->tm_mday,ptm->tm_year+1900,ptm->tm_hour,ptm->tm_min); | |
253 | return buf; | |
254 | } | |
255 | ||
256 | int putmessage(msg,fmsg,fp,route,flavor,sbl,incode,outcode) | |
257 | rfcmsg *msg; | |
258 | ftnmsg *fmsg; | |
259 | FILE *fp; | |
260 | faddr *route; | |
261 | char flavor; | |
262 | fa_list **sbl; | |
263 | int incode, outcode; | |
264 | { | |
265 | char buf[BUFSIZ],*p,*q,newsubj[4 * (MAXSUBJ+1)],*oldsubj; | |
266 | rfcmsg *tmp; | |
267 | int rfcheaders; | |
268 | int needsplit,hdrsize,datasize,splitpart,forbidsplit; | |
269 | int sot_kludge, eot_kludge; | |
270 | int qp_or_base64; /* 0=plain text, 1=quoted-printable, 2=base64 */ | |
271 | #ifdef FSCHTML | |
272 | int html_message; | |
273 | #endif | |
274 | int tinyorigin=0; | |
275 | fa_list *tmpl; | |
276 | fa_list *ptl=NULL; | |
277 | faddr *ta; | |
278 | int seenlen; | |
279 | int oldnet; | |
280 | int i; | |
281 | char *acup_a=NULL; | |
282 | unsigned long acup_n=0; | |
283 | char sbe[16]; | |
284 | FILE *pkt; | |
285 | #ifdef JE | |
286 | time_t t; | |
287 | struct tm *ptm; | |
288 | #endif | |
289 | #ifdef FSC_0047 | |
290 | struct tm *ptmsplit; | |
291 | int splitparttotal; | |
292 | #endif | |
293 | static char hostname[MAXHOSTNAMELEN]; | |
294 | ||
295 | ||
296 | debug(3,"putmessage from %s",ascfnode(fmsg->from,0x7f)); | |
297 | debug(3,"putmessage to %s",ascfnode(fmsg->to,0x7f)); | |
298 | debug(3,"putmessage subj %s",S(fmsg->subj)); | |
299 | debug(3,"putmessage flags %04x",fmsg->flags); | |
300 | debug(3,"putmessage msgid %s %lx",S(fmsg->msgid_a),fmsg->msgid_n); | |
301 | debug(3,"putmessage reply %s %lx",S(fmsg->reply_a),fmsg->reply_n); | |
302 | debug(3,"putmessage date %s",ftndate(fmsg->date)); | |
303 | if (newsmode) debug(3,"putmessage area %s",S(fmsg->area)); | |
304 | ||
305 | removemime=0; | |
306 | removeorg=0; | |
307 | removemsgid=0; | |
308 | removeref=0; | |
309 | removeinreply=0; | |
310 | removesupersedes=0; | |
311 | removeapproved=0; | |
312 | removefrom=1; | |
313 | removereplyto=1; | |
314 | removereturnto=1; | |
315 | ftnorigin=fmsg->ftnorigin; | |
316 | sot_kludge=0; | |
317 | eot_kludge=0; | |
318 | qp_or_base64=0; | |
319 | #ifdef FSCHTML | |
320 | html_message=0; | |
321 | #endif | |
322 | ||
323 | if ((hdr("X-PGP-Signed",msg))) | |
324 | pgpsigned=1; | |
325 | q=hdr("Content-Transfer-Encoding",msg); | |
326 | if (q) while (*q && isspace(*q)) q++; | |
327 | if (!(q)) q="8bit"; | |
328 | if ((p=hdr("Content-Type",msg))) | |
329 | { | |
330 | while (*p && isspace(*p)) p++; | |
331 | ||
332 | /* turn the quoted-printable decode mode on; remember FTN is | |
333 | virtually 8-bit clean */ | |
334 | if ((strncasecmp(p, "text/plain", 10) == 0) && | |
335 | (strncasecmp(q, "quoted-printable", 16) == 0)) | |
336 | qp_or_base64 = 1; | |
337 | /* turn the base64 decode mode on */ | |
338 | else if ((strncasecmp(p, "text/plain", 10) == 0) && | |
339 | (strncasecmp(q, "base64", 6) == 0)) | |
340 | qp_or_base64 = 2; | |
341 | /* This is already done in ifmail.c */ | |
342 | /* else if ((strncasecmp(p, "application/pgp", 15) == 0)) | |
343 | pgpsigned=1; */ | |
344 | ||
345 | #ifdef FSCHTML | |
346 | /* text/html support from FSC-HTML 001 proposal of | |
347 | Odinn Sorensen (2:236/77) */ | |
348 | if (strncasecmp(p, "text/html", 9) == 0) | |
349 | html_message = 1; | |
350 | for (tmp=msg;tmp;tmp=tmp->next) | |
351 | if (((strcasecmp(tmp->key,"X-FTN-KLUDGE") == 0) && | |
352 | (strcasecmp(tmp->val,"FSCHTML") == 0)) || | |
353 | (strcasecmp(tmp->key,"X-FTN-HTML") == 0)) | |
354 | html_message = 0; | |
355 | #endif | |
356 | ||
357 | if ((readcharset(p) != CHRS_NOTSET ) && | |
358 | ((q == NULL) || | |
359 | (strncasecmp(q,"7bit",4) == 0) || | |
360 | ((!pgpsigned) && (qp_or_base64==1)) || | |
361 | ((!pgpsigned) && (qp_or_base64==2)) || | |
362 | (strncasecmp(q,"8bit",4) == 0))) | |
363 | removemime=1; /* no need in MIME headers */ | |
364 | /* some old MUA puts "text" instead of "text/plain; charset=..." */ | |
365 | else if ((strcasecmp(p,"text\n") == 0)) | |
366 | removemime=1; | |
367 | ||
368 | } | |
369 | ||
370 | if ((p=hdr("Message-ID",msg))) | |
371 | { | |
372 | if ((rfclevel < 1) && (ftnmsgidstyle) && (q=strchr(p,'@'))) | |
373 | { | |
374 | q++; | |
375 | if (strncasecmp(q,ftnmsgidstyle,strlen(ftnmsgidstyle))==0) | |
376 | removemsgid=1; | |
377 | removeref=1; | |
378 | } | |
379 | if (!removemsgid) | |
380 | removemsgid=chkftnmsgid(p); | |
381 | } | |
382 | ||
383 | if ((!removeref) && (newsmode) && (p=hdr("References",msg))) | |
384 | { | |
385 | p=xstrcpy(p); | |
386 | q=strtok(p," \t\n"); | |
387 | if ((q) && (strtok(NULL," \t\n") == NULL)) | |
388 | removeref=chkftnmsgid(q); | |
389 | free(p); | |
390 | } | |
391 | ||
392 | if ((p=hdr("In-Reply-To",msg)) && (!newsmode)) | |
393 | { | |
394 | p=xstrcpy(p); | |
395 | q=strtok(p," \t\n"); | |
396 | if ((q) && (strtok(NULL," \t\n") == NULL)) | |
397 | removeinreply=chkftnmsgid(q); | |
398 | free(p); | |
399 | } | |
400 | ||
401 | if ((p=hdr("Supersedes",msg))) | |
402 | removesupersedes=chkftnmsgid(p); | |
403 | ||
404 | if ((p=hdr("Approved",msg))) | |
405 | { | |
406 | int modtype; | |
407 | char *newsgroup,*distribution,*moderator; | |
408 | ||
409 | while(*p && isspace(*p)) p++; | |
410 | if ((q=strchr(p,'\n'))) *q='\0'; | |
411 | /* ngdist(area,newsgroup,distribution,moderator,modtype) */ | |
412 | ngdist(fmsg->area,&newsgroup,&distribution,&moderator,&modtype); | |
413 | if ((modtype > 1) && (strcasestr(moderator,p))) | |
414 | removeapproved=1; | |
415 | if (q) *q='\n'; | |
416 | } | |
417 | ||
418 | if ((p=hdr("From",msg))) | |
419 | { | |
420 | if (rfclevel > -2) removefrom=0; | |
421 | if ((rfclevel < 1) && !(removefrom)) | |
422 | { | |
423 | if ((!gethostname(hostname,sizeof(hostname)-1)) && | |
424 | (strcasestr(p,hostname))) removefrom=1; | |
425 | else if ((localdomain) && (q=strchr(p,'@'))) | |
426 | { | |
427 | q++; | |
428 | if (strcasestr(q,localdomain)) | |
429 | removefrom=1; | |
430 | } | |
431 | } | |
432 | } | |
433 | ||
434 | if ((p=hdr("Reply-To",msg))) | |
435 | { | |
436 | if (rfclevel > -2) removereplyto=0; | |
437 | if ((rfclevel < 1) && !(removereplyto)) | |
438 | { | |
439 | if ((!gethostname(hostname,sizeof(hostname)-1)) && | |
440 | (strcasestr(p,hostname))) removereplyto=1; | |
441 | else if ((localdomain) && (q=strchr(p,'@'))) | |
442 | { | |
443 | q++; | |
444 | if (strcasestr(q,localdomain)) | |
445 | removereplyto=1; | |
446 | } | |
447 | } | |
448 | if ((!removereplyto) && (q=hdr("From",msg))) | |
449 | { | |
450 | while(*p && isspace(*p)) p++; | |
451 | if (p[strlen(p)-1] == '\n') p[strlen(p)-1]='\0'; | |
452 | if (strcasestr(q,p)) removereplyto=1; | |
453 | } | |
454 | } | |
455 | ||
456 | if ((p=hdr("Return-Receipt-To",msg))) | |
457 | { | |
458 | if (rfclevel > -1) removereturnto=0; | |
459 | if ((rfclevel < 1) && !(removereturnto)) | |
460 | { | |
461 | if ((!gethostname(hostname,sizeof(hostname)-1)) && | |
462 | (strcasestr(p,hostname))) removereturnto=1; | |
463 | else if ((localdomain) && (q=strchr(p,'@'))) | |
464 | { | |
465 | q++; | |
466 | if (strcasestr(q,localdomain)) | |
467 | removereturnto=1; | |
468 | } | |
469 | } | |
470 | if ((!removereturnto) && (q=hdr("From",msg))) | |
471 | { | |
472 | while(*p && isspace(*p)) p++; | |
473 | if (p[strlen(p)-1] == '\n') p[strlen(p)-1]='\0'; | |
474 | if (strcasestr(q,p)) removereturnto=1; | |
475 | } | |
476 | } | |
477 | ||
478 | p=ascfnode(fmsg->from,0x1f); | |
479 | i=79-11-3-strlen(p); | |
480 | if (ftnorigin && fmsg->origin && (strlen(fmsg->origin) > i)) | |
481 | { | |
482 | /* This is a kludge... I don't like it too much. But well, | |
483 | if this is a message of FTN origin, the original origin (:) | |
484 | line MUST have been short enough to fit in 79 chars... | |
485 | So we give it a try. Probably it would be better to keep | |
486 | the information about the address format from the origin | |
487 | line in a special X-FTN-... header, but this seems even | |
488 | less elegant. Any _good_ ideas, anyone? */ | |
489 | ||
490 | /* OK, I am keeping this, though if should never be used | |
491 | al long as X-FTN-Origin is used now */ | |
492 | ||
493 | p=ascfnode(fmsg->from,0x0f); | |
494 | i=79-11-3-strlen(p); | |
495 | tinyorigin=1; | |
496 | } | |
497 | if (fmsg->origin) | |
498 | { | |
499 | if (strlen(fmsg->origin) > i) | |
500 | fmsg->origin[i]='\0'; | |
501 | else | |
502 | removeorg=1; | |
503 | } | |
504 | forbidsplit=(nosplitmode || ftnorigin || (hdr("X-FTN-Split",msg))); | |
505 | needsplit=0; | |
506 | #ifdef FSC_0047 | |
507 | time(&t); | |
508 | ptmsplit=localtime(&t); | |
509 | #endif | |
510 | splitpart=0; | |
511 | hdrsize=20; | |
512 | hdrsize+=(fmsg->subj)?strlen(fmsg->subj):0; | |
513 | hdrsize+=(fmsg->from->name)?strlen(fmsg->from->name):0; | |
514 | hdrsize+=(fmsg->to->name)?strlen(fmsg->to->name):0; | |
515 | do | |
516 | { | |
517 | datasize=0; | |
518 | ||
519 | if (splitpart) | |
520 | { | |
521 | #ifdef GATEBAU_MSGID | |
522 | if (areagatebau(fmsg->area)) | |
523 | sprintf(newsubj,"%02d: ",splitpart+1); | |
524 | else | |
525 | #endif | |
526 | sprintf(newsubj,"[part %d] ",splitpart+1); | |
527 | strncat(newsubj,fmsg->subj,MAXSUBJ-strlen(newsubj)); | |
528 | } | |
529 | else | |
530 | { | |
531 | strncpy(newsubj,fmsg->subj,MAXSUBJ); | |
532 | } | |
533 | strcpy(newsubj, hdrnconv(newsubj, incode, outcode, MAXSUBJ)); | |
534 | newsubj[MAXSUBJ]='\0'; | |
535 | ||
536 | if (splitpart) | |
537 | { | |
538 | #ifdef GATEBAU_MSGID | |
539 | if (areagatebau(fmsg->area)) | |
540 | fmsg->msgid_n += splitpart; | |
541 | else | |
542 | #endif | |
543 | hash_update_n(&fmsg->msgid_n,splitpart); | |
544 | } | |
545 | ||
546 | oldsubj=fmsg->subj; | |
547 | fmsg->subj=newsubj; | |
548 | if ((pkt=ftnmsghdr(fmsg,NULL,route,flavor)) == NULL) | |
549 | { | |
550 | return 1; | |
551 | } | |
552 | fmsg->subj=oldsubj; | |
553 | ||
554 | #ifdef FSC_0047 | |
555 | if (splitpart) | |
556 | { | |
557 | /* For this we need to know, BEFORE writting the message, how many split | |
558 | * parts will be needed. It is not possible with the method actually used | |
559 | * here, maybe a day... | |
560 | */ | |
561 | ||
562 | /* Field 3 ("123" in the exemple) is intended to be the number of the message | |
563 | * in an *.MSG message base :) | |
564 | * as there is nothing similar with ifmail I put the number of day (1-365) | |
565 | */ | |
566 | ||
567 | /* How to retrieve this number ??? (I put a fake 24 here, for testing, but it | |
568 | * must contain the total number of splitted messages) | |
569 | */ | |
570 | splitparttotal=24; | |
571 | ||
572 | /* The kludge line itself */ | |
573 | /* 1 2 3 4 5 | |
574 | * 0123456789012345678901234567890123456789012345678901234 | |
575 | * @SPLIT: 11 Jun 96 05:49:33 @293/2219 123 10/24 +++++++++++ | |
576 | */ | |
577 | ||
578 | fprintf(pkt,"\1SPLIT: %02d %s %02d %02d:%02d:%02d @%-11s %-5d %02d/%02d +++++++++++\r", | |
579 | ptmsplit->tm_mday,months[ptmsplit->tm_mon], | |
580 | ptmsplit->tm_year%100,ptmsplit->tm_hour, | |
581 | ptmsplit->tm_min,ptmsplit->tm_sec, | |
582 | ascfnode(bestaka,0x06),ptmsplit->tm_yday, | |
583 | splitpart,splitparttotal); | |
584 | } | |
585 | #endif | |
586 | ||
587 | if ((p=hdr("X-FTN-REPLYADDR",msg))) | |
588 | { | |
589 | hdrsize += 10+strlen(p); | |
590 | fprintf(pkt,"\1REPLYADDR:"); | |
591 | kwrite(p,pkt); | |
592 | } | |
593 | else if ((replyaddr) && ((!removereplyto) || (!removefrom))) | |
594 | { | |
595 | hdrsize += 10+strlen(replyaddr); | |
596 | fprintf(pkt,"\1REPLYADDR: "); | |
597 | kwrite(replyaddr,pkt); | |
598 | } | |
599 | ||
600 | if ((p=hdr("X-FTN-REPLYTO",msg))) | |
601 | { | |
602 | hdrsize += 8+strlen(p); | |
603 | fprintf(pkt,"\1REPLYTO:"); | |
604 | kwrite(p,pkt); | |
605 | } | |
606 | else if ((replyaddr) && ((!removereplyto) || (!removefrom))) | |
607 | { | |
608 | hdrsize += 15; | |
609 | if (magicname) | |
610 | fprintf(pkt,"\1REPLYTO: %s %s\r", | |
611 | ascfnode(bestaka,0x1f), | |
612 | magicname); | |
613 | else | |
614 | fprintf(pkt,"\1REPLYTO: %s UUCP\r", | |
615 | ascfnode(bestaka,0x1f)); | |
616 | } | |
617 | else if ((p=hdr("Reply-To",msg))) | |
618 | { | |
619 | if ((ta=parsefaddr(p))) | |
620 | { | |
621 | if ((q=hdr("From",msg))) | |
622 | { | |
623 | if (!strcasestr(q,p)) | |
624 | fprintf(pkt,"\1REPLYTO: %s %s\r", | |
625 | ascfnode(ta,0x1f), | |
626 | ta->name); | |
627 | tidy_faddr(ta); | |
628 | } | |
629 | } | |
630 | } | |
631 | ||
632 | if ((p=strip_flags(hdr("X-FTN-FLAGS",msg)))) | |
633 | { | |
634 | hdrsize += 15; | |
635 | fprintf(pkt,"\1FLAGS:%s\r",p); | |
636 | free(p); | |
637 | } | |
638 | ||
639 | #ifndef ADD_PID | |
640 | if (rfclevel==1) | |
641 | #endif | |
642 | { | |
643 | p=hdr("X-FTN-PID", msg); | |
644 | if (p==NULL) p=hdr("User-Agent", msg); | |
645 | if (p==NULL) p=hdr("X-Newsreader", msg); | |
646 | if (p==NULL) p=hdr("X-Mailer", msg); | |
647 | if (p) | |
648 | { | |
649 | hdrsize += 4 + strlen(p); | |
650 | fprintf(pkt, "\1PID:"); | |
651 | kwrite(p, pkt); | |
652 | } | |
653 | } | |
654 | ||
655 | hdrsize += 15; | |
656 | writechrs(outcode,pkt,1); | |
657 | ||
658 | #ifdef FSCHTML | |
659 | if (html_message) | |
660 | { | |
661 | hdrsize += 9; | |
662 | fprintf(pkt, "\1HTML: 5\r"); | |
663 | } | |
664 | #endif | |
665 | ||
666 | #ifdef ALLOW_CONTROL | |
667 | if ((!hdr("X-FTN-ACUPDATE",msg)) && (p=hdr("Control",msg))) | |
668 | { | |
669 | if (strstr(p,"cancel")) | |
670 | { | |
671 | ftnmsgid(p,&acup_a,&acup_n,fmsg->area); | |
672 | if (acup_a) { | |
673 | #ifdef GATEBAU_MSGID | |
674 | if (!areagatebau(fmsg->area)) | |
675 | { | |
676 | hash_update_n(&acup_n,fmsg->area); | |
677 | } | |
678 | #else | |
679 | hash_update_n(&acup_n,fmsg->area); | |
680 | #endif | |
681 | hdrsize += 26 + strlen(acup_a); | |
682 | fprintf(pkt,"\1ACUPDATE: DELETE %s %08lx\r", | |
683 | acup_a,acup_n); | |
684 | } | |
685 | } | |
686 | } | |
687 | #endif | |
688 | ||
689 | if ((!hdr("X-FTN-ACUPDATE",msg)) && (p=hdr("Supersedes",msg))) | |
690 | { | |
691 | ftnmsgid(p,&acup_a,&acup_n,fmsg->area); | |
692 | if (acup_a) { | |
693 | #ifdef GATEBAU_MSGID | |
694 | if (!areagatebau(fmsg->area)) | |
695 | hash_update_n(&acup_n,fmsg->area); | |
696 | #else | |
697 | hash_update_n(&acup_n,fmsg->area); | |
698 | #endif | |
699 | hdrsize += 26 + strlen(acup_a); | |
700 | fprintf(pkt,"\1ACUPDATE: MODIFY %s %08lx\r", | |
701 | acup_a,acup_n); | |
702 | } | |
703 | } | |
704 | ||
705 | #ifdef FSC_0070 | |
706 | /* FSC-0070 */ | |
707 | if((p = hdr("Message-ID", msg)) | |
708 | && !(hdr("X-FTN-RFCID", msg))) { | |
709 | q = strdup(p); | |
710 | fprintf(pkt,"\1RFCID:"); | |
711 | if ((l = strrchr(q, '<')) && (r = strchr(q, '>')) | |
712 | && (l < r)) { | |
713 | *l++ = ' '; | |
714 | while(*l && isspace(*l)) | |
715 | l++; | |
716 | l--; /* leading ' ' */ | |
717 | *r-- = '\0'; | |
718 | while(*r && isspace(*r)) | |
719 | *r-- = '\0'; | |
720 | } | |
721 | else | |
722 | l = q; | |
723 | kwrite(l, pkt); | |
724 | hdrsize += 6 + strlen(l); | |
725 | free(q); | |
726 | } | |
727 | #endif /* FSC_0070 */ | |
728 | ||
729 | #ifdef KEEP_TEARLINES_CLEAN | |
730 | if (!(hdr("X-FTN-Tearline", msg)) | |
731 | && !(hdr("X-FTN-TID", msg))) | |
732 | { | |
733 | sprintf(buf, " ifmail %s", version); | |
734 | hdrsize += 4 + strlen(buf); | |
735 | fprintf(pkt, "\1TID:"); | |
736 | kwrite(buf, pkt); | |
737 | } | |
738 | #endif /* KEEP_TEARLINES_CLEAN */ | |
739 | ||
740 | if ((splitpart == 0) || (hdrsize < MAXHDRSIZE)) | |
741 | { | |
742 | for (tmp=msg;tmp;tmp=tmp->next) | |
743 | if ((!strncmp(tmp->key,"X-Fsc-",6)) || | |
744 | (!strncmp(tmp->key,"X-FTN-",6) && | |
745 | strcasecmp(tmp->key,"X-FTN-Tearline") && | |
746 | strcasecmp(tmp->key,"X-FTN-Origin") && | |
747 | strcasecmp(tmp->key,"X-FTN-Sender") && | |
748 | strcasecmp(tmp->key,"X-FTN-Split") && | |
749 | strcasecmp(tmp->key,"X-FTN-FLAGS") && | |
750 | strcasecmp(tmp->key,"X-FTN-AREA") && | |
751 | strcasecmp(tmp->key,"X-FTN-MSGID") && | |
752 | strcasecmp(tmp->key,"X-FTN-REPLY") && | |
753 | strcasecmp(tmp->key,"X-FTN-SEEN-BY") && | |
754 | strcasecmp(tmp->key,"X-FTN-PATH") && | |
755 | strcasecmp(tmp->key,"X-FTN-REPLYADDR") && | |
756 | strcasecmp(tmp->key,"X-FTN-REPLYTO") && | |
757 | strcasecmp(tmp->key,"X-FTN-To") && | |
758 | strcasecmp(tmp->key,"X-FTN-From") && | |
759 | strcasecmp(tmp->key,"X-FTN-CHARSET") && | |
760 | strcasecmp(tmp->key,"X-FTN-CHRS") && | |
761 | strcasecmp(tmp->key,"X-FTN-CODEPAGE") && | |
762 | strcasecmp(tmp->key,"X-FTN-ORIGCHRS") && | |
763 | strcasecmp(tmp->key,"X-FTN-SOT") && | |
764 | strcasecmp(tmp->key,"X-FTN-EOT") && | |
765 | strcasecmp(tmp->key,"X-FTN-Via"))) | |
766 | if (strcasecmp(tmp->key,"X-FTN-KLUDGE") == 0) | |
767 | { | |
768 | if (!strcasecmp(tmp->val," SOT:\n")) | |
769 | sot_kludge=1; | |
770 | else if (!strcasecmp(tmp->val," EOT:\n")) | |
771 | eot_kludge=1; | |
772 | else | |
773 | { | |
774 | hdrsize += strlen(tmp->val); | |
775 | fprintf(pkt,"\1"); | |
776 | /* we should have restored the original string here... */ | |
777 | kwrite((tmp->val)+1,pkt); | |
778 | } | |
779 | } | |
780 | else | |
781 | { | |
782 | hdrsize += strlen(tmp->key)+strlen(tmp->val); | |
783 | fprintf(pkt,"\1%s:",tmp->key+6); | |
784 | kwrite(tmp->val,pkt); | |
785 | } | |
786 | /* ZConnect are X-ZC-*: in usenet, \1ZC-*: in FTN */ | |
787 | for (tmp=msg;tmp;tmp=tmp->next) | |
788 | if ((!strncmp(tmp->key,"X-ZC-",5))) | |
789 | { | |
790 | hdrsize += strlen(tmp->key)+strlen(tmp->val); | |
791 | fprintf(pkt,"\1%s:",tmp->key+2); | |
792 | kwrite(tmp->val,pkt); | |
793 | } | |
794 | #ifdef GATEBAU_MSGID | |
795 | if ((!ftnorigin) && (rfclevel > 0) && | |
796 | (areagatebau(fmsg->area))) | |
797 | { | |
798 | hdrsize += 12; | |
799 | fprintf(pkt,"\1X-GATEWAY:"); | |
800 | #ifdef XGATEWAY_STRICT | |
801 | if ((p=hdr("X-Gateway",msg))) | |
802 | { | |
803 | hdrsize += strlen(p); | |
804 | if (q=strchr(p,'\n')) *q='\0'; | |
805 | fprintf(pkt," %s,",p); | |
806 | if (q) *q='\n'; | |
807 | } | |
808 | #endif | |
809 | hdrsize += 24+strlen(myfqdn)+strlen(version); | |
810 | fprintf(pkt," RFC1036/822 %s [ifmail %s]\r", | |
811 | myfqdn,version); | |
812 | } | |
813 | #endif | |
814 | ||
815 | ||
816 | rfcheaders=0; | |
817 | for (tmp=msg;tmp;tmp=tmp->next) | |
818 | #ifdef KEEP_MSGID_ON_SPLIT | |
819 | if ((needputrfc(tmp) == 1)) | |
820 | #else | |
821 | if ((needputrfc(tmp) == 1) && | |
822 | ((strcasecmp(tmp->key,"Message-ID")) || | |
823 | (splitpart == 0))) | |
824 | #endif | |
825 | { | |
826 | hdrsize += strlen(tmp->key)+strlen(tmp->val); | |
827 | fprintf(pkt,"\1RFC-%s:",tmp->key); | |
828 | kwrite(hdrconv(tmp->val, incode, outcode),pkt); | |
829 | } | |
830 | for (tmp=msg;tmp;tmp=tmp->next) | |
831 | #ifdef KEEP_MSGID_ON_SPLIT | |
832 | if ((needputrfc(tmp) > 1)) | |
833 | #else | |
834 | if ((needputrfc(tmp) > 1) && | |
835 | ((strcasecmp(tmp->key,"Message-ID")) || | |
836 | (splitpart == 0))) | |
837 | #endif | |
838 | { | |
839 | rfcheaders++; | |
840 | hdrsize += strlen(tmp->key)+strlen(tmp->val); | |
841 | fprintf(pkt,"%s:",tmp->key); | |
842 | cwrite(hdrconv(tmp->val, incode, outcode),pkt); | |
843 | } | |
844 | if (rfcheaders) cwrite("\n",pkt); | |
845 | if ((hdr("X-FTN-SOT",msg)) || (sot_kludge)) | |
846 | fprintf(pkt,"\1SOT:\r"); | |
847 | if ((splitpart == 0) && (hdr("X-PGP-Signed",msg))) | |
848 | fprintf(pkt,PGP_SIGNED_BEGIN"\r"); | |
849 | } | |
850 | ||
851 | if (replyaddr) | |
852 | { | |
853 | free(replyaddr); | |
854 | replyaddr=NULL; | |
855 | } | |
856 | /* */ | |
857 | if (needsplit) | |
858 | { | |
859 | #ifndef FSC_0047 | |
860 | fprintf(pkt," * Continuation %d of a split message *\r\r", | |
861 | splitpart); | |
862 | #endif | |
863 | needsplit=0; | |
864 | } | |
865 | else if ((p=hdr("X-Body-Start",msg))) | |
866 | { | |
867 | datasize += strlen(p); | |
868 | if (qp_or_base64==1) | |
869 | cwrite(strkconv(qp_decode(p), incode, outcode), pkt); | |
870 | else if (qp_or_base64==2) | |
871 | cwrite(strkconv(b64_decode(p), incode, outcode), pkt); | |
872 | else | |
873 | cwrite(strkconv(p, incode, outcode), pkt); | |
874 | } | |
875 | while (!(needsplit=(!forbidsplit) && | |
876 | (((splitpart && | |
877 | (datasize > maxmsize)) || | |
878 | (!splitpart && | |
879 | ((datasize+hdrsize) > maxmsize)))) | |
880 | ) && | |
881 | (bgets(buf,sizeof(buf)-1,fp))) | |
882 | { | |
883 | debug(19,"putmessage body %s",buf); | |
884 | datasize += strlen(buf); | |
885 | if (qp_or_base64==1) | |
886 | cwrite(strkconv(qp_decode(buf), incode, outcode), pkt); | |
887 | else if (qp_or_base64==2) | |
888 | cwrite(strkconv(b64_decode(buf), incode, outcode), pkt); | |
889 | else | |
890 | cwrite(strkconv(buf, incode, outcode), pkt); | |
891 | } | |
892 | if (needsplit) | |
893 | { | |
894 | #ifndef FSC_0047 | |
895 | fprintf(pkt,"\r * Message split, to be continued *\r"); | |
896 | #endif | |
897 | splitpart++; | |
898 | } | |
899 | else if ((p=hdr("X-PGP-Signed",msg))) | |
900 | { | |
901 | fprintf(pkt,PGP_SIG_BEGIN"\r"); | |
902 | if ((q=hdr("X-PGP-Version",msg))) | |
903 | { | |
904 | fprintf(pkt,"Version:"); | |
905 | cwrite(q,pkt); | |
906 | } | |
907 | if ((q=hdr("X-PGP-Charset",msg))) | |
908 | { | |
909 | fprintf(pkt,"Charset:"); | |
910 | cwrite(q,pkt); | |
911 | } | |
912 | if ((q=hdr("X-PGP-Comment",msg))) | |
913 | { | |
914 | fprintf(pkt,"Comment:"); | |
915 | cwrite(q,pkt); | |
916 | } | |
917 | fprintf(pkt,"\r"); | |
918 | p=xstrcpy(p); | |
919 | q=strtok(p," \t\n"); | |
920 | fprintf(pkt,"%s\r",q); | |
921 | while ((q=(strtok(NULL," \t\n")))) | |
922 | fprintf(pkt,"%s\r",q); | |
923 | fprintf(pkt,PGP_SIG_END"\r"); | |
924 | } | |
925 | /* */ | |
926 | ||
927 | /* putbody(0,msg,fp,pkt,forbidsplit,hdrsize,incode,outcode,qp_or_base64); */ | |
928 | ||
929 | if ((p=hdr("X-FTN-EOT",msg)) || (eot_kludge)) | |
930 | fprintf(pkt,"\1EOT:\r"); | |
931 | ||
932 | if ((p=hdr("X-FTN-Tearline",msg))) | |
933 | { | |
934 | fprintf(pkt,"---"); | |
935 | if (strcasecmp(p," (none)\n") == 0) | |
936 | cwrite("\n",pkt); | |
937 | else | |
938 | cwrite(p,pkt); | |
939 | } | |
940 | else if (newsmode) | |
941 | #ifdef KEEP_TEARLINES_CLEAN | |
942 | fprintf(pkt,"---\r"); | |
943 | #else | |
944 | #ifdef REPLACE_TEARLINES_WITH | |
945 | fprintf(pkt,"--- "/**/REPLACE_TEARLINES_WITH/**/"\r"); | |
946 | #else | |
947 | fprintf(pkt,"--- ifmail v.%s\r",version); | |
948 | #endif /* REPLACE_TEARLINES_WITH */ | |
949 | #endif /* KEEP_TEARLINES_CLEAN */ | |
950 | ||
951 | if ((p=hdr("X-FTN-Origin",msg))) | |
952 | { | |
953 | if (*(q=p+strlen(p)-1) == '\n') *q='\0'; | |
954 | fprintf(pkt," * Origin:"); | |
955 | cwrite(hdrconv(p, incode, outcode),pkt); | |
956 | if (!newsmode) fprintf(pkt,"\r"); | |
957 | } | |
958 | else if (newsmode) | |
959 | { | |
960 | fprintf(pkt," * Origin: "); /* strlen=11 */ | |
961 | if (fmsg->origin) | |
962 | cwrite(hdrconv(fmsg->origin, incode, outcode), pkt); | |
963 | else | |
964 | cwrite(DEFAULT_ORIGIN,pkt); | |
965 | fprintf(pkt," (%s)", | |
966 | ascfnode(fmsg->from,tinyorigin?0x0f:0x1f)); | |
967 | } | |
968 | ||
969 | if (newsmode) | |
970 | { | |
971 | for (tmpl=whoami;tmpl;tmpl=tmpl->next) | |
972 | if ((tmpl->addr->point == 0) && | |
973 | ((bestaka->domain == NULL) || | |
974 | (tmpl->addr->domain == NULL) || | |
975 | (strcasecmp(bestaka->domain, | |
976 | tmpl->addr->domain) == 0)) && | |
977 | (bestaka->zone == tmpl->addr->zone)) | |
978 | fill_list(sbl,ascfnode(tmpl->addr,0x06),NULL); | |
979 | #ifdef HAS_NDBM_H | |
980 | if ((p=hdr("Message-ID",msg))) | |
981 | { | |
982 | while (isspace(*p)) p++; | |
983 | q=xstrcpy(p); | |
984 | if (*(p=q+strlen(q)-1) == '\n') *(p--)='\0'; | |
985 | while (isspace(*p)) *(p--)='\0'; | |
986 | fill_list(sbl,idlookup(q),NULL); | |
987 | free(q); | |
988 | } | |
989 | #endif | |
990 | sort_list(sbl); | |
991 | seenlen=MAXSEEN+1; | |
992 | /* ensure it will not match for the first entry */ | |
993 | oldnet=(*sbl)->addr->net-1; | |
994 | for (tmpl=*sbl;tmpl;tmpl=tmpl->next) | |
995 | { | |
996 | if (tmpl->addr->net == oldnet) | |
997 | sprintf(sbe," %u",tmpl->addr->node); | |
998 | else | |
999 | sprintf(sbe," %u/%u",tmpl->addr->net, | |
1000 | tmpl->addr->node); | |
1001 | oldnet=tmpl->addr->net; | |
1002 | seenlen+=strlen(sbe); | |
1003 | if (seenlen > MAXSEEN) | |
1004 | { | |
1005 | seenlen=0; | |
1006 | fprintf(pkt,"\rSEEN-BY:"); | |
1007 | sprintf(sbe," %u/%u",tmpl->addr->net, | |
1008 | tmpl->addr->node); | |
1009 | seenlen=strlen(sbe); | |
1010 | } | |
1011 | fprintf(pkt,"%s",sbe); | |
1012 | } | |
1013 | ||
1014 | for (tmp=msg;tmp;tmp=tmp->next) | |
1015 | if (!strcasecmp(tmp->key,"X-FTN-PATH")) | |
1016 | { | |
1017 | fill_path(&ptl,tmp->val); | |
1018 | } | |
1019 | sprintf(sbe,"%u/%u",bestaka->net, | |
1020 | bestaka->node); | |
1021 | fill_path(&ptl,sbe); | |
1022 | uniq_list(&ptl); | |
1023 | seenlen=MAXPATH+1; | |
1024 | /* ensure it will not match for the first entry */ | |
1025 | oldnet=ptl->addr->net-1; | |
1026 | for (tmpl=ptl;tmpl;tmpl=tmpl->next) | |
1027 | { | |
1028 | if (tmpl->addr->net == oldnet) | |
1029 | sprintf(sbe," %u",tmpl->addr->node); | |
1030 | else | |
1031 | sprintf(sbe," %u/%u",tmpl->addr->net, | |
1032 | tmpl->addr->node); | |
1033 | oldnet=tmpl->addr->net; | |
1034 | seenlen+=strlen(sbe); | |
1035 | if (seenlen > MAXPATH) | |
1036 | { | |
1037 | seenlen=0; | |
1038 | fprintf(pkt,"\r\1PATH:"); | |
1039 | sprintf(sbe," %u/%u",tmpl->addr->net, | |
1040 | tmpl->addr->node); | |
1041 | seenlen=strlen(sbe); | |
1042 | } | |
1043 | fprintf(pkt,"%s",sbe); | |
1044 | } | |
1045 | fprintf(pkt,"\r"); | |
1046 | } | |
1047 | else /* mail mode */ | |
1048 | { | |
1049 | for (tmp=msg;tmp;tmp=tmp->next) | |
1050 | if (!strcasecmp(tmp->key,"X-FTN-Via")) | |
1051 | { | |
1052 | datasize += strlen(tmp->key)+strlen(tmp->val); | |
1053 | fprintf(pkt,"\1Via"); | |
1054 | kwrite(tmp->val,pkt); | |
1055 | } | |
1056 | #ifdef JE | |
1057 | /* ### Modified by T.Tanaka on 26 Mar 1995 */ | |
1058 | time(&t); | |
1059 | ptm=gmtime(&t); | |
1060 | /* @Via 6:730/18@os2net @19950304.052627 FrontDoor 2.12.SW */ | |
1061 | /* fprintf(pkt, "\1Via %s @%04d%02d%02d.%02d%02d%02d.%s ifmail %s\r", | |
1062 | ascfnode(bestaka,0x1f), | |
1063 | ptm->tm_year + 1900, | |
1064 | ptm->tm_mon + 1, | |
1065 | ptm->tm_mday, | |
1066 | ptm->tm_hour, | |
1067 | ptm->tm_min, | |
1068 | ptm->tm_sec, | |
1069 | "UTC", version); | |
1070 | */ | |
1071 | /* @Via Squish/386 1.11 6:600/500, Fri Mar 24 1995 at 09:32 UTC */ | |
1072 | /* fprintf(pkt, "\1Via ifmail %s %s, %s %s %d %d at %02d:%02d %s\r", | |
1073 | version, ascfnode(bestaka,0x1f), | |
1074 | weekday[ptm->tm_wday], months[ptm->tm_mon], | |
1075 | ptm->tm_mday, ptm->tm_year + 1900, | |
1076 | ptm->tm_hour, ptm->tm_min, "UTC"); | |
1077 | */ | |
1078 | #endif | |
1079 | /* @Via ifmail 2:293/2219@fidonet, Wed Jan 3 1996 at 07:49 (2.8c) */ | |
1080 | fprintf(pkt,"\1Via ifmail %s, %s (%s)\r", | |
1081 | ascfnode(bestaka,0x1f), | |
1082 | viadate(),version); | |
1083 | } | |
1084 | awrite("",pkt); /* trailing zero byte */ | |
1085 | if (ferror(pkt)) | |
1086 | { | |
1087 | logerr("$error writing to ftn packet"); | |
1088 | return 1; | |
1089 | } | |
1090 | tidy_falist(&ptl); | |
1091 | } | |
1092 | while (needsplit); | |
1093 | ||
1094 | debug(3,"putmessage exiting..."); | |
1095 | return 0; | |
1096 | } | |
1097 |
120 | 120 | { |
121 | 121 | *r='\0'; |
122 | 122 | r=strrchr(l+6,'_'); |
123 | *r++='\0'; | |
123 | if (r) *r++='\0'; | |
124 | 124 | *s=xstrcpy(qp_decode(l+6)); |
125 | sscanf(r,"%lx",&nid); | |
125 | if (r) sscanf(r,"%lx",&nid); | |
126 | 126 | ftnorigin=1; |
127 | 127 | } |
128 | 128 | /* <NOMSGID_mimeanything_abcd1234@ftn.domain> */ |
479 | 479 | tmsg->msgid_s=xstrcpy(p); |
480 | 480 | if (*(p=tmsg->msgid_s+strlen(tmsg->msgid_s)-1) == '\n') *p='\0'; |
481 | 481 | } |
482 | else if ((p=hdr(".MSGID",msg))) | |
483 | { | |
484 | tmsg->ftnorigin&=1; | |
485 | while (isspace(*p)) p++; | |
486 | tmsg->msgid_s=xstrcpy(p); | |
487 | if (*(p=tmsg->msgid_s+strlen(tmsg->msgid_s)-1) == '\n') *p='\0'; | |
488 | } | |
482 | 489 | else if ((p=hdr("Message-ID",msg))) |
483 | 490 | { |
484 | 491 | tmsg->ftnorigin &= |
0 | /* ### Modified by P.Saratxaga on 19 Sep 1995 ### | |
1 | * - Added X-FTN-From and X-FTN-To support | |
2 | * - added code by T.Tanaka, dated 13 Mar 1995, to put the freename in the ftn | |
3 | * header, instead of the userid, when the address is fido parseable | |
4 | * - modified ^aREPLY: code, to look in In-Reply-To: only if not newsmode, and | |
5 | * in References: only if newsmode | |
6 | * - modified the way ^aREPLYADDR and ftn 'to:' are created (I use the | |
7 | * function parserfcaddr() ), so the address of the "Reply-To: " line (if | |
8 | * exists) is used for ^aREPLYADDR and registration database. | |
9 | * - support to decode MSGID from fidogate "Message-ID: <MSGID_....>" | |
10 | * - suport for X-Apparently-To: (generated by the french fido->usenet gate) | |
11 | * - added -DDONT_REGATE code by Wim Van Sebroeck <vsebro@medelec.uia.ac.be> | |
12 | * - corriged a bug when Organization: has only blanks | |
13 | */ | |
14 | #include <stdlib.h> | |
15 | #include <stdio.h> | |
16 | #include <limits.h> | |
17 | #include <string.h> | |
18 | #include <ctype.h> | |
19 | #include <time.h> | |
20 | #include "xutil.h" | |
21 | #include "lutil.h" | |
22 | #include "ftn.h" | |
23 | #include "ftnmsg.h" | |
24 | #include "rfcmsg.h" | |
25 | #include "rfcaddr.h" | |
26 | #include "mime.h" | |
27 | #include "charset.h" | |
28 | #include "charconv.h" | |
29 | #include "config.h" | |
30 | #include "version.h" | |
31 | #include "hash.h" | |
32 | #ifdef GATEBAU_MSGID | |
33 | #include "areas.h" | |
34 | #endif | |
35 | ||
36 | #ifndef ULONG_MAX | |
37 | #define ULONG_MAX 4294967295 | |
38 | #endif | |
39 | ||
40 | int newsmode=0; | |
41 | char *replyaddr=NULL; | |
42 | ||
43 | extern time_t now; | |
44 | extern faddr *bestaka; | |
45 | extern int rfclevel; | |
46 | ||
47 | extern time_t parsedate(char *,void *); | |
48 | extern int registrate(char *,char *); | |
49 | extern unsigned long atoul(char*); | |
50 | ||
51 | extern unsigned INT16 crc(char *); | |
52 | extern int flagset(char *); | |
53 | #ifdef GATEBAU_MSGID | |
54 | extern unsigned long crcgatebau(char*); | |
55 | #endif | |
56 | ||
57 | int ftnmsgid(msgid,s,n,areaname) | |
58 | char *msgid; | |
59 | char **s; | |
60 | unsigned long *n; | |
61 | char *areaname; | |
62 | { | |
63 | char *buf,*l,*r; | |
64 | unsigned long nid=0L; | |
65 | faddr *tmp; | |
66 | int ftnorigin=0; | |
67 | ||
68 | debug(3,"make ftn msgid from \"%s\"",msgid); | |
69 | ||
70 | if (msgid == NULL) | |
71 | { | |
72 | *s=NULL; | |
73 | *n=0L; | |
74 | return ftnorigin; | |
75 | } | |
76 | ||
77 | buf=xmalloc(strlen(msgid)+65); | |
78 | strcpy(buf,msgid); | |
79 | if ((l=strchr(buf,'<'))) l++; | |
80 | else l=buf; | |
81 | while (isspace(*l)) l++; | |
82 | if ((r=strchr(l,'>'))) *r='\0'; | |
83 | if (*(r=l+strlen(l)-1) == '\n') *r='\0'; | |
84 | if ((tmp=parsefaddr(l))) | |
85 | { | |
86 | if (tmp->name) | |
87 | { | |
88 | if (strspn(tmp->name,"0123456789") == strlen(tmp->name)) | |
89 | nid=atoul(tmp->name); | |
90 | else nid=ULONG_MAX; | |
91 | if (nid == ULONG_MAX) | |
92 | hash_update_s(&nid,tmp->name); | |
93 | else | |
94 | ftnorigin=1; | |
95 | } | |
96 | else | |
97 | { | |
98 | hash_update_s(&nid,l); | |
99 | } | |
100 | *s=xstrcpy(ascfnode(tmp,0x1f)); | |
101 | tidy_faddr(tmp); | |
102 | } | |
103 | else | |
104 | { | |
105 | if ((r=strchr(l,'@')) == NULL) /* should never happen */ | |
106 | { | |
107 | *s=xstrcpy(l); | |
108 | hash_update_s(&nid,l); | |
109 | } | |
110 | else if ((rfclevel < 1) && (bestaka) && (ftnmsgidstyle) && | |
111 | (strncasecmp(r+1,ftnmsgidstyle, | |
112 | strlen(ftnmsgidstyle)) == 0)) | |
113 | { | |
114 | *s=xstrcpy(ascfnode(bestaka,0x1f)); | |
115 | /* FIXME: what to put here ? -- P.Saratxaga */ | |
116 | hash_update_s(&nid,l); | |
117 | } | |
118 | /* <MSGID_mimeanything_abcd1234@ftn.domain> */ | |
119 | else if (strncmp(l,"MSGID_",6) == 0) | |
120 | { | |
121 | *r='\0'; | |
122 | r=strrchr(l+6,'_'); | |
123 | if (r) *r++='\0'; | |
124 | *s=xstrcpy(qp_decode(l+6)); | |
125 | if (r) sscanf(r,"%lx",&nid); | |
126 | ftnorigin=1; | |
127 | } | |
128 | /* <NOMSGID_mimeanything_abcd1234@ftn.domain> */ | |
129 | else if (strncmp(l,"NOMSGID_",8) == 0) | |
130 | { | |
131 | *s=NULL; | |
132 | *n=0L; | |
133 | ftnorigin=1; | |
134 | return ftnorigin; | |
135 | } | |
136 | /* <ftn_2.204.226$fidonet_1d17b3b3_Johan.Olofsson@magnus.ct.se> */ | |
137 | else if (strncmp(l,"ftn_",4) == 0) | |
138 | { | |
139 | *r='\0'; | |
140 | if ((r=strchr(l+4,'$')) || (r=strchr(l+4,'#'))) | |
141 | { | |
142 | if (*r=='$') *r='@'; | |
143 | if ((r=strchr(l+4,'.'))) | |
144 | *r=':'; | |
145 | if ((r=strchr(l+4,'.'))) | |
146 | *r='/'; | |
147 | } | |
148 | while ((r=strrchr(l+4,'_')) != strchr(l+4,'_')) *r='\0'; | |
149 | r=strchr(l+4,'_'); | |
150 | *r++='\0'; | |
151 | *s=xstrcpy(l+4); | |
152 | sscanf(r,"%lx",&nid); | |
153 | ftnorigin=1; | |
154 | } | |
155 | /* <wgcid$3$g712$h610$i22$kfidonet$j6596dbf5@brazerko.com> */ | |
156 | else if (strncmp(l,"wgcid$",6) == 0) | |
157 | { | |
158 | *r='\0'; | |
159 | if ((r=strstr(l+6,"$g"))) | |
160 | { | |
161 | *r='\0'; | |
162 | *s=xstrcpy(l+6); | |
163 | *s=xstrcat(*s,":"); | |
164 | l=r+2; | |
165 | } | |
166 | if ((r=strstr(l,"$h"))) | |
167 | { | |
168 | *r++='\0'; | |
169 | *s=xstrcat(*s,l); | |
170 | *s=xstrcat(*s,"/"); | |
171 | l=r+2; | |
172 | } | |
173 | if ((r=strstr(l,"$i"))) | |
174 | { | |
175 | *r='\0'; | |
176 | *s=xstrcat(*s,l); | |
177 | *s=xstrcat(*s,"."); | |
178 | l=r+2; | |
179 | } | |
180 | if ((r=strstr(l,"$k"))) | |
181 | { | |
182 | *r='\0'; | |
183 | *s=xstrcat(*s,l); | |
184 | *s=xstrcat(*s,"@"); | |
185 | l=r+2; | |
186 | } | |
187 | if ((r=strstr(l,"$j"))) | |
188 | { | |
189 | *r='\0'; | |
190 | *s=xstrcat(*s,l); | |
191 | sscanf(r+2,"%lx",&nid); | |
192 | } | |
193 | } | |
194 | #ifdef GATEBAU_MSGID | |
195 | else if (areagatebau(areaname)) | |
196 | { | |
197 | *s=xstrcpy("<"); | |
198 | *s=xstrcat(*s,l); | |
199 | *s=xstrcat(*s,">"); | |
200 | if (areaname) { | |
201 | r=xstrcpy(*s); | |
202 | r=xstrcat(r,areaname); | |
203 | nid=crcgatebau(r); | |
204 | } else { | |
205 | nid=crcgatebau(*s); | |
206 | } | |
207 | } | |
208 | #endif | |
209 | else | |
210 | { | |
211 | *r++='\0'; | |
212 | if (strspn(l,"0123456789") == strlen(l)) | |
213 | nid=atoul(l); | |
214 | else nid=ULONG_MAX; | |
215 | if (nid == ULONG_MAX) { | |
216 | hash_update_s(&nid,l); | |
217 | } | |
218 | *s=xstrcpy(r); | |
219 | } | |
220 | } | |
221 | *n=nid; | |
222 | ||
223 | free(buf); | |
224 | return ftnorigin; | |
225 | } | |
226 | ||
227 | ftnmsg *mkftnhdr(msg,incode,outcode) | |
228 | rfcmsg *msg; | |
229 | int incode, outcode; | |
230 | { | |
231 | char *freename=NULL,*rfcfrom=NULL,*p,*q,*l,*r; | |
232 | char *fbuf=NULL; | |
233 | #ifdef DONT_REGATE | |
234 | char *ftnfrom=NULL; | |
235 | #endif | |
236 | ftnmsg *tmsg; | |
237 | int needreplyaddr; | |
238 | ||
239 | tmsg=(ftnmsg *)xmalloc(sizeof(ftnmsg)); | |
240 | ||
241 | tmsg->flags=0; | |
242 | tmsg->ftnorigin=0; | |
243 | tmsg->to=NULL; | |
244 | tmsg->from=NULL; | |
245 | tmsg->date=0L; | |
246 | tmsg->subj=NULL; | |
247 | tmsg->msgid_s=NULL; | |
248 | tmsg->msgid_a=NULL; | |
249 | tmsg->reply_s=NULL; | |
250 | tmsg->reply_a=NULL; | |
251 | tmsg->origin=NULL; | |
252 | tmsg->area=NULL; | |
253 | ||
254 | if (newsmode) | |
255 | { | |
256 | p=xstrcpy(hdr("Comment-To",msg)); | |
257 | if (p == NULL) p=xstrcpy(hdr("X-Comment-To",msg)); | |
258 | if (p == NULL) p=xstrcpy(hdr("X-FTN-To",msg)); | |
259 | if (p == NULL) p=xstrcpy(hdr("X-Fidonet-Comment-To",msg)); | |
260 | if (p == NULL) p=xstrcpy(hdr("X-Apparently-To",msg)); | |
261 | if (p) | |
262 | { | |
263 | debug(6,"getting `to' address from: \"%s\"",p); | |
264 | if ((tmsg->to=parsefaddr(p)) == NULL) | |
265 | tmsg->to=parsefaddr("All@p0.f0.n0.z0"); | |
266 | if ((l=strrchr(p,'<')) && (r=strchr(p,'>')) && (l < r)) | |
267 | { | |
268 | r=l; | |
269 | *r--='\0'; | |
270 | if ((l=strchr(p,'"')) && (r=strrchr(p,'"')) && (l < r)) | |
271 | { | |
272 | l++; | |
273 | *r--='\0'; | |
274 | } | |
275 | while (isspace(*r)) *r--='\0'; | |
276 | if (!l) l=p; | |
277 | while (isspace(*l)) l++; | |
278 | } | |
279 | else if ((l=strrchr(p,'(')) && (r=strchr(p,')')) && (l < r)) | |
280 | { | |
281 | *r--='\0'; | |
282 | while (isspace(*r)) *r--='\0'; | |
283 | l++; | |
284 | while (isspace(*l)) l++; | |
285 | } | |
286 | else | |
287 | { | |
288 | l=p; | |
289 | while (isspace(*l)) l++; | |
290 | r=p+strlen(p)-1; | |
291 | if (*r == '\n') *r--='\0'; | |
292 | while (isspace(*r)) *r--='\0'; | |
293 | } | |
294 | ||
295 | if(*l) | |
296 | { | |
297 | strcpy(l,hdrnconv(l,incode,outcode,MAXNAME)); | |
298 | if (strlen(l) > MAXNAME) | |
299 | l[MAXNAME]='\0'; | |
300 | free(tmsg->to->name); | |
301 | tmsg->to->name=xstrcpy(l); | |
302 | } | |
303 | free(p); | |
304 | } | |
305 | else | |
306 | tmsg->to=parsefaddr("All@p0.f0.n0.z0"); | |
307 | debug(3,"TO: %s",ascinode(tmsg->to,0x7f)); | |
308 | } | |
309 | ||
310 | p=fbuf=xstrcpy(hdr("Reply-To",msg)); | |
311 | if (fbuf == NULL) p=fbuf=xstrcpy(hdr("From",msg)); | |
312 | if (fbuf == NULL) p=fbuf=xstrcpy(hdr("X-UUCP-From",msg)); | |
313 | if (p) { | |
314 | q=p; | |
315 | while (isspace(*q)) q++; | |
316 | fbuf=parserfcaddr(q).remainder; | |
317 | if (parserfcaddr(q).target) { | |
318 | fbuf=xstrcat(fbuf,"@"); | |
319 | fbuf=xstrcat(fbuf,parserfcaddr(q).target); | |
320 | } | |
321 | rfcfrom=fbuf; | |
322 | } | |
323 | if (!rfcfrom) rfcfrom=xstrcpy("postmaster"); | |
324 | p=fbuf=xstrcpy(hdr("From",msg)); | |
325 | if (fbuf == NULL) p=fbuf=xstrcpy(hdr("X-UUCP-From",msg)); | |
326 | if (p) { | |
327 | q=p; | |
328 | while (isspace(*q)) q++; | |
329 | if ((q) && (*q != '\0')) | |
330 | freename=parserfcaddr(q).comment; | |
331 | else freename=NULL; | |
332 | } | |
333 | else freename=xstrcpy("Unidentified User"); | |
334 | if (freename) { | |
335 | while (isspace(*freename)) freename++; | |
336 | } | |
337 | ||
338 | if (rfcfrom) | |
339 | { | |
340 | while (isspace(*rfcfrom)) rfcfrom++; | |
341 | p=rfcfrom+strlen(rfcfrom)-1; | |
342 | while ((isspace(*p)) || (*p == '\n')) *(p--)='\0'; | |
343 | } | |
344 | if ((freename) && (*freename != '\0')) | |
345 | { | |
346 | while (isspace(*freename)) freename++; | |
347 | p=freename+strlen(freename)-1; | |
348 | while ((isspace(*p)) || (*p == '\n')) *(p--)='\0'; | |
349 | strcpy(freename,hdrconv(freename,incode,outcode)); | |
350 | if ((*freename == '\"') && (*(p=freename+strlen(freename)-1) == '\"')) | |
351 | { | |
352 | freename++; | |
353 | *p='\0'; | |
354 | } | |
355 | } | |
356 | if ((!freename) || ((freename) && (*freename == '\0')) || (strcmp(freename,".")==0)) | |
357 | freename=rfcfrom; | |
358 | ||
359 | if (newsmode) debug(3,"FROM: %s <%s>",freename,rfcfrom); | |
360 | else loginf("from: %s <%s>",freename,rfcfrom); | |
361 | ||
362 | needreplyaddr=1; | |
363 | if ((tmsg->from=parsefaddr(rfcfrom)) == NULL) | |
364 | { | |
365 | if (freename && rfcfrom) | |
366 | if (!strchr(freename,'@') && | |
367 | !strchr(freename,'%') && | |
368 | strncasecmp(freename,rfcfrom,MAXNAME) && | |
369 | strncasecmp(freename,"uucp",4) && | |
370 | strncasecmp(freename,"usenet",6) && | |
371 | strncasecmp(freename,"news",4) && | |
372 | strncasecmp(freename,"super",5) && | |
373 | strncasecmp(freename,"admin",5) && | |
374 | strncasecmp(freename,"postmaster",10) && | |
375 | strncasecmp(freename,"sys",3)) | |
376 | needreplyaddr=registrate(freename,rfcfrom); | |
377 | } | |
378 | else | |
379 | { | |
380 | tmsg->ftnorigin=1; | |
381 | tmsg->from->name=xstrcpy(freename); | |
382 | if (strlen(tmsg->from->name) > MAXNAME) | |
383 | tmsg->from->name[MAXNAME]='\0'; | |
384 | } | |
385 | ||
386 | if (replyaddr) | |
387 | { | |
388 | free(replyaddr); | |
389 | replyaddr=NULL; | |
390 | } | |
391 | if (needreplyaddr && (tmsg->from == NULL)) | |
392 | { | |
393 | debug(6,"fill replyaddr with \"%s\"",rfcfrom); | |
394 | replyaddr=xstrcpy(rfcfrom); | |
395 | } | |
396 | ||
397 | debug(6,"From address was%s distinguished as ftn", | |
398 | tmsg->from ? "" : " not"); | |
399 | ||
400 | if ((tmsg->from == NULL) && (bestaka)) | |
401 | { | |
402 | #ifdef DONT_REGATE | |
403 | p=xstrcpy(hdr("X-FTN-Sender",msg)); | |
404 | if (p == NULL) { | |
405 | if ((p=hdr("X-FTN-From",msg))) | |
406 | p=xstrcpy(ascinode(parsefnode(p),0xff)); | |
407 | } | |
408 | if (p) | |
409 | { | |
410 | q=p; | |
411 | while (isspace(*q)) q++; | |
412 | ftnfrom=parserfcaddr(q).remainder; | |
413 | if (parserfcaddr(q).target) | |
414 | { | |
415 | ftnfrom=xstrcat(ftnfrom,"@"); | |
416 | ftnfrom=xstrcat(ftnfrom,parserfcaddr(q).target); | |
417 | } | |
418 | debug(6,"Ftn gateway: \"%s\"", ftnfrom); | |
419 | if (newsmode) debug(3,"FTN-FROM: %s",ftnfrom); | |
420 | else loginf("ftn sender: %s",ftnfrom); | |
421 | if (ftnfrom) tmsg->from=parsefaddr(ftnfrom); | |
422 | if ((tmsg->from) && (!tmsg->from->name)) | |
423 | { | |
424 | tmsg->from->name=xstrcpy(rfcfrom); | |
425 | } | |
426 | } | |
427 | if (tmsg->from == NULL) | |
428 | { | |
429 | #endif | |
430 | tmsg->from=(faddr *)xmalloc(sizeof(faddr)); | |
431 | tmsg->from->name=xstrcpy(freename); | |
432 | if (tmsg->from->name && (strlen(tmsg->from->name) > MAXNAME)) | |
433 | tmsg->from->name[MAXNAME]='\0'; | |
434 | tmsg->from->point=bestaka->point; | |
435 | tmsg->from->node=bestaka->node; | |
436 | tmsg->from->net=bestaka->net; | |
437 | tmsg->from->zone=bestaka->zone; | |
438 | tmsg->from->domain=xstrcpy(bestaka->domain); | |
439 | #ifdef DONT_REGATE | |
440 | } | |
441 | #endif | |
442 | } | |
443 | ||
444 | if (fbuf) free(fbuf); fbuf=NULL; | |
445 | ||
446 | p=hdr("Subject",msg); | |
447 | if (p) | |
448 | { | |
449 | while (isspace(*p)) p++; | |
450 | /* charset conversion for subject line is done in message.c | |
451 | * here we only convert quoted-printable and base64 to 8 bit | |
452 | */ | |
453 | tmsg->subj=xstrcpy(hdrnconv(p, 0, 0, MAXSUBJ)); | |
454 | tmsg->subj=xstrcpy(p); | |
455 | if (*(p=tmsg->subj+strlen(tmsg->subj)-1) == '\n') *p='\0'; | |
456 | if (strlen(tmsg->subj) > MAXSUBJ) tmsg->subj[MAXSUBJ]='\0'; | |
457 | } | |
458 | else tmsg->subj=xstrcpy(" "); | |
459 | ||
460 | debug(3,"SUBJ: \"%s\"",tmsg->subj); | |
461 | ||
462 | if ((p=hdr("X-FTN-FLAGS",msg))) tmsg->flags |= flagset(p); | |
463 | if (hdr("Return-Receipt-To",msg)) tmsg->flags |= FLG_RRQ; | |
464 | if (hdr("Notice-Requested-Upon-Delivery-To",msg)) tmsg->flags |= FLG_RRQ; | |
465 | if (!newsmode) | |
466 | { | |
467 | tmsg->flags |= FLG_PVT; | |
468 | tmsg->flags |= FLG_K_S; | |
469 | } | |
470 | ||
471 | if ((p=hdr("X-Origin-Date",msg))) tmsg->date=parsedate(p,NULL); | |
472 | else if ((p=hdr("Date",msg))) tmsg->date=parsedate(p,NULL); | |
473 | else tmsg->date=time((time_t *)NULL); | |
474 | ||
475 | if ((p=hdr("X-FTN-MSGID",msg))) | |
476 | { | |
477 | tmsg->ftnorigin&=1; | |
478 | while (isspace(*p)) p++; | |
479 | tmsg->msgid_s=xstrcpy(p); | |
480 | if (*(p=tmsg->msgid_s+strlen(tmsg->msgid_s)-1) == '\n') *p='\0'; | |
481 | } | |
482 | else if ((p=hdr("Message-ID",msg))) | |
483 | { | |
484 | tmsg->ftnorigin &= | |
485 | ftnmsgid(p,&(tmsg->msgid_a),&(tmsg->msgid_n),tmsg->area); | |
486 | } | |
487 | else | |
488 | { | |
489 | tmsg->msgid_a=NULL; | |
490 | } | |
491 | ||
492 | if ((p=hdr("X-FTN-REPLY",msg))) | |
493 | { | |
494 | while (isspace(*p)) p++; | |
495 | tmsg->reply_s=xstrcpy(p); | |
496 | if (*(p=tmsg->reply_s+strlen(tmsg->reply_s)-1) == '\n') *p='\0'; | |
497 | } | |
498 | else | |
499 | { | |
500 | if (newsmode) | |
501 | { | |
502 | p=hdr("References",msg); | |
503 | if (p) | |
504 | { l=xstrcpy(p); | |
505 | r=strtok(l," \t\n"); | |
506 | while ((l=strtok(NULL," \t\n")) != NULL) r=l; | |
507 | p=r; | |
508 | free(l); | |
509 | } | |
510 | } | |
511 | else p=hdr("In-Reply-To",msg); | |
512 | } | |
513 | if (p) | |
514 | { | |
515 | (void)ftnmsgid(p,&(tmsg->reply_a),&(tmsg->reply_n),NULL); | |
516 | } | |
517 | else | |
518 | { | |
519 | tmsg->reply_a=NULL; | |
520 | } | |
521 | ||
522 | debug(3,"DATE: %s, MSGID: %s %lx, REPLY: %s %lx", | |
523 | ftndate(tmsg->date), | |
524 | S(tmsg->msgid_a),tmsg->msgid_n, | |
525 | S(tmsg->reply_a),tmsg->reply_n); | |
526 | ||
527 | if ((p=hdr("Organization",msg))) | |
528 | { | |
529 | while (isspace(*p)) p++; | |
530 | tmsg->origin=xstrcpy(hdrconv(p, incode, outcode)); | |
531 | if (tmsg->origin) | |
532 | if (*(p=tmsg->origin+strlen(tmsg->origin)-1) == '\n') *p='\0'; | |
533 | } | |
534 | ||
535 | debug(3,"ORIGIN: %s",S(tmsg->origin)); | |
536 | ||
537 | return tmsg; | |
538 | } |
18 | 18 | #define BUFSIZ 512 |
19 | 19 | #endif |
20 | 20 | |
21 | #define KWDCHARS "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_" | |
21 | #define KWDCHARS "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_." | |
22 | 22 | |
23 | 23 | extern char *bgets(char *,int,FILE *); |
24 | 24 |
0 | /* ### Modified by P.Saratxaga on 6 Aug 1995 ### | |
1 | * - Added PCBOARD_GATE | |
2 | * - changed MACHIGAI code () | |
3 | */ | |
4 | #include <stdlib.h> | |
5 | #include <stdio.h> | |
6 | #include <ctype.h> | |
7 | #include <string.h> | |
8 | #include "xutil.h" | |
9 | #include "lutil.h" | |
10 | #include "rfcmsg.h" | |
11 | ||
12 | #ifndef TRUE | |
13 | #define TRUE 1 | |
14 | #define FALSE 0 | |
15 | #endif | |
16 | ||
17 | #ifndef BUFSIZ | |
18 | #define BUFSIZ 512 | |
19 | #endif | |
20 | ||
21 | #define KWDCHARS "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_" | |
22 | ||
23 | extern char *bgets(char *,int,FILE *); | |
24 | ||
25 | rfcmsg *parsrfc(fp) | |
26 | FILE *fp; | |
27 | { | |
28 | int linecont=FALSE,newcont,firstline; | |
29 | rfcmsg *start=NULL, *cur=NULL; | |
30 | char buffer[BUFSIZ]; | |
31 | char *p; | |
32 | ||
33 | while(bgets(buffer,BUFSIZ-1,fp) && strcmp(buffer,"\n")) | |
34 | { | |
35 | newcont=(buffer[strlen(buffer)-1] != '\n'); | |
36 | debug(17,"Line read: \"%s\" - %s continued", | |
37 | buffer,newcont?"to be":"not to be"); | |
38 | if (linecont) | |
39 | { | |
40 | debug(17,"this is a continuation of a long line"); | |
41 | cur->val=xstrcat(cur->val,buffer); | |
42 | } | |
43 | else | |
44 | { | |
45 | if (isspace(buffer[0])) | |
46 | { | |
47 | if (strspn(buffer," \t\n") == strlen(buffer)) | |
48 | { | |
49 | debug(17,"breaking with blank-only line"); | |
50 | break; | |
51 | } | |
52 | debug(17,"this is a continuation line"); | |
53 | if (!cur) | |
54 | { | |
55 | debug(17,"Wrong first line: \"%s\"",buffer); | |
56 | cur=(rfcmsg *) | |
57 | xmalloc(sizeof(rfcmsg)); | |
58 | start=cur; | |
59 | cur->next=NULL; | |
60 | cur->key=xstrcpy("X-Body-Start"); | |
61 | cur->val=xstrcpy(buffer); | |
62 | break; | |
63 | } | |
64 | else cur->val=xstrcat(cur->val,buffer); | |
65 | } | |
66 | else | |
67 | { | |
68 | debug(17,"this is a header line"); | |
69 | if (cur) | |
70 | { | |
71 | firstline=FALSE; | |
72 | (cur->next)=(rfcmsg *) | |
73 | xmalloc(sizeof(rfcmsg)); | |
74 | cur=cur->next; | |
75 | } | |
76 | else | |
77 | { | |
78 | firstline=TRUE; | |
79 | cur=(rfcmsg *) | |
80 | xmalloc(sizeof(rfcmsg)); | |
81 | start=cur; | |
82 | } | |
83 | cur->next=NULL; | |
84 | cur->key=NULL; | |
85 | cur->val=NULL; | |
86 | if (firstline && !strncmp(buffer,"From ",5)) | |
87 | { | |
88 | debug(17,"This is a uucpfrom line"); | |
89 | cur->key=xstrcpy("X-UUCP-From"); | |
90 | cur->val=xstrcpy(buffer+4); | |
91 | } | |
92 | #ifdef PCBOARD_GATE | |
93 | /* These ones are generatd by a usenet-->PcBoard-->FTN gate | |
94 | "@FROM :" has the address of the original "From: " (but not the freename, | |
95 | which is on the fidonet header, don't know how to get it... | |
96 | "@SUBJECT:" is the original "Subject: ", and "@PACKOUT:" seems to be | |
97 | the "Expires: ", the date format is changed to dd-mm-yy */ | |
98 | else if ( !strncmp(buffer,"@FROM :",9)) | |
99 | { | |
100 | debug(17,"@FROM___: line"); | |
101 | cur->key=xstrcpy("X-PcBoard-FROM"); | |
102 | cur->val=xstrcpy(" "); | |
103 | cur->val=xstrcat(cur->val,buffer+9); | |
104 | } | |
105 | else if ( !strncmp(buffer,"@SUBJECT:",9)) | |
106 | { | |
107 | debug(17,"@SUBJECT: line"); | |
108 | cur->key=xstrcpy("X-PcBoard-SUBJECT"); | |
109 | cur->val=xstrcpy(" "); | |
110 | cur->val=xstrcat(cur->val,buffer+9); | |
111 | } | |
112 | else if ( !strncmp(buffer,"@PACKOUT:",9)) | |
113 | { | |
114 | debug(17,"@PACKOUT: line"); | |
115 | cur->key=xstrcpy("X-PcBoard-PACKOUT"); | |
116 | cur->val=xstrcpy(" "); | |
117 | cur->val=xstrcat(cur->val,buffer+9); | |
118 | } | |
119 | #endif /* PCBOARD_GATE */ | |
120 | else if ((p=strchr(buffer,':')) && | |
121 | (p > buffer) && /* ':' isn't 1st chr */ | |
122 | isspace(*(p+1)) && /* space past ':' */ | |
123 | #ifdef MACHIGAI | |
124 | /* at least one non blank char */ | |
125 | (strspn(p+2, " \t\n") < strlen(p+2)) && | |
126 | #endif | |
127 | (strspn(buffer,KWDCHARS) == (p-buffer))) | |
128 | { | |
129 | *p='\0'; | |
130 | debug(17,"This is a regular header"); | |
131 | cur->key=xstrcpy(buffer); | |
132 | cur->val=xstrcpy(p+1); | |
133 | } | |
134 | else | |
135 | { | |
136 | debug(17,"Non-header line: \"%s\"",buffer); | |
137 | cur->key=xstrcpy("X-Body-Start"); | |
138 | cur->val=xstrcpy(buffer); | |
139 | break; | |
140 | } | |
141 | } | |
142 | } | |
143 | linecont=newcont; | |
144 | } | |
145 | return(start); | |
146 | } | |
147 | ||
148 | void tidyrfc(msg) | |
149 | rfcmsg *msg; | |
150 | { | |
151 | rfcmsg *nxt; | |
152 | ||
153 | for (;msg;msg=nxt) | |
154 | { | |
155 | nxt=msg->next; | |
156 | if (msg->key) free(msg->key); | |
157 | if (msg->val) free(msg->val); | |
158 | free(msg); | |
159 | } | |
160 | return; | |
161 | } | |
162 | ||
163 | void dumpmsg(msg,fp) | |
164 | rfcmsg *msg; | |
165 | FILE *fp; | |
166 | { | |
167 | char *p; | |
168 | ||
169 | p=hdr("X-Body-Start",msg); | |
170 | for (;msg;msg=msg->next) if (strcasecmp(msg->key,"X-Body-Start")) | |
171 | { | |
172 | if (!strcasecmp(msg->key,"X-UUCP-From")) | |
173 | fputs("From",fp); | |
174 | else | |
175 | { | |
176 | fputs(msg->key,fp); | |
177 | fputs(":",fp); | |
178 | } | |
179 | fputs(msg->val,fp); | |
180 | } | |
181 | fputs("\n",fp); | |
182 | if (p) fputs(p,fp); | |
183 | return; | |
184 | } |
85 | 85 | extern long timeoutconnect; |
86 | 86 | extern long timeoutreset; |
87 | 87 | extern long dialdelay; |
88 | extern long italianpoint; | |
88 | 89 | |
89 | 90 | extern char *oldfilemap; |
90 | 91 | extern char maptab[]; |
88 | 88 | long timeoutreset=2L; |
89 | 89 | long timeoutconnect=75L; |
90 | 90 | long dialdelay=0L; |
91 | long italianpoint=0L; | |
91 | 92 | |
92 | 93 | char *oldfilemap=NULL; |
93 | 94 | char maptab[] = { |
291 | 292 | {"defaultrfcchar", getdefcode, (char**)&defaultrfcchar}, |
292 | 293 | {"defaultftnchar", getdefcode2, (char**)&defaultftnchar}, |
293 | 294 | {"toftnchar", getdefcode2, (char**)&toftnchar}, |
295 | {"italianpoint", getlong, &italianpoint}, | |
294 | 296 | {NULL, NULL, NULL} |
295 | 297 | }; |
296 | 298 |
0 | #!/bin/sh | |
1 | # ahbpoll, poll the two lines of my boss node | |
2 | # | |
3 | # This script is based on the original ifpoll by Rasca Gmelch | |
4 | # Copyright (C) 1997 by Marco d'Itri, 2:332/206.10 / md@linux.it | |
5 | ||
6 | . /etc/ifmail/ifshellvars | |
7 | ||
8 | # Max number of failed polls | |
9 | MaxTry=8 | |
10 | # delay between outgoing calls in seconds | |
11 | DELAY=60 | |
12 | ||
13 | ############################################################################### | |
14 | # start some tail(1)s and initialize the ^C handler | |
15 | { tail -n0 -f $IFLOG > $INFO_TTY & }; TOKILL=$! | |
16 | ##{ tail -n0 -f $IFLOG | grep "received" & }; TOKILL="$TOKILL $!" | |
17 | ##{ tail -n0 -f $IFLOG | grep "sent" & }; TOKILL="$TOKILL $!" | |
18 | ||
19 | trap "killall -HUP ifcico; kill $TOKILL; echo -e 'Aborted\n'; exit 100;" INT | |
20 | ||
21 | # let's pack the fido stuff.. | |
22 | $IFBIN/ifpack | |
23 | ||
24 | ############################################################################### | |
25 | # loop until ifcico could connect the node or MaxTry is encountered | |
26 | i=1; errlv=1; alternate=0 | |
27 | while [ $i -le $MaxTry -a $errlv != 0 ]; do | |
28 | if [ $alternate = 0 ]; then | |
29 | NODE=f206.n332.z2.fidonet.org | |
30 | alternate=1 | |
31 | elif [ $alternate = 1 ]; then | |
32 | NODE=f207.n332.z2.fidonet.org | |
33 | alternate=0 | |
34 | fi | |
35 | ||
36 | echo -n "ahbpoll[$$]: $i. try ($NODE) " | |
37 | $IFBIN/ifcico -r 1 $NODE | |
38 | errlv=$? | |
39 | case "$errlv" in | |
40 | "0") | |
41 | echo "ok :)" | |
42 | ;; | |
43 | "2") | |
44 | echo 'failed: busy (rc 2)' | |
45 | if [ $i != $MaxTry -a $alternate = 0 ]; then sleep $DELAY; fi | |
46 | ;; | |
47 | "3") | |
48 | echo 'failed: system error (rc 3)' | |
49 | ;; | |
50 | "11") | |
51 | echo 'failed: lost carrier (rc 11)' | |
52 | if [ $i != $MaxTry -a $alternate = 0 ]; then sleep $[$DELAY+120]; fi | |
53 | ;; | |
54 | *) | |
55 | echo "failed: ?? (rc $errlv)" | |
56 | if [ $i != $MaxTry -a $alternate = 0 ]; then sleep $DELAY; fi | |
57 | ;; | |
58 | esac | |
59 | let i=i+1 | |
60 | done | |
61 | ||
62 | ############################################################################### | |
63 | # if the poll was ok, unpack | |
64 | if [ $errlv = "0" ]; then | |
65 | if [ "`echo $IFSPOOL/inb/0000fff6.*`" != "$IFSPOOL/inb/0000fff6.*" ]; then | |
66 | cp --force --link --preserve \ | |
67 | $IFSPOOL/inb/0000fff6.* $IFSPOOL/BAK | |
68 | fi | |
69 | $IFBIN/ifunpack | |
70 | find $IFSPOOL/BAK -mtime +3 -type f -exec rm -fv \{\} \; >/dev/null | |
71 | find $IFSPOOL/outb -empty -type f -exec rm -fv \{\} \; >/dev/null | |
72 | fi | |
73 | ||
74 | ############################################################################### | |
75 | # Kill tail(s) | |
76 | kill $TOKILL | |
77 | ||
78 | # return the errorlevel of ifcico | |
79 | exit $errlv |
0 | # Every 30 minutes gate the articles for the boss | |
1 | 6,36 * * * * /etc/news/scripts/fidosend f206.n332 | |
2 |
0 | #!/bin/sh | |
1 | ## SH script to send fido batches out trought ifmail. | |
2 | ||
3 | set -e | |
4 | ||
5 | VERBOSE=false | |
6 | . /usr/lib/news/innshellvars | |
7 | . /etc/ifmail/ifshellvars | |
8 | ||
9 | if [ ! -f $SERVERPID ]; then exit ;fi | |
10 | ||
11 | if [ $# -lt 1 ]; then | |
12 | echo "$0 [$$]: Usage: $0 site" | |
13 | exit 1 | |
14 | else | |
15 | SITE=$1 | |
16 | fi | |
17 | ||
18 | if [ -s $BATCH/$SITE ]; then | |
19 | mv $BATCH/$SITE $BATCH/$SITE.work | |
20 | $NEWSBIN/ctlinnd -s -t30 flush $SITE | |
21 | $NEWSBIN/batcher -v -p\ | |
22 | "$IFBIN/ifnews $2 $3 $4 $5 %s"\ | |
23 | $SITE $BATCH/$SITE.work \ | |
24 | && rm -f $BATCH/$SITE.work | |
25 | else | |
26 | $VERBOSE && echo "$0 [$$]: no articles for $SITE" | |
27 | fi | |
28 |
0 | PUSHDIVERT(-1) | |
1 | ifdef(`IFMAIL_MAILER_PATH',, `define(`IFMAIL_MAILER_PATH', /usr/lib/ifmail/ifmail)') | |
2 | ifdef(`IFMAIL_MAILER_FLAGS',, `define(`IFMAIL_MAILER_FLAGS', `')') | |
3 | ifdef(`IFMAIL_MAILER_ARGS',, `define(`IFMAIL_MAILER_ARGS', `ifmail -r $h $u')') | |
4 | ||
5 | POPDIVERT | |
6 | ####################################### | |
7 | ### IFMAIL Mailer specification ### | |
8 | ####################################### | |
9 | ||
10 | VERSIONID(`@(#)ifmail.m4 2.0 (Md) 97/08/23') | |
11 | ||
12 | Mifmail, P=IFMAIL_MAILER_PATH, F=CONCAT(8mDFMuCS, IFMAIL_MAILER_FLAGS), S=11, R=21,ifdef(`IFMAIL_MAILER_MAX', ` M=IFMAIL_MAILER_MAX,') | |
13 | _OPTINS(`IFMAIL_MAILER_CHARSET', `C=', `, ')T=X-FTN/RFC822/X-Unix, U=ftn:ftn, | |
14 | A=IFMAIL_MAILER_ARGS | |
15 | Mifmail-c, P=IFMAIL_MAILER_PATH, F=CONCAT(8mDFMuCS, IFMAIL_MAILER_FLAGS), S=11, R=21,ifdef(`IFMAIL_MAILER_MAX', ` M=IFMAIL_MAILER_MAX,') | |
16 | _OPTINS(`IFMAIL_MAILER_CHARSET', `C=', `, ')T=X-FTN/RFC822/X-Unix, U=ftn:ftn, | |
17 | A=IFMAIL_MAILER_ARGS -gc | |
18 | Mifmail-h, P=IFMAIL_MAILER_PATH, F=CONCAT(8mDFMuCS, IFMAIL_MAILER_FLAGS), S=11, R=21,ifdef(`IFMAIL_MAILER_MAX', ` M=IFMAIL_MAILER_MAX,') | |
19 | _OPTINS(`IFMAIL_MAILER_CHARSET', `C=', `, ')T=X-FTN/RFC822/X-Unix, U=ftn:ftn, | |
20 | A=IFMAIL_MAILER_ARGS -gh | |
21 | dnl**************************************************************************** | |
22 | LOCAL_CONFIG`'dnl | |
23 | ifdef(`FTN_POINTS', | |
24 | `# All our points. They must be the same user for every aka. | |
25 | CD FTN_POINTS | |
26 | ')dnl | |
27 | divert`'dnl | |
28 | dnl* | |
29 | dnl**************************************************************************** | |
30 | LOCAL_NET_CONFIG`'dnl | |
31 | dnl+ Does not works on nodes which run uucp. | |
32 | ifdef(`FTN_POINTS', | |
33 | `# Route mail for our fidotech points | |
34 | R$* < @ $=D . $=w . > $* $#ifmail $@ $2.$3 $: $1 < @ $2 . $3 > $4 | |
35 | ')dnl | |
36 | dnl* | |
37 | ifdef(`IFMAIL_BOUNCE_UUCP', | |
38 | `# Bounce mail sent to the gateway without a To: pseudo header as first line | |
39 | RUUCP $#error $@ 5.1.1 $: "you must provide a To: address" | |
40 | ')dnl | |
41 | dnl* | |
42 | # send as normal email and not as netmail | |
43 | R$* < @ $+ .ip.fidonet.org. > $* $: $1 < @ $2 .fidonet.org. > $3 | |
44 | divert`'dnl | |
45 | dnl* | |
46 | dnl**************************************************************************** | |
47 | LOCAL_RULE_0`'dnl | |
48 | # trying to guess real internet domains | |
49 | C{NotFtn} fidonet ftp www smtp mail ns ns2 whois | |
50 | R$* < @ $={NotFtn}.$+.fidonet.org. > $* $: $1 < @ $2 . $3 .ip.fidonet.org. > $4 | |
51 | divert | |
52 | dnl* | |
53 | dnl**************************************************************************** | |
54 | LOCAL_RULE_3`' | |
55 | # canonize fidotech domains. | |
56 | R$* < @ $+ .z1.fidonet.org > $* $: $1 < @ $2 .z1.fidonet.org. > $3 | |
57 | R$* < @ $+ .z2.fidonet.org > $* $: $1 < @ $2 .z2.fidonet.org. > $3 | |
58 | R$* < @ $+ .z3.fidonet.org > $* $: $1 < @ $2 .z3.fidonet.org. > $3 | |
59 | R$* < @ $+ .z4.fidonet.org > $* $: $1 < @ $2 .z4.fidonet.org. > $3 | |
60 | R$* < @ $+ .z5.fidonet.org > $* $: $1 < @ $2 .z5.fidonet.org. > $3 | |
61 | R$* < @ $+ .z6.fidonet.org > $* $: $1 < @ $2 .z6.fidonet.org. > $3 | |
62 | #R$* < @ $+ .crash.fidonet.org > $* $: $1 < @ $2 .crash.fidonet.org. > $3 | |
63 | R$* < @ $+ .ftn > $* $: $1 < @ $2 .ftn. > $3 | |
64 | divert`'dnl | |
65 | dnl**************************************************************************** |
0 | #!/bin/sh | |
1 | # ifpoll, poll my boss node or the node given as argument 1 | |
2 | # | |
3 | # This script is based on the original ifpoll by Rasca Gmelch | |
4 | # Copyright (C) 1997 by Marco d'Itri, 2:332/206.10 / md@linux.it | |
5 | ||
6 | . /etc/ifmail/ifshellvars | |
7 | ||
8 | # my boss node (default address to poll) | |
9 | NODE="f206.n332.z2.fidonet.org" | |
10 | # Max number of failed polls | |
11 | MaxTry=8 | |
12 | # delay between outgoing calls in seconds | |
13 | DELAY=60 | |
14 | ||
15 | # argv[1] is the optional node to call | |
16 | if [ "$1" != "" ]; then | |
17 | if [ "$1" = "-?" -o "$1" = "-h" ]; then | |
18 | echo "usage: ifpoll [<node>]" | |
19 | exit 3 | |
20 | else | |
21 | NODE=$1 | |
22 | fi | |
23 | fi | |
24 | ||
25 | ############################################################################### | |
26 | # start some tail(1)s and initialize the ^C handler | |
27 | { tail -n0 -f $IFLOG > $INFO_TTY & }; TOKILL=$! | |
28 | ##{ tail -n0 -f $IFLOG | grep "received" & }; TOKILL="$TOKILL $!" | |
29 | ##{ tail -n0 -f $IFLOG | grep "sent" & }; TOKILL="$TOKILL $!" | |
30 | ||
31 | trap "killall -HUP ifcico; kill $TOKILL; echo -e 'Aborted\n'; exit 100;" INT | |
32 | ||
33 | # let's pack the fido stuff.. | |
34 | $IFBIN/ifpack | |
35 | ||
36 | ############################################################################### | |
37 | # loop until ifcico could connect the node or MaxTry is encountered | |
38 | i=1; errlv=1 | |
39 | while [ $i -le $MaxTry -a $errlv != 0 ]; do | |
40 | echo -n "ifpoll[$$]: $i. try ($NODE) " | |
41 | $IFBIN/ifcico -r 1 $NODE | |
42 | errlv=$? | |
43 | case "$errlv" in | |
44 | "0") | |
45 | echo "ok :)" | |
46 | ;; | |
47 | "2") | |
48 | echo 'failed: busy (rc 2)' | |
49 | if [ $i != $MaxTry ]; then sleep $DELAY; fi | |
50 | ;; | |
51 | "3") | |
52 | echo 'failed: system error (rc 3)' | |
53 | ;; | |
54 | "11") | |
55 | echo 'failed: lost carrier (rc 11)' | |
56 | if [ $i != $MaxTry ]; then sleep $[$DELAY+120]; fi | |
57 | ;; | |
58 | *) | |
59 | echo "failed: ?? (rc $errlv)" | |
60 | if [ $i != $MaxTry ]; then sleep $DELAY; fi | |
61 | ;; | |
62 | esac | |
63 | let i=i+1 | |
64 | done | |
65 | ||
66 | ############################################################################### | |
67 | # if the poll was ok, unpack | |
68 | if [ $errlv = "0" ]; then | |
69 | if [ "`echo $IFSPOOL/inb/0000fff6.*`" != "$IFSPOOL/inb/0000fff6.*" ]; then | |
70 | cp --force --link --preserve \ | |
71 | $IFSPOOL/inb/0000fff6.* $IFSPOOL/BAK | |
72 | fi | |
73 | $IFBIN/ifunpack | |
74 | find $IFSPOOL/BAK -mtime +3 -type f -exec rm -fv \{\} \; >/dev/null | |
75 | find $IFSPOOL/outb -empty -type f -exec rm -fv \{\} \; >/dev/null | |
76 | fi | |
77 | ||
78 | ############################################################################### | |
79 | # Kill tail(s) | |
80 | kill $TOKILL | |
81 | ||
82 | # return the errorlevel of ifcico | |
83 | exit $errlv |
0 | # user ifmail runs as | |
1 | IFUSER=ftn | |
2 | ||
3 | # where binaries like "ifcico" and "ifpack" reside | |
4 | IFBIN=/usr/lib/ifmail | |
5 | ||
6 | # spool directory for ftn packets where inbound and outbounds reside | |
7 | IFSPOOL=/var/spool/ftn | |
8 | ||
9 | # logfiles directory | |
10 | IFLOGDIR=/var/log/ifmail | |
11 | ||
12 | # logfile of ifcico | |
13 | IFLOG=$IFLOGDIR/iflog | |
14 | ||
15 | # default console for showing the log (used by ifpoll) | |
16 | INFO_TTY="/dev/tty24" | |
17 | ||
18 | # nodelists directory name | |
19 | IFNLDIRNAME=nl.d | |
20 | ||
21 | # nodelists directory | |
22 | IFNLD=$IFSPOOL/$IFNLDIRNAME | |
23 |
0 | # You really need to write there all the six zones. | |
1 | .z1.fidonet.org ifmail:f206.n332 | |
2 | .z2.fidonet.org ifmail:f206.n332 | |
3 | .z3.fidonet.org ifmail:f206.n332 | |
4 | .z4.fidonet.org ifmail:f206.n332 | |
5 | .z5.fidonet.org ifmail:f206.n332 | |
6 | .z6.fidonet.org ifmail:f206.n332 | |
7 | # This is an othernet | |
8 | .guidenet.ftn ifmail:f101.n391.z42 | |
9 | # This is your smarthost | |
10 | . smtp:mail.provider.it |
0 | #!/bin/sh | |
1 | # | |
2 | # This script compiles the Italian fidonet nodelist received via TIC | |
3 | # Copyright (C) 1996 by Marco d'Itri, 2:332/206.10 / md@linux.it | |
4 | ||
5 | . /etc/ifmail/ifshellvars | |
6 | ||
7 | if [ -r $IFSPOOL/inb/region33.zip ]; then | |
8 | unzip -L -o -p $IFSPOOL/inb/region33.zip \ | |
9 | | sed "s/^;Zone,2,/Zone,2,/1" > $IFNLD/region.033.NEW | |
10 | { echo -e 'To: postmaster\n' | |
11 | diff --unified=0 $IFNLD/region.033 $IFNLD/region.033.NEW } \ | |
12 | | sendmail -t | |
13 | mv $IFNLD/region.033.NEW $IFNLD/region.033 | |
14 | fi | |
15 | tail -f -n0 $IFLOG & | |
16 | TOKILL=$! | |
17 | $IFBIN/ifindex | |
18 | sleep 1 | |
19 | kill $TOKILL | |
20 | mv $IFSPOOL/inb/region33.zip $IFSPOOL/inb/region33.zi0 | |
21 |
0 | divert(-1) | |
1 | # | |
2 | # This is the m4 setup file for wonderland.linux.it | |
3 | # Copyright (C) 1996 by Marco d'Itri <md@linux.it> | |
4 | # | |
5 | divert(0) | |
6 | VERSIONID(`setup for wonderland (ifmail) 96/10/25') | |
7 | OSTYPE(debian)dnl | |
8 | dnl# | |
9 | dnl# fidonet things | |
10 | define(`IFMAIL_MAILER_MAX', 100000)dnl | |
11 | dnl# | |
12 | define(`confTRUSTED_USERS', ftn)dnl | |
13 | MAILER(local)dnl | |
14 | MAILER(smtp)dnl | |
15 | MAILER(ifmail)dnl | |
16 | dnl# | |
17 | dnl########################################################################### | |
18 | LOCAL_CONFIG | |
19 | Cwwonderland.linux.it wonderland.ils.org p10.f206.n332.z2.fidonet.org p10.f207.n332.z2.fidonet.org f102.n391.z42.guidenet.ftn | |
20 | divert`'dnl |
26 | 26 | |
27 | 27 | COMERZ fido.commerz world iso-8859-1 CP437 fro:Jan.Smith@f1.n2.z3.fidonet.org |
28 | 28 | |
29 | You have so write here the tag conversions, probably one by one. | |
29 | 30 | |
30 | ### [ There is the list I use for belgian newsgroups ] | |
31 | ### [ I don't use Distribution field, I see no need to add one... ] | |
32 | ### [ only for a few fido-only distributed areas ] | |
33 | ||
34 | ########### be.* | |
35 | BE.ANNOUNCE be.announce | |
36 | BE.COMMERCIAL be.commercial | |
37 | BE.COMP be.comp | |
38 | BE.FORSALE be.forsale | |
39 | BE.JOBS be.jobs | |
40 | BE.MISC be.misc | |
41 | BE.POLITICS be.politics | |
42 | BE.SCIENCE be.science | |
43 | BE.TV be.tv | |
44 | ||
45 | ########### fido.belg.* | |
46 | 3DSTUDIO.B fido.belg.3dstudio | |
47 | AIDS.B fido.belg.aids | |
48 | ALLFIX.B fido.belg.allfix.general | |
49 | ALLFIX_SUP.B fido.belg.allfix.support | |
50 | AMIGA.B fido.belg.amiga | |
51 | ASTRONOM.B fido.belg.astronomy | |
52 | AUTO.B fido.belg.auto | |
53 | AVONTUUR.B fido.belg.avontuur | |
54 | BABEL.B fido.belg.babel | |
55 | BACKBONE.B fido.belg.backbone | |
56 | FAKEUSER.B fido.belg.bbs.fake-users | |
57 | BBSADV.B fido.belg.bbsadv | |
58 | BEER.B fido.belg.beer | |
59 | BEURS.B fido.belg.beurs | |
60 | BEURS-DATA.B fido.belg.beurs-data | |
61 | BIJBEL.B fido.belg.bijbel | |
62 | BOEKEN.B fido.belg.boeken | |
63 | CDROM.B fido.belg.cdrom | |
64 | CLIPPER.B fido.belg.clipper | |
65 | CLUBS.B fido.belg.clubs | |
66 | COMICS.B fido.belg.comics | |
67 | DBHULP.B fido.belg.dbridge.support | |
68 | DVNET.B fido.belg.dvnet | |
69 | ELEKTRON.B fido.belg.electron | |
70 | FILES.B fido.belg.files | |
71 | ||
72 | ########### fido.belg.fra.* | |
73 | ASM-TUTORIAL.BF fido.belg.fra.asm-tutorial | |
74 | AUTOMOBILE.BF fido.belg.fra.automobile | |
75 | C_ECHO.BF fido.belg.fra.c | |
76 | CLIPPER.BF fido.belg.fra.clipper | |
77 | COMMERCE.BF fido.belg.fra.commerce | |
78 | COMMS.BF fido.belg.fra.communications | |
79 | COMPNEWS.B fido.belg.fra.compuserve.news | |
80 | ED-MSG.BF fido.belg.fra.editeurs_msg | |
81 | FIDONET.BF fido.belg.fra.fidonet | |
82 | FILE-SEARCH.B fido.belg.fra.files.search | |
83 | FILE-SEARCH.B fido.belg.fra.files.search | |
84 | FILM.BF fido.belg.fra.film | |
85 | GENEALOGY.BF fido.belg.fra.genealogy | |
86 | GENERAL.B fido.belg.fra.general | |
87 | HARD.BF fido.belg.fra.hardware | |
88 | INTERNET.BF fido.belg.fra.internet | |
89 | ISDN.BF fido.belg.fra.isdn | |
90 | LINUX.BF fido.belg.fra.linux | |
91 | MAXIMUS.BF fido.belg.fra.maximus | |
92 | OCCASES.BF fido.belg.fra.occases | |
93 | OS2.BF fido.belg.fra.os2 | |
94 | RELIGION.BF fido.belg.fra.religion | |
95 | RTFM fido.belg.fra.rtfm | |
96 | SCIENCES.BF fido.belg.fra.sciences | |
97 | SOFT.BF fido.belg.fra.soft | |
98 | SONS.BF fido.belg.fra.sons | |
99 | SYSTEMES.BF fido.belg.fra.systemen | |
100 | WIN.BF fido.belg.fra.windows | |
101 | ||
102 | ########### fido.belg.* (2) | |
103 | FDHELP.B fido.belg.frontdoor.support | |
104 | FRUSTRATIE.B fido.belg.frustratie | |
105 | FSFAN.B fido.belg.fsfan | |
106 | FUNPROG.B fido.belg.funprog | |
107 | GAMING.B fido.belg.gaming | |
108 | GOLDED.B fido.belg.golded | |
109 | HAM.B fido.belg.ham | |
110 | HOUSE.B fido.belg.house | |
111 | HP48.B fido.belg.hp48 | |
112 | INTERNET.B fido.belg.internet | |
113 | JOB.B fido.belg.jobs | |
114 | KEUKEN.B fido.belg.keuken | |
115 | KINDEREN.B fido.belg.kinderen | |
116 | K.U.LEUVEN fido.belg.kuleuven | |
117 | LAN.BF fido.belg.lan | |
118 | LASERDISC.B fido.belg.laserdiscs | |
119 | LINUX.B fido.belg.linux | |
120 | SIMENON.B fido.belg.literature.simenon | |
121 | LOSTKIDS.B fido.belg.lostkids | |
122 | LOTTO.B fido.belg.lotto | |
123 | LUKRAAK.B fido.belg.lukraak | |
124 | MACBEL.B fido.belg.macbel | |
125 | MATH.B fido.belg.math | |
126 | MAX.B fido.belg.maximus | |
127 | MEDIA.B fido.belg.media | |
128 | MODEL_MAKING.B fido.belg.model_making | |
129 | MODEM.B fido.belg.modem | |
130 | MODERATORS.B fido.belg.moderators | |
131 | MUZIEK.B fido.belg.music | |
132 | NATSYSOP.B fido.belg.natsysop fido | |
133 | ||
134 | ########### fido.belg.ned.* | |
135 | ALGEMEEN.B fido.belg.ned.algemeen | |
136 | ALLES.BN fido.belg.ned.alles | |
137 | DIER.B fido.belg.ned.animals | |
138 | DAMES.B fido.belg.ned.computer.widows | |
139 | COMPUTER&RECHT fido.belg.ned.computer_recht | |
140 | DWARZ.B fido.belg.ned.dragon.warz | |
141 | FILM.B fido.belg.ned.films | |
142 | GRAP.B fido.belg.ned.grappen | |
143 | HANDEL.B fido.belg.ned.handel | |
144 | FOTO.B fido.belg.ned.photography | |
145 | PROBOARD.B fido.belg.ned.proboard | |
146 | SYSTEMEN.BN fido.belg.ned.systemen | |
147 | WINDOWS.BN fido.belg.ned.windows | |
148 | ||
149 | ########### fido.belg.* (3) | |
150 | OS2.B fido.belg.os2 | |
151 | OS2COM.B fido.belg.os2com | |
152 | OUWEZAK.B fido.belg.ouwezak | |
153 | P-DOMAIN.B fido.belg.p-domain | |
154 | PARAVISIE.B fido.belg.paravisie | |
155 | PGP.B fido.belg.pgp | |
156 | POINTS.B fido.belg.points | |
157 | POLITIC.B fido.belg.politics | |
158 | PROBOARD.029 fido.belg.proboard | |
159 | PROJECT.B fido.belg.project | |
160 | QB.B fido.belg.quickbasic | |
161 | RA_SUP.B fido.belg.ra.support | |
162 | RAM.B fido.belg.ram | |
163 | RAY_FRA_ANI.B fido.belg.ray_fra_ani | |
164 | RECHT.B fido.belg.recht | |
165 | RPG.B fido.belg.rpg | |
166 | SATELLITE.B fido.belg.satellite | |
167 | SEX.B fido.belg.sex | |
168 | SJACHEL.B fido.belg.sjachel | |
169 | SOUND_CORNER.B fido.belg.sound_corner | |
170 | STUDENTEN.B fido.belg.studenten | |
171 | TABOE fido.belg.taboe | |
172 | RAIL.B fido.belg.trains | |
173 | UFO.B fido.belg.ufo | |
174 | UITGAAN.B fido.belg.uitgaan | |
175 | UNIX.B fido.belg.unix | |
176 | VIRTUAL.B fido.belg.virtual_reality | |
177 | VIRUS.B fido.belg.virus | |
178 | VUB fido.belg.vub | |
179 | BNET.B fido.belg.vzw.bnet | |
180 | IMPACT fido.belg.vzw.impact | |
181 | WAPEN.B fido.belg.wapen | |
182 | WELZIJN.B fido.belg.welzijn | |
183 | WETENSCHAP.B fido.belg.wetenschap | |
184 | ZYXEL.B fido.belg.zyxel | |
31 | An international area | |
32 | NET_DEV fido.int.net_dev | |
33 | An italian area | |
34 | RC&REC_NEWS.033 fido.ita.033.rc&rec_news | |
35 | Etc... | |
185 | 36 | |
186 | 37 | Line with a single '*' in the "newsgroup" field defines default areatag. |
187 | 38 | '*' in the "AREA" field, if present, is expanded to the original |
197 | 48 | and distribution. '*' in the "newsgroup" field, if present, is expanded |
198 | 49 | to the original areatag (converted to lowcase). |
199 | 50 | |
200 | * fido.* fido | |
51 | * fido.* #fido | |
201 | 52 | |
202 | 53 | You can specify a line with a single asterisk in the "AREA" field and |
203 | 54 | a single asterisk in the "newsgroup" field. It will cause a reversible |
12 | 12 | verbose 0 |
13 | 13 | |
14 | 14 | # Main address: |
15 | address 2:5020/230@fidonet | |
15 | address 2:999/999 | |
16 | #address 2:5020/230@fidonet | |
16 | 17 | |
17 | 18 | # AKAs: |
18 | address 2:5020/6.14@fidonet | |
19 | address 2:5020/23.14@fidonet | |
20 | address 2:5020/49.14@fidonet | |
21 | address 100:5020/23.14@dummynet | |
19 | #address 2:5020/6.14@fidonet | |
20 | #address 2:5020/23.14@fidonet | |
21 | #address 2:5020/49.14@fidonet | |
22 | #address 100:5020/23.14@dummynet | |
22 | 23 | |
23 | 24 | # Passwords for connections. checked by ifcico. |
24 | 25 | # Inserted into EMSI and yoohoo packets. |
47 | 48 | # "jsmith: John.Smith@p89.f567.n234.z1.fidonet.org" |
48 | 49 | # and fqdn value is "pccross.msk.su", then the resulting message will |
49 | 50 | # contain a line: "Reply-To: jsmith@pccross.msk.su". |
50 | sysalias /usr/lib/smail/aliases | |
51 | sysalias /etc/ifmail/aliases | |
51 | 52 | |
52 | 53 | # This host fully qualified domain name to add to the alias above |
53 | 54 | myfqdn pccross.msk.su |
61 | 62 | magicname UUCP |
62 | 63 | |
63 | 64 | # Directory for incoming packets/files: |
64 | inbound /var/spool/ifmail/inb | |
65 | inbound /var/spool/ftn/inb | |
65 | 66 | # Directories for "listed" and "protected" sessions |
66 | listinbound /var/spool/ifmail/inb | |
67 | protinbound /var/spool/ifmail/inb | |
67 | listinbound /var/spool/ftn/inb | |
68 | protinbound /var/spool/ftn/inb | |
68 | 69 | |
69 | 70 | # Directory for outgoing packets (default domain and zone): |
70 | 71 | # other zones will be like "/usr/spool/ifmail/outb.003", |
71 | 72 | # other domains will be like "/usr/spool/ifmail/<domain>.<zone>" |
72 | # I prefer to name the default outbound as "fidonet", so it is consistent | |
73 | # with the naming pattern of the other domains. | |
74 | outbound /var/spool/ifmail/fidonet | |
73 | outbound /var/spool/ftn/outb | |
75 | 74 | |
76 | 75 | # If you specify this, outgoing arcmail files will go to `outbound', |
77 | 76 | # but be reffered as being in `dosoutbound' in the .flo files |
87 | 86 | # to many shortnames without problems. If one shortname points to many |
88 | 87 | # fullnames, all matches are sent. The files are sent under their |
89 | 88 | # shortnames. |
90 | reqmap /usr/local/lib/fnet/reqmap | |
89 | #reqmap /etc/ifmail/reqmap | |
91 | 90 | |
92 | 91 | # Directory with executables to satisfy "magic" file requests |
93 | 92 | # if requested a file present in this directory, it will be |
95 | 94 | # is not executable, it is read line by line and the lines are |
96 | 95 | # processed as if they were received file requests (recusively). |
97 | 96 | # Execution of commands may compromize security! You are warned. |
98 | magic /usr/lib/ifmail/magic | |
97 | #magic /usr/local/lib/ifmail/magic | |
99 | 98 | |
100 | 99 | # Primary nodelist (serves "outbound" directory and domain from the |
101 | 100 | # first "address" statement). Name expanded with ".NNN" if neccessary. |
102 | nodelist /var/spool/ifmail/nl.d/nodelist | |
101 | nodelist /var/spool/ftn/nl.d/nodelist | |
103 | 102 | |
104 | 103 | # Secondary nodelists and nodelists for other domains. |
105 | 104 | # use directory name from the first "nodelist" statement. |
106 | 105 | # filename originating address |
107 | 106 | #nodelist pnt5020.ndl 2:5020/0@fidonet |
108 | 107 | #nodelist chatlist 100:0/0@chateaunet |
109 | nodelist private.ndl 2:5020/0@fidonet | |
108 | #nodelist private.ndl 2:5020/0@fidonet | |
110 | 109 | |
111 | 110 | # domain translations, just context substitution. Leading dot recommended. |
112 | 111 | # May contain '@'-sign too. First matching used. |
115 | 114 | # explicitly as a last line. |
116 | 115 | # FTN side Internet side |
117 | 116 | # fidonet (zones 1 -> 6 ) |
118 | domtrans .n5020.z2.fidonet .fido.pccross.msk.su | |
119 | domtrans .n5030.z2.fidonet .fido.tctube.spb.su | |
117 | #domtrans .n5020.z2.fidonet .fido.pccross.msk.su | |
118 | #domtrans .n5030.z2.fidonet .fido.tctube.spb.su | |
120 | 119 | domtrans .z1.fidonet .z1.fidonet.org |
121 | 120 | domtrans .z2.fidonet .z2.fidonet.org |
122 | 121 | domtrans .z3.fidonet .z3.fidonet.org |
124 | 123 | domtrans .z5.fidonet .z5.fidonet.org |
125 | 124 | domtrans .z6.fidonet .z6.fidonet.org |
126 | 125 | # domain names |
127 | domtrans .beginnet .beginnet.ftn | |
128 | domtrans .n320.z101.francom .belgique.fm.alphanet.ch | |
129 | domtrans .n352.z101.francom .luxembourg.fm.alphanet.ch | |
126 | #domtrans .beginnet .beginnet.ftn | |
127 | #domtrans .n320.z101.francom .belgique.fm.alphanet.ch | |
128 | #domtrans .n352.z101.francom .luxembourg.fm.alphanet.ch | |
130 | 129 | # zone numbers (fidonet is added by default) |
131 | domtrans .n320.z101.fidonet .belgique.fm.alphanet.ch | |
132 | domtrans .n352.z101.fidonet .luxembourg.fm.alphanet.ch | |
133 | domtrans .z140.fidonet .z140.beginnet.ftn | |
130 | #domtrans .n320.z101.fidonet .belgique.fm.alphanet.ch | |
131 | #domtrans .n352.z101.fidonet .luxembourg.fm.alphanet.ch | |
132 | #domtrans .z140.fidonet .z140.beginnet.ftn | |
134 | 133 | # default (the rest) |
135 | 134 | domtrans .fidonet .ftn |
136 | 135 | |
146 | 145 | |
147 | 146 | # Bad groups prefixes - do not pass to fido if appear in Newsgroups header |
148 | 147 | # This is NOT the same as "!news.group" in the cnews "sys" file. |
149 | badgroup relcom.ads. | |
150 | badgroup relcom.commerce. | |
148 | #badgroup relcom.ads. | |
149 | #badgroup relcom.commerce. | |
151 | 150 | |
152 | 151 | # Groups for which the Gatebau-style of MSGID<-->Message-ID conversion |
153 | 152 | # must be done. Same syntax as badgroup lines. *** USE WHITH CARE *** |
154 | gatebaugroup fido.ger. | |
153 | gatebaugroup fido. | |
155 | 154 | #gatebaugroup de. |
156 | 155 | |
157 | 156 | # Maximum allowed number of groups in the Newsgroups header, article will |
179 | 178 | # Crosshatch ('#') denotes start of comment; space, tab and crosshatch |
180 | 179 | # characters cannot be specified using the first (character) notation. |
181 | 180 | # |
182 | maptabdir /etc/ifmail/maptabs | |
181 | maptabdir /usr/lib/ifmail/maptabs | |
183 | 182 | |
184 | 183 | # Default charsets to be used when ifmail can't found info in the message |
185 | 184 | # see the file README.charsets for a list of available values and for |
200 | 199 | # Transport programs for mail and news, used by iftoss |
201 | 200 | # for sendmail, $F expands to "from" address, $T - to "to" address. |
202 | 201 | sendmail /usr/sbin/sendmail -oi -f $F $T |
203 | rnews /usr/lib/news/rnews | |
202 | rnews /usr/bin/rnews | |
204 | 203 | |
205 | 204 | # Toss program, used by ifunpack |
206 | 205 | iftoss /usr/lib/ifmail/iftoss |
224 | 223 | # Maximum packet size, ifmail/ifnews will start new packet if exeeds. |
225 | 224 | # *.?ut files are NOT created if nonzero specified, you must run ifpack |
226 | 225 | # to make packets go out. |
227 | maxpsize 30000 | |
226 | maxpsize 300000 | |
228 | 227 | |
229 | 228 | # Maximum message size when splitting big messages of usenet origin |
230 | # default is 12300 bytes | |
231 | maxmsize 12300 | |
229 | maxmsize 123000 | |
232 | 230 | |
233 | 231 | # Flavors that should not be subject to packet size limiting. These |
234 | 232 | # flavors will be put into `ready to send' packets and not packed |
235 | 233 | # by ifpack. Special flavor 'm' means "all netmail". |
236 | nonpacked cm | |
234 | #nonpacked cm | |
237 | 235 | |
238 | 236 | # cnews log file and (temporary) database for seen-bys |
239 | newslog /usr/lib/news/log | |
240 | msgidbm /tmp/ifmsgids | |
241 | ||
242 | # MSGID <-> Message-ID database, for creating correct References when gating | |
243 | # if commented out this feature isn't activated | |
244 | refdbm /tmp/ref_db | |
237 | #newslog /usr/lib/news/log | |
238 | # I hope it will works with INN - Md | |
239 | newslog /var/lib/news/history | |
240 | msgidbm /var/spool/ifmail/ifmsgids | |
245 | 241 | |
246 | 242 | # From this line on, values may be prefixed by a logical expression in |
247 | 243 | # round brackets. Operators are: '!', '&', '|', 'Xor'. |
282 | 278 | # actual speed is taken from the nodelist. If speed is omitted (or set |
283 | 279 | # to zero), previous port speed is not changed. |
284 | 280 | #ModemPort (time Any0000-0900,Sat,Sun) cua0 |
285 | ModemPort ttyS1:L38400 | |
281 | ModemPort modem:L38400 | |
286 | 282 | |
287 | 283 | # PhoneTrans lines provide rules to change phone prefixes to make local |
288 | 284 | # or long-distance calls. In the example below, my country code is 7, |
298 | 294 | PhoneTrans 32- / 0 |
299 | 295 | PhoneTrans / 00 |
300 | 296 | ModemReset ATZ\r |
301 | ModemDial (time Any0800-2200 & address 2:5020/49) AT&M5&N4DP\T\r | |
302 | ModemDial (address 2:5020/49) AT&M5&N6DP\T\r | |
303 | ModemDial (speed < 4800) AT&N3DP\T\r | |
297 | #ModemDial (time Any0800-2200 & address 2:5020/49) AT&M5&N4DP\T\r | |
298 | #ModemDial (address 2:5020/49) AT&M5&N6DP\T\r | |
299 | #ModemDial (speed < 4800) AT&N3DP\T\r | |
304 | 300 | ModemDial ATDP\T\r |
305 | 301 | ModemHangup ATZ\r |
306 | 302 | ModemOK OK |
341 | 337 | |
342 | 338 | # EMSI data for this node |
343 | 339 | # From this line on values CANNOT be prefixed with logical expression |
344 | Name == Oriental BBS == | |
345 | Location Liège Belgium | |
346 | SysOp Pablo Saratxaga | |
347 | Phone 32-4-3445020 | |
340 | Name == A Debian GNU/Linux BBS == | |
341 | Location Unknown | |
342 | SysOp User Name | |
343 | Phone xx-xx-xxxxxxxx | |
348 | 344 | Speed 14400 |
349 | 345 | Flags XA,V32B,V42B |
0 | Return-Path: phreak!demos!kremvax.demos.su!educom2.fct.unl.pt!px | |
1 | Received: from phreak by pccross.msk.su with uucp | |
2 | (Smail3.1.29.1 #2) id m0s1Itd-0006NgC; Tue, 18 Apr 95 23:25 MSD | |
3 | Received: by phreak.demos.su; Tue, 18 Apr 1995 18:30:32 +0400 | |
4 | Received: by kremvax.demos.su; Tue, 18 Apr 1995 18:28:14 +0400 | |
5 | Received: from root@isolde.fct.unl.pt [192.68.178.191] by kremvax.demos.su with SMTP id SAA14524; | |
6 | (8.6.9/D) Tue, 18 Apr 1995 18:26:52 +0400 | |
7 | Received: from laminaria.fct.unl.pt by isolde.fct.unl.pt with SMTP id AA20480 | |
8 | (5.65c/IDA-1.4.4 for <crosser@pccross.msk.su>); Tue, 18 Apr 1995 15:47:16 +0200 | |
9 | Received: from educom2.fct.unl.pt by laminaria.fct.unl.pt (AIX 3.2/UCB 5.64/4.03) | |
10 | id AA14367; Tue, 18 Apr 1995 15:18:18 +0200 | |
11 | Received: by educom2.fct.unl.pt (5.51/6.2); Tue, 18 Apr 95 14:23:27 GMT | |
12 | From: "Joaquim Baptista - DI [pxquim]" <px@educom2.fct.unl.pt> | |
13 | Message-Id: <9504181523.AA10741@educom2.fct.unl.pt> | |
14 | To: Eugene Crosser <crosser@pccross.msk.su>, ifmail@jadpc.jd.com | |
15 | Cc: px@fct.unl.pt | |
16 | Subject: fido.daily v1.1, resume your ifcico, iftoss, ifmail, and ifnews logs | |
17 | Date: Mon, 06 Feb 95 12:21:07 +0100 | |
18 | ||
19 | ||
20 | Greetings, | |
21 | ||
22 | Some of you may remember my previous post of "fido.daily", a perl script | |
23 | to resume ifmail logs. | |
24 | ||
25 | I received a request to restrict the nodes being processed; I added a | |
26 | "-s pattern" option which should allow you to select just one node or | |
27 | one network. Use "-s 2:362/" to select the net 2:362, for instance. | |
28 | ||
29 | I also received a bug report. Sometimes a node is reported as 2:362/42, | |
30 | other times as 2:362/42@fidonet, and this confused the script. I now | |
31 | strip the "@net" part to solve the problem. It would be nicer to add | |
32 | it, but that is not always possible. | |
33 | ||
34 | To better support the automatic generation of reports, I now include the | |
35 | period being reported on the log. This shows what is being reported in | |
36 | the event of failures, such as a failure to rotate the logs due to a machine | |
37 | being down, and causing the recounting of partial logs. | |
38 | ||
39 | It will warn you if a message is not tossed because its area is not | |
40 | configured. It probably should detect other exceptional situations. | |
41 | Suggestions for such situations are welcome (actual log lines would | |
42 | be best). | |
43 | ||
44 | It's been a while since I changed it, so I am releasing the current | |
45 | version as version 1.1. | |
46 | ||
47 | I place the fido.daily script on the public domain, but I ask that, if | |
48 | you do any significant improvement, that you consider sending the | |
49 | improvements to me so that I can mantain a reference version. | |
50 | Suggestions for improvements are also welcome. | |
51 | ||
52 | In this message I include a sample output produced by the script, the | |
53 | fido.daily script itself, and a "rotate-logs" shell script that I | |
54 | addapted from code floating on the net. I invoke this last script | |
55 | daily from cron. | |
56 | ||
57 | ----BEGIN sample output -- | |
58 | Report period: | |
59 | From Apr 10 03:34:03 | |
60 | To Apr 18 02:59:57 | |
61 | ||
62 | Trafic by system (ifcico): | |
63 | Attempts Busy NoCa Conn Time Received Sent System | |
64 | 314 90 1 20 6:58 472Kb 0Kb 16:16000/0 | |
65 | 216 1 1 26 11:12 904Kb 7Kb 2:362/1006 | |
66 | 269 119 13 18 0:15 15Kb 0Kb 2:362/8 | |
67 | ||
68 | ||
69 | Messages received by system (iftoss): | |
70 | Echomail Netmail Route | |
71 | 796 0 16:16000/0 | |
72 | 2119 0 2:362/10 | |
73 | 23 0 2:362/8 | |
74 | ||
75 | ||
76 | Messages sent by system (ifnews+ifmail): | |
77 | Echomail Netmail Route | |
78 | 1 0 16:16000/0 | |
79 | 11 0 362/10 | |
80 | ----END sample output -- | |
81 | ||
82 | ||
83 | ----BEGIN fido.daily -- | |
84 | #!/usr/local/bin/perl | |
0 | #!/usr/bin/perl | |
85 | 1 | # |
86 | 2 | # fido.daily -- resume your ifcico, iftoss, ifmail, and ifnews logs |
87 | 3 | # |
190 | 106 | local($s)= @_; |
191 | 107 | sprintf("%4d:%2.2d", $s/60, $s-int($s/60)*60); |
192 | 108 | } |
193 | ----END fido.daily -- | |
194 | ||
195 | ----BEGIN rotate-logs -- | |
196 | #!/bin/sh | |
197 | ||
198 | # Script to rotate syslog files. Run from cron, every day or weekend. | |
199 | ||
200 | LOGDIR=/usr/adm/fido # log file directory | |
201 | OLDDIR=${LOGDIR}/OLD | |
202 | LOGPERM=0660 # log file permissions | |
203 | ||
204 | LOG1=iflog | |
205 | LOG2=ifdebug | |
206 | LOG3=rnews | |
207 | ||
208 | LOG1OWN=fido.uucp # log file ownership | |
209 | LOG2OWN=fido.uucp # log file ownership | |
210 | LOG3OWN=news.news # log file ownership | |
211 | ||
212 | # But first, generate some statistics... | |
213 | ||
214 | TMP=/tmp/fido.$$ | |
215 | echo To: jcf, jpa, px > $TMP | |
216 | echo Subject: Daily Fidonet report >> $TMP | |
217 | echo "" >> $TMP | |
218 | perl /usr/local/lib/fido/fido.daily ${LOGDIR}/${LOG1} >> $TMP | |
219 | /usr/lib/sendmail -t < $TMP && rm $TMP | |
220 | ||
221 | ||
222 | test -f ${OLDDIR}/${LOG1}.6 && mv ${OLDDIR}/${LOG1}.6 ${OLDDIR}/${LOG1}.7 | |
223 | test -f ${OLDDIR}/${LOG1}.5 && mv ${OLDDIR}/${LOG1}.5 ${OLDDIR}/${LOG1}.6 | |
224 | test -f ${OLDDIR}/${LOG1}.4 && mv ${OLDDIR}/${LOG1}.4 ${OLDDIR}/${LOG1}.5 | |
225 | test -f ${OLDDIR}/${LOG1}.3 && mv ${OLDDIR}/${LOG1}.3 ${OLDDIR}/${LOG1}.4 | |
226 | test -f ${OLDDIR}/${LOG1}.2 && mv ${OLDDIR}/${LOG1}.2 ${OLDDIR}/${LOG1}.3 | |
227 | test -f ${OLDDIR}/${LOG1}.1 && mv ${OLDDIR}/${LOG1}.1 ${OLDDIR}/${LOG1}.2 | |
228 | test -f ${OLDDIR}/${LOG1}.0 && mv ${OLDDIR}/${LOG1}.0 ${OLDDIR}/${LOG1}.1 | |
229 | test -f ${LOGDIR}/${LOG1} && mv ${LOGDIR}/${LOG1} ${OLDDIR}/${LOG1}.0 | |
230 | ||
231 | test -f ${OLDDIR}/${LOG2}.6 && mv ${OLDDIR}/${LOG2}.6 ${OLDDIR}/${LOG2}.7 | |
232 | test -f ${OLDDIR}/${LOG2}.5 && mv ${OLDDIR}/${LOG2}.5 ${OLDDIR}/${LOG2}.6 | |
233 | test -f ${OLDDIR}/${LOG2}.4 && mv ${OLDDIR}/${LOG2}.4 ${OLDDIR}/${LOG2}.5 | |
234 | test -f ${OLDDIR}/${LOG2}.3 && mv ${OLDDIR}/${LOG2}.3 ${OLDDIR}/${LOG2}.4 | |
235 | test -f ${OLDDIR}/${LOG2}.2 && mv ${OLDDIR}/${LOG2}.2 ${OLDDIR}/${LOG2}.3 | |
236 | test -f ${OLDDIR}/${LOG2}.1 && mv ${OLDDIR}/${LOG2}.1 ${OLDDIR}/${LOG2}.2 | |
237 | test -f ${OLDDIR}/${LOG2}.0 && mv ${OLDDIR}/${LOG2}.0 ${OLDDIR}/${LOG2}.1 | |
238 | test -f ${LOGDIR}/${LOG2} && mv ${LOGDIR}/${LOG2} ${OLDDIR}/${LOG2}.0 | |
239 | ||
240 | test -f ${OLDDIR}/${LOG3}.6 && mv ${OLDDIR}/${LOG3}.6 ${OLDDIR}/${LOG3}.7 | |
241 | test -f ${OLDDIR}/${LOG3}.5 && mv ${OLDDIR}/${LOG3}.5 ${OLDDIR}/${LOG3}.6 | |
242 | test -f ${OLDDIR}/${LOG3}.4 && mv ${OLDDIR}/${LOG3}.4 ${OLDDIR}/${LOG3}.5 | |
243 | test -f ${OLDDIR}/${LOG3}.3 && mv ${OLDDIR}/${LOG3}.3 ${OLDDIR}/${LOG3}.4 | |
244 | test -f ${OLDDIR}/${LOG3}.2 && mv ${OLDDIR}/${LOG3}.2 ${OLDDIR}/${LOG3}.3 | |
245 | test -f ${OLDDIR}/${LOG3}.1 && mv ${OLDDIR}/${LOG3}.1 ${OLDDIR}/${LOG3}.2 | |
246 | test -f ${OLDDIR}/${LOG3}.0 && mv ${OLDDIR}/${LOG3}.0 ${OLDDIR}/${LOG3}.1 | |
247 | test -f ${LOGDIR}/${LOG3} && mv ${LOGDIR}/${LOG3} ${OLDDIR}/${LOG3}.0 | |
248 | ||
249 | cp /dev/null ${LOG1} | |
250 | chmod ${LOGPERM} ${LOG1} | |
251 | /usr/local/bin/chown ${LOG1OWN} ${LOG1} | |
252 | ||
253 | cp /dev/null ${LOG2} | |
254 | chmod ${LOGPERM} ${LOG2} | |
255 | /usr/local/bin/chown ${LOG2OWN} ${LOG2} | |
256 | ||
257 | cp /dev/null ${LOG3} | |
258 | chmod ${LOGPERM} ${LOG3} | |
259 | /usr/local/bin/chown ${LOG3OWN} ${LOG3} | |
260 | ----END rotate-logs -- |
0 | #!/usr/bin/perl | |
1 | # | |
2 | # fido.daily -- resume your ifcico, iftoss, ifmail, and ifnews logs | |
3 | # | |
4 | # by Joaquim Baptista, px@fct.unl.pt | |
5 | # | |
6 | # Placed on the public domain. If you make significant improvements on | |
7 | # this script, please send them to me so that I can mantain a "reference" | |
8 | # version. This script works with ifmail28; future versions may break it. | |
9 | # | |
10 | # Example usage from cron, before rotating the logs: | |
11 | # fido.daily iflog | mail -s 'Daily Fidonet report' sysop | |
12 | # | |
13 | # v1.1 -- Ignore "@somenet" in addresses like "2:362/42@fidonet" to avoid | |
14 | # multiple entries for the same node. Add -s option to select | |
15 | # nodes. Avoid dupplicate lines in the table of messages sent. | |
16 | # Add report of period covered. | |
17 | # | |
18 | # v1.0 -- First release | |
19 | ||
20 | require "getopts.pl"; | |
21 | &Getopts("s:") || die "usage: $0 [-s pattern] [file...]\n"; | |
22 | if ($opt_s ne "") { $opt_s =~ s/([^a-zA-Z0-9\s])/\\$1/g; } | |
23 | ||
24 | $first="zzz 99"; | |
25 | $last= " "; | |
26 | while (<>) { | |
27 | if (/^([A-Z][a-z][a-z] [ \d]\d )/) { | |
28 | $date= substr($_,0,15); | |
29 | if ($date lt $first) { $first=$date; } | |
30 | if ($last lt $date ) { $last=$date; } | |
31 | } | |
32 | ||
33 | if (/ifcico\[(\d+)\]: calling\s+([^\s@]+)/ ) { | |
34 | $call{$1}=$2; | |
35 | $attempts{$2}++; | |
36 | } | |
37 | elsif (/ifcico\[(\d+)\]: chat got "CONNECT"/) { | |
38 | $conn{$call{$1}}++; | |
39 | } | |
40 | elsif (/ifcico\[(\d+)\]: chat got "BUSY"/) { | |
41 | $busy{$call{$1}}++; | |
42 | } | |
43 | elsif (/ifcico\[(\d+)\]: chat got "NO CARRIER"/) { | |
44 | $noca{$call{$1}}++; | |
45 | } | |
46 | elsif (/ifcico\[(\d+)\]: received (\d+) bytes in (\d+)/) { | |
47 | $bytes_rcvd{$call{$1}} += $2; | |
48 | $seconds_rcvd{$call{$1}} += $3; | |
49 | } | |
50 | elsif (/ifcico\[(\d+)\]: sent (\d+) bytes in (\d+)/) { | |
51 | $bytes_sent{$call{$1}} += $2; | |
52 | $seconds_sent{$call{$1}} += $3; | |
53 | } | |
54 | elsif (/iftoss\[(\d+)\]: packet from node ([^\s@]+)/) { | |
55 | $toss{$1}= $2; | |
56 | } | |
57 | elsif (/iftoss\[(\d+)\]: No newsgroup for area tag (\S+)/) { | |
58 | $toss_area{$2}++; | |
59 | } | |
60 | elsif (/iftoss\[(\d+)\]: end (\d+) echomail, (\d+)/) { | |
61 | $tosskeys{$toss{$1}} ++; | |
62 | $echomail{$toss{$1}} += $2; | |
63 | $netmail{$toss{$1}} += $3; | |
64 | } | |
65 | elsif (/ifmail\[(\d+)\]: route: ([^\s@]+)/) { | |
66 | $ifmail{$2}++; | |
67 | } | |
68 | elsif (/ifnews\[(\d+)\]: route: ([^\s@]+)/) { | |
69 | $ifnews{$2}++; | |
70 | } } | |
71 | ||
72 | print "Report period:\n From $first\n To $last\n\n"; | |
73 | ||
74 | print "Trafic by system (ifcico):\n"; | |
75 | print "Attempts Busy NoCa Conn Time Received Sent System\n"; | |
76 | for $s (sort keys %attempts) { | |
77 | next if ($opt_s ne "") && ($s !~ /$opt_s/o); | |
78 | printf("%7d %3d %3d %3d %s %6dKb %4dKb %s\n", | |
79 | $attempts{$s}, $busy{$s}, $noca{$s}, $conn{$s}, | |
80 | &mmss($seconds_rcvd{$s}+$seconds_sent{$s}), | |
81 | $bytes_rcvd{$s}/1024, $bytes_sent{$s}/1024, $s); | |
82 | } | |
83 | ||
84 | print "\n\nMessages received by system (iftoss):\nEchomail Netmail Route\n"; | |
85 | for $s (sort keys %tosskeys) { | |
86 | next if ($opt_s ne "") && ($s !~ /$opt_s/o); | |
87 | printf("%7d %7d %s\n", $echomail{$s}, $netmail{$s}, $s); | |
88 | } | |
89 | ||
90 | print "\n\nMessages sent by system (ifnews+ifmail):\nEchomail Netmail Route\n"; | |
91 | %aux=(%ifmail, %ifnews); | |
92 | for $s (sort (keys %aux)) { | |
93 | next if ($opt_s ne "") && ($s !~ /$opt_s/o); | |
94 | printf("%7d %7d %s\n", $ifnews{$s}, $ifmail{$s}, $s); | |
95 | } | |
96 | ||
97 | if (%toss_area) { | |
98 | print "\n\nMessages not tossed for lack of area tag (iftoss):\nNumber Area tag\n"; | |
99 | for $a (sort keys %toss_area) { | |
100 | printf("%5d %s\n", $toss_area{$a}, $a); | |
101 | } } | |
102 | ||
103 | exit 0; | |
104 | ||
105 | sub mmss { | |
106 | local($s)= @_; | |
107 | sprintf("%4d:%2.2d", $s/60, $s-int($s/60)*60); | |
108 | } |