Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update JSCH to 0.2.20 #639

Closed
wants to merge 10 commits into from
2 changes: 1 addition & 1 deletion src/main/java/com/jcraft/jsch/AgentIdentityRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public AgentIdentityRepository(AgentConnector connector) {
}

@Override
public Vector<Identity> getIdentities() {
public Vector<?> getIdentities() {
return agent.getIdentities();
}

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/jcraft/jsch/ChannelAgentForwarding.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ void write(byte[] foo, int s, int l) throws IOException {

if (typ == SSH2_AGENTC_REQUEST_IDENTITIES) {
mbuf.putByte(SSH2_AGENT_IDENTITIES_ANSWER);
@SuppressWarnings("unchecked")
Vector<Identity> identities = irepo.getIdentities();
synchronized (identities) {
int count = 0;
Expand Down Expand Up @@ -157,6 +158,7 @@ void write(byte[] foo, int s, int l) throws IOException {
// datafellows = SSH_BUG_SIGBLOB;
// }

@SuppressWarnings("unchecked")
Vector<Identity> identities = irepo.getIdentities();
Identity identity = null;
synchronized (identities) {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/jcraft/jsch/IdentityRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public interface IdentityRepository {

public int getStatus();

public Vector<Identity> getIdentities();
@SuppressWarnings("rawtypes")
public Vector getIdentities();

public boolean add(byte[] identity);

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/jcraft/jsch/IdentityRepositoryWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ public void removeAll() {
}

@Override
public Vector<Identity> getIdentities() {
Vector<Identity> result = new Vector<>();
public Vector<?> getIdentities() {
Vector<Object> result = new Vector<>();
for (int i = 0; i < cache.size(); i++) {
Identity identity = cache.elementAt(i);
result.add(identity);
}
Vector<Identity> tmp = ir.getIdentities();
Vector<?> tmp = ir.getIdentities();
for (int i = 0; i < tmp.size(); i++) {
result.add(tmp.elementAt(i));
}
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/com/jcraft/jsch/JSch.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class JSch {
config.put("kex", Util.getSystemProperty("jsch.kex",
"curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256"));
config.put("server_host_key", Util.getSystemProperty("jsch.server_host_key",
"ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256"));
"ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256,ssh-rsa"));
config.put("prefer_known_host_key_types",
Util.getSystemProperty("jsch.prefer_known_host_key_types", "yes"));
config.put("enable_strict_kex", Util.getSystemProperty("jsch.enable_strict_kex", "yes"));
Expand Down Expand Up @@ -230,7 +230,7 @@ public class JSch {
config.put("PreferredAuthentications", Util.getSystemProperty("jsch.preferred_authentications",
"gssapi-with-mic,publickey,keyboard-interactive,password"));
config.put("PubkeyAcceptedAlgorithms", Util.getSystemProperty("jsch.client_pubkey",
"ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256"));
"ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256,ssh-rsa"));
config.put("enable_pubkey_auth_query",
Util.getSystemProperty("jsch.enable_pubkey_auth_query", "yes"));
config.put("try_additional_pubkey_algorithms",
Expand Down Expand Up @@ -541,6 +541,7 @@ public void addIdentity(Identity identity, byte[] passphrase) throws JSchExcepti
*/
@Deprecated
public void removeIdentity(String name) throws JSchException {
@SuppressWarnings("unchecked")
Vector<Identity> identities = identityRepository.getIdentities();
for (int i = 0; i < identities.size(); i++) {
Identity identity = identities.elementAt(i);
Expand Down Expand Up @@ -571,6 +572,7 @@ public void removeIdentity(Identity identity) throws JSchException {
*/
public Vector<String> getIdentityNames() throws JSchException {
Vector<String> foo = new Vector<>();
@SuppressWarnings("unchecked")
Vector<Identity> identities = identityRepository.getIdentities();
for (int i = 0; i < identities.size(); i++) {
Identity identity = identities.elementAt(i);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/jcraft/jsch/LocalIdentityRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public int getStatus() {
}

@Override
public synchronized Vector<Identity> getIdentities() {
public synchronized Vector<?> getIdentities() {
removeDupulicates();
Vector<Identity> v = new Vector<>();
for (int i = 0; i < identities.size(); i++) {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/jcraft/jsch/UserAuthPublicKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class UserAuthPublicKey extends UserAuth {
public boolean start(Session session) throws Exception {
super.start(session);

@SuppressWarnings("unchecked")
Vector<Identity> identities = session.getIdentityRepository().getIdentities();

synchronized (identities) {
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/jcraft/jsch/KeyPair2Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ void loadKey(String path, String password, String keyType)
jSch.addIdentity(prvkey);
}
});
assertEquals(keyType, jSch.getIdentityRepository().getIdentities().get(0).getAlgName());
assertEquals(keyType, ((Identity) jSch.getIdentityRepository().getIdentities().get(0)).getAlgName());
}
}
2 changes: 1 addition & 1 deletion src/test/java/com/jcraft/jsch/KeyPairTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void loadKey(String path, String password, String keyType)
jSch.addIdentity(prvkey);
}
});
assertEquals(keyType, jSch.getIdentityRepository().getIdentities().get(0).getAlgName());
assertEquals(keyType, ((Identity) jSch.getIdentityRepository().getIdentities().get(0)).getAlgName());
}

@Test
Expand Down
Loading