diff options
author | Jeremy Allison <jra@samba.org> | 2007-01-13 22:10:18 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:17:07 -0500 |
commit | ab46f9cdd232cc08b4c2f57c3fe7add652f6ce38 (patch) | |
tree | 2e16799b6b0f49f04e9a3d9cb8ae474f9e5298ac /source3/smbd | |
parent | 165e08e8b1efa55b4548e1853a637e1696e4fd7b (diff) | |
download | samba-ab46f9cdd232cc08b4c2f57c3fe7add652f6ce38.tar.gz samba-ab46f9cdd232cc08b4c2f57c3fe7add652f6ce38.tar.bz2 samba-ab46f9cdd232cc08b4c2f57c3fe7add652f6ce38.zip |
r20742: Rename chkpth -> checkpath for sanity's sake :-).
Start removing unneeded "BOOL ok" from this reply.c
(this logic is old, old, old..... :-).
Jeremy.
(This used to be commit 3d52268095c605a80dfcd371769198a332baa0a5)
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/process.c | 2 | ||||
-rw-r--r-- | source3/smbd/reply.c | 70 |
2 files changed, 36 insertions, 36 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c index ecb33453c5..929471a48c 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -620,7 +620,7 @@ static const struct smb_message_struct { /* 0x0d */ { "SMBunlock",reply_unlock,AS_USER}, /* 0x0e */ { "SMBctemp",reply_ctemp,AS_USER }, /* 0x0f */ { "SMBmknew",reply_mknew,AS_USER}, -/* 0x10 */ { "SMBchkpth",reply_chkpth,AS_USER}, +/* 0x10 */ { "SMBcheckpath",reply_checkpath,AS_USER}, /* 0x11 */ { "SMBexit",reply_exit,DO_CHDIR}, /* 0x12 */ { "SMBlseek",reply_lseek,AS_USER}, /* 0x13 */ { "SMBlockread",reply_lockread,AS_USER}, diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 7d89382a7d..9fa359de8c 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -596,57 +596,58 @@ int reply_ioctl(connection_struct *conn, } /**************************************************************************** - Reply to a chkpth. + Strange checkpath NTSTATUS mapping. ****************************************************************************/ -int reply_chkpth(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, int dum_buffsize) +static NTSTATUS map_checkpath_error(const char *inbuf, NTSTATUS status) +{ + /* Strange DOS error code semantics only for checkpath... */ + if (!(SVAL(inbuf,smb_flg2) & FLAGS2_32_BIT_ERROR_CODES)) { + if (NT_STATUS_EQUAL(NT_STATUS_OBJECT_NAME_INVALID,status)) { + /* We need to map to ERRbadpath */ + return NT_STATUS_OBJECT_PATH_NOT_FOUND; + } + } + return status; +} + +/**************************************************************************** + Reply to a checkpath. +****************************************************************************/ + +int reply_checkpath(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, int dum_buffsize) { int outsize = 0; pstring name; - BOOL ok = False; SMB_STRUCT_STAT sbuf; NTSTATUS status; - START_PROFILE(SMBchkpth); + START_PROFILE(SMBcheckpath); srvstr_get_path(inbuf, name, smb_buf(inbuf) + 1, sizeof(name), 0, STR_TERMINATE, &status); if (!NT_STATUS_IS_OK(status)) { - END_PROFILE(SMBchkpth); - - /* Strange DOS error code semantics only for chkpth... */ - if (!(SVAL(inbuf,smb_flg2) & FLAGS2_32_BIT_ERROR_CODES)) { - if (NT_STATUS_EQUAL(NT_STATUS_OBJECT_NAME_INVALID,status)) { - /* We need to map to ERRbadpath */ - status = NT_STATUS_OBJECT_PATH_NOT_FOUND; - } - } + END_PROFILE(SMBcheckpath); + status = map_checkpath_error(inbuf, status); return ERROR_NT(status); } RESOLVE_DFSPATH(name, conn, inbuf, outbuf); + DEBUG(3,("reply_checkpath %s mode=%d\n", name, (int)SVAL(inbuf,smb_vwv0))); + status = unix_convert(conn, name, False, NULL, &sbuf); if (!NT_STATUS_IS_OK(status)) { - END_PROFILE(SMBchkpth); - /* Strange DOS error code semantics only for chkpth... */ - if (!(SVAL(inbuf,smb_flg2) & FLAGS2_32_BIT_ERROR_CODES)) { - if (NT_STATUS_EQUAL(NT_STATUS_OBJECT_NAME_INVALID,status)) { - /* We need to map to ERRbadpath */ - status = NT_STATUS_OBJECT_PATH_NOT_FOUND; - } - } + END_PROFILE(SMBcheckpath); + status = map_checkpath_error(inbuf, status); return ERROR_NT(status); } - if (check_name(name,conn)) { - if (VALID_STAT(sbuf) || SMB_VFS_STAT(conn,name,&sbuf) == 0) - if (!(ok = S_ISDIR(sbuf.st_mode))) { - END_PROFILE(SMBchkpth); - return ERROR_BOTH(NT_STATUS_NOT_A_DIRECTORY,ERRDOS,ERRbadpath); - } - } - - if (!ok) { + if (check_name(name,conn) && (VALID_STAT(sbuf) || SMB_VFS_STAT(conn,name,&sbuf) == 0)) { + if (!S_ISDIR(sbuf.st_mode)) { + END_PROFILE(SMBcheckpath); + return ERROR_BOTH(NT_STATUS_NOT_A_DIRECTORY,ERRDOS,ERRbadpath); + } + } else { /* We special case this - as when a Windows machine is parsing a path is steps through the components one at a time - if a component fails it expects @@ -660,19 +661,18 @@ int reply_chkpth(connection_struct *conn, char *inbuf,char *outbuf, int dum_size * for that case and NT_STATUS_OBJECT_PATH_NOT_FOUND * if the path is invalid. */ - END_PROFILE(SMBchkpth); + END_PROFILE(SMBcheckpath); return ERROR_BOTH(NT_STATUS_OBJECT_NAME_NOT_FOUND,ERRDOS,ERRbadpath); } - END_PROFILE(SMBchkpth); + END_PROFILE(SMBcheckpath); return(UNIXERROR(ERRDOS,ERRbadpath)); } outsize = set_message(outbuf,0,0,False); - DEBUG(3,("chkpth %s mode=%d\n", name, (int)SVAL(inbuf,smb_vwv0))); - END_PROFILE(SMBchkpth); - return(outsize); + END_PROFILE(SMBcheckpath); + return outsize; } /**************************************************************************** |