Changeset 740 for vendor/current/source3/modules/vfs_full_audit.c
- Timestamp:
- Nov 14, 2012, 12:59:34 PM (13 years ago)
- File:
-
- 1 edited
-
vendor/current/source3/modules/vfs_full_audit.c (modified) (28 diffs)
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/modules/vfs_full_audit.c
r478 r740 59 59 60 60 #include "includes.h" 61 62 63 64 65 66 61 67 62 68 static int vfs_full_audit_debug_level = DBGC_VFS; … … 87 93 88 94 SMB_VFS_OP_OPENDIR, 95 89 96 SMB_VFS_OP_READDIR, 90 97 SMB_VFS_OP_SEEKDIR, … … 124 131 SMB_VFS_OP_NTIMES, 125 132 SMB_VFS_OP_FTRUNCATE, 133 126 134 SMB_VFS_OP_LOCK, 127 135 SMB_VFS_OP_KERNEL_FLOCK, … … 228 236 { SMB_VFS_OP_FS_CAPABILITIES, "fs_capabilities" }, 229 237 { SMB_VFS_OP_OPENDIR, "opendir" }, 238 230 239 { SMB_VFS_OP_READDIR, "readdir" }, 231 240 { SMB_VFS_OP_SEEKDIR, "seekdir" }, … … 262 271 { SMB_VFS_OP_NTIMES, "ntimes" }, 263 272 { SMB_VFS_OP_FTRUNCATE, "ftruncate" }, 273 264 274 { SMB_VFS_OP_LOCK, "lock" }, 265 275 { SMB_VFS_OP_KERNEL_FLOCK, "kernel_flock" }, … … 330 340 { SMB_VFS_OP_AIO_SUSPEND,"aio_suspend" }, 331 341 { SMB_VFS_OP_AIO_FORCE, "aio_force" }, 332 { SMB_VFS_OP_IS_OFFLINE, " aio_is_offline" },333 { SMB_VFS_OP_SET_OFFLINE, " aio_set_offline" },342 { SMB_VFS_OP_IS_OFFLINE, "is_offline" }, 343 { SMB_VFS_OP_SET_OFFLINE, "set_offline" }, 334 344 { SMB_VFS_OP_LAST, NULL } 335 345 }; … … 393 403 result = talloc_sub_advanced(ctx, 394 404 lp_servicename(SNUM(conn)), 395 conn->se rver_info->unix_name,405 conn->se_info->unix_name, 396 406 conn->connectpath, 397 conn->se rver_info->utok.gid,398 conn->se rver_info->sanitized_username,399 pdb_get_domain(conn->server_info->sam_account),407 conn->se_info->utok.gid, 408 conn->se_info->sanitized_username, 409 , 400 410 prefix); 401 411 TALLOC_FREE(prefix); … … 432 442 } 433 443 434 static void init_bitmap(struct bitmap **bm, const char **ops)435 { 436 bool log_all = False;437 438 if ( *bm != NULL)439 return ;440 441 *bm = bitmap_allocate(SMB_VFS_OP_LAST); 442 443 if ( *bm == NULL) {444 static , const char **ops) 445 { 446 ; 447 448 if ( 449 return; 450 } 451 452 bm = bitmap_talloc(mem_ctx, SMB_VFS_OP_LAST); 453 if (bm == NULL) { 444 454 DEBUG(0, ("Could not alloc bitmap -- " 445 455 "defaulting to logging everything\n")); 446 return ;456 return; 447 457 } 448 458 449 while (*ops != NULL) {459 ) { 450 460 int i; 451 bool found = False; 461 bool neg = false; 462 const char *op; 452 463 453 464 if (strequal(*ops, "all")) { 454 log_all = True; 465 for (i=0; i<SMB_VFS_OP_LAST; i++) { 466 bitmap_set(bm, i); 467 } 468 continue; 469 } 470 471 if (strequal(*ops, "none")) { 455 472 break; 456 473 } 457 474 458 if (strequal(*ops, "none")) { 459 break; 475 op = ops[0]; 476 if (op[0] == '!') { 477 neg = true; 478 op += 1; 460 479 } 461 480 … … 465 484 "in sync with vfs.h\n"); 466 485 } 467 468 if (strequal(*ops, vfs_op_names[i].name)) { 469 bitmap_set(*bm, i); 470 found = True; 486 if (strequal(op, vfs_op_names[i].name)) { 487 if (neg) { 488 bitmap_clear(bm, i); 489 } else { 490 bitmap_set(bm, i); 491 } 492 break; 471 493 } 472 494 } 473 if ( !found) {495 if () { 474 496 DEBUG(0, ("Could not find opname %s, logging all\n", 475 497 *ops)); 476 log_all = True;477 break;498 ; 499 ; 478 500 } 479 ops += 1;480 501 } 481 482 if (log_all) { 483 /* The query functions default to True */ 484 bitmap_free(*bm); 485 *bm = NULL; 486 } 502 return bm; 487 503 } 488 504 … … 580 596 } 581 597 582 /* Free function for the private data. */583 584 static void free_private_data(void **p_data)585 {586 struct vfs_full_audit_private_data *pd = *(struct vfs_full_audit_private_data **)p_data;587 588 if (pd->success_ops) {589 bitmap_free(pd->success_ops);590 }591 if (pd->failure_ops) {592 bitmap_free(pd->failure_ops);593 }594 SAFE_FREE(pd);595 *p_data = NULL;596 }597 598 598 /* Implementation of vfs_ops. Pass everything on to the default 599 599 operation but log event first. */ … … 604 604 int result; 605 605 struct vfs_full_audit_private_data *pd = NULL; 606 const char *none[] = { NULL };607 const char *all [] = { "all" };608 606 609 607 result = SMB_VFS_NEXT_CONNECT(handle, svc, user); … … 612 610 } 613 611 614 pd = SMB_MALLOC_P(struct vfs_full_audit_private_data);612 pd = struct vfs_full_audit_private_data); 615 613 if (!pd) { 616 614 SMB_VFS_NEXT_DISCONNECT(handle); 617 615 return -1; 618 616 } 619 ZERO_STRUCTP(pd);620 617 621 618 #ifndef WITH_SYSLOG … … 623 620 #endif 624 621 625 init_bitmap(&pd->success_ops,626 lp_parm_string_list(SNUM(handle->conn), "full_audit", "success",627 none));628 init_bitmap(&pd->failure_ops,629 lp_parm_string_list(SNUM(handle->conn), "full_audit", "failure",630 all));622 623 ", 624 )); 625 626 ", 627 )); 631 628 632 629 /* Store the private data. */ 633 SMB_VFS_HANDLE_SET_DATA(handle, pd, free_private_data,630 SMB_VFS_HANDLE_SET_DATA(handle, pd, , 634 631 struct vfs_full_audit_private_data, return -1); 635 632 … … 699 696 static int smb_full_audit_get_shadow_copy_data(struct vfs_handle_struct *handle, 700 697 struct files_struct *fsp, 701 SHADOW_COPY_DATA *shadow_copy_data, bool labels) 698 struct shadow_copy_data *shadow_copy_data, 699 bool labels) 702 700 { 703 701 int result; … … 742 740 743 741 do_log(SMB_VFS_OP_OPENDIR, (result != NULL), handle, "%s", fname); 742 743 744 745 746 747 748 749 750 751 752 753 754 744 755 745 756 return result; … … 862 873 uint32_t oplock_request, 863 874 uint64_t allocation_size, 875 864 876 struct security_descriptor *sd, 865 877 struct ea_list *ea_list, … … 905 917 oplock_request, /* oplock_request */ 906 918 allocation_size, /* allocation_size */ 919 907 920 sd, /* sd */ 908 921 ea_list, /* ea_list */ … … 1099 1112 result = SMB_VFS_NEXT_GET_ALLOC_SIZE(handle, fsp, sbuf); 1100 1113 1101 do_log(SMB_VFS_OP_GET_ALLOC_SIZE, (result >= 0), handle, "%d", result); 1114 do_log(SMB_VFS_OP_GET_ALLOC_SIZE, (result != (uint64_t)-1), handle, 1115 "%llu", result); 1102 1116 1103 1117 return result; … … 1232 1246 } 1233 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1234 1263 static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp, 1235 1264 int op, SMB_OFF_T offset, SMB_OFF_T count, int type) … … 1334 1363 1335 1364 static char *smb_full_audit_realpath(vfs_handle_struct *handle, 1336 const char *path , char *resolved_path)1365 const char *path) 1337 1366 { 1338 1367 char *result; 1339 1368 1340 result = SMB_VFS_NEXT_REALPATH(handle, path , resolved_path);1369 result = SMB_VFS_NEXT_REALPATH(handle, path); 1341 1370 1342 1371 do_log(SMB_VFS_OP_REALPATH, (result != NULL), handle, "%s", path); … … 1536 1565 static NTSTATUS smb_full_audit_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, 1537 1566 uint32 security_info, 1538 SEC_DESC**ppdesc)1567 **ppdesc) 1539 1568 { 1540 1569 NTSTATUS result; … … 1551 1580 const char *name, 1552 1581 uint32 security_info, 1553 SEC_DESC**ppdesc)1582 **ppdesc) 1554 1583 { 1555 1584 NTSTATUS result; … … 1565 1594 static NTSTATUS smb_full_audit_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, 1566 1595 uint32 security_info_sent, 1567 const SEC_DESC*psd)1596 const *psd) 1568 1597 { 1569 1598 NTSTATUS result; … … 2178 2207 "%s", fsp_str_do_log(fsp)); 2179 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2180 2232 return result; 2181 2233 } … … 2194 2246 .fs_capabilities = smb_full_audit_fs_capabilities, 2195 2247 .opendir = smb_full_audit_opendir, 2248 2196 2249 .readdir = smb_full_audit_readdir, 2197 2250 .seekdir = smb_full_audit_seekdir, … … 2202 2255 .closedir = smb_full_audit_closedir, 2203 2256 .init_search_op = smb_full_audit_init_search_op, 2204 .open = smb_full_audit_open,2257 .open = smb_full_audit_open, 2205 2258 .create_file = smb_full_audit_create_file, 2206 2259 .close_fn = smb_full_audit_close, … … 2228 2281 .ntimes = smb_full_audit_ntimes, 2229 2282 .ftruncate = smb_full_audit_ftruncate, 2283 2230 2284 .lock = smb_full_audit_lock, 2231 2285 .kernel_flock = smb_full_audit_kernel_flock, … … 2296 2350 .aio_suspend = smb_full_audit_aio_suspend, 2297 2351 .aio_force = smb_full_audit_aio_force, 2352 2353 2298 2354 }; 2299 2355
Note:
See TracChangeset
for help on using the changeset viewer.
