|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46303 issues when trying to receive file created with ssh2_exec from ssh2_scp_recv
Submitted: 2008-10-15 15:11 UTC Modified: 2008-10-15 15:23 UTC
From: eric_intzandt at tvworks dot com Assigned:
Status: Not a bug Package: Network related
PHP Version: 5.2.6 OS: linux red hat enterprise 4
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:
Bug Type:
From: eric_intzandt at tvworks dot com
New email:
PHP Version: OS:


 [2008-10-15 15:11 UTC] eric_intzandt at tvworks dot com
I create an ssh connection to server b.  I then call ssh2_exec to create a file.  In the same connection, I then call ssh2_scp_recv to grab the file.  However, this returns the file with a size of 0.  If I take out the ssh2_exec() call, and just use ssh2_scp_recv with a pre-existing file it works fine. see code

	 './configure' '--host=x86_64-redhat-linux-gnu' '--build=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib64' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-expat-dir=/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-kerberos' '--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr' '--enable-memory-limit' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--without-mime-magic' '--with-libxml-dir=/usr' '--with-xml' '--with-system-tzdata' '--with-apxs2=/usr/sbin/apxs' '--without-mysql' '--without-gd' '--without-odbc' '--disable-dom' '--disable-dba' '--without-unixODBC' '--disable-pdo' '--disable-xmlreader' '--disable-xmlwriter' '--without-sqlite' '--disable-json' '--without-pspell' 

Reproduce code:
Assumes we are connecting to host B, from host A.

$conn = ssh2_connect($host,22);
    $command = "/usr/bin/pg_dump -F t -U ".COMMAND_USER." -d tv -f /home/admin/command_db.tar -i";  
    ssh2_exec($conn, $command );//creates file successfully
    echo "Failed to authenticate";

Expected result:
I would expect a file command_db to be created on host b, then transferred to host a.  

Actual result:
File gets created on host B, transferred to host A, but the filesize on host A is 0.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-15 15:23 UTC] eric_intzandt at tvworks dot com
needed to sleep() it longer than i thought. sorry to be a pita
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Oct 24 04:03:35 2021 UTC