From b41b38031f8eeec916e0e5f9fb80cd8ecd5e22cd Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 14 Aug 2007 07:39:11 +0000 Subject: r24398: Convert call_nt_transact_notify_change to the new API (This used to be commit 607b3ab8bc6052770f0324b57f3db6e1c11a7005) --- source3/smbd/notify.c | 16 +++++------ source3/smbd/nttrans.c | 72 ++++++++++++++++++++++---------------------------- 2 files changed, 39 insertions(+), 49 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/notify.c b/source3/smbd/notify.c index 6c77f4c270..8474ca6446 100644 --- a/source3/smbd/notify.c +++ b/source3/smbd/notify.c @@ -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 @@ static BOOL notify_marshall_changes(int num_changes, 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 @@ static void change_notify_reply_packet(const char *request_buf, "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 @@ void change_notify_reply(const char *request_buf, uint32 max_param, 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 @@ NTSTATUS change_notify_create(struct files_struct *fsp, uint32 filter, 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) { diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index 970703a2d6..401fdca929 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -2071,15 +2071,15 @@ int reply_ntrename(connection_struct *conn, 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 @@ static int call_nt_transact_notify_change(connection_struct *conn, char *inbuf, 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 @@ static int call_nt_transact_notify_change(connection_struct *conn, char *inbuf, 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 @@ static int call_nt_transact_notify_change(connection_struct *conn, char *inbuf, } 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 @@ static int call_nt_transact_notify_change(connection_struct *conn, char *inbuf, 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 @@ static int call_nt_transact_notify_change(connection_struct *conn, char *inbuf, * 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 @@ static void handle_nttrans(connection_struct *conn, 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; } -- cgit