1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-23 00:23:53 +03:00

smb.h: Supporting defines for NT trans calls.

trans2.c: Paranoia bugfixes added when studying nttrans.c.
Jeremy.
This commit is contained in:
Jeremy Allison
-
parent 74565f0039
commit 94e70edef9
2 changed files with 33 additions and 4 deletions

View File

@@ -895,6 +895,31 @@ struct parm_struct
#define smb_droff smb_vwv7
#define smb_drdisp smb_vwv8
/* these are for the NT trans primary request. */
#define smb_nt_MaxSetupCount smb_vwv0
#define smb_nt_Flags (smb_vwv0 + 1)
#define smb_nt_TotalParameterCount (smb_vwv0 + 3)
#define smb_nt_TotalDataCount (smb_vwv0 + 7)
#define smb_nt_MaxParameterCount (smb_vwv0 + 11)
#define smb_nt_MaxDataCount (smb_vwv0 + 15)
#define smb_nt_ParameterCount (smb_vwv0 + 19)
#define smb_nt_ParameterOffset (smb_vwv0 + 23)
#define smb_nt_DataCount (smb_vwv0 + 27)
#define smb_nt_DataOffset (smb_vwv0 + 31)
#define smb_nt_SetupCount (smb_vwv0 + 35)
#define smb_nt_Function (smb_vwv0 + 36)
#define smb_nt_SetupStart (smb_vwv0 + 39)
/* these are for the NT trans secondary request. */
#define smb_nts_TotalParameterCount (smb_vwv0 + 3)
#define smb_nts_TotalDataCount (smb_vwv0 + 7)
#define smb_nts_ParameterCount (smb_vwv0 + 11)
#define smb_nts_ParameterOffset (smb_vwv0 + 15)
#define smb_nts_ParameterDisplacement (smb_vwv0 + 19)
#define smb_nts_DataCount (smb_vwv0 + 23)
#define smb_nts_DataOffset (smb_vwv0 + 27)
#define smb_nts_DataDisplacement (smb_vwv0 + 31)
/* where to find the base of the SMB packet proper */
#define smb_base(buf) (((char *)(buf))+4)

View File

@@ -1787,7 +1787,9 @@ int reply_trans2(char *inbuf,char *outbuf,int length,int bufsize)
if (num_params > total_params || num_data > total_data)
exit_server("invalid params in reply_trans2");
if(params)
memcpy( params, smb_base(inbuf) + SVAL(inbuf, smb_psoff), num_params);
if(data)
memcpy( data, smb_base(inbuf) + SVAL(inbuf, smb_dsoff), num_data);
if(num_data_sofar < total_data || num_params_sofar < total_params)
@@ -1812,7 +1814,9 @@ int reply_trans2(char *inbuf,char *outbuf,int length,int bufsize)
else
DEBUG(0,("reply_trans2: %s in getting secondary trans2 response.\n",
(smb_read_error == READ_ERROR) ? "error" : "timeout" ));
if(params)
free(params);
if(data)
free(data);
return(ERROR(ERRSRV,ERRerror));
}