Commit 70546ef0 authored by Jakub Jirutka's avatar Jakub Jirutka 🇺🇦
Browse files

main/opensmtpd: add support for PAM in subpackage -pam

Resolves !15216
parent b323f680
......@@ -15,18 +15,32 @@ arch="all"
license="ISC"
depends="!postfix ca-certificates"
makedepends="automake autoconf libtool mandoc db-dev libasr-dev libevent-dev
fts-dev zlib-dev openssl-dev bison flex-dev"
fts-dev zlib-dev openssl-dev bison flex-dev linux-pam-dev"
install="$pkgname.pre-install"
subpackages="$pkgname-dbg $pkgname-openrc $pkgname-doc"
subpackages="$pkgname-dbg $pkgname-pam $pkgname-openrc $pkgname-doc"
source="https://www.opensmtpd.org/archives/opensmtpd-$pkgver.tar.gz
smtpd.initd
smtpd.confd
aliases
autoconf-decl-checks.patch
smtpd.conf.patch
"
options="suid !check"
prepare() {
default_prepare
cp -ar "$builddir" "$builddir-pam"
}
build() {
cd "$builddir"
_build
cd "$builddir-pam"
_build --with-auth-pam
}
_build() {
./configure \
--prefix=/usr \
--sysconfdir=/etc/smtpd \
......@@ -42,7 +56,8 @@ build() {
--with-libs="-lfts" \
--with-pie \
--with-path-CAfile=/etc/ssl/certs/ca-certificates.crt \
--with-mantype=doc
--with-mantype=doc \
"$@"
make
}
......@@ -50,16 +65,27 @@ package() {
make DESTDIR="$pkgdir" -C "$builddir" install
install -Dm755 "$srcdir"/smtpd.initd "$pkgdir"/etc/init.d/smtpd
install -Dm644 "$srcdir"/smtpd.confd "$pkgdir"/etc/conf.d/smtpd
install -Dm644 "$srcdir"/aliases "$pkgdir"/etc/smtpd/aliases
# Create compatibility symlinks for mailq, newaliases, makemap and sendmail.
local binary; for binary in mailq newaliases makemap sendmail; do
ln -s /usr/sbin/smtpctl "$pkgdir"/usr/sbin/$binary
done
install -Dm755 "$builddir-pam"/mk/smtpd/smtpd "$pkgdir"/usr/sbin/smtpd-pam
}
pam() {
pkgdesc="OpenSMTPD with PAM support"
depends="$pkgname=$pkgver-r$pkgrel"
amove usr/sbin/smtpd-pam
}
sha512sums="403952e77b360f42d8dc8ae7cd7faeced831b9e37bffd7c67d338b7208f7471d50f3594c3475a9282d18cb17435efd305ec8c05f89eaeab5d363ddb1c4d54a2e opensmtpd-6.7.1p1.tar.gz
4972c4fafd5a91766952f5ee738030a1b2663bd8f0ba873945962bb25df584d6af37f7e25d5beedcf2d8cf1d909690fd1bb597555ac127800ef10186ea24eb53 smtpd.initd
ec3e3a877f77d55a8f676169ff30feb1467b5ac5b0a3bfa960c54ab3848610ccf819e037d2d2a3b2231ec35989cf1dd03f105a7b5188fc828ee653260532fe1b smtpd.initd
e68fca4a7e0ceda271ad61c5a6592a859789bea9ccb6417258f7a0b45d92163ed6097c208d3fdfb78bf978a6a01b6f3678e047e3ce972b2c521419d54a992e0a smtpd.confd
51d47b34eb3d728daa45f29d6434cc75db28dfa69b6fb3ecd873121df85b296a2d2c81016d765a07778aa26a496e4b29c09a30b82678cf42596a536734b5deca aliases
37104cc605569f142ceffa902f200e8a7e9e1114ebe5394ed1eac0ed6ce25454e1610270921c45246de8396eee04b7c8ab5a112a231036a6ef14e7e229b264e3 autoconf-decl-checks.patch
14ff3d4f56aee3a31551ea535c4a5bf9b760f0f11bc269225d7b176d5031294716133cbf4555a92e76cc6e33de89454435562672ddaf1ab365e61085eb1e4d53 smtpd.conf.patch"
# Configuration for /etc/init.d/smtpd
# Use PAM?
# Note: You have to install package opensmtpd-pam to enable PAM.
#use_pam=no
# Additional arguments for smtpd.
#command_args=
......@@ -5,6 +5,8 @@ extra_commands="checkconfig"
description_checkconfig="Check configuration file for errors"
command=/usr/sbin/smtpd
[ "$use_pam" = yes ] && command=/usr/sbin/smtpd-pam
command_args="-F ${command_args:-$SMTPD_OPTS}" # SMTPD_OPTS is deprecated
command_background=yes
......@@ -23,6 +25,11 @@ start_pre() {
}
checkconfig() {
if [ "$use_pam" = yes ] && [ ! -x "$command" ]; then
eerror "\$use_pam=yes, but opensmtpd-pam is not installed"
return 1
fi
ebegin "Checking $name configuration"
# Don't output anything unless something is *not* ok.
......
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