Fix bug 7075 - bug in vfs_scannedonly rmdir implementation.
authorJeremy Allison <jra@samba.org>
Fri, 5 Feb 2010 00:23:32 +0000 (16:23 -0800)
committerKarolin Seeger <kseeger@samba.org>
Mon, 29 Mar 2010 07:41:05 +0000 (09:41 +0200)
Check for NULL on opendir, correctly call next rmdir.

Jeremy.
(cherry picked from commit 39fad1417eefe69712fd1a805a41dcfe0d34fdf1)

source3/modules/vfs_scannedonly.c

index 20c54fbd25cbe295d0902b715da1e7daf5cf1bd9..0e32a6f34fc0c48595aec821fd93f0095677ebea 100644 (file)
@@ -822,6 +822,9 @@ static int scannedonly_rmdir(vfs_handle_struct * handle, const char *path)
 
        path_w_slash = name_w_ending_slash(ctx,path);
        dirp = SMB_VFS_NEXT_OPENDIR(handle, path, NULL, 0);
+       if (!dirp) {
+               return -1;
+       }
        while ((dire = SMB_VFS_NEXT_READDIR(handle, dirp, NULL)) != NULL) {
                if (ISDOT(dire->d_name) || ISDOTDOT(dire->d_name)) {
                        continue;
@@ -878,7 +881,8 @@ static int scannedonly_rmdir(vfs_handle_struct * handle, const char *path)
                        TALLOC_FREE(smb_fname);
                }
        }
-       return SMB_VFS_NEXT_CLOSEDIR(handle, dirp);
+       SMB_VFS_NEXT_CLOSEDIR(handle, dirp);
+       return SMB_VFS_NEXT_RMDIR(handle, path);
 }
 
 static void free_scannedonly_data(void **data)