lib/vertica/messages/backend_messages/authentication.rb in vertica-0.8.1 vs lib/vertica/messages/backend_messages/authentication.rb in vertica-0.9.0.beta1
- old
+ new
@@ -1,9 +1,9 @@
module Vertica
module Messages
class Authentication < BackendMessage
- message_id ?R
+ message_id 'R'
OK = 0
KERBEROS_V5 = 2
CLEARTEXT_PASSWORD = 3
CRYPT_PASSWORD = 4
@@ -15,15 +15,14 @@
attr_reader :code
attr_reader :salt
attr_reader :auth_data
- def initialize(stream, size)
- super
- case @code = stream.read_network_int32
- when CRYPT_PASSWORD then @salt = stream.readn(2)
- when MD5_PASSWORD then @salt = stream.readn(4)
- when GSS_CONTINUE then @auth_data = stream.readn(size - 9)
+ def initialize(data)
+ @code, other = data.unpack('Na*')
+ case @code
+ when CRYPT_PASSWORD, MD5_PASSWORD then @salt = other
+ when GSS_CONTINUE then @auth_data = other
end
end
end
end
end