@@ -1322,9 +1322,8 @@ static int decode_negotiation_token(struct ksmbd_conn *conn,
1322
1322
1323
1323
static int ntlm_negotiate (struct ksmbd_work * work ,
1324
1324
struct negotiate_message * negblob ,
1325
- size_t negblob_len )
1325
+ size_t negblob_len , struct smb2_sess_setup_rsp * rsp )
1326
1326
{
1327
- struct smb2_sess_setup_rsp * rsp = smb2_get_msg (work -> response_buf );
1328
1327
struct challenge_message * chgblob ;
1329
1328
unsigned char * spnego_blob = NULL ;
1330
1329
u16 spnego_blob_len ;
@@ -1429,10 +1428,10 @@ static struct ksmbd_user *session_user(struct ksmbd_conn *conn,
1429
1428
return user ;
1430
1429
}
1431
1430
1432
- static int ntlm_authenticate (struct ksmbd_work * work )
1431
+ static int ntlm_authenticate (struct ksmbd_work * work ,
1432
+ struct smb2_sess_setup_req * req ,
1433
+ struct smb2_sess_setup_rsp * rsp )
1433
1434
{
1434
- struct smb2_sess_setup_req * req = smb2_get_msg (work -> request_buf );
1435
- struct smb2_sess_setup_rsp * rsp = smb2_get_msg (work -> response_buf );
1436
1435
struct ksmbd_conn * conn = work -> conn ;
1437
1436
struct ksmbd_session * sess = work -> sess ;
1438
1437
struct channel * chann = NULL ;
@@ -1566,10 +1565,10 @@ static int ntlm_authenticate(struct ksmbd_work *work)
1566
1565
}
1567
1566
1568
1567
#ifdef CONFIG_SMB_SERVER_KERBEROS5
1569
- static int krb5_authenticate (struct ksmbd_work * work )
1568
+ static int krb5_authenticate (struct ksmbd_work * work ,
1569
+ struct smb2_sess_setup_req * req ,
1570
+ struct smb2_sess_setup_rsp * rsp )
1570
1571
{
1571
- struct smb2_sess_setup_req * req = smb2_get_msg (work -> request_buf );
1572
- struct smb2_sess_setup_rsp * rsp = smb2_get_msg (work -> response_buf );
1573
1572
struct ksmbd_conn * conn = work -> conn ;
1574
1573
struct ksmbd_session * sess = work -> sess ;
1575
1574
char * in_blob , * out_blob ;
@@ -1647,7 +1646,9 @@ static int krb5_authenticate(struct ksmbd_work *work)
1647
1646
return 0 ;
1648
1647
}
1649
1648
#else
1650
- static int krb5_authenticate (struct ksmbd_work * work )
1649
+ static int krb5_authenticate (struct ksmbd_work * work ,
1650
+ struct smb2_sess_setup_req * req ,
1651
+ struct smb2_sess_setup_rsp * rsp )
1651
1652
{
1652
1653
return - EOPNOTSUPP ;
1653
1654
}
@@ -1656,15 +1657,17 @@ static int krb5_authenticate(struct ksmbd_work *work)
1656
1657
int smb2_sess_setup (struct ksmbd_work * work )
1657
1658
{
1658
1659
struct ksmbd_conn * conn = work -> conn ;
1659
- struct smb2_sess_setup_req * req = smb2_get_msg ( work -> request_buf ) ;
1660
- struct smb2_sess_setup_rsp * rsp = smb2_get_msg ( work -> response_buf ) ;
1660
+ struct smb2_sess_setup_req * req ;
1661
+ struct smb2_sess_setup_rsp * rsp ;
1661
1662
struct ksmbd_session * sess ;
1662
1663
struct negotiate_message * negblob ;
1663
1664
unsigned int negblob_len , negblob_off ;
1664
1665
int rc = 0 ;
1665
1666
1666
1667
ksmbd_debug (SMB , "Received request for session setup\n" );
1667
1668
1669
+ WORK_BUFFERS (work , req , rsp );
1670
+
1668
1671
rsp -> StructureSize = cpu_to_le16 (9 );
1669
1672
rsp -> SessionFlags = 0 ;
1670
1673
rsp -> SecurityBufferOffset = cpu_to_le16 (72 );
@@ -1786,7 +1789,7 @@ int smb2_sess_setup(struct ksmbd_work *work)
1786
1789
1787
1790
if (conn -> preferred_auth_mech &
1788
1791
(KSMBD_AUTH_KRB5 | KSMBD_AUTH_MSKRB5 )) {
1789
- rc = krb5_authenticate (work );
1792
+ rc = krb5_authenticate (work , req , rsp );
1790
1793
if (rc ) {
1791
1794
rc = - EINVAL ;
1792
1795
goto out_err ;
@@ -1800,7 +1803,7 @@ int smb2_sess_setup(struct ksmbd_work *work)
1800
1803
sess -> Preauth_HashValue = NULL ;
1801
1804
} else if (conn -> preferred_auth_mech == KSMBD_AUTH_NTLMSSP ) {
1802
1805
if (negblob -> MessageType == NtLmNegotiate ) {
1803
- rc = ntlm_negotiate (work , negblob , negblob_len );
1806
+ rc = ntlm_negotiate (work , negblob , negblob_len , rsp );
1804
1807
if (rc )
1805
1808
goto out_err ;
1806
1809
rsp -> hdr .Status =
@@ -1813,7 +1816,7 @@ int smb2_sess_setup(struct ksmbd_work *work)
1813
1816
le16_to_cpu (rsp -> SecurityBufferLength ) - 1 );
1814
1817
1815
1818
} else if (negblob -> MessageType == NtLmAuthenticate ) {
1816
- rc = ntlm_authenticate (work );
1819
+ rc = ntlm_authenticate (work , req , rsp );
1817
1820
if (rc )
1818
1821
goto out_err ;
1819
1822
0 commit comments