summaryrefslogtreecommitdiff
path: root/source3/modules
diff options
context:
space:
mode:
authorKarolin Seeger <kseeger@samba.org>2009-01-21 18:31:30 +0100
committerKarolin Seeger <kseeger@samba.org>2009-01-21 18:32:38 +0100
commit3089cfcc4b75088db4dd5683902be81bc4ee48b4 (patch)
tree9375f7de497ccd735ef7184f5c452cc14ae0cf95 /source3/modules
parent1377f28f85118b97b723da6636a865499774b448 (diff)
downloadsamba-3089cfcc4b75088db4dd5683902be81bc4ee48b4.tar.gz
samba-3089cfcc4b75088db4dd5683902be81bc4ee48b4.tar.bz2
samba-3089cfcc4b75088db4dd5683902be81bc4ee48b4.zip
s3/vfs_extd_audit: Don't ignore "syslog = 0".
This fixes bug #5956. Thanks to Oskar Wycislak <cantorek [at] gmail.com> for reporting and providing a patch! Karolin
Diffstat (limited to 'source3/modules')
-rw-r--r--source3/modules/vfs_extd_audit.c145
1 files changed, 86 insertions, 59 deletions
diff --git a/source3/modules/vfs_extd_audit.c b/source3/modules/vfs_extd_audit.c
index 7516cba1d3..d7c9d39c5e 100644
--- a/source3/modules/vfs_extd_audit.c
+++ b/source3/modules/vfs_extd_audit.c
@@ -132,8 +132,11 @@ static int audit_connect(vfs_handle_struct *handle, const char *svc, const char
openlog("smbd_audit", LOG_PID, audit_syslog_facility(handle));
- syslog(audit_syslog_priority(handle), "connect to service %s by user %s\n",
- svc, user);
+ if (lp_syslog() > 0) {
+ syslog(audit_syslog_priority(handle),
+ "connect to service %s by user %s\n",
+ svc, user);
+ }
DEBUG(10, ("Connected to service %s as user %s\n",
svc, user));
@@ -144,7 +147,9 @@ static int audit_connect(vfs_handle_struct *handle, const char *svc, const char
static void audit_disconnect(vfs_handle_struct *handle)
{
- syslog(audit_syslog_priority(handle), "disconnected\n");
+ if (lp_syslog() > 0) {
+ syslog(audit_syslog_priority(handle), "disconnected\n");
+ }
DEBUG(10, ("Disconnected from VFS module extd_audit\n"));
SMB_VFS_NEXT_DISCONNECT(handle);
@@ -157,10 +162,12 @@ static SMB_STRUCT_DIR *audit_opendir(vfs_handle_struct *handle, const char *fnam
result = SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
- syslog(audit_syslog_priority(handle), "opendir %s %s%s\n",
- fname,
- (result == NULL) ? "failed: " : "",
- (result == NULL) ? strerror(errno) : "");
+ if (lp_syslog() > 0) {
+ syslog(audit_syslog_priority(handle), "opendir %s %s%s\n",
+ fname,
+ (result == NULL) ? "failed: " : "",
+ (result == NULL) ? strerror(errno) : "");
+ }
DEBUG(1, ("vfs_extd_audit: opendir %s %s %s\n",
fname,
(result == NULL) ? "failed: " : "",
@@ -172,13 +179,15 @@ static SMB_STRUCT_DIR *audit_opendir(vfs_handle_struct *handle, const char *fnam
static int audit_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode)
{
int result;
-
+
result = SMB_VFS_NEXT_MKDIR(handle, path, mode);
-
- syslog(audit_syslog_priority(handle), "mkdir %s %s%s\n",
- path,
- (result < 0) ? "failed: " : "",
- (result < 0) ? strerror(errno) : "");
+
+ if (lp_syslog() > 0) {
+ syslog(audit_syslog_priority(handle), "mkdir %s %s%s\n",
+ path,
+ (result < 0) ? "failed: " : "",
+ (result < 0) ? strerror(errno) : "");
+ }
DEBUG(0, ("vfs_extd_audit: mkdir %s %s %s\n",
path,
(result < 0) ? "failed: " : "",
@@ -190,13 +199,15 @@ static int audit_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode)
static int audit_rmdir(vfs_handle_struct *handle, const char *path)
{
int result;
-
+
result = SMB_VFS_NEXT_RMDIR(handle, path);
- syslog(audit_syslog_priority(handle), "rmdir %s %s%s\n",
- path,
- (result < 0) ? "failed: " : "",
- (result < 0) ? strerror(errno) : "");
+ if (lp_syslog() > 0) {
+ syslog(audit_syslog_priority(handle), "rmdir %s %s%s\n",
+ path,
+ (result < 0) ? "failed: " : "",
+ (result < 0) ? strerror(errno) : "");
+ }
DEBUG(0, ("vfs_extd_audit: rmdir %s %s %s\n",
path,
(result < 0) ? "failed: " : "",
@@ -208,14 +219,16 @@ static int audit_rmdir(vfs_handle_struct *handle, const char *path)
static int audit_open(vfs_handle_struct *handle, const char *fname, files_struct *fsp, int flags, mode_t mode)
{
int result;
-
+
result = SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode);
- syslog(audit_syslog_priority(handle), "open %s (fd %d) %s%s%s\n",
- fname, result,
- ((flags & O_WRONLY) || (flags & O_RDWR)) ? "for writing " : "",
- (result < 0) ? "failed: " : "",
- (result < 0) ? strerror(errno) : "");
+ if (lp_syslog() > 0) {
+ syslog(audit_syslog_priority(handle), "open %s (fd %d) %s%s%s\n",
+ fname, result,
+ ((flags & O_WRONLY) || (flags & O_RDWR)) ? "for writing " : "",
+ (result < 0) ? "failed: " : "",
+ (result < 0) ? strerror(errno) : "");
+ }
DEBUG(2, ("vfs_extd_audit: open %s %s %s\n",
fname,
(result < 0) ? "failed: " : "",
@@ -227,13 +240,15 @@ static int audit_open(vfs_handle_struct *handle, const char *fname, files_struct
static int audit_close(vfs_handle_struct *handle, files_struct *fsp)
{
int result;
-
+
result = SMB_VFS_NEXT_CLOSE(handle, fsp);
- syslog(audit_syslog_priority(handle), "close fd %d %s%s\n",
- fsp->fh->fd,
- (result < 0) ? "failed: " : "",
- (result < 0) ? strerror(errno) : "");
+ if (lp_syslog() > 0) {
+ syslog(audit_syslog_priority(handle), "close fd %d %s%s\n",
+ fsp->fh->fd,
+ (result < 0) ? "failed: " : "",
+ (result < 0) ? strerror(errno) : "");
+ }
DEBUG(2, ("vfs_extd_audit: close fd %d %s %s\n",
fsp->fh->fd,
(result < 0) ? "failed: " : "",
@@ -245,31 +260,35 @@ static int audit_close(vfs_handle_struct *handle, files_struct *fsp)
static int audit_rename(vfs_handle_struct *handle, const char *oldname, const char *newname)
{
int result;
-
+
result = SMB_VFS_NEXT_RENAME(handle, oldname, newname);
- syslog(audit_syslog_priority(handle), "rename %s -> %s %s%s\n",
- oldname, newname,
- (result < 0) ? "failed: " : "",
- (result < 0) ? strerror(errno) : "");
+ if (lp_syslog() > 0) {
+ syslog(audit_syslog_priority(handle), "rename %s -> %s %s%s\n",
+ oldname, newname,
+ (result < 0) ? "failed: " : "",
+ (result < 0) ? strerror(errno) : "");
+ }
DEBUG(1, ("vfs_extd_audit: rename old: %s newname: %s %s %s\n",
oldname, newname,
(result < 0) ? "failed: " : "",
(result < 0) ? strerror(errno) : ""));
- return result;
+ return result;
}
static int audit_unlink(vfs_handle_struct *handle, const char *path)
{
int result;
-
+
result = SMB_VFS_NEXT_UNLINK(handle, path);
- syslog(audit_syslog_priority(handle), "unlink %s %s%s\n",
- path,
- (result < 0) ? "failed: " : "",
- (result < 0) ? strerror(errno) : "");
+ if (lp_syslog() > 0) {
+ syslog(audit_syslog_priority(handle), "unlink %s %s%s\n",
+ path,
+ (result < 0) ? "failed: " : "",
+ (result < 0) ? strerror(errno) : "");
+ }
DEBUG(0, ("vfs_extd_audit: unlink %s %s %s\n",
path,
(result < 0) ? "failed: " : "",
@@ -284,10 +303,12 @@ static int audit_chmod(vfs_handle_struct *handle, const char *path, mode_t mode)
result = SMB_VFS_NEXT_CHMOD(handle, path, mode);
- syslog(audit_syslog_priority(handle), "chmod %s mode 0x%x %s%s\n",
- path, mode,
- (result < 0) ? "failed: " : "",
- (result < 0) ? strerror(errno) : "");
+ if (lp_syslog() > 0) {
+ syslog(audit_syslog_priority(handle), "chmod %s mode 0x%x %s%s\n",
+ path, mode,
+ (result < 0) ? "failed: " : "",
+ (result < 0) ? strerror(errno) : "");
+ }
DEBUG(1, ("vfs_extd_audit: chmod %s mode 0x%x %s %s\n",
path, mode,
(result < 0) ? "failed: " : "",
@@ -299,13 +320,15 @@ static int audit_chmod(vfs_handle_struct *handle, const char *path, mode_t mode)
static int audit_chmod_acl(vfs_handle_struct *handle, const char *path, mode_t mode)
{
int result;
-
+
result = SMB_VFS_NEXT_CHMOD_ACL(handle, path, mode);
- syslog(audit_syslog_priority(handle), "chmod_acl %s mode 0x%x %s%s\n",
- path, mode,
- (result < 0) ? "failed: " : "",
- (result < 0) ? strerror(errno) : "");
+ if (lp_syslog() > 0) {
+ syslog(audit_syslog_priority(handle), "chmod_acl %s mode 0x%x %s%s\n",
+ path, mode,
+ (result < 0) ? "failed: " : "",
+ (result < 0) ? strerror(errno) : "");
+ }
DEBUG(1, ("vfs_extd_audit: chmod_acl %s mode 0x%x %s %s\n",
path, mode,
(result < 0) ? "failed: " : "",
@@ -317,13 +340,15 @@ static int audit_chmod_acl(vfs_handle_struct *handle, const char *path, mode_t m
static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
{
int result;
-
+
result = SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
- syslog(audit_syslog_priority(handle), "fchmod %s mode 0x%x %s%s\n",
- fsp->fsp_name, mode,
- (result < 0) ? "failed: " : "",
- (result < 0) ? strerror(errno) : "");
+ if (lp_syslog() > 0) {
+ syslog(audit_syslog_priority(handle), "fchmod %s mode 0x%x %s%s\n",
+ fsp->fsp_name, mode,
+ (result < 0) ? "failed: " : "",
+ (result < 0) ? strerror(errno) : "");
+ }
DEBUG(1, ("vfs_extd_audit: fchmod %s mode 0x%x %s %s",
fsp->fsp_name, mode,
(result < 0) ? "failed: " : "",
@@ -335,13 +360,15 @@ static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mod
static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
{
int result;
-
+
result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode);
- syslog(audit_syslog_priority(handle), "fchmod_acl %s mode 0x%x %s%s\n",
- fsp->fsp_name, mode,
- (result < 0) ? "failed: " : "",
- (result < 0) ? strerror(errno) : "");
+ if (lp_syslog() > 0) {
+ syslog(audit_syslog_priority(handle), "fchmod_acl %s mode 0x%x %s%s\n",
+ fsp->fsp_name, mode,
+ (result < 0) ? "failed: " : "",
+ (result < 0) ? strerror(errno) : "");
+ }
DEBUG(1, ("vfs_extd_audit: fchmod_acl %s mode 0x%x %s %s",
fsp->fsp_name, mode,
(result < 0) ? "failed: " : "",