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 */
|
TR_DEFAULT_PROXY_TYPE, /* reset in prefs */
|
||||||
[fDefaults boolForKey: @"ProxyAuthorize"],
|
[fDefaults boolForKey: @"ProxyAuthorize"],
|
||||||
[[fDefaults stringForKey: @"ProxyUsername"] UTF8String],
|
[[fDefaults stringForKey: @"ProxyUsername"] UTF8String],
|
||||||
""); /* reset in prefs - from Keychain (leave blank instead of NULL) */
|
NULL); /* reset in prefs - from Keychain */
|
||||||
|
|
||||||
[NSApp setDelegate: self];
|
[NSApp setDelegate: self];
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,9 @@
|
||||||
- (BOOL)setPassword:(NSString *)newPassword;
|
- (BOOL)setPassword:(NSString *)newPassword;
|
||||||
- (BOOL)setUsername:(NSString *)newUsername;
|
- (BOOL)setUsername:(NSString *)newUsername;
|
||||||
- (BOOL)setLabel:(NSString *)newLabel;
|
- (BOOL)setLabel:(NSString *)newLabel;
|
||||||
|
|
||||||
|
//added by ML
|
||||||
|
- (void)removeFromKeychain;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface EMKeychainItem (Private)
|
@interface EMKeychainItem (Private)
|
||||||
|
|
|
@ -82,6 +82,12 @@
|
||||||
|
|
||||||
return [self modifyAttributeWithTag:kSecLabelItemAttr toBeString:newLabel];
|
return [self modifyAttributeWithTag:kSecLabelItemAttr toBeString:newLabel];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)removeFromKeychain
|
||||||
|
{
|
||||||
|
SecKeychainItemDelete(coreKeychainItem);
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation EMKeychainItem (Private)
|
@implementation EMKeychainItem (Private)
|
||||||
|
|
|
@ -757,10 +757,18 @@
|
||||||
EMGenericKeychainItem * keychainItem = [[EMKeychainProxy sharedProxy] genericKeychainItemForService: @"Transmission:Proxy"
|
EMGenericKeychainItem * keychainItem = [[EMKeychainProxy sharedProxy] genericKeychainItemForService: @"Transmission:Proxy"
|
||||||
withUsername: @"Proxy"];
|
withUsername: @"Proxy"];
|
||||||
if (keychainItem)
|
if (keychainItem)
|
||||||
|
{
|
||||||
|
if (![password isEqualToString: @""])
|
||||||
[keychainItem setPassword: password];
|
[keychainItem setPassword: password];
|
||||||
else
|
else
|
||||||
|
[keychainItem removeFromKeychain];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (![password isEqualToString: @""])
|
||||||
[[EMKeychainProxy sharedProxy] addGenericKeychainItemForService: @"Transmission:Proxy" withUsername: @"Proxy"
|
[[EMKeychainProxy sharedProxy] addGenericKeychainItemForService: @"Transmission:Proxy" withUsername: @"Proxy"
|
||||||
password: password];
|
password: password];
|
||||||
|
}
|
||||||
|
|
||||||
tr_sessionSetProxyPassword(fHandle, [password UTF8String]);
|
tr_sessionSetProxyPassword(fHandle, [password UTF8String]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue