svn commit: samba r6347 - in trunk/source/client: .

jra at samba.org jra at samba.org
Fri Apr 15 00:38:57 GMT 2005


Author: jra
Date: 2005-04-15 00:38:57 +0000 (Fri, 15 Apr 2005)
New Revision: 6347

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=6347

Log:
Fix for bug #2605 reported by Daniel Patterson <Daniel_Patterson at national.com.au>.
Ensure smbclient doesn't perform commands if the "chdir" fails in a scripted set.
Jeremy.

Modified:
   trunk/source/client/client.c


Changeset:
Modified: trunk/source/client/client.c
===================================================================
--- trunk/source/client/client.c	2005-04-14 23:32:56 UTC (rev 6346)
+++ trunk/source/client/client.c	2005-04-15 00:38:57 UTC (rev 6347)
@@ -257,6 +257,7 @@
 	struct cli_state *targetcli;
 	SMB_STRUCT_STAT sbuf;
 	uint32 attributes;
+	int ret = 1;
       
 	dos_format(newdir);
 
@@ -302,21 +303,23 @@
 			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;
 }
 
 /****************************************************************************
@@ -3167,7 +3170,13 @@
 		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);
@@ -3230,7 +3239,13 @@
 
 	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();
 



More information about the samba-cvs mailing list