Subject: Collected Debian patches for postsrsd
Author: Oxan van Leeuwen <oxan@oxanvanleeuwen.nl>

The postsrsd package is maintained in Git rather than maintaining
patches as separate files, and separating the patches isn't worth
the effort.  They are therefore all included in this single Debian
patch.

For full commit history and separated commits, see the packaging Git
repository. The location of the repository can be found in the Vcs-Git
field in debian/control.
--- postsrsd-1.5.orig/init/postsrsd.default.in
+++ postsrsd-1.5/init/postsrsd.default.in
@@ -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=postsrsd
 
 # Bind to this address
 #
--- postsrsd-1.5.orig/init/postsrsd.systemd.in
+++ postsrsd-1.5/init/postsrsd.systemd.in
@@ -1,12 +1,22 @@
 [Unit]
 Description=PostSRSd Daemon
+Documentation=man:postsrsd(8)
 
 [Service]
 Type=simple
 Restart=always
 
 # Fallback defaults.
+Environment=SRS_FORWARD_PORT=10001
+Environment=SRS_REVERSE_PORT=10002
 Environment=SRS_DOMAIN=localhost.localdomain
+Environment=SRS_SECRET=@SYSCONF_DIR@/@PROJECT_NAME@.secret
+Environment=SRS_SEPARATOR==
+Environment=SRS_HASHLENGTH=4
+Environment=SRS_HASHMIN=4
+Environment=RUN_AS=postsrsd
+Environment=SRS_LISTEN_ADDR=127.0.0.1
+Environment=CHROOT=@CHROOT_DIR@
 Environment=SRS_EXCLUDE_DOMAINS=
 
 # Fill in a default value for SRS_DOMAIN using postconf.
--- postsrsd-1.5.orig/init/postsrsd.sysv-lsb.in
+++ postsrsd-1.5/init/postsrsd.sysv-lsb.in
@@ -5,11 +5,12 @@
 #
 ### BEGIN INIT INFO
 # Provides:          @PROJECT_NAME@
-# Required-Start:    $syslog $network $local_fs
-# Required-Stop:     $syslog $network $local_fs
+# Required-Start:    $syslog $network $remote_fs
+# Required-Stop:     $syslog $network $remote_fs
 # Default-Start:     2 3 4 5
 # Default-Stop:      0 1 6
 # Short-Description: Start/stop the @PROJECT_NAME@ daemon
+# Description:       postsrsd offers Sender Rewriting Scheme support for Postfix
 ### END INIT INFO
 
 set -e
@@ -28,11 +29,23 @@ test -x $DAEMON || exit 0
 . /lib/lsb/init-functions
 
 # Default configuration
+SRS_FORWARD_PORT=10001
+SRS_REVERSE_PORT=10002
 SRS_DOMAIN=`postconf -h mydomain || true`
+SRS_SECRET=@SYSCONF_DIR@/@PROJECT_NAME@.secret
+SRS_SEPARATOR==
+SRS_HASHLENGTH=4
+SRS_HASHMIN=4
+RUN_AS=postsrsd
+CHROOT=@CHROOT_DIR@
+SRS_LISTEN_ADDR=127.0.0.1
 SRS_EXCLUDE_DOMAINS=
 
-# Read config file
-. @CONFIG_DIR@/$NAME
+# Read config file if it is present.
+if [ -r @CONFIG_DIR@/$NAME ]
+then
+    . @CONFIG_DIR@/$NAME
+fi
 
 test -r "$SRS_SECRET" -a -n "$SRS_DOMAIN" || exit 1
 
