]> git.ipfire.org Git - people/ms/dma.git/commitdiff
Embed Yet Another Copy(tm) of the dbounce-simple-safecat utility.
authorPeter Pentchev <roam@ringlet.net>
Tue, 10 Mar 2009 12:04:42 +0000 (12:04 +0000)
committerPeter Pentchev <roam@ringlet.net>
Tue, 10 Mar 2009 12:04:42 +0000 (12:04 +0000)
Recommend safecat so it can actually work :)

control
dbounce-simple-safecat [new file with mode: 0644]
dbounce-simple-safecat.1 [new file with mode: 0644]
dma.install [new file with mode: 0644]
rules

diff --git a/control b/control
index 921bc6c3b28b42c2687a31c213c78469bca99cd4..bb353657eeff8bd4ebf0b2d2647b9c2163141d62 100644 (file)
--- a/control
+++ b/control
@@ -14,6 +14,7 @@ Depends: liblockfile1 (>> 1.01), ${shlibs:Depends}, ${misc:Depends}
 Provides: mail-transport-agent
 Conflicts: mail-transport-agent
 Replaces: mail-transport-agent
+Recommends: safecat
 Description: the DragonFly Mail Agent, a lightweight MTA
  The DragonFly Mail Agent is a small Mail Transport Agent (MTA),
  designed for home and office use.  It accepts mails from locally
diff --git a/dbounce-simple-safecat b/dbounce-simple-safecat
new file mode 100644 (file)
index 0000000..429e3e8
--- /dev/null
@@ -0,0 +1,78 @@
+#!/bin/sh
+#
+# Copyright (c) 2009  Peter Pentchev
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+set -e
+
+usage()
+{
+       cat <<EOUSAGE
+Usage: dbounce-simple-safecat [-a addr] [-d dir] [-i queueid] [-t type] -f msg
+       -a      the recipient of the bounced message
+       -d      the bounce directory, default $DEFBOUNCEDIR
+       -f      the full path to the bounced message to process
+       -i      the ID of the bounce message in the local MTA's queue
+       -t      the MTA type, currently ignored
+EOUSAGE
+}
+
+DEFBOUNCEDIR='/var/spool/mail/dma-bounces'
+BOUNCEDIR="$DEFBOUNCEDIR"
+
+while getopts 'a:d:f:i:t:' o; do
+       case "$o" in
+               a)
+                       ADDR="$OPTARG"
+                       ;;
+               d)
+                       BOUNCEDIR="$OPTARG"
+                       ;;
+               f)
+                       FILENAME="$OPTARG"
+                       ;;
+               i)
+                       QUEUEID="$OPTARG"
+                       ;;
+               t)
+                       MTA="$OPTARG"
+                       ;;
+               *)
+                       usage 1>&2
+                       exit 1
+       esac
+done
+
+if [ ! -r "$FILENAME" ]; then
+       echo "Nonexistent or unreadable bounce file $FILENAME" 1>&2
+       exit 1
+fi
+
+F=`safecat "$BOUNCEDIR/tmp" "$BOUNCEDIR/new" < "$FILENAME"`
+OUTFILE="$BOUNCEDIR/new/$F"
+if [ ! -f "$OUTFILE" ]; then
+       echo "safecat indicated success, but '$OUTFILE' does not exist" 1>&2
+       exit 1
+fi
+echo "Successfully written the message to $OUTFILE"
diff --git a/dbounce-simple-safecat.1 b/dbounce-simple-safecat.1
new file mode 100644 (file)
index 0000000..6f8e5f7
--- /dev/null
@@ -0,0 +1,102 @@
+.\" Copyright (c) 2009  Peter Pentchev
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.Dd March 12, 2009
+.Dt DBOUNCE-SIMPLE-SAFECAT 1
+.Os
+.Sh NAME
+.Nm dbounce-simple-safecat
+.Nd store double-bounced email messages into a Maildir
+.Sh SYNOPSIS
+.Nm
+.Op Fl a Ar addr
+.Op Fl d Ar dir
+.Op Fl i Ar queueid
+.Op Fl t Ar type
+.Fl f Ar msg
+.Sh DESCRIPTION
+The
+.Nm
+utility reads an email message file from the local MTA's queue directory and
+invokes the
+.Xr safecat 1
+utility to store it into a Maildir-format directory for the administrator's
+perusal.
+It is intended to be used as a double-bounce handler by mail transfer agents
+such as
+.Xr dma 8
+(when dma's
+.Va DBOUNCEPROG
+configuration setting is specified).
+.Pp
+The
+.Nm
+utility accepts the following command-line options; only
+.Fl f
+is mandatory:
+.Pp
+.Bl -tag -width "-i queueid"
+.It Fl a Ar addr
+The recipient of the bounce message.
+.It Fl d Ar dir
+The bounce directory,
+.Pa /var/spool/mail/dma-bounces
+by default.
+.It Fl f Ar msg
+The full path to the bounced message to process. 
+.It Fl i Ar queueid
+The ID of the bounce message in the local MTA's queue.
+.It Fl t Ar type
+The MTA type, currently unused.
+.El
+.Sh EXAMPLES
+Copy a message from the local
+.Xr dma 8
+queue into the default double-bounce Maildir:
+.Pp
+.Dl dbounce-simple-safecat -a roam@ringlet.net -i 40c1b8.882e250 -t dma -f /var/spool/dma/40c1b8.882e250
+.Pp
+A minimal execution with only the mandatory parameters:
+.Pp
+.Dl dbounce-simple-safecat -f /var/spool/dma/40c1b8.882e250
+.Pp
+Explicitly specify the destination directory:
+.Pp
+.Dl dbounce-simple-safecat -d /root/bounces -f /var/spool/dma/40c1b8.882e250
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr safecat 1 ,
+.Xr dma 8
+.Sh HISTORY
+The
+.Nm
+utility was written by Peter Pentchev in 2009.
+.Sh AUTHORS
+.An Peter Pentchev
+.Aq roam@ringlet.net
+.Sh BUGS
+No, thank you :)
+But if you should actually find any, please report them
+to the author.
diff --git a/dma.install b/dma.install
new file mode 100644 (file)
index 0000000..a1199a7
--- /dev/null
@@ -0,0 +1,2 @@
+debian/dbounce-simple-safecat usr/bin
+debian/dbounce-simple-safecat.1 usr/share/man/man1
diff --git a/rules b/rules
index b8ad7a3886d40131edc8cba0df8864859f4e8755..6efaa552a92457f0aa99808eace63e25353f7127 100755 (executable)
--- a/rules
+++ b/rules
@@ -60,7 +60,7 @@ binary-arch: build install
        dh_installchangelogs 
        dh_installdocs
        dh_installexamples
-#      dh_install
+       dh_install
 #      dh_installmenu
 #      dh_installdebconf       
 #      dh_installlogrotate