if setting the proxy password to blank, delete it from the keychain
This commit is contained in:
parent
1c38bce649
commit
4c987b7a27
|
@ -228,7 +228,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
TR_DEFAULT_PROXY_TYPE, /* reset in prefs */
|
||||
[fDefaults boolForKey: @"ProxyAuthorize"],
|
||||
[[fDefaults stringForKey: @"ProxyUsername"] UTF8String],
|
||||
""); /* reset in prefs - from Keychain (leave blank instead of NULL) */
|
||||
NULL); /* reset in prefs - from Keychain */
|
||||
|
||||
[NSApp setDelegate: self];
|
||||
|
||||
|
|
|
@ -40,6 +40,9 @@
|
|||
- (BOOL)setPassword:(NSString *)newPassword;
|
||||
- (BOOL)setUsername:(NSString *)newUsername;
|
||||
- (BOOL)setLabel:(NSString *)newLabel;
|
||||
|
||||
//added by ML
|
||||
- (void)removeFromKeychain;
|
||||
@end
|
||||
|
||||
@interface EMKeychainItem (Private)
|
||||
|
|
|
@ -82,6 +82,12 @@
|
|||
|
||||
return [self modifyAttributeWithTag:kSecLabelItemAttr toBeString:newLabel];
|
||||
}
|
||||
|
||||
- (void)removeFromKeychain
|
||||
{
|
||||
SecKeychainItemDelete(coreKeychainItem);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation EMKeychainItem (Private)
|
||||
|
|
|
@ -757,10 +757,18 @@
|
|||
EMGenericKeychainItem * keychainItem = [[EMKeychainProxy sharedProxy] genericKeychainItemForService: @"Transmission:Proxy"
|
||||
withUsername: @"Proxy"];
|
||||
if (keychainItem)
|
||||
[keychainItem setPassword: password];
|
||||
{
|
||||
if (![password isEqualToString: @""])
|
||||
[keychainItem setPassword: password];
|
||||
else
|
||||
[keychainItem removeFromKeychain];
|
||||
}
|
||||
else
|
||||
[[EMKeychainProxy sharedProxy] addGenericKeychainItemForService: @"Transmission:Proxy" withUsername: @"Proxy"
|
||||
password: password];
|
||||
{
|
||||
if (![password isEqualToString: @""])
|
||||
[[EMKeychainProxy sharedProxy] addGenericKeychainItemForService: @"Transmission:Proxy" withUsername: @"Proxy"
|
||||
password: password];
|
||||
}
|
||||
|
||||
tr_sessionSetProxyPassword(fHandle, [password UTF8String]);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue