summaryrefslogtreecommitdiffstats
path: root/source/client/clitar.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-03-05 17:17:52 -0800
committerKarolin Seeger <kseeger@samba.org>2009-03-06 08:28:31 +0100
commit2332ec76e73aad423e575ca52b621bb1bb634b47 (patch)
tree620d95e2f0729a9b3116b8258c3795cb2a6039c3 /source/client/clitar.c
parent544cd04a90a45e4b8ba7caca531d103351e14948 (diff)
downloadsamba-2332ec76e73aad423e575ca52b621bb1bb634b47.tar.gz
samba-2332ec76e73aad423e575ca52b621bb1bb634b47.tar.xz
samba-2332ec76e73aad423e575ca52b621bb1bb634b47.zip
Fix bug #6161 - smbclient corrupts source path in tar mode
This was my fault. I broke the smbclient tar argument processing in creating the string for chdir when removing pstrings. Jeremy. (cherry picked from commit a9e6c91cd18b8b7b805f4b69f3867ea4bd6bc3ba)
Diffstat (limited to 'source/client/clitar.c')
-rw-r--r--source/client/clitar.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/source/client/clitar.c b/source/client/clitar.c
index 5a974467c30..d6c02df0a5e 100644
--- a/source/client/clitar.c
+++ b/source/client/clitar.c
@@ -1513,6 +1513,7 @@ int process_tar(void)
if (strrchr_m(cliplist[i], '\\')) {
char *p;
+ char saved_char;
char *saved_dir = talloc_strdup(ctx,
client_get_cur_dir());
if (!saved_dir) {
@@ -1531,13 +1532,28 @@ int process_tar(void)
if (!tarmac) {
return 1;
}
+ /*
+ * Strip off the last \\xxx
+ * xxx element of tarmac to set
+ * it as current directory.
+ */
p = strrchr_m(tarmac, '\\');
if (!p) {
return 1;
}
+ saved_char = p[1];
p[1] = '\0';
+
client_set_cur_dir(tarmac);
+ /*
+ * Restore the character we
+ * just replaced to
+ * put the pathname
+ * back as it was.
+ */
+ p[1] = saved_char;
+
DEBUG(5, ("process_tar, do_list with tarmac: %s\n", tarmac));
do_list(tarmac,attribute,do_tar, False, True);