net-ldap 0.16.3 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/History.rdoc +36 -0
  3. data/README.rdoc +9 -2
  4. data/lib/net/ldap.rb +25 -2
  5. data/lib/net/ldap/connection.rb +1 -1
  6. data/lib/net/ldap/dataset.rb +2 -2
  7. data/lib/net/ldap/entry.rb +13 -2
  8. data/lib/net/ldap/error.rb +1 -26
  9. data/lib/net/ldap/password.rb +4 -0
  10. data/lib/net/ldap/version.rb +1 -1
  11. metadata +12 -88
  12. data/.gitignore +0 -10
  13. data/.rubocop.yml +0 -20
  14. data/.rubocop_todo.yml +0 -723
  15. data/.travis.yml +0 -57
  16. data/CONTRIBUTING.md +0 -54
  17. data/Gemfile +0 -2
  18. data/Rakefile +0 -23
  19. data/net-ldap.gemspec +0 -37
  20. data/script/changelog +0 -47
  21. data/script/ldap-docker +0 -12
  22. data/script/package +0 -7
  23. data/script/release +0 -16
  24. data/test/ber/core_ext/test_array.rb +0 -22
  25. data/test/ber/core_ext/test_string.rb +0 -25
  26. data/test/ber/test_ber.rb +0 -153
  27. data/test/fixtures/ca/docker-ca.pem +0 -18
  28. data/test/fixtures/ldif/06-retcode.ldif +0 -75
  29. data/test/fixtures/ldif/50-seed.ldif +0 -374
  30. data/test/integration/test_add.rb +0 -26
  31. data/test/integration/test_ber.rb +0 -30
  32. data/test/integration/test_bind.rb +0 -221
  33. data/test/integration/test_delete.rb +0 -29
  34. data/test/integration/test_open.rb +0 -87
  35. data/test/integration/test_password_modify.rb +0 -93
  36. data/test/integration/test_return_codes.rb +0 -46
  37. data/test/integration/test_search.rb +0 -77
  38. data/test/support/vm/openldap/.gitignore +0 -1
  39. data/test/test_auth_adapter.rb +0 -15
  40. data/test/test_dn.rb +0 -43
  41. data/test/test_entry.rb +0 -66
  42. data/test/test_filter.rb +0 -223
  43. data/test/test_filter_parser.rb +0 -29
  44. data/test/test_helper.rb +0 -73
  45. data/test/test_ldap.rb +0 -114
  46. data/test/test_ldap_connection.rb +0 -505
  47. data/test/test_ldif.rb +0 -104
  48. data/test/test_password.rb +0 -10
  49. data/test/test_rename.rb +0 -77
  50. data/test/test_search.rb +0 -39
  51. data/test/test_snmp.rb +0 -118
  52. data/test/test_ssl_ber.rb +0 -44
  53. data/test/testdata.ldif +0 -101
  54. data/testserver/ldapserver.rb +0 -200
  55. data/testserver/testdata.ldif +0 -101
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5b993fcb063f53718741afa8b8b8a504bdadb9310472e31b7e803fc5f8db8d4a
4
- data.tar.gz: 630c0d112dd4d31a980bca4a112d8ccac064901a513ecfd02c39556f3bbe73f7
3
+ metadata.gz: 02707fcb56d13184b4bbcc16c1555a0d417efb7e20c216a97ee8f28c9553ea84
4
+ data.tar.gz: 26a82f5021146fe6ec84d83e41722364964e155eb898102e3a8618facc020d9a
5
5
  SHA512:
