File: ldaplogin

package info (click to toggle)
libtcl-ldap 1.0-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 180 kB
  • ctags: 305
  • sloc: ansic: 1,435; tcl: 161; makefile: 57
file content (79 lines) | stat: -rwxr-xr-x 1,848 bytes parent folder | download
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/wish

# read the config file
load tclLdap.so
proc bindtodb {} {
LdapBind $host $binddn $bindpw
exit
}
if {[file exists "~/.ldaprc"]} {
  set configfile "~/.ldaprc"
} elseif {[file exists "/etc/openldap/ldap.conf"]} {
  set configfile "/etc/openldap/ldap.conf"
}
set base "random"
set port "389"
global host
global base
global binddn
global bindpw
global port
set conf [ open $configfile r]
while { [ eof $conf ] == 0 } {
gets $conf confline
regexp {^BASE +(.*)} $confline x base
regexp {^HOST +(.*)} $confline x host
regexp {^PORT +(.*)} $confline x port
}
close $conf
set binddn "uid=$env(USER),$base"

# create the login widget
frame .login
label .login.binddn_txt \
  -text "Bind DN"
entry .login.binddn \
  -width 30 \
  -textvariable binddn

label .login.bindpw_txt \
  -text "Bind Pw"
entry .login.bindpw \
  -width 30 \
  -show * \
  -textvariable bindpw

label .login.base_txt \
  -text "Base"
entry .login.base \
  -width 30 \
  -textvariable base

label .login.host_txt \
 -text "Server"
entry .login.host \
  -width 30 \
  -textvariable host

label .login.port_txt \
 -text "Port"
entry .login.port \
  -width 30 \
  -textvariable port
frame .go
button .go.bindtoldap \
  -text "Bind to Database" \
  -command { LdapBind $host $port $binddn $bindpw }

grid config .login.binddn_txt -column 0 -row 0 -sticky e
grid config .login.binddn -column 1 -row 0 -sticky e
grid config .login.bindpw_txt -column 0 -row 1 -sticky e
grid config .login.bindpw -column 1 -row 1 -sticky e
grid config .login.base_txt -column 0 -row 2 -sticky e
grid config .login.base -column 1 -row 2 -sticky e
grid config .login.host_txt -column 0 -row 3 -sticky e
grid config .login.host -column 1 -row 3 -sticky e
grid config .login.port_txt -column 0 -row 4 -sticky e
grid config .login.port -column 1 -row 4 -sticky e
pack .go.bindtoldap
pack .login .go