Howdy,

I've updated the code in Bricolage that uses Net::SSH2 (the Perl interface to 
libssh2) to distribute files to servers. The update now properly checks error 
conditions. As a result, there are now more errors to deal with. So I'm trying 
to figure out the cause of them. The complete code is here:

  http://github.com/bricoleurs/bricolage/blob/master/lib/Bric/Util/Trans/SFTP.pm

The first error is from this excerpt from line 290:

    my $ret = $ssh2->auth(
        ($server->get_login ? (
            username   => $server->get_login,
            password   => $server->get_password,
        ) : ()),
        (SFTP_PUBLIC_KEY_FILE ? (
            publickey  => SFTP_PUBLIC_KEY_FILE,
            privatekey => SFTP_PRIVATE_KEY_FILE,
        ) : ()),
    );
    throw_gen(
        error => "Error authenticating to '$hn' via SSH2",
        payload => join ' ', $ssh2->error,
    ) unless $ret && $ssh2->auth_ok;

The error, thrown in that last statement, is:

  -37 LIBSSH2_ERROR_EAGAIN Would block requesting userauth list

I think that there might be both a login and a SFTP_PUBLIC_KEY_FILE value. Is 
there really any harm in passing both the username/password and 
publickey/privatekey params? Is that in fact the source of the error? Should 
this error simply be ignored?

The second error comes from this statement at line 177:

    $sftp->rename($temp_dest, $dest_file) or throw_gen(
        error   => "Error renaming '$temp_dest' to '$dest_file' on '$hn'",
        payload => join ' ', $sftp->error
    );

The error is:

  4 SSH_FX_FAILURE

Which seems to be because the server to which we've connected has generated 
some sort of error. But beyond that, I'm mystified. The call to scp_put() 
appears to have worked at line 172, so I'm not sure why it would complain about 
a rename(). Is there any way to get more information about the underlying error?

Thanks,

David

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

Reply via email to