mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-04-30 02:37:49 +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
|
public enum GSSAttributeName
|
||||||
{
|
{
|
||||||
AccessToken,
|
AccessToken,
|
||||||
|
DomainName,
|
||||||
IsAnonymous,
|
IsAnonymous,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -18,9 +18,10 @@ namespace SMBLibrary.Authentication.NTLM
|
||||||
{
|
{
|
||||||
public class AuthContext
|
public class AuthContext
|
||||||
{
|
{
|
||||||
public string WorkStation;
|
|
||||||
public byte[] ServerChallenge;
|
public byte[] ServerChallenge;
|
||||||
|
public string DomainName;
|
||||||
public string UserName;
|
public string UserName;
|
||||||
|
public string WorkStation;
|
||||||
public byte[] SessionKey;
|
public byte[] SessionKey;
|
||||||
public bool IsGuest;
|
public bool IsGuest;
|
||||||
|
|
||||||
|
@ -130,6 +131,7 @@ namespace SMBLibrary.Authentication.NTLM
|
||||||
return NTStatus.SEC_E_INVALID_TOKEN;
|
return NTStatus.SEC_E_INVALID_TOKEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
authContext.DomainName = message.DomainName;
|
||||||
authContext.UserName = message.UserName;
|
authContext.UserName = message.UserName;
|
||||||
authContext.WorkStation = message.WorkStation;
|
authContext.WorkStation = message.WorkStation;
|
||||||
if ((message.NegotiateFlags & NegotiateFlags.Anonymous) > 0)
|
if ((message.NegotiateFlags & NegotiateFlags.Anonymous) > 0)
|
||||||
|
@ -236,6 +238,8 @@ namespace SMBLibrary.Authentication.NTLM
|
||||||
{
|
{
|
||||||
switch (attributeName)
|
switch (attributeName)
|
||||||
{
|
{
|
||||||
|
case GSSAttributeName.DomainName:
|
||||||
|
return authContext.DomainName;
|
||||||
case GSSAttributeName.IsGuest:
|
case GSSAttributeName.IsGuest:
|
||||||
return authContext.IsGuest;
|
return authContext.IsGuest;
|
||||||
case GSSAttributeName.MachineName:
|
case GSSAttributeName.MachineName:
|
||||||
|
|
|
@ -21,8 +21,9 @@ namespace SMBLibrary.Win32.Security
|
||||||
public class AuthContext
|
public class AuthContext
|
||||||
{
|
{
|
||||||
public SecHandle ServerContext;
|
public SecHandle ServerContext;
|
||||||
public string WorkStation;
|
public string DomainName;
|
||||||
public string UserName;
|
public string UserName;
|
||||||
|
public string WorkStation;
|
||||||
public bool IsGuest;
|
public bool IsGuest;
|
||||||
|
|
||||||
public AuthContext(SecHandle serverContext)
|
public AuthContext(SecHandle serverContext)
|
||||||
|
@ -71,6 +72,7 @@ namespace SMBLibrary.Win32.Security
|
||||||
return NTStatus.SEC_E_INVALID_TOKEN;
|
return NTStatus.SEC_E_INVALID_TOKEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
authContext.DomainName = message.DomainName;
|
||||||
authContext.UserName = message.UserName;
|
authContext.UserName = message.UserName;
|
||||||
authContext.WorkStation = message.WorkStation;
|
authContext.WorkStation = message.WorkStation;
|
||||||
if ((message.NegotiateFlags & NegotiateFlags.Anonymous) > 0 ||
|
if ((message.NegotiateFlags & NegotiateFlags.Anonymous) > 0 ||
|
||||||
|
@ -152,6 +154,8 @@ namespace SMBLibrary.Win32.Security
|
||||||
{
|
{
|
||||||
case GSSAttributeName.AccessToken:
|
case GSSAttributeName.AccessToken:
|
||||||
return SSPIHelper.GetAccessToken(authContext.ServerContext);
|
return SSPIHelper.GetAccessToken(authContext.ServerContext);
|
||||||
|
case GSSAttributeName.DomainName:
|
||||||
|
return authContext.DomainName;
|
||||||
case GSSAttributeName.IsGuest:
|
case GSSAttributeName.IsGuest:
|
||||||
return authContext.IsGuest;
|
return authContext.IsGuest;
|
||||||
case GSSAttributeName.MachineName:
|
case GSSAttributeName.MachineName:
|
||||||
|
|
Loading…
Add table
Reference in a new issue