Fix bug #5953 - smbclient crashes: cli_list_new segmentation fault.
authorJeremy Allison <jra@samba.org>
Mon, 8 Dec 2008 22:02:59 +0000 (14:02 -0800)
committerJeremy Allison <jra@samba.org>
Mon, 8 Dec 2008 22:02:59 +0000 (14:02 -0800)
Karolin: must be in 3.2-stable. Thanks,
Jeremy.

source/libsmb/clilist.c
source/smbd/vfs.c

index 50918458b081010b8211493e1fbf23fea9340fd3..cebafc6919a0d522f38f6ca6a1704a4050746a30 100644 (file)
@@ -417,7 +417,7 @@ int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute,
                }
 
                SAFE_FREE(mask);
-               if (ff_searchcount > 0) {
+               if (ff_searchcount > 0 && ff_eos == 0 && finfo.name) {
                        mask = SMB_STRDUP(finfo.name);
                } else {
                        mask = SMB_STRDUP("");
index 33a3a43aa474a9a76d6e9a18e5d3ba1db2bd23f5..6cf156cb3907622e407eeb87388749c195b675e3 100644 (file)
@@ -624,6 +624,9 @@ int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len)
 
        flush_write_cache(fsp, SIZECHANGE_FLUSH);
 
+#ifdef HAVE_POSIX_FALLOCATE
+       set_filelen_write_cache(fsp, len);
+#else
        if (!sparse_buf) {
                sparse_buf = SMB_CALLOC_ARRAY(char, SPARSE_BUF_WRITE_SIZE);
                if (!sparse_buf) {
@@ -652,8 +655,11 @@ int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len)
                total += pwrite_ret;
        }
 
+       ret = 0;
+#endif
+
        set_filelen_write_cache(fsp, len);
-       return 0;
+       return ret;
 }
 
 /****************************************************************************