~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/auth_ldap/test_ldap.sh

  • Committer: Monty Taylor
  • Date: 2010-04-22 02:46:23 UTC
  • mto: (1497.3.4 enable-dtrace)
  • mto: This revision was merged to the branch mainline in revision 1527.
  • Revision ID: mordred@inaugust.com-20100422024623-4urw8fi8eraci08p
Don't overwrite the pandora_vc_revinfo file if we don't have new
authoratative information.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
# Copyright (C) 2010 Eric Day
3
 
# All rights reserved.
4
 
#
5
 
# Redistribution and use in source and binary forms, with or without
6
 
# modification, are permitted provided that the following conditions are
7
 
# met:
8
 
#
9
 
#     * Redistributions of source code must retain the above copyright
10
 
# notice, this list of conditions and the following disclaimer.
11
 
#
12
 
#     * Redistributions in binary form must reproduce the above
13
 
# copyright notice, this list of conditions and the following disclaimer
14
 
# in the documentation and/or other materials provided with the
15
 
# distribution.
16
 
#
17
 
#     * The names of its contributors may not be used to endorse or
18
 
# promote products derived from this software without specific prior
19
 
# written permission.
20
 
#
21
 
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
 
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
 
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24
 
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25
 
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26
 
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27
 
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28
 
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29
 
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30
 
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31
 
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
 
 
33
 
# Kill any leftover processes from before
34
 
pids=`ps -ef|grep drizzled|grep 12345|awk '{print $2}'`
35
 
if [ "$pids" != "" ]
36
 
then
37
 
  kill -9 $pids
38
 
  sleep 1
39
 
fi
40
 
 
41
 
datadir=$1
42
 
 
43
 
./drizzled/drizzled \
44
 
  --datadir=$datadir \
45
 
  --plugin-add=auth_ldap \
46
 
  --auth-ldap-uri=ldap://127.0.0.1:12321/ \
47
 
  --auth-ldap-bind-dn="cn=root,dc=drizzle,dc=org" \
48
 
  --auth-ldap-bind-password=testldap \
49
 
  --auth-ldap-base-dn="dc=drizzle,dc=org" \
50
 
  --auth-ldap-cache-timeout=1 \
51
 
  --mysql-protocol-port=12345 \
52
 
  --drizzle-protocol.port=12346 \
53
 
  --pid-file=pid &
54
 
 
55
 
sleep 3
56
 
 
57
 
failed=0
58
 
 
59
 
for x in 1 2
60
 
do
61
 
  echo
62
 
  echo "Test good login:"
63
 
  echo "SELECT 'SUCCESS';" | ./client/drizzle -u user -Pdrizzlepass -p 12345
64
 
  if [ $? -ne 0 ]
65
 
  then
66
 
    failed=1
67
 
  fi
68
 
 
69
 
  echo
70
 
  echo "Test bad password:"
71
 
  echo "SELECT 'FAIL';" | ./client/drizzle -u user -Pbadpass -p 12345
72
 
  if [ $? -ne 1 ]
73
 
  then
74
 
    failed=1
75
 
  fi
76
 
 
77
 
  echo
78
 
  echo "Test no password:"
79
 
  echo "SELECT 'FAIL';" | ./client/drizzle -u user -p 12345
80
 
  if [ $? -ne 1 ]
81
 
  then
82
 
    failed=1
83
 
  fi
84
 
 
85
 
  echo
86
 
  echo "Test bad user:"
87
 
  echo "SELECT 'FAIL';" | ./client/drizzle -u baduser -Pdrizzlepass -p 12345
88
 
  if [ $? -ne 1 ]
89
 
  then
90
 
    failed=1
91
 
  fi
92
 
  echo
93
 
 
94
 
  echo "Test bad user with no password:"
95
 
  echo "SELECT 'FAIL';" | ./client/drizzle -u baduser -p 12345
96
 
  if [ $? -ne 1 ]
97
 
  then
98
 
    failed=1
99
 
  fi
100
 
 
101
 
  # sleep here so ldap cache has time to clear
102
 
  sleep 2
103
 
done
104
 
 
105
 
kill `cat $datadir/pid`
106
 
sleep 2
107
 
 
108
 
echo
109
 
 
110
 
if [ $failed -ne 0 ]
111
 
then
112
 
  echo "At least one test failed, see error messages above"
113
 
  exit 1
114
 
fi
115
 
 
116
 
echo "All tests passed successfully!"
117
 
exit 0