180: def dispatch_conn_message msg
181: case msg
182: when AuthentificationClearTextPassword
183: raise ArgumentError, "no password specified" if @password.nil?
184: send_data PasswordMessage.new(@password).dump
185:
186: when AuthentificationCryptPassword
187: raise ArgumentError, "no password specified" if @password.nil?
188: send_data PasswordMessage.new(@password.crypt(msg.salt)).dump
189:
190: when AuthentificationMD5Password
191: raise ArgumentError, "no password specified" if @password.nil?
192: require 'digest/md5'
193:
194: m = Digest::MD5.hexdigest(@password + @user)
195: m = Digest::MD5.hexdigest(m + msg.salt)
196: m = 'md5' + m
197: send_data PasswordMessage.new(m).dump
198:
199: when AuthentificationKerberosV4, AuthentificationKerberosV5, AuthentificationSCMCredential
200: raise "unsupported authentification"
201:
202: when AuthentificationOk
203: when ErrorResponse
204: raise msg.field_values.join("\t")
205: when NoticeResponse
206: @notice_processor.call(msg) if @notice_processor
207: when ParameterStatus
208: @params[msg.key] = msg.value
209: when BackendKeyData
210:
211:
212: when ReadyForQuery
213:
214: pc,@pending_conn = @pending_conn,nil
215: pc.succeed true
216: else
217: raise "unhandled message type"
218: end
219: end