Browse Source

SMB2: SecurityMode: Added Flags attribute

Tal Aloni 6 years ago
parent
commit
c6908e2d93

+ 2 - 0
SMBLibrary/SMB2/Enums/Negotiate/SecurityMode.cs

@@ -1,6 +1,8 @@
+using System;
 
 namespace SMBLibrary.SMB2
 {
+    [Flags]
     public enum SecurityMode : ushort
     {
         SigningEnabled = 0x0001,  // SMB2_NEGOTIATE_SIGNING_ENABLED

+ 2 - 2
SMBLibrary/Server/SMB2/SessionSetupHelper.cs

@@ -1,4 +1,4 @@
-/* Copyright (C) 2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
+/* Copyright (C) 2017-2019 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
  * 
  * You can redistribute this program and/or modify it under the terms of
  * the GNU Lesser Public License as published by the Free Software Foundation,
@@ -66,7 +66,7 @@ namespace SMBLibrary.Server.SMB2
                 if (!isGuest.HasValue || !isGuest.Value)
                 {
                     state.LogToServer(Severity.Information, "Session Setup: User '{0}' authenticated successfully (Domain: '{1}', Workstation: '{2}', OS version: '{3}').", userName, domainName, machineName, osVersion);
-                    bool signingRequired = (request.SecurityMode == SecurityMode.SigningRequired);
+                    bool signingRequired = (request.SecurityMode & SecurityMode.SigningRequired) > 0;
                     state.CreateSession(request.Header.SessionID, userName, machineName, sessionKey, accessToken, signingRequired);
                 }
                 else