mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-07 15:50:57 +03:00
Merge pull request #196 from Boris-de/fix_hostname_matching
bugfix: match complete host instead of contains on the hoststring
This commit is contained in:
@@ -352,7 +352,7 @@ public class OpenSSHKnownHosts
|
|||||||
@Override
|
@Override
|
||||||
public boolean appliesTo(KeyType type, String host)
|
public boolean appliesTo(KeyType type, String host)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
return type == this.type && hostnames.contains(host);
|
return type == this.type && hosts.contains(host);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import java.security.PublicKey;
|
|||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.equalTo;
|
import static org.hamcrest.CoreMatchers.equalTo;
|
||||||
import static org.hamcrest.CoreMatchers.instanceOf;
|
import static org.hamcrest.CoreMatchers.instanceOf;
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
@@ -78,6 +79,7 @@ public class OpenSSHKnownHostsTest {
|
|||||||
|
|
||||||
assertTrue(kh.verify("schmizz.net", 22, key));
|
assertTrue(kh.verify("schmizz.net", 22, key));
|
||||||
assertTrue(kh.verify("69.163.155.180", 22, key));
|
assertTrue(kh.verify("69.163.155.180", 22, key));
|
||||||
|
assertFalse(kh.verify("69.163.155.18", 22, key));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user