Bug#1030923: [PATCH] debian/postinst: Use '--force-badname' option if 'adduser' package version is below '3.122'.

2024-02-01 Thread Mike Gabriel

Control: close -1
Control: fixed -1 0.0.1+git20230316.f1bd0f1-1

On  Do 09 Feb 2023 12:25:49 CET, Daniel Teichmann wrote:


Otherwise use '--allow-bad-names' option (if adduser version is new enough).
Fixes: https://bugs.debian.org/1030923
---
 debian/postinst | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/debian/postinst b/debian/postinst
index bd92aa1..56c44ce 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -23,10 +23,18 @@ case "${1}" in
 # setup mDNS Reflector system user account
 if ! getent 'passwd' '_mdns.reflector' >'/dev/null'; then
 echo 'Creating _mdns.reflector system user.' >&2
+# if adduser >= 3.122; then use --allow-bad-names
+# if not; then use --force-badname
+badname_option="--allow-bad-names"
+version=`dpkg-query --show  
--showformat='${Version}' adduser`
+if dpkg --compare-versions "$version" "lt"  
"3.122"; then

+badname_option="--force-badname"
+fi
+
 adduser --system --no-create-home \
 --disabled-password --disabled-login \
 --shell /bin/false --group --home  
/dev/null \

---allow-bad-names _mdns.reflector
+"$badname_option" _mdns.reflector
 fi

 # Enable cap_net_raw+ep for the mdns-reflector binary
--
2.30.2


This patch has been shipped since 0.0.1+git20230316.f1bd0f1-1. Closing  
this issue.


Mike
--

mike gabriel aka sunweaver (Debian Developer)
mobile: +49 (1520) 1976 148
landline: +49 (4351) 486 14 27

GnuPG Fingerprint: 9BFB AEE8 6C0A A5FF BF22  0782 9AF4 6B30 2577 1B31
mail: sunwea...@debian.org, http://sunweavers.net



pgpc6FHa6YMiL.pgp
Description: Digitale PGP-Signatur


Bug#1030923: [PATCH] debian/postinst: Use '--force-badname' option if 'adduser' package version is below '3.122'.

2023-02-09 Thread Daniel Teichmann
Otherwise use '--allow-bad-names' option (if adduser version is new enough).
Fixes: https://bugs.debian.org/1030923
---
 debian/postinst | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/debian/postinst b/debian/postinst
index bd92aa1..56c44ce 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -23,10 +23,18 @@ case "${1}" in
 # setup mDNS Reflector system user account
 if ! getent 'passwd' '_mdns.reflector' >'/dev/null'; then
 echo 'Creating _mdns.reflector system user.' >&2
+# if adduser >= 3.122; then use --allow-bad-names
+# if not; then use --force-badname
+badname_option="--allow-bad-names"
+version=`dpkg-query --show --showformat='${Version}' 
adduser`
+if dpkg --compare-versions "$version" "lt" "3.122"; 
then
+badname_option="--force-badname"
+fi
+
 adduser --system --no-create-home \
 --disabled-password --disabled-login \
 --shell /bin/false --group --home /dev/null \
---allow-bad-names _mdns.reflector
+"$badname_option" _mdns.reflector
 fi
 
 # Enable cap_net_raw+ep for the mdns-reflector binary
-- 
2.30.2