Lines Matching refs:sess_data

532 struct sess_data {  struct
536 void (*func)(struct sess_data *); argument
551 sess_alloc_buffer(struct sess_data *sess_data, int wct) in sess_alloc_buffer() argument
554 struct cifs_ses *ses = sess_data->ses; in sess_alloc_buffer()
563 sess_data->iov[0].iov_base = (char *)smb_buf; in sess_alloc_buffer()
564 sess_data->iov[0].iov_len = be32_to_cpu(smb_buf->smb_buf_length) + 4; in sess_alloc_buffer()
569 sess_data->buf0_type = CIFS_SMALL_BUFFER; in sess_alloc_buffer()
572 sess_data->iov[2].iov_base = kmalloc(2000, GFP_KERNEL); in sess_alloc_buffer()
573 if (!sess_data->iov[2].iov_base) { in sess_alloc_buffer()
582 sess_data->iov[0].iov_base = NULL; in sess_alloc_buffer()
583 sess_data->iov[0].iov_len = 0; in sess_alloc_buffer()
584 sess_data->buf0_type = CIFS_NO_BUFFER; in sess_alloc_buffer()
589 sess_free_buffer(struct sess_data *sess_data) in sess_free_buffer() argument
592 free_rsp_buf(sess_data->buf0_type, sess_data->iov[0].iov_base); in sess_free_buffer()
593 sess_data->buf0_type = CIFS_NO_BUFFER; in sess_free_buffer()
594 kfree(sess_data->iov[2].iov_base); in sess_free_buffer()
598 sess_establish_session(struct sess_data *sess_data) in sess_establish_session() argument
600 struct cifs_ses *ses = sess_data->ses; in sess_establish_session()
630 sess_sendreceive(struct sess_data *sess_data) in sess_sendreceive() argument
633 struct smb_hdr *smb_buf = (struct smb_hdr *) sess_data->iov[0].iov_base; in sess_sendreceive()
636 count = sess_data->iov[1].iov_len + sess_data->iov[2].iov_len; in sess_sendreceive()
641 rc = SendReceive2(sess_data->xid, sess_data->ses, in sess_sendreceive()
642 sess_data->iov, 3 /* num_iovecs */, in sess_sendreceive()
643 &sess_data->buf0_type, in sess_sendreceive()
658 sess_auth_lanman(struct sess_data *sess_data) in sess_auth_lanman() argument
664 struct cifs_ses *ses = sess_data->ses; in sess_auth_lanman()
671 rc = sess_alloc_buffer(sess_data, 10); in sess_auth_lanman()
675 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_lanman()
676 bcc_ptr = sess_data->iov[2].iov_base; in sess_auth_lanman()
709 ascii_ssetup_strings(&bcc_ptr, ses, sess_data->nls_cp); in sess_auth_lanman()
711 sess_data->iov[2].iov_len = (long) bcc_ptr - in sess_auth_lanman()
712 (long) sess_data->iov[2].iov_base; in sess_auth_lanman()
714 rc = sess_sendreceive(sess_data); in sess_auth_lanman()
718 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_lanman()
719 smb_buf = (struct smb_hdr *)sess_data->iov[0].iov_base; in sess_auth_lanman()
747 sess_data->nls_cp); in sess_auth_lanman()
750 sess_data->nls_cp); in sess_auth_lanman()
753 rc = sess_establish_session(sess_data); in sess_auth_lanman()
755 sess_data->result = rc; in sess_auth_lanman()
756 sess_data->func = NULL; in sess_auth_lanman()
757 sess_free_buffer(sess_data); in sess_auth_lanman()
763 sess_auth_ntlm(struct sess_data *sess_data) in sess_auth_ntlm() argument
769 struct cifs_ses *ses = sess_data->ses; in sess_auth_ntlm()
775 rc = sess_alloc_buffer(sess_data, 13); in sess_auth_ntlm()
779 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_ntlm()
780 bcc_ptr = sess_data->iov[2].iov_base; in sess_auth_ntlm()
791 rc = setup_ntlm_response(ses, sess_data->nls_cp); in sess_auth_ntlm()
812 if (sess_data->iov[0].iov_len % 2) { in sess_auth_ntlm()
816 unicode_ssetup_strings(&bcc_ptr, ses, sess_data->nls_cp); in sess_auth_ntlm()
818 ascii_ssetup_strings(&bcc_ptr, ses, sess_data->nls_cp); in sess_auth_ntlm()
822 sess_data->iov[2].iov_len = (long) bcc_ptr - in sess_auth_ntlm()
823 (long) sess_data->iov[2].iov_base; in sess_auth_ntlm()
825 rc = sess_sendreceive(sess_data); in sess_auth_ntlm()
829 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_ntlm()
830 smb_buf = (struct smb_hdr *)sess_data->iov[0].iov_base; in sess_auth_ntlm()
857 sess_data->nls_cp); in sess_auth_ntlm()
860 sess_data->nls_cp); in sess_auth_ntlm()
863 rc = sess_establish_session(sess_data); in sess_auth_ntlm()
865 sess_data->result = rc; in sess_auth_ntlm()
866 sess_data->func = NULL; in sess_auth_ntlm()
867 sess_free_buffer(sess_data); in sess_auth_ntlm()
873 sess_auth_ntlmv2(struct sess_data *sess_data) in sess_auth_ntlmv2() argument
879 struct cifs_ses *ses = sess_data->ses; in sess_auth_ntlmv2()
885 rc = sess_alloc_buffer(sess_data, 13); in sess_auth_ntlmv2()
889 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_ntlmv2()
890 bcc_ptr = sess_data->iov[2].iov_base; in sess_auth_ntlmv2()
900 rc = setup_ntlmv2_rsp(ses, sess_data->nls_cp); in sess_auth_ntlmv2()
920 if (sess_data->iov[0].iov_len % 2) { in sess_auth_ntlmv2()
924 unicode_ssetup_strings(&bcc_ptr, ses, sess_data->nls_cp); in sess_auth_ntlmv2()
926 ascii_ssetup_strings(&bcc_ptr, ses, sess_data->nls_cp); in sess_auth_ntlmv2()
930 sess_data->iov[2].iov_len = (long) bcc_ptr - in sess_auth_ntlmv2()
931 (long) sess_data->iov[2].iov_base; in sess_auth_ntlmv2()
933 rc = sess_sendreceive(sess_data); in sess_auth_ntlmv2()
937 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_ntlmv2()
938 smb_buf = (struct smb_hdr *)sess_data->iov[0].iov_base; in sess_auth_ntlmv2()
965 sess_data->nls_cp); in sess_auth_ntlmv2()
968 sess_data->nls_cp); in sess_auth_ntlmv2()
971 rc = sess_establish_session(sess_data); in sess_auth_ntlmv2()
973 sess_data->result = rc; in sess_auth_ntlmv2()
974 sess_data->func = NULL; in sess_auth_ntlmv2()
975 sess_free_buffer(sess_data); in sess_auth_ntlmv2()
982 sess_auth_kerberos(struct sess_data *sess_data) in sess_auth_kerberos() argument
988 struct cifs_ses *ses = sess_data->ses; in sess_auth_kerberos()
997 rc = sess_alloc_buffer(sess_data, 12); in sess_auth_kerberos()
1001 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_kerberos()
1002 bcc_ptr = sess_data->iov[2].iov_base; in sess_auth_kerberos()
1038 sess_data->iov[1].iov_base = msg->data + msg->sesskey_len; in sess_auth_kerberos()
1039 sess_data->iov[1].iov_len = msg->secblob_len; in sess_auth_kerberos()
1040 pSMB->req.SecurityBlobLength = cpu_to_le16(sess_data->iov[1].iov_len); in sess_auth_kerberos()
1044 if ((sess_data->iov[0].iov_len in sess_auth_kerberos()
1045 + sess_data->iov[1].iov_len) % 2) { in sess_auth_kerberos()
1049 unicode_oslm_strings(&bcc_ptr, sess_data->nls_cp); in sess_auth_kerberos()
1050 unicode_domain_string(&bcc_ptr, ses, sess_data->nls_cp); in sess_auth_kerberos()
1053 ascii_ssetup_strings(&bcc_ptr, ses, sess_data->nls_cp); in sess_auth_kerberos()
1056 sess_data->iov[2].iov_len = (long) bcc_ptr - in sess_auth_kerberos()
1057 (long) sess_data->iov[2].iov_base; in sess_auth_kerberos()
1059 rc = sess_sendreceive(sess_data); in sess_auth_kerberos()
1063 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_kerberos()
1064 smb_buf = (struct smb_hdr *)sess_data->iov[0].iov_base; in sess_auth_kerberos()
1101 sess_data->nls_cp); in sess_auth_kerberos()
1104 sess_data->nls_cp); in sess_auth_kerberos()
1107 rc = sess_establish_session(sess_data); in sess_auth_kerberos()
1112 sess_data->result = rc; in sess_auth_kerberos()
1113 sess_data->func = NULL; in sess_auth_kerberos()
1114 sess_free_buffer(sess_data); in sess_auth_kerberos()
1126 _sess_auth_rawntlmssp_assemble_req(struct sess_data *sess_data) in _sess_auth_rawntlmssp_assemble_req() argument
1130 struct cifs_ses *ses = sess_data->ses; in _sess_auth_rawntlmssp_assemble_req()
1134 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in _sess_auth_rawntlmssp_assemble_req()
1147 bcc_ptr = sess_data->iov[2].iov_base; in _sess_auth_rawntlmssp_assemble_req()
1149 if ((sess_data->iov[0].iov_len + sess_data->iov[1].iov_len) % 2) { in _sess_auth_rawntlmssp_assemble_req()
1153 unicode_oslm_strings(&bcc_ptr, sess_data->nls_cp); in _sess_auth_rawntlmssp_assemble_req()
1155 sess_data->iov[2].iov_len = (long) bcc_ptr - in _sess_auth_rawntlmssp_assemble_req()
1156 (long) sess_data->iov[2].iov_base; in _sess_auth_rawntlmssp_assemble_req()
1162 sess_auth_rawntlmssp_authenticate(struct sess_data *sess_data);
1165 sess_auth_rawntlmssp_negotiate(struct sess_data *sess_data) in sess_auth_rawntlmssp_negotiate() argument
1170 struct cifs_ses *ses = sess_data->ses; in sess_auth_rawntlmssp_negotiate()
1189 rc = sess_alloc_buffer(sess_data, 12); in sess_auth_rawntlmssp_negotiate()
1193 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_rawntlmssp_negotiate()
1197 sess_data->iov[1].iov_len = sizeof(NEGOTIATE_MESSAGE); in sess_auth_rawntlmssp_negotiate()
1198 sess_data->iov[1].iov_base = pSMB->req.SecurityBlob; in sess_auth_rawntlmssp_negotiate()
1201 rc = _sess_auth_rawntlmssp_assemble_req(sess_data); in sess_auth_rawntlmssp_negotiate()
1205 rc = sess_sendreceive(sess_data); in sess_auth_rawntlmssp_negotiate()
1207 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_rawntlmssp_negotiate()
1208 smb_buf = (struct smb_hdr *)sess_data->iov[0].iov_base; in sess_auth_rawntlmssp_negotiate()
1211 if (sess_data->buf0_type != CIFS_NO_BUFFER && in sess_auth_rawntlmssp_negotiate()
1243 sess_free_buffer(sess_data); in sess_auth_rawntlmssp_negotiate()
1246 sess_data->func = sess_auth_rawntlmssp_authenticate; in sess_auth_rawntlmssp_negotiate()
1256 sess_data->func = NULL; in sess_auth_rawntlmssp_negotiate()
1257 sess_data->result = rc; in sess_auth_rawntlmssp_negotiate()
1261 sess_auth_rawntlmssp_authenticate(struct sess_data *sess_data) in sess_auth_rawntlmssp_authenticate() argument
1266 struct cifs_ses *ses = sess_data->ses; in sess_auth_rawntlmssp_authenticate()
1275 rc = sess_alloc_buffer(sess_data, 12); in sess_auth_rawntlmssp_authenticate()
1280 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_rawntlmssp_authenticate()
1295 &blob_len, ses, sess_data->nls_cp); in sess_auth_rawntlmssp_authenticate()
1298 sess_data->iov[1].iov_len = blob_len; in sess_auth_rawntlmssp_authenticate()
1299 sess_data->iov[1].iov_base = ntlmsspblob; in sess_auth_rawntlmssp_authenticate()
1308 rc = _sess_auth_rawntlmssp_assemble_req(sess_data); in sess_auth_rawntlmssp_authenticate()
1312 rc = sess_sendreceive(sess_data); in sess_auth_rawntlmssp_authenticate()
1316 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; in sess_auth_rawntlmssp_authenticate()
1317 smb_buf = (struct smb_hdr *)sess_data->iov[0].iov_base; in sess_auth_rawntlmssp_authenticate()
1355 sess_data->nls_cp); in sess_auth_rawntlmssp_authenticate()
1358 sess_data->nls_cp); in sess_auth_rawntlmssp_authenticate()
1364 sess_free_buffer(sess_data); in sess_auth_rawntlmssp_authenticate()
1367 rc = sess_establish_session(sess_data); in sess_auth_rawntlmssp_authenticate()
1375 sess_data->func = NULL; in sess_auth_rawntlmssp_authenticate()
1376 sess_data->result = rc; in sess_auth_rawntlmssp_authenticate()
1379 static int select_sec(struct cifs_ses *ses, struct sess_data *sess_data) in select_sec() argument
1399 sess_data->func = sess_auth_lanman; in select_sec()
1405 sess_data->func = sess_auth_ntlm; in select_sec()
1408 sess_data->func = sess_auth_ntlmv2; in select_sec()
1412 sess_data->func = sess_auth_kerberos; in select_sec()
1420 sess_data->func = sess_auth_rawntlmssp_negotiate; in select_sec()
1434 struct sess_data *sess_data; in CIFS_SessSetup() local
1441 sess_data = kzalloc(sizeof(struct sess_data), GFP_KERNEL); in CIFS_SessSetup()
1442 if (!sess_data) in CIFS_SessSetup()
1445 rc = select_sec(ses, sess_data); in CIFS_SessSetup()
1449 sess_data->xid = xid; in CIFS_SessSetup()
1450 sess_data->ses = ses; in CIFS_SessSetup()
1451 sess_data->buf0_type = CIFS_NO_BUFFER; in CIFS_SessSetup()
1452 sess_data->nls_cp = (struct nls_table *) nls_cp; in CIFS_SessSetup()
1454 while (sess_data->func) in CIFS_SessSetup()
1455 sess_data->func(sess_data); in CIFS_SessSetup()
1458 rc = sess_data->result; in CIFS_SessSetup()
1461 kfree(sess_data); in CIFS_SessSetup()