~ubuntu-branches/ubuntu/precise/nss-pam-ldapd/precise-security

« back to all changes in this revision

Viewing changes to debian/libnss-ldapd.postrm

  • Committer: Package Import Robot
  • Author(s): Arthur de Jong
  • Date: 2011-09-04 21:00:00 UTC
  • mfrom: (14.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20110904210000-pe3u91iga88vtr16
Tags: 0.8.4
* Upload to unstable
* switch to using the member attribute by default instead of
  uniqueMember (backwards incompatible change)
* only return "x" as a password hash when the object has the shadowAccount
  objectClass and nsswitch.conf is configured to do shadow lookups using
  LDAP (this avoids some problems with pam_unix)
* fix problem with partial attribute name matches in DN (thanks Timothy
  White)
* fix a problem with objectSid mappings with recent versions of OpenLDAP
  (patch by Wesley Mason)
* set the socket timeout in a connection callback to avoid timeout
  issues during the SSL handshake (patch by Stefan Völkel)
* check for unknown variables in pam_authz_search
* only check password expiration when authenticating, only check account
  expiration when doing authorisation
* make buffer sizes consistent and grow all buffers holding string
  representations of numbers to be able to hold 64-bit numbers
* update AX_PTHREAD from autoconf-archive
* support querying DNS SRV records from a different domain than the current
  one (based on a patch by James M. Leddy)
* fix a problem with uninitialised memory while parsing the tls_ciphers
  option (closes: #638872) (but doesn't work yet due to #640384)
* implement bounds checking of numeric values read from LDAP (patch by
  Jakub Hrozek)
* correctly support large uid and gid values from LDAP (patch by Jakub
  Hrozek)
* improvements to the configure script (patch by Jakub Hrozek)
* switch to dh for debian/rules and bump debhelper compatibility to 8
* build Debian packages with multiarch support
* ship shlibs (but still no symbol files) for libnss-ldapd since that was
  the easiest way to support multiarch
* fix output in init script when restarting nslcd (closes: #637132)
* correctly handle leading and trailing spaces in preseeded debconf uri
  option (patch by Andreas B. Mundt) (closes: #637863)
* support spaces around database names in /etc/nsswitch.conf while
  configuring package (closes: #640185)
* updated Russian debconf translation by Yuri Kozlov (closes: #637751)
* updated French debconf translation by Christian Perrier (closes: #637756)
* added Slovak debconf translation by Slavko (closes: #637759)
* updated Danish debconf translation by Joe Hansen (closes :#637763)
* updated Brazilian Portuguese debconf translation by Denis Doria
* updated Portuguese debconf translation by Américo Monteiro
* updated Japanese debconf translation by Kenshi Muto (closes: #638195)
* updated Czech debconf translation by Miroslav Kure (closes: #639026)
* updated German debconf translation by Chris Leick (closes: #639107)
* updated Spanish debconf translation by Francisco Javier Cuadrado
  (closes: #639236)
* updated Dutch debconf translation by Arthur de Jong with help from Paul
  Gevers and Jeroen Schot

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
set -e
4
4
 
 
5
# find the names of services that are configured to use LDAP
 
6
# Note: this function is in libnss-ldapd.config and libnss-ldapd.postrm
 
7
nss_list_configured()
 
8
{
 
9
  sed -n \
 
10
      's/^[[:space:]]*\([a-z]*\)[[:space:]]*:.*[[:space:]]ldap\([[:space:]].*\)\?/\1/p' \
 
11
      /etc/nsswitch.conf
 
12
}
 
13
 
 
14
# check whether the name is configure to do lookups through
 
15
# LDAP
 
16
# Note: this function is in libnss-ldapd.postinst, libnss-ldapd.postrm
 
17
#       and libpam-ldapd.postinst
 
18
nss_is_enabled()
 
19
{
 
20
  name="$1"
 
21
  grep -q '^[[:space:]]*'$name'[[:space:]]*:.*ldap.*' /etc/nsswitch.conf
 
22
}
 
23
 
5
24
# remove NSS lookups though LDAP for the specified service
6
 
# Note: this function is in both libnss-ldapd.postinst and libnss-ldapd.postrm
 
25
# Note: this function is in libnss-ldapd.postinst and libnss-ldapd.postrm
7
26
nss_disable()
8
27
{
9
28
  name="$1"
10
29
  # these functions also remove the lookup result handling part
11
30
  # of the ldap entry (see nsswitch.conf(5))
12
 
  if grep -q '^'$name':.*ldap.*' /etc/nsswitch.conf
 
31
  if nss_is_enabled "$name"
13
32
  then
14
33
    echo "/etc/nsswitch.conf: disable LDAP lookups for $name" >&2
15
 
    if [ -n "`sed -n '/^'$name':[[:space:]]*ldap[[:space:]]*\(\[[^]]*\]\)*[[:space:]]*$/p' /etc/nsswitch.conf`" ]
 
34
    if [ -n "`sed -n '/^[[:space:]]*'$name'[[:space:]]*:[[:space:]]*ldap[[:space:]]*\(\[[^]]*\]\)*[[:space:]]*$/p' /etc/nsswitch.conf`" ]
16
35
    then
17
36
      # the name service only maps to ldap, remove the whole line
18
 
      sed -i '/^'$name':[[:space:]]*ldap[[:space:]]*\(\[[^]]*\]\)*[[:space:]]*$/d' /etc/nsswitch.conf
 
37
      sed -i '/^[[:space:]]*'$name'[[:space:]]*:[[:space:]]*ldap[[:space:]]*\(\[[^]]*\]\)*[[:space:]]*$/d' /etc/nsswitch.conf
19
38
    else
20
39
      # remove ldap part from existing line, keeping other methods intact
21
40
      # TODO: remove trailing space
22
 
      sed -i 's/^\('$name':.*\)ldap[[:space:]]*\(\[[^]]*\]\)*[[:space:]]*\(.*\)$/\1\3/' /etc/nsswitch.conf
 
41
      sed -i 's/^\([[:space:]]*'$name'[[:space:]]*:.*\)ldap[[:space:]]*\(\[[^]]*\]\)*[[:space:]]*\(.*\)$/\1\3/' /etc/nsswitch.conf
23
42
    fi
 
43
    # invalidate nscd cache
 
44
    nscd -i "$name" > /dev/null 2>&1 || true
24
45
  fi
25
46
  # we're done
26
47
  return 0
30
51
if ( [ "$1" = "remove" ] || [ "$1" = "purge" ] )
31
52
then
32
53
  # check which naming services are configured
33
 
  configured=`sed -n 's/^\([a-z]*\):.*[[:space:]]ldap\([[:space:]].*\)\?/\1/p' /etc/nsswitch.conf`
 
54
  configured=`nss_list_configured`
34
55
  if [ -n "$configured" ]
35
56
  then
36
57
    # if we have debconf, use debconf to ask, otherwise just shout
54
75
        fi
55
76
      fi
56
77
      # re-check which services are left enabled
57
 
      configured=`sed -n 's/^\([a-z]*\):.*[[:space:]]ldap\([[:space:]].*\)\?/\1/p' /etc/nsswitch.conf`
 
78
      configured=`nss_list_configured`
58
79
    fi
59
80
    # check if ldap is still configured
60
81
    if [ -n "$configured" ]