@@ -905,7 +905,7 @@ public void onClick(DialogInterface dialog, int whichButton) {
905905 public void onRequestSshFingerprintMismatchDecision (String host , int port , byte [] fingerprint , AtomicBoolean doContinue ) {
906906 // this method is probably called from the vnc thread
907907 post (() -> {
908- SshKnownHost maybeFound = VncDatabase .getInstance (getContext ()).getSshKnownHostDao ().get (host + ":" + port );
908+ SshKnownHost maybeFound = VncDatabase .getInstance (getContext ()).getSshKnownHostDao ().get (Utils . uriFormatHostWithPort ( host , port ) );
909909 if (maybeFound == null ) { // fallback for saves without port
910910 maybeFound = VncDatabase .getInstance (getContext ()).getSshKnownHostDao ().get (host );
911911 }
@@ -919,7 +919,7 @@ public void onRequestSshFingerprintMismatchDecision(String host, int port, byte[
919919 "SHA256:" + Base64 .encodeToString (fingerprint ,Base64 .NO_PADDING |Base64 .NO_WRAP ))))
920920 .setCancelable (false )
921921 .setPositiveButton (R .string .ssh_key_new_continue , (dialog12 , whichButton ) -> {
922- VncDatabase .getInstance (getContext ()).getSshKnownHostDao ().insert (new SshKnownHost (0 , host + ":" + port , fingerprint ));
922+ VncDatabase .getInstance (getContext ()).getSshKnownHostDao ().insert (new SshKnownHost (0 , Utils . uriFormatHostWithPort ( host , port ) , fingerprint ));
923923 doContinue .set (true );
924924 synchronized (vncConn ) {
925925 vncConn .notify ();
@@ -944,7 +944,7 @@ public void onRequestSshFingerprintMismatchDecision(String host, int port, byte[
944944 "SHA256:" + Base64 .encodeToString (fingerprint ,Base64 .NO_PADDING |Base64 .NO_WRAP ))))
945945 .setCancelable (false )
946946 .setPositiveButton (R .string .ssh_key_mismatch_continue , (dialog12 , whichButton ) -> {
947- SshKnownHost updatedHost = new SshKnownHost (knownHost .id , host + ":" + port , fingerprint );
947+ SshKnownHost updatedHost = new SshKnownHost (knownHost .id , Utils . uriFormatHostWithPort ( host , port ) , fingerprint );
948948 VncDatabase .getInstance (getContext ()).getSshKnownHostDao ().update (updatedHost );
949949 doContinue .set (true );
950950 synchronized (vncConn ) {
@@ -969,7 +969,7 @@ public void onRequestSshFingerprintMismatchDecision(String host, int port, byte[
969969 public void onRequestX509FingerprintMismatchDecision (String subject , String validFrom , String validUntil , byte [] fingerprint , final AtomicBoolean decision ) {
970970 // this method is probably called from the vnc thread
971971 post (() -> {
972- X509KnownHost knownHost = VncDatabase .getInstance (getContext ()).getX509KnownHostDao ().get (vncConn .getConnSettings ().address + ":" + vncConn .getConnSettings ().port );
972+ X509KnownHost knownHost = VncDatabase .getInstance (getContext ()).getX509KnownHostDao ().get (Utils . uriFormatHostWithPort ( vncConn .getConnSettings ().address , vncConn .getConnSettings ().port ) );
973973 if (knownHost == null ) {
974974 // no fingerprint expected
975975 AlertDialog dialog = new AlertDialog .Builder (getContext ())
@@ -981,7 +981,7 @@ public void onRequestX509FingerprintMismatchDecision(String subject, String vali
981981 Utils .byteArrayToColonSeparatedHex (fingerprint ))))
982982 .setCancelable (false )
983983 .setPositiveButton (R .string .x509_key_new_continue , (dialog12 , whichButton ) -> {
984- VncDatabase .getInstance (getContext ()).getX509KnownHostDao ().insert (new X509KnownHost (0 , vncConn .getConnSettings ().address + ":" + vncConn .getConnSettings ().port , fingerprint ));
984+ VncDatabase .getInstance (getContext ()).getX509KnownHostDao ().insert (new X509KnownHost (0 , Utils . uriFormatHostWithPort ( vncConn .getConnSettings ().address , vncConn .getConnSettings ().port ) , fingerprint ));
985985 decision .set (true );
986986 synchronized (vncConn ) {
987987 vncConn .notify ();
@@ -1010,7 +1010,7 @@ public void onRequestX509FingerprintMismatchDecision(String subject, String vali
10101010 .setCancelable (false )
10111011 .setPositiveButton (R .string .x509_key_mismatch_continue , (dialog12 , whichButton ) -> {
10121012 // update/insert fingerprint of known host
1013- X509KnownHost updatedHost = new X509KnownHost (knownHost .id , vncConn .getConnSettings ().address + ":" + vncConn .getConnSettings ().port , fingerprint );
1013+ X509KnownHost updatedHost = new X509KnownHost (knownHost .id , Utils . uriFormatHostWithPort ( vncConn .getConnSettings ().address , vncConn .getConnSettings ().port ) , fingerprint );
10141014 VncDatabase .getInstance (getContext ()).getX509KnownHostDao ().update (updatedHost );
10151015 decision .set (true );
10161016 synchronized (vncConn ) {
0 commit comments