Skip to content

Commit

Permalink
added checkrecipient-ezmlm PAM
Browse files Browse the repository at this point in the history
1. added checkrecipient-ezmlm Pluggable Address Module for qmail-smtpd
   recipient extension
  • Loading branch information
mbhangui committed Jul 26, 2023
1 parent 478330e commit bc28385
Show file tree
Hide file tree
Showing 13 changed files with 64 additions and 6 deletions.
1 change: 1 addition & 0 deletions ezmlm-x/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ Makevars.
PKGBUILD
ezmlm.changes
install
checkrecipient-ezmlm
2 changes: 2 additions & 0 deletions ezmlm-x/LIBEXEC
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
d:::755:::
c:::755:/:checkrecipient-ezmlm:
15 changes: 14 additions & 1 deletion ezmlm-x/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ edit = sed \
-e 's}@prefix\@}$(prefix)}g' \
-e 's}@qmaildir\@}$(qmaildir)}g' \
-e 's}@sysconfdir\@}$(sysconfdir)}g' \
-e 's}@libexecdir\@}$(libexecdir)}g' \
-e 's}@mandir\@}$(mandir)}g' \
-e 's,@email\@,$(email),g' \
-e 's}@version\@}$(version)}g' \
Expand Down Expand Up @@ -178,7 +179,8 @@ compile issub.c issub.h uint32.h

it: \
ezmlm-make ezmlm-manage ezmlm-send ezmlm-reject ezmlm-return \
ezmlm-warn ezmlm-weed ezmlm-list ezmlm-sub ezmlm-unsub ezmlm-queue
ezmlm-warn ezmlm-weed ezmlm-list ezmlm-sub ezmlm-unsub ezmlm-queue \
checkrecipient-ezmlm

load: \
make-load warn-auto.sh systype
Expand Down Expand Up @@ -224,6 +226,8 @@ default install conf-bin
./install $(DESTDIR)"`head -1 conf-bin`" < BIN
mkdir -p $(DESTDIR)"`head -n 1 conf-sbin`"
./install $(DESTDIR)"`head -1 conf-sbin`" < SBIN
mkdir -p $(DESTDIR)"`head -n 1 conf-libexec`/ezmlm"
./install $(DESTDIR)"`head -1 conf-libexec`/ezmlm" < LIBEXEC
mkdir -p $(DESTDIR)$(mandir)
./install $(DESTDIR)$(mandir) < MAN

Expand Down Expand Up @@ -272,6 +276,15 @@ warn-auto.sh
> ezmlm-queue
chmod 755 ezmlm-queue

checkrecipient-ezmlm: warn-auto.sh checkrecipient-ezmlm.sh \
conf-prefix conf-sysconfdir conf-libexec
cat warn-auto.sh checkrecipient-ezmlm.sh \
| sed s}PREFIX}"`head -1 conf-prefix`"}g \
| sed s}SYSCONFDIR}"`head -1 conf-sysconfdir`"}g \
| sed s}LIBEXEC}"`head -1 conf-libexec`"}g \
> checkrecipient-ezmlm
chmod 755 checkrecipient-ezmlm

