php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59762 ssh2_scp_recv creates zero size file
Submitted: 2011-05-11 04:44 UTC Modified: 2013-02-18 00:35 UTC
Votes:8
Avg. Score:4.6 ± 0.7
Reproduced:7 of 7 (100.0%)
Same Version:1 (14.3%)
Same OS:4 (57.1%)
From: mail_0000 at mail dot ru Assigned:
Status: No Feedback Package: ssh2 (PECL)
PHP Version: 5.3.5 OS: Solaris 10
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mail_0000 at mail dot ru
New email:
PHP Version: OS:

 

 [2011-05-11 04:44 UTC] mail_0000 at mail dot ru
Description:
------------
ssh2_scp_recv creates zero size file thus the function returns "true", thus ssh2_scp_send works perfectly

Also this bug was found with php 5.3.6, 5.3.5, 5.2.1, 5.2.17, 4.4.5

openssl v 0.9.8r  1.0.0d

Reproduce code:
---------------
<?php
$connection = ssh2_connect('shell.example.com', 22);
ssh2_auth_password($connection, 'username', 'password');

ssh2_scp_recv($connection, '/remote/filename', '/local/filename');
?>

Expected result:
----------------
create a full copy of /remote/filename /local/filename

Actual result:
--------------
function creates /local/filename and returns true, but the file has no data and its size is 0 bytes 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-12-14 19:37 UTC] mike dot mackintosh at angrystatic dot com
Can you post the output from the following command line command:

scp -v user@remotehost:/remote/filename /local/filename
 [2011-12-16 13:46 UTC] mail_0000 at mail dot ru
scp -v user@hostname:R.php RM.php           
Executing: program /usr/bin/ssh host hostname, user user, command scp -v -f R.php
Sun_SSH_1.1, SSH protocols 1.5/2.0, OpenSSL 0x0090704f
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Rhosts Authentication disabled, originating port will not be trusted.
debug1: ssh_connect: needpriv 0
debug1: Connecting to hostname [hostname] port 22.
debug1: Connection established.
debug1: identity file /.ssh/identity type -1
debug1: identity file /.ssh/id_rsa type 1
debug1: identity file /.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version Sun_SSH_1.1
debug1: no match: Sun_SSH_1.1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-Sun_SSH_1.1
debug1: Failed to acquire GSS-API credentials for any mechanisms (No credentials were supplied, or the credentials were unavailable or inaccessible
Unknown code 0
)
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: Peer sent proposed langtags, ctos: bg-BG,de-LU,en-CA,en-GB,en-IE,en-US,es-MX,et-EE,fr,fr-BE,fr-CA,fr-FR,fr-LU,hr-HR,lt-LT,lv-LV,mk-MK,nl-BE,nl-NL,ro-RO,ru,ru-RU,sh-BA,sl-SI,sq-AL,sr-CS,es,et,lt,lv,nl,nr,sr-SP,sr-YU,tr,tr-TR,i-default
debug1: Peer sent proposed langtags, stoc: bg-BG,de-LU,en-CA,en-GB,en-IE,en-US,es-MX,et-EE,fr,fr-BE,fr-CA,fr-FR,fr-LU,hr-HR,lt-LT,lv-LV,mk-MK,nl-BE,nl-NL,ro-RO,ru,ru-RU,sh-BA,sl-SI,sq-AL,sr-CS,es,et,lt,lv,nl,nr,sr-SP,sr-YU,tr,tr-TR,i-default
debug1: We proposed langtags, ctos: ru-RU
debug1: We proposed langtags, stoc: ru-RU
debug1: Negotiated lang: ru-RU
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: Remote: Negotiated main locale: ru_RU.UTF-8
debug1: Remote: Negotiated messages locale: ru_RU.UTF-8
debug1: dh_gen_key: priv key bits set: 127/256
debug1: bits set: 1629/3191
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'hostname' is known and matches the RSA host key.
debug1: Found key in /.ssh/known_hosts:2
debug1: bits set: 1578/3191
debug1: ssh_rsa_verify: signature correct
debug1: newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: done: ssh_kex2.
debug1: send SSH2_MSG_SERVICE_REQUEST
debug1: got SSH2_MSG_SERVICE_ACCEPT
debug1: Authentications that can continue: gssapi-keyex,gssapi-with-mic,publickey,password,keyboard-interactive
debug1: Next authentication method: gssapi-keyex
debug1: Next authentication method: gssapi-with-mic
debug1: Failed to acquire GSS-API credentials for any mechanisms (No credentials were supplied, or the credentials were unavailable or inaccessible
Unknown code 0
)
debug1: Next authentication method: publickey
debug1: Trying private key: /.ssh/identity
debug1: Trying public key: /.ssh/id_rsa
debug1: Authentications that can continue: gssapi-keyex,gssapi-with-mic,publickey,password,keyboard-interactive
debug1: Trying private key: /.ssh/id_dsa
debug1: Next authentication method: keyboard-interactive
Password: 
debug1: Authentication succeeded (keyboard-interactive)
debug1: fd 5 setting O_NONBLOCK
debug1: fd 6 setting O_NONBLOCK
debug1: channel 0: new [client-session]
debug1: send channel open 0
debug1: Entering interactive session.
debug1: ssh_session2_setup: id 0
debug1: channel request 0: env
debug1: channel request 0: env
debug1: channel request 0: env
debug1: channel request 0: env
debug1: channel request 0: env
debug1: Sending command: scp -v -f R.php
debug1: channel request 0: exec
debug1: channel 0: open confirm rwindow 0 rmax 32768
debug1: Remote: Channel 0 set: LC_CTYPE=ru_RU.KOI8-R
debug1: Remote: Channel 0 set: LC_COLLATE=ru_RU.KOI8-R
debug1: Remote: Channel 0 set: LC_NUMERIC=ru_RU.KOI8-R
debug1: Remote: Channel 0 set: LC_MONETARY=ru_RU.KOI8-R
debug1: Remote: Channel 0 set: LC_MESSAGES=C
Sending file modes: C0644 169 R.php
R.php                100% |*********************************************************************************|   169       00:00    
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: rcvd eof
debug1: channel 0: output open -> drain
debug1: channel 0: obuf empty
debug1: channel 0: close_write
debug1: channel 0: output drain -> closed
debug1: channel 0: rcvd close
debug1: channel 0: close_read
debug1: channel 0: input open -> closed
debug1: channel 0: almost dead
debug1: channel 0: gc: notify user
debug1: channel 0: gc: user detached
debug1: channel 0: send close
debug1: channel 0: is dead
debug1: channel 0: garbage collecting
debug1: channel_free: channel 0: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK
debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 0,0 seconds
debug1: Bytes per second: stdin 0,0, stdout 0,0, stderr 0,0
debug1: Exit status 0
 [2012-06-16 21:01 UTC] langemeijer@php.net
What version of libssh2 are you using? Please update to a recent version and try 
again. The bug may very well be in the libssh2 library.
 [2012-06-16 21:01 UTC] langemeijer@php.net
-Status: Open +Status: Feedback
 [2012-10-16 19:09 UTC] langemeijer@php.net
A new ssh2 package is released. Please see if problem still occurs.
 [2013-02-18 00:35 UTC] pecl-dev at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 [2013-11-18 14:10 UTC] s dot horsman at erasmusmc dot nl
I have this exact problem on PHP 5.3.3, OS RHEL4, libssh2 1.4.3, ssh2 0.12

Using ssh2_sftp + file_get_contents on the same file works without problem.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 01:01:28 2024 UTC