php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #60522
Patch ssh2_agent_authentication revision 2012-05-25 09:46 UTC by casper at bcx dot nl
revision 2012-05-24 20:51 UTC by casper at bcx dot nl

Patch ssh2_agent_authentication for ssh2 Bug #60522

Patch version 2012-05-24 20:51 UTC

Return to Bug #60522 | Download this patch
This patch is obsolete

Obsoleted by patches:

Patch Revisions: 2012-05-25 09:46 UTC | 2012-05-24 20:51 UTC

Developer: casper@bcx.nl



     
     PHP_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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 11:01:37 2024 UTC