Ignore:
Timestamp:
Nov 14, 2012, 12:59:34 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to 3.6.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/modules/vfs_full_audit.c

    r478 r740  
    5959
    6060#include "includes.h"
     61
     62
     63
     64
     65
     66
    6167
    6268static int vfs_full_audit_debug_level = DBGC_VFS;
     
    8793
    8894        SMB_VFS_OP_OPENDIR,
     95
    8996        SMB_VFS_OP_READDIR,
    9097        SMB_VFS_OP_SEEKDIR,
     
    124131        SMB_VFS_OP_NTIMES,
    125132        SMB_VFS_OP_FTRUNCATE,
     133
    126134        SMB_VFS_OP_LOCK,
    127135        SMB_VFS_OP_KERNEL_FLOCK,
     
    228236        { SMB_VFS_OP_FS_CAPABILITIES,   "fs_capabilities" },
    229237        { SMB_VFS_OP_OPENDIR,   "opendir" },
     238
    230239        { SMB_VFS_OP_READDIR,   "readdir" },
    231240        { SMB_VFS_OP_SEEKDIR,   "seekdir" },
     
    262271        { SMB_VFS_OP_NTIMES,    "ntimes" },
    263272        { SMB_VFS_OP_FTRUNCATE, "ftruncate" },
     273
    264274        { SMB_VFS_OP_LOCK,      "lock" },
    265275        { SMB_VFS_OP_KERNEL_FLOCK,      "kernel_flock" },
     
    330340        { SMB_VFS_OP_AIO_SUSPEND,"aio_suspend" },
    331341        { 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" },
    334344        { SMB_VFS_OP_LAST, NULL }
    335345};
     
    393403        result = talloc_sub_advanced(ctx,
    394404                        lp_servicename(SNUM(conn)),
    395                         conn->server_info->unix_name,
     405                        conn->se_info->unix_name,
    396406                        conn->connectpath,
    397                         conn->server_info->utok.gid,
    398                         conn->server_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                        ,
    400410                        prefix);
    401411        TALLOC_FREE(prefix);
     
    432442}
    433443
    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) {
     444static , 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) {
    444454                DEBUG(0, ("Could not alloc bitmap -- "
    445455                          "defaulting to logging everything\n"));
    446                 return;
     456                return;
    447457        }
    448458
    449         while (*ops != NULL) {
     459        ) {
    450460                int i;
    451                 bool found = False;
     461                bool neg = false;
     462                const char *op;
    452463
    453464                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")) {
    455472                        break;
    456473                }
    457474
    458                 if (strequal(*ops, "none")) {
    459                         break;
     475                op = ops[0];
     476                if (op[0] == '!') {
     477                        neg = true;
     478                        op += 1;
    460479                }
    461480
     
    465484                                          "in sync with vfs.h\n");
    466485                        }
    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;
    471493                        }
    472494                }
    473                 if (!found) {
     495                if () {
    474496                        DEBUG(0, ("Could not find opname %s, logging all\n",
    475497                                  *ops));
    476                         log_all = True;
    477                         break;
     498                        ;
     499                        ;
    478500                }
    479                 ops += 1;
    480501        }
    481 
    482         if (log_all) {
    483                 /* The query functions default to True */
    484                 bitmap_free(*bm);
    485                 *bm = NULL;
    486         }
     502        return bm;
    487503}
    488504
     
    580596}
    581597
    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 
    598598/* Implementation of vfs_ops.  Pass everything on to the default
    599599   operation but log event first. */
     
    604604        int result;
    605605        struct vfs_full_audit_private_data *pd = NULL;
    606         const char *none[] = { NULL };
    607         const char *all [] = { "all" };
    608606
    609607        result = SMB_VFS_NEXT_CONNECT(handle, svc, user);
     
    612610        }
    613611
    614         pd = SMB_MALLOC_P(struct vfs_full_audit_private_data);
     612        pd = struct vfs_full_audit_private_data);
    615613        if (!pd) {
    616614                SMB_VFS_NEXT_DISCONNECT(handle);
    617615                return -1;
    618616        }
    619         ZERO_STRUCTP(pd);
    620617
    621618#ifndef WITH_SYSLOG
     
    623620#endif
    624621
    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                                        ));
    631628
    632629        /* Store the private data. */
    633         SMB_VFS_HANDLE_SET_DATA(handle, pd, free_private_data,
     630        SMB_VFS_HANDLE_SET_DATA(handle, pd, ,
    634631                                struct vfs_full_audit_private_data, return -1);
    635632
     
    699696static int smb_full_audit_get_shadow_copy_data(struct vfs_handle_struct *handle,
    700697                                struct files_struct *fsp,
    701                                 SHADOW_COPY_DATA *shadow_copy_data, bool labels)
     698                                struct shadow_copy_data *shadow_copy_data,
     699                                bool labels)
    702700{
    703701        int result;
     
    742740
    743741        do_log(SMB_VFS_OP_OPENDIR, (result != NULL), handle, "%s", fname);
     742
     743
     744
     745
     746
     747
     748
     749
     750
     751
     752
     753
     754
    744755
    745756        return result;
     
    862873                                      uint32_t oplock_request,
    863874                                      uint64_t allocation_size,
     875
    864876                                      struct security_descriptor *sd,
    865877                                      struct ea_list *ea_list,
     
    905917                oplock_request,                         /* oplock_request */
    906918                allocation_size,                        /* allocation_size */
     919
    907920                sd,                                     /* sd */
    908921                ea_list,                                /* ea_list */
     
    10991112        result = SMB_VFS_NEXT_GET_ALLOC_SIZE(handle, fsp, sbuf);
    11001113
    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);
    11021116
    11031117        return result;
     
    12321246}
    12331247
     1248
     1249
     1250
     1251
     1252
     1253
     1254
     1255
     1256
     1257
     1258
     1259
     1260
     1261
     1262
    12341263static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp,
    12351264                       int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
     
    13341363
    13351364static char *smb_full_audit_realpath(vfs_handle_struct *handle,
    1336                             const char *path, char *resolved_path)
     1365                            const char *path)
    13371366{
    13381367        char *result;
    13391368
    1340         result = SMB_VFS_NEXT_REALPATH(handle, path, resolved_path);
     1369        result = SMB_VFS_NEXT_REALPATH(handle, path);
    13411370
    13421371        do_log(SMB_VFS_OP_REALPATH, (result != NULL), handle, "%s", path);
     
    15361565static NTSTATUS smb_full_audit_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
    15371566                                uint32 security_info,
    1538                                 SEC_DESC **ppdesc)
     1567                                **ppdesc)
    15391568{
    15401569        NTSTATUS result;
     
    15511580                                          const char *name,
    15521581                                          uint32 security_info,
    1553                                           SEC_DESC **ppdesc)
     1582                                          **ppdesc)
    15541583{
    15551584        NTSTATUS result;
     
    15651594static NTSTATUS smb_full_audit_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
    15661595                              uint32 security_info_sent,
    1567                               const SEC_DESC *psd)
     1596                              const *psd)
    15681597{
    15691598        NTSTATUS result;
     
    21782207                "%s", fsp_str_do_log(fsp));
    21792208
     2209
     2210
     2211
     2212
     2213
     2214
     2215
     2216
     2217
     2218
     2219
     2220
     2221
     2222
     2223
     2224
     2225
     2226
     2227
     2228
     2229
     2230
     2231
    21802232        return result;
    21812233}
     
    21942246        .fs_capabilities = smb_full_audit_fs_capabilities,
    21952247        .opendir = smb_full_audit_opendir,
     2248
    21962249        .readdir = smb_full_audit_readdir,
    21972250        .seekdir = smb_full_audit_seekdir,
     
    22022255        .closedir = smb_full_audit_closedir,
    22032256        .init_search_op = smb_full_audit_init_search_op,
    2204         .open = smb_full_audit_open,
     2257        .open = smb_full_audit_open,
    22052258        .create_file = smb_full_audit_create_file,
    22062259        .close_fn = smb_full_audit_close,
     
    22282281        .ntimes = smb_full_audit_ntimes,
    22292282        .ftruncate = smb_full_audit_ftruncate,
     2283
    22302284        .lock = smb_full_audit_lock,
    22312285        .kernel_flock = smb_full_audit_kernel_flock,
     
    22962350        .aio_suspend = smb_full_audit_aio_suspend,
    22972351        .aio_force = smb_full_audit_aio_force,
     2352
     2353
    22982354};
    22992355
Note: See TracChangeset for help on using the changeset viewer.