Module: LDAP
- Defined in:
- lib/ldap/schema.rb,
lib/ldap.rb,
lib/ldap/mod.rb,
lib/ldap/conn.rb,
lib/ldap/entry.rb,
lib/ldap/error.rb,
lib/ldap/control.rb,
lib/ldap/constants.rb
Overview
Manipulation of LDAP control data.
$Id: control.rb,v 1.2 2005/02/28 05:02:25 ianmacd Exp $
Copyright © 2004 Ian Macdonald <[email protected]>
Defined Under Namespace
Modules: ConnImplementation
Classes: Conn, Control, Entry, Error, InvalidDataError, InvalidEntryError, Mod, ResultError, SSLConn, Schema
Constant Summary
collapse
- LDAPS_PORT =
636
- LDAP_ADMINLIMIT_EXCEEDED =
11
- LDAP_ALIAS_DEREF_PROBLEM =
36
- LDAP_ALIAS_PROBLEM =
33
- LDAP_ALREADY_EXISTS =
68
- LDAP_API_INFO_VERSION =
1
- LDAP_API_VERSION =
3001
- LDAP_AUTH_KRBV41 =
129
- LDAP_AUTH_KRBV42 =
130
- LDAP_AUTH_METHOD_NOT_SUPPORTED =
7
- LDAP_AUTH_NONE =
0
- LDAP_AUTH_SASL =
163
- LDAP_AUTH_SIMPLE =
128
- LDAP_AUTH_UNKNOWN =
-6
- LDAP_BUSY =
51
- LDAP_COMPARE_FALSE =
5
- LDAP_COMPARE_TRUE =
6
- LDAP_CONFIDENTIALITY_REQUIRED =
13
- LDAP_CONSTRAINT_VIOLATION =
19
- LDAP_CONTROL_PAGEDRESULTS =
"1.2.840.113556.1.4.319"
- LDAP_DECODING_ERROR =
-4
- LDAP_DEREF_ALWAYS =
3
- LDAP_DEREF_FINDING =
2
- LDAP_DEREF_NEVER =
0
- LDAP_DEREF_SEARCHING =
1
- LDAP_ENCODING_ERROR =
-3
- LDAP_FILTER_ERROR =
-7
- LDAP_INAPPROPRIATE_AUTH =
48
- LDAP_INAPPROPRIATE_MATCHING =
18
- LDAP_INSUFFICIENT_ACCESS =
50
- LDAP_INVALID_CREDENTIALS =
49
- LDAP_INVALID_DN_SYNTAX =
34
- LDAP_INVALID_SYNTAX =
21
- LDAP_IS_LEAF =
35
- LDAP_LOCAL_ERROR =
-2
- LDAP_LOOP_DETECT =
54
- LDAP_MOD_ADD =
0
- LDAP_MOD_BVALUES =
128
- LDAP_MOD_DELETE =
1
- LDAP_MOD_INCREMENT =
3
- LDAP_MOD_OP =
7
- LDAP_MOD_REPLACE =
2
- LDAP_NAMING_VIOLATION =
64
- LDAP_NOT_ALLOWED_ON_NONLEAF =
66
- LDAP_NOT_ALLOWED_ON_RDN =
67
- LDAP_NO_MEMORY =
-10
- LDAP_NO_OBJECT_CLASS_MODS =
69
- LDAP_NO_SUCH_ATTRIBUTE =
16
- LDAP_NO_SUCH_OBJECT =
32
- LDAP_OBJECT_CLASS_VIOLATION =
65
- LDAP_OPERATIONS_ERROR =
1
- LDAP_OPT_API_FEATURE_INFO =
21
- LDAP_OPT_API_INFO =
0
- LDAP_OPT_CLIENT_CONTROLS =
19
- LDAP_OPT_DEREF =
2
- LDAP_OPT_DESC =
1
- LDAP_OPT_HOST_NAME =
48
- LDAP_OPT_OFF =
0
- LDAP_OPT_ON =
3117220
- LDAP_OPT_PROTOCOL_VERSION =
17
- LDAP_OPT_REFERRALS =
8
- LDAP_OPT_RESTART =
9
- LDAP_OPT_SERVER_CONTROLS =
18
- LDAP_OPT_SIZELIMIT =
3
- LDAP_OPT_TIMELIMIT =
4
- LDAP_OPT_X_SASL_AUTHCID =
24834
- LDAP_OPT_X_SASL_AUTHZID =
24835
- LDAP_OPT_X_SASL_MAXBUFSIZE =
24841
- LDAP_OPT_X_SASL_MECH =
24832
- LDAP_OPT_X_SASL_REALM =
24833
- LDAP_OPT_X_SASL_SECPROPS =
24838
- LDAP_OPT_X_SASL_SSF =
24836
- LDAP_OPT_X_SASL_SSF_EXTERNAL =
24837
- LDAP_OPT_X_SASL_SSF_MAX =
24840
- LDAP_OPT_X_SASL_SSF_MIN =
24839
- LDAP_OPT_X_TLS =
24576
- LDAP_OPT_X_TLS_ALLOW =
3
- LDAP_OPT_X_TLS_CACERTDIR =
24579
- LDAP_OPT_X_TLS_CACERTFILE =
24578
- LDAP_OPT_X_TLS_CERTFILE =
24580
- LDAP_OPT_X_TLS_CIPHER_SUITE =
24584
- LDAP_OPT_X_TLS_DEMAND =
2
- LDAP_OPT_X_TLS_HARD =
1
- LDAP_OPT_X_TLS_KEYFILE =
24581
- LDAP_OPT_X_TLS_NEVER =
0
- LDAP_OPT_X_TLS_RANDOM_FILE =
24585
- LDAP_OPT_X_TLS_REQUIRE_CERT =
24582
- LDAP_OPT_X_TLS_TRY =
4
- LDAP_OTHER =
80
- LDAP_PARAM_ERROR =
-9
- LDAP_PARTIAL_RESULTS =
9
- LDAP_PORT =
389
- LDAP_PROTOCOL_ERROR =
2
- LDAP_REFERRAL =
10
- LDAP_RESULTS_TOO_LARGE =
70
- LDAP_SASL_BIND_IN_PROGRESS =
14
- LDAP_SASL_SIMPLE =
nil
- LDAP_SCOPE_BASE =
0
- LDAP_SCOPE_ONELEVEL =
1
- LDAP_SCOPE_SUBTREE =
2
- LDAP_SERVER_DOWN =
-1
- LDAP_SIZELIMIT_EXCEEDED =
4
- LDAP_STRONG_AUTH_NOT_SUPPORTED =
7
- LDAP_STRONG_AUTH_REQUIRED =
8
- LDAP_SUCCESS =
0
- LDAP_TIMELIMIT_EXCEEDED =
3
- LDAP_TIMEOUT =
-5
- LDAP_TYPE_OR_VALUE_EXISTS =
20
- LDAP_UNAVAILABLE =
52
- LDAP_UNAVAILABLE_CRITICAL_EXTENSION =
12
- LDAP_UNDEFINED_TYPE =
17
- LDAP_UNWILLING_TO_PERFORM =
53
- LDAP_USER_CANCELLED =
-8
- LDAP_VENDOR_NAME =
"OpenLDAP"
- LDAP_VENDOR_VERSION =
20335
- LDAP_VERSION =
2
- LDAP_VERSION1 =
1
- LDAP_VERSION2 =
2
- LDAP_VERSION3 =
3
- LDAP_VERSION_MAX =
3
- MAJOR_VERSION =
0
- MINOR_VERSION =
9
- PATCH_VERSION =
7
- VERSION =
"0.9.7"
Class Method Summary
collapse
Class Method Details
.configuration(attrs = { }) ⇒ Object
73
74
75
|
# File 'lib/ldap.rb', line 73
def self.configuration(attrs = { })
@environment.merge attrs
end
|
.entry2hash(entry) ⇒ Object
4
5
6
7
8
9
10
11
|
# File 'lib/ldap/entry.rb', line 4
def entry2hash(entry)
out = {}
out['dn'] = [entry.dn]
entry.get_attributes.each do |k|
out[k] = entry[k]
end
out
end
|
.err2string(err) ⇒ Object
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
|
# File 'lib/ldap.rb', line 4
def self.err2string(err)
case err||0
when -1 then "Can't contact LDAP server"
when 0 then "Success"
when 1 then "Operations error"
when 2 then "Protocol error"
when 3 then "Time limit exceeded"
when 4 then "Size limit exceeded"
when 5 then "Compare False"
when 6 then "Compare True"
when 7 then "Authentication method not supported"
when 8 then "Strong(er) authentication required"
when 9 then "Partial results and referral received"
when 10 then "Referral"
when 11 then "Administrative limit exceeded"
when 12 then "Critical extension is unavailable"
when 13 then "Confidentiality required"
when 14 then "SASL bind in progress"
when 15 then "Unknown error"
when 16 then "No such attribute"
when 17 then "Undefined attribute type"
when 18 then "Inappropriate matching"
when 19 then "Constraint violation"
when 20 then "Type or value exists"
when 21 then "Invalid syntax"
when 32 then "No such object"
when 33 then "Alias problem"
when 34 then "Invalid DN syntax"
when 35 then "Entry is a leaf"
when 36 then "Alias dereferencing problem"
when 47 then "Proxy Authorization Failure"
when 48 then "Inappropriate authentication"
when 49 then "Invalid credentials"
when 50 then "Insufficient access"
when 51 then "Server is busy"
when 52 then "Server is unavailable"
when 53 then "Server is unwilling to perform"
when 54 then "Loop detected"
when 64 then "Naming violation"
when 65 then "Object class violation"
when 66 then "Operation not allowed on non-leaf"
when 67 then "Operation not allowed on RDN"
when 68 then "Already exists"
when 69 then "Cannot modify object class"
when 70 then "Results too large"
when 71 then "Operation affects multiple DSAs"
when 80 then "Internal (implementation specific) error"
else "Unknown error"
end
end
|
.hash2mods(mod_type, hash) ⇒ Object
7
8
9
10
11
|
# File 'lib/ldap/mod.rb', line 7
def hash2mods(mod_type, hash)
hash.map do |key, value|
mod(mod_type, key, value)
end
end
|
.load_configuration(attrs = {}) ⇒ Object
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/ldap.rb', line 55
def self.load_configuration(attrs={})
env = nil
env = javax.naming.directory.InitialDirContext.new.environment rescue nil
default = {'java.naming.factory.initial' => 'com.sun.jndi.ldap.LdapCtxFactory'}
if env
env2 = default.dup
env.each do |k,v|
env2[k.to_s] = v.to_s
end
env = env2
else
env = default.dup
end
env = default.dup
env.merge! attrs
@environment = env
end
|
.mod(mod_type, attr, vals) ⇒ Object
3
4
5
|
# File 'lib/ldap/mod.rb', line 3
def mod(mod_type, attr, vals)
Mod.new(mod_type, attr, vals)
end
|