Skip to content

Commit 5adde38

Browse files
committed
Revert "Pass hostkey & port to host verify callback"
This reverts commit f68b40c.
1 parent 8a871d1 commit 5adde38

File tree

1 file changed

+3
-11
lines changed
  • src/libgit2/transports

1 file changed

+3
-11
lines changed

src/libgit2/transports/ssh.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -651,8 +651,6 @@ static int check_against_known_hosts(
651651
return ret;
652652
}
653653

654-
#define SSH_DEFAULT_PORT 22
655-
656654
/*
657655
* Perform the check for the session's certificate against known hosts if
658656
* possible and then ask the user if they have a callback.
@@ -750,29 +748,23 @@ static int check_certificate(
750748
if (check_cb != NULL) {
751749
git_cert_hostkey *cert_ptr = &cert;
752750
git_error_state previous_error = {0};
753-
const char *host_ptr = host;
754-
git_str host_and_port = GIT_STR_INIT;
755-
756-
if (port != SSH_DEFAULT_PORT) {
757-
git_str_printf(&host_and_port, "%s:%d", host, port);
758-
host_ptr = host_and_port.ptr;
759-
}
760751

761752
git_error_state_capture(&previous_error, error);
762-
error = check_cb((git_cert *) cert_ptr, cert_valid, host_ptr, check_cb_payload);
753+
error = check_cb((git_cert *) cert_ptr, cert_valid, host, check_cb_payload);
763754
if (error == GIT_PASSTHROUGH) {
764755
error = git_error_state_restore(&previous_error);
765756
} else if (error < 0 && !git_error_last()) {
766757
git_error_set(GIT_ERROR_NET, "unknown remote host key");
767758
}
768759

769760
git_error_state_free(&previous_error);
770-
git_str_dispose(&host_and_port);
771761
}
772762

773763
return error;
774764
}
775765

766+
#define SSH_DEFAULT_PORT "22"
767+
776768
static int _git_ssh_setup_conn(
777769
ssh_subtransport *t,
778770
const char *url,

0 commit comments

Comments
 (0)