[Pkg-samba-maint] [Git][samba-team/samba][master] 2 commits: d/control: winbind should depend on the same binary:Version of libwbclient

Michael Tokarev (@mjt) gitlab at salsa.debian.org
Thu Dec 1 19:39:22 GMT 2022



Michael Tokarev pushed to branch master at Debian Samba Team / samba


Commits:
23e3c41d by Michael Tokarev at 2022-12-01T21:17:44+03:00
d/control: winbind should depend on the same binary:Version of libwbclient

Without this dependency, shlib:Depends asks for libwbclient0 >= 2:4.5.0+dfsg,
but that one used different wbclient <=> winbind protocol, so any wbinfo
run resulted in something like

 failed to call wbcGetpwnam: WBC_ERR_WINBIND_NOT_AVAILABLE

Thank you Stefan Weichinger for the patience while finding this one!

- - - - -
32b93eda by Michael Tokarev at 2022-12-01T22:35:54+03:00
libnss-winbind: add postinst/postrm scripts to add/remove nsswitch.conf entry

Theres dh-sequence-installnss in bookworm+, but it mjt dislikes
that one, - it is trivial to do that in plain sed.

- - - - -


3 changed files:

- debian/control
- + debian/libnss-winbind.postinst
- + debian/libnss-winbind.postrm


Changes:

=====================================
debian/control
=====================================
@@ -352,6 +352,8 @@ Multi-Arch: allowed
 Depends: lsb-base (>= 3.0-6),
          samba-common (= ${source:Version}),
          samba-common-bin (=${binary:Version}),
+# wbinfo (linked with libwbclient) which should use the same protocol
+         libwbclient0 (=${binary:Version}),
 # for groupadd in postinst
          passwd,
          ${misc:Depends},


=====================================
debian/libnss-winbind.postinst
=====================================
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+set -e
+
+# Try to add the nss entry to the "passwd" and "group" lines in
+# /etc/nsswitch.conf to automatically enable libnss-winbind support;
+# do not change the configuration if the lines already contain "winbind"
+# Only add winbind, not wins, since the latter is of little use in 2022+
+
+if [ "$1" = configure ] && [ -z "$2" ]; then
+    echo "First installation detected, adding winbind to /etc/nsswitch.conf..."
+    if ! [ -e /etc/nsswitch.conf ]; then
+        echo "Could not find /etc/nsswitch.conf."
+    else
+        sed -r -i \
+          -e  '/^(passwd|group):.*[[:space:]]winbind\b/b' \
+          -e 's/^(passwd|group):.*/& winbind/' \
+          /etc/nsswitch.conf
+    fi
+fi


=====================================
debian/libnss-winbind.postrm
=====================================
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+set -e
+
+remove_nss_entry() {
+    local file=$1
+    local pkg=$2
+    local module=$3
+    refcount=$(dpkg-query -f '${db:Status-Abbrev} ${binary:Package}\n' \
+        -W $pkg | grep '^i' | wc -l)
+    if [ "$refcount" -gt 0 ] ; then
+        # package is installed for other architectures still, do nothing
+        return
+    fi
+    # abort if file does not exist
+    if ! [ -e $file ]; then
+        echo "Could not find ${file}."
+        return
+    fi
+    echo "Removing $module from $file if any..."
+    # we must remove possible [foo=bar] options as well
+    sed -i -r "/(passwd|group):/ s/[[:space:]]+$module\b([[:space:]]*\[[^]]*\])*//" $file
+}
+
+if [ "$1" = remove ]; then
+    remove_nss_entry /etc/nsswitch.conf libnss-winbind winbind
+fi



View it on GitLab: https://salsa.debian.org/samba-team/samba/-/compare/244eecedaa7e790b169a384ec9fc93d73b8a1c15...32b93eda5f9d879d8c0a0390414987eb906b8fec

-- 
View it on GitLab: https://salsa.debian.org/samba-team/samba/-/compare/244eecedaa7e790b169a384ec9fc93d73b8a1c15...32b93eda5f9d879d8c0a0390414987eb906b8fec
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-samba-maint/attachments/20221201/a92536b9/attachment-0001.htm>


More information about the Pkg-samba-maint mailing list