aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-08-08 01:11:23 +0000
committerrowanbeentje <rowan@beent.je>2009-08-08 01:11:23 +0000
commit76563cf13092e21da3efd853c0721f782bbc0b83 (patch)
treee7020353ee9c18fa0439b75d97a4a1d657ce4ddd
parent2297b13252ee7149606ecd4544898614f0ac9298 (diff)
downloadsequelpro-76563cf13092e21da3efd853c0721f782bbc0b83.tar.gz
sequelpro-76563cf13092e21da3efd853c0721f782bbc0b83.tar.bz2
sequelpro-76563cf13092e21da3efd853c0721f782bbc0b83.zip
Merge r1175 (public key fixes) into 0.9.6 release branch
-rw-r--r--Source/SPConnectionController.m4
-rw-r--r--Source/SPSSHTunnel.h3
-rw-r--r--Source/SPSSHTunnel.m12
3 files changed, 13 insertions, 6 deletions
diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m
index b27f24f2..c7dfd21f 100644
--- a/Source/SPConnectionController.m
+++ b/Source/SPConnectionController.m
@@ -219,7 +219,7 @@
// Add keychain or plaintext password as appropriate - note the checks in initiateConnection.
if (connectionSSHKeychainItemName) {
[sshTunnel setPasswordKeychainName:connectionSSHKeychainItemName account:connectionSSHKeychainItemAccount];
- } else {
+ } else if (sshPassword) {
[sshTunnel setPassword:[self sshPassword]];
}
@@ -281,7 +281,7 @@
}
// Only set the password if there is no Keychain item set. The connection will ask the delegate for passwords in the Keychain.
- if (!connectionKeychainItemName) {
+ if (!connectionKeychainItemName && [self password]) {
[mySQLConnection setPassword:[self password]];
}
diff --git a/Source/SPSSHTunnel.h b/Source/SPSSHTunnel.h
index e9b06cb6..2538204e 100644
--- a/Source/SPSSHTunnel.h
+++ b/Source/SPSSHTunnel.h
@@ -27,7 +27,8 @@
enum spsshtunnel_password_modes
{
SPSSH_PASSWORD_USES_KEYCHAIN = 0,
- SPSSH_PASSWORD_ASKS_UI = 1
+ SPSSH_PASSWORD_ASKS_UI = 1,
+ SPSSH_NO_PASSWORD = 2
};
@interface SPSSHTunnel : NSObject <MCPConnectionProxy>
diff --git a/Source/SPSSHTunnel.m b/Source/SPSSHTunnel.m
index 60260f8d..a366256c 100644
--- a/Source/SPSSHTunnel.m
+++ b/Source/SPSSHTunnel.m
@@ -160,7 +160,7 @@
{
localPort = 0;
- if (connectionState != PROXY_STATE_IDLE || (!passwordInKeychain && !password)) return;
+ if (connectionState != PROXY_STATE_IDLE) return;
[debugMessages removeAllObjects];
[NSThread detachNewThreadSelector:@selector(launchTask:) toTarget: self withObject: nil ];
}
@@ -286,8 +286,10 @@
[taskEnvironment setObject:[[NSNumber numberWithInt:SPSSH_PASSWORD_USES_KEYCHAIN] stringValue] forKey:@"SP_PASSWORD_METHOD"];
[taskEnvironment setObject:keychainName forKey:@"SP_KEYCHAIN_ITEM_NAME"];
[taskEnvironment setObject:keychainAccount forKey:@"SP_KEYCHAIN_ITEM_ACCOUNT"];
- } else {
+ } else if (password) {
[taskEnvironment setObject:[[NSNumber numberWithInt:SPSSH_PASSWORD_ASKS_UI] stringValue] forKey:@"SP_PASSWORD_METHOD"];
+ } else {
+ [taskEnvironment setObject:[[NSNumber numberWithInt:SPSSH_NO_PASSWORD] stringValue] forKey:@"SP_PASSWORD_METHOD"];
}
[task setEnvironment:taskEnvironment];
@@ -536,7 +538,11 @@
case 1:
thePassword = [NSString stringWithString:[sshPasswordField stringValue]];
[sshPasswordField setStringValue:@""];
- [[delegate undoManager] removeAllActionsWithTarget:sshPasswordField];
+ if ([delegate respondsToSelector:@selector(setUndoManager:)] && [delegate undoManager]) {
+ [[delegate undoManager] removeAllActionsWithTarget:sshPasswordField];
+ } else if ([[parentWindow windowController] document] && [[[parentWindow windowController] document] undoManager]) {
+ [[[[parentWindow windowController] document] undoManager] removeAllActionsWithTarget:sshPasswordField];
+ }
requestedPassphrase = [[NSString alloc] initWithString:thePassword];
// Add to keychain if appropriate