Skip to content

Commit 5dfde99

Browse files
committed
Fix #16954.
1 parent 7e103ed commit 5dfde99

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

ssh/src/main/java/ch/cyberduck/core/sftp/openssh/OpenSSHCredentialsConfigurator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public Credentials configure(final Host host) {
5353
if(!credentials.isPublicKeyAuthentication()) {
5454
if(null != entry.getIdentityFile()) {
5555
log.info("Using identity {} from {}", entry, configuration);
56-
credentials.setIdentity(entry.getIdentityFile());
56+
credentials.setIdentity(LocalFactory.get(entry.getIdentityFile()));
5757
}
5858
else {
5959
// No custom public key authentication configuration

ssh/src/main/java/ch/cyberduck/core/sftp/openssh/OpenSSHIdentityAgentConfigurator.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
1919
*/
2020

21-
import ch.cyberduck.core.Local;
2221
import ch.cyberduck.core.LocalFactory;
2322
import ch.cyberduck.core.sftp.openssh.config.transport.OpenSshConfig;
2423

@@ -39,13 +38,13 @@ public OpenSSHIdentityAgentConfigurator(final OpenSshConfig configuration) {
3938
}
4039

4140
public String getIdentityAgent(final String alias) {
42-
final Local agent = configuration.lookup(alias).getIdentityAgent();
41+
final String agent = configuration.lookup(alias).getIdentityAgent();
4342
if(null == agent) {
4443
log.debug("No configuration for alias {}", alias);
4544
return null;
4645
}
4746
log.debug("Found configuration {} for alias {}", agent, alias);
48-
return agent.getAbsolute();
47+
return agent;
4948
}
5049

5150
@Override

ssh/src/main/java/ch/cyberduck/core/sftp/openssh/config/transport/OpenSshConfig.java

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ private Map<String, Host> parse(final InputStream in) throws IOException {
186186
else if("ProxyJump".equalsIgnoreCase(keyword)) {
187187
for(final Host c : current) {
188188
if(c.proxyJump == null) {
189-
c.proxyJump = dequote(argValue);
189+
c.proxyJump = none(dequote(argValue));
190190
}
191191
}
192192
}
@@ -213,21 +213,21 @@ else if("Port".equalsIgnoreCase(keyword)) {
213213
else if("IdentityFile".equalsIgnoreCase(keyword)) {
214214
for(final Host c : current) {
215215
if(c.identityFile == null) {
216-
c.identityFile = LocalFactory.get(dequote(argValue));
216+
c.identityFile = none(dequote(argValue));
217217
}
218218
}
219219
}
220220
else if("IdentityAgent".equalsIgnoreCase(keyword)) {
221221
for(final Host c : current) {
222222
if(c.identityAgent == null) {
223-
c.identityAgent = LocalFactory.get(dequote(argValue));
223+
c.identityAgent = none(dequote(argValue));
224224
}
225225
}
226226
}
227227
else if("PreferredAuthentications".equalsIgnoreCase(keyword)) {
228228
for(final Host c : current) {
229229
if(c.preferredAuthentications == null) {
230-
c.preferredAuthentications = nows(dequote(argValue));
230+
c.preferredAuthentications = none(nows(dequote(argValue)));
231231
}
232232
}
233233
}
@@ -289,6 +289,13 @@ private static Boolean yesno(final String value) {
289289
return Boolean.FALSE;
290290
}
291291

292+
private static String none(final String value) {
293+
if("none".equalsIgnoreCase(value)) {
294+
return null;
295+
}
296+
return value;
297+
}
298+
292299
/**
293300
* Configuration of one "Host" block in the configuration file.
294301
* <p/>
@@ -304,8 +311,8 @@ public static class Host {
304311
String hostName;
305312
String proxyJump;
306313
int port;
307-
Local identityFile;
308-
Local identityAgent;
314+
String identityFile;
315+
String identityAgent;
309316
String user;
310317
String preferredAuthentications;
311318
Boolean identitiesOnly;
@@ -363,14 +370,14 @@ public int getPort() {
363370
* @return path of the private key file to use for authentication; null if the caller should use default
364371
* authentication strategies.
365372
*/
366-
public Local getIdentityFile() {
373+
public String getIdentityFile() {
367374
return identityFile;
368375
}
369376

370377
/**
371378
* @return Specifies the UNIX-domain socket used to communicate with the authentication agent.
372379
*/
373-
public Local getIdentityAgent() {
380+
public String getIdentityAgent() {
374381
return identityAgent;
375382
}
376383

0 commit comments

Comments
 (0)