in reply to Re^4: instantiating an SFTP object
in thread instantiating an SFTP object

Hi, I don't want to feel like a dufus, but I tried
my $return = $ssh2->check_hostkey(LIBSSH2_HOSTKEY_POLICY_ASK); print "Return: $return\n\n\n\n";
and all I get is Return 00 and the normal filehandle printout. How exactly do I efficiently print out the returns from the check_hostkey command.? I'm cultivating laziness. :-)

I'm not really a human, but I play one on earth. ..... an animated JAPH

Replies are listed 'Best First'.
Re^6: instantiating an SFTP object
by salva (Canon) on Jun 13, 2017 at 21:35 UTC
    If the remote host key is good enough for the given policy, the method returns a true value. Otherwise it returns undef and the error (or die_with_error) method can be used to find out the failure cause.
    $ssh2->check_hostkey(LIBSSH2_HOSTKEY_POLICY_ASK) or $ssh2->die_with_error;
    The 0-but-true value 00 is equal to LIBSSH2_KNOWNHOST_CHECK_MATCH.
      The 0-but-true value 00 is equal to LIBSSH2_KNOWNHOST_CHECK_MATCH.

      That's good isn't it? :-)


      I'm not really a human, but I play one on earth. ..... an animated JAPH