aboutsummaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2005-06-10 15:22:57 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2005-06-10 15:22:57 +0000
commitccf80d27d2d90d03d0352f0d3212d95dd13c0f23 (patch)
tree2132d9e62acd400957b23488e379149953d51151 /etc
parente8428b9ccac84a443f11aefbd2bccdecb63b16de (diff)
downloadmailfromd-ccf80d27d2d90d03d0352f0d3212d95dd13c0f23.tar.gz
mailfromd-ccf80d27d2d90d03d0352f0d3212d95dd13c0f23.tar.bz2
Added to the repository
git-svn-id: file:///svnroot/mailfromd/trunk@91 7a8a7f39-df28-0410-adc6-e0d955640f24
Diffstat (limited to 'etc')
-rw-r--r--etc/.cvsignore3
-rw-r--r--etc/Makefile.am27
-rw-r--r--etc/mailfromd.rc55
-rwxr-xr-xetc/rc.in85
4 files changed, 170 insertions, 0 deletions
diff --git a/etc/.cvsignore b/etc/.cvsignore
new file mode 100644
index 00000000..3a780d86
--- /dev/null
+++ b/etc/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+Makefile.in
+rc.mailfromd
diff --git a/etc/Makefile.am b/etc/Makefile.am
new file mode 100644
index 00000000..e0bcf3bf
--- /dev/null
+++ b/etc/Makefile.am
@@ -0,0 +1,27 @@
+# This file is part of mailfrom filter.
+# Copyright (C) 2005, Sergey Poznyakoff
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+
+EXTRA_DIST = mailfromd.rc rc.in
+noinst_SCRIPTS = rc.mailfromd
+
+DEFAULT_PIDFILE = $(MAILFROMSTATEDIR)/mailfromd.pid
+CLEANFILES = rc.mailfromd
+
+.in.mailfromd:
+ f=$(libexecdir)/`echo "mailfromd" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ sed "s,<DEFAULT_PIDFILE>,$(DEFAULT_PIDFILE),;s,<DEFAULT_DAEMON>,$$f," $< > $@ \ No newline at end of file
diff --git a/etc/mailfromd.rc b/etc/mailfromd.rc
new file mode 100644
index 00000000..efcd9fdc
--- /dev/null
+++ b/etc/mailfromd.rc
@@ -0,0 +1,55 @@
+/* This file is part of mailfrom filter.
+ Copyright (C) 2005, Sergey Poznyakoff
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301 USA */
+
+#pragma option relay "/etc/mail/sendmail.cw"
+#pragma option relay "/etc/mail/relay-domains"
+#pragma option timeout 7500
+#pragma option retry 3
+#pragma option milter-timeout 7
+#pragma option mailfrom ""
+#pragma option ehlo "gnu.org"
+#pragma regex +extended +icase
+#pragma option debug 10
+
+if $f = ""
+ accept
+elif hostname ${client_addr} matches ".*(adsl|sdsl|hdsl|ldsl|dialin|dialup|ppp|dhcp|dynamic).*"
+ reject 550 "Use your SMTP relay"
+elif hostname ${client_addr} matches ".*-[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}.*"
+ on poll host ${client_addr} for $f do
+ when success:
+ accept
+ when not_found or failure:
+ reject 510 "Sender validity not confirmed"
+ when temp_failure:
+ tempfail
+ done
+elif relayed hostname ${client_addr}
+ accept
+elif $f fnmatches "*yahoo.com"
+ accept
+else
+ on poll $f do
+ when success:
+ accept
+ when not_found or failure:
+ reject 510 "Sender validity not confirmed"
+ when temp_failure:
+ tempfail
+ done
+fi
diff --git a/etc/rc.in b/etc/rc.in
new file mode 100755
index 00000000..97d919eb
--- /dev/null
+++ b/etc/rc.in
@@ -0,0 +1,85 @@
+#! /bin/sh
+# This file is part of mailfrom filter.
+# Copyright (C) 2005, Sergey Poznyakoff
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+
+PIDFILE=<DEFAULT_PIDFILE>
+DAEMON=<DEFAULT_DAEMON>
+ARGS=""
+PS="ps axwwww"
+
+mailfromd_start() {
+ echo "Starting mailfromd..."
+ rm -f $PIDFILE
+ if eval $DAEMON $ARGS ; then
+ if [ ! -r $PIDFILE ]; then
+ sleep 1
+ test -r $PIDFILE || echo "mailfromd NOT started" >&2
+ fi
+ else
+ echo "mailfromd failed to start" >&2
+ fi
+}
+
+mailfromd_stop() {
+ echo "Stopping mailfromd..."
+ if [ -r $PIDFILE ]; then
+ PID=`head -n 1 $PIDFILE`
+ kill -TERM -$PID 2>/dev/null
+ N=0
+ while [ -r $PIDFILE ]
+ do
+ N=$((N+1))
+ if [ $N -gt 5 ]; then
+ break
+ fi
+ sleep 1
+ done
+ if [ -r $PIDFILE ]; then
+ echo "Still running. Killing it..." >&2
+ kill -KILL $PID 2>/dev/null
+ rm $PIDFILE
+ fi
+ else
+ echo "mailfromd is not running" >&2
+ fi
+}
+
+mailfromd_status() {
+ if [ -r $PIDFILE ]; then
+ echo "mailformd appears to be running at `head -n 1 $PIDFILE`"
+ fi
+ $PS | grep "[0-9]:[0-9][0-9] $DAEMON " |
+ while read pid tt stat time command
+ do
+ echo $pid $command
+ done
+}
+
+case $1 in
+start) mailfromd_start;;
+stop) mailfromd_stop;;
+restart)
+ mailfromd_stop
+ sleep 1
+ mailfromd_start;;
+status)
+ mailfromd_status;;
+*) echo "Usage: $0 {start|stop|restart|status}" >&2;;
+esac
+
+# End of rc.mailfromd

Return to:

Send suggestions and report system problems to the System administrator.