Ticket #79 (closed defect)

Opened 8 years ago

Last modified 8 years ago

Patch for allowing whitespace in file names

Reported by: heiner0 Owned by:
Priority: normal Milestone:
Component: Version:
Keywords: Cc: heiner0
Blocked By: Blocks:

Description

The attached patch fixes

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

It introduces a new (private) function

libssh2_shell_quotearg()

for "quoting" a shell command argument (e.g. a file name). Example:

one two

gets converted to

'one two'

(note the single quotation marks).

The quoting style ensures that the results
work with both Bourne Shell derivates (sh, ksh, ksh93, bash, zsh) and C-Shell dialects (csh, tcsh).

The new (private) macro

libssh2_shell_quotedsize()

calculates the maximum size a quoted string can have; this is useful for allocating a memory buffer for the
results.

I've tested the code with

Linux: bash, ksh93, tcsh
Solaris: sh, bash, csh

Attachments

shellquote.patch (9.6 KB) - added by heiner0 8 years ago.
Patch for allowing whitspace in file names

Download all attachments as: .zip

Change History

Changed 8 years ago by heiner0

Patch for allowing whitspace in file names

comment:1 Changed 8 years ago by heiner0

This entry is a duplicate of 1960894 and can be close.

Note: See TracTickets for help on using tickets.