Net::SSLeay error when using SSH on AnyEvent::Handle

José Micó jose.mico at gmail.com
Tue Nov 23 15:12:59 CET 2010


At least since AE 4, I've got an error when using SSH on AnyEvent::Handle:

     Not enough arguments for Net::SSLeay::CTX_set_default_passwd_cb at 
/home/jose/trunk/lib/AnyEvent/TLS.pm line 859, near "})"
     Compilation failed in require at 
/home/jose/trunk/lib/AnyEvent/Handle.pm line 2094.

The only reference to CTX_set_default_passwd_cb into Net::SSLeay 
marvelous documentation says:

     Per-context callbacks for decrypting private keys are implemented.
     Net::SSLeay::CTX_set_default_passwd_cb($ctx, sub { "top-secret" });
     Net::SSLeay::CTX_set_default_passwd_cb($ctx, undef);

So I've added an undef parameter to CTX_set_default_passwd_cb, and SSL 
works perfectly :-)
I'm using an old version of Net::SSLeay (1.25, don't ask), maybe this is 
not necessary when using more recent versions.

--- home/jose/Desktop/AnyEvent-5.28/lib/AnyEvent/TLS.pm
+++ home/jose/trunk/lib/AnyEvent/TLS.pm
@@ -856,7 +856,7 @@
     my ($self) = @_;

     # better be safe than sorry with net-ssleay
-   Net::SSLeay::CTX_set_default_passwd_cb ($self->{ctx});
+   Net::SSLeay::CTX_set_default_passwd_cb ($self->{ctx}, undef);

     Net::SSLeay::CTX_free ($self->{ctx});
  }

Regards,
José




More information about the anyevent mailing list