Commit b28d08cc authored by Jeremy Allison's avatar Jeremy Allison Committed by Gerald (Jerry) Carter
Browse files

r1093: Ensure we clear any cached errors on a deferred open call so

we don't return the wrong error code on the next packet.
Jeremy.
(This used to be commit c1b06deb574d7b8e746bdf0d6f0eab16848a6cc1)
parent effd4a33
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -28,6 +28,17 @@ NTSTATUS unix_ERR_ntstatus = NT_STATUS_OK;
/* From lib/error.c */
extern struct unix_error_map unix_dos_nt_errmap[];

/****************************************************************************
 Ensure we don't have any errors cached.
****************************************************************************/
 
void clear_cached_errors(void)
{
	unix_ERR_class = SMB_SUCCESS;
	unix_ERR_code = 0;
	unix_ERR_ntstatus = NT_STATUS_OK;
}

/****************************************************************************
 Create an error packet from a cached error.
****************************************************************************/
+2 −0
Original line number Diff line number Diff line
@@ -865,6 +865,7 @@ create_options = 0x%x root_dir_fid = 0x%x\n", flags, desired_access, file_attrib
				END_PROFILE(SMBntcreateX);
				if (open_was_deferred(SVAL(inbuf,smb_mid))) {
					/* We have re-scheduled this call. */
					clear_cached_errors();
					return -1;
				}
				return set_bad_path_error(errno, bad_path, outbuf, ERRDOS,ERRnoaccess);
@@ -1353,6 +1354,7 @@ static int call_nt_transact_create(connection_struct *conn, char *inbuf, char *o
				restore_case_semantics(conn, file_attributes);
				if (open_was_deferred(SVAL(inbuf,smb_mid))) {
					/* We have re-scheduled this call. */
					clear_cached_errors();
					return -1;
				}
				return set_bad_path_error(errno, bad_path, outbuf, ERRDOS,ERRnoaccess);
+6 −0
Original line number Diff line number Diff line
@@ -1045,6 +1045,7 @@ int reply_open(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
		END_PROFILE(SMBopen);
		if (open_was_deferred(SVAL(inbuf,smb_mid))) {
			/* We have re-scheduled this call. */
			clear_cached_errors();
			return -1;
		}
		return set_bad_path_error(errno, bad_path, outbuf, ERRDOS, ERRnoaccess);
@@ -1138,6 +1139,7 @@ int reply_open_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt
		END_PROFILE(SMBopenX);
		if (open_was_deferred(SVAL(inbuf,smb_mid))) {
			/* We have re-scheduled this call. */
			clear_cached_errors();
			return -1;
		}
		return set_bad_path_error(errno, bad_path, outbuf, ERRDOS, ERRnoaccess);
@@ -1267,6 +1269,7 @@ int reply_mknew(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
		END_PROFILE(SMBcreate);
		if (open_was_deferred(SVAL(inbuf,smb_mid))) {
			/* We have re-scheduled this call. */
			clear_cached_errors();
			return -1;
		}
		return set_bad_path_error(errno, bad_path, outbuf, ERRDOS, ERRnoaccess);
@@ -1346,6 +1349,7 @@ int reply_ctemp(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
		END_PROFILE(SMBctemp);
		if (open_was_deferred(SVAL(inbuf,smb_mid))) {
			/* We have re-scheduled this call. */
			clear_cached_errors();
			return -1;
		}
		return set_bad_path_error(errno, bad_path, outbuf, ERRDOS, ERRnoaccess);
@@ -1642,6 +1646,7 @@ int reply_unlink(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
	if (!NT_STATUS_IS_OK(status)) {
		if (open_was_deferred(SVAL(inbuf,smb_mid))) {
			/* We have re-scheduled this call. */
			clear_cached_errors();
			return -1;
		}
		return ERROR_NT(status);
@@ -3967,6 +3972,7 @@ int reply_mv(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
		END_PROFILE(SMBmv);
		if (open_was_deferred(SVAL(inbuf,smb_mid))) {
			/* We have re-scheduled this call. */
			clear_cached_errors();
			return -1;
		}
		return ERROR_NT(status);
+1 −0
Original line number Diff line number Diff line
@@ -629,6 +629,7 @@ static int call_trans2open(connection_struct *conn, char *inbuf, char *outbuf, i
	if (!fsp) {
		if (open_was_deferred(SVAL(inbuf,smb_mid))) {
			/* We have re-scheduled this call. */
			clear_cached_errors();
			return -1;
		}
		return set_bad_path_error(errno, bad_path, outbuf, ERRDOS,ERRnoaccess);