6
- metadata.gz: 4d3879fe70c419c08f9b9638cd39846092c9dd81dc9bff0a8d0e72462b273fda351afaa6946b0a7d43d6c67c221af8b8988962fed5a5a489096a54f84fe2446e
7
- data.tar.gz: 18c4a8b2a05541800bbbe869f0f4ca498a4e2f46e41ec2cabc9e0506e10e74d569c6664d8c32e6160b1bb1a02eedff329c50f6c02eae9b0c92d63a503d08189b
6
+ metadata.gz: d19e1bc7cdcaceff6263f2bca2e9326ef441e301ab74556c42313e01704800abb59231f760abec64a8f2d1e313c18324b97c57a64d2b2ee24943be9e4bd2c428
7
+ data.tar.gz: fa69d36265e7b11b7c83cf812caca680e30af3a0be31c145d70396835081fc06f6a2bf43262ec08f4d6fab1094823dc70de069441229a991f3c5b2eadeb7c4e5
@@ -1,3 +1,39 @@
1
+ === Net::LDAP 0.17.0
2
+ * Added private recursive_delete as alternative to DELETE_TREE #268
3
+ * Test suite updates #373 #376 #377
4
+ * Use Base64.strict_encode64 and SSHA256 #303
5
+ * Remove deprecated ConnectionRefusedError #366
6
+ * Added method to get a duplicate of the internal Hash #286
7
+ * remove a circular require #380
8
+ * fix LdapServerAsnSyntax compile #379
9
+ * Implement '==' operator for entries #381
10
+ * fix for undefined method for write exception #383
11
+
12
+ === Net::LDAP 0.16.3
13
+
14
+ * Add Net::LDAP::InvalidDNError #371
15
+ * Use require_relative instead of require #360
16
+ * Address some warnings and fix JRuby test omissions #365
17
+ * Bump rake dev dependency to 12.3 #359
18
+ * Enable rubocop in ci #251
19
+ * Enhance rubocop configuration and test syntax #344
20
+ * CI: Drop rbx-2, uninstallable #364
21
+ * Fix RuboCop warnings #312
22
+ * Fix wrong error class #305
23
+ * CONTRIBUTING.md: Repair link to Issues #309
24
+ * Make the generate() method more idiomatic... #326
25
+ * Make encode_sort_controls() more idiomatic... #327
26
+ * Make the instrument() method more idiomatic... #328
27
+ * Fix uninitialised Net::LDAP::LdapPduError #338
28
+ * README.rdoc: Use SVG build badge #310
29
+ * Update TravisCI config to inclue Ruby 2.7 #346
30
+ * add explicit ** to silence Ruby 2.7 warning #342
31
+ * Support parsing filters with attribute tags #345
32
+ * Bump rubocop development dependency version #336
33
+ * Add link to generated and hosted documentation on rubydoc #319
34
+ * Fix 'uninitialized constant Net::LDAP::PDU::LdapPduError' error #317
35
+ * simplify encoding logic: no more chomping required #362
36
+
1
37
  === Net::LDAP 0.16.2
2
38
 
3
39
  * Net::LDAP#open does not cache bind result {#334}[https://github.com/ruby-ldap/ruby-net-ldap/pull/334]
