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

vlendec at samba.org vlendec at samba.org
Tue Aug 14 07:39:12 GMT 2007


Author: vlendec
Date: 2007-08-14 07:39:11 +0000 (Tue, 14 Aug 2007)
New Revision: 24398

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

Log:
Convert call_nt_transact_notify_change to the new API
Modified:
   branches/SAMBA_3_2/source/smbd/notify.c
   branches/SAMBA_3_2/source/smbd/nttrans.c


Changeset:
Modified: branches/SAMBA_3_2/source/smbd/notify.c
===================================================================
--- branches/SAMBA_3_2/source/smbd/notify.c	2007-08-14 07:21:10 UTC (rev 24397)
+++ branches/SAMBA_3_2/source/smbd/notify.c	2007-08-14 07:39:11 UTC (rev 24398)
@@ -24,7 +24,7 @@
 struct notify_change_request {
 	struct notify_change_request *prev, *next;
 	struct files_struct *fsp;	/* backpointer for cancel by mid */
-	char request_buf[smb_size];
+	uint8 request_buf[smb_size];
 	uint32 filter;
 	uint32 max_param;
 	struct notify_mid_map *mid_map;
@@ -128,14 +128,14 @@
  Setup the common parts of the return packet and send it.
 *****************************************************************************/
 
-static void change_notify_reply_packet(const char *request_buf,
+static void change_notify_reply_packet(const uint8 *request_buf,
 				       NTSTATUS error_code)
 {
-	const char *inbuf = request_buf;
+	const char *inbuf = (char *)request_buf;
 	char outbuf[smb_size+38];
 
 	memset(outbuf, '\0', sizeof(outbuf));
-	construct_reply_common(request_buf, outbuf);
+	construct_reply_common(inbuf, outbuf);
 
 	ERROR_NT(error_code);
 
@@ -151,7 +151,7 @@
 				    "failed.");
 }
 
-void change_notify_reply(const char *request_buf, uint32 max_param,
+void change_notify_reply(const uint8 *request_buf, uint32 max_param,
 			 struct notify_change_buf *notify_buf)
 {
 	char *outbuf = NULL;
@@ -183,9 +183,9 @@
 		goto done;
 	}
 
-	construct_reply_common(request_buf, outbuf);
+	construct_reply_common((char *)request_buf, outbuf);
 
-	if (send_nt_replies(request_buf, outbuf, buflen, NT_STATUS_OK, prs_data_p(&ps),
+	if (send_nt_replies((char *)request_buf, outbuf, buflen, NT_STATUS_OK, prs_data_p(&ps),
 			    prs_offset(&ps), NULL, 0) == -1) {
 		exit_server("change_notify_reply_packet: send_smb failed.");
 	}
@@ -238,7 +238,7 @@
 	return status;
 }
 
-NTSTATUS change_notify_add_request(const char *inbuf, uint32 max_param,
+NTSTATUS change_notify_add_request(const uint8 *inbuf, uint32 max_param,
 				   uint32 filter, BOOL recursive,
 				   struct files_struct *fsp)
 {

Modified: branches/SAMBA_3_2/source/smbd/nttrans.c
===================================================================
--- branches/SAMBA_3_2/source/smbd/nttrans.c	2007-08-14 07:21:10 UTC (rev 24397)
+++ branches/SAMBA_3_2/source/smbd/nttrans.c	2007-08-14 07:39:11 UTC (rev 24398)
@@ -2071,15 +2071,15 @@
  don't allow a directory to be opened.
 ****************************************************************************/
 
-static int call_nt_transact_notify_change(connection_struct *conn, char *inbuf,
-					  char *outbuf, int length,
-					  int bufsize, 
-					  uint16 **ppsetup, uint32 setup_count,
-					  char **ppparams,
-					  uint32 parameter_count,
-					  char **ppdata, uint32 data_count,
-					  uint32 max_data_count,
-					  uint32 max_param_count)
+static void call_nt_transact_notify_change(connection_struct *conn,
+					   struct smb_request *req,
+					   uint16 **ppsetup,
+					   uint32 setup_count,
+					   char **ppparams,
+					   uint32 parameter_count,
+					   char **ppdata, uint32 data_count,
+					   uint32 max_data_count,
+					   uint32 max_param_count)
 {
 	uint16 *setup = *ppsetup;
 	files_struct *fsp;
@@ -2088,7 +2088,8 @@
 	BOOL recursive;
 
 	if(setup_count < 6) {
-		return ERROR_DOS(ERRDOS,ERRbadfunc);
+		reply_doserror(req, ERRDOS, ERRbadfunc);
+		return;
 	}
 
 	fsp = file_fsp(SVAL(setup,4));
@@ -2098,14 +2099,16 @@
 	DEBUG(3,("call_nt_transact_notify_change\n"));
 
 	if(!fsp) {
-		return ERROR_DOS(ERRDOS,ERRbadfid);
+		reply_doserror(req, ERRDOS, ERRbadfid);
+		return;
 	}
 
 	{
 		char *filter_string;
 
 		if (!(filter_string = notify_filter_string(NULL, filter))) {
-			return ERROR_NT(NT_STATUS_NO_MEMORY);
+			reply_nterror(req,NT_STATUS_NO_MEMORY);
+			return;
 		}
 
 		DEBUG(3,("call_nt_transact_notify_change: notify change "
@@ -2116,7 +2119,8 @@
 	}
 
 	if((!fsp->is_directory) || (conn != fsp->conn)) {
-		return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
+		reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+		return;
 	}
 
 	if (fsp->notify == NULL) {
@@ -2126,7 +2130,8 @@
 		if (!NT_STATUS_IS_OK(status)) {
 			DEBUG(10, ("change_notify_create returned %s\n",
 				   nt_errstr(status)));
-			return ERROR_NT(status);
+			reply_nterror(req, status);
+			return;
 		}
 	}
 
@@ -2141,26 +2146,25 @@
 		 * here.
 		 */
 
-		change_notify_reply(inbuf, max_param_count, fsp->notify);
+		change_notify_reply(req->inbuf, max_param_count, fsp->notify);
 
 		/*
 		 * change_notify_reply() above has independently sent its
 		 * results
 		 */
-		return -1;
+		return;
 	}
 
 	/*
 	 * No changes pending, queue the request
 	 */
 
-	status = change_notify_add_request(inbuf, max_param_count, filter,
+	status = change_notify_add_request(req->inbuf, max_param_count, filter,
 			recursive, fsp);
 	if (!NT_STATUS_IS_OK(status)) {
-		return ERROR_NT(status);
+		reply_nterror(req, status);
 	}
-
-	return -1;
+	return;
 }
 
 /****************************************************************************
@@ -3166,28 +3170,14 @@
 
 		case NT_TRANSACT_NOTIFY_CHANGE:
 		{
-			char *inbuf, *outbuf;
-			int size, bufsize;
-
 			START_PROFILE(NT_transact_notify_change);
-
-			if (!reply_prep_legacy(req, &inbuf, &outbuf, &size,
-					       &bufsize)) {
-				reply_nterror(req, NT_STATUS_NO_MEMORY);
-				END_PROFILE(SMBnttrans);
-				return;
-			}
-
-			reply_post_legacy(
-				req,
-				call_nt_transact_notify_change(
-					conn, inbuf, outbuf, size, bufsize,
-					&state->setup, state->setup_count,
-					&state->param, state->total_param,
-					&state->data, state->total_data,
-					state->max_data_return,
-					state->max_param_return));
-
+			call_nt_transact_notify_change(
+				conn, req,
+				&state->setup, state->setup_count,
+				&state->param, state->total_param,
+				&state->data, state->total_data,
+				state->max_data_return,
+				state->max_param_return);
 			END_PROFILE(NT_transact_notify_change);
 			break;
 		}



More information about the samba-cvs mailing list