Fix #80729: ssh2_shell() streams are not stream_select()able

On Windows, the socket type is not an `int` but rather `SOCKET` which
is actually `unsigned int` on x86 and `unsigned __int64` on x64.  To
cater to this type mismatch, PHP offers the portable `php_socket_t` (at
least as of PHP 5.0.0).  We use it for `php_ssh2_session_data` as well.
This commit is contained in:
Christoph M. Becker
2021-02-10 18:53:45 +01:00
parent 93265d71bd
commit 478edd029a
2 changed files with 3 additions and 2 deletions

View File

@@ -22,6 +22,7 @@
#include <libssh2.h>
#include <libssh2_sftp.h>
#include "ext/standard/url.h"
#include "main/php_network.h"
#define PHP_SSH2_VERSION "1.2"
#define PHP_SSH2_DEFAULT_PORT 22
@@ -64,7 +65,7 @@ typedef struct _php_ssh2_session_data {
zval *macerror_cb;
zval *disconnect_cb;
int socket;
php_socket_t socket;
} php_ssh2_session_data;
typedef struct _php_ssh2_sftp_data {

View File

@@ -171,7 +171,7 @@ static int php_ssh2_channel_stream_cast(php_stream *stream, int castas, void **r
case PHP_STREAM_AS_FD_FOR_SELECT:
case PHP_STREAM_AS_SOCKETD:
if (ret) {
*(int *)ret = (*session_data)->socket;
*(php_socket_t *)ret = (*session_data)->socket;
}
return SUCCESS;
default: