Subject: [libssh2] [ libssh2-Bugs-1960894 ] libssh2_scp_* do not handle whitespace in file names

[libssh2] [ libssh2-Bugs-1960894 ] libssh2_scp_* do not handle whitespace in file names

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Thu, 21 Aug 2008 16:58:38 +0000

Bugs item #1960894, was opened at 2008-05-09 09:50
Message generated for change (Comment added) made by heiner0
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=703942&aid=1960894&group_id=125852

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Heiner (heiner0)
Assigned to: Nobody/Anonymous (nobody)
Summary: libssh2_scp_* do not handle whitespace in file names

Initial Comment:
it seems that some libssh2 SCP functions do not correctly handle
whitespace in file names. When trying to copy a file named "with blanks"
using libssh2_scp_recv() I get an error message.

The reason is that libssh2 builds a "scp" command line that will be
run on the remote side, but does not take care to quote the file
name. It runs the equivalent of the following "ssh" command:

    scp -f with blanks

instead of (note the quotation marks):

    scp -f 'with blanks'

The code causing problems is in libssh2_scp_recv():

    memcpy(session->scpRecv_command, "scp -f ", sizeof("scp -f ") - 1);
    memcpy(session->scpRecv_command + sizeof("scp -f ") - 1, path,
           path_len);

    (Similar code is in libssh2_scp_send()).

Variable "path" should get correct quoting.

I attached the function shell_quotearg() that could be used for quoting
the path name.

----------------------------------------------------------------------

>Comment By: Heiner (heiner0)
Date: 2008-08-21 16:58

Message:
Logged In: YES
user_id=1568315
Originator: YES

The shell_quotearg() function had problems when the login shell of the
remote
user was the C-Shell (csh). The new function works with CSH as well.
It includes a small test program: cc -DMAIN -o qtest shell_quotearg.c;
./qtest "someone's test"

File Added: shell_quotearg.c

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=703942&aid=1960894&group_id=125852

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2008-08-21