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/filename.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/filename.c')
-rw-r--r-- | source3/smbd/filename.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index a36b7ff282..b69d2f3e5e 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -512,28 +512,25 @@ NTSTATUS unix_convert(connection_struct *conn, a valid one for the user to access. ****************************************************************************/ -BOOL check_name(const pstring name,connection_struct *conn) +NTSTATUS check_name(connection_struct *conn, const pstring name) { - BOOL ret = True; - if (IS_VETO_PATH(conn, name)) { /* Is it not dot or dot dot. */ if (!((name[0] == '.') && (!name[1] || (name[1] == '.' && !name[2])))) { - DEBUG(5,("file path name %s vetoed\n",name)); - errno = ENOENT; - return False; + DEBUG(5,("check_name: file path name %s vetoed\n",name)); + return map_nt_error_from_unix(ENOENT); } } if (!lp_widelinks(SNUM(conn)) || !lp_symlinks(SNUM(conn))) { - ret = reduce_name(conn,name); - } - - if (!ret) { - DEBUG(5,("check_name on %s failed\n",name)); + NTSTATUS status = reduce_name(conn,name); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(5,("check_name: name %s failed with %s\n",name, nt_errstr(status))); + return status; + } } - return(ret); + return NT_STATUS_OK; } /**************************************************************************** |