net-ldap 0.2 → 0.2.1

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.

@@ -1,4 +1,8 @@
1
- === Net::LDAP 0.2 / 2011-03-__
1
+ === Net::LDAP 0.2.1 / 2011-03-23
2
+ * Bug Fixes:
3
+ * Net::LDAP.modify_ops was broken and is now fixed.
4
+
5
+ === Net::LDAP 0.2 / 2011-03-22
2
6
  * Major Enhancements:
3
7
  * Net::LDAP::Filter changes:
4
8
  * Filters can only be constructed using our custom constructors (eq, ge,
data/Rakefile CHANGED
@@ -6,6 +6,7 @@ require 'hoe'
6
6
  Hoe.plugin :doofus
7
7
  Hoe.plugin :git
8
8
  Hoe.plugin :gemspec
9
+ Hoe.plugin :rubyforge
9
10
 
10
11
  Hoe.spec 'net-ldap' do |spec|
11
12
  spec.rubyforge_name = spec.name
@@ -106,7 +106,7 @@ module Net # :nodoc:
106
106
  # <tr><th>BMPString</th><th>C</th><td>30: 62 (0x3e, 0b00111110)</td></tr>
107
107
  # </table>
108
108
  module BER
109
- VERSION = '0.2'
109
+ VERSION = '0.2.1'
110
110
 
111
111
  ##
112
112
  # Used for BER-encoding the length and content bytes of a Fixnum integer
@@ -241,7 +241,7 @@ require 'net/ldap/entry'
241
241
  # and then keeps it open while it executes a user-supplied block.
242
242
  # Net::LDAP#open closes the connection on completion of the block.
243
243
  class Net::LDAP
244
- VERSION = "0.2"
244
+ VERSION = "0.2.1"
245
245
 
246
246
  class LdapError < StandardError; end
247
247
 
@@ -1452,18 +1452,25 @@ class Net::LDAP::Connection #:nodoc:
1452
1452
  result_code
1453
1453
  end
1454
1454
 
1455
- def self.modify_ops args
1456
- modify_ops = []
1457
- a = args[:operations] and a.each {|op, attr, values|
1458
- # TODO, fix the following line, which gives a bogus error
1459
- # if the opcode is invalid.
1460
- op_1 = {:add => 0, :delete => 1, :replace => 2} [op.to_sym].to_ber_enumerated
1461
- values = [values].flatten.map { |v|
1462
- v.to_ber unless v.nil?
1463
- }.to_ber_set
1464
- modify_ops << [op_1,[attr.to_s.to_ber,values].to_ber_sequence].to_ber
1455
+ MODIFY_OPERATIONS = { #:nodoc:
1456
+ :add => 0,
1457
+ :delete => 1,
1458
+ :replace => 2
1459
+ }
1460
+
1461
+ def self.modify_ops(operations)
1462
+ modify_ops = []
1463
+ if operations
1464
+ operations.each { |op, attrib, values|
1465
+ # TODO, fix the following line, which gives a bogus error if the
1466
+ # opcode is invalid.
1467
+ op_ber = MODIFY_OPERATIONS[op.to_sym].to_ber_enumerated
1468
+ values = [ values ].flatten.map { |v| v.to_ber if v }.to_ber_set
1469
+ values = [ attrib.to_s.to_ber, values ].to_ber_sequence
1470
+ modify_ops << [ op_ber, values ].to_ber
1465
1471
  }
1466
- modify_ops
1472
+ end
1473
+ modify_ops
1467
1474
  end
1468
1475
 
1469
1476
  #--
@@ -1476,9 +1483,9 @@ class Net::LDAP::Connection #:nodoc:
1476
1483
  def modify(args)
1477
1484
  modify_dn = args[:dn] or raise "Unable to modify empty DN"
1478
1485
  modify_ops = modify_ops args[:operations]
1479
- request = [modify_dn.to_ber,
1480
- modify_ops.to_ber_sequence].to_ber_appsequence(6)
1481
- pkt = [next_msgid.to_ber, request].to_ber_sequence
1486
+ request = [ modify_dn.to_ber,
1487
+ modify_ops.to_ber_sequence ].to_ber_appsequence(6)
1488
+ pkt = [ next_msgid.to_ber, request ].to_ber_sequence
1482
1489
  @conn.write pkt
1483
1490
 
1484
1491
  (be = @conn.read_ber(Net::LDAP::AsnSyntax)) && (pdu = Net::LDAP::PDU.new(be)) && (pdu.app_tag == 7) or raise Net::LDAP::LdapError, "response missing or invalid"
@@ -2,7 +2,7 @@
2
2
  # :stopdoc:
3
3
  module Net
4
4
  class SNMP
5
- VERSION = '0.2'
5
+ VERSION = '0.2.1'
6
6
 
7
7
  AsnSyntax = Net::BER.compile_syntax({
8
8
  :application => {
@@ -1,24 +1,24 @@
1
1
  require 'common'
2
2
 
3
3
  class TestLDAP < Test::Unit::TestCase
4
- def test_modify_ops_delete
5
- args = {:operations=>[[:delete, "mail"]]}
6
- result = Net::LDAP::Connection.modify_ops(args)
7
- expected = ["0\r\n\x01\x010\b\x04\x04mail1\x00"]
8
- assert_equal(expected, result)
9
- end
4
+ def test_modify_ops_delete
5
+ args = { :operations => [ [ :delete, "mail" ] ] }
6
+ result = Net::LDAP::Connection.modify_ops(args[:operations])
7
+ expected = [ "0\r\n\x01\x010\b\x04\x04mail1\x00" ]
8
+ assert_equal(expected, result)
9
+ end
10
10
 
11
- def test_modify_ops_add
12
- args = {:operations=>[[:add, "mail", "testuser@example.com"]]}
13
- result = Net::LDAP::Connection.modify_ops(args)
14
- expected = ["0#\n\x01\x000\x1E\x04\x04mail1\x16\x04\x14testuser@example.com"]
15
- assert_equal(expected, result)
16
- end
11
+ def test_modify_ops_add
12
+ args = { :operations => [ [ :add, "mail", "testuser@example.com" ] ] }
13
+ result = Net::LDAP::Connection.modify_ops(args[:operations])
14
+ expected = [ "0#\n\x01\x000\x1E\x04\x04mail1\x16\x04\x14testuser@example.com" ]
15
+ assert_equal(expected, result)
16
+ end
17
17
 
18
- def test_modify_ops_replace
19
- args = {:operations=>[[:replace, "mail", "testuser@example.com"]]}
20
- result = Net::LDAP::Connection.modify_ops(args)
21
- expected = ["0#\n\x01\x020\x1E\x04\x04mail1\x16\x04\x14testuser@example.com"]
22
- assert_equal(expected, result)
23
- end
18
+ def test_modify_ops_replace
19
+ args = { :operations =>[ [ :replace, "mail", "testuser@example.com" ] ] }
20
+ result = Net::LDAP::Connection.modify_ops(args[:operations])
21
+ expected = [ "0#\n\x01\x020\x1E\x04\x04mail1\x16\x04\x14testuser@example.com" ]
22
+ assert_equal(expected, result)
23
+ end
24
24
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-ldap
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- version: "0.2"
9
+ - 1
10
+ version: 0.2.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Francis Cianfrocca
@@ -18,13 +19,29 @@ autorequire:
18
19
  bindir: bin
19
20
  cert_chain: []
20
21
 
21
- date: 2011-03-22 00:00:00 -04:00
22
+ date: 2011-03-23 00:00:00 -04:00
22
23
  default_executable:
23
24
  dependencies:
24
25
  - !ruby/object:Gem::Dependency
25
- name: hoe-git
26
+ name: rubyforge
26
27
  prerelease: false
27
28
  requirement: &id001 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ hash: 7
34
+ segments:
35
+ - 2
36
+ - 0
37
+ - 4
38
+ version: 2.0.4
39
+ type: :development
40
+ version_requirements: *id001
41
+ - !ruby/object:Gem::Dependency
42
+ name: hoe-git
43
+ prerelease: false
44
+ requirement: &id002 !ruby/object:Gem::Requirement
28
45
  none: false
29
46
  requirements:
30
47
  - - ~>
@@ -34,11 +51,11 @@ dependencies:
34
51
  - 1
35
52
  version: "1"
36
53
  type: :development
37
- version_requirements: *id001
54
+ version_requirements: *id002
38
55
  - !ruby/object:Gem::Dependency
39
56
  name: hoe-gemspec
40
57
  prerelease: false
41
- requirement: &id002 !ruby/object:Gem::Requirement
58
+ requirement: &id003 !ruby/object:Gem::Requirement
42
59
  none: false
43
60
  requirements:
44
61
  - - ~>
@@ -48,11 +65,11 @@ dependencies:
48
65
  - 1
49
66
  version: "1"
50
67
  type: :development
51
- version_requirements: *id002
68
+ version_requirements: *id003
52
69
  - !ruby/object:Gem::Dependency
53
70
  name: metaid
54
71
  prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
72
+ requirement: &id004 !ruby/object:Gem::Requirement
56
73
  none: false
57
74
  requirements:
58
75
  - - ~>
@@ -62,11 +79,11 @@ dependencies:
62
79
  - 1
63
80
  version: "1"
64
81
  type: :development
65
- version_requirements: *id003
82
+ version_requirements: *id004
66
83
  - !ruby/object:Gem::Dependency
67
84
  name: flexmock
68
85
  prerelease: false
69
- requirement: &id004 !ruby/object:Gem::Requirement
86
+ requirement: &id005 !ruby/object:Gem::Requirement
70
87
  none: false
71
88
  requirements:
72
89
  - - ~>
@@ -78,11 +95,11 @@ dependencies:
78
95
  - 0
79
96
  version: 0.9.0
80
97
  type: :development
81
- version_requirements: *id004
98
+ version_requirements: *id005
82
99
  - !ruby/object:Gem::Dependency
83
100
  name: rspec
84
101
  prerelease: false
85
- requirement: &id005 !ruby/object:Gem::Requirement
102
+ requirement: &id006 !ruby/object:Gem::Requirement
86
103
  none: false
87
104
  requirements:
88
105
  - - ~>
@@ -93,11 +110,11 @@ dependencies:
93
110
  - 0
94
111
  version: "2.0"
95
112
  type: :development
96
- version_requirements: *id005
113
+ version_requirements: *id006
97
114
  - !ruby/object:Gem::Dependency
98
115
  name: hoe
99
116
  prerelease: false
100
- requirement: &id006 !ruby/object:Gem::Requirement
117
+ requirement: &id007 !ruby/object:Gem::Requirement
101
118
  none: false
102
119
  requirements:
103
120
  - - ">="
@@ -109,7 +126,7 @@ dependencies:
109
126
  - 1
110
127
  version: 2.9.1
111
128
  type: :development
112
- version_requirements: *id006
129
+ version_requirements: *id007
113
130
  description: "Net::LDAP for Ruby (also called net-ldap) implements client access for the\n\
114
131
  Lightweight Directory Access Protocol (LDAP), an IETF standard protocol for\n\
115
132
  accessing distributed directory services. Net::LDAP is written completely in\n\