mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-07-14 05:15:03 +02:00
Server: Fix issue when GSSAPI SessionKey is null (#182)
This commit is contained in:
parent
23fbe4feca
commit
4c59c21670
2 changed files with 3 additions and 3 deletions
|
@ -38,7 +38,7 @@ namespace SMBLibrary.Server.SMB1
|
|||
object accessToken = securityProvider.GetContextAttribute(state.AuthenticationContext, GSSAttributeName.AccessToken);
|
||||
bool? isGuest = securityProvider.GetContextAttribute(state.AuthenticationContext, GSSAttributeName.IsGuest) as bool?;
|
||||
|
||||
if (sessionKey.Length > 16)
|
||||
if (sessionKey != null && sessionKey.Length > 16)
|
||||
{
|
||||
// [MS-CIFS] 3.3.5.43 If the session key is equal to or longer than 16 bytes, only the least significant 16 bytes MUST be stored in Server.Session.SessionKey
|
||||
sessionKey = ByteReader.ReadBytes(sessionKey, 0, 16);
|
||||
|
@ -128,7 +128,7 @@ namespace SMBLibrary.Server.SMB1
|
|||
object accessToken = securityProvider.GetContextAttribute(state.AuthenticationContext, GSSAttributeName.AccessToken);
|
||||
bool? isGuest = securityProvider.GetContextAttribute(state.AuthenticationContext, GSSAttributeName.IsGuest) as bool?;
|
||||
|
||||
if (sessionKey.Length > 16)
|
||||
if (sessionKey != null && sessionKey.Length > 16)
|
||||
{
|
||||
// [MS-CIFS] 3.3.5.43 If the session key is equal to or longer than 16 bytes, only the least significant 16 bytes MUST be stored in Server.Session.SessionKey
|
||||
sessionKey = ByteReader.ReadBytes(sessionKey, 0, 16);
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace SMBLibrary.Server.SMB2
|
|||
object accessToken = securityProvider.GetContextAttribute(state.AuthenticationContext, GSSAttributeName.AccessToken);
|
||||
bool? isGuest = securityProvider.GetContextAttribute(state.AuthenticationContext, GSSAttributeName.IsGuest) as bool?;
|
||||
|
||||
if (sessionKey.Length > 16)
|
||||
if (sessionKey != null && sessionKey.Length > 16)
|
||||
{
|
||||
// [MS-SMB2] 3.3.1.8 SessionKey MUST be set to the first 16 bytes of the cryptographic key queried from the GSS protocol for this authenticated context.
|
||||
sessionKey = ByteReader.ReadBytes(sessionKey, 0, 16);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue