@@ -57,19 +57,19 @@ def each_pair
57
57
state = :key_oid
58
58
key << char
59
59
when ' ' then state = :key
60
- else raise "DN badly formed"
60
+ else raise Net :: LDAP :: InvalidDNError , "DN badly formed"
61
61
end
62
62
when :key_normal then
63
63
case char
64
64
when '=' then state = :value
65
65
when 'a' ..'z' , 'A' ..'Z' , '0' ..'9' , '-' , ' ' then key << char
66
- else raise "DN badly formed"
66
+ else raise Net :: LDAP :: InvalidDNError , "DN badly formed"
67
67
end
68
68
when :key_oid then
69
69
case char
70
70
when '=' then state = :value
71
71
when '0' ..'9' , '.' , ' ' then key << char
72
- else raise "DN badly formed"
72
+ else raise Net :: LDAP :: InvalidDNError , "DN badly formed"
73
73
end
74
74
when :value then
75
75
case char
@@ -110,7 +110,7 @@ def each_pair
110
110
when '0' ..'9' , 'a' ..'f' , 'A' ..'F' then
111
111
state = :value_normal
112
112
value << "#{ hex_buffer } #{ char } " . to_i ( 16 ) . chr
113
- else raise "DN badly formed"
113
+ else raise Net :: LDAP :: InvalidDNError , "DN badly formed"
114
114
end
115
115
when :value_quoted then
116
116
case char
@@ -132,7 +132,7 @@ def each_pair
132
132
when '0' ..'9' , 'a' ..'f' , 'A' ..'F' then
133
133
state = :value_quoted
134
134
value << "#{ hex_buffer } #{ char } " . to_i ( 16 ) . chr
135
- else raise "DN badly formed"
135
+ else raise Net :: LDAP :: InvalidDNError , "DN badly formed"
136
136
end
137
137
when :value_hexstring then
138
138
case char
@@ -145,14 +145,14 @@ def each_pair
145
145
yield key . string . strip , value . string . rstrip
146
146
key = StringIO . new
147
147
value = StringIO . new ;
148
- else raise "DN badly formed"
148
+ else raise Net :: LDAP :: InvalidDNError , "DN badly formed"
149
149
end
150
150
when :value_hexstring_hex then
151
151
case char
152
152
when '0' ..'9' , 'a' ..'f' , 'A' ..'F' then
153
153
state = :value_hexstring
154
154
value << char
155
- else raise "DN badly formed"
155
+ else raise Net :: LDAP :: InvalidDNError , "DN badly formed"
156
156
end
157
157
when :value_end then
158
158
case char
@@ -162,14 +162,14 @@ def each_pair
162
162
yield key . string . strip , value . string . rstrip
163
163
key = StringIO . new
164
164
value = StringIO . new ;
165
- else raise "DN badly formed"
165
+ else raise Net :: LDAP :: InvalidDNError , "DN badly formed"
166
166
end
167
- else raise "Fell out of state machine"
167
+ else raise Net :: LDAP :: InvalidDNError , "Fell out of state machine"
168
168
end
169
169
end
170
170
171
171
# Last pair
172
- raise "DN badly formed" unless
172
+ raise Net :: LDAP :: InvalidDNError , "DN badly formed" unless
173
173
[ :value , :value_normal , :value_hexstring , :value_end ] . include? state
174
174
175
175
yield key . string . strip , value . string . rstrip
0 commit comments