~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-10-02 14:17:48 UTC
  • mfrom: (1.1.1 upstream)
  • mto: (2.1.17 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20101002141748-m6vbfbfjhrw1153e
Tags: 2010.09.1802-1
* New upstream release.
* Removed pid-file argument hack.
* Updated GPL-2 address to be new address.
* Directly copy in drizzledump.1 since debian doesn't have sphinx 1.0 yet.
* Link to jquery from libjs-jquery. Add it as a depend.
* Add drizzled.8 symlink to the install files.

Show diffs side-by-side

added added

removed removed

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