summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/tests/test-samba3sam.sh
blob: 5baf0bf77ada963d44fa526962fdf1f50ae70dab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/sh

S3URL=$1

if [ -z "$S3URL" ];
then
	rm -f samba3.ldb
	S3URL="tdb://samba3.ldb"
	echo "Adding samba3 LDIF..."
	$VALGRIND ldbadd -H tdb://samba3.ldb < samba3.ldif || exit 1
fi

rm -f samba4.ldb

echo "Initial samba4 LDIF..."
$VALGRIND ldbadd -H tdb://samba4.ldb <<EOF
dn: @MODULES
@LIST: samba3sam

dn: @MAP=samba3sam
@MAP_URL: $S3URL

EOF

LOC="-H tdb://samba4.ldb"

echo "Looking up by non-mapped attribute"
$VALGRIND ldbsearch $LOC "(cn=Administrator)" || exit 1

echo "Looking up by mapped attribute"
$VALGRIND ldbsearch $LOC "(name=Backup Operators)" || exit 1

echo "Looking up by old name of renamed attribute"
$VALGRIND ldbsearch $LOC "(displayName=Backup Operators)" || exit 1

echo "Adding a record"
$VALGRIND ldbadd $LOC <<EOF
dn: cn=Foo,dc=idealx,dc=org
unixName: root
lastLogon: 20000
cn: Foo
showInAdvancedViewOnly: TRUE

EOF

echo "Checking for existance of record"
$VALGRIND ldbsearch $LOC "(cn=Foo)" unixName lastLogon cn showInAdvancedViewOnly || exit 1

echo "Checking for persistence of non-mappable attribute"
$VALGRIND ldbsearch $LOC "(cn=Foo)" showInAdvancedViewOnly | grep showInAdvancedViewOnly || exit 1

echo "Adding record with mapped attribute in dn"
$VALGRIND ldbadd $LOC <<EOF
dn: unixName=nobody,dc=idealx,dc=org
unixName: nobody 
cn: Niemand

EOF

echo "Checking for existance of record (mapped)"
$VALGRIND ldbsearch $LOC "(unixName=nobody)" unixName cn dn || exit 1