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

s3/vfs/nfs4_acls: avoid a stat

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): Tue Sep 27 04:03:03 CEST 2016 on sn-devel-144
This commit is contained in:
Ralph Boehme 2016-09-11 13:30:44 +02:00 committed by Jeremy Allison
parent 85a309b5a3
commit 71937b16bf

View File

@ -529,11 +529,19 @@ NTSTATUS smb_fget_nt_acl_nfs4(files_struct *fsp,
{
SMB_STRUCT_STAT sbuf;
struct smbacl4_vfs_params params;
SMB_STRUCT_STAT *psbuf = NULL;
DEBUG(10, ("smb_fget_nt_acl_nfs4 invoked for %s\n", fsp_str_dbg(fsp)));
if (smbacl4_fGetFileOwner(fsp, &sbuf)) {
return map_nt_error_from_unix(errno);
if (VALID_STAT(fsp->fsp_name->st)) {
psbuf = &fsp->fsp_name->st;
}
if (psbuf == NULL) {
if (smbacl4_fGetFileOwner(fsp, &sbuf)) {
return map_nt_error_from_unix(errno);
}
psbuf = &sbuf;
}
if (pparams == NULL) {
@ -544,7 +552,7 @@ NTSTATUS smb_fget_nt_acl_nfs4(files_struct *fsp,
pparams = &params;
}
return smb_get_nt_acl_nfs4_common(&sbuf, pparams, security_info,
return smb_get_nt_acl_nfs4_common(psbuf, pparams, security_info,
mem_ctx, ppdesc, theacl);
}
@ -558,12 +566,20 @@ NTSTATUS smb_get_nt_acl_nfs4(struct connection_struct *conn,
{
SMB_STRUCT_STAT sbuf;
struct smbacl4_vfs_params params;
const SMB_STRUCT_STAT *psbuf = NULL;
DEBUG(10, ("smb_get_nt_acl_nfs4 invoked for %s\n",
smb_fname->base_name));
if (smbacl4_GetFileOwner(conn, smb_fname, &sbuf)) {
return map_nt_error_from_unix(errno);
if (VALID_STAT(smb_fname->st)) {
psbuf = &smb_fname->st;
}
if (psbuf == NULL) {
if (smbacl4_GetFileOwner(conn, smb_fname, &sbuf)) {
return map_nt_error_from_unix(errno);
}
psbuf = &sbuf;
}
if (pparams == NULL) {
@ -574,7 +590,7 @@ NTSTATUS smb_get_nt_acl_nfs4(struct connection_struct *conn,
pparams = &params;
}
return smb_get_nt_acl_nfs4_common(&sbuf, pparams, security_info,
return smb_get_nt_acl_nfs4_common(psbuf, pparams, security_info,
mem_ctx, ppdesc, theacl);
}