diff --git a/README.md b/README.md index c1230527..ad967c03 100644 --- a/README.md +++ b/README.md @@ -82,8 +82,8 @@ Connect to a Postgres server using the standard URI format: let conn = PostgresConnection::connect("postgres://user:pass@host:port/database?arg1=val1&arg2=val2"); ``` `pass` may be omitted if not needed. `port` defaults to `5432` and `database` -defaults to the value of `user` if not specified. The driver supports `trust`, -`password` and `md5` authentication. +defaults to the value of `user` if not specified. The driver supports `trust` +and `password` authentication. Statement Preparation --------------------- diff --git a/lib.rs b/lib.rs index f35ee4f5..c5313eec 100644 --- a/lib.rs +++ b/lib.rs @@ -70,9 +70,7 @@ fn main() { extern mod extra; use extra::container::Deque; -use extra::digest::Digest; use extra::ringbuf::RingBuf; -use extra::md5::Md5; use extra::url::{UserInfo, Url}; use std::cell::Cell; use std::hashmap::HashMap; @@ -507,25 +505,8 @@ impl InnerPostgresConnection { }; self.write_messages([&PasswordMessage { password: pass }]); } - AuthenticationMD5Password { salt } => { - let UserInfo { user, pass } = user; - let pass = match pass { - Some(pass) => pass, - None => return Some(MissingPassword) - }; - let input = pass + user; - let mut md5 = Md5::new(); - md5.input_str(input); - let output = md5.result_str(); - md5.reset(); - md5.input_str(output); - md5.input(salt); - let output = "md5" + md5.result_str(); - self.write_messages([&PasswordMessage { - password: output.as_slice() - }]); - } - AuthenticationKerberosV5 + AuthenticationMD5Password { _ } + | AuthenticationKerberosV5 | AuthenticationSCMCredential | AuthenticationGSS | AuthenticationSSPI => return Some(UnsupportedAuthentication), diff --git a/tests.rs b/tests.rs index 037dee30..cdf265de 100644 --- a/tests.rs +++ b/tests.rs @@ -528,31 +528,6 @@ fn test_plaintext_pass_wrong_pass() { } } -#[test] -fn test_md5_pass() { - PostgresConnection::connect("postgres://md5_user:password@localhost/postgres"); -} - -#[test] -fn test_md5_pass_no_pass() { - let ret = PostgresConnection::try_connect("postgres://md5_user@localhost/postgres"); - match ret { - Err(MissingPassword) => (), - Err(err) => fail!("Unexpected error {}", err.to_str()), - _ => fail!("Expected error") - } -} - -#[test] -fn test_md5_pass_wrong_pass() { - let ret = PostgresConnection::try_connect("postgres://md5_user:asdf@localhost/postgres"); - match ret { - Err(DbError(PostgresDbError { code: InvalidPassword, _ })) => (), - Err(err) => fail!("Unexpected error {}", err.to_str()), - _ => fail!("Expected error") - } -} - #[test] fn test_dns_failure() { let ret = PostgresConnection::try_connect("postgres://postgres@asdfasdfasdf");