Author: jelmer
Date: 2006-05-24 22:15:03 +0000 (Wed, 24 May 2006)
New Revision: 15875

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

Log:
Fix bug in smbclients 'put' command tridge found a while ago. Add tests 
for 'put' and 'get' commands so we don't break them again.

Fixes #3742

Modified:
   branches/SAMBA_4_0/source/client/client.c
   branches/SAMBA_4_0/source/script/tests/test_smbclient.sh


Changeset:
Modified: branches/SAMBA_4_0/source/client/client.c
===================================================================
--- branches/SAMBA_4_0/source/client/client.c   2006-05-24 20:20:28 UTC (rev 
15874)
+++ branches/SAMBA_4_0/source/client/client.c   2006-05-24 22:15:03 UTC (rev 
15875)
@@ -1194,16 +1194,16 @@
        char *rname;
        
        if (!args[1]) {
-               d_printf("put <filename>\n");
+               d_printf("put <filename> [<remotename>]\n");
                return 1;
        }
 
-       lname = talloc_asprintf(ctx, "%s\\%s", ctx->remote_cur_dir, args[1]);
+       lname = talloc_strdup(ctx, args[1]);
   
        if (args[2])
                rname = talloc_strdup(ctx, args[2]);
        else
-               rname = talloc_strdup(ctx, lname);
+               rname = talloc_asprintf(ctx, "%s\\%s", ctx->remote_cur_dir, 
lname);
        
        dos_clean_name(rname);
 

Modified: branches/SAMBA_4_0/source/script/tests/test_smbclient.sh
===================================================================
--- branches/SAMBA_4_0/source/script/tests/test_smbclient.sh    2006-05-24 
20:20:28 UTC (rev 15874)
+++ branches/SAMBA_4_0/source/script/tests/test_smbclient.sh    2006-05-24 
22:15:03 UTC (rev 15875)
@@ -32,14 +32,14 @@
 
 
 # put that file
-echo mput tmpfile | runcmd "Putting file" || failed=`expr $failed + 1`
+echo mput tmpfile | runcmd "MPutting file" || failed=`expr $failed + 1`
 # check file info
 echo altname tmpfile | runcmd "Getting alternative name" || failed=`expr 
$failed + 1`
 # run allinfo on that file
 echo allinfo tmpfile | runcmd "Checking info on file" || failed=`expr $failed 
+ 1`
 # get that file
 mv tmpfile tmpfile-old
-echo mget tmpfile | runcmd "Getting file" || failed=`expr $failed + 1`
+echo mget tmpfile | runcmd "MGetting file" || failed=`expr $failed + 1`
 # remove that file
 echo rm tmpfile | runcmd "Removing file" || failed=`expr $failed + 1`
 # compare locally
@@ -61,6 +61,24 @@
 # run fsinfo
 echo fsinfo objectid | runcmd "Getting file system info" || failed=`expr 
$failed + 1`
 
-rm -f tmpfile tmpfile-old
+# put that file
+echo put tmpfile | runcmd "Putting file" || failed=`expr $failed + 1`
+# get that file
+mv tmpfile tmpfile-old
+echo get tmpfile | runcmd "Getting file" || failed=`expr $failed + 1`
+# remove that file
+echo rm tmpfile | runcmd "Removing file" || failed=`expr $failed + 1`
+# compare locally
+testit "Comparing files" diff tmpfile-old tmpfile || failed=`expr $failed + 1`
+# put that file
+echo put tmpfile tmpfilex | runcmd "Putting file with different name" || 
failed=`expr $failed + 1`
+# get that file
+echo get tmpfilex | runcmd "Getting file again" || failed=`expr $failed + 1`
+# compare locally
+testit "Comparing files" diff tmpfilex tmpfile || failed=`expr $failed + 1`
+# remove that file
+echo rm tmpfilex | runcmd "Removing file" || failed=`expr $failed + 1`
 
+rm -f tmpfile tmpfile-old tmpfilex
+
 testok $0 $failed

Reply via email to