mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-04-29 18:27:48 +02:00
Independent / Integrated NTLMAuthenticationProvider: GetContextAttribute can now return OS version
This commit is contained in:
parent
25584a151f
commit
97326c311a
4 changed files with 22 additions and 0 deletions
|
@ -13,6 +13,7 @@ namespace SMBLibrary.Authentication.GSSAPI
|
|||
/// </summary>
|
||||
IsGuest,
|
||||
MachineName,
|
||||
OSVersion,
|
||||
SessionKey,
|
||||
UserName,
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ namespace SMBLibrary.Authentication.NTLM
|
|||
public string DomainName;
|
||||
public string UserName;
|
||||
public string WorkStation;
|
||||
public string OSVersion;
|
||||
public byte[] SessionKey;
|
||||
public bool IsGuest;
|
||||
|
||||
|
@ -134,6 +135,11 @@ namespace SMBLibrary.Authentication.NTLM
|
|||
authContext.DomainName = message.DomainName;
|
||||
authContext.UserName = message.UserName;
|
||||
authContext.WorkStation = message.WorkStation;
|
||||
if (message.Version != null)
|
||||
{
|
||||
authContext.OSVersion = message.Version.ToString();
|
||||
}
|
||||
|
||||
if ((message.NegotiateFlags & NegotiateFlags.Anonymous) > 0)
|
||||
{
|
||||
if (this.EnableGuestLogin)
|
||||
|
@ -244,6 +250,8 @@ namespace SMBLibrary.Authentication.NTLM
|
|||
return authContext.IsGuest;
|
||||
case GSSAttributeName.MachineName:
|
||||
return authContext.WorkStation;
|
||||
case GSSAttributeName.OSVersion:
|
||||
return authContext.OSVersion;
|
||||
case GSSAttributeName.SessionKey:
|
||||
return authContext.SessionKey;
|
||||
case GSSAttributeName.UserName:
|
||||
|
|
|
@ -48,6 +48,11 @@ namespace SMBLibrary.Authentication.NTLM
|
|||
ByteWriter.WriteByte(buffer, offset + 7, NTLMRevisionCurrent);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("{0}.{1}.{2}", ProductMajorVersion, ProductMinorVersion, ProductBuild);
|
||||
}
|
||||
|
||||
public static NTLMVersion WindowsXP
|
||||
{
|
||||
get
|
||||
|
|
|
@ -24,6 +24,7 @@ namespace SMBLibrary.Win32.Security
|
|||
public string DomainName;
|
||||
public string UserName;
|
||||
public string WorkStation;
|
||||
public string OSVersion;
|
||||
public bool IsGuest;
|
||||
|
||||
public AuthContext(SecHandle serverContext)
|
||||
|
@ -75,6 +76,11 @@ namespace SMBLibrary.Win32.Security
|
|||
authContext.DomainName = message.DomainName;
|
||||
authContext.UserName = message.UserName;
|
||||
authContext.WorkStation = message.WorkStation;
|
||||
if (message.Version != null)
|
||||
{
|
||||
authContext.OSVersion = message.Version.ToString();
|
||||
}
|
||||
|
||||
if ((message.NegotiateFlags & NegotiateFlags.Anonymous) > 0 ||
|
||||
!IsUserExists(message.UserName))
|
||||
{
|
||||
|
@ -160,6 +166,8 @@ namespace SMBLibrary.Win32.Security
|
|||
return authContext.IsGuest;
|
||||
case GSSAttributeName.MachineName:
|
||||
return authContext.WorkStation;
|
||||
case GSSAttributeName.OSVersion:
|
||||
return authContext.OSVersion;
|
||||
case GSSAttributeName.SessionKey:
|
||||
return SSPIHelper.GetSessionKey(authContext.ServerContext);
|
||||
case GSSAttributeName.UserName:
|
||||
|
|
Loading…
Add table
Reference in a new issue