Lines Matching refs:sess_data
564 struct sess_data { struct
568 void (*func)(struct sess_data *); argument
583 sess_alloc_buffer(struct sess_data *sess_data, int wct) in sess_alloc_buffer() argument
586 struct cifs_ses *ses = sess_data->ses; in sess_alloc_buffer()
595 sess_data->iov[0].iov_base = (char *)smb_buf; in sess_alloc_buffer()
596 sess_data->iov[0].iov_len = be32_to_cpu(smb_buf->smb_buf_length) + 4; in sess_alloc_buffer()
601 sess_data->buf0_type = CIFS_SMALL_BUFFER; in sess_alloc_buffer()
604 sess_data->iov[2].iov_base = kmalloc(2000, GFP_KERNEL); in sess_alloc_buffer()
605 if (!sess_data->iov[2].iov_base) { in sess_alloc_buffer()
614 sess_data->iov[0].iov_base = NULL; in sess_alloc_buffer()
615 sess_data->iov[0].iov_len = 0; in sess_alloc_buffer()
616 sess_data->buf0_type = CIFS_NO_BUFFER; in sess_alloc_buffer()
621 sess_free_buffer(struct sess_data *sess_data) in sess_free_buffer() argument
624 free_rsp_buf(sess_data->buf0_type, sess_data->iov[0].iov_base); in sess_free_buffer()
625 sess_data->buf0_type = CIFS_NO_BUFFER; in sess_free_buffer()
626 kfree(sess_data->iov[2].iov_base); in sess_free_buffer()
630 sess_establish_session(struct sess_data *sess_data) in sess_establish_session() argument
632 struct cifs_ses *ses = sess_data->ses; in sess_establish_session()
662 sess_sendreceive(struct sess_data *sess_data) in sess_sendreceive() argument
665 struct smb_hdr *smb_buf = (struct smb_hdr *) sess_data->iov[0].iov_base; in sess_sendreceive()
669 count = sess_data->iov[1].iov_len + sess_data->iov[2].iov_len; in sess_sendreceive()
674 rc = SendReceive2(sess_data->xid, sess_data->ses, in sess_sendreceive()
675 sess_data->iov, 3 /* num_iovecs */, in sess_sendreceive()
676 &sess_data->buf0_type, in sess_sendreceive()
678 cifs_small_buf_release(sess_data->iov[0].iov_base); in sess_sendreceive()
679 memcpy(&sess_data->iov[0], &rsp_iov, sizeof(struct kvec)); in sess_sendreceive()
693 sess_auth_lanman(struct sess_data *sess_data) in sess_auth_lanman() argument
699 struct cifs_ses *ses = sess_data->ses; in sess_auth_lanman()
705 rc = sess_alloc_buffer(sess_data, 10); in sess_auth_lanman()
709 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_lanman()
710 bcc_ptr = sess_data->iov[2].iov_base; in sess_auth_lanman()
745 ascii_ssetup_strings(&bcc_ptr, ses, sess_data->nls_cp); in sess_auth_lanman()
747 sess_data->iov[2].iov_len = (long) bcc_ptr - in sess_auth_lanman()
748 (long) sess_data->iov[2].iov_base; in sess_auth_lanman()
750 rc = sess_sendreceive(sess_data); in sess_auth_lanman()
754 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_lanman()
755 smb_buf = (struct smb_hdr *)sess_data->iov[0].iov_base; in sess_auth_lanman()
783 sess_data->nls_cp); in sess_auth_lanman()
786 sess_data->nls_cp); in sess_auth_lanman()
789 rc = sess_establish_session(sess_data); in sess_auth_lanman()
791 sess_data->result = rc; in sess_auth_lanman()
792 sess_data->func = NULL; in sess_auth_lanman()
793 sess_free_buffer(sess_data); in sess_auth_lanman()
799 sess_auth_ntlm(struct sess_data *sess_data) in sess_auth_ntlm() argument
805 struct cifs_ses *ses = sess_data->ses; in sess_auth_ntlm()
811 rc = sess_alloc_buffer(sess_data, 13); in sess_auth_ntlm()
815 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_ntlm()
816 bcc_ptr = sess_data->iov[2].iov_base; in sess_auth_ntlm()
827 rc = setup_ntlm_response(ses, sess_data->nls_cp); in sess_auth_ntlm()
848 if (sess_data->iov[0].iov_len % 2) { in sess_auth_ntlm()
852 unicode_ssetup_strings(&bcc_ptr, ses, sess_data->nls_cp); in sess_auth_ntlm()
854 ascii_ssetup_strings(&bcc_ptr, ses, sess_data->nls_cp); in sess_auth_ntlm()
858 sess_data->iov[2].iov_len = (long) bcc_ptr - in sess_auth_ntlm()
859 (long) sess_data->iov[2].iov_base; in sess_auth_ntlm()
861 rc = sess_sendreceive(sess_data); in sess_auth_ntlm()
865 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_ntlm()
866 smb_buf = (struct smb_hdr *)sess_data->iov[0].iov_base; in sess_auth_ntlm()
893 sess_data->nls_cp); in sess_auth_ntlm()
896 sess_data->nls_cp); in sess_auth_ntlm()
899 rc = sess_establish_session(sess_data); in sess_auth_ntlm()
901 sess_data->result = rc; in sess_auth_ntlm()
902 sess_data->func = NULL; in sess_auth_ntlm()
903 sess_free_buffer(sess_data); in sess_auth_ntlm()
909 sess_auth_ntlmv2(struct sess_data *sess_data) in sess_auth_ntlmv2() argument
915 struct cifs_ses *ses = sess_data->ses; in sess_auth_ntlmv2()
921 rc = sess_alloc_buffer(sess_data, 13); in sess_auth_ntlmv2()
925 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_ntlmv2()
926 bcc_ptr = sess_data->iov[2].iov_base; in sess_auth_ntlmv2()
936 rc = setup_ntlmv2_rsp(ses, sess_data->nls_cp); in sess_auth_ntlmv2()
956 if (sess_data->iov[0].iov_len % 2) { in sess_auth_ntlmv2()
960 unicode_ssetup_strings(&bcc_ptr, ses, sess_data->nls_cp); in sess_auth_ntlmv2()
962 ascii_ssetup_strings(&bcc_ptr, ses, sess_data->nls_cp); in sess_auth_ntlmv2()
966 sess_data->iov[2].iov_len = (long) bcc_ptr - in sess_auth_ntlmv2()
967 (long) sess_data->iov[2].iov_base; in sess_auth_ntlmv2()
969 rc = sess_sendreceive(sess_data); in sess_auth_ntlmv2()
973 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_ntlmv2()
974 smb_buf = (struct smb_hdr *)sess_data->iov[0].iov_base; in sess_auth_ntlmv2()
1001 sess_data->nls_cp); in sess_auth_ntlmv2()
1004 sess_data->nls_cp); in sess_auth_ntlmv2()
1007 rc = sess_establish_session(sess_data); in sess_auth_ntlmv2()
1009 sess_data->result = rc; in sess_auth_ntlmv2()
1010 sess_data->func = NULL; in sess_auth_ntlmv2()
1011 sess_free_buffer(sess_data); in sess_auth_ntlmv2()
1018 sess_auth_kerberos(struct sess_data *sess_data) in sess_auth_kerberos() argument
1024 struct cifs_ses *ses = sess_data->ses; in sess_auth_kerberos()
1033 rc = sess_alloc_buffer(sess_data, 12); in sess_auth_kerberos()
1037 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_kerberos()
1038 bcc_ptr = sess_data->iov[2].iov_base; in sess_auth_kerberos()
1074 sess_data->iov[1].iov_base = msg->data + msg->sesskey_len; in sess_auth_kerberos()
1075 sess_data->iov[1].iov_len = msg->secblob_len; in sess_auth_kerberos()
1076 pSMB->req.SecurityBlobLength = cpu_to_le16(sess_data->iov[1].iov_len); in sess_auth_kerberos()
1080 if ((sess_data->iov[0].iov_len in sess_auth_kerberos()
1081 + sess_data->iov[1].iov_len) % 2) { in sess_auth_kerberos()
1085 unicode_oslm_strings(&bcc_ptr, sess_data->nls_cp); in sess_auth_kerberos()
1086 unicode_domain_string(&bcc_ptr, ses, sess_data->nls_cp); in sess_auth_kerberos()
1089 ascii_ssetup_strings(&bcc_ptr, ses, sess_data->nls_cp); in sess_auth_kerberos()
1092 sess_data->iov[2].iov_len = (long) bcc_ptr - in sess_auth_kerberos()
1093 (long) sess_data->iov[2].iov_base; in sess_auth_kerberos()
1095 rc = sess_sendreceive(sess_data); in sess_auth_kerberos()
1099 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_kerberos()
1100 smb_buf = (struct smb_hdr *)sess_data->iov[0].iov_base; in sess_auth_kerberos()
1137 sess_data->nls_cp); in sess_auth_kerberos()
1140 sess_data->nls_cp); in sess_auth_kerberos()
1143 rc = sess_establish_session(sess_data); in sess_auth_kerberos()
1148 sess_data->result = rc; in sess_auth_kerberos()
1149 sess_data->func = NULL; in sess_auth_kerberos()
1150 sess_free_buffer(sess_data); in sess_auth_kerberos()
1162 _sess_auth_rawntlmssp_assemble_req(struct sess_data *sess_data) in _sess_auth_rawntlmssp_assemble_req() argument
1165 struct cifs_ses *ses = sess_data->ses; in _sess_auth_rawntlmssp_assemble_req()
1169 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in _sess_auth_rawntlmssp_assemble_req()
1181 bcc_ptr = sess_data->iov[2].iov_base; in _sess_auth_rawntlmssp_assemble_req()
1183 if ((sess_data->iov[0].iov_len + sess_data->iov[1].iov_len) % 2) { in _sess_auth_rawntlmssp_assemble_req()
1187 unicode_oslm_strings(&bcc_ptr, sess_data->nls_cp); in _sess_auth_rawntlmssp_assemble_req()
1189 sess_data->iov[2].iov_len = (long) bcc_ptr - in _sess_auth_rawntlmssp_assemble_req()
1190 (long) sess_data->iov[2].iov_base; in _sess_auth_rawntlmssp_assemble_req()
1196 sess_auth_rawntlmssp_authenticate(struct sess_data *sess_data);
1199 sess_auth_rawntlmssp_negotiate(struct sess_data *sess_data) in sess_auth_rawntlmssp_negotiate() argument
1204 struct cifs_ses *ses = sess_data->ses; in sess_auth_rawntlmssp_negotiate()
1223 rc = sess_alloc_buffer(sess_data, 12); in sess_auth_rawntlmssp_negotiate()
1227 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_rawntlmssp_negotiate()
1231 sess_data->iov[1].iov_len = sizeof(NEGOTIATE_MESSAGE); in sess_auth_rawntlmssp_negotiate()
1232 sess_data->iov[1].iov_base = pSMB->req.SecurityBlob; in sess_auth_rawntlmssp_negotiate()
1235 rc = _sess_auth_rawntlmssp_assemble_req(sess_data); in sess_auth_rawntlmssp_negotiate()
1239 rc = sess_sendreceive(sess_data); in sess_auth_rawntlmssp_negotiate()
1241 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_rawntlmssp_negotiate()
1242 smb_buf = (struct smb_hdr *)sess_data->iov[0].iov_base; in sess_auth_rawntlmssp_negotiate()
1245 if (sess_data->buf0_type != CIFS_NO_BUFFER && in sess_auth_rawntlmssp_negotiate()
1277 sess_free_buffer(sess_data); in sess_auth_rawntlmssp_negotiate()
1280 sess_data->func = sess_auth_rawntlmssp_authenticate; in sess_auth_rawntlmssp_negotiate()
1290 sess_data->func = NULL; in sess_auth_rawntlmssp_negotiate()
1291 sess_data->result = rc; in sess_auth_rawntlmssp_negotiate()
1295 sess_auth_rawntlmssp_authenticate(struct sess_data *sess_data) in sess_auth_rawntlmssp_authenticate() argument
1300 struct cifs_ses *ses = sess_data->ses; in sess_auth_rawntlmssp_authenticate()
1309 rc = sess_alloc_buffer(sess_data, 12); in sess_auth_rawntlmssp_authenticate()
1314 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_rawntlmssp_authenticate()
1317 &blob_len, ses, sess_data->nls_cp); in sess_auth_rawntlmssp_authenticate()
1320 sess_data->iov[1].iov_len = blob_len; in sess_auth_rawntlmssp_authenticate()
1321 sess_data->iov[1].iov_base = ntlmsspblob; in sess_auth_rawntlmssp_authenticate()
1330 rc = _sess_auth_rawntlmssp_assemble_req(sess_data); in sess_auth_rawntlmssp_authenticate()
1334 rc = sess_sendreceive(sess_data); in sess_auth_rawntlmssp_authenticate()
1338 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_rawntlmssp_authenticate()
1339 smb_buf = (struct smb_hdr *)sess_data->iov[0].iov_base; in sess_auth_rawntlmssp_authenticate()
1377 sess_data->nls_cp); in sess_auth_rawntlmssp_authenticate()
1380 sess_data->nls_cp); in sess_auth_rawntlmssp_authenticate()
1386 sess_free_buffer(sess_data); in sess_auth_rawntlmssp_authenticate()
1389 rc = sess_establish_session(sess_data); in sess_auth_rawntlmssp_authenticate()
1397 sess_data->func = NULL; in sess_auth_rawntlmssp_authenticate()
1398 sess_data->result = rc; in sess_auth_rawntlmssp_authenticate()
1401 static int select_sec(struct cifs_ses *ses, struct sess_data *sess_data) in select_sec() argument
1421 sess_data->func = sess_auth_lanman; in select_sec()
1427 sess_data->func = sess_auth_ntlm; in select_sec()
1430 sess_data->func = sess_auth_ntlmv2; in select_sec()
1434 sess_data->func = sess_auth_kerberos; in select_sec()
1442 sess_data->func = sess_auth_rawntlmssp_negotiate; in select_sec()
1456 struct sess_data *sess_data; in CIFS_SessSetup() local
1463 sess_data = kzalloc(sizeof(struct sess_data), GFP_KERNEL); in CIFS_SessSetup()
1464 if (!sess_data) in CIFS_SessSetup()
1467 rc = select_sec(ses, sess_data); in CIFS_SessSetup()
1471 sess_data->xid = xid; in CIFS_SessSetup()
1472 sess_data->ses = ses; in CIFS_SessSetup()
1473 sess_data->buf0_type = CIFS_NO_BUFFER; in CIFS_SessSetup()
1474 sess_data->nls_cp = (struct nls_table *) nls_cp; in CIFS_SessSetup()
1476 while (sess_data->func) in CIFS_SessSetup()
1477 sess_data->func(sess_data); in CIFS_SessSetup()
1480 rc = sess_data->result; in CIFS_SessSetup()
1483 kfree(sess_data); in CIFS_SessSetup()