svn commit: samba r15764 - in trunk/source/smbd: .
vlendec at samba.org
vlendec at samba.org
Sat May 20 21:05:49 GMT 2006
Author: vlendec
Date: 2006-05-20 21:05:49 +0000 (Sat, 20 May 2006)
New Revision: 15764
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15764
Log:
Change open_file_fchmod not to use set_saved_ntstatus. The return code of main
user file_set_dosmode() gives its specific error code via errno which this
patch does not touch. set_sd (via posix_acls.c) unconditionally returns
NT_STATUS_ACCESS_DENIED if open_file_fchmod() fails so the error path here
seems not too important. The other uses ignore the error code.
Volker
Modified:
trunk/source/smbd/dosmode.c
trunk/source/smbd/open.c
trunk/source/smbd/posix_acls.c
Changeset:
Modified: trunk/source/smbd/dosmode.c
===================================================================
--- trunk/source/smbd/dosmode.c 2006-05-20 20:33:40 UTC (rev 15763)
+++ trunk/source/smbd/dosmode.c 2006-05-20 21:05:49 UTC (rev 15764)
@@ -300,8 +300,7 @@
* are not violating security in doing the setxattr.
*/
- fsp = open_file_fchmod(conn,path,sbuf);
- if (!fsp)
+ if (!NT_STATUS_IS_OK(open_file_fchmod(conn,path,sbuf,&fsp)))
return ret;
become_root();
if (SMB_VFS_SETXATTR(conn, path, SAMBA_XATTR_DOS_ATTRIB, attrstr, strlen(attrstr), 0) == 0) {
@@ -467,8 +466,8 @@
* holding. We need to review this.... may need to
* break batch oplocks open by others. JRA.
*/
- files_struct *fsp = open_file_fchmod(conn,fname,st);
- if (!fsp)
+ files_struct *fsp;
+ if (!NT_STATUS_IS_OK(open_file_fchmod(conn,fname,st,&fsp)))
return -1;
become_root();
ret = SMB_VFS_FCHMOD(fsp, fsp->fh->fd, unixmode);
Modified: trunk/source/smbd/open.c
===================================================================
--- trunk/source/smbd/open.c 2006-05-20 20:33:40 UTC (rev 15763)
+++ trunk/source/smbd/open.c 2006-05-20 21:05:49 UTC (rev 15764)
@@ -1778,21 +1778,20 @@
Open a file for for write to ensure that we can fchmod it.
****************************************************************************/
-files_struct *open_file_fchmod(connection_struct *conn, const char *fname,
- SMB_STRUCT_STAT *psbuf)
+NTSTATUS open_file_fchmod(connection_struct *conn, const char *fname,
+ SMB_STRUCT_STAT *psbuf, files_struct **result)
{
files_struct *fsp = NULL;
BOOL fsp_open;
NTSTATUS status;
if (!VALID_STAT(*psbuf)) {
- return NULL;
+ return NT_STATUS_INVALID_PARAMETER;
}
status = file_new(conn, &fsp);
if(!NT_STATUS_IS_OK(status)) {
- set_saved_ntstatus(status);
- return NULL;
+ return status;
}
/* note! we must use a non-zero desired access or we don't get
@@ -1806,11 +1805,13 @@
*/
if (!fsp_open) {
+ status = map_nt_error_from_unix(errno);
file_free(fsp);
- return NULL;
+ return status;
}
- return fsp;
+ *result = fsp;
+ return NT_STATUS_OK;
}
/****************************************************************************
Modified: trunk/source/smbd/posix_acls.c
===================================================================
--- trunk/source/smbd/posix_acls.c 2006-05-20 20:33:40 UTC (rev 15763)
+++ trunk/source/smbd/posix_acls.c 2006-05-20 21:05:49 UTC (rev 15764)
@@ -3043,8 +3043,7 @@
return -1;
}
- fsp = open_file_fchmod(conn,fname,&st);
- if (!fsp) {
+ if (!NT_STATUS_IS_OK(open_file_fchmod(conn,fname,&st,&fsp))) {
return -1;
}
More information about the samba-cvs
mailing list