Browse Source

GSSProvider: Properly handle invalid SPNEGO Token

Tal Aloni 7 years ago
parent
commit
97a48adf4a
1 changed files with 9 additions and 1 deletions
  1. 9 1
      SMBLibrary/Authentication/GSSAPI/GSSProvider.cs

+ 9 - 1
SMBLibrary/Authentication/GSSAPI/GSSProvider.cs

@@ -54,7 +54,15 @@ namespace SMBLibrary.Authentication.GSSAPI
         public virtual NTStatus AcceptSecurityContext(ref GSSContext context, byte[] inputToken, out byte[] outputToken)
         public virtual NTStatus AcceptSecurityContext(ref GSSContext context, byte[] inputToken, out byte[] outputToken)
         {
         {
             outputToken = null;
             outputToken = null;
-            SimpleProtectedNegotiationToken spnegoToken = SimpleProtectedNegotiationToken.ReadToken(inputToken, 0);
+            SimpleProtectedNegotiationToken spnegoToken = null;
+            try
+            {
+                spnegoToken = SimpleProtectedNegotiationToken.ReadToken(inputToken, 0);
+            }
+            catch
+            {
+            }
+
             if (spnegoToken != null)
             if (spnegoToken != null)
             {
             {
                 if (spnegoToken is SimpleProtectedNegotiationTokenInit)
                 if (spnegoToken is SimpleProtectedNegotiationTokenInit)