svn commit: samba r6348 - in branches/SAMBA_3_0/source/client: .

jra at samba.org jra at samba.org
Fri Apr 15 00:39:07 GMT 2005


Author: jra
Date: 2005-04-15 00:39:03 +0000 (Fri, 15 Apr 2005)
New Revision: 6348

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

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:
   branches/SAMBA_3_0/source/client/client.c


Changeset:
Modified: branches/SAMBA_3_0/source/client/client.c
===================================================================
--- branches/SAMBA_3_0/source/client/client.c	2005-04-15 00:38:57 UTC (rev 6347)
+++ branches/SAMBA_3_0/source/client/client.c	2005-04-15 00:39:03 UTC (rev 6348)
@@ -260,6 +260,7 @@
 	struct cli_state *targetcli;
 	SMB_STRUCT_STAT sbuf;
 	uint32 attributes;
+	int ret = 1;
       
 	dos_format(newdir);
 
@@ -305,21 +306,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;
 }
 
 /****************************************************************************
@@ -3170,7 +3173,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);
@@ -3233,7 +3242,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