vfs_full_audit: Save full_audit:priority in private_data
authorVolker Lendecke <vl@samba.org>
Thu, 7 Aug 2014 10:34:18 +0000 (10:34 +0000)
committerJeremy Allison <jra@samba.org>
Thu, 7 Aug 2014 20:12:12 +0000 (22:12 +0200)
lp_parm_enum can become expensive

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_full_audit.c

index ec886c52bd0f6092ee43af73bb316ac220e1d065..00af87c53beb084d9e6c08db471f1d7771abaeb1 100644 (file)
@@ -74,6 +74,7 @@ struct vfs_full_audit_private_data {
        struct bitmap *success_ops;
        struct bitmap *failure_ops;
        int syslog_facility;
+       int syslog_priority;
 };
 
 #undef DBGC_CLASS
@@ -521,7 +522,7 @@ static void do_log(vfs_op_type op, bool success, vfs_handle_struct *handle,
         * Specify the facility to interoperate with other syslog callers
         * (smbd for example).
         */
-       priority = audit_syslog_priority(handle) | pd->syslog_facility;
+       priority = pd->syslog_priority | pd->syslog_facility;
 
        audit_pre = audit_prefix(talloc_tos(), handle->conn);
        syslog(priority, "%s|%s|%s|%s\n",
@@ -590,6 +591,8 @@ static int smb_full_audit_connect(vfs_handle_struct *handle,
                return -1;
        }
 
+       pd->syslog_priority = audit_syslog_priority(handle);
+
 #ifdef WITH_SYSLOG
        openlog("smbd_audit", 0, pd->syslog_facility);
 #endif