Remove MD5 support

:(
This commit is contained in:
Steven Fackler 2013-10-28 08:42:57 -07:00
parent f6c209c8eb
commit 42555b7a09
3 changed files with 4 additions and 48 deletions

View File

@ -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
---------------------

23
lib.rs
View File

@ -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),

View File

@ -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");