openldap 0.0.1pre11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gemtest +0 -0
- data/History.md +4 -0
- data/Manifest.txt +20 -0
- data/README.md +100 -0
- data/Rakefile +152 -0
- data/Roadmap.md +55 -0
- data/ext/connection.c +1125 -0
- data/ext/extconf.rb +24 -0
- data/ext/openldap.c +558 -0
- data/ext/openldap.h +91 -0
- data/lib/openldap.rb +102 -0
- data/lib/openldap/connection.rb +179 -0
- data/lib/openldap/exceptions.rb +246 -0
- data/lib/openldap/mixins.rb +65 -0
- data/lib/openldap/utils.rb +123 -0
- data/spec/lib/constants.rb +29 -0
- data/spec/lib/helpers.rb +128 -0
- data/spec/openldap/connection_spec.rb +190 -0
- data/spec/openldap/exceptions_spec.rb +46 -0
- data/spec/openldap_spec.rb +83 -0
- data/test.conf-example +2 -0
- metadata +181 -0
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/usr/bin/env rspec -cfd -b
|
2
|
+
|
3
|
+
BEGIN {
|
4
|
+
require 'pathname'
|
5
|
+
basedir = Pathname( __FILE__ ).dirname.parent.parent
|
6
|
+
libdir = basedir + 'lib'
|
7
|
+
|
8
|
+
$LOAD_PATH.unshift( basedir.to_s ) unless $LOAD_PATH.include?( basedir.to_s )
|
9
|
+
$LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s )
|
10
|
+
}
|
11
|
+
|
12
|
+
require 'rspec'
|
13
|
+
require 'spec/lib/helpers'
|
14
|
+
require 'openldap/exceptions'
|
15
|
+
|
16
|
+
describe OpenLDAP, "exceptions" do
|
17
|
+
|
18
|
+
before( :all ) do
|
19
|
+
setup_logging( :fatal )
|
20
|
+
end
|
21
|
+
|
22
|
+
after( :all ) do
|
23
|
+
reset_logging()
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
it "autogenerates exceptions for OpenLDAP error status codes" do
|
28
|
+
eclass = OpenLDAP::RESULT_EXCEPTION_CLASS[ OpenLDAP::LDAP_OPERATIONS_ERROR ]
|
29
|
+
|
30
|
+
eclass.should be_a( Class )
|
31
|
+
eclass.name.should == "OpenLDAP::OperationsError"
|
32
|
+
eclass.result_code.should == OpenLDAP::LDAP_OPERATIONS_ERROR
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
describe OpenLDAP::Error do
|
37
|
+
|
38
|
+
it "knows how to look up the exception class for a result code" do
|
39
|
+
OpenLDAP::Error.subclass_for( OpenLDAP::LDAP_INVALID_CREDENTIALS ).
|
40
|
+
should == OpenLDAP::InvalidCredentials
|
41
|
+
OpenLDAP::InvalidCredentials.result_code.should == OpenLDAP::LDAP_INVALID_CREDENTIALS
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
@@ -0,0 +1,83 @@
|
|
1
|
+
#!/usr/bin/env rspec -cfd -b
|
2
|
+
|
3
|
+
BEGIN {
|
4
|
+
require 'pathname'
|
5
|
+
basedir = Pathname( __FILE__ ).dirname.parent
|
6
|
+
libdir = basedir + 'lib'
|
7
|
+
|
8
|
+
$LOAD_PATH.unshift( basedir.to_s ) unless $LOAD_PATH.include?( basedir.to_s )
|
9
|
+
$LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s )
|
10
|
+
}
|
11
|
+
|
12
|
+
require 'rspec'
|
13
|
+
require 'spec/lib/helpers'
|
14
|
+
require 'openldap'
|
15
|
+
|
16
|
+
describe OpenLDAP do
|
17
|
+
|
18
|
+
before( :all ) do
|
19
|
+
setup_logging( :fatal )
|
20
|
+
end
|
21
|
+
|
22
|
+
after( :all ) do
|
23
|
+
reset_logging()
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
# typedef struct ldap_url_desc {
|
28
|
+
# char * lud_scheme; /* URI scheme */
|
29
|
+
# char * lud_host; /* LDAP host to contact */
|
30
|
+
# int lud_port; /* port on host */
|
31
|
+
# char * lud_dn; /* base for search */
|
32
|
+
# char ** lud_attrs; /* list of attributes */
|
33
|
+
# int lud_scope; /* a LDAP_SCOPE_... value */
|
34
|
+
# char * lud_filter; /* LDAP search filter */
|
35
|
+
# char ** lud_exts; /* LDAP extensions */
|
36
|
+
# int lud_crit_exts; /* true if any extension is critical */
|
37
|
+
# /* may contain additional fields for internal use */
|
38
|
+
# } LDAPURLDesc;
|
39
|
+
it "can split an LDAP URL into its components" do
|
40
|
+
OpenLDAP.split_url( 'ldap://ldap.acme.com/dc=acme,dc=com' ).should == [
|
41
|
+
'ldap',
|
42
|
+
'ldap.acme.com',
|
43
|
+
389,
|
44
|
+
'dc=acme,dc=com',
|
45
|
+
[],
|
46
|
+
OpenLDAP::LDAP_SCOPE_BASE,
|
47
|
+
nil,
|
48
|
+
[],
|
49
|
+
false,
|
50
|
+
]
|
51
|
+
end
|
52
|
+
|
53
|
+
it "raises an argument error when asked to split a String that isn't an LDAP URL" do
|
54
|
+
expect {
|
55
|
+
OpenLDAP.split_url( 'your cat is incredibly soft' )
|
56
|
+
}.to raise_error( ArgumentError, /not an ldap url/i )
|
57
|
+
end
|
58
|
+
|
59
|
+
it "propagates taintedness from a split URL to its parts" do
|
60
|
+
url = 'ldap://ldap.acme.com/dc=acme,dc=com'
|
61
|
+
url.taint
|
62
|
+
|
63
|
+
result = OpenLDAP.split_url( url )
|
64
|
+
|
65
|
+
result[0].should be_tainted()
|
66
|
+
result[1].should be_tainted()
|
67
|
+
# port is an immediate object, so it's not tainted
|
68
|
+
result[3].should be_tainted()
|
69
|
+
end
|
70
|
+
|
71
|
+
it "has a method for examining the API info of the library it's linked against" do
|
72
|
+
OpenLDAP.api_info.should be_a( Hash )
|
73
|
+
OpenLDAP.api_info.should include( :api_version, :protocol_version, :extensions,
|
74
|
+
:vendor_name, :vendor_version )
|
75
|
+
end
|
76
|
+
|
77
|
+
it "has a hash of extension versions for the library it's linked against" do
|
78
|
+
OpenLDAP.api_feature_info.should be_a( Hash )
|
79
|
+
OpenLDAP.api_feature_info.should include( *OpenLDAP.api_info[:extensions] )
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
|
data/test.conf-example
ADDED
metadata
ADDED
@@ -0,0 +1,181 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: openldap
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1pre11
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Michael Granger
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain:
|
12
|
+
- ! '-----BEGIN CERTIFICATE-----
|
13
|
+
|
14
|
+
MIIDLDCCAhSgAwIBAgIBADANBgkqhkiG9w0BAQUFADA8MQwwCgYDVQQDDANnZWQx
|
15
|
+
|
16
|
+
FzAVBgoJkiaJk/IsZAEZFgdfYWVyaWVfMRMwEQYKCZImiZPyLGQBGRYDb3JnMB4X
|
17
|
+
|
18
|
+
DTEwMDkxNjE0NDg1MVoXDTExMDkxNjE0NDg1MVowPDEMMAoGA1UEAwwDZ2VkMRcw
|
19
|
+
|
20
|
+
FQYKCZImiZPyLGQBGRYHX2FlcmllXzETMBEGCgmSJomT8ixkARkWA29yZzCCASIw
|
21
|
+
|
22
|
+
DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALy//BFxC1f/cPSnwtJBWoFiFrir
|
23
|
+
|
24
|
+
h7RicI+joq/ocVXQqI4TDWPyF/8tqkvt+rD99X9qs2YeR8CU/YiIpLWrQOYST70J
|
25
|
+
|
26
|
+
vDn7Uvhb2muFVqq6+vobeTkILBEO6pionWDG8jSbo3qKm1RjKJDwg9p4wNKhPuu8
|
27
|
+
|
28
|
+
KGue/BFb67KflqyApPmPeb3Vdd9clspzqeFqp7cUBMEpFS6LWxy4Gk+qvFFJBJLB
|
29
|
+
|
30
|
+
BUHE/LZVJMVzfpC5Uq+QmY7B+FH/QqNndn3tOHgsPadLTNimuB1sCuL1a4z3Pepd
|
31
|
+
|
32
|
+
TeLBEFmEao5Dk3K/Q8o8vlbIB/jBDTUx6Djbgxw77909x6gI9doU4LD5XMcCAwEA
|
33
|
+
|
34
|
+
AaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFJeoGkOr9l4B
|
35
|
+
|
36
|
+
+saMkW/ZXT4UeSvVMA0GCSqGSIb3DQEBBQUAA4IBAQBG2KObvYI2eHyyBUJSJ3jN
|
37
|
+
|
38
|
+
vEnU3d60znAXbrSd2qb3r1lY1EPDD3bcy0MggCfGdg3Xu54z21oqyIdk8uGtWBPL
|
39
|
+
|
40
|
+
HIa9EgfFGSUEgvcIvaYqiN4jTUtidfEFw+Ltjs8AP9gWgSIYS6Gr38V0WGFFNzIH
|
41
|
+
|
42
|
+
aOD2wmu9oo/RffW4hS/8GuvfMzcw7CQ355wFR4KB/nyze+EsZ1Y5DerCAagMVuDQ
|
43
|
+
|
44
|
+
U0BLmWDFzPGGWlPeQCrYHCr+AcJz+NRnaHCKLZdSKj/RHuTOt+gblRex8FAh8NeA
|
45
|
+
|
46
|
+
cmlhXe46pZNJgWKbxZah85jIjx95hR8vOI+NAM5iH9kOqK13DrxacTKPhqj5PjwF
|
47
|
+
|
48
|
+
-----END CERTIFICATE-----
|
49
|
+
|
50
|
+
'
|
51
|
+
date: 2011-08-11 00:00:00.000000000Z
|
52
|
+
dependencies:
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: hoe-mercurial
|
55
|
+
requirement: &2157736660 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ~>
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 1.2.1
|
61
|
+
type: :development
|
62
|
+
prerelease: false
|
63
|
+
version_requirements: *2157736660
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
name: hoe-highline
|
66
|
+
requirement: &2157736180 !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ~>
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: 0.0.1
|
72
|
+
type: :development
|
73
|
+
prerelease: false
|
74
|
+
version_requirements: *2157736180
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: rake-compiler
|
77
|
+
requirement: &2157735720 !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.7'
|
83
|
+
type: :development
|
84
|
+
prerelease: false
|
85
|
+
version_requirements: *2157735720
|
86
|
+
- !ruby/object:Gem::Dependency
|
87
|
+
name: rspec
|
88
|
+
requirement: &2157735300 !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '2.6'
|
94
|
+
type: :development
|
95
|
+
prerelease: false
|
96
|
+
version_requirements: *2157735300
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: hoe
|
99
|
+
requirement: &2157734880 !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
101
|
+
requirements:
|
102
|
+
- - ~>
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '2.11'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: *2157734880
|
108
|
+
description: ! "A simple, but feature-complete Ruby binding for OpenLDAP's libldap.
|
109
|
+
\n\nThis binding is intended as an alternative for [ruby-ldap][] for libraries or
|
110
|
+
applications which require a more complete implementation of the LDAP protocol (according
|
111
|
+
to [RFC4511][]) than it provides.\n\nAdditions or changes:\n\n* Referrals for add,
|
112
|
+
modify, delete, modrdn, compare\n* Controls for add, modify, delete, modrdn, compare\n*
|
113
|
+
Asynchronous and synchronous APIs\n* Detailed exception class hierarchy for results
|
114
|
+
instead of just one\n class for all non-success results.\n* Complete [RFC4511][]
|
115
|
+
support:\n - extended operations and results\n - unsolicited notifications\n -
|
116
|
+
continuation references\n - intermediate responses\n - alias deferencing\n -
|
117
|
+
etc.\n* Cleanly abandon terminated operations where supported\n* Memory-handling
|
118
|
+
cleanup to avoid leaks, corruption, and other\n problems experienced in the wild.\n*
|
119
|
+
Drop deprecated non-_ext variants of operations which have a \n modern equivalent.\n*
|
120
|
+
M17n for Ruby 1.9.x.\n* Improved test coverage\n\n**NOTE:** This library is still
|
121
|
+
under development, and should not be considered to be feature-complete or production-ready.\n\nThis
|
122
|
+
project's versions follow the [Semantic Versioning Specification][semver]."
|
123
|
+
email:
|
124
|
+
- ged@FaerieMUD.org
|
125
|
+
executables: []
|
126
|
+
extensions:
|
127
|
+
- ext/extconf.rb
|
128
|
+
extra_rdoc_files:
|
129
|
+
- Manifest.txt
|
130
|
+
- ext/connection.c
|
131
|
+
- ext/openldap.c
|
132
|
+
files:
|
133
|
+
- .gemtest
|
134
|
+
- History.md
|
135
|
+
- Manifest.txt
|
136
|
+
- README.md
|
137
|
+
- Rakefile
|
138
|
+
- Roadmap.md
|
139
|
+
- ext/connection.c
|
140
|
+
- ext/openldap.c
|
141
|
+
- ext/openldap.h
|
142
|
+
- lib/openldap.rb
|
143
|
+
- lib/openldap/connection.rb
|
144
|
+
- lib/openldap/exceptions.rb
|
145
|
+
- lib/openldap/mixins.rb
|
146
|
+
- lib/openldap/utils.rb
|
147
|
+
- spec/lib/constants.rb
|
148
|
+
- spec/lib/helpers.rb
|
149
|
+
- spec/openldap/connection_spec.rb
|
150
|
+
- spec/openldap/exceptions_spec.rb
|
151
|
+
- spec/openldap_spec.rb
|
152
|
+
- test.conf-example
|
153
|
+
- ext/extconf.rb
|
154
|
+
homepage: http://bitbucket.org/ged/ruby-openldap
|
155
|
+
licenses:
|
156
|
+
- BSD
|
157
|
+
post_install_message:
|
158
|
+
rdoc_options:
|
159
|
+
- --main
|
160
|
+
- README.md
|
161
|
+
require_paths:
|
162
|
+
- lib
|
163
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
164
|
+
none: false
|
165
|
+
requirements:
|
166
|
+
- - ! '>='
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: 1.9.2
|
169
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
170
|
+
none: false
|
171
|
+
requirements:
|
172
|
+
- - ! '>='
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0'
|
175
|
+
requirements: []
|
176
|
+
rubyforge_project: openldap
|
177
|
+
rubygems_version: 1.8.5
|
178
|
+
signing_key:
|
179
|
+
specification_version: 3
|
180
|
+
summary: A simple, but feature-complete Ruby binding for OpenLDAP's libldap
|
181
|
+
test_files: []
|