summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2009-06-06 20:46:33 +0000
committerArthur de Jong <arthur@arthurdejong.org>2009-06-06 20:46:33 +0000
commit285930cbcc3e2074ed7fe78a47aec55e49749953 (patch)
tree923db25377f59fcd0369eb1251fbd391140898a2 /tests
parent6a0fbfe59622f76a2546e089d896a4c5ff3eea9b (diff)
implement case-sensitive filtering for group, netgroup, passwd, protocols, rpc, services and shadow lookups
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@934 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test_nsscmds.sh60
1 files changed, 59 insertions, 1 deletions
diff --git a/tests/test_nsscmds.sh b/tests/test_nsscmds.sh
index ed14afd..2469a97 100755
--- a/tests/test_nsscmds.sh
+++ b/tests/test_nsscmds.sh
@@ -2,7 +2,7 @@
# test.sh - simple test script to check output of name lookup commands
#
-# Copyright (C) 2007, 2008 Arthur de Jong
+# Copyright (C) 2007, 2008, 2009 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -104,6 +104,11 @@ check "getent aliases bar2" << EOM
bar2: foobar@example.com
EOM
+# get alias by different case
+check "getent aliases FOO" << EOM
+foo: bar@example.com
+EOM
+
###########################################################################
echo "test_nsscmds.sh: testing ether..."
@@ -118,6 +123,11 @@ check "getent ethers testhostalias" << EOM
0:18:8a:54:1a:8e testhostalias
EOM
+# get an entry by hostname with different case
+check "getent ethers TESTHOST" << EOM
+0:18:8a:54:1a:8e testhost
+EOM
+
# get an entry by ethernet address
check "getent ethers 0:18:8a:54:1a:8b" << EOM
0:18:8a:54:1a:8b testhost2
@@ -148,6 +158,10 @@ EOM
#users:*:100:arthur,test
#EOM
+# group with different case should not be found
+check "getent group TESTGROUP" << EOM
+EOM
+
check "getent group 6100" << EOM
testgroup:*:6100:arthur,test
EOM
@@ -194,6 +208,11 @@ check "getent hosts testhostalias" << EOM
10.0.0.1 testhost testhostalias
EOM
+# check hostname with different case
+check "getent hosts TESTHOST" << EOM
+10.0.0.1 testhost testhostalias
+EOM
+
check "getent hosts 10.0.0.1" << EOM
10.0.0.1 testhost testhostalias
EOM
@@ -218,6 +237,12 @@ check "getent netgroup tstnetgroup" << EOM
tstnetgroup ( , arthur, ) (noot, , )
EOM
+# check netgroup lookup with different case
+# Note: this should return nothing at all (this is a bug)
+check "getent netgroup TSTNETGROUP" << EOM
+TSTNETGROUP
+EOM
+
###########################################################################
echo "test_nsscmds.sh: testing networks..."
@@ -226,6 +251,11 @@ check "getent networks testnet" << EOM
testnet 10.0.0.0
EOM
+# check network name with different case
+check "getent networks TESTNET" << EOM
+testnet 10.0.0.0
+EOM
+
check "getent networks 10.0.0.0" << EOM
testnet 10.0.0.0
EOM
@@ -246,6 +276,10 @@ check "getent passwd arthur" << EOM
arthur:x:1000:100:Arthur de Jong:/home/arthur:/bin/bash
EOM
+# check username with different case
+check "getent passwd ARTHUR" << EOM
+EOM
+
check "getent passwd 4089" << EOM
jguzzetta:x:4089:1000:Josephine Guzzetta:/home/jguzzetta:/bin/bash
EOM
@@ -267,6 +301,14 @@ check "getent protocols protfooalias" << EOM
protfoo 140 protfooalias
EOM
+# check protocol with different case
+check "getent protocols PROTFOO" << EOM
+EOM
+
+# test protocol alias with different case
+check "getent protocols PROTFOOALIAS" << EOM
+EOM
+
check "getent protocols 140" << EOM
protfoo 140 protfooalias
EOM
@@ -291,6 +333,10 @@ check "getent rpc rpcfooalias" << EOM
rpcfoo 160002 rpcfooalias
EOM
+# test rpc name with different case
+check "getent rpc RPCFOO" << EOM
+EOM
+
check "getent rpc 160002" << EOM
rpcfoo 160002 rpcfooalias
EOM
@@ -314,6 +360,14 @@ EOM
check "getent services foosrv/udp" << EOM
EOM
+# check with different case
+check "getent services FOOSRV" << EOM
+EOM
+
+# check protocol name case sensitivity (TCP is commonly an alias)
+check "getent services foosrv/tCp" << EOM
+EOM
+
check "getent services 15349/tcp" << EOM
foosrv 15349/tcp
EOM
@@ -365,6 +419,10 @@ check "getent shadow arthur" << EOM
arthur:*::100:200:7:2::0
EOM
+# check case-sensitivity
+check "getent shadow ARTHUR" << EOM
+EOM
+
# check if the number of passwd entries matches the number of shadow entries
check "getent shadow | wc -l" << EOM
`getent passwd | wc -l`