Skip to content

Commit

Permalink
Fixed remove to clean up plugin entries in nsswitch.conf
Browse files Browse the repository at this point in the history
We weren't removing the tacplus plugin from nsswitch.conf on package remove,
now we do.

Also cleaned up a bit and use \s instead of [ \t] for whitespace.
For postinst, moved into configure case where it belonged.

Updated changelog for recent fixes and bumped version
  • Loading branch information
Dave Olson committed Jun 30, 2017
1 parent 6f721d9 commit 19008ab
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 8 deletions.
9 changes: 9 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
libnss-tacplus (1.0.3-2) unstable; urgency=low
* Fixed package remove to clean up plugin entries in nsswitch.conf
* New Disabled: added user_homedir config variable to allow per-user
home directories (unless per-command authorization is enabled)
* Fixed configuration files should automatically be reparsed
if they change, for long-lived programs and daemons that use NSS.

-- Dave Olson <[email protected]> Fri, 30 Jun 2017 13:34:20 -0700

libnss-tacplus (1.0.3-1) unstable; urgency=low
* Added config variable "timeout" to limit time attempting to
connect to non-responding TACACS server.
Expand Down
15 changes: 7 additions & 8 deletions debian/libnss-tacplus.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ set -e

case "$1" in
configure)
# Add tacplus to /etc/nsswitch.conf, since it's necessary
# for this package, and won't break anything else. Do nothing
# if tacplus is already present in the passwd line
if [ -e "/etc/nsswitch.conf" ]; then
sed -i -e '/tacplus\s/b' \
-e '/^passwd:/s/compat/tacplus &/' /etc/nsswitch.conf
fi
;;

abort-upgrade|abort-remove|abort-deconfigure)
Expand All @@ -18,14 +25,6 @@ case "$1" in
;;
esac

# Add tacplus to /etc/nsswitch.conf, since it's necessary
# for this package, and won't break anything else. Do nothing
# if tacplus is already present in the passwd line
if [ -e "/etc/nsswitch.conf" ]; then
sed -i -e '/tacplus/b' \
-e '/^passwd/s/compat/tacplus &/' /etc/nsswitch.conf
fi


#DEBHELPER#

Expand Down
13 changes: 13 additions & 0 deletions debian/libnss-tacplus.prerm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

set -e

if [ "$1" = remove ]; then
# Undo the addition of the plugin
if [ -e "/etc/nsswitch.conf" ]; then
sed -i -e '/^passwd:.*tacplus\s/s/tacplus\s//' \
/etc/nsswitch.conf || true # don't prevent remove on error
fi
fi

#DEBHELPER#

0 comments on commit 19008ab

Please sign in to comment.