Mail archive
alpine-aports

[alpine-aports] [PATCH v2] mini-sendmail: new aport

From: Stuart Cardall <developer_at_it-offshore.co.uk>
Date: Tue, 9 Feb 2016 19:28:59 +0000

---
v1 --> v2
now correctly includes the authors copyright notice in $pkg-doc
 testing/mini-sendmail/APKBUILD      | 64 +++++++++++++++++++++++++++++++++++++
 testing/mini-sendmail/LICENSE       | 25 +++++++++++++++
 testing/mini-sendmail/README.alpine |  5 +++
 testing/mini-sendmail/sh.c          | 30 +++++++++++++++++
 4 files changed, 124 insertions(+)
 create mode 100644 testing/mini-sendmail/APKBUILD
 create mode 100644 testing/mini-sendmail/LICENSE
 create mode 100644 testing/mini-sendmail/README.alpine
 create mode 100644 testing/mini-sendmail/sh.c
diff --git a/testing/mini-sendmail/APKBUILD b/testing/mini-sendmail/APKBUILD
new file mode 100644
index 0000000..4d05ad3
--- /dev/null
+++ b/testing/mini-sendmail/APKBUILD
_at_@ -0,0 +1,64 @@
+# Contributor: Stuart Cardall <developer_at_it-offshore.co.uk>
+# Maintainer: Stuart Cardall <developer_at_it-offshore.co.uk>
+pkgname=mini-sendmail
+_realname=mini_sendmail
+pkgver=1.3.9
+pkgrel=0
+pkgdesc="Accept mail inside a chroot + wrapper for /bin/sh"
+url="http://acme.com/software/mini_sendmail/"
+arch="all"
+license="custom"
+depends=""
+depends_dev=""
+makedepends="$depends_dev"
+subpackages="$pkgname-doc"
+source="http://www.acme.com/software/$_realname/$_realname-$pkgver.tar.gz
+	README.alpine
+	LICENSE
+	sh.c
+	"
+
+_builddir="$srcdir"/$_realname-$pkgver
+prepare() {
+       local i
+       cd "$_builddir"
+       for i in $source; do
+               case $i in
+               *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+               esac
+       done
+}
+
+build() {
+       cd "$_builddir"
+       sed -i "s|^BINDIR.*|BINDIR = $pkgdir/var/lib/mini-sendmail|" Makefile
+       sed -i "s|^MANDIR.*|MANDIR = $pkgdir/usr/share/man|" Makefile
+       sed -i 's|cp mini_sendmail.8.*|cp mini_sendmail.8 $(MANDIR)/man8/|' Makefile
+       make || return 1
+       cp "$srcdir"/sh.c ./
+       gcc sh.c -o sh -static || return 1
+}
+
+package() {
+       cd "$_builddir"
+       mkdir -p "$pkgdir"/var/lib/mini-sendmail
+       mkdir -p "$pkgdir"/usr/share/man/man8
+       mkdir -p "$pkgdir"/usr/share/doc/mini-sendmail
+       make DESTDIR="$pkgdir" install || return 1
+       install -Dm755 sh "$pkgdir"/var/lib/mini-sendmail/
+       install -Dm644 "$srcdir"/README.alpine "$pkgdir"/usr/share/doc/mini-sendmail/
+       install -Dm644 "$srcdir"/LICENSE "$pkgdir"/usr/share/doc/mini-sendmail/
+}
+
+md5sums="0769b6d3ba64fa77a52a90c8866fc4ed  mini_sendmail-1.3.9.tar.gz
+de62b0348231c4f3863876f4611f82f8  README.alpine
+a51bbd8a9bcc7391e4db256b6bfb581b  LICENSE
+4d751980f33365c5a6520725ab67686e  sh.c"
+sha256sums="2e2741ade434808b2b95c7df7b2016a4a7e629c3d6c87468a7f58fb183a1967b  mini_sendmail-1.3.9.tar.gz
+be609714548a5b5e33bef3d6e231eec978050f17b0c4f57793025f505b3ff7c9  README.alpine
+65c82388e07b7fc2427c870d52db6e2f6dc81aba58cd2bee005544db6b151376  LICENSE
+d24df6d8ee3b335e6be3a0e78b3110e35ffd3e523e50e0272603ec44c08176b0  sh.c"
+sha512sums="b28c39d94b77acc27a8c9e99583904b43815936b2bf7e27b996685784ff1bc9882bdfc57822ddf62d3198f38ec3df0b766289115cb4e6c23abee93884d2d6bb9  mini_sendmail-1.3.9.tar.gz
+bc6a389f20834956e86edbf033cd6b7a3b7df4a9c1a101a751179c4af444ca08a4cb0bb07dc3a01a3d72908f45059921db336814d9ac9f8eee61d61ce1b2e62f  README.alpine
+315b63e597561d911541975160ef5b6158fa5421a638efb06bf5e7af72069484a057c332d590b9e8e72383b67e25f7393a81666f8b914d0c649f1572cf330077  LICENSE
+7356bfb52c46ac79797fea620f7e39c4141c066006e1b72fbf247ea36268a8c89a04120c508c431e0ad152eec9891b2766e2782046e8ea370a1f8ea6699fa0ff  sh.c"
diff --git a/testing/mini-sendmail/LICENSE b/testing/mini-sendmail/LICENSE
new file mode 100644
index 0000000..47bb71d
--- /dev/null
+++ b/testing/mini-sendmail/LICENSE
_at_@ -0,0 +1,25 @@
+mini_sendmail - accept email on behalf of real sendmail
+
+Copyright © 1999,2015 by Jef Poskanzer <jef_at_mail.acme.com>.
+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.
diff --git a/testing/mini-sendmail/README.alpine b/testing/mini-sendmail/README.alpine
new file mode 100644
index 0000000..ce44325
--- /dev/null
+++ b/testing/mini-sendmail/README.alpine
_at_@ -0,0 +1,5 @@
+PHP launches sendmail via system(), which in turn uses “/bin/sh -c” internally.
+/var/lib/mini-sendmail/sh is a wrapper that supports being called with “-c command”
+to launch sendmail.
+
+https://knzl.de/setting-up-a-chroot-for-php/
diff --git a/testing/mini-sendmail/sh.c b/testing/mini-sendmail/sh.c
new file mode 100644
index 0000000..7feea6d
--- /dev/null
+++ b/testing/mini-sendmail/sh.c
_at_@ -0,0 +1,30 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#define MAXARG 64
+
+int main( int argc, char* const argv[] ) {
+    char* args[ MAXARG ] = {};
+
+    if( argc < 3 || strcmp( argv[1], "-c" ) != 0 ) {
+        fprintf( stderr, "Usage: %s -c <cmd>\n", argv[0] );
+        return 1;
+    }
+
+    {
+        char* token;
+        int i = 0;
+        char* argStr = strdup( argv[2] );
+        while( ( token = strsep( &argStr, " " ) ) != NULL ) {
+            if( token && strlen( token ) )
+                args[ i++ ] = token;
+            if( i >= MAXARG )
+                return 2;
+        }
+    }
+
+    return execvp( args[0], args );
+}
+
-- 
2.7.0
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Tue Feb 09 2016 - 19:28:59 GMT