~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/auth_ldap/schema/gentestusers.sh

  • Committer: Brian Aker
  • Date: 2010-08-18 16:12:58 UTC
  • mto: This revision was merged to the branch mainline in revision 1720.
  • Revision ID: brian@tangent.org-20100818161258-1vm71da888dfvwsx
Remove the code surrounding stack trace.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
help() {
 
4
    echo "Arguement options are:"
 
5
    echo "-p: password to use for password"
 
6
    echo "-b: path to mysql_password_hash"
 
7
    echo "-u: username to generate users from"
 
8
    echo "-n: number of users to generate"
 
9
    echo "-l: base ldap dn to use for user generation"
 
10
    echo "-d: debug"
 
11
    echo 
 
12
    echo "$0 is a script used to generate users to test"
 
13
    echo " drizzles mysql auth integration with ldap."
 
14
    echo " if \"-b\" is set users will be generated with attribute"
 
15
    echo " drizzleUserMysqlPassword"
 
16
    echo " Script dumps all information to stdout so end user can decide"
 
17
    echo " what they want to do with output."
 
18
    echo 
 
19
}
 
20
 
 
21
genldif() {
 
22
    if [ $debug ] 
 
23
    then 
 
24
        echo "-p: $password"
 
25
        echo "-b: $mysqlpasswordhashbin"
 
26
        echo "-u: $username"
 
27
        echo "-n: $numberofusers"
 
28
        echo "-l: $ldapbase"
 
29
        echo "-d: $debug" 
 
30
        echo 
 
31
    fi
 
32
 
 
33
    tmpcount=0
 
34
    while [ $tmpcount -lt $numberofusers ]
 
35
    do
 
36
        tmpusername=$username$tmpcount
 
37
        tmpuidnumber=$(( 500 + $tmpcount ))
 
38
        tmpgidnumber=$(( 500 + $tmpcount ))
 
39
        echo "dn: uid=$tmpusername,$ldapbase"
 
40
        echo "objectclass: top"
 
41
        echo "objectclass: posixAccount"
 
42
        echo "objectclass: account"
 
43
        if [ $mysqlpasswordhashbin ]
 
44
        then
 
45
            echo "objectclass: drizzleUser"
 
46
            mysqlpasshash=`$mysqlpasswordhashbin $password`
 
47
            echo "drizzleUserMysqlPassword: $mysqlpasshash"
 
48
        fi
 
49
        echo "uidNumber: $tmpuidnumber"
 
50
        echo "gidNumber: $tmpgidnumber"
 
51
        echo "uid: $tmpusername"
 
52
        echo "homeDirectory: /home/$tmpusername"
 
53
        echo "loginshell: /sbin/nologin"
 
54
        echo "userPassword: $password"
 
55
        echo "cn: $tmpusername"
 
56
        echo
 
57
        tmpcount=$(($tmpcount + 1))
 
58
 
 
59
    done
 
60
}
 
61
 
 
62
while [ $# -gt 0 ]
 
63
do
 
64
    case $1
 
65
    in
 
66
        -p)
 
67
            password=$2
 
68
            shift 2
 
69
        ;;
 
70
        
 
71
        -b)
 
72
            mysqlpasswordhashbin=$2
 
73
            shift 2
 
74
        ;;
 
75
        
 
76
        -u)
 
77
            username=$2
 
78
            shift 2
 
79
        ;;
 
80
        
 
81
        -n)
 
82
            numberofusers=$2
 
83
            shift 2
 
84
        ;;
 
85
        -l)
 
86
            ldapbase=$2
 
87
            shift 2
 
88
        ;;
 
89
        -d)
 
90
            debug=1
 
91
            shift 1
 
92
        ;;
 
93
 
 
94
        *)
 
95
            help
 
96
            shift 1
 
97
            exit
 
98
        ;;
 
99
    esac
 
100
done
 
101
 
 
102
genldif