1#!/bin/sh 2 3# test_nsscmds.sh - simple test script to check output of name lookup commands 4# 5# Copyright (C) 2007-2017 Arthur de Jong 6# 7# This library is free software; you can redistribute it and/or 8# modify it under the terms of the GNU Lesser General Public 9# License as published by the Free Software Foundation; either 10# version 2.1 of the License, or (at your option) any later version. 11# 12# This library is distributed in the hope that it will be useful, 13# but WITHOUT ANY WARRANTY; without even the implied warranty of 14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15# Lesser General Public License for more details. 16# 17# You should have received a copy of the GNU Lesser General Public 18# License along with this library; if not, write to the Free Software 19# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 20# 02110-1301 USA 21 22# This script expects to be run in an environment where nss-pam-ldapd 23# is deployed with an LDAP server with the proper content (and nslcd running). 24# It's probably best to run this in an environment without nscd (this breaks 25# the services tests). 26 27set -e 28 29# find source directory 30srcdir="${srcdir-`dirname "$0"`}" 31builddir="${builddir-`dirname "$0"`}" 32top_builddir="${top_builddir-${builddir}/..}" 33 34# ensure that we are running in the test environment 35"$srcdir/testenv.sh" check || exit 77 36 37# preload our own NSS module 38if [ -e "$top_builddir/nss/nss_ldap.so" ] 39then 40 LD_PRELOAD="$top_builddir/nss/nss_ldap.so" 41 export LD_PRELOAD 42fi 43 44# the total number of errors 45FAIL=0 46 47check() { 48 # the command to execute 49 cmd="$1" 50 # save the expected output 51 expectfile=`mktemp -t expected.XXXXXX 2> /dev/null || tempfile -s .expected 2> /dev/null` 52 cat > "$expectfile" 53 # run the command 54 echo 'test_nsscmds.sh: checking "'"$cmd"'"' 55 actualfile=`mktemp -t actual.XXXXXX 2> /dev/null || tempfile -s .actual 2> /dev/null` 56 eval "$cmd" > "$actualfile" 2>&1 || true 57 # check for differences 58 diff -Nauwi "$expectfile" "$actualfile" || FAIL=`expr $FAIL + 1` 59 # remove temporary files 60 rm "$expectfile" "$actualfile" 61} 62 63########################################################################### 64 65if grep '^aliases.*ldap' /etc/nsswitch.conf > /dev/null 2>&1 66then 67echo "test_nsscmds.sh: testing aliases..." 68 69# note that this doesn't work if /etc/aliases contains anything 70 71# check all aliases 72check "getent aliases|sort" << EOM 73bar2: foobar@example.com 74bar: foobar@example.com 75foo: bar@example.com 76EOM 77 78# get alias by name 79check "getent aliases foo" << EOM 80foo: bar@example.com 81EOM 82 83# get alias by second name 84check "getent aliases bar2" << EOM 85bar2: foobar@example.com 86EOM 87 88# get alias by different case 89check "getent aliases FOO" << EOM 90foo: bar@example.com 91EOM 92 93fi # end of aliases tests 94 95########################################################################### 96 97if grep '^ethers.*ldap' /etc/nsswitch.conf > /dev/null 2>&1 98then 99echo "test_nsscmds.sh: testing ether..." 100 101# get an entry by hostname 102check "getent ethers testhost" << EOM 1030:18:8a:54:1a:8e testhost 104EOM 105 106# get an entry by alias name 107check "getent ethers testhostalias" << EOM 1080:18:8a:54:1a:8e testhostalias 109EOM 110 111# get an entry by hostname with different case 112check "getent ethers TESTHOST" << EOM 1130:18:8a:54:1a:8e testhost 114EOM 115 116# get an entry by ethernet address 117check "getent ethers 0:18:8a:54:1a:8b" << EOM 1180:18:8a:54:1a:8b testhost2 119EOM 120 121# get entry by ip address 122# this does not currently work, but maybe it should 123#check "getent ethers 192.0.2.123" << EOM 124#0:18:8a:54:1a:8e testhost 125#EOM 126 127# get all ethers (unsupported) 128check "getent ethers" << EOM 129Enumeration not supported on ethers 130EOM 131 132fi # end of ethers tests 133 134########################################################################### 135 136if grep '^group.*ldap' /etc/nsswitch.conf > /dev/null 2>&1 137then 138echo "test_nsscmds.sh: testing group..." 139 140# function to sort group members of a group 141sortgroup() { 142 while read line 143 do 144 group="`echo "$line" | sed 's/^\([^:]*:[^:]*:[^:]*\).*$/\1:/'`" 145 members="`echo "$line" | sed -n 's/^[^:]*:[^:]*:[^:]*:\(.*\)$/\1/p' | tr ',' '\n' | sort | tr '\n' ','`" 146 members="`echo "$members" | sed 's/,$//'`" 147 echo "${group}${members}" 148 done 149} 150 151check "getent group testgroup | sortgroup" << EOM 152testgroup:*:6100:arthur,test,testuser4 153EOM 154 155# this does not work because users is in /etc/group but it would 156# be nice if libc supported this 157#check "getent group users" << EOM 158#users:*:100:arthur,test 159#EOM 160 161# group with different case should not be found 162check "getent group TESTGROUP" << EOM 163EOM 164 165check "getent group 6100 | sortgroup" << EOM 166testgroup:*:6100:arthur,test,testuser4 167EOM 168 169check "groups arthur | sed 's/^.* *: *//' | sed 's/ debci//'" << EOM 170users testgroup testgroup2 grp4 grp5 grp6 grp7 grp8 grp9 grp10 grp11 grp12 grp13 grp14 grp15 grp16 grp17 grp18 171EOM 172 173check "groups testuser4 | sed 's/^.* *: *//'" << EOM 174users testgroup testgroup2 175EOM 176 177check "getent group | egrep '^(testgroup|users|root):' | sortgroup" << EOM 178$(egrep '^(testgroup|users|root):' /etc/group) 179testgroup:*:6100:arthur,test,testuser4 180users:*:100:arthur,test 181EOM 182 183check "getent group | wc -l" << EOM 184`grep -c '^[^#].*:' /etc/group | awk '{print $1 + 23}'` 185EOM 186 187check "getent group | grep ^largegroup | sortgroup" << EOM 188largegroup:*:1005:akraskouskas,alat,ameisinger,bdevera,behrke,bmoldan,btempel,cjody,clouder,cmanno,dbye,dciviello,dfirpo,dgivliani,dgosser,emcquiddy,enastasi,fcunard,gcubbison,gdaub,gdreitzler,ghanauer,gpomerance,gsusoev,gtinnel,gvollrath,gzuhlke,hgalavis,hhaffey,hhydrick,hmachesky,hpaek,hpolk,hsweezer,htomlinson,hzagami,igurwell,ihashbarger,jyeater,kbradbury,khathway,kklavetter,lbuchtel,lgandee,lkhubba,lmauracher,lseehafer,lvittum,mblanchet,mbodley,mciaccia,mjuris,ndipanfilo,nfilipek,nfunchess,ngata,ngullett,nkraker,nriofrio,nroepke,nrybij,oclunes,oebrani,okveton,osaines,otrevor,pdossous,phaye,psowa,purquilla,rkoonz,rlatessa,rworkowski,sdebry,sgurski,showe,slaforge,tabdelal,testusr2,testusr3,tfalconeri,tpaa,uschweyen,utrezize,vchevalier,vdelnegro,vleyton,vmedici,vmigliori,vpender,vwaltmann,wbrettschneide,wselim,wvalcin,wworf,yautin,ykisak,zgingrich,znightingale,zwinterbottom 189EOM 190 191check "getent group largegroup | sortgroup" << EOM 192largegroup:*:1005:akraskouskas,alat,ameisinger,bdevera,behrke,bmoldan,btempel,cjody,clouder,cmanno,dbye,dciviello,dfirpo,dgivliani,dgosser,emcquiddy,enastasi,fcunard,gcubbison,gdaub,gdreitzler,ghanauer,gpomerance,gsusoev,gtinnel,gvollrath,gzuhlke,hgalavis,hhaffey,hhydrick,hmachesky,hpaek,hpolk,hsweezer,htomlinson,hzagami,igurwell,ihashbarger,jyeater,kbradbury,khathway,kklavetter,lbuchtel,lgandee,lkhubba,lmauracher,lseehafer,lvittum,mblanchet,mbodley,mciaccia,mjuris,ndipanfilo,nfilipek,nfunchess,ngata,ngullett,nkraker,nriofrio,nroepke,nrybij,oclunes,oebrani,okveton,osaines,otrevor,pdossous,phaye,psowa,purquilla,rkoonz,rlatessa,rworkowski,sdebry,sgurski,showe,slaforge,tabdelal,testusr2,testusr3,tfalconeri,tpaa,uschweyen,utrezize,vchevalier,vdelnegro,vleyton,vmedici,vmigliori,vpender,vwaltmann,wbrettschneide,wselim,wvalcin,wworf,yautin,ykisak,zgingrich,znightingale,zwinterbottom 193EOM 194 195check "getent group | grep ^hugegroup | sortgroup" << EOM 196hugegroup:*:1006:ablackstock,abortignon,achhor,ademosthenes,adenicola,adishaw,aesbensen,aferge,afredin,afuchs,agarbett,agimm,agordner,ahandy,ajaquess,akertzman,akomsthoeft,akraskouskas,akravetz,alamour,alat,alienhard,amanganelli,amaslyn,amayorga,amccroskey,amcgraw,amckinney,ameisinger,aponcedeleon,apurdon,areid,arosel,ascheno,ascovel,asemons,ashuey,asivley,astrunk,atollefsrud,atonkin,awhitt,aziernicki,badair,baigner,bbeckfield,bbrenton,bcoletta,bcolorado,bdadds,bdaughenbaugh,bdevera,bdominga,behrke,beon,bfishbeck,bgavagan,bguthary,bharnois,bhelverson,bjolly,blovig,bluellen,bmadamba,bmarlin,bmarszalek,bmicklos,bmoling,bouten,bphou,bpinedo,brodgerson,broher,bromano,bscadden,bsibal,bstrede,bswantak,btempel,btheim,bveeneman,bwinterton,bwynes,cabare,carguellez,cbarlup,cbartnick,cbelardo,cbleimehl,cbotdorf,cbourek,cbrechbill,cbrom,ccyganiewicz,cdeckard,cdegravelle,cdickes,cdrumm,cfasone,cflenner,cfleurantin,cgaler,cgalinol,cgaudette,cghianni,charriman,cjody,cjuntunen,ckerska,ckistenmacher,cklem,ckodish,clapenta,clewicki,clouder,cmafnas,cmanno,cmcanulty,cmellberg,cmiramon,cnabzdyk,cnoriego,cpaccione,cpalmios,cparee,cpencil,cpentreath,cpinela,cpluid,critchie,cscullion,csever,csoomaroo,cspilis,cswigert,ctenny,ctetteh,ctuzzo,cwank,cweiss,dasiedu,daubert,dbarriball,dbertels,dblazejewski,dcaltabiano,dciullo,ddeguire,ddigerolamo,denriquez,deshmon,dfirpo,dflore,dfollman,dgiacomazzi,dgivliani,dgosser,dhammontree,dhendon,dhindsman,dholdaway,dlablue,dlanois,dlargo,dledenbach,dlongbotham,dloubier,dmahapatra,dmarchizano,dmcgillen,dminozzi,dnegri,dpebbles,draymundo,dscheurer,dsharr,dsherard,dsteever,dtashjian,dtornow,dtuholski,dwittlinger,dzurek,eaguire,eathey,ebattee,ebeachem,eberkman,ebusk,ecelestin,ecolden,ecordas,ediga,edrinkwater,edurick,egospatrick,egrago,ehathcock,ehindbaugh,ejeppesen,ekalfas,ekenady,ekeuper,eklein,eklunder,ekurter,emanikowski,emargulis,emcquiddy,emehta,eorsten,eparham,epeterson,epoinelli,erathert,erostad,eserrett,esheehan,esonia,esproull,esthill,estockwin,etunby,ewicks,ewilles,ewismer,ewuitschick,eyounglas,eziebert,fagro,faleo,farquette,fbeatrice,fberra,fberyman,fbielecki,fburrough,fcha,fcunard,ffigert,fgoben,fgrashot,fhain,fhalon,fkeef,fmarchi,fmilsaps,fnottage,fparness,fplayfair,fsapien,fsavela,fsirianni,fsplinter,fsunderland,fsymmonds,fthein,fvallian,fvascones,fverfaille,fvinal,fwidhalm,gallanson,gapkin,garchambeault,gbitar,gbolay,gcarlini,gcervantez,gchounlapane,gclapham,gcobane,gconver,gcukaj,gcummer,gcurnutt,gdaub,gdeblasio,gdeyarmond,gdrilling,gearnshaw,gfaire,gfedewa,ggehrke,ggillim,ghann,ghelderman,ghumbles,gishii,gjankowiak,gkerens,glafontaine,gloebs,gmackinder,gmassi,gmilian,gmings,gmoen,gparkersmith,gpomerance,gportolese,greiff,gsantella,gschaumburg,gshrode,gtinnel,guresti,gvollrath,gwaud,habby,hbastidos,hbetterman,hbickford,hbraim,hbrandow,hbrehmer,hbukovsky,hcafourek,hcarrizal,hchaviano,hcintron,hcowles,hcusta,hdoiel,hdyner,hfludd,hgalavis,hhaffey,hhagee,hhartranft,hholyfield,hhysong,hkarney,hkinderknecht,hkippes,hkohlmeyer,hlauchaire,hlemon,hlichota,hliverman,hloftis,hlynema,hmateer,hmatonak,hmiazga,hmogush,hmuscaro,hpalmquist,hpimpare,hpolintan,hrapisura,hrenart,hriech,hsabol,hschelb,hschoepfer,hspiry,hstreitnatter,hsweezer,htilzer,htomlinson,htsuha,hvannette,hveader,hwestermark,hwoodert,hzagami,hzinda,iambrosino,ibeto,ibreitbart,ibuzo,ibyles,ichewning,icoard,ideveyra,ienglert,igizzi,ihalford,ihanneman,ihegener,ihernan,iherrarte,ihimmelwright,ihoa,iiffert,ikadar,ikulbida,ilacourse,ilamberth,ilawbaugh,ileaman,ilevian,imarungo,imcbay,imensah,imicthell,imillin,imuehl,inarain,iogasawara,iroiger,iseipel,isowder,isplonskowski,istallcup,istarring,isteinlicht,ithum,ivanschaack,iweibe,iyorgey,iyorks,jamber,jappleyard,jbielicki,jbjorkman,jcaroll,jdodge,jeuresti,jeverton,jglotzbecker,jherkenratt,jholzmiller,jjumalon,jkimpton,jknight,jlebouf,jlunney,jmartha,jmarugg,jmatty,joligee,jquicksall,jrees,jreigh,jroman,jscheitlin,jseen,jsegundo,jsenavanh,jskafec,jspohn,jsweezy,jvillaire,jwinterton,jzych,kaanerud,kalguire,kbarnthouse,kbartolet,kbattershell,kbrevitz,kbrugal,kcofrancesco,kcomparoni,kconkey,kdevincent,kepps,kfaure,kfend,kgarced,kgremminger,khartness,kheadlon,khovanesian,kjoslyn,klitehiser,klundsten,klurie,kmallach,kmandolfo,kmarzili,kmayoras,kmcardle,kmcguire,kmedcaf,kmeester,kmisove,kmoesch,kmosko,kmuros,kolexa,kottomaniello,kpalka,kpannunzio,kpenale,kpuebla,krahman,kseisler,kshippy,ksiering,ksollitto,ksparling,kstachurski,kthede,ktoni,ktriblett,ktuccio,ktuner,kwidrick,kwinterling,kwirght,laksamit,lautovino,lbanco,lbassin,lbove,lbuchtel,lcanestrini,lcaudell,lcavez,lcocherell,lcoulon,lcremer,leberhardt,lfarraj,lfichtner,lgadomski,lgandee,lgradilla,lhuggler,limbrogno,ljomes,lkimel,llarmore,llasher,lmadruga,lmauracher,lmcgeary,lmichaud,lmuehlberger,lnormand,lparrish,lpeagler,lpintor,lpitek,lpondexter,lrandall,lringuette,lschenkelberg,lschnorbus,lschollmeier,lseabold,lseehafer,lshilling,lsivic,lsobrino,lsous,lspielvogel,lvaleriano,lvanconant,lwedner,lyoula,mallmand,maustine,mbeagley,mbodley,mbravata,mcampagnone,mcaram,mcashett,mcasida,mcoch,mcolehour,mcontreras,mdanos,mdecourcey,mdedon,mdickinson,mdimaio,mdoering,mdyce,meconomides,mespinel,mfaeth,mfeil,mferandez,mfitzherbert,mgavet,mgayden,mground,mheilbrun,mhollings,mjeon,mkibler,mkofoed,mlaverde,mlenning,mlinak,mlinardi,mmangiamele,mmattu,mmcchristian,mmerriwether,mmesidor,mneubacher,moller,moser,mpanahon,mpark,mpellew,mpilon,mpizzaro,mpytko,mquigg,mredd,mrizer,mruppel,mrydelek,mskeele,mstirn,mswogger,mtanzi,mtintle,mvanbergen,mvanpelt,mvas,mvedder,mviverette,myokoyama,nagerton,nasmar,nbuford,nbugtong,ncermeno,nchrisman,nciucci,ndesautels,ndrumgole,nedgin,nendicott,nerbach,nevan,nforti,nfunchess,ngiesler,nglathar,ngrowney,ngullett,nhayer,nhelfinstine,nhija,ninnella,njordon,nkempon,nkubley,nlainhart,nlatchaw,nlemma,nlinarez,nlohmiller,nmccolm,nmoren,nnamanworth,nnickel,nousdahl,nphan,nramones,nranck,nridinger,nriofrio,nrybij,nrysavy,nschmig,nsiemonsma,nslaby,nspolar,nvyhnal,nwescott,nwiker,oahyou,oalthouse,obeaufait,obenallack,obercier,obihl,ocalleo,ochasten,oclunes,oconerly,ocrabbs,oebrani,ofelcher,ohatto,ohearl,ohedlund,ohoffert,ohove,ojerabek,okave,okveton,omalvaez,omasone,omatula,omcdaid,oolivarez,oosterhouse,opeet,opizzuti,opoch,oport,opuglisi,oreiss,osaber,oscarpello,oshough,ovibbert,owhelchel,owhitelow,pahles,pbascom,pbeckerdite,pbiggart,pbondroff,pbrentano,pcaposole,pcornn,pdauterman,pdech,pdischinger,pduitscher,pdulac,pdurando,pfavolise,pgiegerich,pgreenier,pgrybel,phalkett,pheathcock,phyer,pmineo,pminnis,ppedraja,ppeper,pphuaphes,prepasky,prowena,psabado,psalesky,pschrayter,psharits,psiroky,psundeen,pthornberry,ptoenjes,ptraweek,purquilla,pvierthaler,pvirelli,pviviani,pwademan,pwashuk,pwetherwax,pwhitmire,pwohlenhaus,pwutzke,qhanly,ralspach,rbernhagen,rbillingsly,rbloomstrand,rbrisby,rcheshier,rchevrette,rdubs,rdubuisson,redling,rfassinger,rfauerbach,rfidel,rginer,rgoonez,rgramby,rgriffies,rguinane,rheinzmann,rkraszewski,rlambertus,rlatessa,rlosinger,rmandril,rmcstay,rnordby,rpastorin,rpikes,rpinilla,rpitter,rramirez,rrasual,rschkade,rtole,rtooker,saben,sackles,sarndt,saycock,sbemo,sbettridge,sbloise,sbonnie,sbrabyn,scocuzza,sdebry,senrico,sestergard,sgefroh,sgirsh,sgropper,sgunder,sgurski,shaith,sherzberg,showe,sjankauskas,skanjirathinga,skoegler,slaningham,slaudeman,slerew,smccaie,smillian,smullowney,snotari,spolmer,srees,srubenfield,sscheiern,sskone,sskyers,sspagnuolo,sstough,sstuemke,svandewalle,svielle,svogler,svongal,swoodie,tabdelal,tairth,tbagne,tbattista,tboxx,tcacal,tcossa,tcrissinger,tdonathan,teliades,tfalconeri,tfetherston,tgelen,tgindhart,tguinnip,tharr,thelfritz,thoch,thynson,tkeala,tkelly,tkhora,tlana,tlowers,tmalecki,tmarkus,tmccaffity,tmccamish,tmcmickle,tmelland,tmorr,tmurata,tmysinger,tnaillon,tnitzel,tpaa,tplatko,tredfearn,tsablea,tsann,tschnepel,tsearle,tsepulueda,tsowells,tstalworth,tvehrs,tvrooman,tyounglas,ualway,uazatyan,ubenken,ubieniek,ubynum,udatu,uednilao,ueriks,uflander,ugerpheide,ugreenberg,uhayakawa,uholecek,ulanigan,umarbury,umosser,upater,upellam,uransford,urosentrance,uschweyen,usevera,uslavinski,uspittler,uvanmatre,uwalpole,uweyand,vbaldasaro,vbigalow,vbonder,vburton,vchevalier,vcrofton,vdesir,vdolan,veisenhardt,vemily,venfort,vfeigel,vglidden,vkrug,vlubic,vmaynard,vmedici,vnazzal,vnery,vpeairs,vpender,vpiraino,vrodick,vrunyon,vsefcovic,vstirman,vtowell,vtresch,vtrumpp,vwabasha,vwaltmann,vwisinger,vwokwicz,wbrill,wclokecloak,wconces,wconstantino,wcreggett,wdagrella,wdevenish,wdovey,wenglander,werrick,wesguerra,wganther,wkhazaleh,wleiva,wlynch,wmailey,wmendell,wnunziata,wottesen,wselim,wstjean,wtruman,wvalcin,wvermeulen,xeppley,xlantey,xrahaim,yautin,ycerasoli,ycobetto,ycostaneda,yduft,yeven,yfrymoyer,ygockel,yhenriques,ykimbel,yolivier,yschmuff,ysnock,yvdberg,zanderlik,zborgmeyer,zbuscaglia,zculp,zfarler,zhaulk,zkutchera,zmeeker,zneeb,zratti,zscammahorn,zvagt,zwinterbottom 197EOM 198 199check "getent group hugegroup | sortgroup" << EOM 200hugegroup:*:1006:ablackstock,abortignon,achhor,ademosthenes,adenicola,adishaw,aesbensen,aferge,afredin,afuchs,agarbett,agimm,agordner,ahandy,ajaquess,akertzman,akomsthoeft,akraskouskas,akravetz,alamour,alat,alienhard,amanganelli,amaslyn,amayorga,amccroskey,amcgraw,amckinney,ameisinger,aponcedeleon,apurdon,areid,arosel,ascheno,ascovel,asemons,ashuey,asivley,astrunk,atollefsrud,atonkin,awhitt,aziernicki,badair,baigner,bbeckfield,bbrenton,bcoletta,bcolorado,bdadds,bdaughenbaugh,bdevera,bdominga,behrke,beon,bfishbeck,bgavagan,bguthary,bharnois,bhelverson,bjolly,blovig,bluellen,bmadamba,bmarlin,bmarszalek,bmicklos,bmoling,bouten,bphou,bpinedo,brodgerson,broher,bromano,bscadden,bsibal,bstrede,bswantak,btempel,btheim,bveeneman,bwinterton,bwynes,cabare,carguellez,cbarlup,cbartnick,cbelardo,cbleimehl,cbotdorf,cbourek,cbrechbill,cbrom,ccyganiewicz,cdeckard,cdegravelle,cdickes,cdrumm,cfasone,cflenner,cfleurantin,cgaler,cgalinol,cgaudette,cghianni,charriman,cjody,cjuntunen,ckerska,ckistenmacher,cklem,ckodish,clapenta,clewicki,clouder,cmafnas,cmanno,cmcanulty,cmellberg,cmiramon,cnabzdyk,cnoriego,cpaccione,cpalmios,cparee,cpencil,cpentreath,cpinela,cpluid,critchie,cscullion,csever,csoomaroo,cspilis,cswigert,ctenny,ctetteh,ctuzzo,cwank,cweiss,dasiedu,daubert,dbarriball,dbertels,dblazejewski,dcaltabiano,dciullo,ddeguire,ddigerolamo,denriquez,deshmon,dfirpo,dflore,dfollman,dgiacomazzi,dgivliani,dgosser,dhammontree,dhendon,dhindsman,dholdaway,dlablue,dlanois,dlargo,dledenbach,dlongbotham,dloubier,dmahapatra,dmarchizano,dmcgillen,dminozzi,dnegri,dpebbles,draymundo,dscheurer,dsharr,dsherard,dsteever,dtashjian,dtornow,dtuholski,dwittlinger,dzurek,eaguire,eathey,ebattee,ebeachem,eberkman,ebusk,ecelestin,ecolden,ecordas,ediga,edrinkwater,edurick,egospatrick,egrago,ehathcock,ehindbaugh,ejeppesen,ekalfas,ekenady,ekeuper,eklein,eklunder,ekurter,emanikowski,emargulis,emcquiddy,emehta,eorsten,eparham,epeterson,epoinelli,erathert,erostad,eserrett,esheehan,esonia,esproull,esthill,estockwin,etunby,ewicks,ewilles,ewismer,ewuitschick,eyounglas,eziebert,fagro,faleo,farquette,fbeatrice,fberra,fberyman,fbielecki,fburrough,fcha,fcunard,ffigert,fgoben,fgrashot,fhain,fhalon,fkeef,fmarchi,fmilsaps,fnottage,fparness,fplayfair,fsapien,fsavela,fsirianni,fsplinter,fsunderland,fsymmonds,fthein,fvallian,fvascones,fverfaille,fvinal,fwidhalm,gallanson,gapkin,garchambeault,gbitar,gbolay,gcarlini,gcervantez,gchounlapane,gclapham,gcobane,gconver,gcukaj,gcummer,gcurnutt,gdaub,gdeblasio,gdeyarmond,gdrilling,gearnshaw,gfaire,gfedewa,ggehrke,ggillim,ghann,ghelderman,ghumbles,gishii,gjankowiak,gkerens,glafontaine,gloebs,gmackinder,gmassi,gmilian,gmings,gmoen,gparkersmith,gpomerance,gportolese,greiff,gsantella,gschaumburg,gshrode,gtinnel,guresti,gvollrath,gwaud,habby,hbastidos,hbetterman,hbickford,hbraim,hbrandow,hbrehmer,hbukovsky,hcafourek,hcarrizal,hchaviano,hcintron,hcowles,hcusta,hdoiel,hdyner,hfludd,hgalavis,hhaffey,hhagee,hhartranft,hholyfield,hhysong,hkarney,hkinderknecht,hkippes,hkohlmeyer,hlauchaire,hlemon,hlichota,hliverman,hloftis,hlynema,hmateer,hmatonak,hmiazga,hmogush,hmuscaro,hpalmquist,hpimpare,hpolintan,hrapisura,hrenart,hriech,hsabol,hschelb,hschoepfer,hspiry,hstreitnatter,hsweezer,htilzer,htomlinson,htsuha,hvannette,hveader,hwestermark,hwoodert,hzagami,hzinda,iambrosino,ibeto,ibreitbart,ibuzo,ibyles,ichewning,icoard,ideveyra,ienglert,igizzi,ihalford,ihanneman,ihegener,ihernan,iherrarte,ihimmelwright,ihoa,iiffert,ikadar,ikulbida,ilacourse,ilamberth,ilawbaugh,ileaman,ilevian,imarungo,imcbay,imensah,imicthell,imillin,imuehl,inarain,iogasawara,iroiger,iseipel,isowder,isplonskowski,istallcup,istarring,isteinlicht,ithum,ivanschaack,iweibe,iyorgey,iyorks,jamber,jappleyard,jbielicki,jbjorkman,jcaroll,jdodge,jeuresti,jeverton,jglotzbecker,jherkenratt,jholzmiller,jjumalon,jkimpton,jknight,jlebouf,jlunney,jmartha,jmarugg,jmatty,joligee,jquicksall,jrees,jreigh,jroman,jscheitlin,jseen,jsegundo,jsenavanh,jskafec,jspohn,jsweezy,jvillaire,jwinterton,jzych,kaanerud,kalguire,kbarnthouse,kbartolet,kbattershell,kbrevitz,kbrugal,kcofrancesco,kcomparoni,kconkey,kdevincent,kepps,kfaure,kfend,kgarced,kgremminger,khartness,kheadlon,khovanesian,kjoslyn,klitehiser,klundsten,klurie,kmallach,kmandolfo,kmarzili,kmayoras,kmcardle,kmcguire,kmedcaf,kmeester,kmisove,kmoesch,kmosko,kmuros,kolexa,kottomaniello,kpalka,kpannunzio,kpenale,kpuebla,krahman,kseisler,kshippy,ksiering,ksollitto,ksparling,kstachurski,kthede,ktoni,ktriblett,ktuccio,ktuner,kwidrick,kwinterling,kwirght,laksamit,lautovino,lbanco,lbassin,lbove,lbuchtel,lcanestrini,lcaudell,lcavez,lcocherell,lcoulon,lcremer,leberhardt,lfarraj,lfichtner,lgadomski,lgandee,lgradilla,lhuggler,limbrogno,ljomes,lkimel,llarmore,llasher,lmadruga,lmauracher,lmcgeary,lmichaud,lmuehlberger,lnormand,lparrish,lpeagler,lpintor,lpitek,lpondexter,lrandall,lringuette,lschenkelberg,lschnorbus,lschollmeier,lseabold,lseehafer,lshilling,lsivic,lsobrino,lsous,lspielvogel,lvaleriano,lvanconant,lwedner,lyoula,mallmand,maustine,mbeagley,mbodley,mbravata,mcampagnone,mcaram,mcashett,mcasida,mcoch,mcolehour,mcontreras,mdanos,mdecourcey,mdedon,mdickinson,mdimaio,mdoering,mdyce,meconomides,mespinel,mfaeth,mfeil,mferandez,mfitzherbert,mgavet,mgayden,mground,mheilbrun,mhollings,mjeon,mkibler,mkofoed,mlaverde,mlenning,mlinak,mlinardi,mmangiamele,mmattu,mmcchristian,mmerriwether,mmesidor,mneubacher,moller,moser,mpanahon,mpark,mpellew,mpilon,mpizzaro,mpytko,mquigg,mredd,mrizer,mruppel,mrydelek,mskeele,mstirn,mswogger,mtanzi,mtintle,mvanbergen,mvanpelt,mvas,mvedder,mviverette,myokoyama,nagerton,nasmar,nbuford,nbugtong,ncermeno,nchrisman,nciucci,ndesautels,ndrumgole,nedgin,nendicott,nerbach,nevan,nforti,nfunchess,ngiesler,nglathar,ngrowney,ngullett,nhayer,nhelfinstine,nhija,ninnella,njordon,nkempon,nkubley,nlainhart,nlatchaw,nlemma,nlinarez,nlohmiller,nmccolm,nmoren,nnamanworth,nnickel,nousdahl,nphan,nramones,nranck,nridinger,nriofrio,nrybij,nrysavy,nschmig,nsiemonsma,nslaby,nspolar,nvyhnal,nwescott,nwiker,oahyou,oalthouse,obeaufait,obenallack,obercier,obihl,ocalleo,ochasten,oclunes,oconerly,ocrabbs,oebrani,ofelcher,ohatto,ohearl,ohedlund,ohoffert,ohove,ojerabek,okave,okveton,omalvaez,omasone,omatula,omcdaid,oolivarez,oosterhouse,opeet,opizzuti,opoch,oport,opuglisi,oreiss,osaber,oscarpello,oshough,ovibbert,owhelchel,owhitelow,pahles,pbascom,pbeckerdite,pbiggart,pbondroff,pbrentano,pcaposole,pcornn,pdauterman,pdech,pdischinger,pduitscher,pdulac,pdurando,pfavolise,pgiegerich,pgreenier,pgrybel,phalkett,pheathcock,phyer,pmineo,pminnis,ppedraja,ppeper,pphuaphes,prepasky,prowena,psabado,psalesky,pschrayter,psharits,psiroky,psundeen,pthornberry,ptoenjes,ptraweek,purquilla,pvierthaler,pvirelli,pviviani,pwademan,pwashuk,pwetherwax,pwhitmire,pwohlenhaus,pwutzke,qhanly,ralspach,rbernhagen,rbillingsly,rbloomstrand,rbrisby,rcheshier,rchevrette,rdubs,rdubuisson,redling,rfassinger,rfauerbach,rfidel,rginer,rgoonez,rgramby,rgriffies,rguinane,rheinzmann,rkraszewski,rlambertus,rlatessa,rlosinger,rmandril,rmcstay,rnordby,rpastorin,rpikes,rpinilla,rpitter,rramirez,rrasual,rschkade,rtole,rtooker,saben,sackles,sarndt,saycock,sbemo,sbettridge,sbloise,sbonnie,sbrabyn,scocuzza,sdebry,senrico,sestergard,sgefroh,sgirsh,sgropper,sgunder,sgurski,shaith,sherzberg,showe,sjankauskas,skanjirathinga,skoegler,slaningham,slaudeman,slerew,smccaie,smillian,smullowney,snotari,spolmer,srees,srubenfield,sscheiern,sskone,sskyers,sspagnuolo,sstough,sstuemke,svandewalle,svielle,svogler,svongal,swoodie,tabdelal,tairth,tbagne,tbattista,tboxx,tcacal,tcossa,tcrissinger,tdonathan,teliades,tfalconeri,tfetherston,tgelen,tgindhart,tguinnip,tharr,thelfritz,thoch,thynson,tkeala,tkelly,tkhora,tlana,tlowers,tmalecki,tmarkus,tmccaffity,tmccamish,tmcmickle,tmelland,tmorr,tmurata,tmysinger,tnaillon,tnitzel,tpaa,tplatko,tredfearn,tsablea,tsann,tschnepel,tsearle,tsepulueda,tsowells,tstalworth,tvehrs,tvrooman,tyounglas,ualway,uazatyan,ubenken,ubieniek,ubynum,udatu,uednilao,ueriks,uflander,ugerpheide,ugreenberg,uhayakawa,uholecek,ulanigan,umarbury,umosser,upater,upellam,uransford,urosentrance,uschweyen,usevera,uslavinski,uspittler,uvanmatre,uwalpole,uweyand,vbaldasaro,vbigalow,vbonder,vburton,vchevalier,vcrofton,vdesir,vdolan,veisenhardt,vemily,venfort,vfeigel,vglidden,vkrug,vlubic,vmaynard,vmedici,vnazzal,vnery,vpeairs,vpender,vpiraino,vrodick,vrunyon,vsefcovic,vstirman,vtowell,vtresch,vtrumpp,vwabasha,vwaltmann,vwisinger,vwokwicz,wbrill,wclokecloak,wconces,wconstantino,wcreggett,wdagrella,wdevenish,wdovey,wenglander,werrick,wesguerra,wganther,wkhazaleh,wleiva,wlynch,wmailey,wmendell,wnunziata,wottesen,wselim,wstjean,wtruman,wvalcin,wvermeulen,xeppley,xlantey,xrahaim,yautin,ycerasoli,ycobetto,ycostaneda,yduft,yeven,yfrymoyer,ygockel,yhenriques,ykimbel,yolivier,yschmuff,ysnock,yvdberg,zanderlik,zborgmeyer,zbuscaglia,zculp,zfarler,zhaulk,zkutchera,zmeeker,zneeb,zratti,zscammahorn,zvagt,zwinterbottom 201EOM 202 203check "getent group nstgrp1 | sortgroup" << EOM 204nstgrp1:*:800:testusr2 205EOM 206 207check "getent group nstgrp2 | sortgroup" << EOM 208nstgrp2:*:801:testusr2,testusr3 209EOM 210 211check "getent group nstgrp3 | sortgroup" << EOM 212nstgrp3:*:802:testusr2,testusr3 213EOM 214 215check "groups testusr2 | sed 's/^.* *: *//'" << EOM 216users largegroup testgroup2 nstgrp1 nstgrp2 nstgrp3 217EOM 218 219check "groups testusr3 | sed 's/^.* *: *//'" << EOM 220users largegroup nstgrp2 nstgrp3 221EOM 222 223fi # end of group tests 224 225########################################################################### 226 227if grep '^hosts.*ldap' /etc/nsswitch.conf > /dev/null 2>&1 228then 229echo "test_nsscmds.sh: testing hosts..." 230 231check "getent hosts testhost" << EOM 232192.0.2.123 testhost testhostalias 233EOM 234 235check "getent hosts testhostalias" << EOM 236192.0.2.123 testhost testhostalias 237EOM 238 239# check hostname with different case 240check "getent hosts TESTHOST" << EOM 241192.0.2.123 testhost testhostalias 242EOM 243 244check "getent hosts 192.0.2.123" << EOM 245192.0.2.123 testhost testhostalias 246EOM 247 248check "getent hosts | grep testhost | sort" << EOM 249192.0.2.123 testhost testhostalias 250192.0.2.124 testhost2 251192.0.2.126 testhost4 252EOM 253 254check "getent hosts 2001:db8::dead:beef" << EOM 2552001:db8::dead:beef testhost2 256EOM 257 258# some systems prefer IPv4, others IPv6 259check "getent ahosts testhost2 | sed 's/ testhost2//' | sort" << EOM 260192.0.2.124 DGRAM 261192.0.2.124 RAW 262192.0.2.124 STREAM 2632001:db8::dead:beef DGRAM 2642001:db8::dead:beef RAW 2652001:db8::dead:beef STREAM 266EOM 267 268check "getent hosts testhost3" << EOM 2692001:db8::feed:c0de testhost3 270EOM 271 272check "getent ahosts testhost3" << EOM 2732001:db8::feed:c0de STREAM testhost3 2742001:db8::feed:c0de DGRAM 2752001:db8::feed:c0de RAW 276EOM 277 278# some systems prefer IPv4, others IPv6 279check "getent ahosts testhost4 | sed 's/ testhost4//' | sort" << EOM 280192.0.2.126 DGRAM 281192.0.2.126 RAW 282192.0.2.126 STREAM 2832001:db8::7e27:ac1d DGRAM 2842001:db8::7e27:ac1d RAW 2852001:db8::7e27:ac1d STREAM 286EOM 287 288fi # end of hosts tests 289 290########################################################################### 291 292if grep '^netgroup.*ldap' /etc/nsswitch.conf > /dev/null 2>&1 293then 294echo "test_nsscmds.sh: testing netgroup..." 295 296# check netgroup lookup of test netgroup 297check "getent netgroup tstnetgroup" << EOM 298tstnetgroup ( , arthur, ) (noot, , ) 299EOM 300 301# check netgroup lookup with different case 302check "getent netgroup TSTNETGROUP" << EOM 303EOM 304 305fi # end of netgroup tests 306 307########################################################################### 308 309if grep '^networks.*ldap' /etc/nsswitch.conf > /dev/null 2>&1 310then 311echo "test_nsscmds.sh: testing networks..." 312 313check "getent networks testnet" << EOM 314testnet 192.0.2.0 315EOM 316 317# check network name with different case 318check "getent networks TESTNET" << EOM 319testnet 192.0.2.0 320EOM 321 322check "getent networks 192.0.2.0" << EOM 323testnet 192.0.2.0 324EOM 325 326check "getent networks | grep testnet" << EOM 327testnet 192.0.2.0 328EOM 329 330fi # end of networks tests 331 332########################################################################### 333 334if grep '^passwd.*ldap' /etc/nsswitch.conf > /dev/null 2>&1 335then 336echo "test_nsscmds.sh: testing passwd..." 337 338check "getent passwd ecolden | sed 's/:[x*]:/:x:/'" << EOM 339ecolden:x:5972:1000:Estelle Colden:/home/ecolden:/bin/bash 340EOM 341 342check "getent passwd arthur | sed 's/:[x*]:/:x:/'" << EOM 343arthur:x:1000:100:Arthur de Jong:/home/arthur:/bin/bash 344EOM 345 346# check username with different case 347check "getent passwd ARTHUR" << EOM 348EOM 349 350check "getent passwd 4089 | sed 's/:[x*]:/:x:/'" << EOM 351jguzzetta:x:4089:1000:Josephine Guzzetta:/home/jguzzetta:/bin/bash 352EOM 353 354# count the number of passwd entries in the 4000-5999 range 355check "getent passwd | grep -c ':[x*]:[45][0-9][0-9][0-9]:'" << EOM 3562000 357EOM 358 359fi # end of passwd tests 360 361########################################################################### 362 363if grep '^protocols.*ldap' /etc/nsswitch.conf > /dev/null 2>&1 364then 365echo "test_nsscmds.sh: testing protocols..." 366 367check "getent protocols protfoo" << EOM 368protfoo 253 protfooalias 369EOM 370 371check "getent protocols protfooalias" << EOM 372protfoo 253 protfooalias 373EOM 374 375# check protocol with different case 376check "getent protocols PROTFOO" << EOM 377EOM 378 379# test protocol alias with different case 380check "getent protocols PROTFOOALIAS" << EOM 381EOM 382 383check "getent protocols 253" << EOM 384protfoo 253 protfooalias 385EOM 386 387check "getent protocols icmp" << EOM 388icmp 1 ICMP 389EOM 390 391check "getent protocols | grep protfoo" << EOM 392protfoo 253 protfooalias 393EOM 394 395fi # end of protocols tests 396 397########################################################################### 398 399if grep '^rpc.*ldap' /etc/nsswitch.conf > /dev/null 2>&1 400then 401echo "test_nsscmds.sh: testing rpc..." 402 403check "getent rpc rpcfoo" << EOM 404rpcfoo 160002 rpcfooalias 405EOM 406 407check "getent rpc rpcfooalias" << EOM 408rpcfoo 160002 rpcfooalias 409EOM 410 411# test rpc name with different case 412check "getent rpc RPCFOO" << EOM 413EOM 414 415check "getent rpc 160002" << EOM 416rpcfoo 160002 rpcfooalias 417EOM 418 419check "getent rpc | grep rpcfoo" << EOM 420rpcfoo 160002 rpcfooalias 421EOM 422 423fi # end of rpc tests 424 425########################################################################### 426 427if grep '^services.*ldap' /etc/nsswitch.conf > /dev/null 2>&1 428then 429echo "test_nsscmds.sh: testing services..." 430 431check "getent services foosrv" << EOM 432foosrv 15349/tcp 433EOM 434 435check "getent services foosrv/tcp" << EOM 436foosrv 15349/tcp 437EOM 438 439check "getent services foosrv/udp" << EOM 440EOM 441 442# check with different case 443check "getent services FOOSRV" << EOM 444EOM 445 446# check protocol name case sensitivity (TCP is commonly an alias) 447check "getent services foosrv/tCp" << EOM 448EOM 449 450check "getent services 15349/tcp" << EOM 451foosrv 15349/tcp 452EOM 453 454check "getent services 15349/udp" << EOM 455EOM 456 457check "getent services barsrv" << EOM 458barsrv 15350/tcp 459EOM 460 461check "getent services barsrv/tcp" << EOM 462barsrv 15350/tcp 463EOM 464 465check "getent services barsrv/udp" << EOM 466barsrv 15350/udp 467EOM 468 469check "getent services | egrep '(foo|bar)srv' | sort" << EOM 470barsrv 15350/tcp 471barsrv 15350/udp 472foosrv 15349/tcp 473EOM 474 475check "getent services sssin" << EOM 476sssin 5000/tcp SSSIN 477EOM 478 479check "getent services SSSIN" << EOM 480sssin 5000/tcp SSSIN 481EOM 482 483check "getent services | wc -l" << EOM 484`grep -c '^[^#].' /etc/services | awk '{print $1 + 4}'` 485EOM 486 487fi # end of services tests 488 489########################################################################### 490 491if grep '^shadow.*ldap' /etc/nsswitch.conf > /dev/null 2>&1 492then 493echo "test_nsscmds.sh: testing shadow..." 494 495# function to remove the password field from output 496rmpasswd() { 497 sed 's/^\([^:]*\):[^:]*:/\1:*:/' 498} 499 500check "getent shadow ecordas | rmpasswd" << EOM 501ecordas:*::::7:2::0 502EOM 503 504check "getent shadow adishaw | rmpasswd" << EOM 505adishaw:*:12302:::7:2::0 506EOM 507 508# check case-sensitivity 509check "getent shadow ADISHAW" << EOM 510EOM 511 512# check if the number of passwd entries matches the number of shadow entries 513check "getent shadow | wc -l" << EOM 514`getent passwd | wc -l` 515EOM 516 517# check if the names of users match between passwd and shadow 518getent passwd | sed 's/:.*//' | sort | \ 519 check "getent shadow | sed 's/:.*//' | sort" 520 521fi # end of shadow tests 522 523########################################################################### 524# determine the result 525 526if [ $FAIL -eq 0 ] 527then 528 echo "test_nsscmds.sh: all tests passed" 529 exit 0 530else 531 echo "test_nsscmds.sh: $FAIL TESTS FAILED" 532 exit 1 533fi 534