Commit 058c7c97 authored by Kevin Daudt's avatar Kevin Daudt 💻
Browse files

community/postsrsd: update to 1.6

- set-socket-listen-address.patch is now applied upstream
- run actual test suite in check()
parent a2ab0cba
diff --git a/init/postsrsd.default.in b/init/postsrsd.default.in
index 7cf2b941db..5f7ad5b916 100644
index 50049f2105..9302b6dbfa 100644
--- a/init/postsrsd.default.in
+++ b/init/postsrsd.default.in
@@ -21,7 +21,7 @@ SRS_SEPARATOR==
......@@ -9,14 +9,14 @@ index 7cf2b941db..5f7ad5b916 100644
-SRS_SECRET=@SYSCONF_DIR@/@PROJECT_NAME@.secret
+SRS_SECRET=@SYSCONF_DIR@/@PROJECT_NAME@/@PROJECT_NAME@.secret
# Local ports for TCP list.
# These ports are used to bind the TCP list for postfix. If you change
@@ -35,7 +35,7 @@ SRS_REVERSE_PORT=10002
# Length of hash to be used in rewritten addresses
SRS_HASHLENGTH=4
@@ -44,7 +44,7 @@ SRS_REVERSE_PORT=10002
# Drop root privileges and run as another user after initialization.
# This is highly recommended as postsrsd handles untrusted input.
#
-RUN_AS=nobody
+RUN_AS=@PROJECT_NAME@
# Jail daemon in chroot environment
CHROOT=@CHROOT_DIR@
# Bind to this address
#
# Contributor: Kevin Daudt <ops@ikke.info>
# Maintainer: Kevin Daudt <ops@ikke.info>
pkgname=postsrsd
pkgver=1.4
pkgver=1.6
pkgrel=1
pkgdesc="Postfix Sender Rewriting Scheme daemon"
url="https://github.com/roehling/postsrsd"
......@@ -11,10 +11,9 @@ depends=""
makedepends="cmake help2man"
pkgusers="postsrsd"
install="$pkgname.pre-install"
subpackages="$pkgname-doc"
subpackages="$pkgname-doc $pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://github.com/roehling/postsrsd/archive/$pkgver.tar.gz
10-fix-defaults.patch
set-socket-listen-address.patch
postsrsd.initd"
builddir="$srcdir/$pkgname-$pkgver"
......@@ -33,7 +32,7 @@ build() {
check() {
cd "$builddir"/build
./postsrsd -v
./postsrsd_tests
}
package() {
......@@ -46,7 +45,6 @@ package() {
install -Dm0755 "$srcdir/postsrsd.initd" "$pkgdir/etc/init.d/postsrsd"
}
sha512sums="e5b9d2091d562030dd8d35117a3c5fb7d99c0613120fc90f74be57af5e88a3fe0ce73a5ce702708047ae37f70c6aedb4a0df018dccbe480048ccb6ed4debbcef postsrsd-1.4.tar.gz
bdafd3921fac6af21cf099ac63fd06692dca37366e197b23aaedd3cf748652bcc5b54cf545b24c7e6cb48d266233a29e9184481af99aa8d58a80e512d326c788 10-fix-defaults.patch
886dff5628bf17f0a18cd3d4fc5cd8245b35325c4d6476ba5d39552b102464d77dc8f33117b0c423a7ea776f102670092e75cd9e638ee34f1834865b219a1b54 set-socket-listen-address.patch
sha512sums="b2df4cdec41361e15cd8c9207fb16564d607559bcb36dd73c9347b90e4f3c2414b88434ef1ffe6a18783f38c5960383516e40e4ffa28802a03539e52ca723aa1 postsrsd-1.6.tar.gz
96a1c4e04ded844b98e5b5e263af51389ad8f1424a0fcd923f8156a2f9491b67552fbe3b5ad972cf1279d7b0e022787d151b5151a27da43227176356848ec4d7 10-fix-defaults.patch
bec690156e60a10286f92470420e2caccd0cd8fd5707fefddeb768b36a4697b9651acd707c7de08a99832a8b27a0328560501fb1376fe39bc27f5fbe4dca7797 postsrsd.initd"
Add the ability to set the socket listen address for the daemon, thus
enabling support to run it within a separate container than postfix.
Patch-Origin: upstream
Patch-Source: https://github.com/roehling/postsrsd/commit/fc2ba94684c99f771ea35f37b29009ba5ec0edb3
---
postsrsd.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/postsrsd.c b/postsrsd.c
index 5a8bd1c..adf65d3 100644
--- a/postsrsd.c
+++ b/postsrsd.c
@@ -48,7 +48,7 @@
static char *self = NULL;
-static size_t bind_service (const char *service, int family, int* socks, size_t max_socks)
+static size_t bind_service (const char *listen_addr, const char *service, int family, int* socks, size_t max_socks)
{
struct addrinfo *addr, *it;
struct addrinfo hints;
@@ -60,7 +60,7 @@ static size_t bind_service (const char *service, int family, int* socks, size_t
hints.ai_family = family;
hints.ai_socktype = SOCK_STREAM;
- err = getaddrinfo(NULL, service, &hints, &addr);
+ err = getaddrinfo(listen_addr, service, &hints, &addr);
if (err != 0) {
fprintf(stderr, "%s: bind_service(%s): %s\n", self, service, gai_strerror(err));
return count;
@@ -219,6 +219,7 @@ static void show_help ()
" -s<file> read secrets from file (required)\n"
" -d<domain> set domain name for rewrite (required)\n"
" -a<char> set first separator character which can be one of: -=+ (default: =)\n"
+ " -l<addr> set socket listen address (default: 127.0.0.1)\n"
" -f<port> set port for the forward SRS lookup (default: 10001)\n"
" -r<port> set port for the reverse SRS lookup (default: 10002)\n"
" -p<pidfile> write process ID to pidfile (default: none)\n"
@@ -243,7 +244,7 @@ int main (int argc, char **argv)
{
int opt, timeout = 1800, family = AF_UNSPEC;
int daemonize = FALSE;
- char *forward_service = NULL, *reverse_service = NULL,
+ char *listen_addr = NULL, *forward_service = NULL, *reverse_service = NULL,
*user = NULL, *domain = NULL, *chroot_dir = NULL;
char separator = '=';
char *secret_file = NULL, *pid_file = NULL;
@@ -264,7 +265,7 @@ int main (int argc, char **argv)
tmp = strrchr(argv[0], '/');
if (tmp) self = strdup(tmp + 1); else self = strdup(argv[0]);
- while ((opt = getopt(argc, argv, "46d:a:f:r:s:u:t:p:c:X::Dhev")) != -1) {
+ while ((opt = getopt(argc, argv, "46d:a:l:f:r:s:u:t:p:c:X::Dhev")) != -1) {
switch (opt) {
case '?':
return EXIT_FAILURE;
@@ -280,6 +281,9 @@ int main (int argc, char **argv)
case 'a':
separator = *optarg;
break;
+ case 'l':
+ listen_addr = strdup(optarg);
+ break;
case 'f':
forward_service = strdup(optarg);
break;
@@ -404,11 +408,11 @@ int main (int argc, char **argv)
return EXIT_FAILURE;
}
/* Bind ports. May require privileges if the config specifies ports below 1024 */
- sc = bind_service(forward_service, family, &sockets[socket_count], 4 - socket_count);
+ sc = bind_service(listen_addr, forward_service, family, &sockets[socket_count], 4 - socket_count);
if (sc == 0) return EXIT_FAILURE;
while (sc-- > 0) handler[socket_count++] = handle_forward;
free (forward_service);
- sc = bind_service(reverse_service, family, &sockets[socket_count], 4 - socket_count);
+ sc = bind_service(listen_addr, reverse_service, family, &sockets[socket_count], 4 - socket_count);
if (sc == 0) return EXIT_FAILURE;
while (sc-- > 0) handler[socket_count++] = handle_reverse;
free (reverse_service);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment