s4-pvfs: log more error conditions in NTVFS backend
authorAndrew Tridgell <tridge@samba.org>
Fri, 5 Mar 2010 03:59:08 +0000 (14:59 +1100)
committerAndrew Tridgell <tridge@samba.org>
Fri, 5 Mar 2010 05:12:06 +0000 (16:12 +1100)
This should make is easier to track down some bug reports

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

source4/ntvfs/posix/pvfs_open.c
source4/ntvfs/posix/pvfs_read.c
source4/ntvfs/posix/pvfs_rename.c

index 7901ef577b98f17fd776fb8e4c33e0f872c84d46..d9d0d2178ab134949398e5acdb439fd02927c777 100644 (file)
@@ -206,6 +206,8 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs,
        if (io->ntcreatex.in.access_mask == SEC_FLAG_MAXIMUM_ALLOWED &&
            (io->ntcreatex.in.create_options & NTCREATEX_OPTIONS_DIRECTORY) &&
            (io->ntcreatex.in.create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE)) {
+               DEBUG(3,(__location__ ": Invalid access_mask/create_options 0x%08x 0x%08x for %s\n",
+                        io->ntcreatex.in.access_mask, io->ntcreatex.in.create_options, name->original_name));
                return NT_STATUS_INVALID_PARAMETER;
        }
        
@@ -229,6 +231,8 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs,
        case NTCREATEX_DISP_OVERWRITE:
        case NTCREATEX_DISP_SUPERSEDE:
        default:
+               DEBUG(3,(__location__ ": Invalid open disposition 0x%08x for %s\n",
+                        io->generic.in.open_disposition, name->original_name));
                return NT_STATUS_INVALID_PARAMETER;
        }
 
@@ -618,15 +622,21 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
        struct security_descriptor *sd = NULL;
 
        if (io->ntcreatex.in.file_attr & ~FILE_ATTRIBUTE_ALL_MASK) {
+               DEBUG(3,(__location__ ": Invalid file_attr 0x%08x for %s\n",
+                        io->ntcreatex.in.file_attr, name->original_name));
                return NT_STATUS_INVALID_PARAMETER;
        }
 
        if (io->ntcreatex.in.file_attr & FILE_ATTRIBUTE_ENCRYPTED) {
+               DEBUG(3,(__location__ ": Invalid encryption request for %s\n",
+                        name->original_name));
                return NT_STATUS_ACCESS_DENIED;
        }
            
        if ((io->ntcreatex.in.file_attr & FILE_ATTRIBUTE_READONLY) &&
            (create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE)) {
+               DEBUG(4,(__location__ ": Invalid delete on close for readonly file %s\n",
+                        name->original_name));
                return NT_STATUS_CANNOT_DELETE;
        }
 
@@ -1213,6 +1223,8 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
        access_mask    = io->generic.in.access_mask;
 
        if (share_access & ~NTCREATEX_SHARE_ACCESS_MASK) {
+               DEBUG(3,(__location__ ": Invalid share_access 0x%08x for %s\n",
+                        share_access, io->ntcreatex.in.fname));
                return NT_STATUS_INVALID_PARAMETER;
        }
 
@@ -1230,6 +1242,8 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
        }
 
        if (create_options & NTCREATEX_OPTIONS_INVALID_PARAM_MASK) {
+               DEBUG(3,(__location__ ": Invalid create_options 0x%08x for %s\n",
+                        create_options, io->ntcreatex.in.fname));
                return NT_STATUS_INVALID_PARAMETER;
        }
 
@@ -1260,6 +1274,8 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
        /* other create options are not allowed */
        if ((create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE) &&
            !(access_mask & SEC_STD_DELETE)) {
+               DEBUG(3,(__location__ ": Invalid delete_on_close option 0x%08x with access_mask 0x%08x for %s\n",
+                        create_options, access_mask, io->ntcreatex.in.fname));
                return NT_STATUS_INVALID_PARAMETER;
        }
 
@@ -1291,6 +1307,8 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
        if (io->ntcreatex.in.file_attr & (FILE_ATTRIBUTE_DEVICE|
                                          FILE_ATTRIBUTE_VOLUME| 
                                          (~FILE_ATTRIBUTE_ALL_MASK))) {
+               DEBUG(3,(__location__ ": Invalid file_attr 0x%08x for %s\n",
+                        io->ntcreatex.in.file_attr, io->ntcreatex.in.fname));
                return NT_STATUS_INVALID_PARAMETER;
        }
 
@@ -1374,6 +1392,8 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
                break;
 
        default:
+               DEBUG(3,(__location__ ": Invalid open disposition 0x%08x for %s\n",
+                        io->generic.in.open_disposition, name->original_name));
                return NT_STATUS_INVALID_PARAMETER;
        }
 
index 75fba3c90d9bbbc1cd1c051756a7d162d1398786..d25036ad4b0721e73fa3c634654cb3f9cfddd4d1 100644 (file)
@@ -60,6 +60,7 @@ NTSTATUS pvfs_read(struct ntvfs_module_context *ntvfs,
 
        maxcnt = rd->readx.in.maxcnt;
        if (maxcnt > 2*UINT16_MAX && req->ctx->protocol < PROTOCOL_SMB2) {
+               DEBUG(3,(__location__ ": Invalid SMB maxcnt 0x%x\n", maxcnt));
                return NT_STATUS_INVALID_PARAMETER;
        }
 
index d963357cbabd2ad4d0cd18537d6ae153c2746689..66c1427a11bdeb78946dd308b27724f665a02026 100644 (file)
@@ -366,6 +366,8 @@ static NTSTATUS pvfs_rename_wildcard(struct pvfs_state *pvfs,
        if (strncmp(dir_path, name2->full_name, strlen(dir_path)) != 0 ||
            name2->full_name[strlen(dir_path)] != '/' ||
            strchr(name2->full_name + strlen(dir_path) + 1, '/')) {
+               DEBUG(3,(__location__ ": Invalid rename for %s -> %s\n",
+                        name1->original_name, name2->original_name));
                return NT_STATUS_INVALID_PARAMETER;
        }
 
@@ -480,10 +482,14 @@ static NTSTATUS pvfs_rename_stream(struct ntvfs_module_context *ntvfs,
        struct odb_lock *lck = NULL;
 
        if (name1->has_wildcard) {
+               DEBUG(3,(__location__ ": Invalid wildcard rename for %s\n",
+                        name1->original_name));
                return NT_STATUS_INVALID_PARAMETER;
        }
 
        if (ren->ntrename.in.new_name[0] != ':') {
+               DEBUG(3,(__location__ ": Invalid rename for %s\n",
+                        ren->ntrename.in.new_name));
                return NT_STATUS_INVALID_PARAMETER;
        }
 
@@ -492,6 +498,8 @@ static NTSTATUS pvfs_rename_stream(struct ntvfs_module_context *ntvfs,
        }
 
        if (ren->ntrename.in.flags != RENAME_FLAG_RENAME) {
+               DEBUG(3,(__location__ ": Invalid rename flags 0x%x for %s\n",
+                        ren->ntrename.in.flags, ren->ntrename.in.new_name));
                return NT_STATUS_INVALID_PARAMETER;
        }
 
@@ -621,6 +629,8 @@ static NTSTATUS pvfs_rename_nt(struct ntvfs_module_context *ntvfs,
                return pvfs_copy_file(pvfs, name1, name2);
 
        case RENAME_FLAG_MOVE_CLUSTER_INFORMATION:
+               DEBUG(3,(__location__ ": Invalid rename cluster for %s\n",
+                        name1->original_name));
                return NT_STATUS_INVALID_PARAMETER;
 
        default: