Ticket #79 (closed defect)
Opened 4 years ago
Last modified 4 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
Change History
Changed 4 years ago by heiner0
- Attachment shellquote.patch added
comment:1 Changed 4 years ago by heiner0
This entry is a duplicate of 1960894 and can be close.

Patch for allowing whitspace in file names