test_ldapcmds.sh (nss-pam-ldapd-0.9.11) | : | test_ldapcmds.sh (nss-pam-ldapd-0.9.12) | ||
---|---|---|---|---|
#!/bin/sh | #!/bin/sh | |||
# test_ldapcmds.sh - simple test script to test lookups | # test_ldapcmds.sh - simple test script to test lookups | |||
# | # | |||
# Copyright (C) 2017-2019 Arthur de Jong | # Copyright (C) 2017-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 146 | skipping to change at line 146 | |||
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.ldap group testgroup | sortgroup" << EOM | check "getent.ldap group testgroup | sortgroup" << EOM | |||
testgroup:*:6100:arthur,test,testuser4 | testgroup:*:6100:test,testuser4,testusr1 | |||
EOM | EOM | |||
check "getent.ldap group users | sortgroup" << EOM | check "getent.ldap group users | sortgroup" << EOM | |||
users:*:100:arthur,test | users:*:100:test,testusr1 | |||
EOM | EOM | |||
# group with different case should not be found | # group with different case should not be found | |||
check "getent.ldap group TESTGROUP" << EOM | check "getent.ldap group TESTGROUP" << EOM | |||
EOM | EOM | |||
check "getent.ldap group 6100 | sortgroup" << EOM | check "getent.ldap group 6100 | sortgroup" << EOM | |||
testgroup:*:6100:arthur,test,testuser4 | testgroup:*:6100:test,testuser4,testusr1 | |||
EOM | EOM | |||
check "getent.ldap group.bymember arthur | sed 's/:.*//' | sort" << EOM | check "getent.ldap group.bymember testusr1 | sed 's/:.*//' | sort" << EOM | |||
grp10 | grp10 | |||
grp11 | grp11 | |||
grp12 | grp12 | |||
grp13 | grp13 | |||
grp14 | grp14 | |||
grp15 | grp15 | |||
grp16 | grp16 | |||
grp17 | grp17 | |||
grp18 | grp18 | |||
grp4 | grp4 | |||
skipping to change at line 188 | skipping to change at line 188 | |||
testgroup2 | testgroup2 | |||
users | users | |||
EOM | EOM | |||
check "getent.ldap group.bymember testuser4 | sed 's/:.*//' | sort" << EOM | check "getent.ldap group.bymember testuser4 | sed 's/:.*//' | sort" << EOM | |||
testgroup | testgroup | |||
testgroup2 | testgroup2 | |||
EOM | EOM | |||
check "getent.ldap group | egrep '^(testgroup|users):' | sortgroup" << EOM | check "getent.ldap group | egrep '^(testgroup|users):' | sortgroup" << EOM | |||
testgroup:*:6100:arthur,test,testuser4 | testgroup:*:6100:test,testuser4,testusr1 | |||
users:*:100:arthur,test | users:*:100:test,testusr1 | |||
EOM | EOM | |||
check "getent.ldap group | wc -l" << EOM | check "getent.ldap group | wc -l" << EOM | |||
23 | 23 | |||
EOM | EOM | |||
check "getent.ldap group | grep ^largegroup | sortgroup" << EOM | check "getent.ldap 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 301 | skipping to change at line 301 | |||
check "getent.ldap hostsv6 192.0.2.124" << EOM | check "getent.ldap hostsv6 192.0.2.124" << EOM | |||
EOM | EOM | |||
########################################################################### | ########################################################################### | |||
echo "test_ldapcmds.sh: testing netgroup..." | echo "test_ldapcmds.sh: testing netgroup..." | |||
# check netgroup lookup of test netgroup | # check netgroup lookup of test netgroup | |||
check "getent.ldap netgroup tstnetgroup" << EOM | check "getent.ldap 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.ldap netgroup TSTNETGROUP" << EOM | check "getent.ldap netgroup TSTNETGROUP" << EOM | |||
EOM | EOM | |||
# check netgroup lookup of test netgroup without recursion | # check netgroup lookup of test netgroup without recursion | |||
check "getent.ldap netgroup.norec tstnetgroup" << EOM | check "getent.ldap netgroup.norec tstnetgroup" << EOM | |||
tstnetgroup tst3netgroup tst2netgroup (, arthur, ) | tstnetgroup tst3netgroup tst2netgroup (, testusr1, ) | |||
EOM | EOM | |||
########################################################################### | ########################################################################### | |||
echo "test_ldapcmds.sh: testing networks..." | echo "test_ldapcmds.sh: testing networks..." | |||
check "getent.ldap networks testnet" << EOM | check "getent.ldap networks testnet" << EOM | |||
testnet 192.0.2.0 | testnet 192.0.2.0 | |||
EOM | EOM | |||
skipping to change at line 342 | skipping to change at line 342 | |||
EOM | EOM | |||
########################################################################### | ########################################################################### | |||
echo "test_ldapcmds.sh: testing passwd..." | echo "test_ldapcmds.sh: testing passwd..." | |||
check "getent.ldap passwd ecolden | sed 's/:[x*]:/:x:/'" << EOM | check "getent.ldap 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.ldap passwd arthur | sed 's/:[x*]:/:x:/'" << EOM | check "getent.ldap 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.ldap passwd ARTHUR" << EOM | check "getent.ldap passwd TESTUSR1" << EOM | |||
EOM | EOM | |||
check "getent.ldap passwd 4089 | sed 's/:[x*]:/:x:/'" << EOM | check "getent.ldap 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.ldap passwd | grep -c ':[x*]:[45][0-9][0-9][0-9]:'" << EOM | check "getent.ldap passwd | grep -c ':[x*]:[45][0-9][0-9][0-9]:'" << EOM | |||
2000 | 2000 | |||
EOM | EOM | |||
End of changes. 10 change blocks. | ||||
12 lines changed or deleted | 12 lines changed or added |