summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-03-05 17:16:54 -0800
committerKarolin Seeger <kseeger@samba.org>2009-03-27 13:06:51 +0100
commit0799502c06d4f54e2c54ebdf69281e1d660482bd (patch)
tree34b2cf0af3e45f6797a4d3eec253a153d298f87d
parentb7e092783f4a3ea7ef1c62400b7e445eb1e879e1 (diff)
downloadsamba-0799502c06d4f54e2c54ebdf69281e1d660482bd.tar.gz
samba-0799502c06d4f54e2c54ebdf69281e1d660482bd.tar.xz
samba-0799502c06d4f54e2c54ebdf69281e1d660482bd.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 750f9d94b0a1208d45cc117df68042e1d83044bf)
-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 084f87e3996..be0bc320bb4 100644
--- a/source/client/clitar.c
+++ b/source/client/clitar.c
@@ -1506,6 +1506,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) {
@@ -1524,13 +1525,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);