"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/test_nsscmds.sh" between
nss-pam-ldapd-0.9.11.tar.gz and nss-pam-ldapd-0.9.12.tar.gz

About: nss-pam-ldapd is a Name Service Switch (NSS) module and Pluggable Authentication Module (PAM) that allows your LDAP server to provide user account, group, host name, alias, netgroup, and basically any other information that you would normally get from /etc flat files or NIS. It also allows you to do authentication to an LDAP server.

test_nsscmds.sh  (nss-pam-ldapd-0.9.11):test_nsscmds.sh  (nss-pam-ldapd-0.9.12)
#!/bin/sh #!/bin/sh
# test_nsscmds.sh - simple test script to check output of name lookup commands # test_nsscmds.sh - simple test script to check output of name lookup commands
# #
# Copyright (C) 2007-2017 Arthur de Jong # Copyright (C) 2007-2021 Arthur de Jong
# #
# This library is free software; you can redistribute it and/or # This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either # License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version. # version 2.1 of the License, or (at your option) any later version.
# #
# This library is distributed in the hope that it will be useful, # This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details. # Lesser General Public License for more details.
skipping to change at line 152 skipping to change at line 152
while read line while read line
do do
group="`echo "$line" | sed 's/^\([^:]*:[^:]*:[^:]*\).*$/\1:/'`" group="`echo "$line" | sed 's/^\([^:]*:[^:]*:[^:]*\).*$/\1:/'`"
members="`echo "$line" | sed -n 's/^[^:]*:[^:]*:[^:]*:\(.*\)$/\1/p' | tr ',' '\n' | sort | tr '\n' ','`" members="`echo "$line" | sed -n 's/^[^:]*:[^:]*:[^:]*:\(.*\)$/\1/p' | tr ',' '\n' | sort | tr '\n' ','`"
members="`echo "$members" | sed 's/,$//'`" members="`echo "$members" | sed 's/,$//'`"
echo "${group}${members}" echo "${group}${members}"
done done
} }
check "getent group testgroup | sortgroup" << EOM check "getent group testgroup | sortgroup" << EOM
testgroup:*:6100:arthur,test,testuser4 testgroup:*:6100:test,testuser4,testusr1
EOM EOM
# this does not work because users is in /etc/group but it would # this does not work because users is in /etc/group but it would
# be nice if libc supported this # be nice if libc supported this
#check "getent group users" << EOM #check "getent group users" << EOM
#users:*:100:arthur,test #users:*:100:testusr1,test
#EOM #EOM
# group with different case should not be found # group with different case should not be found
check "getent group TESTGROUP" << EOM check "getent group TESTGROUP" << EOM
EOM EOM
check "getent group 6100 | sortgroup" << EOM check "getent group 6100 | sortgroup" << EOM
testgroup:*:6100:arthur,test,testuser4 testgroup:*:6100:test,testuser4,testusr1
EOM EOM
check "groups arthur | sed 's/^.* *: *//' | sed 's/ debci//'" << EOM check "groups testusr1 | sed 's/^.* *: *//'" << EOM
users testgroup testgroup2 grp4 grp5 grp6 grp7 grp8 grp9 grp10 grp11 grp12 grp13 grp14 grp15 grp16 grp17 grp18 users testgroup testgroup2 grp4 grp5 grp6 grp7 grp8 grp9 grp10 grp11 grp12 grp13 grp14 grp15 grp16 grp17 grp18
EOM EOM
check "groups testuser4 | sed 's/^.* *: *//'" << EOM check "groups testuser4 | sed 's/^.* *: *//'" << EOM
users testgroup testgroup2 users testgroup testgroup2
EOM EOM
check "getent group | egrep '^(testgroup|users|root):' | sortgroup" << EOM check "getent group | egrep '^(testgroup|users|root):' | sortgroup" << EOM
$(egrep '^(testgroup|users|root):' /etc/group) $(egrep '^(testgroup|users|root):' /etc/group)
testgroup:*:6100:arthur,test,testuser4 testgroup:*:6100:test,testuser4,testusr1
users:*:100:arthur,test users:*:100:test,testusr1
EOM EOM
check "getent group | wc -l" << EOM check "getent group | wc -l" << EOM
`grep -c '^[^#].*:' /etc/group | awk '{print $1 + 23}'` `grep -c '^[^#].*:' /etc/group | awk '{print $1 + 23}'`
EOM EOM
check "getent group | grep ^largegroup | sortgroup" << EOM check "getent group | grep ^largegroup | sortgroup" << EOM
largegroup:*:1005:akraskouskas,alat,ameisinger,bdevera,behrke,bmoldan,btempel,cj ody,clouder,cmanno,dbye,dciviello,dfirpo,dgivliani,dgosser,emcquiddy,enastasi,fc unard,gcubbison,gdaub,gdreitzler,ghanauer,gpomerance,gsusoev,gtinnel,gvollrath,g zuhlke,hgalavis,hhaffey,hhydrick,hmachesky,hpaek,hpolk,hsweezer,htomlinson,hzaga mi,igurwell,ihashbarger,jyeater,kbradbury,khathway,kklavetter,lbuchtel,lgandee,l khubba,lmauracher,lseehafer,lvittum,mblanchet,mbodley,mciaccia,mjuris,ndipanfilo ,nfilipek,nfunchess,ngata,ngullett,nkraker,nriofrio,nroepke,nrybij,oclunes,oebra ni,okveton,osaines,otrevor,pdossous,phaye,psowa,purquilla,rkoonz,rlatessa,rworko wski,sdebry,sgurski,showe,slaforge,tabdelal,testusr2,testusr3,tfalconeri,tpaa,us chweyen,utrezize,vchevalier,vdelnegro,vleyton,vmedici,vmigliori,vpender,vwaltman n,wbrettschneide,wselim,wvalcin,wworf,yautin,ykisak,zgingrich,znightingale,zwint erbottom largegroup:*:1005:akraskouskas,alat,ameisinger,bdevera,behrke,bmoldan,btempel,cj ody,clouder,cmanno,dbye,dciviello,dfirpo,dgivliani,dgosser,emcquiddy,enastasi,fc unard,gcubbison,gdaub,gdreitzler,ghanauer,gpomerance,gsusoev,gtinnel,gvollrath,g zuhlke,hgalavis,hhaffey,hhydrick,hmachesky,hpaek,hpolk,hsweezer,htomlinson,hzaga mi,igurwell,ihashbarger,jyeater,kbradbury,khathway,kklavetter,lbuchtel,lgandee,l khubba,lmauracher,lseehafer,lvittum,mblanchet,mbodley,mciaccia,mjuris,ndipanfilo ,nfilipek,nfunchess,ngata,ngullett,nkraker,nriofrio,nroepke,nrybij,oclunes,oebra ni,okveton,osaines,otrevor,pdossous,phaye,psowa,purquilla,rkoonz,rlatessa,rworko wski,sdebry,sgurski,showe,slaforge,tabdelal,testusr2,testusr3,tfalconeri,tpaa,us chweyen,utrezize,vchevalier,vdelnegro,vleyton,vmedici,vmigliori,vpender,vwaltman n,wbrettschneide,wselim,wvalcin,wworf,yautin,ykisak,zgingrich,znightingale,zwint erbottom
EOM EOM
skipping to change at line 298 skipping to change at line 298
fi # end of hosts tests fi # end of hosts tests
########################################################################### ###########################################################################
if grep '^netgroup.*ldap' /etc/nsswitch.conf > /dev/null 2>&1 if grep '^netgroup.*ldap' /etc/nsswitch.conf > /dev/null 2>&1
then then
echo "test_nsscmds.sh: testing netgroup..." echo "test_nsscmds.sh: testing netgroup..."
# check netgroup lookup of test netgroup # check netgroup lookup of test netgroup
check "getent netgroup tstnetgroup" << EOM check "getent netgroup tstnetgroup" << EOM
tstnetgroup ( , arthur, ) (noot, , ) tstnetgroup ( , testusr1, ) (noot, , )
EOM EOM
# check netgroup lookup with different case # check netgroup lookup with different case
check "getent netgroup TSTNETGROUP" << EOM check "getent netgroup TSTNETGROUP" << EOM
EOM EOM
fi # end of netgroup tests fi # end of netgroup tests
########################################################################### ###########################################################################
skipping to change at line 342 skipping to change at line 342
########################################################################### ###########################################################################
if grep '^passwd.*ldap' /etc/nsswitch.conf > /dev/null 2>&1 if grep '^passwd.*ldap' /etc/nsswitch.conf > /dev/null 2>&1
then then
echo "test_nsscmds.sh: testing passwd..." echo "test_nsscmds.sh: testing passwd..."
check "getent passwd ecolden | sed 's/:[x*]:/:x:/'" << EOM check "getent passwd ecolden | sed 's/:[x*]:/:x:/'" << EOM
ecolden:x:5972:1000:Estelle Colden:/home/ecolden:/bin/bash ecolden:x:5972:1000:Estelle Colden:/home/ecolden:/bin/bash
EOM EOM
check "getent passwd arthur | sed 's/:[x*]:/:x:/'" << EOM check "getent passwd testusr1 | sed 's/:[x*]:/:x:/'" << EOM
arthur:x:1000:100:Arthur de Jong:/home/arthur:/bin/bash testusr1:x:1007:100:Arthur de Jong:/home/testusr1:/bin/bash
EOM EOM
# check username with different case # check username with different case
check "getent passwd ARTHUR" << EOM check "getent passwd TESTUSR1" << EOM
EOM EOM
check "getent passwd 4089 | sed 's/:[x*]:/:x:/'" << EOM check "getent passwd 4089 | sed 's/:[x*]:/:x:/'" << EOM
jguzzetta:x:4089:1000:Josephine Guzzetta:/home/jguzzetta:/bin/bash jguzzetta:x:4089:1000:Josephine Guzzetta:/home/jguzzetta:/bin/bash
EOM EOM
# count the number of passwd entries in the 4000-5999 range # count the number of passwd entries in the 4000-5999 range
check "getent passwd | grep -c ':[x*]:[45][0-9][0-9][0-9]:'" << EOM check "getent passwd | grep -c ':[x*]:[45][0-9][0-9][0-9]:'" << EOM
2000 2000
EOM EOM
 End of changes. 9 change blocks. 
11 lines changed or deleted 11 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)