54 int param_len, i, pkt_len, andx_len, andx_param_len;
60 if (Tree_Handle ==
NULL) {
71 tree -> con = Con_Handle;
88 if (Tree_Handle ==
NULL)
100 andx_param_len = strlen(service) + 1 + strlen(service_type) + 1;
102 if (Con_Handle -> protocol <
SMB_P_NT1) {
105 fprintf(stderr,
"Doing an LM session setup etc ...\n");
110 param_len = strlen(UserName) + 1 + strlen(PassWord) + 1 +
111 strlen(Con_Handle -> PDomain) + 1 +
112 strlen(Con_Handle -> OSName) + 1;
121 if (Tree_Handle ==
NULL)
154 p = p + strlen(PassWord) + 1;
157 p = p + strlen(UserName);
162 strcpy(p, Con_Handle -> PDomain);
163 p = p + strlen(Con_Handle -> PDomain);
167 strcpy(p, Con_Handle -> OSName);
168 p = p + strlen(Con_Handle -> OSName);
178 fprintf(stderr,
"Doing NT LM Sess Setup etc ... \n");
181 param_len = strlen(UserName) + 1 + strlen(PassWord) +
182 strlen(Con_Handle -> PDomain) + 1 +
183 strlen(Con_Handle -> OSName) + 1 +
184 strlen(Con_Handle -> LMType) + 1;
193 if (Tree_Handle ==
NULL)
228 p = p + strlen(PassWord);
231 p = p + strlen(UserName);
236 strcpy(p, Con_Handle -> PDomain);
237 p = p + strlen(Con_Handle -> PDomain);
241 strcpy(p, Con_Handle -> OSName);
242 p = p + strlen(Con_Handle -> OSName);
246 strcpy(p, Con_Handle -> LMType);
247 p = p + strlen(Con_Handle -> LMType);
268 p = p + strlen(service) + 1;
269 strcpy(p, service_type);
273 if (
RFCNB_Send(Con_Handle -> Trans_Connect, pkt, pkt_len) < 0) {
276 fprintf(stderr,
"Error sending SessSetupAndTCon request\n");
288 if (
RFCNB_Recv(Con_Handle -> Trans_Connect, pkt, pkt_len) < 0) {
291 fprintf(stderr,
"Error receiving response to SessSetupAndTCon\n");
306 fprintf(stderr,
"SMB_SessSetupAndTCon failed with errorclass = %i, Error Code = %i\n",
323 fprintf(stderr,
"SessSetupAndX response. Action = %i\n",
335 tree -> mbs = Con_Handle -> max_xmit;
339 if (Con_Handle -> first_tree ==
NULL) {
341 Con_Handle -> first_tree == tree;
342 Con_Handle -> last_tree == tree;
346 Con_Handle -> last_tree ->
next = tree;
347 tree -> prev = Con_Handle -> last_tree;
348 Con_Handle -> last_tree = tree;
373 int param_len, i, pkt_len, tcon_len, tcon_param_len, open_len,
374 open_param_len, header_len;
390 tree -> con = Con_Handle;
401 fprintf(stderr,
"Could not allocate file handle space ...");
431 tcon_param_len = strlen(service) + 1 + strlen(service_type) + 1;
434 open_param_len = 1 + strlen(
filename) + 1;
436 if (Con_Handle -> protocol <
SMB_P_NT1) {
440 param_len = strlen(UserName) + 1 + strlen(PassWord) + 1 +
441 strlen(Con_Handle -> PDomain) + 1 +
442 strlen(Con_Handle -> OSName) + 1;
446 pkt_len = header_len + tcon_len + tcon_param_len +
447 open_len + open_param_len;
487 p = p + strlen(PassWord) + 1;
490 p = p + strlen(UserName);
495 strcpy(p, Con_Handle -> PDomain);
496 p = p + strlen(Con_Handle -> PDomain);
500 strcpy(p, Con_Handle -> OSName);
501 p = p + strlen(Con_Handle -> OSName);
510 param_len = strlen(UserName) + 1 + strlen(PassWord) +
511 strlen(Con_Handle -> PDomain) + 1 +
512 strlen(Con_Handle -> OSName) + 1 +
513 strlen(Con_Handle -> LMType) + 1;
517 pkt_len = header_len + tcon_len + tcon_param_len +
518 open_len + open_param_len;
560 p = p + strlen(PassWord);
563 p = p + strlen(UserName);
568 strcpy(p, Con_Handle -> PDomain);
569 p = p + strlen(Con_Handle -> PDomain);
573 strcpy(p, Con_Handle -> OSName);
574 p = p + strlen(Con_Handle -> OSName);
578 strcpy(p, Con_Handle -> LMType);
579 p = p + strlen(Con_Handle -> LMType);
592 tcon_len + tcon_param_len));
602 p = p + strlen(service) + 1;
603 strcpy(p, service_type);
607 AndXCom = AndXCom + tcon_len + tcon_param_len;
629 if (
RFCNB_Send(Con_Handle -> Trans_Connect, pkt, pkt_len) < 0) {
632 fprintf(stderr,
"Error sending SessSetupAndTCon request\n");
645 if (
RFCNB_Recv(Con_Handle -> Trans_Connect, pkt, pkt_len) < 0) {
648 fprintf(stderr,
"Error receiving response to SessSetupAndTCon\n");
664 fprintf(stderr,
"SMB_SessSetupAndTCon failed with errorclass = %i, Error Code = %i\n",
682 fprintf(stderr,
"SessSetupAndX response. Action = %i\n",
693 tree -> mbs = Con_Handle -> max_xmit;
696 fprintf(stderr,
"mbs=%i\n", tree -> mbs);
701 strncpy(file_tmp -> filename, filename,
sizeof(file_tmp -> filename) - 1);
702 file_tmp -> tree = tree;
715 fprintf(stderr,
"Word Params = %x, AXO = %x\n",
726 file_tmp -> fileloc = 0;
728 *File_Handle = file_tmp;
732 if (Con_Handle -> first_tree ==
NULL) {
734 Con_Handle -> first_tree == tree;
735 Con_Handle -> last_tree == tree;
739 Con_Handle -> last_tree ->
next = tree;
740 tree -> prev = Con_Handle -> last_tree;
741 Con_Handle -> last_tree = tree;
#define SIVAL(buf, pos, val)
#define SSVAL(buf, pos, val)
int SMB_Logon_TCon_Open(SMB_Handle_Type Con_Handle, char *UserName, char *PassWord, char *service, char *service_type, SMB_Tree_Handle *Tree_Handle, char *filename, WORD mode, WORD search, SMB_File **File_Handle)
SMB_Tree_Handle SMB_Logon_And_TCon(SMB_Handle_Type Con_Handle, SMB_Tree_Handle Tree_Handle, char *UserName, char *PassWord, char *service, char *service_type)
struct RFCNB_Pkt * RFCNB_Alloc_Pkt(int n)
void RFCNB_Free_Pkt(struct RFCNB_Pkt *pkt)
int RFCNB_Send(struct RFCNB_Con *Con_Handle, struct RFCNB_Pkt *udata, int Length)
int RFCNB_Recv(void *Con_Handle, struct RFCNB_Pkt *Data, int Length)
#define SMBlibE_SendFailed
#define SMBlibE_RecvFailed
struct SMB_Tree_Structure * SMB_Tree_Handle
#define SMB_ssetpNTLM_mmc_offset
#define SMB_hdr_axc_offset
#define SMB_ssetpNTLM_res_offset
#define SMB_ssetpLM_bcc_offset
#define SMB_ssetpr_act_offset
#define SMB_hdr_rcls_offset
#define SMB_hdr_wct_offset
#define SMB_ssetpNTLM_cap_offset
#define SMB_tconx_axc_offset
#define SMB_openx_als_offset
#define SMB_ssetpNTLM_mbs_offset
#define SMB_tconx_buf_offset
#define SMB_openx_bcc_offset
#define SMB_openx_tim_offset
#define SMB_openx_ofn_offset
#define SMB_ssetpNTLM_snk_offset
#define SMB_openxr_axo_offset
#define SMB_openxr_acc_offset
#define SMB_ssetpLM_pwl_offset
#define SMB_openx_axo_offset
#define SMB_openx_axc_offset
#define SMB_ssetpNTLM_cipl_offset
#define SMB_openx_buf_offset
#define SMB_hdr_err_offset
#define SMB_hdr_axo_offset
#define SMB_tconx_flg_offset
#define SMB_tconx_pwl_offset
#define SMB_ssetpNTLM_cspl_offset
#define SMB_hdr_mid_offset
#define SMB_openxr_fid_offset
#define SMB_ssetpLM_mbs_offset
#define SMB_hdr_idf_offset
#define SMB_openxr_tim_offset
#define SMB_ssetpLM_buf_offset
#define SMB_hdr_uid_offset
#define SMB_ssetpNTLM_len
#define SMB_tconxr_axo_offset
#define SMB_ssetpNTLM_vcn_offset
#define SMB_hdr_pid_offset
#define SMB_openx_flg_offset
#define SMB_tconx_axo_offset
#define SMB_ssetpLM_res_offset
#define SMB_ssetpNTLM_buf_offset
#define SMB_tconx_bcc_offset
#define SMB_openx_atr_offset
#define SMB_openxr_fsz_offset
#define SMB_openx_mod_offset
#define SMB_ssetpLM_mmc_offset
#define SMB_hdr_tid_offset
#define SMB_openx_axr_offset
#define SMB_openx_fat_offset
#define SMB_ssetpNTLM_bcc_offset
#define SMB_hdr_com_offset
#define SMB_ssetpLM_snk_offset
#define SMB_ssetpLM_vcn_offset