Commit a0d7a22e authored by Michael Kozono's avatar Michael Kozono

Always downcase DNs

parent 91f2492a
...@@ -37,10 +37,12 @@ module Gitlab ...@@ -37,10 +37,12 @@ module Gitlab
buffer << "=" if index % 2 == 1 buffer << "=" if index % 2 == 1
buffer << "," if index % 2 == 0 && index != 0 buffer << "," if index % 2 == 0 && index != 0
arg = args[index].downcase
if index < args.length - 1 || index % 2 == 1 if index < args.length - 1 || index % 2 == 1
buffer << self.class.escape(args[index]) buffer << self.class.escape(arg)
else else
buffer << args[index] buffer << arg
end end
end end
...@@ -60,7 +62,7 @@ module Gitlab ...@@ -60,7 +62,7 @@ module Gitlab
case state case state
when :key then when :key then
case char case char
when 'a'..'z', 'A'..'Z' then when 'a'..'z' then
state = :key_normal state = :key_normal
key << char key << char
when '0'..'9' then when '0'..'9' then
...@@ -72,7 +74,7 @@ module Gitlab ...@@ -72,7 +74,7 @@ module Gitlab
when :key_normal then when :key_normal then
case char case char
when '=' then state = :value when '=' then state = :value
when 'a'..'z', 'A'..'Z', '0'..'9', '-', ' ' then key << char when 'a'..'z', '0'..'9', '-', ' ' then key << char
else raise "DN badly formed" else raise "DN badly formed"
end end
when :key_oid then when :key_oid then
...@@ -110,14 +112,14 @@ module Gitlab ...@@ -110,14 +112,14 @@ module Gitlab
end end
when :value_normal_escape then when :value_normal_escape then
case char case char
when '0'..'9', 'a'..'f', 'A'..'F' then when '0'..'9', 'a'..'f' then
state = :value_normal_escape_hex state = :value_normal_escape_hex
hex_buffer = char hex_buffer = char
else state = :value_normal; value << char else state = :value_normal; value << char
end end
when :value_normal_escape_hex then when :value_normal_escape_hex then
case char case char
when '0'..'9', 'a'..'f', 'A'..'F' then when '0'..'9', 'a'..'f' then
state = :value_normal state = :value_normal
value << "#{hex_buffer}#{char}".to_i(16).chr value << "#{hex_buffer}#{char}".to_i(16).chr
else raise "DN badly formed" else raise "DN badly formed"
...@@ -130,7 +132,7 @@ module Gitlab ...@@ -130,7 +132,7 @@ module Gitlab
end end
when :value_quoted_escape then when :value_quoted_escape then
case char case char
when '0'..'9', 'a'..'f', 'A'..'F' then when '0'..'9', 'a'..'f' then
state = :value_quoted_escape_hex state = :value_quoted_escape_hex
hex_buffer = char hex_buffer = char
else else
...@@ -139,14 +141,14 @@ module Gitlab ...@@ -139,14 +141,14 @@ module Gitlab
end end
when :value_quoted_escape_hex then when :value_quoted_escape_hex then
case char case char
when '0'..'9', 'a'..'f', 'A'..'F' then when '0'..'9', 'a'..'f' then
state = :value_quoted state = :value_quoted
value << "#{hex_buffer}#{char}".to_i(16).chr value << "#{hex_buffer}#{char}".to_i(16).chr
else raise "DN badly formed" else raise "DN badly formed"
end end
when :value_hexstring then when :value_hexstring then
case char case char
when '0'..'9', 'a'..'f', 'A'..'F' then when '0'..'9', 'a'..'f' then
state = :value_hexstring_hex state = :value_hexstring_hex
value << char value << char
when ' ' then state = :value_end when ' ' then state = :value_end
...@@ -159,7 +161,7 @@ module Gitlab ...@@ -159,7 +161,7 @@ module Gitlab
end end
when :value_hexstring_hex then when :value_hexstring_hex then
case char case char
when '0'..'9', 'a'..'f', 'A'..'F' then when '0'..'9', 'a'..'f' then
state = :value_hexstring state = :value_hexstring
value << char value << char
else raise "DN badly formed" else raise "DN badly formed"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment