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;