net-ldap 0.15.0 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of net-ldap might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -1
- data/.rubocop_todo.yml +240 -86
- data/History.rdoc +6 -0
- data/README.rdoc +4 -6
- data/lib/net/ber.rb +3 -4
- data/lib/net/ber/ber_parser.rb +3 -3
- data/lib/net/ldap.rb +51 -41
- data/lib/net/ldap/auth_adapter/sasl.rb +3 -1
- data/lib/net/ldap/connection.rb +27 -28
- data/lib/net/ldap/dn.rb +4 -5
- data/lib/net/ldap/entry.rb +4 -5
- data/lib/net/ldap/version.rb +1 -1
- data/net-ldap.gemspec +1 -1
- data/script/generate-fixture-ca +48 -0
- data/script/install-openldap +38 -19
- data/test/fixtures/ca/ca.info +4 -0
- data/test/fixtures/ca/cacert.pem +24 -0
- data/test/fixtures/ca/cakey.pem +190 -0
- data/test/integration/test_bind.rb +214 -12
- data/test/support/vm/openldap/README.md +35 -3
- data/test/support/vm/openldap/Vagrantfile +1 -0
- data/test/test_helper.rb +9 -1
- data/test/test_ldap_connection.rb +1 -3
- data/test/test_ldif.rb +1 -1
- metadata +12 -7
- data/test/fixtures/cacert.pem +0 -20
@@ -1,8 +1,31 @@
|
|
1
1
|
# Local OpenLDAP Integration Testing
|
2
2
|
|
3
|
-
Set up a [Vagrant](http://www.vagrantup.com/) VM to run integration
|
3
|
+
Set up a [Vagrant](http://www.vagrantup.com/) VM to run integration
|
4
|
+
tests against OpenLDAP locally. *NOTE*: To support some of the SSL tests,
|
5
|
+
Vagrant forwards localhost port 9389 to VM host port 9389. The port mapping
|
6
|
+
goes away when you run `vagrant destroy`.
|
4
7
|
|
5
|
-
|
8
|
+
## Install Vagrant
|
9
|
+
|
10
|
+
*NOTE*: The Vagrant gem (`gem install vagrant`) is
|
11
|
+
[no longer supported](https://www.vagrantup.com/docs/installation/). If you've
|
12
|
+
previously installed it, run `gem uninstall vagrant`. If you're an rbenv
|
13
|
+
user, you probably want to follow that up with `rbenv rehash; hash -r`.
|
14
|
+
|
15
|
+
If you use Homebrew on macOS:
|
16
|
+
``` bash
|
17
|
+
$ brew update
|
18
|
+
$ brew cask install virtualbox
|
19
|
+
$ brew cask install vagrant
|
20
|
+
$ brew cask install vagrant-manager
|
21
|
+
$ vagrant plugin install vagrant-vbguest
|
22
|
+
```
|
23
|
+
|
24
|
+
Installing Vagrant and virtualbox on other operating systems is left
|
25
|
+
as an exercise to the reader. Note the `vagrant-vbguest` plugin is required
|
26
|
+
to update the VirtualBox guest extensions in the guest VM image.
|
27
|
+
|
28
|
+
## Run the tests
|
6
29
|
|
7
30
|
``` bash
|
8
31
|
# start VM (from the correct directory)
|
@@ -15,6 +38,9 @@ $ ip=$(vagrant ssh -- "ifconfig eth1 | grep -o -E '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]
|
|
15
38
|
# change back to root project directory
|
16
39
|
$ cd ../../../..
|
17
40
|
|
41
|
+
# set the TCP port for testing
|
42
|
+
$ export INTEGRATION_PORT=9389
|
43
|
+
|
18
44
|
# run all tests, including integration tests
|
19
45
|
$ time INTEGRATION=openldap INTEGRATION_HOST=$ip bundle exec rake
|
20
46
|
|
@@ -27,6 +53,12 @@ $ export INTEGRATION_HOST=$ip
|
|
27
53
|
|
28
54
|
# now run tests without having to set ENV variables
|
29
55
|
$ time bundle exec rake
|
56
|
+
|
57
|
+
# Once you're all done
|
58
|
+
$ cd test/support/vm/openldap
|
59
|
+
$ vagrant destroy
|
30
60
|
```
|
31
61
|
|
32
|
-
|
62
|
+
If at any point your VM appears to have broken itself, `vagrant destroy`
|
63
|
+
from the `test/support/vm/openldap` directory will blow it away. You can
|
64
|
+
then do `vagrant up` and start over.
|
data/test/test_helper.rb
CHANGED
@@ -14,10 +14,18 @@ CA_FILE =
|
|
14
14
|
if File.exist?("/etc/ssl/certs/cacert.pem")
|
15
15
|
"/etc/ssl/certs/cacert.pem"
|
16
16
|
else
|
17
|
-
File.expand_path("fixtures/cacert.pem", File.dirname(__FILE__))
|
17
|
+
File.expand_path("fixtures/ca/cacert.pem", File.dirname(__FILE__))
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
+
BIND_CREDS = {
|
22
|
+
method: :simple,
|
23
|
+
username: "uid=user1,ou=People,dc=rubyldap,dc=com",
|
24
|
+
password: "passworD1",
|
25
|
+
}.freeze
|
26
|
+
|
27
|
+
TLS_OPTS = OpenSSL::SSL::SSLContext::DEFAULT_PARAMS.merge({}).freeze
|
28
|
+
|
21
29
|
if RUBY_VERSION < "2.0"
|
22
30
|
class String
|
23
31
|
def b
|
@@ -16,9 +16,7 @@ class TestLDAPConnection < Test::Unit::TestCase
|
|
16
16
|
class FakeTCPSocket
|
17
17
|
def initialize(host, port, socket_opts = {})
|
18
18
|
status, error = host.split(".")
|
19
|
-
if status == "fail"
|
20
|
-
raise Object.const_get(error)
|
21
|
-
end
|
19
|
+
raise Object.const_get(error) if status == "fail"
|
22
20
|
end
|
23
21
|
end
|
24
22
|
|
data/test/test_ldif.rb
CHANGED
@@ -76,7 +76,7 @@ class TestLdif < Test::Unit::TestCase
|
|
76
76
|
|
77
77
|
# Must test folded lines and base64-encoded lines as well as normal ones.
|
78
78
|
def test_to_ldif
|
79
|
-
data = File.open(TestLdifFilename, "rb"
|
79
|
+
data = File.open(TestLdifFilename, "rb", &:read)
|
80
80
|
io = StringIO.new(data)
|
81
81
|
|
82
82
|
# added .lines to turn to array because 1.9 doesn't have
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-ldap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francis Cianfrocca
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date:
|
16
|
+
date: 2017-02-24 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: flexmock
|
@@ -49,14 +49,14 @@ dependencies:
|
|
49
49
|
requirements:
|
50
50
|
- - "~>"
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: 0.
|
52
|
+
version: 0.42.0
|
53
53
|
type: :development
|
54
54
|
prerelease: false
|
55
55
|
version_requirements: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
57
|
- - "~>"
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: 0.
|
59
|
+
version: 0.42.0
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: test-unit
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
@@ -151,13 +151,16 @@ files:
|
|
151
151
|
- lib/net/snmp.rb
|
152
152
|
- net-ldap.gemspec
|
153
153
|
- script/changelog
|
154
|
+
- script/generate-fixture-ca
|
154
155
|
- script/install-openldap
|
155
156
|
- script/package
|
156
157
|
- script/release
|
157
158
|
- test/ber/core_ext/test_array.rb
|
158
159
|
- test/ber/core_ext/test_string.rb
|
159
160
|
- test/ber/test_ber.rb
|
160
|
-
- test/fixtures/
|
161
|
+
- test/fixtures/ca/ca.info
|
162
|
+
- test/fixtures/ca/cacert.pem
|
163
|
+
- test/fixtures/ca/cakey.pem
|
161
164
|
- test/fixtures/openldap/memberof.ldif
|
162
165
|
- test/fixtures/openldap/retcode.ldif
|
163
166
|
- test/fixtures/openldap/slapd.conf.ldif
|
@@ -212,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
212
215
|
version: '0'
|
213
216
|
requirements: []
|
214
217
|
rubyforge_project:
|
215
|
-
rubygems_version: 2.5.
|
218
|
+
rubygems_version: 2.5.2
|
216
219
|
signing_key:
|
217
220
|
specification_version: 4
|
218
221
|
summary: Net::LDAP for Ruby (also called net-ldap) implements client access for the
|
@@ -222,7 +225,9 @@ test_files:
|
|
222
225
|
- test/ber/core_ext/test_array.rb
|
223
226
|
- test/ber/core_ext/test_string.rb
|
224
227
|
- test/ber/test_ber.rb
|
225
|
-
- test/fixtures/
|
228
|
+
- test/fixtures/ca/ca.info
|
229
|
+
- test/fixtures/ca/cacert.pem
|
230
|
+
- test/fixtures/ca/cakey.pem
|
226
231
|
- test/fixtures/openldap/memberof.ldif
|
227
232
|
- test/fixtures/openldap/retcode.ldif
|
228
233
|
- test/fixtures/openldap/slapd.conf.ldif
|
data/test/fixtures/cacert.pem
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
-----BEGIN CERTIFICATE-----
|
2
|
-
MIIDRzCCAf+gAwIBAgIEVHpbmjANBgkqhkiG9w0BAQsFADATMREwDwYDVQQDEwhy
|
3
|
-
dWJ5bGRhcDAeFw0xNDExMjkyMzQ5NDZaFw0xNTExMjkyMzQ5NDZaMBMxETAPBgNV
|
4
|
-
BAMTCHJ1YnlsZGFwMIIBUjANBgkqhkiG9w0BAQEFAAOCAT8AMIIBOgKCATEA4pKe
|
5
|
-
cDCNuL53fkpO/WSAS+gmMTsOs+oOK71kZlk2QT/MBz8TxC6m358qCADjnXcMVVxa
|
6
|
-
ySQbQlVKZMkIvLNciZbiLDgC5II0NbHACNa8rqenoKRjS4J9W3OhA8EmnXn/Me+8
|
7
|
-
uMCI9tfnKNRZYdkQZlra4I+Idn+xYfl/5q5b/7ZjPS2zY/585hFEYE+5vfOZVBSU
|
8
|
-
3HMNSeuJvTehLv7dD7aQfXNM4cRgHXequkJQ/HLLFAO4AgJ+LJrFWpj7GWz3crgr
|
9
|
-
9G5px4T78wJH3NQiOsG6UBXPw8c4T+Z6GAWX2l1zs1gZsaiCVbAraqK3404lL7yp
|
10
|
-
+ThbsW3ifzgNPhmjScXBLdbEDrrAKosW7kkTOGzxiMCBmNlj2SKhcztoduAtfF1f
|
11
|
-
Fs2Jk8MRTHwO8ThD7wIDAQABo0MwQTAPBgNVHRMBAf8EBTADAQH/MA8GA1UdDwEB
|
12
|
-
/wQFAwMHBAAwHQYDVR0OBBYEFJDm67ekyFu4/Z7VcO6Vk/5pinGcMA0GCSqGSIb3
|
13
|
-
DQEBCwUAA4IBMQDHeEPzfYRtjynpUKyrtxx/6ZVOfCLuz4eHkBZggz/pJacDCv/a
|
14
|
-
I//W03XCk8RWq/fWVVUzvxXgPwnYcw992PLM7XW81zp6ruRUDWooYnjHZZz3bRhe
|
15
|
-
kC4QvM2mZhcsMVmhmWWKZn81qXgVdUY1XNRhk87cuXjF/UTpEieFvWAsCUkFZkqB
|
16
|
-
AmySCuI/FuPaauT1YAltkIlYAEIGNJGZDMf2BTVUQpXhTXeS9/AZWLNDBwiq+fwo
|
17
|
-
YYnsr9MnBXCEmg1gVSR/Ay2AZmbYfiYtb5kU8uq2lSWAUb4LX6HZl82wo3OilrJ2
|
18
|
-
WXl6Qf+Fcy4qqkRt4AKHjtzizpEDCOVYuuG0Zoy+QnxNXRsEzpb8ymnJFrcgYfk/
|
19
|
-
6Lv2gWAFl5FqCZp7gBWg55eL2coT4C+mbNTF
|
20
|
-
-----END CERTIFICATE-----
|