Try this patch. If it works for you, inform me, as then I will post it
to the list. (I tested it myself allready, but I want to be sure.)
--snip snip--
diff -u --recursive /home/sjl/ssh-2.0.12.orig/apps/ssh/scp2.c
ssh-2.0.12/apps/ssh/scp2.c
--- /home/sjl/ssh-2.0.12.orig/apps/ssh/scp2.c Mon Jan 25 16:14:45 1999
+++ ssh-2.0.12/apps/ssh/scp2.c Fri Feb 5 05:27:08 1999
@@ -848,6 +848,7 @@
temp_filename = &orig_filename[strlen(basepath)];
hlp = strchr(temp_filename, '/');
+
if (hlp)
{
*hlp = '\0';
@@ -1033,6 +1034,7 @@
ScpFileLocation *new_loc_list_start = NULL, *new_loc_list_tail = NULL;
ScpFileLocation temp_loc = NULL;
SshFileHandle handle;
+ Boolean found_expansion = FALSE;
SSH_PRECOND(loc_list_start && loc_list_tail);
SSH_PRECOND((*loc_list_start)->next == NULL);
@@ -1085,7 +1087,7 @@
{
char *full_filename;
int is_dir = 0;
-
+
/* Discard if "." or ".." */
if ((session->tmp_attributes->permissions & S_IFMT)
== S_IFDIR)
@@ -1099,6 +1101,7 @@
if (!strcmp(tempdir, ".") || !strcmp(tempdir, ".."))
continue;
+ found_expansion = TRUE;
is_dir = 1;
}
@@ -1125,6 +1128,7 @@
list_tail = list_tail->next;
}
+ found_expansion = TRUE;
}
/* XXX what if permissions doesn't contain everything we need?
@@ -1141,13 +1145,13 @@
if (session->preserve_flag)
(*new_loc_list_start)->dir_attrs =
ssh_file_attributes_dup(session->tmp_attributes);
-
if (!scp_recurse_directories(new_loc_list_start,
new_loc_list_tail,
session,
src_client))
{
+ found_expansion = TRUE;
/* Append. (If list's first item, initialize.) */
if (list_start == NULL)
{
@@ -1163,7 +1167,6 @@
else
{
scp_file_location_free(*new_loc_list_start);
- ssh_xfree(full_filename);
}
}
}
@@ -1173,6 +1176,8 @@
ssh_xfree(new_loc_list_start);
ssh_xfree(new_loc_list_tail);
+ if (!found_expansion)
+ return TRUE;
(*loc_list_start)->next = list_start;
*loc_list_tail = list_tail;
@@ -1459,6 +1464,8 @@
/* Here we do wildcard-expansion*/
if (session->src_list && session->src_list->contains_wildcards)
{
+ char *basepath = NULL;
+
/* host has to be remote, not local, otherwise the shell
would've parsed the wildcards for us.*/
if (!session->src_list->host)
@@ -1473,21 +1480,28 @@
to_be_deleted = session->src_list;
-
- if (session->src_remote_client != NULL)
+ if (!scp_set_src_is_remote_location_ok(session,
+ session->src_list->host,
+ session->src_list->port,
+ session->src_list->user))
{
- ssh_file_client_destroy(session->src_remote_client);
- session->src_remote_client = NULL;
+
+ if (session->src_remote_client != NULL)
+ {
+ ssh_file_client_destroy(session->src_remote_client);
+ session->src_remote_client = NULL;
+ }
+ session->src_remote_client =
+ scp_open_remote_connection(session,
+ session->src_list->host,
+ session->src_list->user,
+ session->src_list->port);
+ scp_set_src_remote_location(session,
+ session->src_list->host,
+ session->src_list->port,
+ session->src_list->user);
}
- session->src_remote_client =
- scp_open_remote_connection(session,
- session->src_list->host,
- session->src_list->user,
- session->src_list->port);
- scp_set_src_remote_location(session,
- session->src_list->host,
- session->src_list->port,
- session->src_list->user);
+
if (session->src_remote_client == NULL)
ssh_fatal("Cannot reach the source location.");
scp_abort_if_remote_dead(session, session->src_remote_client);
@@ -1495,10 +1509,15 @@
*list_start =
scp_file_location_dup(session->src_list);
+
+ if (session->src_list->file[0] == '/')
+ basepath = ssh_xstrdup("/");
+ else
+ basepath = ssh_xstrdup("");
/* Expand. (NOTE: this is a recursive function) */
if (!scp_expand_wildcards(list_start, list_tail,
- (char *)"", session->src_list->file,
+ basepath, session->src_list->file,
session))
{
tmp = session->src_list->next;
@@ -1540,21 +1559,28 @@
{
/* Open connection */
- if (session->src_remote_client != NULL)
+ if (!scp_set_src_is_remote_location_ok(session,
+ session->src_list->host,
+ session->src_list->port,
+ session->src_list->user))
{
- ssh_file_client_destroy(session->src_remote_client);
- session->src_remote_client = NULL;
- }
+ if (session->src_remote_client != NULL)
+ {
+ ssh_file_client_destroy(session->src_remote_client);
+ session->src_remote_client = NULL;
+ }
- session->src_remote_client =
- scp_open_remote_connection(session,
- session->src_list->host,
- session->src_list->user,
- session->src_list->port);
- scp_set_src_remote_location(session,
- session->src_list->host,
- session->src_list->port,
- session->src_list->user);
+ session->src_remote_client =
+ scp_open_remote_connection(session,
+ session->src_list->host,
+ session->src_list->user,
+ session->src_list->port);
+ scp_set_src_remote_location(session,
+ session->src_list->host,
+ session->src_list->port,
+ session->src_list->user);
+ }
+
if (session->src_remote_client == NULL)
ssh_fatal("Cannot reach the source location.");
scp_abort_if_remote_dead(session, session->src_remote_client);
@@ -1670,9 +1696,16 @@
current_src_location->
file[strlen(session->
current_src_location->dir_mask)]);
-
- if (*temp_filename == '/')
+
+ /* Remove excess '/' characters */
+ for (;*temp_filename == '/';)
temp_filename++;
+
+ if (session->dst_location->file[strlen(session->dst_location->file) - 1]
+ == '/')
+ session->dst_location->file[strlen(session->dst_location->file) - 1] =
+ '\0';
+
session->current_dst_file =
str_concat_3(session->dst_location->file,
@@ -1685,6 +1718,11 @@
else if (session->dst_is_dir)
{
char *hlp = strrchr(session->current_src_location->file, '/');
+ /* Remove excess '/' characters */
+ if (session->dst_location->file[strlen(session->dst_location->file) - 1]
+ == '/')
+ session->dst_location->file[strlen(session->dst_location->file) - 1] =
+ '\0';
if (hlp == NULL)
{
@@ -2793,14 +2831,6 @@
/* create needed directories */
if (session->current_src_location->is_dir == 1)
{
- /* char *new_dir;*/
- /* If source file is directory, we make the dir and
- continue. */
- /* xxx */
- /* session->tmp_attributes->flags = 0;
- new_dir = str_concat_3(session->dst_location->file, "/",
- session->current_dst_file);
- */
if (session->preserve_flag)
{
SSH_DEBUG(3, ("Preserve flag is on, but we don't have " \
--snap snap--
Shane Ramey writes:
: Well, it looks as if I'm giving my fair share of questions on this list;
: don't think I'm not trying. I've been pretty much working non-stop. I do
: appreciate all the help
:
: Here's my problem:
:
: Just a little obvious thing.
:
: shane@shane:/home/shane > scp shane@caffeine:/etc/pass* .
: shane@caffeine's password:
: warning: No wildcard expansions found for '/etc/pass*'.
:
: There IS an /etc/passwd on that machine, but it is not recieving the
: file. I'm using ssh2, and have used any number of quotation marks and
: have tried escaping.
:
: The wildcards I've tried and the syntax:
:
:
: shane@shane:/home/shane > scp shane@caffeine:"/etc/pass*" .
: shane@shane:/home/shane > scp shane@caffeine:/etc/pass\* .
: shane@shane:/home/shane > scp "shane@caffeine:/etc/pass*" .
:
: Am I doing this wrong? the scp man page says it's correct, is there any
: way to use wildcards?
:
: Thank you,
:
: -Shane
:
:
: --
: Shane Ramey
: Systems Administrator
: BroadLink Communications, Inc.
--
[[EMAIL PROTECTED] -- Sami J. Lehtinen -- [EMAIL PROTECTED]]
[work:+358 9 43543214][gsm:+358 50 5170 258][http://www.iki.fi/~sjl]
[SSH Communications Security Ltd. http://www.ssh.fi/]