mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-04-30 02:37:49 +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>
|
/// </summary>
|
||||||
IsGuest,
|
IsGuest,
|
||||||
MachineName,
|
MachineName,
|
||||||
|
OSVersion,
|
||||||
SessionKey,
|
SessionKey,
|
||||||
UserName,
|
UserName,
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ namespace SMBLibrary.Authentication.NTLM
|
||||||
public string DomainName;
|
public string DomainName;
|
||||||
public string UserName;
|
public string UserName;
|
||||||
public string WorkStation;
|
public string WorkStation;
|
||||||
|
public string OSVersion;
|
||||||
public byte[] SessionKey;
|
public byte[] SessionKey;
|
||||||
public bool IsGuest;
|
public bool IsGuest;
|
||||||
|
|
||||||
|
@ -134,6 +135,11 @@ namespace SMBLibrary.Authentication.NTLM
|
||||||
authContext.DomainName = message.DomainName;
|
authContext.DomainName = message.DomainName;
|
||||||
authContext.UserName = message.UserName;
|
authContext.UserName = message.UserName;
|
||||||
authContext.WorkStation = message.WorkStation;
|
authContext.WorkStation = message.WorkStation;
|
||||||
|
if (message.Version != null)
|
||||||
|
{
|
||||||
|
authContext.OSVersion = message.Version.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
if ((message.NegotiateFlags & NegotiateFlags.Anonymous) > 0)
|
if ((message.NegotiateFlags & NegotiateFlags.Anonymous) > 0)
|
||||||
{
|
{
|
||||||
if (this.EnableGuestLogin)
|
if (this.EnableGuestLogin)
|
||||||
|
@ -244,6 +250,8 @@ namespace SMBLibrary.Authentication.NTLM
|
||||||
return authContext.IsGuest;
|
return authContext.IsGuest;
|
||||||
case GSSAttributeName.MachineName:
|
case GSSAttributeName.MachineName:
|
||||||
return authContext.WorkStation;
|
return authContext.WorkStation;
|
||||||
|
case GSSAttributeName.OSVersion:
|
||||||
|
return authContext.OSVersion;
|
||||||
case GSSAttributeName.SessionKey:
|
case GSSAttributeName.SessionKey:
|
||||||
return authContext.SessionKey;
|
return authContext.SessionKey;
|
||||||
case GSSAttributeName.UserName:
|
case GSSAttributeName.UserName:
|
||||||
|
|
|
@ -48,6 +48,11 @@ namespace SMBLibrary.Authentication.NTLM
|
||||||
ByteWriter.WriteByte(buffer, offset + 7, NTLMRevisionCurrent);
|
ByteWriter.WriteByte(buffer, offset + 7, NTLMRevisionCurrent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return String.Format("{0}.{1}.{2}", ProductMajorVersion, ProductMinorVersion, ProductBuild);
|
||||||
|
}
|
||||||
|
|
||||||
public static NTLMVersion WindowsXP
|
public static NTLMVersion WindowsXP
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
@ -24,6 +24,7 @@ namespace SMBLibrary.Win32.Security
|
||||||
public string DomainName;
|
public string DomainName;
|
||||||
public string UserName;
|
public string UserName;
|
||||||
public string WorkStation;
|
public string WorkStation;
|
||||||
|
public string OSVersion;
|
||||||
public bool IsGuest;
|
public bool IsGuest;
|
||||||
|
|
||||||
public AuthContext(SecHandle serverContext)
|
public AuthContext(SecHandle serverContext)
|
||||||
|
@ -75,6 +76,11 @@ namespace SMBLibrary.Win32.Security
|
||||||
authContext.DomainName = message.DomainName;
|
authContext.DomainName = message.DomainName;
|
||||||
authContext.UserName = message.UserName;
|
authContext.UserName = message.UserName;
|
||||||
authContext.WorkStation = message.WorkStation;
|
authContext.WorkStation = message.WorkStation;
|
||||||
|
if (message.Version != null)
|
||||||
|
{
|
||||||
|
authContext.OSVersion = message.Version.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
if ((message.NegotiateFlags & NegotiateFlags.Anonymous) > 0 ||
|
if ((message.NegotiateFlags & NegotiateFlags.Anonymous) > 0 ||
|
||||||
!IsUserExists(message.UserName))
|
!IsUserExists(message.UserName))
|
||||||
{
|
{
|
||||||
|
@ -160,6 +166,8 @@ namespace SMBLibrary.Win32.Security
|
||||||
return authContext.IsGuest;
|
return authContext.IsGuest;
|
||||||
case GSSAttributeName.MachineName:
|
case GSSAttributeName.MachineName:
|
||||||
return authContext.WorkStation;
|
return authContext.WorkStation;
|
||||||
|
case GSSAttributeName.OSVersion:
|
||||||
|
return authContext.OSVersion;
|
||||||
case GSSAttributeName.SessionKey:
|
case GSSAttributeName.SessionKey:
|
||||||
return SSPIHelper.GetSessionKey(authContext.ServerContext);
|
return SSPIHelper.GetSessionKey(authContext.ServerContext);
|
||||||
case GSSAttributeName.UserName:
|
case GSSAttributeName.UserName:
|
||||||
|
|
Loading…
Add table
Reference in a new issue