mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-04-29 18:27:48 +02:00
Independent / Integrated NTLMAuthenticationProvider: GetContextAttribute can now return DomainName
This commit is contained in:
parent
62d240d166
commit
f5d540728e
3 changed files with 11 additions and 2 deletions
|
@ -5,6 +5,7 @@ namespace SMBLibrary.Authentication.GSSAPI
|
|||
public enum GSSAttributeName
|
||||
{
|
||||
AccessToken,
|
||||
DomainName,
|
||||
IsAnonymous,
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -18,9 +18,10 @@ namespace SMBLibrary.Authentication.NTLM
|
|||
{
|
||||
public class AuthContext
|
||||
{
|
||||
public string WorkStation;
|
||||
public byte[] ServerChallenge;
|
||||
public string DomainName;
|
||||
public string UserName;
|
||||
public string WorkStation;
|
||||
public byte[] SessionKey;
|
||||
public bool IsGuest;
|
||||
|
||||
|
@ -130,6 +131,7 @@ namespace SMBLibrary.Authentication.NTLM
|
|||
return NTStatus.SEC_E_INVALID_TOKEN;
|
||||
}
|
||||
|
||||
authContext.DomainName = message.DomainName;
|
||||
authContext.UserName = message.UserName;
|
||||
authContext.WorkStation = message.WorkStation;
|
||||
if ((message.NegotiateFlags & NegotiateFlags.Anonymous) > 0)
|
||||
|
@ -236,6 +238,8 @@ namespace SMBLibrary.Authentication.NTLM
|
|||
{
|
||||
switch (attributeName)
|
||||
{
|
||||
case GSSAttributeName.DomainName:
|
||||
return authContext.DomainName;
|
||||
case GSSAttributeName.IsGuest:
|
||||
return authContext.IsGuest;
|
||||
case GSSAttributeName.MachineName:
|
||||
|
|
|
@ -21,8 +21,9 @@ namespace SMBLibrary.Win32.Security
|
|||
public class AuthContext
|
||||
{
|
||||
public SecHandle ServerContext;
|
||||
public string WorkStation;
|
||||
public string DomainName;
|
||||
public string UserName;
|
||||
public string WorkStation;
|
||||
public bool IsGuest;
|
||||
|
||||
public AuthContext(SecHandle serverContext)
|
||||
|
@ -71,6 +72,7 @@ namespace SMBLibrary.Win32.Security
|
|||
return NTStatus.SEC_E_INVALID_TOKEN;
|
||||
}
|
||||
|
||||
authContext.DomainName = message.DomainName;
|
||||
authContext.UserName = message.UserName;
|
||||
authContext.WorkStation = message.WorkStation;
|
||||
if ((message.NegotiateFlags & NegotiateFlags.Anonymous) > 0 ||
|
||||
|
@ -152,6 +154,8 @@ namespace SMBLibrary.Win32.Security
|
|||
{
|
||||
case GSSAttributeName.AccessToken:
|
||||
return SSPIHelper.GetAccessToken(authContext.ServerContext);
|
||||
case GSSAttributeName.DomainName:
|
||||
return authContext.DomainName;
|
||||
case GSSAttributeName.IsGuest:
|
||||
return authContext.IsGuest;
|
||||
case GSSAttributeName.MachineName:
|
||||
|
|
Loading…
Add table
Reference in a new issue