Expand braces internally, as POSIX /bin/sh does not do {} expansion.
Signed-off-by: Russell Steicke <russells@adelie.cx>
This commit is contained in:
committed by
Paul Beckingham
parent
0cc7bc337d
commit
e4da3aca0d
@@ -41,14 +41,12 @@ TransportSSH::TransportSSH(const Uri& uri) : Transport(uri)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void TransportSSH::send(const std::string& source)
|
||||
{
|
||||
std::vector<std::string> sourcelist;
|
||||
std::vector<std::string>::const_iterator source_iter;
|
||||
|
||||
if (_uri._host == "")
|
||||
throw std::string (STRING_TRANSPORT_SSH_URI);
|
||||
|
||||
// Is there more than one file to transfer?
|
||||
// Then path has to end with a '/'
|
||||
if (is_filelist(source) && !_uri.is_directory())
|
||||
throw format (STRING_TRANSPORT_URI_NODIR, _uri._path);
|
||||
|
||||
// cmd line is: scp [-p port] [user@]host:path
|
||||
if (_uri._port != "")
|
||||
{
|
||||
@@ -56,7 +54,22 @@ void TransportSSH::send(const std::string& source)
|
||||
_arguments.push_back (_uri._port);
|
||||
}
|
||||
|
||||
_arguments.push_back (source);
|
||||
if (is_filelist (source))
|
||||
{
|
||||
expand_braces (source, _uri._data, sourcelist);
|
||||
// Is there more than one source?
|
||||
// Then path has to end with a '/'
|
||||
if (sourcelist.size () > 1 && !_uri.is_directory ())
|
||||
throw format (STRING_TRANSPORT_URI_NODIR, _uri);
|
||||
|
||||
for (source_iter = sourcelist.begin (); source_iter != sourcelist.end (); ++source_iter) {
|
||||
_arguments.push_back (*source_iter);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_arguments.push_back (source);
|
||||
}
|
||||
|
||||
if (_uri._user != "")
|
||||
{
|
||||
@@ -89,6 +102,8 @@ void TransportSSH::recv(std::string target)
|
||||
_arguments.push_back (_uri._port);
|
||||
}
|
||||
|
||||
// We do not do {} expansion of the URI, as ssh servers do that for us.
|
||||
|
||||
if (_uri._user != "")
|
||||
{
|
||||
_arguments.push_back (_uri._user + "@" + _uri._host + ":" + escape (_uri._path, ' '));
|
||||
|
||||
Reference in New Issue
Block a user