Author: vlendec Date: 2007-08-14 08:24:02 +0000 (Tue, 14 Aug 2007) New Revision: 24401
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=24401 Log: Push reply_prep_legacy into send_nt_replies Modified: branches/SAMBA_3_2/source/smbd/nttrans.c Changeset: Modified: branches/SAMBA_3_2/source/smbd/nttrans.c =================================================================== --- branches/SAMBA_3_2/source/smbd/nttrans.c 2007-08-14 08:23:54 UTC (rev 24400) +++ branches/SAMBA_3_2/source/smbd/nttrans.c 2007-08-14 08:24:02 UTC (rev 24401) @@ -67,14 +67,9 @@ HACK ! Always assumes smb_setup field is zero. ****************************************************************************/ -static int send_nt_replies(const char *inbuf, - char *outbuf, - int bufsize, - NTSTATUS nt_error, - char *params, - int paramsize, - char *pdata, - int datasize) +void send_nt_replies(struct smb_request *req, NTSTATUS nt_error, + char *params, int paramsize, + char *pdata, int datasize) { int data_to_send = datasize; int params_to_send = paramsize; @@ -90,6 +85,14 @@ * transNT replies. */ + char *inbuf, *outbuf; + int length, bufsize; + + if (!reply_prep_legacy(req, &inbuf, &outbuf, &length, &bufsize)) { + reply_nterror(req, NT_STATUS_NO_MEMORY); + return; + } + set_message(inbuf,outbuf,18,0,True); if (NT_STATUS_V(nt_error)) { @@ -106,7 +109,8 @@ if (!send_smb(smbd_server_fd(),outbuf)) { exit_server_cleanly("send_nt_replies: send_smb failed."); } - return 0; + TALLOC_FREE(req->outbuf); + return; } /* @@ -255,31 +259,12 @@ if(params_to_send < 0 || data_to_send < 0) { DEBUG(0,("send_nt_replies failed sanity check pts = %d, dts = %d\n!!!", params_to_send, data_to_send)); - return -1; + TALLOC_FREE(req->outbuf); + return; } } - - return 0; } -void send_nt_replies_new(struct smb_request *req, NTSTATUS nt_error, - char *params, int paramsize, - char *pdata, int datasize) -{ - char *inbuf, *outbuf; - int length, bufsize; - - if (!reply_prep_legacy(req, &inbuf, &outbuf, &length, &bufsize)) { - reply_nterror(req, NT_STATUS_NO_MEMORY); - return; - } - - reply_post_legacy( - req, - send_nt_replies(inbuf, outbuf, bufsize, nt_error, - params, paramsize, pdata, datasize)); -} - /**************************************************************************** Is it an NTFS stream name ? ****************************************************************************/ @@ -1138,7 +1123,7 @@ DEBUG(5,("do_nt_transact_create_pipe: open name = %s\n", fname)); /* Send the required number of replies */ - send_nt_replies_new(req, NT_STATUS_OK, params, param_len, *ppdata, 0); + send_nt_replies(req, NT_STATUS_OK, params, param_len, *ppdata, 0); return; } @@ -1789,7 +1774,7 @@ DEBUG(5,("call_nt_transact_create: open name = %s\n", fname)); /* Send the required number of replies */ - send_nt_replies_new(req, NT_STATUS_OK, params, param_len, *ppdata, 0); + send_nt_replies(req, NT_STATUS_OK, params, param_len, *ppdata, 0); return; } @@ -2218,7 +2203,7 @@ /* * Rename was successful. */ - send_nt_replies_new(req, NT_STATUS_OK, NULL, 0, NULL, 0); + send_nt_replies(req, NT_STATUS_OK, NULL, 0, NULL, 0); DEBUG(3,("nt transact rename from = %s, to = %s succeeded.\n", fsp->fsp_name, new_name)); @@ -2316,8 +2301,8 @@ if(max_data_count < sd_size) { - send_nt_replies_new(req, NT_STATUS_BUFFER_TOO_SMALL, - params, 4, *ppdata, 0); + send_nt_replies(req, NT_STATUS_BUFFER_TOO_SMALL, + params, 4, *ppdata, 0); talloc_destroy(mem_ctx); return; } @@ -2367,8 +2352,7 @@ talloc_destroy(mem_ctx); - send_nt_replies_new(req, NT_STATUS_OK, params, 4, data, - (int)sd_size); + send_nt_replies(req, NT_STATUS_OK, params, 4, data, (int)sd_size); return; } @@ -2423,7 +2407,7 @@ done: - send_nt_replies_new(req, NT_STATUS_OK, NULL, 0, NULL, 0); + send_nt_replies(req, NT_STATUS_OK, NULL, 0, NULL, 0); return; } @@ -2472,7 +2456,7 @@ so we can know if we need to pre-allocate or not */ DEBUG(10,("FSCTL_SET_SPARSE: called on FID[0x%04X](but not implemented)\n", fidnum)); - send_nt_replies_new(req, NT_STATUS_OK, NULL, 0, NULL, 0); + send_nt_replies(req, NT_STATUS_OK, NULL, 0, NULL, 0); return; case FSCTL_CREATE_OR_GET_OBJECT_ID: @@ -2498,8 +2482,8 @@ push_file_id_16(pdata, &fsp->file_id); memcpy(pdata+16,create_volume_objectid(conn,objid),16); push_file_id_16(pdata+32, &fsp->file_id); - send_nt_replies_new(req, NT_STATUS_OK, NULL, 0, - pdata, data_count); + send_nt_replies(req, NT_STATUS_OK, NULL, 0, + pdata, data_count); return; } @@ -2643,8 +2627,8 @@ talloc_destroy(shadow_data->mem_ctx); - send_nt_replies_new(req, NT_STATUS_OK, NULL, 0, - pdata, data_count); + send_nt_replies(req, NT_STATUS_OK, NULL, 0, + pdata, data_count); return; } @@ -2698,7 +2682,7 @@ */ /* this works for now... */ - send_nt_replies_new(req, NT_STATUS_OK, NULL, 0, NULL, 0); + send_nt_replies(req, NT_STATUS_OK, NULL, 0, NULL, 0); return; } default: @@ -2983,8 +2967,8 @@ break; } - send_nt_replies_new(req, nt_status, params, param_len, - pdata, data_len); + send_nt_replies(req, nt_status, params, param_len, + pdata, data_len); } /**************************************************************************** @@ -3113,8 +3097,8 @@ return; } - send_nt_replies_new(req, NT_STATUS_OK, params, param_len, - pdata, data_len); + send_nt_replies(req, NT_STATUS_OK, params, param_len, + pdata, data_len); } #endif /* HAVE_SYS_QUOTAS */