ezmlm-queue.1: ezmlm-queue.9 conf-sysconfdir conf-qmail
cat ezmlm-queue.9 \
| sed s}SYSCONFDIR}"`head -1 conf-sysconfdir`"}g \
Expand Down
1 change: 1 addition & 0 deletions ezmlm-x/Makevars.DARWIN
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ prefix = $(shell head -1 conf-prefix 2>/dev/null)
qmaildir = $(shell head -1 conf-qmail 2>/dev/null)
mandir = $(shell [ -d "`head -1 conf-prefix`"/share/man ] && echo "`head -1 conf-prefix`/share/man" || echo "`head -1 conf-prefix`/man")
sysconfdir = $(shell head -1 conf-sysconfdir 2>/dev/null)
libexecdir = $(shell head -1 conf-libexec 2>/dev/null)
version = $(shell cat conf-version)
release = $(shell cat conf-release 2>/dev/null ||echo "1.1")
email = $(shell cat conf-email)
Expand Down
1 change: 1 addition & 0 deletions ezmlm-x/Makevars.FREEBSD
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ prefix != head -1 conf-prefix 2>/dev/null
qmaildir != head -1 conf-qmail 2>/dev/null
mandir != [ -d "`head -1 conf-prefix`"/man ] && echo "`head -1 conf-prefix`/man" || echo "`head -1 conf-prefix`/share/man"
sysconfdir != head -1 conf-sysconfdir 2>/dev/null
libexecdir != head -1 conf-libexec 2>/dev/null
version != cat conf-version
release != cat conf-release 2>/dev/null ||echo "1.1"
email != cat conf-email
Expand Down
1 change: 1 addition & 0 deletions ezmlm-x/Makevars.LINUX
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ prefix = $(shell head -1 conf-prefix 2>/dev/null)
qmaildir = $(shell head -1 conf-qmail 2>/dev/null)
mandir = $(shell [ -d "`head -1 conf-prefix`"/man ] && echo "`head -1 conf-prefix`/man" || echo "`head -1 conf-prefix`/share/man")
sysconfdir = $(shell head -1 conf-sysconfdir 2>/dev/null)
libexecdir = $(shell head -1 conf-libexec 2>/dev/null)
version = $(shell cat conf-version)
release = $(shell cat conf-release 2>/dev/null ||echo "1.1")
email = $(shell cat conf-email 2>/dev/null)
Expand Down
32 changes: 32 additions & 0 deletions ezmlm-x/checkrecipient-ezmlm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#
# This is a Pluggable Address Module for qmail-smtpd
# recipients extension
# This module reads an address from descriptor 3
# if addr is an address configured in ezmlm/ezmlm-idx
# It needs to be called using the qmail-smtpd recipient
# extension in SYSCONFDIR/control/recipients
# like this
#
# @domain|LIBEXEC/ezmlm/checkrecipient-ezmlm
# or
# user|LIBEXEC/ezmlm/checkrecipient-ezmlm
#
exec 0<&3
read addr

domain=$(echo $addr|cut -d@ -f2)
if [ -z "$domain" ] ; then # mail to local user
user=$addr
# get the user's home directory
dir=$(getent passwd $user | awk -F: '{print $6}')
else
# check if this is one of our domains
grep $domain SYSCONFDIR/control/rcpthosts >/dev/null 2>&1
[ $? -ne 0 ] && exit 1
user=$(echo $addr | cut -d@ -f1)
# get the domain directory
dir=$(grep "+""$domain""-" SYSCONFDIR/users/assign | awk -F: '{print $5}' 2>/dev/null)
fi

# check if ezmlm list exists
[ -n "$dir" -a -d "$dir/$user" ] && exit 0 || exit 1
1 change: 1 addition & 0 deletions ezmlm-x/conf-libexec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/usr/libexec
2 changes: 1 addition & 1 deletion ezmlm-x/conf-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0
1.1
7 changes: 4 additions & 3 deletions ezmlm-x/debian/ezmlm.install
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
usr/bin /usr
usr/sbin /usr
usr/share/man /usr/share
usr/bin /usr
usr/sbin /usr
usr/share/man /usr/share
usr/libexec/ezmlm /usr/libexec
1 change: 1 addition & 0 deletions ezmlm-x/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ rm=/bin/rm
prefix=/usr
mandir=${prefix}/share/man
sysconfdir=$(shell head -1 conf-sysconfdir)
libexecdir=$(shell head -1 conf-libexec)
version=$(shell cat conf-version)
email=$(shell cat conf-email)
DESTDIR=$(CURDIR)/debian/ezmlm.tmp
Expand Down
4 changes: 3 additions & 1 deletion ezmlm-x/doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
*
Release 1.1 Start 18/17/2021
Release 1.1 Start 24/07/2023
1. added checkrecipient-ezmlm Pluggable Address Module for qmail-smtpd
recipient extension

*
Release 1.0 Start 06/10/2018
Expand Down
2 changes: 2 additions & 0 deletions ezmlm-x/ezmlm.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
%endif
%global _prefix @prefix@
%global sysconfdir @sysconfdir@
%global libexecdir @libexecdir@
%global mandir @mandir@
%global ezdocdir @prefix@/share/doc/ezmlm
%if %build_on_obs == 1
Expand Down Expand Up @@ -138,6 +139,7 @@ find %{buildroot}%{mandir} -type f -exec gzip -q {} \;
%{_prefix}/bin/ezmlm-warn
%{_prefix}/bin/ezmlm-weed
%{_prefix}/sbin/ezmlm-queue
%{libexecdir}/ezmlm/checkrecipient-ezmlm
%{mandir}/man1/ezmlm-list.1.*
%{mandir}/man1/ezmlm-make.1.*
%{mandir}/man1/ezmlm-manage.1.*
Expand Down

0 comments on commit bc28385

Please sign in to comment.