From 75cfef38a4d836b7b1ee642a9c87ac8deb9a2144 Mon Sep 17 00:00:00 2001 From: Gerdriaan Mulder Date: Mon, 8 May 2023 17:24:35 +0200 Subject: [PATCH 1/3] ssh2_fopen_wrappers: initialize php_stream_wrapper_ops explicitly --- ssh2_fopen_wrappers.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ssh2_fopen_wrappers.c b/ssh2_fopen_wrappers.c index 9f6c163..7c6f433 100644 --- a/ssh2_fopen_wrappers.c +++ b/ssh2_fopen_wrappers.c @@ -720,7 +720,12 @@ static php_stream_wrapper_ops php_ssh2_shell_stream_wops = { NULL, /* stat */ NULL, /* stat_url */ NULL, /* opendir */ - "ssh2.shell" + "ssh2.shell", /* label */ + NULL, /* unlink */ + NULL, /* rename */ + NULL, /* mkdir */ + NULL, /* rmdir */ + NULL /* stream_metadata */ }; php_stream_wrapper php_ssh2_stream_wrapper_shell = { From 860d2904883df929aca4bef9a4edd878bf865eba Mon Sep 17 00:00:00 2001 From: Gerdriaan Mulder Date: Mon, 8 May 2023 17:31:35 +0200 Subject: [PATCH 2/3] ssh2_fopen_wrappers: initialize php_stream_wrapper_ops explicitly --- ssh2_fopen_wrappers.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/ssh2_fopen_wrappers.c b/ssh2_fopen_wrappers.c index 7c6f433..46ff8a8 100644 --- a/ssh2_fopen_wrappers.c +++ b/ssh2_fopen_wrappers.c @@ -969,7 +969,12 @@ static php_stream_wrapper_ops php_ssh2_exec_stream_wops = { NULL, /* stat */ NULL, /* stat_url */ NULL, /* opendir */ - "ssh2.exec" + "ssh2.exec", /* label */ + NULL, /* unlink */ + NULL, /* rename */ + NULL, /* mkdir */ + NULL, /* rmdir */ + NULL /* stream_metadata */ }; php_stream_wrapper php_ssh2_stream_wrapper_exec = { @@ -1110,7 +1115,12 @@ static php_stream_wrapper_ops php_ssh2_scp_stream_wops = { NULL, /* stat */ NULL, /* stat_url */ NULL, /* opendir */ - "ssh2.scp" + "ssh2.scp", /* label */ + NULL, /* unlink */ + NULL, /* rename */ + NULL, /* mkdir */ + NULL, /* rmdir */ + NULL /* stream_metadata */ }; php_stream_wrapper php_ssh2_stream_wrapper_scp = { @@ -1380,7 +1390,12 @@ static php_stream_wrapper_ops php_ssh2_tunnel_stream_wops = { NULL, /* stat */ NULL, /* stat_url */ NULL, /* opendir */ - "ssh2.tunnel" + "ssh2.tunnel", /* label */ + NULL, /* unlink */ + NULL, /* rename */ + NULL, /* mkdir */ + NULL, /* rmdir */ + NULL /* stream_metadata */ }; php_stream_wrapper php_ssh2_stream_wrapper_tunnel = { From 4966b69b32d5bee93030f8185ffc00f516ff88a7 Mon Sep 17 00:00:00 2001 From: Gerdriaan Mulder Date: Tue, 1 Aug 2023 16:50:13 +0200 Subject: [PATCH 3/3] ssh2_sftp: fully initialize `php_ssh2_sftp_wrapper_ops` And include comments to refer to PHP's `main/php_streams.h` struct `php_stream_wrapper_ops`. --- ssh2_sftp.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/ssh2_sftp.c b/ssh2_sftp.c index 2a22626..7f1ba80 100644 --- a/ssh2_sftp.c +++ b/ssh2_sftp.c @@ -554,15 +554,16 @@ static int php_ssh2_sftp_rmdir(php_stream_wrapper *wrapper, const char *url, int static php_stream_wrapper_ops php_ssh2_sftp_wrapper_ops = { php_ssh2_sftp_stream_opener, - NULL, /* close */ + NULL, /* stream_close */ NULL, /* stat */ - php_ssh2_sftp_urlstat, - php_ssh2_sftp_dirstream_opener, - PHP_SSH2_SFTP_WRAPPER_NAME, - php_ssh2_sftp_unlink, - php_ssh2_sftp_rename, - php_ssh2_sftp_mkdir, - php_ssh2_sftp_rmdir, + php_ssh2_sftp_urlstat, /* stat_url */ + php_ssh2_sftp_dirstream_opener, /* opendir */ + PHP_SSH2_SFTP_WRAPPER_NAME, /* label */ + php_ssh2_sftp_unlink, /* unlink */ + php_ssh2_sftp_rename, /* rename */ + php_ssh2_sftp_mkdir, /* mkdir */ + php_ssh2_sftp_rmdir, /* rmdir */ + NULL /* stream_metadata */ }; php_stream_wrapper php_ssh2_sftp_wrapper = {