1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

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
This commit is contained in:
Jeremy Allison 2018-08-24 13:37:27 -07:00 committed by Andreas Schneider
parent 59f1334726
commit 4d72ebb821

View File

@ -667,6 +667,32 @@ static const char *smb_fname_str_do_log(const struct smb_filename *cwd,
if (smb_fname == NULL) { if (smb_fname == NULL) {
return ""; 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); status = get_full_smb_filename(do_log_ctx(), smb_fname, &fname);
if (!NT_STATUS_IS_OK(status)) { if (!NT_STATUS_IS_OK(status)) {
return ""; return "";