Merge forward small bug found in password storage
While fixing bug 2981433 in Gingerbread, I discovered one additional place where passwords were being trimmed. This brings the fix forward into honeycomb, as well as a new unit test for the fix. Bug: 2981433 Change-Id: I566f5c0c6693ca7c0069bca9e74f320fca48e600
This commit is contained in:
parent
24a81185d1
commit
9128217da1
|
@ -2683,8 +2683,8 @@ public abstract class EmailContent {
|
|||
String userInfo = null;
|
||||
if ((mFlags & FLAG_AUTHENTICATE) != 0) {
|
||||
String trimUser = (mLogin != null) ? mLogin.trim() : "";
|
||||
String trimPassword = (mPassword != null) ? mPassword.trim() : "";
|
||||
userInfo = trimUser + ":" + trimPassword;
|
||||
String password = (mPassword != null) ? mPassword : "";
|
||||
userInfo = trimUser + ":" + password;
|
||||
}
|
||||
String address = (mAddress != null) ? mAddress.trim() : null;
|
||||
String path = (mDomain != null) ? "/" + mDomain : null;
|
||||
|
|
|
@ -354,6 +354,27 @@ public class ProviderTests extends ProviderTestCase2<EmailProvider> {
|
|||
assertEquals(587, ha.mPort);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test preservation of username & password in URI
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testHostAuthUri() {
|
||||
HostAuth ha = new HostAuth();
|
||||
ha.setStoreUri("protocol://user:password@server:123");
|
||||
String getUri = ha.getStoreUri();
|
||||
assertEquals("protocol://user:password@server:123", getUri);
|
||||
|
||||
// Now put spaces in/around username (they are trimmed)
|
||||
ha.setStoreUri("protocol://%20us%20er%20:password@server:123");
|
||||
getUri = ha.getStoreUri();
|
||||
assertEquals("protocol://us%20er:password@server:123", getUri);
|
||||
|
||||
// Now put spaces around password (should not be trimmed)
|
||||
ha.setStoreUri("protocol://user:%20pass%20word%20@server:123");
|
||||
getUri = ha.getStoreUri();
|
||||
assertEquals("protocol://user:%20pass%20word%20@server:123", getUri);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test simple mailbox save/retrieve
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue