diff options
author | Jeremy Allison <jra@samba.org> | 2007-01-17 02:09:37 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:17:12 -0500 |
commit | 83eb0d1d6d90d182e8eee8496695113c89f8dba1 (patch) | |
tree | d2b02c7647d2755759e0453cb411101429da16b4 /source3/smbd/nttrans.c | |
parent | 52a36db39fb96353702616dfac5004239c34cd2c (diff) | |
download | samba-83eb0d1d6d90d182e8eee8496695113c89f8dba1.tar.gz samba-83eb0d1d6d90d182e8eee8496695113c89f8dba1.tar.bz2 samba-83eb0d1d6d90d182e8eee8496695113c89f8dba1.zip |
r20844: Somewhat radical change - this may break the build (I will
watch carefully - so I'm doing it in one transaction so I can
roll back).
Change check_name(), reduce_name() and dptr_create() to
return NTSTATUS. This helps a lot in error path processing
and especially in reduce_name() allows us to ditch the flaky
and error-prone saving of errno and return errors directly.
Jeremy.
(This used to be commit 6133a694aa429d638320e39ffe1c49d172583ccf)
Diffstat (limited to 'source3/smbd/nttrans.c')
-rw-r--r-- | source3/smbd/nttrans.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index df65ad7da6..f4d6220592 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -634,10 +634,11 @@ int reply_ntcreate_and_X(connection_struct *conn, return ERROR_NT(status); } /* All file access must go through check_name() */ - if (!check_name(fname,conn)) { + status = check_name(conn, fname); + if (!NT_STATUS_IS_OK(status)) { restore_case_semantics(conn, file_attributes); END_PROFILE(SMBntcreateX); - return UNIXERROR(ERRDOS,ERRbadpath); + return ERROR_NT(status); } /* This is the correct thing to do (check every time) but can_delete is @@ -1259,9 +1260,10 @@ static int call_nt_transact_create(connection_struct *conn, char *inbuf, char *o return ERROR_NT(status); } /* All file access must go through check_name() */ - if (!check_name(fname,conn)) { + status = check_name(conn, fname); + if (!NT_STATUS_IS_OK(status)) { restore_case_semantics(conn, file_attributes); - return UNIXERROR(ERRDOS,ERRbadpath); + return ERROR_NT(status); } /* This is the correct thing to do (check every time) but can_delete is @@ -1570,8 +1572,9 @@ static NTSTATUS copy_internals(connection_struct *conn, char *oldname, char *new ZERO_STRUCT(sbuf1); ZERO_STRUCT(sbuf2); - if (!CAN_WRITE(conn)) + if (!CAN_WRITE(conn)) { return NT_STATUS_MEDIA_WRITE_PROTECTED; + } status = unix_convert(conn, oldname, False, last_component_oldname, &sbuf1); if (!NT_STATUS_IS_OK(status)) { @@ -1582,8 +1585,9 @@ static NTSTATUS copy_internals(connection_struct *conn, char *oldname, char *new if (!VALID_STAT(sbuf1)) { return NT_STATUS_OBJECT_NAME_NOT_FOUND; } - if (!check_name(oldname,conn)) { - return NT_STATUS_ACCESS_DENIED; + status = check_name(conn, oldname); + if (!NT_STATUS_IS_OK(status)) { + return status; } /* Ensure attributes match. */ @@ -1602,8 +1606,9 @@ static NTSTATUS copy_internals(connection_struct *conn, char *oldname, char *new return NT_STATUS_OBJECT_NAME_COLLISION; } - if (!check_name(newname,conn)) { - return NT_STATUS_ACCESS_DENIED; + status = check_name(conn, newname); + if (!NT_STATUS_IS_OK(status)) { + return status; } /* No links from a directory. */ @@ -1612,8 +1617,9 @@ static NTSTATUS copy_internals(connection_struct *conn, char *oldname, char *new } /* Ensure this is within the share. */ - if (!reduce_name(conn, oldname) != 0) { - return NT_STATUS_ACCESS_DENIED; + status = reduce_name(conn, oldname); + if (!NT_STATUS_IS_OK(status)) { + return status; } DEBUG(10,("copy_internals: doing file copy %s to %s\n", oldname, newname)); |