diff options
author | rowanbeentje <rowan@beent.je> | 2010-09-08 21:36:11 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2010-09-08 21:36:11 +0000 |
commit | f7a69e2454ca3dd1f1a62875522e9fb3dea572b3 (patch) | |
tree | 847d2a915dfd496382977fc64799222057a923e3 /Source/SPSSHTunnel.m | |
parent | 3f6aa841dd77af2cf8f2818c91cd186aec2ca5e0 (diff) | |
download | sequelpro-f7a69e2454ca3dd1f1a62875522e9fb3dea572b3.tar.gz sequelpro-f7a69e2454ca3dd1f1a62875522e9fb3dea572b3.tar.bz2 sequelpro-f7a69e2454ca3dd1f1a62875522e9fb3dea572b3.zip |
- Add support for SSH identity files (public keys) in custom locations
- Update localisable strings
- Fix initial window position
Diffstat (limited to 'Source/SPSSHTunnel.m')
-rw-r--r-- | Source/SPSSHTunnel.m | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Source/SPSSHTunnel.m b/Source/SPSSHTunnel.m index 5cc833fd..807d507e 100644 --- a/Source/SPSSHTunnel.m +++ b/Source/SPSSHTunnel.m @@ -72,6 +72,7 @@ } parentWindow = nil; + identityFilePath = nil; sshQuestionDialog = nil; sshPasswordDialog = nil; password = nil; @@ -128,6 +129,19 @@ return YES; } +/** + * Sets the path of an identity file, or public key file, to use when connecting. + */ +- (BOOL) setKeyFilePath:(NSString *)thePath +{ + NSString *expandedPath = [thePath stringByExpandingTildeInPath]; + if (![[NSFileManager defaultManager] fileExistsAtPath:expandedPath]) return NO; + + if (identityFilePath) [identityFilePath release]; + identityFilePath = [[NSString alloc] initWithString:expandedPath]; + return YES; +} + /* * Sets the keychain name to use to retrieve the password. This is the recommended and * secure way of supplying a password to the SSH tunnel. @@ -282,6 +296,10 @@ [taskArguments addObject:@"-o ExitOnForwardFailure=yes"]; [taskArguments addObject:[NSString stringWithFormat:@"-o ConnectTimeout=%ld", (long)connectionTimeout]]; [taskArguments addObject:@"-o NumberOfPasswordPrompts=3"]; + if (identityFilePath) { + [taskArguments addObject:@"-i"]; + [taskArguments addObject:identityFilePath]; + } if (useKeepAlive && keepAliveInterval) { [taskArguments addObject:@"-o TCPKeepAlive=no"]; [taskArguments addObject:[NSString stringWithFormat:@"-o ServerAliveInterval=%ld", (long)ceil(keepAliveInterval)]]; @@ -652,6 +670,7 @@ if (password) [password release]; if (keychainName) [keychainName release]; if (keychainAccount) [keychainAccount release]; + if (identityFilePath) [identityFilePath release]; // As this object is not a NSWindowController, use manual top-level nib item management if (sshQuestionDialog) [sshQuestionDialog release], sshQuestionDialog = nil; |