194: def dispatch_conn_message msg
195: case msg
196: when AuthentificationClearTextPassword
197: raise ArgumentError, "no password specified" if @password.nil?
198: send_data PasswordMessage.new(@password).dump
199:
200: when AuthentificationCryptPassword
201: raise ArgumentError, "no password specified" if @password.nil?
202: send_data PasswordMessage.new(@password.crypt(msg.salt)).dump
203:
204: when AuthentificationMD5Password
205: raise ArgumentError, "no password specified" if @password.nil?
206: require 'digest/md5'
207:
208: m = Digest::MD5.hexdigest(@password + @user)
209: m = Digest::MD5.hexdigest(m + msg.salt)
210: m = 'md5' + m
211: send_data PasswordMessage.new(m).dump
212:
213: when AuthentificationKerberosV4, AuthentificationKerberosV5, AuthentificationSCMCredential
214: raise "unsupported authentification"
215:
216: when AuthentificationOk
217: when ErrorResponse
218: raise msg.field_values.join("\t")
219: when NoticeResponse
220: @notice_processor.call(msg) if @notice_processor
221: when ParameterStatus
222: @params[msg.key] = msg.value
223: when BackendKeyData
224:
225:
226: when ReadyForQuery
227:
228: pc,@pending_conn = @pending_conn,nil
229: pc.succeed true
230: else
231: raise "unhandled message type"
232: end
233: end