return tmp_do_log_ctx;
}
-static void do_log(vfs_op_type op, bool success, vfs_handle_struct *handle,
- const char *format, ...) PRINTF_ATTRIBUTE(4, 5);
+static void do_log(vfs_op_type op,
+ const char *msg,
+ vfs_handle_struct *handle,
+ const char *format,
+ ...) PRINTF_ATTRIBUTE(4, 5);
-static void do_log(vfs_op_type op, bool success, vfs_handle_struct *handle,
- const char *format, ...)
+/*
+ * Logging as success if msg==NULL, otherwise msg is expected to be
+ * strerror or nt_errstr
+ */
+static void do_log(vfs_op_type op,
+ const char *msg,
+ vfs_handle_struct *handle,
+ const char *format,
+ ...)
{
+ bool success = (msg == NULL);
struct vfs_full_audit_private_data *pd;
fstring err_msg;
char *audit_pre = NULL;
if (success)
fstrcpy(err_msg, "ok");
else
- fstr_sprintf(err_msg, "fail (%s)", strerror(errno));
+ fstr_sprintf(err_msg, "fail (%s)", msg);
va_start(ap, format);
op_msg = talloc_vasprintf(talloc_tos(), format, ap);
TALLOC_FREE(tmp_do_log_ctx);
}
+static const char *errmsg_unix(int result)
+{
+ if (result >= 0) {
+ return NULL;
+ }
+ return strerror(errno);
+}
+
+static const char *errmsg_ntstatus(NTSTATUS status)
+{
+ if (NT_STATUS_IS_OK(status)) {
+ return NULL;
+ }
+ return nt_errstr(status);
+}
+
/**
* Return a string using the do_log_ctx()
*/
SMB_VFS_HANDLE_SET_DATA(handle, pd, NULL,
struct vfs_full_audit_private_data, return -1);
- do_log(SMB_VFS_OP_CONNECT, True, handle,
- "%s", svc);
+ do_log(SMB_VFS_OP_CONNECT, NULL, handle, "%s", svc);
return 0;
}
SMB_VFS_NEXT_DISCONNECT(handle);
- do_log(SMB_VFS_OP_DISCONNECT, True, handle,
- "%s", lp_servicename(talloc_tos(), lp_sub, SNUM(handle->conn)));
+ do_log(SMB_VFS_OP_DISCONNECT,
+ NULL,
+ handle,
+ "%s",
+ lp_servicename(talloc_tos(), lp_sub, SNUM(handle->conn)));
/* The bitmaps will be disconnected when the private
data is deleted. */
/* Don't have a reasonable notion of failure here */
do_log(SMB_VFS_OP_DISK_FREE,
- True,
+ NULL,
handle,
"%s",
smb_fname_str_do_log(handle->conn, smb_fname));
result = SMB_VFS_NEXT_GET_QUOTA(handle, smb_fname, qtype, id, qt);
do_log(SMB_VFS_OP_GET_QUOTA,
- (result >= 0),
+ errmsg_unix(result),
handle,
"%s",
smb_fname_str_do_log(handle->conn, smb_fname));
result = SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, qt);
- do_log(SMB_VFS_OP_SET_QUOTA, (result >= 0), handle, "");
+ do_log(SMB_VFS_OP_SET_QUOTA, errmsg_unix(result), handle, "");
return result;
}
result = SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data, labels);
- do_log(SMB_VFS_OP_GET_SHADOW_COPY_DATA, (result >= 0), handle, "");
+ do_log(SMB_VFS_OP_GET_SHADOW_COPY_DATA,
+ errmsg_unix(result),
+ handle,
+ "");
return result;
}
result = SMB_VFS_NEXT_STATVFS(handle, smb_fname, statbuf);
- do_log(SMB_VFS_OP_STATVFS, (result >= 0), handle, "");
+ do_log(SMB_VFS_OP_STATVFS, errmsg_unix(result), handle, "");
return result;
}
result = SMB_VFS_NEXT_FS_CAPABILITIES(handle, p_ts_res);
- do_log(SMB_VFS_OP_FS_CAPABILITIES, true, handle, "");
+ do_log(SMB_VFS_OP_FS_CAPABILITIES, NULL, handle, "");
return result;
}
status = SMB_VFS_NEXT_GET_DFS_REFERRALS(handle, r);
- do_log(SMB_VFS_OP_GET_DFS_REFERRALS, NT_STATUS_IS_OK(status),
- handle, "");
+ do_log(SMB_VFS_OP_GET_DFS_REFERRALS,
+ errmsg_ntstatus(status),
+ handle,
+ "");
return status;
}
referral_count);
do_log(SMB_VFS_OP_CREATE_DFS_PATHAT,
- NT_STATUS_IS_OK(status),
- handle,
- "%s",
- smb_fname_str_do_log(handle->conn, full_fname));
+ errmsg_ntstatus(status),
+ handle,
+ "%s",
+ smb_fname_str_do_log(handle->conn, full_fname));
TALLOC_FREE(full_fname);
return status;
preferral_count);
do_log(SMB_VFS_OP_READ_DFS_PATHAT,
- NT_STATUS_IS_OK(status),
- handle,
- "%s",
- smb_fname_str_do_log(handle->conn, full_fname));
+ errmsg_ntstatus(status),
+ handle,
+ "%s",
+ smb_fname_str_do_log(handle->conn, full_fname));
TALLOC_FREE(full_fname);
return status;
status = SMB_VFS_NEXT_SNAP_CHECK_PATH(handle, mem_ctx, service_path,
base_volume);
- do_log(SMB_VFS_OP_SNAP_CHECK_PATH, NT_STATUS_IS_OK(status),
- handle, "");
+ do_log(SMB_VFS_OP_SNAP_CHECK_PATH,
+ errmsg_ntstatus(status),
+ handle,
+ "");
return status;
}
status = SMB_VFS_NEXT_SNAP_CREATE(handle, mem_ctx, base_volume, tstamp,
rw, base_path, snap_path);
- do_log(SMB_VFS_OP_SNAP_CREATE, NT_STATUS_IS_OK(status), handle, "");
+ do_log(SMB_VFS_OP_SNAP_CREATE, errmsg_ntstatus(status), handle, "");
return status;
}
status = SMB_VFS_NEXT_SNAP_DELETE(handle, mem_ctx, base_path,
snap_path);
- do_log(SMB_VFS_OP_SNAP_DELETE, NT_STATUS_IS_OK(status), handle, "");
+ do_log(SMB_VFS_OP_SNAP_DELETE, errmsg_ntstatus(status), handle, "");
return status;
}
result = SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr);
- do_log(SMB_VFS_OP_FDOPENDIR, (result != NULL), handle, "%s",
- fsp_str_do_log(fsp));
+ do_log(SMB_VFS_OP_FDOPENDIR,
+ result == NULL ? strerror(errno) : NULL,
+ handle,
+ "%s",
+ fsp_str_do_log(fsp));
return result;
}
/* This operation has no reasonable error condition
* (End of dir is also failure), so always succeed.
*/
- do_log(SMB_VFS_OP_READDIR, True, handle, "");
+ do_log(SMB_VFS_OP_READDIR, NULL, handle, "");
return result;
}
{
SMB_VFS_NEXT_REWINDDIR(handle, dirp);
- do_log(SMB_VFS_OP_REWINDDIR, True, handle, "");
+ do_log(SMB_VFS_OP_REWINDDIR, NULL, handle, "");
}
static int smb_full_audit_mkdirat(vfs_handle_struct *handle,
mode);
do_log(SMB_VFS_OP_MKDIRAT,
- (result >= 0),
+ errmsg_unix(result),
handle,
"%s",
smb_fname_str_do_log(handle->conn, full_fname));
result = SMB_VFS_NEXT_CLOSEDIR(handle, dirp);
- do_log(SMB_VFS_OP_CLOSEDIR, (result >= 0), handle, "");
+ do_log(SMB_VFS_OP_CLOSEDIR, errmsg_unix(result), handle, "");
return result;
}
result = SMB_VFS_NEXT_OPENAT(handle, dirfsp, smb_fname, fsp, how);
- do_log(SMB_VFS_OP_OPENAT, (result >= 0), handle, "%s|%s",
- ((how->flags & O_WRONLY) || (how->flags & O_RDWR))?"w":"r",
+ do_log(SMB_VFS_OP_OPENAT,
+ errmsg_unix(result),
+ handle,
+ "%s|%s",
+ ((how->flags & O_WRONLY) || (how->flags & O_RDWR)) ? "w" : "r",
fsp_str_do_log(fsp));
return result;
pinfo, /* pinfo */
in_context_blobs, out_context_blobs); /* create context */
- do_log(SMB_VFS_OP_CREATE_FILE, (NT_STATUS_IS_OK(result)), handle,
- "0x%x|%s|%s|%s", access_mask,
+ do_log(SMB_VFS_OP_CREATE_FILE,
+ errmsg_ntstatus(result),
+ handle,
+ "0x%x|%s|%s|%s",
+ access_mask,
create_options & FILE_DIRECTORY_FILE ? "dir" : "file",
str_create_disposition,
- smb_fname_str_do_log(handle->conn, smb_fname));
+ smb_fname_str_do_log(handle->conn, smb_fname));
return result;
}
result = SMB_VFS_NEXT_CLOSE(handle, fsp);
- do_log(SMB_VFS_OP_CLOSE, (result >= 0), handle, "%s",
+ do_log(SMB_VFS_OP_CLOSE,
+ errmsg_unix(result),
+ handle,
+ "%s",
fsp_str_do_log(fsp));
return result;
result = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
- do_log(SMB_VFS_OP_PREAD, (result >= 0), handle, "%s",
+ do_log(SMB_VFS_OP_PREAD,
+ errmsg_unix(result),
+ handle,
+ "%s",
fsp_str_do_log(fsp));
return result;
req = tevent_req_create(mem_ctx, &state,
struct smb_full_audit_pread_state);
if (req == NULL) {
- do_log(SMB_VFS_OP_PREAD_SEND, false, handle, "%s",
+ do_log(SMB_VFS_OP_PREAD_SEND,
+ strerror(ENOMEM),
+ handle,
+ "%s",
fsp_str_do_log(fsp));
return NULL;
}
subreq = SMB_VFS_NEXT_PREAD_SEND(state, ev, handle, fsp, data,
n, offset);
if (tevent_req_nomem(subreq, req)) {
- do_log(SMB_VFS_OP_PREAD_SEND, false, handle, "%s",
+ do_log(SMB_VFS_OP_PREAD_SEND,
+ strerror(ENOMEM),
+ handle,
+ "%s",
fsp_str_do_log(fsp));
return tevent_req_post(req, ev);
}
tevent_req_set_callback(subreq, smb_full_audit_pread_done, req);
- do_log(SMB_VFS_OP_PREAD_SEND, true, handle, "%s", fsp_str_do_log(fsp));
+ do_log(SMB_VFS_OP_PREAD_SEND, NULL, handle, "%s", fsp_str_do_log(fsp));
return req;
}
req, struct smb_full_audit_pread_state);
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
- do_log(SMB_VFS_OP_PREAD_RECV, false, state->handle, "%s",
+ do_log(SMB_VFS_OP_PREAD_RECV,
+ errmsg_unix(vfs_aio_state->error),
+ state->handle,
+ "%s",
fsp_str_do_log(state->fsp));
return -1;
}
- do_log(SMB_VFS_OP_PREAD_RECV, (state->ret >= 0), state->handle, "%s",
+ do_log(SMB_VFS_OP_PREAD_RECV,
+ NULL,
+ state->handle,
+ "%s",
fsp_str_do_log(state->fsp));
*vfs_aio_state = state->vfs_aio_state;
result = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
- do_log(SMB_VFS_OP_PWRITE, (result >= 0), handle, "%s",
+ do_log(SMB_VFS_OP_PWRITE,
+ errmsg_unix(result),
+ handle,
+ "%s",
fsp_str_do_log(fsp));
return result;
req = tevent_req_create(mem_ctx, &state,
struct smb_full_audit_pwrite_state);
if (req == NULL) {
- do_log(SMB_VFS_OP_PWRITE_SEND, false, handle, "%s",
+ do_log(SMB_VFS_OP_PWRITE_SEND,
+ strerror(ENOMEM),
+ handle,
+ "%s",
fsp_str_do_log(fsp));
return NULL;
}
subreq = SMB_VFS_NEXT_PWRITE_SEND(state, ev, handle, fsp, data,
n, offset);
if (tevent_req_nomem(subreq, req)) {
- do_log(SMB_VFS_OP_PWRITE_SEND, false, handle, "%s",
+ do_log(SMB_VFS_OP_PWRITE_SEND,
+ strerror(ENOMEM),
+ handle,
+ "%s",
fsp_str_do_log(fsp));
return tevent_req_post(req, ev);
}
tevent_req_set_callback(subreq, smb_full_audit_pwrite_done, req);
- do_log(SMB_VFS_OP_PWRITE_SEND, true, handle, "%s",
+ do_log(SMB_VFS_OP_PWRITE_SEND,
+ NULL,
+ handle,
+ "%s",
fsp_str_do_log(fsp));
return req;
}
req, struct smb_full_audit_pwrite_state);
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
- do_log(SMB_VFS_OP_PWRITE_RECV, false, state->handle, "%s",
+ do_log(SMB_VFS_OP_PWRITE_RECV,
+ errmsg_unix(vfs_aio_state->error),
+ state->handle,
+ "%s",
fsp_str_do_log(state->fsp));
return -1;
}
- do_log(SMB_VFS_OP_PWRITE_RECV, (state->ret >= 0), state->handle, "%s",
+ do_log(SMB_VFS_OP_PWRITE_RECV,
+ NULL,
+ state->handle,
+ "%s",
fsp_str_do_log(state->fsp));
*vfs_aio_state = state->vfs_aio_state;
result = SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence);
- do_log(SMB_VFS_OP_LSEEK, (result != (ssize_t)-1), handle,
- "%s", fsp_str_do_log(fsp));
+ do_log(SMB_VFS_OP_LSEEK,
+ result == -1 ? strerror(errno) : NULL,
+ handle,
+ "%s",
+ fsp_str_do_log(fsp));
return result;
}
result = SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n);
- do_log(SMB_VFS_OP_SENDFILE, (result >= 0), handle,
- "%s", fsp_str_do_log(fromfsp));
+ do_log(SMB_VFS_OP_SENDFILE,
+ errmsg_unix(result),
+ handle,
+ "%s",
+ fsp_str_do_log(fromfsp));
return result;
}
result = SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n);
- do_log(SMB_VFS_OP_RECVFILE, (result >= 0), handle,
- "%s", fsp_str_do_log(tofsp));
+ do_log(SMB_VFS_OP_RECVFILE,
+ errmsg_unix(result),
+ handle,
+ "%s",
+ fsp_str_do_log(tofsp));
return result;
}
src_dirfsp,
smb_fname_src);
if (full_fname_src == NULL) {
+ do_log(SMB_VFS_OP_RENAMEAT,
+ strerror(ENOMEM),
+ handle,
+ "%s/%s|%s/%s",
+ smb_fname_str_do_log(handle->conn,
+ src_dirfsp->fsp_name),
+ smb_fname_src->base_name,
+ smb_fname_str_do_log(handle->conn,
+ dst_dirfsp->fsp_name),
+ smb_fname_dst->base_name);
errno = ENOMEM;
return -1;
}
smb_fname_dst);
if (full_fname_dst == NULL) {
TALLOC_FREE(full_fname_src);
+ do_log(SMB_VFS_OP_RENAMEAT,
+ strerror(ENOMEM),
+ handle,
+ "%s/%s|%s/%s",
+ smb_fname_str_do_log(handle->conn,
+ src_dirfsp->fsp_name),
+ smb_fname_src->base_name,
+ smb_fname_str_do_log(handle->conn,
+ dst_dirfsp->fsp_name),
+ smb_fname_dst->base_name);
errno = ENOMEM;
return -1;
}
if (result == -1) {
saved_errno = errno;
}
- do_log(SMB_VFS_OP_RENAMEAT, (result >= 0), handle, "%s|%s",
+ do_log(SMB_VFS_OP_RENAMEAT,
+ errmsg_unix(result),
+ handle,
+ "%s|%s",
smb_fname_str_do_log(handle->conn, full_fname_src),
smb_fname_str_do_log(handle->conn, full_fname_dst));
saved_errno = errno;
do_log(SMB_VFS_OP_RENAME_STREAM,
- (result >= 0),
+ errmsg_unix(result),
handle,
"%s|%s",
fsp_str_do_log(src_fsp),
req = tevent_req_create(mem_ctx, &state,
struct smb_full_audit_fsync_state);
if (req == NULL) {
- do_log(SMB_VFS_OP_FSYNC_SEND, false, handle, "%s",
+ do_log(SMB_VFS_OP_FSYNC_SEND,
+ strerror(ENOMEM),
+ handle,
+ "%s",
fsp_str_do_log(fsp));
return NULL;
}
subreq = SMB_VFS_NEXT_FSYNC_SEND(state, ev, handle, fsp);
if (tevent_req_nomem(subreq, req)) {
- do_log(SMB_VFS_OP_FSYNC_SEND, false, handle, "%s",
+ do_log(SMB_VFS_OP_FSYNC_SEND,
+ strerror(ENOMEM),
+ handle,
+ "%s",
fsp_str_do_log(fsp));
return tevent_req_post(req, ev);
}
tevent_req_set_callback(subreq, smb_full_audit_fsync_done, req);
- do_log(SMB_VFS_OP_FSYNC_SEND, true, handle, "%s", fsp_str_do_log(fsp));
+ do_log(SMB_VFS_OP_FSYNC_SEND, NULL, handle, "%s", fsp_str_do_log(fsp));
return req;
}
req, struct smb_full_audit_fsync_state);
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
- do_log(SMB_VFS_OP_FSYNC_RECV, false, state->handle, "%s",
+ do_log(SMB_VFS_OP_FSYNC_RECV,
+ errmsg_unix(vfs_aio_state->error),
+ state->handle,
+ "%s",
fsp_str_do_log(state->fsp));
return -1;
}
- do_log(SMB_VFS_OP_FSYNC_RECV, (state->ret >= 0), state->handle, "%s",
+ do_log(SMB_VFS_OP_FSYNC_RECV,
+ NULL,
+ state->handle,
+ "%s",
fsp_str_do_log(state->fsp));
*vfs_aio_state = state->vfs_aio_state;
result = SMB_VFS_NEXT_STAT(handle, smb_fname);
- do_log(SMB_VFS_OP_STAT, (result >= 0), handle, "%s",
+ do_log(SMB_VFS_OP_STAT,
+ errmsg_unix(result),
+ handle,
+ "%s",
smb_fname_str_do_log(handle->conn, smb_fname));
return result;
result = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
- do_log(SMB_VFS_OP_FSTAT, (result >= 0), handle, "%s",
+ do_log(SMB_VFS_OP_FSTAT,
+ errmsg_unix(result),
+ handle,
+ "%s",
fsp_str_do_log(fsp));
return result;
result = SMB_VFS_NEXT_LSTAT(handle, smb_fname);
- do_log(SMB_VFS_OP_LSTAT, (result >= 0), handle, "%s",
+ do_log(SMB_VFS_OP_LSTAT,
+ errmsg_unix(result),
+ handle,
+ "%s",
smb_fname_str_do_log(handle->conn, smb_fname));
return result;
result = SMB_VFS_NEXT_FSTATAT(handle, dirfsp, smb_fname, sbuf, flags);
do_log(SMB_VFS_OP_FSTATAT,
- (result >= 0),
+ errmsg_unix(result),
handle,
"%s/%s",
fsp_str_do_log(dirfsp),
result = SMB_VFS_NEXT_GET_ALLOC_SIZE(handle, fsp, sbuf);
- do_log(SMB_VFS_OP_GET_ALLOC_SIZE, (result != (uint64_t)-1), handle,
- "%llu", (unsigned long long)result);
+ do_log(SMB_VFS_OP_GET_ALLOC_SIZE,
+ (result == (uint64_t)-1) ? strerror(errno) : NULL,
+ handle,
+ "%llu",
+ (unsigned long long)result);
return result;
}
smb_fname,
flags);
- do_log(SMB_VFS_OP_UNLINKAT, (result >= 0), handle, "%s",
+ do_log(SMB_VFS_OP_UNLINKAT,
+ errmsg_unix(result),
+ handle,
+ "%s",
smb_fname_str_do_log(handle->conn, full_fname));
TALLOC_FREE(full_fname);
result = SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
- do_log(SMB_VFS_OP_FCHMOD, (result >= 0), handle,
- "%s|%o", fsp_str_do_log(fsp), mode);
+ do_log(SMB_VFS_OP_FCHMOD,
+ errmsg_unix(result),
+ handle,
+ "%s|%o",
+ fsp_str_do_log(fsp),
+ mode);
return result;
}
result = SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid);
- do_log(SMB_VFS_OP_FCHOWN, (result >= 0), handle, "%s|%ld|%ld",
- fsp_str_do_log(fsp), (long int)uid, (long int)gid);
+ do_log(SMB_VFS_OP_FCHOWN,
+ errmsg_unix(result),
+ handle,
+ "%s|%ld|%ld",
+ fsp_str_do_log(fsp),
+ (long int)uid,
+ (long int)gid);
return result;
}
result = SMB_VFS_NEXT_LCHOWN(handle, smb_fname, uid, gid);
- do_log(SMB_VFS_OP_LCHOWN, (result >= 0), handle, "%s|%ld|%ld",
- smb_fname->base_name, (long int)uid, (long int)gid);
+ do_log(SMB_VFS_OP_LCHOWN,
+ errmsg_unix(result),
+ handle,
+ "%s|%ld|%ld",
+ smb_fname->base_name,
+ (long int)uid,
+ (long int)gid);
return result;
}
result = SMB_VFS_NEXT_CHDIR(handle, smb_fname);
do_log(SMB_VFS_OP_CHDIR,
- (result >= 0),
+ errmsg_unix(result),
handle,
"chdir|%s",
smb_fname_str_do_log(handle->conn, smb_fname));
result = SMB_VFS_NEXT_GETWD(handle, ctx);
- do_log(SMB_VFS_OP_GETWD, (result != NULL), handle, "%s",
- result == NULL? "" : result->base_name);
+ do_log(SMB_VFS_OP_GETWD,
+ result == NULL ? strerror(errno) : NULL,
+ handle,
+ "%s",
+ result == NULL ? "" : result->base_name);
return result;
}
}
do_log(SMB_VFS_OP_FNTIMES,
- (result >= 0),
+ errmsg_unix(result),
handle,
"%s|%s|%s|%s|%s",
fsp_str_do_log(fsp),
result = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, len);
- do_log(SMB_VFS_OP_FTRUNCATE, (result >= 0), handle,
- "%s", fsp_str_do_log(fsp));
+ do_log(SMB_VFS_OP_FTRUNCATE,
+ errmsg_unix(result),
+ handle,
+ "%s",
+ fsp_str_do_log(fsp));
return result;
}
result = SMB_VFS_NEXT_FALLOCATE(handle, fsp, mode, offset, len);
- do_log(SMB_VFS_OP_FALLOCATE, (result >= 0), handle,
- "%s", fsp_str_do_log(fsp));
+ do_log(SMB_VFS_OP_FALLOCATE,
+ errmsg_unix(result),
+ handle,
+ "%s",
+ fsp_str_do_log(fsp));
return result;
}
result = SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type);
- do_log(SMB_VFS_OP_LOCK, result, handle, "%s", fsp_str_do_log(fsp));
+ do_log(SMB_VFS_OP_LOCK,
+ !result ? strerror(errno) : NULL,
+ handle,
+ "%s",
+ fsp_str_do_log(fsp));
return result;
}
share_access,
access_mask);
- do_log(SMB_VFS_OP_FILESYSTEM_SHAREMODE, (result >= 0), handle, "%s",
+ do_log(SMB_VFS_OP_FILESYSTEM_SHAREMODE,
+ errmsg_unix(result),
+ handle,
+ "%s",
fsp_str_do_log(fsp));
return result;
result = SMB_VFS_NEXT_FCNTL(handle, fsp, cmd, arg);
va_end(dup_cmd_arg);
- do_log(SMB_VFS_OP_FCNTL, (result >= 0), handle, "%s",
+ do_log(SMB_VFS_OP_FCNTL,
+ errmsg_unix(result),
+ handle,
+ "%s",
fsp_str_do_log(fsp));
return result;
result = SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype);
- do_log(SMB_VFS_OP_LINUX_SETLEASE, (result >= 0), handle, "%s",
+ do_log(SMB_VFS_OP_LINUX_SETLEASE,
+ errmsg_unix(result),
+ handle,
+ "%s",
fsp_str_do_log(fsp));
- return result;
+ return result;
}
static bool smb_full_audit_getlock(vfs_handle_struct *handle, files_struct *fsp,
result = SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid);
- do_log(SMB_VFS_OP_GETLOCK, result, handle, "%s", fsp_str_do_log(fsp));
+ do_log(SMB_VFS_OP_GETLOCK,
+ !result ? strerror(errno) : NULL,
+ handle,
+ "%s",
+ fsp_str_do_log(fsp));
return result;
}
new_smb_fname);
do_log(SMB_VFS_OP_SYMLINKAT,
- (result >= 0),
+ errmsg_unix(result),
handle,
"%s|%s",
link_contents->base_name,
bufsiz);
do_log(SMB_VFS_OP_READLINKAT,
- (result >= 0),
+ errmsg_unix(result),
handle,
"%s",
smb_fname_str_do_log(handle->conn, full_fname));
flags);
do_log(SMB_VFS_OP_LINKAT,
- (result >= 0),
+ errmsg_unix(result),
handle,
"%s|%s",
smb_fname_str_do_log(handle->conn, old_full_fname),
dev);
do_log(SMB_VFS_OP_MKNODAT,
- (result >= 0),
+ errmsg_unix(result),
handle,
"%s",
smb_fname_str_do_log(handle->conn, full_fname));
result_fname = SMB_VFS_NEXT_REALPATH(handle, ctx, smb_fname);
do_log(SMB_VFS_OP_REALPATH,
- (result_fname != NULL),
+ result_fname == NULL ? strerror(errno) : NULL,
handle,
"%s",
smb_fname_str_do_log(handle->conn, smb_fname));
result = SMB_VFS_NEXT_FCHFLAGS(handle, fsp, flags);
do_log(SMB_VFS_OP_FCHFLAGS,
- (result != 0),
+ errmsg_unix(result),
handle,
"%s",
smb_fname_str_do_log(handle->conn, fsp->fsp_name));
result = SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf);
do_log(SMB_VFS_OP_FILE_ID_CREATE,
- !file_id_equal(&id_zero, &result),
+ file_id_equal(&id_zero, &result) ? strerror(errno) : NULL,
handle,
"%s",
file_id_str_buf(result, &idbuf));
result = SMB_VFS_NEXT_FS_FILE_ID(handle, sbuf);
do_log(SMB_VFS_OP_FS_FILE_ID,
- result != 0,
- handle, "%" PRIu64, result);
+ result == 0 ? strerror(errno) : NULL,
+ handle,
+ "%" PRIu64,
+ result);
return result;
}
result = SMB_VFS_NEXT_FSTREAMINFO(handle, fsp, mem_ctx,
pnum_streams, pstreams);
- do_log(SMB_VFS_OP_FSTREAMINFO,
- NT_STATUS_IS_OK(result),
- handle,
- "%s",
- smb_fname_str_do_log(handle->conn, fsp->fsp_name));
+ do_log(SMB_VFS_OP_FSTREAMINFO,
+ errmsg_ntstatus(result),
+ handle,
+ "%s",
+ smb_fname_str_do_log(handle->conn, fsp->fsp_name));
- return result;
+ return result;
}
static NTSTATUS smb_full_audit_get_real_filename_at(
handle, dirfsp, name, mem_ctx, found_name);
do_log(SMB_VFS_OP_GET_REAL_FILENAME_AT,
- NT_STATUS_IS_OK(result),
+ errmsg_ntstatus(result),
handle,
"%s/%s->%s",
fsp_str_dbg(dirfsp),
result = SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle, br_lck, plock);
- do_log(SMB_VFS_OP_BRL_LOCK_WINDOWS, NT_STATUS_IS_OK(result), handle,
- "%s:%llu-%llu. type=%d.",
+ do_log(SMB_VFS_OP_BRL_LOCK_WINDOWS,
+ errmsg_ntstatus(result),
+ handle,
+ "%s:%llu-%llu. type=%d.",
fsp_str_do_log(brl_fsp(br_lck)),
(unsigned long long)plock->start,
(unsigned long long)plock->size,
result = SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle, br_lck, plock);
- do_log(SMB_VFS_OP_BRL_UNLOCK_WINDOWS, (result == 0), handle,
- "%s:%llu-%llu:%d", fsp_str_do_log(brl_fsp(br_lck)),
+ do_log(SMB_VFS_OP_BRL_UNLOCK_WINDOWS,
+ !result ? strerror(errno) : NULL,
+ handle,
+ "%s:%llu-%llu:%d",
+ fsp_str_do_log(brl_fsp(br_lck)),
(unsigned long long)plock->start,
(unsigned long long)plock->size,
plock->lock_type);
result = SMB_VFS_NEXT_STRICT_LOCK_CHECK(handle, fsp, plock);
- do_log(SMB_VFS_OP_STRICT_LOCK_CHECK, result, handle,
- "%s:%llu-%llu:%d", fsp_str_do_log(fsp),
+ do_log(SMB_VFS_OP_STRICT_LOCK_CHECK,
+ !result ? strerror(errno) : NULL,
+ handle,
+ "%s:%llu-%llu:%d",
+ fsp_str_do_log(fsp),
(unsigned long long)plock->start,
(unsigned long long)plock->size,
plock->lock_type);
result = SMB_VFS_NEXT_TRANSLATE_NAME(handle, name, direction, mem_ctx,
mapped_name);
- do_log(SMB_VFS_OP_TRANSLATE_NAME, NT_STATUS_IS_OK(result), handle, "");
+ do_log(SMB_VFS_OP_TRANSLATE_NAME, errmsg_ntstatus(result), handle, "");
return result;
}
parent_dir_out,
atname_out);
do_log(SMB_VFS_OP_PARENT_PATHNAME,
- NT_STATUS_IS_OK(result),
+ errmsg_ntstatus(result),
handle,
"%s",
smb_fname_str_do_log(handle->conn, smb_fname_in));
max_out_len,
out_len);
- do_log(SMB_VFS_OP_FSCTL, NT_STATUS_IS_OK(result), handle, "");
+ do_log(SMB_VFS_OP_FSCTL, errmsg_ntstatus(result), handle, "");
return result;
}
req = SMB_VFS_NEXT_OFFLOAD_READ_SEND(mem_ctx, ev, handle, fsp,
fsctl, ttl, offset, to_copy);
- do_log(SMB_VFS_OP_OFFLOAD_READ_SEND, req, handle, "");
+ do_log(SMB_VFS_OP_OFFLOAD_READ_SEND,
+ req == NULL ? strerror(ENOMEM) : NULL,
+ handle,
+ "");
return req;
}
status = SMB_VFS_NEXT_OFFLOAD_READ_RECV(req, handle, mem_ctx,
flags, xferlen, _token_blob);
- do_log(SMB_VFS_OP_OFFLOAD_READ_RECV, NT_STATUS_IS_OK(status), handle, "");
+ do_log(SMB_VFS_OP_OFFLOAD_READ_RECV,
+ errmsg_ntstatus(status),
+ handle,
+ "");
return status;
}
fsctl, token, transfer_offset,
dest_fsp, dest_off, num);
- do_log(SMB_VFS_OP_OFFLOAD_WRITE_SEND, req, handle, "");
+ do_log(SMB_VFS_OP_OFFLOAD_WRITE_SEND,
+ req == NULL ? strerror(ENOMEM) : NULL,
+ handle,
+ "");
return req;
}
result = SMB_VFS_NEXT_OFFLOAD_WRITE_RECV(handle, req, copied);
- do_log(SMB_VFS_OP_OFFLOAD_WRITE_RECV, NT_STATUS_IS_OK(result), handle, "");
+ do_log(SMB_VFS_OP_OFFLOAD_WRITE_RECV,
+ errmsg_ntstatus(result),
+ handle,
+ "");
return result;
}
result = SMB_VFS_NEXT_FGET_COMPRESSION(handle, mem_ctx, fsp,
_compression_fmt);
- do_log(SMB_VFS_OP_FGET_COMPRESSION, NT_STATUS_IS_OK(result), handle,
+ do_log(SMB_VFS_OP_FGET_COMPRESSION,
+ errmsg_ntstatus(result),
+ handle,
"%s",
fsp_str_do_log(fsp));
result = SMB_VFS_NEXT_SET_COMPRESSION(handle, mem_ctx, fsp,
compression_fmt);
- do_log(SMB_VFS_OP_SET_COMPRESSION, NT_STATUS_IS_OK(result), handle,
- "%s", fsp_str_do_log(fsp));
+ do_log(SMB_VFS_OP_SET_COMPRESSION,
+ errmsg_ntstatus(result),
+ handle,
+ "%s",
+ fsp_str_do_log(fsp));
return result;
}
status = SMB_VFS_NEXT_FREADDIR_ATTR(handle, fsp, mem_ctx, pattr_data);
do_log(SMB_VFS_OP_FREADDIR_ATTR,
- NT_STATUS_IS_OK(status),
+ errmsg_ntstatus(status),
handle,
"%s",
fsp_str_do_log(fsp));
struct smb_full_audit_get_dos_attributes_state);
if (req == NULL) {
do_log(SMB_VFS_OP_GET_DOS_ATTRIBUTES_SEND,
- false,
+ strerror(ENOMEM),
handle,
"%s/%s",
fsp_str_do_log(dir_fsp),
smb_fname);
if (tevent_req_nomem(subreq, req)) {
do_log(SMB_VFS_OP_GET_DOS_ATTRIBUTES_SEND,
- false,
+ strerror(ENOMEM),
handle,
"%s/%s",
fsp_str_do_log(dir_fsp),
req);
do_log(SMB_VFS_OP_GET_DOS_ATTRIBUTES_SEND,
- true,
+ NULL,
handle,
"%s/%s",
fsp_str_do_log(dir_fsp),
if (tevent_req_is_nterror(req, &status)) {
do_log(SMB_VFS_OP_GET_DOS_ATTRIBUTES_RECV,
- false,
+ errmsg_ntstatus(status),
state->handle,
"%s/%s",
fsp_str_do_log(state->dir_fsp),
}
do_log(SMB_VFS_OP_GET_DOS_ATTRIBUTES_RECV,
- true,
+ NULL,
state->handle,
"%s/%s",
fsp_str_do_log(state->dir_fsp),
dosmode);
do_log(SMB_VFS_OP_FGET_DOS_ATTRIBUTES,
- NT_STATUS_IS_OK(status),
- handle,
- "%s",
- fsp_str_do_log(fsp));
+ errmsg_ntstatus(status),
+ handle,
+ "%s",
+ fsp_str_do_log(fsp));
return status;
}
dosmode);
do_log(SMB_VFS_OP_FSET_DOS_ATTRIBUTES,
- NT_STATUS_IS_OK(status),
- handle,
- "%s",
- fsp_str_do_log(fsp));
+ errmsg_ntstatus(status),
+ handle,
+ "%s",
+ fsp_str_do_log(fsp));
return status;
}
result = SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info,
mem_ctx, ppdesc);
- do_log(SMB_VFS_OP_FGET_NT_ACL, NT_STATUS_IS_OK(result), handle,
- "%s", fsp_str_do_log(fsp));
+ do_log(SMB_VFS_OP_FGET_NT_ACL,
+ errmsg_ntstatus(result),
+ handle,
+ "%s",
+ fsp_str_do_log(fsp));
return result;
}
result = SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
- do_log(SMB_VFS_OP_FSET_NT_ACL, NT_STATUS_IS_OK(result), handle,
- "%s [%s]", fsp_str_do_log(fsp), sd ? sd : "");
+ do_log(SMB_VFS_OP_FSET_NT_ACL,
+ errmsg_ntstatus(result),
+ handle,
+ "%s [%s]",
+ fsp_str_do_log(fsp),
+ sd ? sd : "");
TALLOC_FREE(sd);
type,
mem_ctx);
- do_log(SMB_VFS_OP_SYS_ACL_GET_FD, (result != NULL), handle,
- "%s", fsp_str_do_log(fsp));
+ do_log(SMB_VFS_OP_SYS_ACL_GET_FD,
+ result == NULL ? strerror(errno) : NULL,
+ handle,
+ "%s",
+ fsp_str_do_log(fsp));
return result;
}
result = SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle, fsp, mem_ctx, blob_description, blob);
- do_log(SMB_VFS_OP_SYS_ACL_BLOB_GET_FD, (result >= 0), handle,
- "%s", fsp_str_do_log(fsp));
+ do_log(SMB_VFS_OP_SYS_ACL_BLOB_GET_FD,
+ errmsg_unix(result),
+ handle,
+ "%s",
+ fsp_str_do_log(fsp));
return result;
}
result = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, type, theacl);
- do_log(SMB_VFS_OP_SYS_ACL_SET_FD, (result >= 0), handle,
- "%s", fsp_str_do_log(fsp));
+ do_log(SMB_VFS_OP_SYS_ACL_SET_FD,
+ errmsg_unix(result),
+ handle,
+ "%s",
+ fsp_str_do_log(fsp));
return result;
}
result = SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FD(handle, fsp);
do_log(SMB_VFS_OP_SYS_ACL_DELETE_DEF_FD,
- (result >= 0),
+ errmsg_unix(result),
handle,
"%s",
fsp_str_do_log(fsp));
struct smb_full_audit_getxattrat_state);
if (req == NULL) {
do_log(SMB_VFS_OP_GETXATTRAT_SEND,
- false,
+ strerror(ENOMEM),
handle,
"%s/%s|%s",
fsp_str_do_log(dir_fsp),
alloc_hint);
if (tevent_req_nomem(subreq, req)) {
do_log(SMB_VFS_OP_GETXATTRAT_SEND,
- false,
+ strerror(ENOMEM),
handle,
"%s/%s|%s",
fsp_str_do_log(dir_fsp),
tevent_req_set_callback(subreq, smb_full_audit_getxattrat_done, req);
do_log(SMB_VFS_OP_GETXATTRAT_SEND,
- true,
+ NULL,
handle,
"%s/%s|%s",
fsp_str_do_log(dir_fsp),
if (tevent_req_is_unix_error(req, &aio_state->error)) {
do_log(SMB_VFS_OP_GETXATTRAT_RECV,
- false,
+ errmsg_unix(aio_state->error),
state->handle,
"%s/%s|%s",
fsp_str_do_log(state->dir_fsp),
}
do_log(SMB_VFS_OP_GETXATTRAT_RECV,
- true,
+ NULL,
state->handle,
"%s/%s|%s",
fsp_str_do_log(state->dir_fsp),
result = SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size);
- do_log(SMB_VFS_OP_FGETXATTR, (result >= 0), handle,
- "%s|%s", fsp_str_do_log(fsp), name);
+ do_log(SMB_VFS_OP_FGETXATTR,
+ errmsg_unix(result),
+ handle,
+ "%s|%s",
+ fsp_str_do_log(fsp),
+ name);
return result;
}
result = SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size);
- do_log(SMB_VFS_OP_FLISTXATTR, (result >= 0), handle,
- "%s", fsp_str_do_log(fsp));
+ do_log(SMB_VFS_OP_FLISTXATTR,
+ errmsg_unix(result),
+ handle,
+ "%s",
+ fsp_str_do_log(fsp));
return result;
}
result = SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
- do_log(SMB_VFS_OP_FREMOVEXATTR, (result >= 0), handle,
- "%s|%s", fsp_str_do_log(fsp), name);
+ do_log(SMB_VFS_OP_FREMOVEXATTR,
+ errmsg_unix(result),
+ handle,
+ "%s|%s",
+ fsp_str_do_log(fsp),
+ name);
return result;
}
result = SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags);
- do_log(SMB_VFS_OP_FSETXATTR, (result >= 0), handle,
- "%s|%s", fsp_str_do_log(fsp), name);
+ do_log(SMB_VFS_OP_FSETXATTR,
+ errmsg_unix(result),
+ handle,
+ "%s|%s",
+ fsp_str_do_log(fsp),
+ name);
return result;
}
bool result;
result = SMB_VFS_NEXT_AIO_FORCE(handle, fsp);
- do_log(SMB_VFS_OP_AIO_FORCE, result, handle,
- "%s", fsp_str_do_log(fsp));
+
+ do_log(SMB_VFS_OP_AIO_FORCE, NULL, handle, "%s", fsp_str_do_log(fsp));
return result;
}
mem_ctx,
cookie);
- do_log(SMB_VFS_OP_DURABLE_COOKIE, NT_STATUS_IS_OK(result), handle,
- "%s", fsp_str_do_log(fsp));
+ do_log(SMB_VFS_OP_DURABLE_COOKIE,
+ errmsg_ntstatus(result),
+ handle,
+ "%s",
+ fsp_str_do_log(fsp));
return result;
}
mem_ctx,
new_cookie);
- do_log(SMB_VFS_OP_DURABLE_DISCONNECT, NT_STATUS_IS_OK(result), handle,
- "%s", fsp_str_do_log(fsp));
+ do_log(SMB_VFS_OP_DURABLE_DISCONNECT,
+ errmsg_ntstatus(result),
+ handle,
+ "%s",
+ fsp_str_do_log(fsp));
return result;
}
new_cookie);
do_log(SMB_VFS_OP_DURABLE_RECONNECT,
- NT_STATUS_IS_OK(result),
- handle,
- "");
+ errmsg_ntstatus(result),
+ handle,
+ "");
return result;
}