@@ -1,4 +1,6 @@
1
- = Net::LDAP for Ruby {<img src="https://travis-ci.org/ruby-ldap/ruby-net-ldap.svg" />}[https://travis-ci.org/ruby-ldap/ruby-net-ldap]
1
+ = Net::LDAP for Ruby
2
+ {<img src="https://badge.fury.io/rb/net-ldap.svg" alt="Gem Version" />}[https://badge.fury.io/rb/net-ldap]
3
+ {<img src="https://travis-ci.org/ruby-ldap/ruby-net-ldap.svg" />}[https://travis-ci.org/ruby-ldap/ruby-net-ldap]
2
4
 
3
5
  == Description
4
6
 
@@ -58,16 +60,21 @@ Simply run:
58
60
 
59
61
  script/ldap-docker
60
62
  INTEGRATION=openldap rake test
63
+
64
+ Or, use {Docker Compose}[https://docs.docker.com/compose/]. See docker-compose.yml for available Ruby versions.
65
+
66
+ docker-compose run ci-2.7
61
67
 
62
68
  CAVEAT: you need to add the following line to /etc/hosts
63
69
  127.0.0.1 ldap.example.org
70
+ 127.0.0.1 cert.mismatch.example.org
64
71
 
65
72
  == Release
66
73
 
67
74
  This section is for gem maintainers to cut a new version of the gem.
68
75
 
69
76
  * Check out a new branch `release-VERSION`
70
- * Update lib/net/ldap/version.rb to next version number X.X.X following {semver}(http://semver.org/).
77
+ * Update lib/net/ldap/version.rb to next version number X.X.X following {semver}[http://semver.org/].
71
78
  * Update `History.rdoc`. Get latest changes with `script/changelog`
72
79
  * Open a pull request with these changes for review
73
80
  * After merging, on the master branch, run `script/release`
@@ -1182,14 +1182,22 @@ class Net::LDAP
1182
1182
  # entries. This method sends an extra control code to tell the LDAP server
1183
1183
  # to do a tree delete. ('1.2.840.113556.1.4.805')
1184
1184
  #
1185
+ # If the LDAP server does not support the DELETE_TREE control code, subordinate
1186
+ # entries are deleted recursively instead.
1187
+ #
1185
1188
  # Returns True or False to indicate whether the delete succeeded. Extended
1186
1189
  # status information is available by calling #get_operation_result.
1187
1190
  #
1188
1191
  # dn = "mail=deleteme@example.com, ou=people, dc=example, dc=com"
1189
1192
  # ldap.delete_tree :dn => dn
1190
1193
  def delete_tree(args)
1191
- delete(args.merge(:control_codes => [[Net::LDAP::LDAPControls::DELETE_TREE, true]]))
1194
+ if search_root_dse[:supportedcontrol].include? Net::LDAP::LDAPControls::DELETE_TREE
1195
+ delete(args.merge(:control_codes => [[Net::LDAP::LDAPControls::DELETE_TREE, true]]))
1196
+ else
1197
+ recursive_delete(args)
1198
+ end
1192
1199
  end
1200
+
1193
1201
  # This method is experimental and subject to change. Return the rootDSE
1194
1202
  # record from the LDAP server as a Net::LDAP::Entry, or an empty Entry if
1195
1203
  # the server doesn't return the record.
@@ -1320,7 +1328,7 @@ class Net::LDAP
1320
1328
  # Force connect to see if there's a connection error
1321
1329
  connection.socket
1322
1330
  connection
1323
- rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT, Net::LDAP::ConnectionRefusedError => e
1331
+ rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT => e
1324
1332
  @result = {
1325
1333
  :resultCode => 52,
1326
1334
  :errorMessage => ResultStrings[ResultCodeUnavailable],
@@ -1340,4 +1348,19 @@ class Net::LDAP
1340
1348
  end
1341
1349
  end
1342
1350
 
1351
+ # Recursively delete a dn and it's subordinate children.
1352
+ # This is useful when a server does not support the DELETE_TREE control code.
1353
+ def recursive_delete(args)
1354
+ raise EmptyDNError unless args.is_a?(Hash) && args.key?(:dn)
1355
+ # Delete Children
1356
+ search(base: args[:dn], scope: Net::LDAP::SearchScope_SingleLevel) do |entry|
1357
+ recursive_delete(dn: entry.dn)
1358
+ end
1359
+ # Delete Self
1360
+ unless delete(dn: args[:dn])
1361
+ raise Net::LDAP::Error, get_operation_result[:error_message].to_s
1362
+ end
1363
+ true
1364
+ end
1365
+
1343
1366
  end # class LDAP
@@ -690,7 +690,7 @@ class Net::LDAP::Connection #:nodoc:
690
690
  #
691
691
  # Typically a TCPSocket, but can be a OpenSSL::SSL::SSLSocket
692
692
  def socket
693
- return @conn if defined? @conn
693
+ return @conn if defined?(@conn) && !@conn.nil?
694
694
 
695
695
  # First refactoring uses the existing methods open_connection and
696
696
  # prepare_socket to set @conn. Next cleanup would centralize connection
@@ -1,3 +1,5 @@
1
+ require_relative 'entry'
2
+
1
3
  # -*- ruby encoding: utf-8 -*-
2
4
  ##
3
5
  # An LDAP Dataset. Used primarily as an intermediate format for converting
@@ -164,5 +166,3 @@ class Net::LDAP::Dataset < Hash
164
166
  end
165
167
  end
166
168
  end
167
-
168
- require_relative 'entry' unless defined? Net::LDAP::Entry
@@ -1,3 +1,5 @@
1
+ require_relative 'dataset'
2
+
1
3
  # -*- ruby encoding: utf-8 -*-
2
4
  ##
3
5
  # Objects of this class represent individual entries in an LDAP directory.
@@ -133,6 +135,13 @@ class Net::LDAP::Entry
133
135
  @myhash.keys
134
136
  end
135
137
 
138
+ ##
139
+ # Creates a duplicate of the internal Hash containing the attributes
140
+ # of the entry.
141
+ def to_h
142
+ @myhash.dup
143
+ end
144
+
136
145
  ##
137
146
  # Accesses each of the attributes present in the Entry.
138
147
  #
@@ -187,6 +196,8 @@ class Net::LDAP::Entry
187
196
  sym.to_s[-1] == ?=
188
197
  end
189
198
  private :setter?
190
- end # class Entry
191
199
 
192
- require_relative 'dataset' unless defined? Net::LDAP::Dataset
200
+ def ==(other)
201
+ other.instance_of?(self.class) && @myhash == other.to_h
202
+ end
203
+ end # class Entry
@@ -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.kind_of? Errno::ECONNREFUSED
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
@@ -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'
@@ -28,6 +29,9 @@ class Net::LDAP::Password
28
29
  when :ssha
29
30
  salt = SecureRandom.random_bytes(16)
30
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)
31
35
  else
32
36
  raise Net::LDAP::HashTypeUnsupportedError, "Unsupported password-hash type (#{type})"
33
37
  end
@@ -1,5 +1,5 @@
1
1
  module Net
2
2
  class LDAP
3
- VERSION = "0.16.3"
3
+ VERSION = "0.17.0"
4
4
  end
5
5
  end
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.16.3
4
+ version: 0.17.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: 2020-08-18 00:00:00.000000000 Z
16
+ date: 2020-11-30 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: flexmock
@@ -61,30 +61,30 @@ dependencies:
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: '0'
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: '0'
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: '0'
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: '0'
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,43 +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/ldap-docker
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/ca/docker-ca.pem
161
- - test/fixtures/ldif/06-retcode.ldif
162
- - test/fixtures/ldif/50-seed.ldif
163
- - test/integration/test_add.rb
164
- - test/integration/test_ber.rb
165
- - test/integration/test_bind.rb
166
- - test/integration/test_delete.rb
167
- - test/integration/test_open.rb
168
- - test/integration/test_password_modify.rb
169
- - test/integration/test_return_codes.rb
170
- - test/integration/test_search.rb
171
- - test/support/vm/openldap/.gitignore
172
- - test/test_auth_adapter.rb
173
- - test/test_dn.rb
174
- - test/test_entry.rb
175
- - test/test_filter.rb
176
- - test/test_filter_parser.rb
177
- - test/test_helper.rb
178
- - test/test_ldap.rb
179
- - test/test_ldap_connection.rb
180
- - test/test_ldif.rb
181
- - test/test_password.rb
182
- - test/test_rename.rb
183
- - test/test_search.rb
184
- - test/test_snmp.rb
185
- - test/test_ssl_ber.rb
186
- - test/testdata.ldif
187
- - testserver/ldapserver.rb
188
- - testserver/testdata.ldif
189
145
  homepage: http://github.com/ruby-ldap/ruby-net-ldap
190
146
  licenses:
191
147
  - MIT
@@ -207,42 +163,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
163
  - !ruby/object:Gem::Version
208
164
  version: '0'
209
165
  requirements: []
210
- rubygems_version: 3.1.2
166
+ rubygems_version: 3.1.4
211
167
  signing_key:
212
168
  specification_version: 4
213
169
  summary: Net::LDAP for Ruby (also called net-ldap) implements client access for the
214
170
  Lightweight Directory Access Protocol (LDAP), an IETF standard protocol for accessing
215
171
  distributed directory services
216
- test_files:
217
- - test/ber/core_ext/test_array.rb
218
- - test/ber/core_ext/test_string.rb
219
- - test/ber/test_ber.rb
220
- - test/fixtures/ca/docker-ca.pem
221
- - test/fixtures/ldif/06-retcode.ldif
222
- - test/fixtures/ldif/50-seed.ldif
223
- - test/integration/test_add.rb
224
- - test/integration/test_ber.rb
225
- - test/integration/test_bind.rb
226
- - test/integration/test_delete.rb
227
- - test/integration/test_open.rb
228
- - test/integration/test_password_modify.rb
229
- - test/integration/test_return_codes.rb
230
- - test/integration/test_search.rb
231
- - test/support/vm/openldap/.gitignore
232
- - test/test_auth_adapter.rb
233
- - test/test_dn.rb
234
- - test/test_entry.rb
235
- - test/test_filter.rb
236
- - test/test_filter_parser.rb
237
- - test/test_helper.rb
238
- - test/test_ldap.rb
239
- - test/test_ldap_connection.rb
240
- - test/test_ldif.rb
241
- - test/test_password.rb
242
- - test/test_rename.rb
243
- - test/test_search.rb
244
- - test/test_snmp.rb
245
- - test/test_ssl_ber.rb
246
- - test/testdata.ldif
247
- - testserver/ldapserver.rb
248
- - testserver/testdata.ldif
172
+ test_files: []
data/.gitignore DELETED
@@ -1,10 +0,0 @@
1
- *~
2
- *.swp
3
- .rvmrc
4
- pkg/
5
- doc/
6
- publish/
7
- Gemfile.lock
8
- .bundle
9
- bin/
10
- .idea
@@ -1,20 +0,0 @@
1
- inherit_from: .rubocop_todo.yml
2
-
3
- AllCops:
4
- Exclude:
5
- - 'pkg/**/*'
6
-
7
- Layout/ExtraSpacing:
8
- Enabled: false
9
-
10
- Lint/AssignmentInCondition:
11
- Enabled: false
12
-
13
- Style/ParallelAssignment:
14
- Enabled: false
15
-
16
- Style/TrailingCommaInLiteral:
17
- EnforcedStyleForMultiline: comma
18
-
19
- Style/TrailingCommaInArguments:
20
- EnforcedStyleForMultiline: comma