mirror of
https://github.com/samba-team/samba.git
synced 2025-03-26 18:50:30 +03:00
s3/smbd: README.Coding fixes in set_ea_dos_attribute
While I'm at it, some README.Coding fixes in set_ea_dos_attribute. Bug: https://bugzilla.samba.org/show_bug.cgi?id=12995 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
7917f9721c
commit
fbad64200e
@ -415,6 +415,7 @@ NTSTATUS set_ea_dos_attribute(connection_struct *conn,
|
||||
struct xattr_DOSATTRIB dosattrib;
|
||||
enum ndr_err_code ndr_err;
|
||||
DATA_BLOB blob;
|
||||
int ret;
|
||||
|
||||
if (!lp_store_dos_attributes(SNUM(conn))) {
|
||||
return NT_STATUS_NOT_IMPLEMENTED;
|
||||
@ -456,14 +457,15 @@ NTSTATUS set_ea_dos_attribute(connection_struct *conn,
|
||||
return NT_STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (SMB_VFS_SETXATTR(conn, smb_fname,
|
||||
SAMBA_XATTR_DOS_ATTRIB, blob.data, blob.length,
|
||||
0) == -1) {
|
||||
ret = SMB_VFS_SETXATTR(conn, smb_fname,
|
||||
SAMBA_XATTR_DOS_ATTRIB,
|
||||
blob.data, blob.length, 0);
|
||||
if (ret != 0) {
|
||||
NTSTATUS status = NT_STATUS_OK;
|
||||
bool need_close = false;
|
||||
files_struct *fsp = NULL;
|
||||
|
||||
if((errno != EPERM) && (errno != EACCES)) {
|
||||
if ((errno != EPERM) && (errno != EACCES)) {
|
||||
DBG_INFO("Cannot set "
|
||||
"attribute EA on file %s: Error = %s\n",
|
||||
smb_fname_str_dbg(smb_fname), strerror(errno));
|
||||
@ -475,7 +477,7 @@ NTSTATUS set_ea_dos_attribute(connection_struct *conn,
|
||||
*/
|
||||
|
||||
/* Check if we have write access. */
|
||||
if(!CAN_WRITE(conn) || !lp_dos_filemode(SNUM(conn)))
|
||||
if (!CAN_WRITE(conn) || !lp_dos_filemode(SNUM(conn)))
|
||||
return NT_STATUS_ACCESS_DENIED;
|
||||
|
||||
if (!can_write_to_file(conn, smb_fname)) {
|
||||
@ -496,9 +498,10 @@ NTSTATUS set_ea_dos_attribute(connection_struct *conn,
|
||||
}
|
||||
|
||||
become_root();
|
||||
if (SMB_VFS_FSETXATTR(fsp,
|
||||
SAMBA_XATTR_DOS_ATTRIB, blob.data,
|
||||
blob.length, 0) == 0) {
|
||||
ret = SMB_VFS_FSETXATTR(fsp,
|
||||
SAMBA_XATTR_DOS_ATTRIB,
|
||||
blob.data, blob.length, 0);
|
||||
if (ret == 0) {
|
||||
status = NT_STATUS_OK;
|
||||
}
|
||||
unbecome_root();
|
||||
|
Loading…
x
Reference in New Issue
Block a user