summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-01-13 22:10:18 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:17:07 -0500
commitab46f9cdd232cc08b4c2f57c3fe7add652f6ce38 (patch)
tree2e16799b6b0f49f04e9a3d9cb8ae474f9e5298ac /source3
parent165e08e8b1efa55b4548e1853a637e1696e4fd7b (diff)
downloadsamba-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')
-rw-r--r--source3/include/smb.h2
-rw-r--r--source3/include/smbprofile.h6
-rw-r--r--source3/smbd/process.c2
-rw-r--r--source3/smbd/reply.c70
4 files changed, 40 insertions, 40 deletions
diff --git a/source3/include/smb.h b/source3/include/smb.h
index c8126c43c3..c029e09120 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -943,7 +943,7 @@ struct bitmap {
#define SMBunlock 0x0D /* unlock byte range */
#define SMBctemp 0x0E /* create temporary file */
#define SMBmknew 0x0F /* make new file */
-#define SMBchkpth 0x10 /* check directory path */
+#define SMBcheckpath 0x10 /* check directory path */
#define SMBexit 0x11 /* process exit */
#define SMBlseek 0x12 /* seek */
#define SMBtcon 0x70 /* tree connect */
diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h
index 39f02ec9f5..867f87515e 100644
--- a/source3/include/smbprofile.h
+++ b/source3/include/smbprofile.h
@@ -266,9 +266,9 @@ enum profile_stats_values
#define SMBmknew_count __profile_stats_value(PR_VALUE_SMBMKNEW, count)
#define SMBmknew_time __profile_stats_value(PR_VALUE_SMBMKNEW, time)
- PR_VALUE_SMBCHKPTH,
-#define SMBchkpth_count __profile_stats_value(PR_VALUE_SMBCHKPTH, count)
-#define SMBchkpth_time __profile_stats_value(PR_VALUE_SMBCHKPTH, time)
+ PR_VALUE_SMBCHECKPATH,
+#define SMBcheckpath_count __profile_stats_value(PR_VALUE_SMBCHECKPATH, count)
+#define SMBcheckpath_time __profile_stats_value(PR_VALUE_SMBCHECKPATH, time)
PR_VALUE_SMBEXIT,
#define SMBexit_count __profile_stats_value(PR_VALUE_SMBEXIT, count)
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;
}
/****************************************************************************