php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | |
Patch ssh2_agent_authentication for ssh2 Bug #60522Patch version 2012-05-24 20:51 UTC Return to Bug #60522 | Download this patchThis patch is obsolete Obsoleted by patches: Patch Revisions: 2012-05-25 09:46 UTC | 2012-05-24 20:51 UTCDeveloper: casper@bcx.nlPHP_SUBST(SSH2_SHARED_LIBADD) diff --git a/ssh2-0.11.3/ssh2.c b/ssh2-0.11.3/ssh2.c index 504a054..9482718 100644 index 504a054..bdd4c7e 100644 --- a/ssh2-0.11.3/ssh2.c +++ b/ssh2-0.11.3/ssh2.c @@ -1104,6 +1104,85 @@ PHP_FUNCTION(ssh2_publickey_list) @@ -1104,6 +1104,80 @@ PHP_FUNCTION(ssh2_publickey_list) /* }}} */ #endif /* PHP_SSH2_PUBLICKEY_SUBSYSTEM */ +#ifdef PHP_SSH2_AGENT_AUTH Line 64 (now 64), was 52 lines, now 47 lines + } + + if (libssh2_agent_connect(agent)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failure connecting to ssh-agent"); + libssh2_agent_free(agent); + RETURN_FALSE; + } + + if (libssh2_agent_list_identities(agent)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failure requesting identities to ssh-agent"); + libssh2_agent_disconnect(agent); + libssh2_agent_free(agent); + RETURN_FALSE; + } + + while (1) { + rc = libssh2_agent_get_identity(agent, &identity, prev_identity); + + if (rc == 1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't continue authentication"); + libssh2_agent_disconnect(agent); + libssh2_agent_free(agent); + RETURN_FALSE; + RETURN_FALSE; + } + + if (rc < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failure obtaining identity from ssh-agent support"); + libssh2_agent_disconnect(agent); + libssh2_agent_free(agent); + RETURN_FALSE; + } + + } + + if (!libssh2_agent_userauth(agent, username, identity)) { + libssh2_agent_disconnect(agent); + libssh2_agent_free(agent); + RETURN_TRUE; + } + prev_identity = identity; + } +} +/* }}} */ + + + + +#endif /* PHP_SSH2_AGENT_AUTH */ + + /* *********************** * Module Housekeeping * *********************** */ @@ -1305,6 +1384,10 @@ zend_function_entry ssh2_functions[] = { @@ -1305,6 +1379,10 @@ zend_function_entry ssh2_functions[] = { PHP_FE(ssh2_publickey_list, NULL) #endif +#ifdef PHP_SSH2_AGENT_AUTH |
Copyright © 2001-2024 The PHP Group All rights reserved. |
Last updated: Sun May 19 11:01:37 2024 UTC |