net-ldap 0.9.0 → 0.10.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/.gitignore +2 -0
- data/Hacking.rdoc +0 -2
- data/History.rdoc +12 -0
- data/README.rdoc +3 -3
- data/Rakefile +8 -69
- data/lib/net/ldap.rb +21 -5
- data/lib/net/ldap/connection.rb +11 -3
- data/lib/net/ldap/filter.rb +1 -1
- data/lib/net/ldap/version.rb +1 -1
- data/net-ldap.gemspec +2 -5
- data/script/install-openldap +66 -2
- data/test/fixtures/cacert.pem +20 -0
- data/test/integration/test_bind.rb +12 -0
- data/test/test_filter_parser.rb +4 -0
- data/test/test_helper.rb +12 -0
- data/test/test_ldap_connection.rb +1 -1
- metadata +7 -35
- data/Manifest.txt +0 -52
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 570b21d340b31538c59bb0082891227b4b048398
|
4
|
+
data.tar.gz: 3101e8927d74913355235198f91b2907b308b712
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9f13490870b0aba267a7de18150eaf40aabf0fb1ace4f0476456b78305873ceb6417448685f3727e737759ae8c4e3db05743cf3b38ba5a64ddf4f6559b11302
|
7
|
+
data.tar.gz: ba4770abb3b87844dc138d21f94cc4c783d0addae63f525b119d99656b9b1ac32d36a6dc28ea017b74504828737b90b757d878337db1ada66edf9ccfe3d3d451
|
data/.gitignore
CHANGED
data/Hacking.rdoc
CHANGED
data/History.rdoc
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
=== Net::LDAP 0.10.0
|
2
|
+
* Major enhancements:
|
3
|
+
* Accept SimpleTLS/StartTLS encryption options (compatible with `OpenSSL::SSL::SSLContext#set_params`)
|
4
|
+
* Bug fixes:
|
5
|
+
* Parse filter strings with square and curly braces (`[]` and `{}`)
|
6
|
+
* Handle connection timeout errors (`Errno::ETIMEDOUT` raised as `Net::LDAP::LdapError`)
|
7
|
+
* Testing changes:
|
8
|
+
* Add integration tests for StartTLS connections to OpenLDAP
|
9
|
+
* Meta changes:
|
10
|
+
* Update Gem release tooling (remove Hoe, use Rake)
|
11
|
+
* Fix Gem release date
|
12
|
+
|
1
13
|
=== Net::LDAP 0.9.0
|
2
14
|
* Major changes:
|
3
15
|
* Dropped support for ruby 1.8.7, ruby >= 1.9.3 now required
|
data/README.rdoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
= Net::LDAP for Ruby {<img src="https://travis-ci.org/
|
1
|
+
= Net::LDAP for Ruby {<img src="https://travis-ci.org/ruby-ldap/ruby-net-ldap.png" />}[https://travis-ci.org/github/ruby-net-ldap]
|
2
2
|
|
3
3
|
== Description
|
4
4
|
|
@@ -41,8 +41,8 @@ Simply require either 'net-ldap' or 'net/ldap'.
|
|
41
41
|
|
42
42
|
This section is for gem maintainers to cut a new version of the gem.
|
43
43
|
|
44
|
-
* Update lib/
|
45
|
-
* Update
|
44
|
+
* Update lib/net/ldap/version.rb to next version number X.X.X following {semver}(http://semver.org/).
|
45
|
+
* Update `History.rdoc`. Get latest changes with `git log --oneline vLAST_RELEASE..HEAD | grep Merge`
|
46
46
|
* On the master branch, run `script/release`
|
47
47
|
|
48
48
|
:include: Contributors.rdoc
|
data/Rakefile
CHANGED
@@ -1,74 +1,13 @@
|
|
1
|
+
#!/usr/bin/env rake
|
1
2
|
# -*- ruby encoding: utf-8 -*-
|
3
|
+
# vim: syntax=ruby
|
2
4
|
|
3
|
-
require
|
4
|
-
require 'hoe'
|
5
|
-
|
6
|
-
Hoe.plugin :doofus
|
7
|
-
Hoe.plugin :git
|
8
|
-
Hoe.plugin :gemspec
|
9
|
-
|
10
|
-
Hoe.spec 'net-ldap' do |spec|
|
11
|
-
# spec.rubyforge_name = spec.name
|
12
|
-
|
13
|
-
spec.developer("Francis Cianfrocca", "blackhedd@rubyforge.org")
|
14
|
-
spec.developer("Emiel van de Laar", "gemiel@gmail.com")
|
15
|
-
spec.developer("Rory O'Connell", "rory.ocon@gmail.com")
|
16
|
-
spec.developer("Kaspar Schiess", "kaspar.schiess@absurd.li")
|
17
|
-
spec.developer("Austin Ziegler", "austin@rubyforge.org")
|
18
|
-
spec.developer("Michael Schaarschmidt", "michael@schaaryworks.com")
|
19
|
-
|
20
|
-
spec.remote_rdoc_dir = ''
|
21
|
-
spec.rsync_args << ' --exclude=statsvn/'
|
22
|
-
|
23
|
-
spec.urls = %w(http://rubyldap.com/' 'https://github.com/ruby-ldap/ruby-net-ldap)
|
24
|
-
spec.licenses = ['MIT']
|
25
|
-
|
26
|
-
spec.history_file = 'History.rdoc'
|
27
|
-
spec.readme_file = 'README.rdoc'
|
28
|
-
|
29
|
-
spec.extra_rdoc_files = FileList["*.rdoc"].to_a
|
30
|
-
|
31
|
-
spec.extra_dev_deps << [ "hoe-git", "~> 1" ]
|
32
|
-
spec.extra_dev_deps << [ "hoe-gemspec", "~> 1" ]
|
33
|
-
spec.extra_dev_deps << [ "flexmock", ">= 1.3.0" ]
|
34
|
-
|
35
|
-
spec.clean_globs << "coverage"
|
36
|
-
|
37
|
-
spec.spec_extras[:required_ruby_version] = ">= 1.8.7"
|
38
|
-
spec.multiruby_skip << "1.8.6"
|
39
|
-
spec.multiruby_skip << "1_8_6"
|
40
|
-
|
41
|
-
spec.need_tar = true
|
42
|
-
end
|
43
|
-
|
44
|
-
# I'm not quite ready to get rid of this, but I think "rake git:manifest" is
|
45
|
-
# sufficient.
|
46
|
-
namespace :old do
|
47
|
-
desc "Build the manifest file from the current set of files."
|
48
|
-
task :build_manifest do |t|
|
49
|
-
require 'find'
|
50
|
-
|
51
|
-
paths = []
|
52
|
-
Find.find(".") do |path|
|
53
|
-
next if File.directory?(path)
|
54
|
-
next if path =~ /\.svn/
|
55
|
-
next if path =~ /\.git/
|
56
|
-
next if path =~ /\.hoerc/
|
57
|
-
next if path =~ /\.swp$/
|
58
|
-
next if path =~ %r{coverage/}
|
59
|
-
next if path =~ /~$/
|
60
|
-
paths << path.sub(%r{^\./}, '')
|
61
|
-
end
|
62
|
-
|
63
|
-
File.open("Manifest.txt", "w") do |f|
|
64
|
-
f.puts paths.sort.join("\n")
|
65
|
-
end
|
5
|
+
require 'rake/testtask'
|
66
6
|
|
67
|
-
|
68
|
-
|
7
|
+
Rake::TestTask.new do |t|
|
8
|
+
t.libs << "test"
|
9
|
+
t.test_files = FileList['test/**/test_*.rb']
|
10
|
+
t.verbose = true
|
69
11
|
end
|
70
12
|
|
71
|
-
|
72
|
-
task :cruise => [:test, :spec]
|
73
|
-
|
74
|
-
# vim: syntax=ruby
|
13
|
+
task :default => :test
|
data/lib/net/ldap.rb
CHANGED
@@ -537,10 +537,6 @@ class Net::LDAP
|
|
537
537
|
# additional capabilities are added, more configuration values will be
|
538
538
|
# added here.
|
539
539
|
#
|
540
|
-
# Currently, the only supported argument is { :method => :simple_tls }.
|
541
|
-
# (Equivalently, you may pass the symbol :simple_tls all by itself,
|
542
|
-
# without enclosing it in a Hash.)
|
543
|
-
#
|
544
540
|
# The :simple_tls encryption method encrypts <i>all</i> communications
|
545
541
|
# with the LDAP server. It completely establishes SSL/TLS encryption with
|
546
542
|
# the LDAP server before any LDAP-protocol data is exchanged. There is no
|
@@ -563,10 +559,30 @@ class Net::LDAP
|
|
563
559
|
# The :start_tls like the :simple_tls encryption method also encrypts all
|
564
560
|
# communcations with the LDAP server. With the exception that it operates
|
565
561
|
# over the standard TCP port.
|
562
|
+
#
|
563
|
+
# In order to verify certificates and enable other TLS options, the
|
564
|
+
# :tls_options hash can be passed alongside :simple_tls or :start_tls.
|
565
|
+
# This hash contains any options that can be passed to
|
566
|
+
# OpenSSL::SSL::SSLContext#set_params(). The most common options passed
|
567
|
+
# should be OpenSSL::SSL::SSLContext::DEFAULT_PARAMS, or the :ca_file option,
|
568
|
+
# which contains a path to a Certificate Authority file (PEM-encoded).
|
569
|
+
#
|
570
|
+
# Example for a default setup without custom settings:
|
571
|
+
# {
|
572
|
+
# :method => :simple_tls,
|
573
|
+
# :tls_options => OpenSSL::SSL::SSLContext::DEFAULT_PARAMS
|
574
|
+
# }
|
575
|
+
#
|
576
|
+
# Example for specifying a CA-File and only allowing TLSv1.1 connections:
|
577
|
+
#
|
578
|
+
# {
|
579
|
+
# :method => :start_tls,
|
580
|
+
# :tls_options => { :ca_file => "/etc/cafile.pem", :ssl_version => "TLSv1_1" }
|
581
|
+
# }
|
566
582
|
def encryption(args)
|
567
583
|
case args
|
568
584
|
when :simple_tls, :start_tls
|
569
|
-
args = { :method => args }
|
585
|
+
args = { :method => args, :tls_options => {} }
|
570
586
|
end
|
571
587
|
@encryption = args
|
572
588
|
end
|
data/lib/net/ldap/connection.rb
CHANGED
@@ -17,6 +17,8 @@ class Net::LDAP::Connection #:nodoc:
|
|
17
17
|
raise Net::LDAP::LdapError, "Server #{server[:host]} refused connection on port #{server[:port]}."
|
18
18
|
rescue Errno::EHOSTUNREACH => error
|
19
19
|
raise Net::LDAP::LdapError, "Host #{server[:host]} was unreachable (#{error.message})"
|
20
|
+
rescue Errno::ETIMEDOUT
|
21
|
+
raise Net::LDAP::LdapError, "Connection to #{server[:host]} timed out."
|
20
22
|
end
|
21
23
|
|
22
24
|
if server[:encryption]
|
@@ -39,9 +41,15 @@ class Net::LDAP::Connection #:nodoc:
|
|
39
41
|
end
|
40
42
|
end
|
41
43
|
|
42
|
-
def self.wrap_with_ssl(io)
|
44
|
+
def self.wrap_with_ssl(io, tls_options = {})
|
43
45
|
raise Net::LDAP::LdapError, "OpenSSL is unavailable" unless Net::LDAP::HasOpenSSL
|
46
|
+
|
44
47
|
ctx = OpenSSL::SSL::SSLContext.new
|
48
|
+
|
49
|
+
# By default, we do not verify certificates. For a 1.0 release, this should probably be changed at some point.
|
50
|
+
# See discussion in https://github.com/ruby-ldap/ruby-net-ldap/pull/161
|
51
|
+
ctx.set_params(tls_options) unless tls_options.empty?
|
52
|
+
|
45
53
|
conn = OpenSSL::SSL::SSLSocket.new(io, ctx)
|
46
54
|
conn.connect
|
47
55
|
|
@@ -83,7 +91,7 @@ class Net::LDAP::Connection #:nodoc:
|
|
83
91
|
def setup_encryption(args)
|
84
92
|
case args[:method]
|
85
93
|
when :simple_tls
|
86
|
-
@conn = self.class.wrap_with_ssl(@conn)
|
94
|
+
@conn = self.class.wrap_with_ssl(@conn, args[:tls_options])
|
87
95
|
# additional branches requiring server validation and peer certs, etc.
|
88
96
|
# go here.
|
89
97
|
when :start_tls
|
@@ -100,7 +108,7 @@ class Net::LDAP::Connection #:nodoc:
|
|
100
108
|
end
|
101
109
|
|
102
110
|
if pdu.result_code.zero?
|
103
|
-
@conn = self.class.wrap_with_ssl(@conn)
|
111
|
+
@conn = self.class.wrap_with_ssl(@conn, args[:tls_options])
|
104
112
|
else
|
105
113
|
raise Net::LDAP::LdapError, "start_tls failed: #{pdu.result_code}"
|
106
114
|
end
|
data/lib/net/ldap/filter.rb
CHANGED
@@ -753,7 +753,7 @@ class Net::LDAP::Filter
|
|
753
753
|
scanner.scan(/\s*/)
|
754
754
|
if op = scanner.scan(/<=|>=|!=|:=|=/)
|
755
755
|
scanner.scan(/\s*/)
|
756
|
-
if value = scanner.scan(/(?:[-\w*.+:@=,#\$%&!'
|
756
|
+
if value = scanner.scan(/(?:[-\[\]{}\w*.+:@=,#\$%&!'^~\s\xC3\x80-\xCA\xAF]|[^\x00-\x7F]|\\[a-fA-F\d]{2})+/u)
|
757
757
|
# 20100313 AZ: Assumes that "(uid=george*)" is the same as
|
758
758
|
# "(uid=george* )". The standard doesn't specify, but I can find
|
759
759
|
# no examples that suggest otherwise.
|
data/lib/net/ldap/version.rb
CHANGED
data/net-ldap.gemspec
CHANGED
@@ -8,7 +8,6 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.version = Net::LDAP::VERSION
|
9
9
|
s.license = "MIT"
|
10
10
|
s.authors = ["Francis Cianfrocca", "Emiel van de Laar", "Rory O'Connell", "Kaspar Schiess", "Austin Ziegler", "Michael Schaarschmidt"]
|
11
|
-
s.date = %q{2012-02-28}
|
12
11
|
s.description = %q{Net::LDAP for Ruby (also called net-ldap) implements client access for the
|
13
12
|
Lightweight Directory Access Protocol (LDAP), an IETF standard protocol for
|
14
13
|
accessing distributed directory services. Net::LDAP is written completely in
|
@@ -21,7 +20,7 @@ earlier versions of the IETF LDAP RFCs (2251-2256, 2829-2830, 3377, and 3771).
|
|
21
20
|
Our roadmap for Net::LDAP 1.0 is to gain full <em>client</em> compliance with
|
22
21
|
the most recent LDAP RFCs (4510-4519, plutions of 4520-4532).}
|
23
22
|
s.email = ["blackhedd@rubyforge.org", "gemiel@gmail.com", "rory.ocon@gmail.com", "kaspar.schiess@absurd.li", "austin@rubyforge.org"]
|
24
|
-
s.extra_rdoc_files = ["
|
23
|
+
s.extra_rdoc_files = ["Contributors.rdoc", "Hacking.rdoc", "History.rdoc", "License.rdoc", "README.rdoc"]
|
25
24
|
s.files = `git ls-files`.split $/
|
26
25
|
s.test_files = s.files.grep(%r{^test})
|
27
26
|
s.homepage = %q{http://github.com/ruby-ldap/ruby-net-ldap}
|
@@ -30,8 +29,6 @@ the most recent LDAP RFCs (4510-4519, plutions of 4520-4532).}
|
|
30
29
|
s.required_ruby_version = ">= 1.9.3"
|
31
30
|
s.summary = %q{Net::LDAP for Ruby (also called net-ldap) implements client access for the Lightweight Directory Access Protocol (LDAP), an IETF standard protocol for accessing distributed directory services}
|
32
31
|
|
33
|
-
s.add_development_dependency("hoe-git", "~> 1.0")
|
34
|
-
s.add_development_dependency("hoe-gemspec", "~> 1.0")
|
35
32
|
s.add_development_dependency("flexmock", "~> 1.3")
|
36
|
-
s.add_development_dependency("
|
33
|
+
s.add_development_dependency("rake", "~> 10.0")
|
37
34
|
end
|
data/script/install-openldap
CHANGED
@@ -5,8 +5,8 @@ set -x
|
|
5
5
|
BASE_PATH="$( cd `dirname $0`/../test/fixtures/openldap && pwd )"
|
6
6
|
SEED_PATH="$( cd `dirname $0`/../test/fixtures && pwd )"
|
7
7
|
|
8
|
-
dpkg -s slapd time ldap-utils ||\
|
9
|
-
DEBIAN_FRONTEND=noninteractive sudo -E apt-get install -y --force-yes slapd time ldap-utils
|
8
|
+
dpkg -s slapd time ldap-utils gnutls-bin ssl-cert > /dev/null ||\
|
9
|
+
DEBIAN_FRONTEND=noninteractive sudo -E apt-get install -y --force-yes slapd time ldap-utils gnutls-bin ssl-cert
|
10
10
|
|
11
11
|
sudo /etc/init.d/slapd stop
|
12
12
|
|
@@ -45,3 +45,67 @@ sudo /etc/init.d/slapd start
|
|
45
45
|
-f $SEED_PATH/seed.ldif
|
46
46
|
|
47
47
|
sudo rm -rf $TMPDIR
|
48
|
+
|
49
|
+
# SSL
|
50
|
+
|
51
|
+
sudo sh -c "certtool --generate-privkey > /etc/ssl/private/cakey.pem"
|
52
|
+
|
53
|
+
sudo sh -c "cat > /etc/ssl/ca.info <<EOF
|
54
|
+
cn = rubyldap
|
55
|
+
ca
|
56
|
+
cert_signing_key
|
57
|
+
EOF"
|
58
|
+
|
59
|
+
# Create the self-signed CA certificate:
|
60
|
+
sudo certtool --generate-self-signed \
|
61
|
+
--load-privkey /etc/ssl/private/cakey.pem \
|
62
|
+
--template /etc/ssl/ca.info \
|
63
|
+
--outfile /etc/ssl/certs/cacert.pem
|
64
|
+
|
65
|
+
# Make a private key for the server:
|
66
|
+
sudo certtool --generate-privkey \
|
67
|
+
--bits 1024 \
|
68
|
+
--outfile /etc/ssl/private/ldap01_slapd_key.pem
|
69
|
+
|
70
|
+
sudo sh -c "cat > /etc/ssl/ldap01.info <<EOF
|
71
|
+
organization = Example Company
|
72
|
+
cn = ldap01.example.com
|
73
|
+
tls_www_server
|
74
|
+
encryption_key
|
75
|
+
signing_key
|
76
|
+
expiration_days = 3650
|
77
|
+
EOF"
|
78
|
+
|
79
|
+
# Create the server certificate
|
80
|
+
sudo certtool --generate-certificate \
|
81
|
+
--load-privkey /etc/ssl/private/ldap01_slapd_key.pem \
|
82
|
+
--load-ca-certificate /etc/ssl/certs/cacert.pem \
|
83
|
+
--load-ca-privkey /etc/ssl/private/cakey.pem \
|
84
|
+
--template /etc/ssl/ldap01.info \
|
85
|
+
--outfile /etc/ssl/certs/ldap01_slapd_cert.pem
|
86
|
+
|
87
|
+
sudo ldapmodify -Y EXTERNAL -H ldapi:/// <<EOF | true
|
88
|
+
dn: cn=config
|
89
|
+
add: olcTLSCACertificateFile
|
90
|
+
olcTLSCACertificateFile: /etc/ssl/certs/cacert.pem
|
91
|
+
-
|
92
|
+
add: olcTLSCertificateFile
|
93
|
+
olcTLSCertificateFile: /etc/ssl/certs/ldap01_slapd_cert.pem
|
94
|
+
-
|
95
|
+
add: olcTLSCertificateKeyFile
|
96
|
+
olcTLSCertificateKeyFile: /etc/ssl/private/ldap01_slapd_key.pem
|
97
|
+
EOF
|
98
|
+
|
99
|
+
# LDAP over TLS/SSL (ldaps://) is deprecated in favour of StartTLS. The latter
|
100
|
+
# refers to an existing LDAP session (listening on TCP port 389) becoming
|
101
|
+
# protected by TLS/SSL whereas LDAPS, like HTTPS, is a distinct
|
102
|
+
# encrypted-from-the-start protocol that operates over TCP port 636. But we
|
103
|
+
# enable it for testing here.
|
104
|
+
sudo sed -i -e 's|^SLAPD_SERVICES="\(.*\)"|SLAPD_SERVICES="ldap:/// ldapi:/// ldaps:///"|' /etc/default/slapd
|
105
|
+
|
106
|
+
sudo adduser openldap ssl-cert
|
107
|
+
sudo chgrp ssl-cert /etc/ssl/private/ldap01_slapd_key.pem
|
108
|
+
sudo chmod g+r /etc/ssl/private/ldap01_slapd_key.pem
|
109
|
+
sudo chmod o-r /etc/ssl/private/ldap01_slapd_key.pem
|
110
|
+
|
111
|
+
sudo service slapd restart
|
@@ -0,0 +1,20 @@
|
|
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-----
|
@@ -19,4 +19,16 @@ class TestBindIntegration < LDAPIntegrationTestCase
|
|
19
19
|
def test_bind_fail
|
20
20
|
refute @ldap.bind(method: :simple, username: "uid=user1,ou=People,dc=rubyldap,dc=com", password: "not my password"), @ldap.get_operation_result.inspect
|
21
21
|
end
|
22
|
+
|
23
|
+
def test_bind_tls_with_cafile
|
24
|
+
tls_options = OpenSSL::SSL::SSLContext::DEFAULT_PARAMS.merge(:ca_file => CA_FILE)
|
25
|
+
@ldap.encryption(method: :start_tls, tls_options: tls_options)
|
26
|
+
assert @ldap.bind(method: :simple, username: "uid=user1,ou=People,dc=rubyldap,dc=com", password: "passworD1"), @ldap.get_operation_result.inspect
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_bind_tls_with_verify_none
|
30
|
+
tls_options = OpenSSL::SSL::SSLContext::DEFAULT_PARAMS.merge(:verify_mode => OpenSSL::SSL::VERIFY_NONE)
|
31
|
+
@ldap.encryption(method: :start_tls, tls_options: tls_options)
|
32
|
+
assert @ldap.bind(method: :simple, username: "uid=user1,ou=People,dc=rubyldap,dc=com", password: "passworD1"), @ldap.get_operation_result.inspect
|
33
|
+
end
|
22
34
|
end
|
data/test/test_filter_parser.rb
CHANGED
@@ -10,6 +10,10 @@ class TestFilterParser < Test::Unit::TestCase
|
|
10
10
|
assert_kind_of Net::LDAP::Filter, Net::LDAP::Filter::FilterParser.parse("(cn=名前)")
|
11
11
|
end
|
12
12
|
|
13
|
+
def test_brackets
|
14
|
+
assert_kind_of Net::LDAP::Filter, Net::LDAP::Filter::FilterParser.parse("(cn=[{something}])")
|
15
|
+
end
|
16
|
+
|
13
17
|
def test_colons
|
14
18
|
assert_kind_of Net::LDAP::Filter, Net::LDAP::Filter::FilterParser.parse("(ismemberof=cn=edu:berkeley:app:calmessages:deans,ou=campus groups,dc=berkeley,dc=edu)")
|
15
19
|
end
|
data/test/test_helper.rb
CHANGED
@@ -6,6 +6,18 @@ require 'flexmock/test_unit'
|
|
6
6
|
# Whether integration tests should be run.
|
7
7
|
INTEGRATION = ENV.fetch("INTEGRATION", "skip") != "skip"
|
8
8
|
|
9
|
+
# The CA file to verify certs against for tests.
|
10
|
+
# Override with CA_FILE env variable; otherwise checks for the VM-specific path
|
11
|
+
# and falls back to the test/fixtures/cacert.pem for local testing.
|
12
|
+
CA_FILE =
|
13
|
+
ENV.fetch("CA_FILE") do
|
14
|
+
if File.exist?("/etc/ssl/certs/cacert.pem")
|
15
|
+
"/etc/ssl/certs/cacert.pem"
|
16
|
+
else
|
17
|
+
File.expand_path("fixtures/cacert.pem", File.dirname(__FILE__))
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
9
21
|
if RUBY_VERSION < "2.0"
|
10
22
|
class String
|
11
23
|
def b
|
@@ -202,7 +202,7 @@ class TestLDAPConnectionSocketReads < Test::Unit::TestCase
|
|
202
202
|
and_return(result2)
|
203
203
|
mock.should_receive(:write)
|
204
204
|
conn = Net::LDAP::Connection.new(:socket => mock)
|
205
|
-
flexmock(Net::LDAP::Connection).should_receive(:wrap_with_ssl).with(mock).
|
205
|
+
flexmock(Net::LDAP::Connection).should_receive(:wrap_with_ssl).with(mock, nil).
|
206
206
|
and_return(mock)
|
207
207
|
|
208
208
|
conn.next_msgid # simulates ongoing query
|
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.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francis Cianfrocca
|
@@ -13,36 +13,8 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date:
|
16
|
+
date: 2014-12-10 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
|
-
- !ruby/object:Gem::Dependency
|
19
|
-
name: hoe-git
|
20
|
-
requirement: !ruby/object:Gem::Requirement
|
21
|
-
requirements:
|
22
|
-
- - "~>"
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version: '1.0'
|
25
|
-
type: :development
|
26
|
-
prerelease: false
|
27
|
-
version_requirements: !ruby/object:Gem::Requirement
|
28
|
-
requirements:
|
29
|
-
- - "~>"
|
30
|
-
- !ruby/object:Gem::Version
|
31
|
-
version: '1.0'
|
32
|
-
- !ruby/object:Gem::Dependency
|
33
|
-
name: hoe-gemspec
|
34
|
-
requirement: !ruby/object:Gem::Requirement
|
35
|
-
requirements:
|
36
|
-
- - "~>"
|
37
|
-
- !ruby/object:Gem::Version
|
38
|
-
version: '1.0'
|
39
|
-
type: :development
|
40
|
-
prerelease: false
|
41
|
-
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
requirements:
|
43
|
-
- - "~>"
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '1.0'
|
46
18
|
- !ruby/object:Gem::Dependency
|
47
19
|
name: flexmock
|
48
20
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,19 +30,19 @@ dependencies:
|
|
58
30
|
- !ruby/object:Gem::Version
|
59
31
|
version: '1.3'
|
60
32
|
- !ruby/object:Gem::Dependency
|
61
|
-
name:
|
33
|
+
name: rake
|
62
34
|
requirement: !ruby/object:Gem::Requirement
|
63
35
|
requirements:
|
64
36
|
- - "~>"
|
65
37
|
- !ruby/object:Gem::Version
|
66
|
-
version: '
|
38
|
+
version: '10.0'
|
67
39
|
type: :development
|
68
40
|
prerelease: false
|
69
41
|
version_requirements: !ruby/object:Gem::Requirement
|
70
42
|
requirements:
|
71
43
|
- - "~>"
|
72
44
|
- !ruby/object:Gem::Version
|
73
|
-
version: '
|
45
|
+
version: '10.0'
|
74
46
|
description: |-
|
75
47
|
Net::LDAP for Ruby (also called net-ldap) implements client access for the
|
76
48
|
Lightweight Directory Access Protocol (LDAP), an IETF standard protocol for
|
@@ -92,7 +64,6 @@ email:
|
|
92
64
|
executables: []
|
93
65
|
extensions: []
|
94
66
|
extra_rdoc_files:
|
95
|
-
- Manifest.txt
|
96
67
|
- Contributors.rdoc
|
97
68
|
- Hacking.rdoc
|
98
69
|
- History.rdoc
|
@@ -107,7 +78,6 @@ files:
|
|
107
78
|
- Hacking.rdoc
|
108
79
|
- History.rdoc
|
109
80
|
- License.rdoc
|
110
|
-
- Manifest.txt
|
111
81
|
- README.rdoc
|
112
82
|
- Rakefile
|
113
83
|
- lib/net-ldap.rb
|
@@ -138,6 +108,7 @@ files:
|
|
138
108
|
- test/ber/core_ext/test_array.rb
|
139
109
|
- test/ber/core_ext/test_string.rb
|
140
110
|
- test/ber/test_ber.rb
|
111
|
+
- test/fixtures/cacert.pem
|
141
112
|
- test/fixtures/openldap/memberof.ldif
|
142
113
|
- test/fixtures/openldap/retcode.ldif
|
143
114
|
- test/fixtures/openldap/slapd.conf.ldif
|
@@ -200,6 +171,7 @@ test_files:
|
|
200
171
|
- test/ber/core_ext/test_array.rb
|
201
172
|
- test/ber/core_ext/test_string.rb
|
202
173
|
- test/ber/test_ber.rb
|
174
|
+
- test/fixtures/cacert.pem
|
203
175
|
- test/fixtures/openldap/memberof.ldif
|
204
176
|
- test/fixtures/openldap/retcode.ldif
|
205
177
|
- test/fixtures/openldap/slapd.conf.ldif
|
data/Manifest.txt
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
.travis.yml
|
2
|
-
Contributors.rdoc
|
3
|
-
Gemfile
|
4
|
-
Hacking.rdoc
|
5
|
-
History.rdoc
|
6
|
-
License.rdoc
|
7
|
-
Manifest.txt
|
8
|
-
README.rdoc
|
9
|
-
Rakefile
|
10
|
-
lib/net-ldap.rb
|
11
|
-
lib/net/ber.rb
|
12
|
-
lib/net/ber/ber_parser.rb
|
13
|
-
lib/net/ber/core_ext.rb
|
14
|
-
lib/net/ber/core_ext/array.rb
|
15
|
-
lib/net/ber/core_ext/bignum.rb
|
16
|
-
lib/net/ber/core_ext/false_class.rb
|
17
|
-
lib/net/ber/core_ext/fixnum.rb
|
18
|
-
lib/net/ber/core_ext/string.rb
|
19
|
-
lib/net/ber/core_ext/true_class.rb
|
20
|
-
lib/net/ldap.rb
|
21
|
-
lib/net/ldap/dataset.rb
|
22
|
-
lib/net/ldap/dn.rb
|
23
|
-
lib/net/ldap/entry.rb
|
24
|
-
lib/net/ldap/filter.rb
|
25
|
-
lib/net/ldap/instrumentation.rb
|
26
|
-
lib/net/ldap/password.rb
|
27
|
-
lib/net/ldap/pdu.rb
|
28
|
-
lib/net/ldap/version.rb
|
29
|
-
lib/net/snmp.rb
|
30
|
-
net-ldap.gemspec
|
31
|
-
spec/integration/ssl_ber_spec.rb
|
32
|
-
spec/spec_helper.rb
|
33
|
-
spec/unit/ber/ber_spec.rb
|
34
|
-
spec/unit/ber/core_ext/array_spec.rb
|
35
|
-
spec/unit/ber/core_ext/string_spec.rb
|
36
|
-
spec/unit/ldap/dn_spec.rb
|
37
|
-
spec/unit/ldap/entry_spec.rb
|
38
|
-
spec/unit/ldap/filter_parser_spec.rb
|
39
|
-
spec/unit/ldap/filter_spec.rb
|
40
|
-
spec/unit/ldap/search_spec.rb
|
41
|
-
spec/unit/ldap_spec.rb
|
42
|
-
test/common.rb
|
43
|
-
test/test_entry.rb
|
44
|
-
test/test_filter.rb
|
45
|
-
test/test_ldap_connection.rb
|
46
|
-
test/test_ldif.rb
|
47
|
-
test/test_password.rb
|
48
|
-
test/test_rename.rb
|
49
|
-
test/test_snmp.rb
|
50
|
-
test/testdata.ldif
|
51
|
-
testserver/ldapserver.rb
|
52
|
-
testserver/testdata.ldif
|