mirror of
git://git.proxmox.com/git/pve-apiclient.git
synced 2024-12-22 17:34:22 +03:00
raise exception if manual fingerprint verification failed
If a fingerprint could not be verified automatically or manually raise an exception to ensure that we do not continue with handling the problematic or even evil response. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
097484f42d
commit
8153e67107
@ -139,8 +139,7 @@ sub manual_verify_fingerprint {
|
|||||||
my ($self, $fingerprint) = @_;
|
my ($self, $fingerprint) = @_;
|
||||||
|
|
||||||
if (!$self->{manual_verification}) {
|
if (!$self->{manual_verification}) {
|
||||||
warn "fingerprint: $fingerprint\n";
|
raise("fingerprint '$fingerprint' not verified, abort!\n");
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print "The authenticity of host '$self->{host}' can't be established.\n" .
|
print "The authenticity of host '$self->{host}' can't be established.\n" .
|
||||||
@ -153,6 +152,8 @@ sub manual_verify_fingerprint {
|
|||||||
|
|
||||||
$self->{cached_fingerprints}->{$fingerprint} = $valid;
|
$self->{cached_fingerprints}->{$fingerprint} = $valid;
|
||||||
|
|
||||||
|
raise("Fingerprint not verified, abort!\n") if !$valid;
|
||||||
|
|
||||||
if (my $cb = $self->{register_fingerprint_cb}) {
|
if (my $cb = $self->{register_fingerprint_cb}) {
|
||||||
$cb->($fingerprint) if $valid;
|
$cb->($fingerprint) if $valid;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user