s3 audit: Change create_file in full_audit to print whether a directory or file was...
authortprouty <tprouty@b72e2a10-2d34-0410-9a71-d3beadf02b57>
Wed, 26 Aug 2009 01:38:07 +0000 (01:38 +0000)
committerTim Prouty <tprouty@samba.org>
Wed, 26 Aug 2009 17:41:54 +0000 (10:41 -0700)
full_audit will now print out whether the createfile was requested for
a file or directory.  The create disposition is also printed out.

source3/modules/vfs_full_audit.c

index 6930a5573fa00e0286a4353a240f9b47e334e3ea..667db7a4bde14dd9a2083fdf041074b89301a86b 100644 (file)
@@ -855,6 +855,30 @@ static NTSTATUS smb_full_audit_create_file(vfs_handle_struct *handle,
                                      int *pinfo)
 {
        NTSTATUS result;
+       const char* str_create_disposition;
+
+       switch (create_disposition) {
+       case FILE_SUPERSEDE:
+               str_create_disposition = "supersede";
+               break;
+       case FILE_OVERWRITE_IF:
+               str_create_disposition = "overwrite_if";
+               break;
+       case FILE_OPEN:
+               str_create_disposition = "open";
+               break;
+       case FILE_OVERWRITE:
+               str_create_disposition = "overwrite";
+               break;
+       case FILE_CREATE:
+               str_create_disposition = "create";
+               break;
+       case FILE_OPEN_IF:
+               str_create_disposition = "open_if";
+               break;
+       default:
+               str_create_disposition = "unknown";
+       }
 
        result = SMB_VFS_NEXT_CREATE_FILE(
                handle,                                 /* handle */
@@ -873,8 +897,10 @@ static NTSTATUS smb_full_audit_create_file(vfs_handle_struct *handle,
                result_fsp,                             /* result */
                pinfo);                                 /* pinfo */
 
-       do_log(SMB_VFS_OP_CREATE_FILE, (NT_STATUS_IS_OK(result)), handle, "0x%x|%s",
-              access_mask, smb_fname_str_do_log(smb_fname));
+       do_log(SMB_VFS_OP_CREATE_FILE, (NT_STATUS_IS_OK(result)), handle,
+              "0x%x|%s|%s|%s", access_mask,
+              create_options & FILE_DIRECTORY_FILE ? "dir" : "file",
+              str_create_disposition, smb_fname_str_do_log(smb_fname));
 
        return result;
 }