From 0c9eb426e8c4713efa8806509e19fb482f702f189e496c90b4d62f7fd050cfca Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@inai.de>
Date: Tue, 23 Jul 2024 12:25:20 +0000
Subject: [PATCH] 
 [info=7c9c1836fe32bb38837741337caaf718a88148d2e9e2f53fb82aa95448c39f2c]

OBS-URL: https://build.opensuse.org/package/show/server:mail/postsrsd?expand=0&rev=28
---
 .gitattributes         |  23 ++++++++++
 .gitignore             |   1 +
 2.0.9.tar.gz           |   3 ++
 _scmsync.obsinfo       |   4 ++
 build.specials.obscpio |   3 ++
 postsrsd.changes       | 100 +++++++++++++++++++++++++++++++++++++++++
 postsrsd.spec          |  87 +++++++++++++++++++++++++++++++++++
 sysuser.conf           |   1 +
 8 files changed, 222 insertions(+)
 create mode 100644 .gitattributes
 create mode 100644 .gitignore
 create mode 100644 2.0.9.tar.gz
 create mode 100644 _scmsync.obsinfo
 create mode 100644 build.specials.obscpio
 create mode 100644 postsrsd.changes
 create mode 100644 postsrsd.spec
 create mode 100644 sysuser.conf

diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..9b03811
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,23 @@
+## Default LFS
+*.7z filter=lfs diff=lfs merge=lfs -text
+*.bsp filter=lfs diff=lfs merge=lfs -text
+*.bz2 filter=lfs diff=lfs merge=lfs -text
+*.gem filter=lfs diff=lfs merge=lfs -text
+*.gz filter=lfs diff=lfs merge=lfs -text
+*.jar filter=lfs diff=lfs merge=lfs -text
+*.lz filter=lfs diff=lfs merge=lfs -text
+*.lzma filter=lfs diff=lfs merge=lfs -text
+*.obscpio filter=lfs diff=lfs merge=lfs -text
+*.oxt filter=lfs diff=lfs merge=lfs -text
+*.pdf filter=lfs diff=lfs merge=lfs -text
+*.png filter=lfs diff=lfs merge=lfs -text
+*.rpm filter=lfs diff=lfs merge=lfs -text
+*.tbz filter=lfs diff=lfs merge=lfs -text
+*.tbz2 filter=lfs diff=lfs merge=lfs -text
+*.tgz filter=lfs diff=lfs merge=lfs -text
+*.ttf filter=lfs diff=lfs merge=lfs -text
+*.txz filter=lfs diff=lfs merge=lfs -text
+*.whl filter=lfs diff=lfs merge=lfs -text
+*.xz filter=lfs diff=lfs merge=lfs -text
+*.zip filter=lfs diff=lfs merge=lfs -text
+*.zst filter=lfs diff=lfs merge=lfs -text
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..57affb6
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.osc
diff --git a/2.0.9.tar.gz b/2.0.9.tar.gz
new file mode 100644
index 0000000..8f1109b
--- /dev/null
+++ b/2.0.9.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:4283c8e7480ffd3fe176b18371570993103740ec9d20eb48cb4d4c53fa8a9628
+size 64224
diff --git a/_scmsync.obsinfo b/_scmsync.obsinfo
new file mode 100644
index 0000000..44ff566
--- /dev/null
+++ b/_scmsync.obsinfo
@@ -0,0 +1,4 @@
+mtime: 1713205079
+commit: 7c9c1836fe32bb38837741337caaf718a88148d2e9e2f53fb82aa95448c39f2c
+url: https://src.opensuse.org/jengelh/postsrsd
+revision: master
diff --git a/build.specials.obscpio b/build.specials.obscpio
new file mode 100644
index 0000000..1f763f8
--- /dev/null
+++ b/build.specials.obscpio
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:6f5d4558e31531d17ce335e6bf3b5677e67615b24487ea61dd59b0b9080f02c7
+size 256
diff --git a/postsrsd.changes b/postsrsd.changes
new file mode 100644
index 0000000..7518a6b
--- /dev/null
+++ b/postsrsd.changes
@@ -0,0 +1,100 @@
+-------------------------------------------------------------------
+Mon Apr 15 07:00:48 UTC 2024 - Jan Engelhardt <jengelh@inai.de>
+
+- Update to release 2.0.9
+  * Build system only: fix a linking error with libsubunit
+
+-------------------------------------------------------------------
+Fri Aug 25 21:55:15 UTC 2023 - Jan Engelhardt <jengelh@inai.de>
+
+- Update to release 2.0.8
+  * Fixed socket creation for Milter
+  * Fixed Milter issue with IPv6 clients
+
+-------------------------------------------------------------------
+Sat Aug 12 15:27:29 UTC 2023 - Jan Engelhardt <jengelh@inai.de>
+
+- Update to release 2.0.7
+  * The parser callback for the original-envelope option used the
+    wrong return type, which could prevent the database mode from
+    activating.
+
+-------------------------------------------------------------------
+Sat Jul 15 20:33:43 UTC 2023 - Jan Engelhardt <jengelh@inai.de>
+
+- Update to release 2.0.6
+  * New configuration option debug to increase log verbosity
+  * Reduced default log verbosity: PostSRSd no longer prints
+    messages for mail addresses which need no rewrite
+
+-------------------------------------------------------------------
+Tue Jun 27 04:49:49 UTC 2023 - Jan Engelhardt <jengelh@inai.de>
+
+- Update to release 2.0.5
+  * Do not try to set Keep-Alive on Redis unix sockets
+
+-------------------------------------------------------------------
+Wed May  3 23:02:52 UTC 2023 - Jan Engelhardt <jengelh@inai.de>
+
+- Update to release 2.0.4
+  * Added new CLI option -h to print a summary of CLI options
+  * Improved error logging
+
+-------------------------------------------------------------------
+Sun Mar  5 12:31:27 UTC 2023 - Jan Engelhardt <jengelh@inai.de>
+
+- Update to release 2.0.3
+  * Close socketmap connection in main process to prevent resource
+    exhaustion
+  * Explicitly set 0666 permissions on socketmap unix socket
+
+-------------------------------------------------------------------
+Mon Jan 16 18:07:47 UTC 2023 - Jan Engelhardt <jengelh@inai.de>
+
+- Switch the default execution user from "nobody" to the new
+  "postsrsd". /var/lib/postsrsd will be owned by postsrsd. If
+  /etc/postsrsd.conf contains a "unprivileged-user" override,
+  it needs to be adjusted.
+
+-------------------------------------------------------------------
+Sat Jan  7 15:14:25 UTC 2023 - Jan Engelhardt <jengelh@inai.de>
+
+- Update to release 2.0.2
+  * Everything thrown over the fence, this is a complete rewrite
+    of PostSRSd.
+  * Configuration file, no more fiddling with environment variables.
+  * Support for socketmap table (Postfix 2.10 or newer required).
+  * Unix socket support
+  * Rewrite mode with database backend, supports unlimited email
+    address length.
+  * Experimental Milter support.
+
+-------------------------------------------------------------------
+Wed Aug 17 08:37:45 UTC 2022 - Jan Engelhardt <jengelh@inai.de>
+
+- Update to release 1.12
+  * Explicitly clear O_NONBLOCK to avoid inherited non-blocking
+    sockets on some operating systems
+  * Do not close all file descriptors up to _SC_MAX_OPEN, that
+    limit can be absurdly high and hang PostSRSd for minutes
+
+-------------------------------------------------------------------
+Mon Apr 26 15:45:28 UTC 2021 - Jan Engelhardt <jengelh@inai.de>
+
+- Update to release 1.11 [boo#1180251]
+  * Drop group privileges as well as user privileges
+  * Fixed: The subprocess that talks to Postfix could be caused
+    to hang with a very long email address. [CVE-2020-35573]
+
+-------------------------------------------------------------------
+Fri Dec 20 00:50:22 UTC 2019 - Jan Engelhardt <jengelh@inai.de>
+
+- Update to release 1.6
+  * Fix endianness issue with SHA-1 implementation
+  * Add dual stack support
+  * Make SRS separator configurable
+
+-------------------------------------------------------------------
+Tue Nov 18 09:47:29 UTC 2014 - jengelh@inai.de
+
+- Initial package for build.opensuse.org (version 1.2+git2)
diff --git a/postsrsd.spec b/postsrsd.spec
new file mode 100644
index 0000000..00371bc
--- /dev/null
+++ b/postsrsd.spec
@@ -0,0 +1,87 @@
+#
+# spec file for package postsrsd
+#
+# Copyright (c) 2024 SUSE LLC
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
+
+
+Name:           postsrsd
+Version:        2.0.9
+Release:        0
+Summary:        Sender Rewriting Support for postfix
+License:        GPL-2.0-only
+Group:          Productivity/Networking/Email/Servers
+URL:            https://github.com/roehling/postsrsd
+Source:         https://github.com/roehling/postsrsd/archive/%version.tar.gz
+Source3:        sysuser.conf
+BuildRequires:  cmake >= 3.24
+BuildRequires:  systemd-rpm-macros
+BuildRequires:  sysuser-tools
+BuildRequires:  pkgconfig(libconfuse)
+BuildRequires:  pkgconfig(sqlite3)
+BuildRequires:  pkgconfig(systemd)
+
+%description
+PostSRSd provides the Sender Rewriting Scheme (SRS) via TCP-based
+lookup tables for Postfix. SRS is needed if your mail server acts
+as forwarder.
+
+%prep
+%autosetup -p1
+
+%build
+%sysusers_generate_pre %_sourcedir/sysuser.conf %name postsrsd.conf
+%cmake -DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS \
+	-DGENERATE_SRS_SECRET=0 -DCHROOT_DIR=/var/lib/postsrsd \
+	-DUSE_APPARMOR=1 -DINIT_FLAVOR=systemd \
+	-DWITH_SQLITE=BOOL:ON -DBUILD_TESTING:BOOL=OFF \
+	-DPOSTSRSD_USER=postsrsd
+%make_jobs
+
+%install
+%cmake_install
+b="%buildroot"
+mkdir -p "$b/%_defaultdocdir"
+mv "$b/%_datadir/doc/%name" "$b/%_defaultdocdir/"
+cp README.rst "$b/%_defaultdocdir/%name/"
+
+mkdir -p "$b/%_sysusersdir" "$b/var/lib/postsrsd"
+install -m 0644 "%_sourcedir/sysuser.conf" "$b/%_sysusersdir/postsrsd.conf"
+
+%pre -f %name.pre
+%service_add_pre postsrsd.service
+
+%post
+s="%_sysconfdir/postsrsd.secret"
+if [ ! -e "$s" ]; then
+	echo "No postsrsd secret found in $s, generating one."
+	dd if=/dev/urandom of="$s" bs=64 count=1
+fi
+%service_add_post postsrsd.service
+
+%preun
+%service_del_preun postsrsd.service
+
+%postun
+%service_del_postun postsrsd.service
+
+%files
+%_sbindir/postsrsd
+%_sysusersdir/*
+%_unitdir/*
+%_defaultdocdir/%name/
+%attr(0750,postsrsd,postsrsd) /var/lib/postsrsd
+%license LICENSES/*
+
+%changelog
diff --git a/sysuser.conf b/sysuser.conf
new file mode 100644
index 0000000..1781020
--- /dev/null
+++ b/sysuser.conf
@@ -0,0 +1 @@
+u postsrsd - "user for postsrsd" /var/lib/postsrsd -