summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2018-08-24 13:37:27 -0700
committerAndreas Schneider <asn@cryptomilk.org>2018-08-27 20:23:55 +0200
commit4d72ebb821518c25e4759ad697d5e18257f80765 (patch)
treeea7b7f2af16517a31cfc777885f741aa0b576126 /source3
parent59f13347260f5c4367c709eb07139f2ba7ddad72 (diff)
downloadsamba-4d72ebb821518c25e4759ad697d5e18257f80765.tar.gz
s3: VFS: vfs_full_audit: Ensure smb_fname_str_do_log() only returns absolute pathnames.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13565 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Mon Aug 27 20:23:55 CEST 2018 on sn-devel-144
Diffstat (limited to 'source3')
-rw-r--r--source3/modules/vfs_full_audit.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index b7929605bfa..e7ca89f9fbe 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -667,6 +667,32 @@ static const char *smb_fname_str_do_log(const struct smb_filename *cwd,
if (smb_fname == NULL) {
return "";
}
+
+ if (smb_fname->base_name[0] != '/') {
+ char *abs_name = NULL;
+ struct smb_filename *fname_copy = cp_smb_filename(
+ do_log_ctx(),
+ smb_fname);
+ if (fname_copy == NULL) {
+ return "";
+ }
+
+ if (!ISDOT(smb_fname->base_name)) {
+ abs_name = talloc_asprintf(do_log_ctx(),
+ "%s/%s",
+ cwd->base_name,
+ smb_fname->base_name);
+ } else {
+ abs_name = talloc_strdup(do_log_ctx(),
+ cwd->base_name);
+ }
+ if (abs_name == NULL) {
+ return "";
+ }
+ fname_copy->base_name = abs_name;
+ smb_fname = fname_copy;
+ }
+
status = get_full_smb_filename(do_log_ctx(), smb_fname, &fname);
if (!NT_STATUS_IS_OK(status)) {
return "";