net-ldap 0.15.0 → 0.19.0
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.
- checksums.yaml +5 -5
- data/History.rdoc +76 -0
- data/README.rdoc +18 -8
- data/lib/net/ber/ber_parser.rb +3 -3
- data/lib/net/ber/core_ext.rb +6 -6
- data/lib/net/ber.rb +5 -6
- data/lib/net/ldap/auth_adapter/gss_spnego.rb +2 -2
- data/lib/net/ldap/auth_adapter/sasl.rb +4 -2
- data/lib/net/ldap/auth_adapter/simple.rb +1 -1
- data/lib/net/ldap/connection.rb +57 -46
- data/lib/net/ldap/dataset.rb +1 -3
- data/lib/net/ldap/dn.rb +21 -30
- data/lib/net/ldap/entry.rb +15 -7
- data/lib/net/ldap/error.rb +2 -26
- data/lib/net/ldap/filter.rb +10 -3
- data/lib/net/ldap/instrumentation.rb +2 -2
- data/lib/net/ldap/password.rb +7 -5
- data/lib/net/ldap/pdu.rb +1 -1
- data/lib/net/ldap/version.rb +1 -1
- data/lib/net/ldap.rb +93 -58
- data/lib/net/snmp.rb +1 -1
- data/lib/net-ldap.rb +1 -1
- metadata +16 -101
- data/.gitignore +0 -9
- data/.rubocop.yml +0 -17
- data/.rubocop_todo.yml +0 -599
- data/.travis.yml +0 -33
- data/CONTRIBUTING.md +0 -54
- data/Gemfile +0 -2
- data/Rakefile +0 -23
- data/net-ldap.gemspec +0 -37
- data/script/changelog +0 -47
- data/script/install-openldap +0 -115
- data/script/package +0 -7
- data/script/release +0 -16
- data/test/ber/core_ext/test_array.rb +0 -22
- data/test/ber/core_ext/test_string.rb +0 -25
- data/test/ber/test_ber.rb +0 -153
- data/test/fixtures/cacert.pem +0 -20
- data/test/fixtures/openldap/memberof.ldif +0 -33
- data/test/fixtures/openldap/retcode.ldif +0 -76
- data/test/fixtures/openldap/slapd.conf.ldif +0 -67
- data/test/fixtures/seed.ldif +0 -374
- data/test/integration/test_add.rb +0 -28
- data/test/integration/test_ber.rb +0 -30
- data/test/integration/test_bind.rb +0 -42
- data/test/integration/test_delete.rb +0 -31
- data/test/integration/test_open.rb +0 -88
- data/test/integration/test_password_modify.rb +0 -80
- data/test/integration/test_return_codes.rb +0 -38
- data/test/integration/test_search.rb +0 -77
- data/test/support/vm/openldap/.gitignore +0 -1
- data/test/support/vm/openldap/README.md +0 -32
- data/test/support/vm/openldap/Vagrantfile +0 -33
- data/test/test_auth_adapter.rb +0 -15
- data/test/test_dn.rb +0 -44
- data/test/test_entry.rb +0 -65
- data/test/test_filter.rb +0 -223
- data/test/test_filter_parser.rb +0 -24
- data/test/test_helper.rb +0 -66
- data/test/test_ldap.rb +0 -114
- data/test/test_ldap_connection.rb +0 -493
- data/test/test_ldif.rb +0 -104
- data/test/test_password.rb +0 -10
- data/test/test_rename.rb +0 -77
- data/test/test_search.rb +0 -39
- data/test/test_snmp.rb +0 -119
- data/test/test_ssl_ber.rb +0 -40
- data/test/testdata.ldif +0 -101
- data/testserver/ldapserver.rb +0 -209
- data/testserver/testdata.ldif +0 -101
data/lib/net/ldap/entry.rb
CHANGED
@@ -133,6 +133,13 @@ class Net::LDAP::Entry
|
|
133
133
|
@myhash.keys
|
134
134
|
end
|
135
135
|
|
136
|
+
##
|
137
|
+
# Creates a duplicate of the internal Hash containing the attributes
|
138
|
+
# of the entry.
|
139
|
+
def to_h
|
140
|
+
@myhash.dup
|
141
|
+
end
|
142
|
+
|
136
143
|
##
|
137
144
|
# Accesses each of the attributes present in the Entry.
|
138
145
|
#
|
@@ -140,11 +147,10 @@ class Net::LDAP::Entry
|
|
140
147
|
# arguments to the block: a Symbol giving the name of the attribute, and a
|
141
148
|
# (possibly empty) \Array of data values.
|
142
149
|
def each # :yields: attribute-name, data-values-array
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
end
|
150
|
+
return unless block_given?
|
151
|
+
attribute_names.each do|a|
|
152
|
+
attr_name, values = a, self[a]
|
153
|
+
yield attr_name, values
|
148
154
|
end
|
149
155
|
end
|
150
156
|
alias_method :each_attribute, :each
|
@@ -188,6 +194,8 @@ class Net::LDAP::Entry
|
|
188
194
|
sym.to_s[-1] == ?=
|
189
195
|
end
|
190
196
|
private :setter?
|
191
|
-
end # class Entry
|
192
197
|
|
193
|
-
|
198
|
+
def ==(other)
|
199
|
+
other.instance_of?(self.class) && @myhash == other.to_h
|
200
|
+
end
|
201
|
+
end # class Entry
|
data/lib/net/ldap/error.rb
CHANGED
@@ -1,38 +1,13 @@
|
|
1
1
|
class Net::LDAP
|
2
|
-
class LdapError < StandardError
|
3
|
-
def message
|
4
|
-
"Deprecation warning: Net::LDAP::LdapError is no longer used. Use Net::LDAP::Error or rescue one of it's subclasses. \n" + super
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
2
|
class Error < StandardError; end
|
9
3
|
|
10
4
|
class AlreadyOpenedError < Error; end
|
11
5
|
class SocketError < Error; end
|
12
|
-
class ConnectionRefusedError < Error;
|
13
|
-
def initialize(*args)
|
14
|
-
warn_deprecation_message
|
15
|
-
super
|
16
|
-
end
|
17
|
-
|
18
|
-
def message
|
19
|
-
warn_deprecation_message
|
20
|
-
super
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def warn_deprecation_message
|
26
|
-
warn "Deprecation warning: Net::LDAP::ConnectionRefused will be deprecated. Use Errno::ECONNREFUSED instead."
|
27
|
-
end
|
28
|
-
end
|
29
6
|
class ConnectionError < Error
|
30
7
|
def self.new(errors)
|
31
8
|
error = errors.first.first
|
32
9
|
if errors.size == 1
|
33
|
-
if error.
|
34
|
-
return Net::LDAP::ConnectionRefusedError.new(error.message)
|
35
|
-
end
|
10
|
+
return error if error.is_a? Errno::ECONNREFUSED
|
36
11
|
|
37
12
|
return Net::LDAP::Error.new(error.message)
|
38
13
|
end
|
@@ -60,6 +35,7 @@ class Net::LDAP
|
|
60
35
|
class ResponseTypeInvalidError < Error; end
|
61
36
|
class ResponseMissingOrInvalidError < Error; end
|
62
37
|
class EmptyDNError < Error; end
|
38
|
+
class InvalidDNError < Error; end
|
63
39
|
class HashTypeUnsupportedError < Error; end
|
64
40
|
class OperatorError < Error; end
|
65
41
|
class SubstringFilterError < Error; end
|
data/lib/net/ldap/filter.rb
CHANGED
@@ -490,7 +490,7 @@ class Net::LDAP::Filter
|
|
490
490
|
when :eq
|
491
491
|
if @right == "*" # presence test
|
492
492
|
@left.to_s.to_ber_contextspecific(7)
|
493
|
-
elsif @right =~ /[*]/ # substring
|
493
|
+
elsif @right.to_s =~ /[*]/ # substring
|
494
494
|
# Parsing substrings is a little tricky. We use String#split to
|
495
495
|
# break a string into substrings delimited by the * (star)
|
496
496
|
# character. But we also need to know whether there is a star at the
|
@@ -645,8 +645,15 @@ class Net::LDAP::Filter
|
|
645
645
|
|
646
646
|
##
|
647
647
|
# Converts escaped characters (e.g., "\\28") to unescaped characters
|
648
|
+
# @note slawson20170317: Don't attempt to unescape 16 byte binary data which we assume are objectGUIDs
|
649
|
+
# The binary form of 5936AE79-664F-44EA-BCCB-5C39399514C6 triggers a BINARY -> UTF-8 conversion error
|
648
650
|
def unescape(right)
|
649
|
-
right
|
651
|
+
right = right.to_s
|
652
|
+
if right.length == 16 && right.encoding == Encoding::BINARY
|
653
|
+
right
|
654
|
+
else
|
655
|
+
right.to_s.gsub(/\\([a-fA-F\d]{2})/) { [$1.hex].pack("U") }
|
656
|
+
end
|
650
657
|
end
|
651
658
|
private :unescape
|
652
659
|
|
@@ -748,7 +755,7 @@ class Net::LDAP::Filter
|
|
748
755
|
# This parses a given expression inside of parentheses.
|
749
756
|
def parse_filter_branch(scanner)
|
750
757
|
scanner.scan(/\s*/)
|
751
|
-
if token = scanner.scan(/[-\w
|
758
|
+
if token = scanner.scan(/[-\w:.;]*[\w]/)
|
752
759
|
scanner.scan(/\s*/)
|
753
760
|
if op = scanner.scan(/<=|>=|!=|:=|=/)
|
754
761
|
scanner.scan(/\s*/)
|
@@ -12,8 +12,8 @@ module Net::LDAP::Instrumentation
|
|
12
12
|
def instrument(event, payload = {})
|
13
13
|
payload = (payload || {}).dup
|
14
14
|
if instrumentation_service
|
15
|
-
instrumentation_service.instrument(event, payload) do |
|
16
|
-
|
15
|
+
instrumentation_service.instrument(event, payload) do |instr_payload|
|
16
|
+
instr_payload[:result] = yield(instr_payload) if block_given?
|
17
17
|
end
|
18
18
|
else
|
19
19
|
yield(payload) if block_given?
|
data/lib/net/ldap/password.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
require 'digest/sha1'
|
3
|
+
require 'digest/sha2'
|
3
4
|
require 'digest/md5'
|
4
5
|
require 'base64'
|
5
6
|
require 'securerandom'
|
@@ -19,20 +20,21 @@ class Net::LDAP::Password
|
|
19
20
|
# * Should we provide sha1 as a synonym for sha1? I vote no because then
|
20
21
|
# should you also provide ssha1 for symmetry?
|
21
22
|
#
|
22
|
-
attribute_value = ""
|
23
23
|
def generate(type, str)
|
24
24
|
case type
|
25
25
|
when :md5
|
26
|
-
|
26
|
+
'{MD5}' + Base64.strict_encode64(Digest::MD5.digest(str))
|
27
27
|
when :sha
|
28
|
-
|
28
|
+
'{SHA}' + Base64.strict_encode64(Digest::SHA1.digest(str))
|
29
29
|
when :ssha
|
30
30
|
salt = SecureRandom.random_bytes(16)
|
31
|
-
|
31
|
+
'{SSHA}' + Base64.strict_encode64(Digest::SHA1.digest(str + salt) + salt)
|
32
|
+
when :ssha256
|
33
|
+
salt = SecureRandom.random_bytes(16)
|
34
|
+
'{SSHA256}' + Base64.strict_encode64(Digest::SHA256.digest(str + salt) + salt)
|
32
35
|
else
|
33
36
|
raise Net::LDAP::HashTypeUnsupportedError, "Unsupported password-hash type (#{type})"
|
34
37
|
end
|
35
|
-
return attribute_value
|
36
38
|
end
|
37
39
|
end
|
38
40
|
end
|
data/lib/net/ldap/pdu.rb
CHANGED
@@ -123,7 +123,7 @@ class Net::LDAP::PDU
|
|
123
123
|
when ExtendedResponse
|
124
124
|
parse_extended_response(ber_object[1])
|
125
125
|
else
|
126
|
-
raise
|
126
|
+
raise Error.new("unknown pdu-type: #{@app_tag}")
|
127
127
|
end
|
128
128
|
|
129
129
|
parse_controls(ber_object[2]) if ber_object[2]
|
data/lib/net/ldap/version.rb
CHANGED
data/lib/net/ldap.rb
CHANGED
@@ -17,19 +17,19 @@ module Net # :nodoc:
|
|
17
17
|
end
|
18
18
|
require 'socket'
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
20
|
+
require_relative 'ber'
|
21
|
+
require_relative 'ldap/pdu'
|
22
|
+
require_relative 'ldap/filter'
|
23
|
+
require_relative 'ldap/dataset'
|
24
|
+
require_relative 'ldap/password'
|
25
|
+
require_relative 'ldap/entry'
|
26
|
+
require_relative 'ldap/instrumentation'
|
27
|
+
require_relative 'ldap/connection'
|
28
|
+
require_relative 'ldap/version'
|
29
|
+
require_relative 'ldap/error'
|
30
|
+
require_relative 'ldap/auth_adapter'
|
31
|
+
require_relative 'ldap/auth_adapter/simple'
|
32
|
+
require_relative 'ldap/auth_adapter/sasl'
|
33
33
|
|
34
34
|
Net::LDAP::AuthAdapter.register([:simple, :anon, :anonymous], Net::LDAP::AuthAdapter::Simple)
|
35
35
|
Net::LDAP::AuthAdapter.register(:sasl, Net::LDAP::AuthAdapter::Sasl)
|
@@ -412,7 +412,7 @@ class Net::LDAP
|
|
412
412
|
ResultCodeStrongerAuthRequired => "Stronger Auth Needed",
|
413
413
|
ResultCodeReferral => "Referral",
|
414
414
|
ResultCodeAdminLimitExceeded => "Admin Limit Exceeded",
|
415
|
-
ResultCodeUnavailableCriticalExtension => "Unavailable
|
415
|
+
ResultCodeUnavailableCriticalExtension => "Unavailable critical extension",
|
416
416
|
ResultCodeConfidentialityRequired => "Confidentiality Required",
|
417
417
|
ResultCodeSaslBindInProgress => "saslBindInProgress",
|
418
418
|
ResultCodeNoSuchAttribute => "No Such Attribute",
|
@@ -476,61 +476,75 @@ class Net::LDAP
|
|
476
476
|
# specify a treebase. If you give a treebase value in any particular
|
477
477
|
# call to #search, that value will override any treebase value you give
|
478
478
|
# here.
|
479
|
+
# * :force_no_page => Set to true to prevent paged results even if your
|
480
|
+
# server says it supports them. This is a fix for MS Active Directory
|
481
|
+
# * :instrumentation_service => An object responsible for instrumenting
|
482
|
+
# operations, compatible with ActiveSupport::Notifications' public API.
|
483
|
+
# * :connect_timeout => The TCP socket timeout (in seconds) to use when
|
484
|
+
# connecting to the LDAP server (default 5 seconds).
|
479
485
|
# * :encryption => specifies the encryption to be used in communicating
|
480
486
|
# with the LDAP server. The value must be a Hash containing additional
|
481
487
|
# parameters, which consists of two keys:
|
482
488
|
# method: - :simple_tls or :start_tls
|
483
|
-
#
|
489
|
+
# tls_options: - Hash of options for that method
|
484
490
|
# The :simple_tls encryption method encrypts <i>all</i> communications
|
485
491
|
# with the LDAP server. It completely establishes SSL/TLS encryption with
|
486
492
|
# the LDAP server before any LDAP-protocol data is exchanged. There is no
|
487
493
|
# plaintext negotiation and no special encryption-request controls are
|
488
494
|
# sent to the server. <i>The :simple_tls option is the simplest, easiest
|
489
495
|
# way to encrypt communications between Net::LDAP and LDAP servers.</i>
|
490
|
-
#
|
491
|
-
#
|
492
|
-
#
|
493
|
-
#
|
494
|
-
#
|
495
|
-
#
|
496
|
-
#
|
497
|
-
# connecting to. It's impossible for an LDAP server to support plaintext
|
498
|
-
# LDAP communications and <i>simple TLS</i> connections on the same port.
|
499
|
-
# The standard TCP port for unencrypted LDAP connections is 389, but the
|
500
|
-
# standard port for simple-TLS encrypted connections is 636. Be sure you
|
501
|
-
# are using the correct port.
|
502
|
-
#
|
496
|
+
# If you get communications or protocol errors when using this option,
|
497
|
+
# check with your LDAP server administrator. Pay particular attention
|
498
|
+
# to the TCP port you are connecting to. It's impossible for an LDAP
|
499
|
+
# server to support plaintext LDAP communications and <i>simple TLS</i>
|
500
|
+
# connections on the same port. The standard TCP port for unencrypted
|
501
|
+
# LDAP connections is 389, but the standard port for simple-TLS
|
502
|
+
# encrypted connections is 636. Be sure you are using the correct port.
|
503
503
|
# The :start_tls like the :simple_tls encryption method also encrypts all
|
504
504
|
# communcations with the LDAP server. With the exception that it operates
|
505
505
|
# over the standard TCP port.
|
506
506
|
#
|
507
|
-
#
|
508
|
-
#
|
509
|
-
#
|
510
|
-
# OpenSSL::SSL::SSLContext#set_params(). The most common options passed
|
511
|
-
# should be OpenSSL::SSL::SSLContext::DEFAULT_PARAMS, or the :ca_file option,
|
512
|
-
# which contains a path to a Certificate Authority file (PEM-encoded).
|
513
|
-
#
|
514
|
-
# Example for a default setup without custom settings:
|
515
|
-
# {
|
516
|
-
# :method => :simple_tls,
|
517
|
-
# :tls_options => OpenSSL::SSL::SSLContext::DEFAULT_PARAMS
|
518
|
-
# }
|
519
|
-
#
|
520
|
-
# Example for specifying a CA-File and only allowing TLSv1.1 connections:
|
507
|
+
# To validate the LDAP server's certificate (a security must if you're
|
508
|
+
# talking over the public internet), you need to set :tls_options
|
509
|
+
# something like this...
|
521
510
|
#
|
522
|
-
#
|
523
|
-
#
|
524
|
-
#
|
511
|
+
# Net::LDAP.new(
|
512
|
+
# # ... set host, bind dn, etc ...
|
513
|
+
# encryption: {
|
514
|
+
# method: :simple_tls,
|
515
|
+
# tls_options: OpenSSL::SSL::SSLContext::DEFAULT_PARAMS,
|
525
516
|
# }
|
526
|
-
#
|
527
|
-
#
|
528
|
-
#
|
529
|
-
#
|
517
|
+
# )
|
518
|
+
#
|
519
|
+
# The above will use the operating system-provided store of CA
|
520
|
+
# certificates to validate your LDAP server's cert.
|
521
|
+
# If cert validation fails, it'll happen during the #bind
|
522
|
+
# whenever you first try to open a connection to the server.
|
523
|
+
# Those methods will throw Net::LDAP::ConnectionError with
|
524
|
+
# a message about certificate verify failing. If your
|
525
|
+
# LDAP server's certificate is signed by DigiCert, Comodo, etc.,
|
526
|
+
# you're probably good. If you've got a self-signed cert but it's
|
527
|
+
# been added to the host's OS-maintained CA store (e.g. on Debian
|
528
|
+
# add foobar.crt to /usr/local/share/ca-certificates/ and run
|
529
|
+
# `update-ca-certificates`), then the cert should pass validation.
|
530
|
+
# To ignore the OS's CA store, put your CA in a PEM-encoded file and...
|
531
|
+
#
|
532
|
+
# encryption: {
|
533
|
+
# method: :simple_tls,
|
534
|
+
# tls_options: { ca_file: '/path/to/my-little-ca.pem',
|
535
|
+
# ssl_version: 'TLSv1_1' },
|
536
|
+
# }
|
537
|
+
#
|
538
|
+
# As you might guess, the above example also fails the connection
|
539
|
+
# if the client can't negotiate TLS v1.1.
|
540
|
+
# tls_options is ultimately passed to OpenSSL::SSL::SSLContext#set_params
|
541
|
+
# For more details, see
|
542
|
+
# http://ruby-doc.org/stdlib-2.0.0/libdoc/openssl/rdoc/OpenSSL/SSL/SSLContext.html
|
530
543
|
#
|
531
544
|
# Instantiating a Net::LDAP object does <i>not</i> result in network
|
532
545
|
# traffic to the LDAP server. It simply stores the connection and binding
|
533
|
-
# parameters in the object.
|
546
|
+
# parameters in the object. That's why Net::LDAP.new doesn't throw
|
547
|
+
# cert validation errors itself; #bind does instead.
|
534
548
|
def initialize(args = {})
|
535
549
|
@host = args[:host] || DefaultHost
|
536
550
|
@port = args[:port] || DefaultPort
|
@@ -700,7 +714,7 @@ class Net::LDAP
|
|
700
714
|
begin
|
701
715
|
@open_connection = new_connection
|
702
716
|
payload[:connection] = @open_connection
|
703
|
-
payload[:bind] = @open_connection.bind(@auth)
|
717
|
+
payload[:bind] = @result = @open_connection.bind(@auth)
|
704
718
|
yield self
|
705
719
|
ensure
|
706
720
|
@open_connection.close if @open_connection
|
@@ -1170,14 +1184,22 @@ class Net::LDAP
|
|
1170
1184
|
# entries. This method sends an extra control code to tell the LDAP server
|
1171
1185
|
# to do a tree delete. ('1.2.840.113556.1.4.805')
|
1172
1186
|
#
|
1187
|
+
# If the LDAP server does not support the DELETE_TREE control code, subordinate
|
1188
|
+
# entries are deleted recursively instead.
|
1189
|
+
#
|
1173
1190
|
# Returns True or False to indicate whether the delete succeeded. Extended
|
1174
1191
|
# status information is available by calling #get_operation_result.
|
1175
1192
|
#
|
1176
1193
|
# dn = "mail=deleteme@example.com, ou=people, dc=example, dc=com"
|
1177
1194
|
# ldap.delete_tree :dn => dn
|
1178
1195
|
def delete_tree(args)
|
1179
|
-
|
1196
|
+
if search_root_dse[:supportedcontrol].include? Net::LDAP::LDAPControls::DELETE_TREE
|
1197
|
+
delete(args.merge(:control_codes => [[Net::LDAP::LDAPControls::DELETE_TREE, true]]))
|
1198
|
+
else
|
1199
|
+
recursive_delete(args)
|
1200
|
+
end
|
1180
1201
|
end
|
1202
|
+
|
1181
1203
|
# This method is experimental and subject to change. Return the rootDSE
|
1182
1204
|
# record from the LDAP server as a Net::LDAP::Entry, or an empty Entry if
|
1183
1205
|
# the server doesn't return the record.
|
@@ -1286,11 +1308,9 @@ class Net::LDAP
|
|
1286
1308
|
else
|
1287
1309
|
begin
|
1288
1310
|
conn = new_connection
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
return result
|
1293
|
-
end
|
1311
|
+
result = conn.bind(args[:auth] || @auth)
|
1312
|
+
return result unless result.result_code == Net::LDAP::ResultCodeSuccess
|
1313
|
+
yield conn
|
1294
1314
|
ensure
|
1295
1315
|
conn.close if conn
|
1296
1316
|
end
|
@@ -1310,7 +1330,7 @@ class Net::LDAP
|
|
1310
1330
|
# Force connect to see if there's a connection error
|
1311
1331
|
connection.socket
|
1312
1332
|
connection
|
1313
|
-
rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT
|
1333
|
+
rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT => e
|
1314
1334
|
@result = {
|
1315
1335
|
:resultCode => 52,
|
1316
1336
|
:errorMessage => ResultStrings[ResultCodeUnavailable],
|
@@ -1330,4 +1350,19 @@ class Net::LDAP
|
|
1330
1350
|
end
|
1331
1351
|
end
|
1332
1352
|
|
1353
|
+
# Recursively delete a dn and it's subordinate children.
|
1354
|
+
# This is useful when a server does not support the DELETE_TREE control code.
|
1355
|
+
def recursive_delete(args)
|
1356
|
+
raise EmptyDNError unless args.is_a?(Hash) && args.key?(:dn)
|
1357
|
+
# Delete Children
|
1358
|
+
search(base: args[:dn], scope: Net::LDAP::SearchScope_SingleLevel) do |entry|
|
1359
|
+
recursive_delete(dn: entry.dn)
|
1360
|
+
end
|
1361
|
+
# Delete Self
|
1362
|
+
unless delete(dn: args[:dn])
|
1363
|
+
raise Net::LDAP::Error, get_operation_result[:error_message].to_s
|
1364
|
+
end
|
1365
|
+
true
|
1366
|
+
end
|
1367
|
+
|
1333
1368
|
end # class LDAP
|
data/lib/net/snmp.rb
CHANGED
data/lib/net-ldap.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
|
-
|
2
|
+
require_relative 'net/ldap'
|
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.19.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: 2024-01-03 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: flexmock
|
@@ -35,56 +35,56 @@ dependencies:
|
|
35
35
|
requirements:
|
36
36
|
- - "~>"
|
37
37
|
- !ruby/object:Gem::Version
|
38
|
-
version:
|
38
|
+
version: 12.3.3
|
39
39
|
type: :development
|
40
40
|
prerelease: false
|
41
41
|
version_requirements: !ruby/object:Gem::Requirement
|
42
42
|
requirements:
|
43
43
|
- - "~>"
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
45
|
+
version: 12.3.3
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: rubocop
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
requirements:
|
50
50
|
- - "~>"
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
52
|
+
version: '1.48'
|
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:
|
59
|
+
version: '1.48'
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: test-unit
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
|
-
- - "
|
64
|
+
- - "~>"
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: '
|
66
|
+
version: '3.3'
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
69
|
version_requirements: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
|
-
- - "
|
71
|
+
- - "~>"
|
72
72
|
- !ruby/object:Gem::Version
|
73
|
-
version: '
|
73
|
+
version: '3.3'
|
74
74
|
- !ruby/object:Gem::Dependency
|
75
75
|
name: byebug
|
76
76
|
requirement: !ruby/object:Gem::Requirement
|
77
77
|
requirements:
|
78
|
-
- - "
|
78
|
+
- - "~>"
|
79
79
|
- !ruby/object:Gem::Version
|
80
|
-
version:
|
80
|
+
version: 9.0.6
|
81
81
|
type: :development
|
82
82
|
prerelease: false
|
83
83
|
version_requirements: !ruby/object:Gem::Requirement
|
84
84
|
requirements:
|
85
|
-
- - "
|
85
|
+
- - "~>"
|
86
86
|
- !ruby/object:Gem::Version
|
87
|
-
version:
|
87
|
+
version: 9.0.6
|
88
88
|
description: |-
|
89
89
|
Net::LDAP for Ruby (also called net-ldap) implements client access for the
|
90
90
|
Lightweight Directory Access Protocol (LDAP), an IETF standard protocol for
|
@@ -112,18 +112,11 @@ extra_rdoc_files:
|
|
112
112
|
- License.rdoc
|
113
113
|
- README.rdoc
|
114
114
|
files:
|
115
|
-
- ".gitignore"
|
116
|
-
- ".rubocop.yml"
|
117
|
-
- ".rubocop_todo.yml"
|
118
|
-
- ".travis.yml"
|
119
|
-
- CONTRIBUTING.md
|
120
115
|
- Contributors.rdoc
|
121
|
-
- Gemfile
|
122
116
|
- Hacking.rdoc
|
123
117
|
- History.rdoc
|
124
118
|
- License.rdoc
|
125
119
|
- README.rdoc
|
126
|
-
- Rakefile
|
127
120
|
- lib/net-ldap.rb
|
128
121
|
- lib/net/ber.rb
|
129
122
|
- lib/net/ber/ber_parser.rb
|
@@ -149,47 +142,6 @@ files:
|
|
149
142
|
- lib/net/ldap/pdu.rb
|
150
143
|
- lib/net/ldap/version.rb
|
151
144
|
- lib/net/snmp.rb
|
152
|
-
- net-ldap.gemspec
|
153
|
-
- script/changelog
|
154
|
-
- script/install-openldap
|
155
|
-
- script/package
|
156
|
-
- script/release
|
157
|
-
- test/ber/core_ext/test_array.rb
|
158
|
-
- test/ber/core_ext/test_string.rb
|
159
|
-
- test/ber/test_ber.rb
|
160
|
-
- test/fixtures/cacert.pem
|
161
|
-
- test/fixtures/openldap/memberof.ldif
|
162
|
-
- test/fixtures/openldap/retcode.ldif
|
163
|
-
- test/fixtures/openldap/slapd.conf.ldif
|
164
|
-
- test/fixtures/seed.ldif
|
165
|
-
- test/integration/test_add.rb
|
166
|
-
- test/integration/test_ber.rb
|
167
|
-
- test/integration/test_bind.rb
|
168
|
-
- test/integration/test_delete.rb
|
169
|
-
- test/integration/test_open.rb
|
170
|
-
- test/integration/test_password_modify.rb
|
171
|
-
- test/integration/test_return_codes.rb
|
172
|
-
- test/integration/test_search.rb
|
173
|
-
- test/support/vm/openldap/.gitignore
|
174
|
-
- test/support/vm/openldap/README.md
|
175
|
-
- test/support/vm/openldap/Vagrantfile
|
176
|
-
- test/test_auth_adapter.rb
|
177
|
-
- test/test_dn.rb
|
178
|
-
- test/test_entry.rb
|
179
|
-
- test/test_filter.rb
|
180
|
-
- test/test_filter_parser.rb
|
181
|
-
- test/test_helper.rb
|
182
|
-
- test/test_ldap.rb
|
183
|
-
- test/test_ldap_connection.rb
|
184
|
-
- test/test_ldif.rb
|
185
|
-
- test/test_password.rb
|
186
|
-
- test/test_rename.rb
|
187
|
-
- test/test_search.rb
|
188
|
-
- test/test_snmp.rb
|
189
|
-
- test/test_ssl_ber.rb
|
190
|
-
- test/testdata.ldif
|
191
|
-
- testserver/ldapserver.rb
|
192
|
-
- testserver/testdata.ldif
|
193
145
|
homepage: http://github.com/ruby-ldap/ruby-net-ldap
|
194
146
|
licenses:
|
195
147
|
- MIT
|
@@ -211,47 +163,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
211
163
|
- !ruby/object:Gem::Version
|
212
164
|
version: '0'
|
213
165
|
requirements: []
|
214
|
-
|
215
|
-
rubygems_version: 2.5.1
|
166
|
+
rubygems_version: 3.4.14
|
216
167
|
signing_key:
|
217
168
|
specification_version: 4
|
218
169
|
summary: Net::LDAP for Ruby (also called net-ldap) implements client access for the
|
219
170
|
Lightweight Directory Access Protocol (LDAP), an IETF standard protocol for accessing
|
220
171
|
distributed directory services
|
221
|
-
test_files:
|
222
|
-
- test/ber/core_ext/test_array.rb
|
223
|
-
- test/ber/core_ext/test_string.rb
|
224
|
-
- test/ber/test_ber.rb
|
225
|
-
- test/fixtures/cacert.pem
|
226
|
-
- test/fixtures/openldap/memberof.ldif
|
227
|
-
- test/fixtures/openldap/retcode.ldif
|
228
|
-
- test/fixtures/openldap/slapd.conf.ldif
|
229
|
-
- test/fixtures/seed.ldif
|
230
|
-
- test/integration/test_add.rb
|
231
|
-
- test/integration/test_ber.rb
|
232
|
-
- test/integration/test_bind.rb
|
233
|
-
- test/integration/test_delete.rb
|
234
|
-
- test/integration/test_open.rb
|
235
|
-
- test/integration/test_password_modify.rb
|
236
|
-
- test/integration/test_return_codes.rb
|
237
|
-
- test/integration/test_search.rb
|
238
|
-
- test/support/vm/openldap/.gitignore
|
239
|
-
- test/support/vm/openldap/README.md
|
240
|
-
- test/support/vm/openldap/Vagrantfile
|
241
|
-
- test/test_auth_adapter.rb
|
242
|
-
- test/test_dn.rb
|
243
|
-
- test/test_entry.rb
|
244
|
-
- test/test_filter.rb
|
245
|
-
- test/test_filter_parser.rb
|
246
|
-
- test/test_helper.rb
|
247
|
-
- test/test_ldap.rb
|
248
|
-
- test/test_ldap_connection.rb
|
249
|
-
- test/test_ldif.rb
|
250
|
-
- test/test_password.rb
|
251
|
-
- test/test_rename.rb
|
252
|
-
- test/test_search.rb
|
253
|
-
- test/test_snmp.rb
|
254
|
-
- test/test_ssl_ber.rb
|
255
|
-
- test/testdata.ldif
|
256
|
-
- testserver/ldapserver.rb
|
257
|
-
- testserver/testdata.ldif
|
172
|
+
test_files: []
|
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
inherit_from: .rubocop_todo.yml
|
2
|
-
|
3
|
-
AllCops:
|
4
|
-
Exclude:
|
5
|
-
- 'pkg/**/*'
|
6
|
-
|
7
|
-
Style/ExtraSpacing:
|
8
|
-
Enabled: false
|
9
|
-
|
10
|
-
Lint/AssignmentInCondition:
|
11
|
-
Enabled: false
|
12
|
-
|
13
|
-
Style/ParallelAssignment:
|
14
|
-
Enabled: false
|
15
|
-
|
16
|
-
Style/TrailingComma:
|
17
|
-
EnforcedStyleForMultiline: comma
|