Lines Matching refs:sess_data

556 struct sess_data {  struct
560 void (*func)(struct sess_data *); argument
575 sess_alloc_buffer(struct sess_data *sess_data, int wct) in sess_alloc_buffer() argument
578 struct cifs_ses *ses = sess_data->ses; in sess_alloc_buffer()
587 sess_data->iov[0].iov_base = (char *)smb_buf; in sess_alloc_buffer()
588 sess_data->iov[0].iov_len = be32_to_cpu(smb_buf->smb_buf_length) + 4; in sess_alloc_buffer()
593 sess_data->buf0_type = CIFS_SMALL_BUFFER; in sess_alloc_buffer()
596 sess_data->iov[2].iov_base = kmalloc(2000, GFP_KERNEL); in sess_alloc_buffer()
597 if (!sess_data->iov[2].iov_base) { in sess_alloc_buffer()
606 sess_data->iov[0].iov_base = NULL; in sess_alloc_buffer()
607 sess_data->iov[0].iov_len = 0; in sess_alloc_buffer()
608 sess_data->buf0_type = CIFS_NO_BUFFER; in sess_alloc_buffer()
613 sess_free_buffer(struct sess_data *sess_data) in sess_free_buffer() argument
616 free_rsp_buf(sess_data->buf0_type, sess_data->iov[0].iov_base); in sess_free_buffer()
617 sess_data->buf0_type = CIFS_NO_BUFFER; in sess_free_buffer()
618 kfree(sess_data->iov[2].iov_base); in sess_free_buffer()
622 sess_establish_session(struct sess_data *sess_data) in sess_establish_session() argument
624 struct cifs_ses *ses = sess_data->ses; in sess_establish_session()
654 sess_sendreceive(struct sess_data *sess_data) in sess_sendreceive() argument
657 struct smb_hdr *smb_buf = (struct smb_hdr *) sess_data->iov[0].iov_base; in sess_sendreceive()
661 count = sess_data->iov[1].iov_len + sess_data->iov[2].iov_len; in sess_sendreceive()
666 rc = SendReceive2(sess_data->xid, sess_data->ses, in sess_sendreceive()
667 sess_data->iov, 3 /* num_iovecs */, in sess_sendreceive()
668 &sess_data->buf0_type, in sess_sendreceive()
670 cifs_small_buf_release(sess_data->iov[0].iov_base); in sess_sendreceive()
671 memcpy(&sess_data->iov[0], &rsp_iov, sizeof(struct kvec)); in sess_sendreceive()
685 sess_auth_lanman(struct sess_data *sess_data) in sess_auth_lanman() argument
691 struct cifs_ses *ses = sess_data->ses; in sess_auth_lanman()
698 rc = sess_alloc_buffer(sess_data, 10); in sess_auth_lanman()
702 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_lanman()
703 bcc_ptr = sess_data->iov[2].iov_base; in sess_auth_lanman()
738 ascii_ssetup_strings(&bcc_ptr, ses, sess_data->nls_cp); in sess_auth_lanman()
740 sess_data->iov[2].iov_len = (long) bcc_ptr - in sess_auth_lanman()
741 (long) sess_data->iov[2].iov_base; in sess_auth_lanman()
743 rc = sess_sendreceive(sess_data); in sess_auth_lanman()
747 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_lanman()
748 smb_buf = (struct smb_hdr *)sess_data->iov[0].iov_base; in sess_auth_lanman()
776 sess_data->nls_cp); in sess_auth_lanman()
779 sess_data->nls_cp); in sess_auth_lanman()
782 rc = sess_establish_session(sess_data); in sess_auth_lanman()
784 sess_data->result = rc; in sess_auth_lanman()
785 sess_data->func = NULL; in sess_auth_lanman()
786 sess_free_buffer(sess_data); in sess_auth_lanman()
792 sess_auth_ntlm(struct sess_data *sess_data) in sess_auth_ntlm() argument
798 struct cifs_ses *ses = sess_data->ses; in sess_auth_ntlm()
804 rc = sess_alloc_buffer(sess_data, 13); in sess_auth_ntlm()
808 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_ntlm()
809 bcc_ptr = sess_data->iov[2].iov_base; in sess_auth_ntlm()
820 rc = setup_ntlm_response(ses, sess_data->nls_cp); in sess_auth_ntlm()
841 if (sess_data->iov[0].iov_len % 2) { in sess_auth_ntlm()
845 unicode_ssetup_strings(&bcc_ptr, ses, sess_data->nls_cp); in sess_auth_ntlm()
847 ascii_ssetup_strings(&bcc_ptr, ses, sess_data->nls_cp); in sess_auth_ntlm()
851 sess_data->iov[2].iov_len = (long) bcc_ptr - in sess_auth_ntlm()
852 (long) sess_data->iov[2].iov_base; in sess_auth_ntlm()
854 rc = sess_sendreceive(sess_data); in sess_auth_ntlm()
858 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_ntlm()
859 smb_buf = (struct smb_hdr *)sess_data->iov[0].iov_base; in sess_auth_ntlm()
886 sess_data->nls_cp); in sess_auth_ntlm()
889 sess_data->nls_cp); in sess_auth_ntlm()
892 rc = sess_establish_session(sess_data); in sess_auth_ntlm()
894 sess_data->result = rc; in sess_auth_ntlm()
895 sess_data->func = NULL; in sess_auth_ntlm()
896 sess_free_buffer(sess_data); in sess_auth_ntlm()
902 sess_auth_ntlmv2(struct sess_data *sess_data) in sess_auth_ntlmv2() argument
908 struct cifs_ses *ses = sess_data->ses; in sess_auth_ntlmv2()
914 rc = sess_alloc_buffer(sess_data, 13); in sess_auth_ntlmv2()
918 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_ntlmv2()
919 bcc_ptr = sess_data->iov[2].iov_base; in sess_auth_ntlmv2()
929 rc = setup_ntlmv2_rsp(ses, sess_data->nls_cp); in sess_auth_ntlmv2()
949 if (sess_data->iov[0].iov_len % 2) { in sess_auth_ntlmv2()
953 unicode_ssetup_strings(&bcc_ptr, ses, sess_data->nls_cp); in sess_auth_ntlmv2()
955 ascii_ssetup_strings(&bcc_ptr, ses, sess_data->nls_cp); in sess_auth_ntlmv2()
959 sess_data->iov[2].iov_len = (long) bcc_ptr - in sess_auth_ntlmv2()
960 (long) sess_data->iov[2].iov_base; in sess_auth_ntlmv2()
962 rc = sess_sendreceive(sess_data); in sess_auth_ntlmv2()
966 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_ntlmv2()
967 smb_buf = (struct smb_hdr *)sess_data->iov[0].iov_base; in sess_auth_ntlmv2()
994 sess_data->nls_cp); in sess_auth_ntlmv2()
997 sess_data->nls_cp); in sess_auth_ntlmv2()
1000 rc = sess_establish_session(sess_data); in sess_auth_ntlmv2()
1002 sess_data->result = rc; in sess_auth_ntlmv2()
1003 sess_data->func = NULL; in sess_auth_ntlmv2()
1004 sess_free_buffer(sess_data); in sess_auth_ntlmv2()
1011 sess_auth_kerberos(struct sess_data *sess_data) in sess_auth_kerberos() argument
1017 struct cifs_ses *ses = sess_data->ses; in sess_auth_kerberos()
1026 rc = sess_alloc_buffer(sess_data, 12); in sess_auth_kerberos()
1030 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_kerberos()
1031 bcc_ptr = sess_data->iov[2].iov_base; in sess_auth_kerberos()
1067 sess_data->iov[1].iov_base = msg->data + msg->sesskey_len; in sess_auth_kerberos()
1068 sess_data->iov[1].iov_len = msg->secblob_len; in sess_auth_kerberos()
1069 pSMB->req.SecurityBlobLength = cpu_to_le16(sess_data->iov[1].iov_len); in sess_auth_kerberos()
1073 if ((sess_data->iov[0].iov_len in sess_auth_kerberos()
1074 + sess_data->iov[1].iov_len) % 2) { in sess_auth_kerberos()
1078 unicode_oslm_strings(&bcc_ptr, sess_data->nls_cp); in sess_auth_kerberos()
1079 unicode_domain_string(&bcc_ptr, ses, sess_data->nls_cp); in sess_auth_kerberos()
1082 ascii_ssetup_strings(&bcc_ptr, ses, sess_data->nls_cp); in sess_auth_kerberos()
1085 sess_data->iov[2].iov_len = (long) bcc_ptr - in sess_auth_kerberos()
1086 (long) sess_data->iov[2].iov_base; in sess_auth_kerberos()
1088 rc = sess_sendreceive(sess_data); in sess_auth_kerberos()
1092 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_kerberos()
1093 smb_buf = (struct smb_hdr *)sess_data->iov[0].iov_base; in sess_auth_kerberos()
1130 sess_data->nls_cp); in sess_auth_kerberos()
1133 sess_data->nls_cp); in sess_auth_kerberos()
1136 rc = sess_establish_session(sess_data); in sess_auth_kerberos()
1141 sess_data->result = rc; in sess_auth_kerberos()
1142 sess_data->func = NULL; in sess_auth_kerberos()
1143 sess_free_buffer(sess_data); in sess_auth_kerberos()
1155 _sess_auth_rawntlmssp_assemble_req(struct sess_data *sess_data) in _sess_auth_rawntlmssp_assemble_req() argument
1159 struct cifs_ses *ses = sess_data->ses; in _sess_auth_rawntlmssp_assemble_req()
1163 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in _sess_auth_rawntlmssp_assemble_req()
1176 bcc_ptr = sess_data->iov[2].iov_base; in _sess_auth_rawntlmssp_assemble_req()
1178 if ((sess_data->iov[0].iov_len + sess_data->iov[1].iov_len) % 2) { in _sess_auth_rawntlmssp_assemble_req()
1182 unicode_oslm_strings(&bcc_ptr, sess_data->nls_cp); in _sess_auth_rawntlmssp_assemble_req()
1184 sess_data->iov[2].iov_len = (long) bcc_ptr - in _sess_auth_rawntlmssp_assemble_req()
1185 (long) sess_data->iov[2].iov_base; in _sess_auth_rawntlmssp_assemble_req()
1191 sess_auth_rawntlmssp_authenticate(struct sess_data *sess_data);
1194 sess_auth_rawntlmssp_negotiate(struct sess_data *sess_data) in sess_auth_rawntlmssp_negotiate() argument
1199 struct cifs_ses *ses = sess_data->ses; in sess_auth_rawntlmssp_negotiate()
1218 rc = sess_alloc_buffer(sess_data, 12); in sess_auth_rawntlmssp_negotiate()
1222 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_rawntlmssp_negotiate()
1226 sess_data->iov[1].iov_len = sizeof(NEGOTIATE_MESSAGE); in sess_auth_rawntlmssp_negotiate()
1227 sess_data->iov[1].iov_base = pSMB->req.SecurityBlob; in sess_auth_rawntlmssp_negotiate()
1230 rc = _sess_auth_rawntlmssp_assemble_req(sess_data); in sess_auth_rawntlmssp_negotiate()
1234 rc = sess_sendreceive(sess_data); in sess_auth_rawntlmssp_negotiate()
1236 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_rawntlmssp_negotiate()
1237 smb_buf = (struct smb_hdr *)sess_data->iov[0].iov_base; in sess_auth_rawntlmssp_negotiate()
1240 if (sess_data->buf0_type != CIFS_NO_BUFFER && in sess_auth_rawntlmssp_negotiate()
1272 sess_free_buffer(sess_data); in sess_auth_rawntlmssp_negotiate()
1275 sess_data->func = sess_auth_rawntlmssp_authenticate; in sess_auth_rawntlmssp_negotiate()
1285 sess_data->func = NULL; in sess_auth_rawntlmssp_negotiate()
1286 sess_data->result = rc; in sess_auth_rawntlmssp_negotiate()
1290 sess_auth_rawntlmssp_authenticate(struct sess_data *sess_data) in sess_auth_rawntlmssp_authenticate() argument
1295 struct cifs_ses *ses = sess_data->ses; in sess_auth_rawntlmssp_authenticate()
1304 rc = sess_alloc_buffer(sess_data, 12); in sess_auth_rawntlmssp_authenticate()
1309 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_rawntlmssp_authenticate()
1312 &blob_len, ses, sess_data->nls_cp); in sess_auth_rawntlmssp_authenticate()
1315 sess_data->iov[1].iov_len = blob_len; in sess_auth_rawntlmssp_authenticate()
1316 sess_data->iov[1].iov_base = ntlmsspblob; in sess_auth_rawntlmssp_authenticate()
1325 rc = _sess_auth_rawntlmssp_assemble_req(sess_data); in sess_auth_rawntlmssp_authenticate()
1329 rc = sess_sendreceive(sess_data); in sess_auth_rawntlmssp_authenticate()
1333 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_rawntlmssp_authenticate()
1334 smb_buf = (struct smb_hdr *)sess_data->iov[0].iov_base; in sess_auth_rawntlmssp_authenticate()
1372 sess_data->nls_cp); in sess_auth_rawntlmssp_authenticate()
1375 sess_data->nls_cp); in sess_auth_rawntlmssp_authenticate()
1381 sess_free_buffer(sess_data); in sess_auth_rawntlmssp_authenticate()
1384 rc = sess_establish_session(sess_data); in sess_auth_rawntlmssp_authenticate()
1392 sess_data->func = NULL; in sess_auth_rawntlmssp_authenticate()
1393 sess_data->result = rc; in sess_auth_rawntlmssp_authenticate()
1396 static int select_sec(struct cifs_ses *ses, struct sess_data *sess_data) in select_sec() argument
1416 sess_data->func = sess_auth_lanman; in select_sec()
1422 sess_data->func = sess_auth_ntlm; in select_sec()
1425 sess_data->func = sess_auth_ntlmv2; in select_sec()
1429 sess_data->func = sess_auth_kerberos; in select_sec()
1437 sess_data->func = sess_auth_rawntlmssp_negotiate; in select_sec()
1451 struct sess_data *sess_data; in CIFS_SessSetup() local
1458 sess_data = kzalloc(sizeof(struct sess_data), GFP_KERNEL); in CIFS_SessSetup()
1459 if (!sess_data) in CIFS_SessSetup()
1462 rc = select_sec(ses, sess_data); in CIFS_SessSetup()
1466 sess_data->xid = xid; in CIFS_SessSetup()
1467 sess_data->ses = ses; in CIFS_SessSetup()
1468 sess_data->buf0_type = CIFS_NO_BUFFER; in CIFS_SessSetup()
1469 sess_data->nls_cp = (struct nls_table *) nls_cp; in CIFS_SessSetup()
1471 while (sess_data->func) in CIFS_SessSetup()
1472 sess_data->func(sess_data); in CIFS_SessSetup()
1475 rc = sess_data->result; in CIFS_SessSetup()
1478 kfree(sess_data); in CIFS_SessSetup()