You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

OpenSshConfigTest.java 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520
  1. /*
  2. * Copyright (C) 2008, 2017 Google Inc. and others
  3. *
  4. * This program and the accompanying materials are made available under the
  5. * terms of the Eclipse Distribution License v. 1.0 which is available at
  6. * https://www.eclipse.org/org/documents/edl-v10.php.
  7. *
  8. * SPDX-License-Identifier: BSD-3-Clause
  9. */
  10. //TODO(ms): move to org.eclipse.jgit.ssh.jsch in 6.0
  11. package org.eclipse.jgit.transport;
  12. import static java.nio.charset.StandardCharsets.UTF_8;
  13. import static org.junit.Assert.assertArrayEquals;
  14. import static org.junit.Assert.assertEquals;
  15. import static org.junit.Assert.assertFalse;
  16. import static org.junit.Assert.assertNotNull;
  17. import static org.junit.Assert.assertNotSame;
  18. import static org.junit.Assert.assertNull;
  19. import static org.junit.Assert.assertTrue;
  20. import java.io.File;
  21. import java.io.FileOutputStream;
  22. import java.io.IOException;
  23. import java.io.OutputStreamWriter;
  24. import java.time.Instant;
  25. import java.util.concurrent.TimeUnit;
  26. import org.eclipse.jgit.junit.RepositoryTestCase;
  27. import org.eclipse.jgit.lib.Constants;
  28. import org.eclipse.jgit.transport.OpenSshConfig.Host;
  29. import org.eclipse.jgit.util.FS;
  30. import org.eclipse.jgit.util.FileUtils;
  31. import org.eclipse.jgit.util.SystemReader;
  32. import org.junit.Before;
  33. import org.junit.Test;
  34. import com.jcraft.jsch.ConfigRepository;
  35. import com.jcraft.jsch.ConfigRepository.Config;
  36. public class OpenSshConfigTest extends RepositoryTestCase {
  37. private File home;
  38. private File configFile;
  39. private OpenSshConfig osc;
  40. @Override
  41. @Before
  42. public void setUp() throws Exception {
  43. super.setUp();
  44. home = new File(trash, "home");
  45. FileUtils.mkdir(home);
  46. configFile = new File(new File(home, ".ssh"), Constants.CONFIG);
  47. FileUtils.mkdir(configFile.getParentFile());
  48. mockSystemReader.setProperty(Constants.OS_USER_NAME_KEY, "jex_junit");
  49. mockSystemReader.setProperty("TST_VAR", "TEST");
  50. osc = new OpenSshConfig(home, configFile);
  51. }
  52. private void config(String data) throws IOException {
  53. FS fs = FS.DETECTED;
  54. long resolution = FS.getFileStoreAttributes(configFile.toPath())
  55. .getFsTimestampResolution().toNanos();
  56. Instant lastMtime = fs.lastModifiedInstant(configFile);
  57. do {
  58. try (final OutputStreamWriter fw = new OutputStreamWriter(
  59. new FileOutputStream(configFile), UTF_8)) {
  60. fw.write(data);
  61. TimeUnit.NANOSECONDS.sleep(resolution);
  62. } catch (InterruptedException e) {
  63. Thread.interrupted();
  64. }
  65. } while (lastMtime.equals(fs.lastModifiedInstant(configFile)));
  66. }
  67. @Test
  68. public void testNoConfig() {
  69. final Host h = osc.lookup("repo.or.cz");
  70. assertNotNull(h);
  71. assertEquals("repo.or.cz", h.getHostName());
  72. assertEquals("jex_junit", h.getUser());
  73. assertEquals(22, h.getPort());
  74. assertEquals(1, h.getConnectionAttempts());
  75. assertNull(h.getIdentityFile());
  76. }
  77. @Test
  78. public void testSeparatorParsing() throws Exception {
  79. config("Host\tfirst\n" +
  80. "\tHostName\tfirst.tld\n" +
  81. "\n" +
  82. "Host second\n" +
  83. " HostName\tsecond.tld\n" +
  84. "Host=third\n" +
  85. "HostName=third.tld\n\n\n" +
  86. "\t Host = fourth\n\n\n" +
  87. " \t HostName\t=fourth.tld\n" +
  88. "Host\t = last\n" +
  89. "HostName \t last.tld");
  90. assertNotNull(osc.lookup("first"));
  91. assertEquals("first.tld", osc.lookup("first").getHostName());
  92. assertNotNull(osc.lookup("second"));
  93. assertEquals("second.tld", osc.lookup("second").getHostName());
  94. assertNotNull(osc.lookup("third"));
  95. assertEquals("third.tld", osc.lookup("third").getHostName());
  96. assertNotNull(osc.lookup("fourth"));
  97. assertEquals("fourth.tld", osc.lookup("fourth").getHostName());
  98. assertNotNull(osc.lookup("last"));
  99. assertEquals("last.tld", osc.lookup("last").getHostName());
  100. }
  101. @Test
  102. public void testQuoteParsing() throws Exception {
  103. config("Host \"good\"\n" +
  104. " HostName=\"good.tld\"\n" +
  105. " Port=\"6007\"\n" +
  106. " User=\"gooduser\"\n" +
  107. "Host multiple unquoted and \"quoted\" \"hosts\"\n" +
  108. " Port=\"2222\"\n" +
  109. "Host \"spaced\"\n" +
  110. "# Bad host name, but testing preservation of spaces\n" +
  111. " HostName=\" spaced\ttld \"\n" +
  112. "# Misbalanced quotes\n" +
  113. "Host \"bad\"\n" +
  114. "# OpenSSH doesn't allow this but ...\n" +
  115. " HostName=bad.tld\"\n");
  116. assertEquals("good.tld", osc.lookup("good").getHostName());
  117. assertEquals("gooduser", osc.lookup("good").getUser());
  118. assertEquals(6007, osc.lookup("good").getPort());
  119. assertEquals(2222, osc.lookup("multiple").getPort());
  120. assertEquals(2222, osc.lookup("quoted").getPort());
  121. assertEquals(2222, osc.lookup("and").getPort());
  122. assertEquals(2222, osc.lookup("unquoted").getPort());
  123. assertEquals(2222, osc.lookup("hosts").getPort());
  124. assertEquals(" spaced\ttld ", osc.lookup("spaced").getHostName());
  125. assertEquals("bad.tld\"", osc.lookup("bad").getHostName());
  126. }
  127. @Test
  128. public void testCaseInsensitiveKeyLookup() throws Exception {
  129. config("Host orcz\n" + "Port 29418\n"
  130. + "\tHostName repo.or.cz\nStrictHostKeyChecking yes\n");
  131. final Host h = osc.lookup("orcz");
  132. Config c = h.getConfig();
  133. String exactCase = c.getValue("StrictHostKeyChecking");
  134. assertEquals("yes", exactCase);
  135. assertEquals(exactCase, c.getValue("stricthostkeychecking"));
  136. assertEquals(exactCase, c.getValue("STRICTHOSTKEYCHECKING"));
  137. assertEquals(exactCase, c.getValue("sTrIcThostKEYcheckING"));
  138. assertNull(c.getValue("sTrIcThostKEYcheckIN"));
  139. }
  140. @Test
  141. public void testAlias_DoesNotMatch() throws Exception {
  142. config("Host orcz\n" + "Port 29418\n" + "\tHostName repo.or.cz\n");
  143. final Host h = osc.lookup("repo.or.cz");
  144. assertNotNull(h);
  145. assertEquals("repo.or.cz", h.getHostName());
  146. assertEquals("jex_junit", h.getUser());
  147. assertEquals(22, h.getPort());
  148. assertNull(h.getIdentityFile());
  149. final Host h2 = osc.lookup("orcz");
  150. assertEquals("repo.or.cz", h.getHostName());
  151. assertEquals("jex_junit", h.getUser());
  152. assertEquals(29418, h2.getPort());
  153. assertNull(h.getIdentityFile());
  154. }
  155. @Test
  156. public void testAlias_OptionsSet() throws Exception {
  157. config("Host orcz\n" + "\tHostName repo.or.cz\n" + "\tPort 2222\n"
  158. + "\tUser jex\n" + "\tIdentityFile .ssh/id_jex\n"
  159. + "\tForwardX11 no\n");
  160. final Host h = osc.lookup("orcz");
  161. assertNotNull(h);
  162. assertEquals("repo.or.cz", h.getHostName());
  163. assertEquals("jex", h.getUser());
  164. assertEquals(2222, h.getPort());
  165. assertEquals(new File(home, ".ssh/id_jex"), h.getIdentityFile());
  166. }
  167. @Test
  168. public void testAlias_OptionsKeywordCaseInsensitive() throws Exception {
  169. config("hOsT orcz\n" + "\thOsTnAmE repo.or.cz\n" + "\tPORT 2222\n"
  170. + "\tuser jex\n" + "\tidentityfile .ssh/id_jex\n"
  171. + "\tForwardX11 no\n");
  172. final Host h = osc.lookup("orcz");
  173. assertNotNull(h);
  174. assertEquals("repo.or.cz", h.getHostName());
  175. assertEquals("jex", h.getUser());
  176. assertEquals(2222, h.getPort());
  177. assertEquals(new File(home, ".ssh/id_jex"), h.getIdentityFile());
  178. }
  179. @Test
  180. public void testAlias_OptionsInherit() throws Exception {
  181. config("Host orcz\n" + "\tHostName repo.or.cz\n" + "\n" + "Host *\n"
  182. + "\tHostName not.a.host.example.com\n" + "\tPort 2222\n"
  183. + "\tUser jex\n" + "\tIdentityFile .ssh/id_jex\n"
  184. + "\tForwardX11 no\n");
  185. final Host h = osc.lookup("orcz");
  186. assertNotNull(h);
  187. assertEquals("repo.or.cz", h.getHostName());
  188. assertEquals("jex", h.getUser());
  189. assertEquals(2222, h.getPort());
  190. assertEquals(new File(home, ".ssh/id_jex"), h.getIdentityFile());
  191. }
  192. @Test
  193. public void testAlias_PreferredAuthenticationsDefault() throws Exception {
  194. final Host h = osc.lookup("orcz");
  195. assertNotNull(h);
  196. assertNull(h.getPreferredAuthentications());
  197. }
  198. @Test
  199. public void testAlias_PreferredAuthentications() throws Exception {
  200. config("Host orcz\n" + "\tPreferredAuthentications publickey\n");
  201. final Host h = osc.lookup("orcz");
  202. assertNotNull(h);
  203. assertEquals("publickey", h.getPreferredAuthentications());
  204. }
  205. @Test
  206. public void testAlias_InheritPreferredAuthentications() throws Exception {
  207. config("Host orcz\n" + "\tHostName repo.or.cz\n" + "\n" + "Host *\n"
  208. + "\tPreferredAuthentications publickey, hostbased\n");
  209. final Host h = osc.lookup("orcz");
  210. assertNotNull(h);
  211. assertEquals("publickey,hostbased", h.getPreferredAuthentications());
  212. }
  213. @Test
  214. public void testAlias_BatchModeDefault() throws Exception {
  215. final Host h = osc.lookup("orcz");
  216. assertNotNull(h);
  217. assertFalse(h.isBatchMode());
  218. }
  219. @Test
  220. public void testAlias_BatchModeYes() throws Exception {
  221. config("Host orcz\n" + "\tBatchMode yes\n");
  222. final Host h = osc.lookup("orcz");
  223. assertNotNull(h);
  224. assertTrue(h.isBatchMode());
  225. }
  226. @Test
  227. public void testAlias_InheritBatchMode() throws Exception {
  228. config("Host orcz\n" + "\tHostName repo.or.cz\n" + "\n" + "Host *\n"
  229. + "\tBatchMode yes\n");
  230. final Host h = osc.lookup("orcz");
  231. assertNotNull(h);
  232. assertTrue(h.isBatchMode());
  233. }
  234. @Test
  235. public void testAlias_ConnectionAttemptsDefault() throws Exception {
  236. final Host h = osc.lookup("orcz");
  237. assertNotNull(h);
  238. assertEquals(1, h.getConnectionAttempts());
  239. }
  240. @Test
  241. public void testAlias_ConnectionAttempts() throws Exception {
  242. config("Host orcz\n" + "\tConnectionAttempts 5\n");
  243. final Host h = osc.lookup("orcz");
  244. assertNotNull(h);
  245. assertEquals(5, h.getConnectionAttempts());
  246. }
  247. @Test
  248. public void testAlias_invalidConnectionAttempts() throws Exception {
  249. config("Host orcz\n" + "\tConnectionAttempts -1\n");
  250. final Host h = osc.lookup("orcz");
  251. assertNotNull(h);
  252. assertEquals(1, h.getConnectionAttempts());
  253. }
  254. @Test
  255. public void testAlias_badConnectionAttempts() throws Exception {
  256. config("Host orcz\n" + "\tConnectionAttempts xxx\n");
  257. final Host h = osc.lookup("orcz");
  258. assertNotNull(h);
  259. assertEquals(1, h.getConnectionAttempts());
  260. }
  261. @Test
  262. public void testDefaultBlock() throws Exception {
  263. config("ConnectionAttempts 5\n\nHost orcz\nConnectionAttempts 3\n");
  264. final Host h = osc.lookup("orcz");
  265. assertNotNull(h);
  266. assertEquals(5, h.getConnectionAttempts());
  267. }
  268. @Test
  269. public void testHostCaseInsensitive() throws Exception {
  270. config("hOsT orcz\nConnectionAttempts 3\n");
  271. final Host h = osc.lookup("orcz");
  272. assertNotNull(h);
  273. assertEquals(3, h.getConnectionAttempts());
  274. }
  275. @Test
  276. public void testListValueSingle() throws Exception {
  277. config("Host orcz\nUserKnownHostsFile /foo/bar\n");
  278. final ConfigRepository.Config c = osc.getConfig("orcz");
  279. assertNotNull(c);
  280. assertEquals("/foo/bar", c.getValue("UserKnownHostsFile"));
  281. }
  282. @Test
  283. public void testListValueMultiple() throws Exception {
  284. // Tilde expansion occurs within the parser
  285. config("Host orcz\nUserKnownHostsFile \"~/foo/ba z\" /foo/bar \n");
  286. final ConfigRepository.Config c = osc.getConfig("orcz");
  287. assertNotNull(c);
  288. assertArrayEquals(new Object[] { new File(home, "foo/ba z").getPath(),
  289. "/foo/bar" },
  290. c.getValues("UserKnownHostsFile"));
  291. }
  292. @Test
  293. public void testRepeatedLookupsWithModification() throws Exception {
  294. config("Host orcz\n" + "\tConnectionAttempts -1\n");
  295. final Host h1 = osc.lookup("orcz");
  296. assertNotNull(h1);
  297. assertEquals(1, h1.getConnectionAttempts());
  298. config("Host orcz\n" + "\tConnectionAttempts 5\n");
  299. final Host h2 = osc.lookup("orcz");
  300. assertNotNull(h2);
  301. assertNotSame(h1, h2);
  302. assertEquals(5, h2.getConnectionAttempts());
  303. assertEquals(1, h1.getConnectionAttempts());
  304. assertNotSame(h1.getConfig(), h2.getConfig());
  305. }
  306. @Test
  307. public void testIdentityFile() throws Exception {
  308. config("Host orcz\nIdentityFile \"~/foo/ba z\"\nIdentityFile /foo/bar");
  309. final Host h = osc.lookup("orcz");
  310. assertNotNull(h);
  311. File f = h.getIdentityFile();
  312. assertNotNull(f);
  313. // Host does tilde replacement
  314. assertEquals(new File(home, "foo/ba z"), f);
  315. final ConfigRepository.Config c = h.getConfig();
  316. // Config does tilde replacement, too
  317. assertArrayEquals(new Object[] { new File(home, "foo/ba z").getPath(),
  318. "/foo/bar" },
  319. c.getValues("IdentityFile"));
  320. }
  321. @Test
  322. public void testMultiIdentityFile() throws Exception {
  323. config("IdentityFile \"~/foo/ba z\"\nHost orcz\nIdentityFile /foo/bar\nHOST *\nIdentityFile /foo/baz");
  324. final Host h = osc.lookup("orcz");
  325. assertNotNull(h);
  326. File f = h.getIdentityFile();
  327. assertNotNull(f);
  328. // Host does tilde replacement
  329. assertEquals(new File(home, "foo/ba z"), f);
  330. final ConfigRepository.Config c = h.getConfig();
  331. // Config does tilde replacement, too
  332. assertArrayEquals(new Object[] { new File(home, "foo/ba z").getPath(),
  333. "/foo/bar", "/foo/baz" },
  334. c.getValues("IdentityFile"));
  335. }
  336. @Test
  337. public void testNegatedPattern() throws Exception {
  338. config("Host repo.or.cz\nIdentityFile ~/foo/bar\nHOST !*.or.cz\nIdentityFile /foo/baz");
  339. final Host h = osc.lookup("repo.or.cz");
  340. assertNotNull(h);
  341. assertEquals(new File(home, "foo/bar"), h.getIdentityFile());
  342. assertArrayEquals(new Object[] { new File(home, "foo/bar").getPath() },
  343. h.getConfig().getValues("IdentityFile"));
  344. }
  345. @Test
  346. public void testPattern() throws Exception {
  347. config("Host repo.or.cz\nIdentityFile ~/foo/bar\nHOST *.or.cz\nIdentityFile /foo/baz");
  348. final Host h = osc.lookup("repo.or.cz");
  349. assertNotNull(h);
  350. assertEquals(new File(home, "foo/bar"), h.getIdentityFile());
  351. assertArrayEquals(new Object[] { new File(home, "foo/bar").getPath(),
  352. "/foo/baz" },
  353. h.getConfig().getValues("IdentityFile"));
  354. }
  355. @Test
  356. public void testMultiHost() throws Exception {
  357. config("Host orcz *.or.cz\nIdentityFile ~/foo/bar\nHOST *.or.cz\nIdentityFile /foo/baz");
  358. final Host h1 = osc.lookup("repo.or.cz");
  359. assertNotNull(h1);
  360. assertEquals(new File(home, "foo/bar"), h1.getIdentityFile());
  361. assertArrayEquals(new Object[] { new File(home, "foo/bar").getPath(),
  362. "/foo/baz" },
  363. h1.getConfig().getValues("IdentityFile"));
  364. final Host h2 = osc.lookup("orcz");
  365. assertNotNull(h2);
  366. assertEquals(new File(home, "foo/bar"), h2.getIdentityFile());
  367. assertArrayEquals(new Object[] { new File(home, "foo/bar").getPath() },
  368. h2.getConfig().getValues("IdentityFile"));
  369. }
  370. @Test
  371. public void testEqualsSign() throws Exception {
  372. config("Host=orcz\n\tConnectionAttempts = 5\n\tUser=\t foobar\t\n");
  373. final Host h = osc.lookup("orcz");
  374. assertNotNull(h);
  375. assertEquals(5, h.getConnectionAttempts());
  376. assertEquals("foobar", h.getUser());
  377. }
  378. @Test
  379. public void testMissingArgument() throws Exception {
  380. config("Host=orcz\n\tSendEnv\nIdentityFile\t\nForwardX11\n\tUser=\t foobar\t\n");
  381. final Host h = osc.lookup("orcz");
  382. assertNotNull(h);
  383. assertEquals("foobar", h.getUser());
  384. assertArrayEquals(new String[0], h.getConfig().getValues("SendEnv"));
  385. assertNull(h.getIdentityFile());
  386. assertNull(h.getConfig().getValue("ForwardX11"));
  387. }
  388. @Test
  389. public void testHomeDirUserReplacement() throws Exception {
  390. config("Host=orcz\n\tIdentityFile %d/.ssh/%u_id_dsa");
  391. final Host h = osc.lookup("orcz");
  392. assertNotNull(h);
  393. assertEquals(new File(new File(home, ".ssh"), "jex_junit_id_dsa"),
  394. h.getIdentityFile());
  395. }
  396. @Test
  397. public void testHostnameReplacement() throws Exception {
  398. config("Host=orcz\nHost *.*\n\tHostname %h\nHost *\n\tHostname %h.example.org");
  399. final Host h = osc.lookup("orcz");
  400. assertNotNull(h);
  401. assertEquals("orcz.example.org", h.getHostName());
  402. }
  403. @Test
  404. public void testRemoteUserReplacement() throws Exception {
  405. config("Host=orcz\n\tUser foo\n" + "Host *.*\n\tHostname %h\n"
  406. + "Host *\n\tHostname %h.ex%%20ample.org\n\tIdentityFile ~/.ssh/%h_%r_id_dsa");
  407. final Host h = osc.lookup("orcz");
  408. assertNotNull(h);
  409. assertEquals(
  410. new File(new File(home, ".ssh"),
  411. "orcz.ex%20ample.org_foo_id_dsa"),
  412. h.getIdentityFile());
  413. }
  414. @Test
  415. public void testLocalhostFQDNReplacement() throws Exception {
  416. String localhost = SystemReader.getInstance().getHostname();
  417. config("Host=orcz\n\tIdentityFile ~/.ssh/%l_id_dsa");
  418. final Host h = osc.lookup("orcz");
  419. assertNotNull(h);
  420. assertEquals(
  421. new File(new File(home, ".ssh"), localhost + "_id_dsa"),
  422. h.getIdentityFile());
  423. }
  424. @Test
  425. public void testPubKeyAcceptedAlgorithms() throws Exception {
  426. config("Host=orcz\n\tPubkeyAcceptedAlgorithms ^ssh-rsa");
  427. Host h = osc.lookup("orcz");
  428. Config c = h.getConfig();
  429. assertEquals("^ssh-rsa",
  430. c.getValue(SshConstants.PUBKEY_ACCEPTED_ALGORITHMS));
  431. assertEquals("^ssh-rsa", c.getValue("PubkeyAcceptedKeyTypes"));
  432. }
  433. @Test
  434. public void testPubKeyAcceptedKeyTypes() throws Exception {
  435. config("Host=orcz\n\tPubkeyAcceptedKeyTypes ^ssh-rsa");
  436. Host h = osc.lookup("orcz");
  437. Config c = h.getConfig();
  438. assertEquals("^ssh-rsa",
  439. c.getValue(SshConstants.PUBKEY_ACCEPTED_ALGORITHMS));
  440. assertEquals("^ssh-rsa", c.getValue("PubkeyAcceptedKeyTypes"));
  441. }
  442. @Test
  443. public void testEolComments() throws Exception {
  444. config("#Comment\nHost=orcz #Comment\n\tPubkeyAcceptedAlgorithms ^ssh-rsa # Comment\n#Comment");
  445. Host h = osc.lookup("orcz");
  446. assertNotNull(h);
  447. Config c = h.getConfig();
  448. assertEquals("^ssh-rsa",
  449. c.getValue(SshConstants.PUBKEY_ACCEPTED_ALGORITHMS));
  450. }
  451. @Test
  452. public void testEnVarSubstitution() throws Exception {
  453. config("Host orcz\nIdentityFile /tmp/${TST_VAR}\n"
  454. + "CertificateFile /tmp/${}/foo\nUser ${TST_VAR}\nIdentityAgent /tmp/${TST_VAR/bar");
  455. Host h = osc.lookup("orcz");
  456. assertNotNull(h);
  457. Config c = h.getConfig();
  458. assertEquals("/tmp/TEST",
  459. c.getValue(SshConstants.IDENTITY_FILE));
  460. // No variable name
  461. assertEquals("/tmp/${}/foo", c.getValue(SshConstants.CERTIFICATE_FILE));
  462. // User doesn't get env var substitution:
  463. assertEquals("${TST_VAR}", c.getValue(SshConstants.USER));
  464. assertEquals("${TST_VAR}", h.getUser());
  465. // Unterminated:
  466. assertEquals("/tmp/${TST_VAR/bar",
  467. c.getValue(SshConstants.IDENTITY_AGENT));
  468. }
  469. }