Skip to content

Commit a0621be

Browse files
cweiskelangemeijer
authored andcommitted
Fix call to ssh2_auth_pubkey() without password
Port of the previous fix for ssh2_auth_pubkey_file() to the passwordless function introduced after that patch. Related: https://bugs.php.net/bug.php?id=79702
1 parent 10ca442 commit a0621be

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ssh2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,15 +709,15 @@ PHP_FUNCTION(ssh2_auth_pubkey)
709709
{
710710
LIBSSH2_SESSION *session;
711711
zval *zsession;
712-
zend_string *username, *pubkey, *privkey, *passphrase;
712+
zend_string *username, *pubkey, *privkey, *passphrase = NULL;
713713

714714
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rSSS|S", &zsession, &username, &pubkey, &privkey, &passphrase) == FAILURE) {
715715
return;
716716
}
717717

718718
SSH2_FETCH_NONAUTHENTICATED_SESSION(session, zsession);
719719

720-
if (libssh2_userauth_publickey_frommemory(session, ZSTR_VAL(username), ZSTR_LEN(username), ZSTR_VAL(pubkey), ZSTR_LEN(pubkey), ZSTR_VAL(privkey), ZSTR_LEN(privkey), ZSTR_VAL(passphrase))) {
720+
if (libssh2_userauth_publickey_frommemory(session, ZSTR_VAL(username), ZSTR_LEN(username), ZSTR_VAL(pubkey), ZSTR_LEN(pubkey), ZSTR_VAL(privkey), ZSTR_LEN(privkey), passphrase ? ZSTR_VAL(passphrase) : NULL)) {
721721
char *buf;
722722
int len;
723723
libssh2_session_last_error(session, &buf, &len, 0);

0 commit comments

Comments
 (0)