1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00

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
This commit is contained in:
Karolin Seeger 2009-01-21 18:31:30 +01:00
parent 1377f28f85
commit 3089cfcc4b

View File

@ -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: " : "",
@ -175,10 +182,12 @@ static int audit_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode)
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: " : "",
@ -193,10 +202,12 @@ static int audit_rmdir(vfs_handle_struct *handle, const char *path)
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: " : "",
@ -211,11 +222,13 @@ static int audit_open(vfs_handle_struct *handle, const char *fname, files_struct
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: " : "",
@ -230,10 +243,12 @@ static int audit_close(vfs_handle_struct *handle, files_struct *fsp)
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: " : "",
@ -248,10 +263,12 @@ static int audit_rename(vfs_handle_struct *handle, const char *oldname, const ch
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: " : "",
@ -266,10 +283,12 @@ static int audit_unlink(vfs_handle_struct *handle, const char *path)
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: " : "",
@ -302,10 +323,12 @@ static int audit_chmod_acl(vfs_handle_struct *handle, const char *path, mode_t m
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: " : "",
@ -320,10 +343,12 @@ static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mod
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: " : "",
@ -338,10 +363,12 @@ static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t
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: " : "",