svn commit: samba r23998 - in branches/SAMBA_3_2/source/smbd: .

vlendec at samba.org vlendec at samba.org
Mon Jul 23 09:53:06 GMT 2007


Author: vlendec
Date: 2007-07-23 09:53:06 +0000 (Mon, 23 Jul 2007)
New Revision: 23998

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

Log:
Convert reply_close to the new API
Modified:
   branches/SAMBA_3_2/source/smbd/pipes.c
   branches/SAMBA_3_2/source/smbd/process.c
   branches/SAMBA_3_2/source/smbd/reply.c


Changeset:
Modified: branches/SAMBA_3_2/source/smbd/pipes.c
===================================================================
--- branches/SAMBA_3_2/source/smbd/pipes.c	2007-07-23 09:36:09 UTC (rev 23997)
+++ branches/SAMBA_3_2/source/smbd/pipes.c	2007-07-23 09:53:06 UTC (rev 23998)
@@ -285,22 +285,24 @@
  Reply to a close.
 ****************************************************************************/
 
-int reply_pipe_close(connection_struct *conn, char *inbuf,char *outbuf)
+void reply_pipe_close(connection_struct *conn, struct smb_request *req)
 {
-	smb_np_struct *p = get_rpc_pipe_p(inbuf,smb_vwv0);
-	int outsize = set_message(inbuf,outbuf,0,0,True);
+	smb_np_struct *p = get_rpc_pipe_p((char *)req->inbuf,smb_vwv0);
 
 	if (!p) {
-		return(ERROR_DOS(ERRDOS,ERRbadfid));
+		reply_doserror(req, ERRDOS, ERRbadfid);
+		return;
 	}
 
 	DEBUG(5,("reply_pipe_close: pnum:%x\n", p->pnum));
 
 	if (!close_rpc_pipe_hnd(p)) {
-		return ERROR_DOS(ERRDOS,ERRbadfid);
+		reply_doserror(req, ERRDOS, ERRbadfid);
+		return;
 	}
 	
 	/* TODO: REMOVE PIPE FROM DB */
 
-	return(outsize);
+	reply_outbuf(req, 0, 0);
+	return;
 }

Modified: branches/SAMBA_3_2/source/smbd/process.c
===================================================================
--- branches/SAMBA_3_2/source/smbd/process.c	2007-07-23 09:36:09 UTC (rev 23997)
+++ branches/SAMBA_3_2/source/smbd/process.c	2007-07-23 09:53:06 UTC (rev 23998)
@@ -638,7 +638,7 @@
 /* 0x01 */ { "SMBrmdir",reply_rmdir,NULL,AS_USER | NEED_WRITE},
 /* 0x02 */ { "SMBopen",reply_open,NULL,AS_USER },
 /* 0x03 */ { "SMBcreate",reply_mknew,NULL,AS_USER},
-/* 0x04 */ { "SMBclose",reply_close,NULL,AS_USER | CAN_IPC },
+/* 0x04 */ { "SMBclose",NULL,reply_close,AS_USER | CAN_IPC },
 /* 0x05 */ { "SMBflush",reply_flush,NULL,AS_USER},
 /* 0x06 */ { "SMBunlink",reply_unlink,NULL,AS_USER | NEED_WRITE },
 /* 0x07 */ { "SMBmv",reply_mv,NULL,AS_USER | NEED_WRITE },

Modified: branches/SAMBA_3_2/source/smbd/reply.c
===================================================================
--- branches/SAMBA_3_2/source/smbd/reply.c	2007-07-23 09:36:09 UTC (rev 23997)
+++ branches/SAMBA_3_2/source/smbd/reply.c	2007-07-23 09:53:06 UTC (rev 23998)
@@ -3402,31 +3402,35 @@
  Reply to a close - has to deal with closing a directory opened by NT SMB's.
 ****************************************************************************/
 
-int reply_close(connection_struct *conn, char *inbuf,char *outbuf, int size,
-                int dum_buffsize)
+void reply_close(connection_struct *conn, struct smb_request *req)
 {
 	NTSTATUS status = NT_STATUS_OK;
-	int outsize = 0;
 	files_struct *fsp = NULL;
 	START_PROFILE(SMBclose);
 
-	outsize = set_message(inbuf,outbuf,0,0,False);
+	if (req->wct < 3) {
+		reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+		END_PROFILE(SMBclose);
+		return;
+	}
 
 	/* If it's an IPC, pass off to the pipe handler. */
 	if (IS_IPC(conn)) {
+		reply_pipe_close(conn, req);
 		END_PROFILE(SMBclose);
-		return reply_pipe_close(conn, inbuf,outbuf);
+		return;
 	}
 
-	fsp = file_fsp(inbuf,smb_vwv0);
+	fsp = file_fsp((char *)req->inbuf,smb_vwv0);
 
 	/*
 	 * We can only use CHECK_FSP if we know it's not a directory.
 	 */
 
 	if(!fsp || (fsp->conn != conn) || (fsp->vuid != current_user.vuid)) {
+		reply_doserror(req, ERRDOS, ERRbadfid);
 		END_PROFILE(SMBclose);
-		return ERROR_DOS(ERRDOS,ERRbadfid);
+		return;
 	}
 
 	if(fsp->is_directory) {
@@ -3448,8 +3452,9 @@
 		 * Take care of any time sent in the close.
 		 */
 
-		fsp_set_pending_modtime(fsp,
-				convert_time_t_to_timespec(srv_make_unix_date3(inbuf+smb_vwv1)));
+		fsp_set_pending_modtime(fsp, convert_time_t_to_timespec(
+						srv_make_unix_date3(
+							req->inbuf+smb_vwv1)));
 
 		/*
 		 * close_file() returns the unix errno if an error
@@ -3460,13 +3465,15 @@
 		status = close_file(fsp,NORMAL_CLOSE);
 	}  
 
-	if(!NT_STATUS_IS_OK(status)) {
+	if (!NT_STATUS_IS_OK(status)) {
+		reply_nterror(req, status);
 		END_PROFILE(SMBclose);
-		return ERROR_NT(status);
+		return;
 	}
 
+	reply_outbuf(req, 0, 0);
 	END_PROFILE(SMBclose);
-	return(outsize);
+	return;
 }
 
 /****************************************************************************



More information about the samba-cvs mailing list