Now that refuse_symlink() gets passed in a smb_fname and not just a char
buffer, we can try to reuse its stat info and save one stat call here.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sun Sep 11 23:52:17 CEST 2016 on sn-devel-144
const SMB_STRUCT_STAT *psbuf);
/****************************************************************************
- Check if an open file handle or pathname is a symlink.
+ Check if an open file handle or smb_fname is a symlink.
****************************************************************************/
static NTSTATUS refuse_symlink(connection_struct *conn,
if (fsp) {
pst = &fsp->fsp_name->st;
} else {
+ pst = &smb_fname->st;
+ }
+
+ if (!VALID_STAT(*pst)) {
int ret = vfs_stat_smb_basename(conn,
smb_fname,
&sbuf);
}
pst = &sbuf;
}
+
if (S_ISLNK(pst->st_ex_mode)) {
return NT_STATUS_ACCESS_DENIED;
}