[packages/opensmtpd] registered smtpd/smtpq uid/gids

glen glen at pld-linux.org
Sun Nov 3 00:14:07 CET 2013


commit 7f0d62147510cff8ba146972c9aca7795461e850
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Sun Nov 3 01:13:57 2013 +0200

    registered smtpd/smtpq uid/gids

 opensmtpd.spec | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)
---
diff --git a/opensmtpd.spec b/opensmtpd.spec
index dd61e04..3595941 100644
--- a/opensmtpd.spec
+++ b/opensmtpd.spec
@@ -1,5 +1,4 @@
 # TODO
-# - allocate uid/gid
 # - should mailq and newalises be in bindir?
 
 # Conditional build:
@@ -30,8 +29,18 @@ BuildRequires:	openssl-devel
 BuildRequires:	rpmbuild(macros) >= 1.228
 BuildRequires:	zlib-devel
 Requires(post,preun):	/sbin/chkconfig
+Requires(postun):	/usr/sbin/groupdel
+Requires(postun):	/usr/sbin/userdel
+Requires(pre):	/bin/id
+Requires(pre):	/usr/bin/getgid
+Requires(pre):	/usr/sbin/groupadd
+Requires(pre):	/usr/sbin/useradd
 Requires:	rc-scripts
+Provides:	group(smtpd)
+Provides:	group(smtpq)
 Provides:	smtpdaemon
+Provides:	user(smtpd)
+Provides:	user(smtpq)
 Obsoletes:	smtpdaemon
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -87,12 +96,10 @@ mv $RPM_BUILD_ROOT{%{_bindir},%{_prefix}/lib}/sendmail
 rm -rf $RPM_BUILD_ROOT
 
 %pre
-%if 0
-%groupadd -r smtpd
-%groupadd -r smtpq
-%useradd -r -g smtpd -s /sbin/nologin -c "OpenSMTPd privsep user" -d %{_privsepdir} smtpd
-%useradd -r -g smtpq -s /sbin/nologin -c "OpenSMTPd queue user" -d %{_privsepdir} smtpq
-%endif
+%groupadd -g 297 smtpd
+%groupadd -g 298 smtpq
+%useradd -u 297 -g smtpd -s /sbin/nologin -c "OpenSMTPd privsep user" -d %{_privsepdir} smtpd
+%useradd -u 298 -g smtpq -s /sbin/nologin -c "OpenSMTPd queue user" -d %{_privsepdir} smtpq
 
 %post
 /sbin/chkconfig --add %{name}
@@ -107,6 +114,12 @@ fi
 %systemd_preun %{name}.service
 
 %postun
+if [ "$1" = "0" ]; then
+	%userremove smtpd
+	%userremove smtpq
+	%groupremove smtpd
+	%groupremove smtpq
+fi
 %systemd_reload
 
 %files
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/opensmtpd.git/commitdiff/7f0d62147510cff8ba146972c9aca7795461e850



More information about the pld-cvs-commit mailing list