summaryrefslogtreecommitdiff
path: root/source3/client
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-04-15 00:39:03 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:56:37 -0500
commitcc7ebb3f14dca6d8fd053d8017aedb2b206e2457 (patch)
tree63f725acac127d39128a6df37861ae2188ad666b /source3/client
parentf60ad8ded6e614f3c0abb2679d3a75096fc595d3 (diff)
downloadsamba-cc7ebb3f14dca6d8fd053d8017aedb2b206e2457.tar.gz
samba-cc7ebb3f14dca6d8fd053d8017aedb2b206e2457.tar.bz2
samba-cc7ebb3f14dca6d8fd053d8017aedb2b206e2457.zip
r6348: Fix for bug #2605 reported by Daniel Patterson <Daniel_Patterson@national.com.au>.
Ensure smbclient doesn't perform commands if the "chdir" fails in a scripted set. Jeremy. (This used to be commit 644608ea7db6d8d73a8c028a82cd0767ffe32af6)
Diffstat (limited to 'source3/client')
-rw-r--r--source3/client/client.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index 604bf0989a..be17488919 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -260,6 +260,7 @@ static int do_cd(char *newdir)
struct cli_state *targetcli;
SMB_STRUCT_STAT sbuf;
uint32 attributes;
+ int ret = 1;
dos_format(newdir);
@@ -305,21 +306,23 @@ static int do_cd(char *newdir)
pstrcpy(cur_dir,saved_dir);
goto out;
}
- }
- else {
+ } else {
pstrcat( targetpath, "\\" );
dos_clean_name( targetpath );
if ( !cli_chkpath(targetcli, targetpath) ) {
d_printf("cd %s: %s\n", dname, cli_errstr(targetcli));
pstrcpy(cur_dir,saved_dir);
+ goto out;
}
}
+ ret = 0;
+
out:
+
pstrcpy(cd_path,cur_dir);
-
- return 0;
+ return ret;
}
/****************************************************************************
@@ -3170,7 +3173,13 @@ static int process(char *base_directory)
return 1;
}
- if (*base_directory) do_cd(base_directory);
+ if (*base_directory) {
+ rc = do_cd(base_directory);
+ if (rc) {
+ cli_cm_shutdown();
+ return rc;
+ }
+ }
if (cmdstr) {
rc = process_command_string(cmdstr);
@@ -3233,7 +3242,13 @@ static int do_tar_op(char *base_directory)
recurse=True;
- if (*base_directory) do_cd(base_directory);
+ if (*base_directory) {
+ ret = do_cd(base_directory);
+ if (ret) {
+ cli_cm_shutdown();
+ return ret;
+ }
+ }
ret=process_tar();