svn commit: samba r20742 - in branches: SAMBA_3_0/source/include SAMBA_3_0/source/smbd SAMBA_3_0_24/source/include SAMBA_3_0_24/source/smbd

jra at samba.org jra at samba.org
Sat Jan 13 22:10:21 GMT 2007


Author: jra
Date: 2007-01-13 22:10:18 +0000 (Sat, 13 Jan 2007)
New Revision: 20742

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20742

Log:
Rename chkpth -> checkpath for sanity's sake :-).
Start removing unneeded "BOOL ok" from this reply.c
(this logic is old, old, old..... :-).
Jeremy.

Modified:
   branches/SAMBA_3_0/source/include/smb.h
   branches/SAMBA_3_0/source/include/smbprofile.h
   branches/SAMBA_3_0/source/smbd/process.c
   branches/SAMBA_3_0/source/smbd/reply.c
   branches/SAMBA_3_0_24/source/include/smb.h
   branches/SAMBA_3_0_24/source/include/smbprofile.h
   branches/SAMBA_3_0_24/source/smbd/process.c
   branches/SAMBA_3_0_24/source/smbd/reply.c


Changeset:
Modified: branches/SAMBA_3_0/source/include/smb.h
===================================================================
--- branches/SAMBA_3_0/source/include/smb.h	2007-01-13 20:44:59 UTC (rev 20741)
+++ branches/SAMBA_3_0/source/include/smb.h	2007-01-13 22:10:18 UTC (rev 20742)
@@ -943,7 +943,7 @@
 #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 */

Modified: branches/SAMBA_3_0/source/include/smbprofile.h
===================================================================
--- branches/SAMBA_3_0/source/include/smbprofile.h	2007-01-13 20:44:59 UTC (rev 20741)
+++ branches/SAMBA_3_0/source/include/smbprofile.h	2007-01-13 22:10:18 UTC (rev 20742)
@@ -266,9 +266,9 @@
 #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)

Modified: branches/SAMBA_3_0/source/smbd/process.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/process.c	2007-01-13 20:44:59 UTC (rev 20741)
+++ branches/SAMBA_3_0/source/smbd/process.c	2007-01-13 22:10:18 UTC (rev 20742)
@@ -620,7 +620,7 @@
 /* 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},

Modified: branches/SAMBA_3_0/source/smbd/reply.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/reply.c	2007-01-13 20:44:59 UTC (rev 20741)
+++ branches/SAMBA_3_0/source/smbd/reply.c	2007-01-13 22:10:18 UTC (rev 20742)
@@ -596,57 +596,58 @@
 }
 
 /****************************************************************************
- 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 @@
 			 * 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;
 }
 
 /****************************************************************************

Modified: branches/SAMBA_3_0_24/source/include/smb.h
===================================================================
--- branches/SAMBA_3_0_24/source/include/smb.h	2007-01-13 20:44:59 UTC (rev 20741)
+++ branches/SAMBA_3_0_24/source/include/smb.h	2007-01-13 22:10:18 UTC (rev 20742)
@@ -934,7 +934,7 @@
 #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 */

Modified: branches/SAMBA_3_0_24/source/include/smbprofile.h
===================================================================
--- branches/SAMBA_3_0_24/source/include/smbprofile.h	2007-01-13 20:44:59 UTC (rev 20741)
+++ branches/SAMBA_3_0_24/source/include/smbprofile.h	2007-01-13 22:10:18 UTC (rev 20742)
@@ -266,9 +266,9 @@
 #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)

Modified: branches/SAMBA_3_0_24/source/smbd/process.c
===================================================================
--- branches/SAMBA_3_0_24/source/smbd/process.c	2007-01-13 20:44:59 UTC (rev 20741)
+++ branches/SAMBA_3_0_24/source/smbd/process.c	2007-01-13 22:10:18 UTC (rev 20742)
@@ -620,7 +620,7 @@
 /* 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},

Modified: branches/SAMBA_3_0_24/source/smbd/reply.c
===================================================================
--- branches/SAMBA_3_0_24/source/smbd/reply.c	2007-01-13 20:44:59 UTC (rev 20741)
+++ branches/SAMBA_3_0_24/source/smbd/reply.c	2007-01-13 22:10:18 UTC (rev 20742)
@@ -596,57 +596,58 @@
 }
 
 /****************************************************************************
- 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 @@
 			 * 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;
 }
 
 /****************************************************************************



More information about the samba-cvs mailing list