summaryrefslogtreecommitdiff
path: root/source3/smbd/trans2.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd/trans2.c')
-rw-r--r--source3/smbd/trans2.c88
1 files changed, 31 insertions, 57 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 40394c3d8a..2cfb692b02 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -751,7 +751,6 @@ static int call_trans2open(connection_struct *conn, char *inbuf, char *outbuf, i
SMB_INO_T inode = 0;
SMB_STRUCT_STAT sbuf;
int smb_action = 0;
- BOOL bad_path = False;
files_struct *fsp;
struct ea_list *ea_list = NULL;
uint16 flags = 0;
@@ -801,13 +800,13 @@ static int call_trans2open(connection_struct *conn, char *inbuf, char *outbuf, i
/* XXXX we need to handle passed times, sattr and flags */
- unix_convert(fname,conn,0,&bad_path,&sbuf);
- if (bad_path) {
- return ERROR_NT(NT_STATUS_OBJECT_PATH_NOT_FOUND);
+ status = unix_convert(conn, fname, False, NULL, &sbuf);
+ if (!NT_STATUS_IS_OK(status)) {
+ return ERROR_NT(status);
}
if (!check_name(fname,conn)) {
- return UNIXERROR(ERRDOS, ERRnoaccess);
+ return UNIXERROR(ERRDOS,ERRnoaccess);
}
if (open_ofun == 0) {
@@ -1662,7 +1661,6 @@ static int call_trans2findfirst(connection_struct *conn, char *inbuf, char *outb
BOOL dont_descend = False;
BOOL out_of_space = False;
int space_remaining;
- BOOL bad_path = False;
BOOL mask_contains_wcard = False;
SMB_STRUCT_STAT sbuf;
TALLOC_CTX *ea_ctx = NULL;
@@ -1720,12 +1718,12 @@ close_if_end = %d requires_resume_key = %d level = 0x%x, max_data_bytes = %d\n",
RESOLVE_DFSPATH_WCARD(directory, conn, inbuf, outbuf);
- unix_convert(directory,conn,0,&bad_path,&sbuf);
- if (bad_path) {
- return ERROR_NT(NT_STATUS_OBJECT_PATH_NOT_FOUND);
+ ntstatus = unix_convert(conn, directory, mask_contains_wcard, NULL, &sbuf);
+ if (!NT_STATUS_IS_OK(ntstatus)) {
+ return ERROR_NT(ntstatus);
}
if(!check_name(directory,conn)) {
- return UNIXERROR(ERRDOS, ERRbadpath);
+ return UNIXERROR(ERRDOS,ERRbadpath);
}
p = strrchr_m(directory,'/');
@@ -2844,7 +2842,6 @@ static int call_trans2qfilepathinfo(connection_struct *conn, char *inbuf, char *
char *base_name;
char *p;
SMB_OFF_T pos = 0;
- BOOL bad_path = False;
BOOL delete_pending = False;
int len;
time_t create_time, mtime, atime;
@@ -2891,11 +2888,11 @@ static int call_trans2qfilepathinfo(connection_struct *conn, char *inbuf, char *
/* Always do lstat for UNIX calls. */
if (SMB_VFS_LSTAT(conn,fname,&sbuf)) {
DEBUG(3,("call_trans2qfilepathinfo: SMB_VFS_LSTAT of %s failed (%s)\n",fname,strerror(errno)));
- return UNIXERROR(ERRDOS, ERRbadpath);
+ return UNIXERROR(ERRDOS,ERRbadpath);
}
} else if (SMB_VFS_STAT(conn,fname,&sbuf)) {
DEBUG(3,("call_trans2qfilepathinfo: SMB_VFS_STAT of %s failed (%s)\n",fname,strerror(errno)));
- return UNIXERROR(ERRDOS, ERRbadpath);
+ return UNIXERROR(ERRDOS,ERRbadpath);
}
delete_pending = get_delete_on_close_flag(sbuf.st_dev, sbuf.st_ino);
@@ -2933,24 +2930,24 @@ static int call_trans2qfilepathinfo(connection_struct *conn, char *inbuf, char *
RESOLVE_DFSPATH(fname, conn, inbuf, outbuf);
- unix_convert(fname,conn,0,&bad_path,&sbuf);
- if (bad_path) {
- return ERROR_NT(NT_STATUS_OBJECT_PATH_NOT_FOUND);
+ status = unix_convert(conn, fname, False, NULL, &sbuf);
+ if (!NT_STATUS_IS_OK(status)) {
+ return ERROR_NT(status);
}
if (!check_name(fname,conn)) {
DEBUG(3,("call_trans2qfilepathinfo: fileinfo of %s failed (%s)\n",fname,strerror(errno)));
- return UNIXERROR(ERRDOS, ERRbadpath);
+ return UNIXERROR(ERRDOS,ERRbadpath);
}
if (INFO_LEVEL_IS_UNIX(info_level)) {
/* Always do lstat for UNIX calls. */
if (SMB_VFS_LSTAT(conn,fname,&sbuf)) {
DEBUG(3,("call_trans2qfilepathinfo: SMB_VFS_LSTAT of %s failed (%s)\n",fname,strerror(errno)));
- return UNIXERROR(ERRDOS, ERRbadpath);
+ return UNIXERROR(ERRDOS,ERRbadpath);
}
} else if (!VALID_STAT(sbuf) && SMB_VFS_STAT(conn,fname,&sbuf) && (info_level != SMB_INFO_IS_NAME_VALID)) {
DEBUG(3,("call_trans2qfilepathinfo: SMB_VFS_STAT of %s failed (%s)\n",fname,strerror(errno)));
- return UNIXERROR(ERRDOS, ERRbadpath);
+ return UNIXERROR(ERRDOS,ERRbadpath);
}
delete_pending = get_delete_on_close_flag(sbuf.st_dev, sbuf.st_ino);
@@ -3671,8 +3668,6 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
NTSTATUS hardlink_internals(connection_struct *conn, char *oldname, char *newname)
{
- BOOL bad_path_oldname = False;
- BOOL bad_path_newname = False;
SMB_STRUCT_STAT sbuf1, sbuf2;
pstring last_component_oldname;
pstring last_component_newname;
@@ -3681,21 +3676,9 @@ NTSTATUS hardlink_internals(connection_struct *conn, char *oldname, char *newnam
ZERO_STRUCT(sbuf1);
ZERO_STRUCT(sbuf2);
- /* No wildcards. */
- if (ms_has_wild(newname) || ms_has_wild(oldname)) {
- return NT_STATUS_OBJECT_PATH_SYNTAX_BAD;
- }
-
- unix_convert(oldname,conn,last_component_oldname,&bad_path_oldname,&sbuf1);
- if (bad_path_oldname) {
- return NT_STATUS_OBJECT_PATH_NOT_FOUND;
- }
-
- /* Quick check for "." and ".." */
- if (last_component_oldname[0] == '.') {
- if (!last_component_oldname[1] || (last_component_oldname[1] == '.' && !last_component_oldname[2])) {
- return NT_STATUS_OBJECT_NAME_INVALID;
- }
+ status = unix_convert(conn, oldname, False, last_component_oldname, &sbuf1);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
}
/* source must already exist. */
@@ -3707,16 +3690,9 @@ NTSTATUS hardlink_internals(connection_struct *conn, char *oldname, char *newnam
return NT_STATUS_ACCESS_DENIED;
}
- unix_convert(newname,conn,last_component_newname,&bad_path_newname,&sbuf2);
- if (bad_path_newname) {
- return NT_STATUS_OBJECT_PATH_NOT_FOUND;
- }
-
- /* Quick check for "." and ".." */
- if (last_component_newname[0] == '.') {
- if (!last_component_newname[1] || (last_component_newname[1] == '.' && !last_component_newname[2])) {
- return NT_STATUS_OBJECT_NAME_INVALID;
- }
+ status = unix_convert(conn, newname, False, last_component_newname, &sbuf2);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
}
/* Disallow if newname already exists. */
@@ -3766,7 +3742,6 @@ static int call_trans2setfilepathinfo(connection_struct *conn, char *inbuf, char
SMB_STRUCT_STAT sbuf;
pstring fname;
int fd = -1;
- BOOL bad_path = False;
files_struct *fsp = NULL;
uid_t set_owner = (uid_t)SMB_UID_NO_CHANGE;
gid_t set_grp = (uid_t)SMB_GID_NO_CHANGE;
@@ -3796,7 +3771,7 @@ static int call_trans2setfilepathinfo(connection_struct *conn, char *inbuf, char
pstrcpy(fname, fsp->fsp_name);
if (SMB_VFS_STAT(conn,fname,&sbuf) != 0) {
DEBUG(3,("call_trans2setfilepathinfo: fileinfo of %s failed (%s)\n",fname,strerror(errno)));
- return UNIXERROR(ERRDOS, ERRbadpath);
+ return UNIXERROR(ERRDOS,ERRbadpath);
}
} else if (fsp && fsp->print_file) {
/*
@@ -3837,9 +3812,9 @@ static int call_trans2setfilepathinfo(connection_struct *conn, char *inbuf, char
if (!NT_STATUS_IS_OK(status)) {
return ERROR_NT(status);
}
- unix_convert(fname,conn,0,&bad_path,&sbuf);
- if (bad_path) {
- return ERROR_NT(NT_STATUS_OBJECT_PATH_NOT_FOUND);
+ status = unix_convert(conn, fname, False, NULL, &sbuf);
+ if (!NT_STATUS_IS_OK(status)) {
+ return ERROR_NT(status);
}
/*
@@ -3848,11 +3823,11 @@ static int call_trans2setfilepathinfo(connection_struct *conn, char *inbuf, char
if(!VALID_STAT(sbuf) && !INFO_LEVEL_IS_UNIX(info_level)) {
DEBUG(3,("call_trans2setfilepathinfo: stat of %s failed (%s)\n", fname, strerror(errno)));
- return UNIXERROR(ERRDOS, ERRbadpath);
+ return UNIXERROR(ERRDOS,ERRbadpath);
}
if(!check_name(fname, conn)) {
- return UNIXERROR(ERRDOS, ERRbadpath);
+ return UNIXERROR(ERRDOS,ERRbadpath);
}
}
@@ -4789,7 +4764,6 @@ static int call_trans2mkdir(connection_struct *conn, char *inbuf, char *outbuf,
char *pdata = *ppdata;
pstring directory;
SMB_STRUCT_STAT sbuf;
- BOOL bad_path = False;
NTSTATUS status = NT_STATUS_OK;
struct ea_list *ea_list = NULL;
@@ -4807,9 +4781,9 @@ static int call_trans2mkdir(connection_struct *conn, char *inbuf, char *outbuf,
DEBUG(3,("call_trans2mkdir : name = %s\n", directory));
- unix_convert(directory,conn,0,&bad_path,&sbuf);
- if (bad_path) {
- return ERROR_NT(NT_STATUS_OBJECT_PATH_NOT_FOUND);
+ status = unix_convert(conn, directory, False, NULL, &sbuf);
+ if (!NT_STATUS_IS_OK(status)) {
+ return ERROR_NT(status);
}
/* Any data in this call is an EA list. */