diff options
author | Deryck Hodge <deryck@samba.org> | 2005-09-29 15:57:21 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:04:48 -0500 |
commit | 435295f1840aa8bd4c04f20a2348c6d701c6b7dc (patch) | |
tree | a77531db3df1312f7cef0ca9ace40abab152d9ab | |
parent | dbbaccc2c05ca2220dbbb74a7368304a89d31c9c (diff) | |
download | samba-435295f1840aa8bd4c04f20a2348c6d701c6b7dc.tar.gz samba-435295f1840aa8bd4c04f20a2348c6d701c6b7dc.tar.bz2 samba-435295f1840aa8bd4c04f20a2348c6d701c6b7dc.zip |
r10619: Allow syslog facility and priority to be set via
smb.conf for audit modules.
Facility may be set to USER or LOCAL0-LOCAL7. Any
of the syslog priority settings may be used.
smb.conf will look like:
audit:facility = LOCAL5
audit:priority = INFO
(Or full_audit:facility, or whatever audit module is used.)
deryck
(This used to be commit c619ee38f0aee43de571524c8ef3bf6b27b30e74)
-rw-r--r-- | source3/modules/vfs_audit.c | 43 | ||||
-rw-r--r-- | source3/modules/vfs_extd_audit.c | 43 | ||||
-rw-r--r-- | source3/modules/vfs_full_audit.c | 47 |
3 files changed, 99 insertions, 34 deletions
diff --git a/source3/modules/vfs_audit.c b/source3/modules/vfs_audit.c index 7d97962db0..9f5179a47c 100644 --- a/source3/modules/vfs_audit.c +++ b/source3/modules/vfs_audit.c @@ -77,21 +77,44 @@ static vfs_op_tuple audit_op_tuples[] = { static int audit_syslog_facility(vfs_handle_struct *handle) { - /* fix me: let this be configurable by: - * lp_param_enum(SNUM(handle->conn),(handle->param?handle->param:"audit"),"syslog facility", - * audit_enum_facility,LOG_USER); - */ - return LOG_USER; + static const struct enum_list enum_log_facilities[] = { + { LOG_USER, "USER" }, + { LOG_LOCAL0, "LOCAL0" }, + { LOG_LOCAL1, "LOCAL1" }, + { LOG_LOCAL2, "LOCAL2" }, + { LOG_LOCAL3, "LOCAL3" }, + { LOG_LOCAL4, "LOCAL4" }, + { LOG_LOCAL5, "LOCAL5" }, + { LOG_LOCAL6, "LOCAL6" }, + { LOG_LOCAL7, "LOCAL7" } + }; + + int facility; + + facility = lp_parm_enum(SNUM(handle->conn), "audit", "facility", enum_log_facilities, LOG_USER); + + return facility; } static int audit_syslog_priority(vfs_handle_struct *handle) { - /* fix me: let this be configurable by: - * lp_param_enum(SNUM(handle->conn),(handle->param?handle->param:"audit"),"syslog priority", - * audit_enum_priority,LOG_NOTICE); - */ - return LOG_NOTICE; + static const struct enum_list enum_log_priorities[] = { + { LOG_EMERG, "EMERG" }, + { LOG_ALERT, "ALERT" }, + { LOG_CRIT, "CRIT" }, + { LOG_ERR, "ERR" }, + { LOG_WARNING, "WARNING" }, + { LOG_NOTICE, "NOTICE" }, + { LOG_INFO, "INFO" }, + { LOG_DEBUG, "DEBUG" } + }; + + int priority; + + priority = lp_parm_enum(SNUM(handle->conn), "audit", "priority", enum_log_priorities, LOG_NOTICE); + + return priority; } /* Implementation of vfs_ops. Pass everything on to the default diff --git a/source3/modules/vfs_extd_audit.c b/source3/modules/vfs_extd_audit.c index d7bb980585..cb8c3ffd6a 100644 --- a/source3/modules/vfs_extd_audit.c +++ b/source3/modules/vfs_extd_audit.c @@ -80,21 +80,44 @@ static vfs_op_tuple audit_op_tuples[] = { static int audit_syslog_facility(vfs_handle_struct *handle) { - /* fix me: let this be configurable by: - * lp_param_enum(SNUM(handle->conn),(handle->param?handle->param:"extd_audit"),"syslog facility", - * audit_enum_facility,LOG_USER); - */ - return LOG_USER; + static const struct enum_list enum_log_facilities[] = { + { LOG_USER, "USER" }, + { LOG_LOCAL0, "LOCAL0" }, + { LOG_LOCAL1, "LOCAL1" }, + { LOG_LOCAL2, "LOCAL2" }, + { LOG_LOCAL3, "LOCAL3" }, + { LOG_LOCAL4, "LOCAL4" }, + { LOG_LOCAL5, "LOCAL5" }, + { LOG_LOCAL6, "LOCAL6" }, + { LOG_LOCAL7, "LOCAL7" } + }; + + int facility; + + facility = lp_parm_enum(SNUM(handle->conn), "extd_audit", "facility", enum_log_facilities, LOG_USER); + + return facility; } static int audit_syslog_priority(vfs_handle_struct *handle) { - /* fix me: let this be configurable by: - * lp_param_enum(SNUM(handle->conn),(handle->param?handle->param:"extd_audit"),"syslog priority", - * audit_enum_priority,LOG_NOTICE); - */ - return LOG_NOTICE; + static const struct enum_list enum_log_priorities[] = { + { LOG_EMERG, "EMERG" }, + { LOG_ALERT, "ALERT" }, + { LOG_CRIT, "CRIT" }, + { LOG_ERR, "ERR" }, + { LOG_WARNING, "WARNING" }, + { LOG_NOTICE, "NOTICE" }, + { LOG_INFO, "INFO" }, + { LOG_DEBUG, "DEBUG" } + }; + + int priority; + + priority = lp_parm_enum(SNUM(handle->conn), "extd_audit", "priority", enum_log_priorities, LOG_NOTICE); + + return priority; } /* Implementation of vfs_ops. Pass everything on to the default diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 175dda7a69..99d5244482 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -606,24 +606,43 @@ static struct { static int audit_syslog_facility(vfs_handle_struct *handle) { - /* fix me: let this be configurable by: - * lp_param_enum(SNUM(handle->conn), - * (handle->param?handle->param:"full_audit"), - * "syslog facility", - * audit_enum_facility,LOG_USER); - */ - return LOG_USER; + static const struct enum_list enum_log_facilities[] = { + { LOG_USER, "USER" }, + { LOG_LOCAL0, "LOCAL0" }, + { LOG_LOCAL1, "LOCAL1" }, + { LOG_LOCAL2, "LOCAL2" }, + { LOG_LOCAL3, "LOCAL3" }, + { LOG_LOCAL4, "LOCAL4" }, + { LOG_LOCAL5, "LOCAL5" }, + { LOG_LOCAL6, "LOCAL6" }, + { LOG_LOCAL7, "LOCAL7" } + }; + + int facility; + + facility = lp_parm_enum(SNUM(handle->conn), "full_audit", "facility", enum_log_facilities, LOG_USER); + + return facility; } static int audit_syslog_priority(vfs_handle_struct *handle) { - /* fix me: let this be configurable by: - * lp_param_enum(SNUM(handle->conn), - * (handle->param?handle->param:"full_audit"), - * "syslog priority", - * audit_enum_priority,LOG_NOTICE); - */ - return LOG_NOTICE; + static const struct enum_list enum_log_priorities[] = { + { LOG_EMERG, "EMERG" }, + { LOG_ALERT, "ALERT" }, + { LOG_CRIT, "CRIT" }, + { LOG_ERR, "ERR" }, + { LOG_WARNING, "WARNING" }, + { LOG_NOTICE, "NOTICE" }, + { LOG_INFO, "INFO" }, + { LOG_DEBUG, "DEBUG" } + }; + + int priority; + + priority = lp_parm_enum(SNUM(handle->conn), "full_audit", "priority", enum_log_priorities, LOG_NOTICE); + + return priority; } static char *audit_prefix(connection_struct *conn) |