~lefteris-nikoltsios/+junk/samba-lp1016895

« back to all changes in this revision

Viewing changes to source3/lib/ldb/tests/test-generic.sh

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2011-12-21 13:18:04 UTC
  • mfrom: (0.39.21 sid)
  • Revision ID: package-import@ubuntu.com-20111221131804-xtlr39wx6njehxxr
Tags: 2:3.6.1-3ubuntu1
* Merge from Debian testing.  Remaining changes:
  + debian/patches/VERSION.patch:
    - set SAMBA_VERSION_SUFFIX to Ubuntu.
  + debian/patches/error-trans.fix-276472:
    - Add the translation of Unix Error code -ENOTSUP to NT Error Code
    - NT_STATUS_NOT_SUPPORTED to prevent the Permission denied error.
  + debian/smb.conf:
    - add "(Samba, Ubuntu)" to server string.
    - comment out the default [homes] share, and add a comment about
      "valid users = %S" to show users how to restrict access to
      \\server\username to only username.
    - Set 'usershare allow guests', so that usershare admins are 
      allowed to create public shares in addition to authenticated
      ones.
    - add map to guest = Bad user, maps bad username to guest access.
  + debian/samba-common.config:
    - Do not change priority to high if dhclient3 is installed.
    - Use priority medium instead of high for the workgroup question.
  + debian/control:
    - Don't build against or suggest ctdb.
    - Add dependency on samba-common-bin to samba.
  + Add ufw integration:
    - Created debian/samba.ufw.profile
    - debian/rules, debian/samba.dirs, debian/samba.files: install
      profile
    - debian/control: have samba suggest ufw
  + Add apport hook:
    - Created debian/source_samba.py.
    - debian/rules, debian/samba.dirs, debian/samba-common-bin.files: install
  + Switch to upstart:
    - Add debian/samba.{nmbd,smbd}.upstart.
  + debian/samba.logrotate, debian/samba-common.dhcp, debian/samba.if-up:
    - Make them upstart compatible
  + debian/samba.postinst: 
    - Avoid scary pdbedit warnings on first import.
  + debian/samba-common.postinst: Add more informative error message for
    the case where smb.conf was manually deleted
  + debian/patches/fix-debuglevel-name-conflict.patch: don't use 'debug_level'
    as a global variable name in an NSS module 
  + Dropped:
    - debian/patches/error-trans.fix-276472
    - debian/patches/fix-debuglevel-name-conflict.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
 
3
 
if [ -z "$LDB_SPECIALS" ]; then
4
 
    LDB_SPECIALS=1
5
 
    export LDB_SPECIALS
6
 
fi
7
 
 
8
 
echo "LDB_URL: $LDB_URL"
9
 
 
10
 
echo "Adding base elements"
11
 
$VALGRIND ldbadd $LDBDIR/tests/test.ldif || exit 1
12
 
 
13
 
echo "Adding again - should fail"
14
 
ldbadd $LDBDIR/tests/test.ldif 2> /dev/null && {
15
 
    echo "Should have failed to add again - gave $?"
16
 
    exit 1
17
 
}
18
 
 
19
 
echo "Modifying elements"
20
 
$VALGRIND ldbmodify $LDBDIR/tests/test-modify.ldif || exit 1
21
 
 
22
 
echo "Showing modified record"
23
 
$VALGRIND ldbsearch '(uid=uham)'  || exit 1
24
 
 
25
 
echo "Rename entry"
26
 
OLDDN="cn=Ursula Hampster,ou=Alumni Association,ou=People,o=University of Michigan,c=TEST"
27
 
NEWDN="cn=Hampster Ursula,ou=Alumni Association,ou=People,o=University of Michigan,c=TEST"
28
 
$VALGRIND ldbrename "$OLDDN" "$NEWDN"  || exit 1
29
 
 
30
 
echo "Showing renamed record"
31
 
$VALGRIND ldbsearch '(uid=uham)' || exit 1
32
 
 
33
 
echo "Starting ldbtest"
34
 
$VALGRIND ldbtest --num-records 100 --num-searches 10  || exit 1
35
 
 
36
 
if [ $LDB_SPECIALS = 1 ]; then
37
 
 echo "Adding index"
38
 
 $VALGRIND ldbadd $LDBDIR/tests/test-index.ldif  || exit 1
39
 
fi
40
 
 
41
 
echo "Adding bad attributes - should fail"
42
 
$VALGRIND ldbadd $LDBDIR/tests/test-wrong_attributes.ldif && {
43
 
    echo "Should fhave failed - gave $?"
44
 
    exit 1
45
 
}
46
 
 
47
 
echo "testing indexed search"
48
 
$VALGRIND ldbsearch '(uid=uham)'  || exit 1
49
 
$VALGRIND ldbsearch '(&(objectclass=person)(objectclass=person)(objectclass=top))' || exit 1
50
 
$VALGRIND ldbsearch '(&(uid=uham)(uid=uham))'  || exit 1
51
 
