File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SSPI Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,12 @@ protected override bool GenerateSspiClientContext(ReadOnlySpan<byte> incomingBlo
16
16
{
17
17
NegotiateAuthenticationStatusCode statusCode = NegotiateAuthenticationStatusCode . UnknownCredentials ;
18
18
19
+ // If we've already successfully performed the negotiate we only want to do it for the original target
20
+ if ( _negotiateAuth is { TargetName : { } name } && name != authParams . Resource )
21
+ {
22
+ return false ;
23
+ }
24
+
19
25
_negotiateAuth ??= new ( new NegotiateAuthenticationClientOptions { Package = "Negotiate" , TargetName = authParams . Resource } ) ;
20
26
var sendBuff = _negotiateAuth . GetOutgoingBlob ( incomingBlob , out statusCode ) ! ;
21
27
@@ -29,6 +35,8 @@ protected override bool GenerateSspiClientContext(ReadOnlySpan<byte> incomingBlo
29
35
return true ;
30
36
}
31
37
38
+ // Reset _negotiateAuth to be generated again for next SPN.
39
+ _negotiateAuth = null ;
32
40
return false ;
33
41
}
34
42
}
You can’t perform that action at this time.
0 commit comments