$VALGRIND ldbsearch '(|(uid=uham)(uid=uham))'  || exit 1
52
 
$VALGRIND ldbsearch '(|(uid=uham)(uid=uham)(objectclass=OpenLDAPperson))'  || exit 1
53
 
$VALGRIND ldbsearch '(&(uid=uham)(uid=uham)(!(objectclass=xxx)))'  || exit 1
54
 
$VALGRIND ldbsearch '(&(objectclass=person)(uid=uham)(!(uid=uhamxx)))' uid \* \+ dn  || exit 1
55
 
$VALGRIND ldbsearch '(&(uid=uham)(uid=uha*)(title=*))' uid || exit 1
56
 
 
57
 
# note that the "((" is treated as an attribute not an expression
58
 
# this matches the openldap ldapsearch behaviour of looking for a '='
59
 
# to see if the first argument is an expression or not
60
 
$VALGRIND ldbsearch '((' uid || exit 1
61
 
$VALGRIND ldbsearch '(objectclass=)' uid || exit 1
62
 
$VALGRIND ldbsearch -b 'cn=Hampster Ursula,ou=Alumni Association,ou=People,o=University of Michigan,c=TEST' -s base "" sn || exit 1
63
 
 
64
 
echo "Test wildcard match"
65
 
$VALGRIND ldbadd $LDBDIR/tests/test-wildcard.ldif  || exit 1
66
 
$VALGRIND ldbsearch '(cn=test*multi)'  || exit 1
67
 
$VALGRIND ldbsearch '(cn=*test*multi*)'  || exit 1
68
 
$VALGRIND ldbsearch '(cn=*test_multi)'  || exit 1
69
 
$VALGRIND ldbsearch '(cn=test_multi*)'  || exit 1
70
 
$VALGRIND ldbsearch '(cn=test*multi*test*multi)'  || exit 1
71
 
$VALGRIND ldbsearch '(cn=test*multi*test*multi*multi_*)' || exit 1
72
 
 
73
 
echo "Starting ldbtest indexed"
74
 
$VALGRIND ldbtest --num-records 100 --num-searches 500  || exit 1
75
 
 
76
 
echo "Testing one level search"
77
 
count=`$VALGRIND ldbsearch -b 'ou=Groups,o=University of Michigan,c=TEST' -s one 'objectclass=*' none |grep '^dn' | wc -l`
78
 
if [ $count != 3 ]; then
79
 
    echo returned $count records - expected 3
80
 
    exit 1
81
 
fi
82
 
 
83
 
echo "Testing binary file attribute value"
84
 
mkdir -p tests/tmp
85
 
cp $LDBDIR/tests/samba4.png tests/tmp/samba4.png
86
 
$VALGRIND ldbmodify $LDBDIR/tests/photo.ldif || exit 1
87
 
count=`$VALGRIND ldbsearch '(cn=Hampster Ursula)' jpegPhoto | grep '^dn' | wc -l`
88
 
if [ $count != 1 ]; then
89
 
    echo returned $count records - expected 1
90
 
    exit 1
91
 
fi
92
 
rm -f tests/tmp/samba4.png
93
 
 
94
 
echo "*TODO* Testing UTF8 upper lower case searches !!"
95
 
 
96
 
echo "Testing compare"
97
 
count=`$VALGRIND ldbsearch '(cn>=t)' cn | grep '^dn' | wc -l`
98
 
if [ $count != 2 ]; then
99
 
    echo returned $count records - expected 2
100
 
    echo "this fails on openLdap ..."
101
 
fi
102
 
 
103
 
count=`$VALGRIND ldbsearch '(cn<=t)' cn | grep '^dn' | wc -l`
104
 
if [ $count != 13 ]; then
105
 
    echo returned $count records - expected 13
106
 
    echo "this fails on opsnLdap ..."
107
 
fi
108
 
 
109
 
checkcount() {
110
 
    count=$1
111
 
    scope=$2
112
 
    basedn=$3
113
 
    expression="$4"
114
 
    n=`bin/ldbsearch -s "$scope" -b "$basedn" "$expression" | grep '^dn' | wc -l`
115
 
    if [ $n != $count ]; then
116
 
        echo "Got $n but expected $count for $expression"
117
 
        bin/ldbsearch "$expression"
118
 
        exit 1
119
 
    fi
120
 
    echo "OK: $count $expression"
121
 
}
122
 
 
123
 
checkcount 0 'base' '' '(uid=uham)'
124
 
checkcount 0 'one' '' '(uid=uham)'
125
 
 
126
 
checkcount 1 'base' 'cn=Hampster Ursula,ou=Alumni Association,ou=People,o=University of Michigan,c=TEST' '(uid=uham)'
127
 
checkcount 1 'one' 'ou=Alumni Association,ou=People,o=University of Michigan,c=TEST' '(uid=uham)'
128
 
checkcount 1 'one' 'ou=People,o=University of Michigan,c=TEST' '(ou=ldb  test)'