Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

147 lines
3.4 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Module Name:
  4. logon.hxx
  5. Abstract:
  6. logon
  7. Author:
  8. Larry Zhu (LZhu) December 1, 2001
  9. Environment:
  10. User Mode
  11. Revision History:
  12. --*/
  13. #ifndef LOGON_HXX
  14. #define LOGON_HXX
  15. #define SECURITY_WIN32
  16. #define SECURITY_PACKAGE
  17. #include <security.h>
  18. #include <secint.h>
  19. #include <cryptdll.h>
  20. #include <kerberos.h>
  21. #include <align.h>
  22. #include <crypt.h>
  23. #include <md5.h>
  24. #include <hmac.h>
  25. enum ELogonTypeSubType {
  26. kNetworkLogonInvalid,
  27. kNetworkLogonNtlmv1,
  28. kNetworkLogonNtlmv2,
  29. kSubAuthLogon,
  30. };
  31. typedef struct _MSV1_0_LM3_RESPONSE {
  32. UCHAR Response[MSV1_0_NTLM3_RESPONSE_LENGTH];
  33. UCHAR ChallengeFromClient[MSV1_0_CHALLENGE_LENGTH];
  34. } MSV1_0_LM3_RESPONSE, *PMSV1_0_LM3_RESPONSE;
  35. VOID
  36. CalculateNtlmv2Owf(
  37. IN NT_OWF_PASSWORD* pNtOwfPassword,
  38. IN UNICODE_STRING* pUserName,
  39. IN UNICODE_STRING* pLogonDomainName,
  40. OUT UCHAR Ntlmv2Owf[MSV1_0_NTLM3_OWF_LENGTH]
  41. );
  42. VOID
  43. GetLmv2Response(
  44. IN NT_OWF_PASSWORD* pNtOwfPassword,
  45. IN UNICODE_STRING* pUserName,
  46. IN UNICODE_STRING* pLogonDomainName,
  47. IN UCHAR ChallengeToClient[MSV1_0_CHALLENGE_LENGTH],
  48. IN UCHAR ChallengeFromClient[MSV1_0_CHALLENGE_LENGTH],
  49. OUT UCHAR Response[MSV1_0_NTLM3_RESPONSE_LENGTH],
  50. OUT OPTIONAL USER_SESSION_KEY* pUserSessionKey,
  51. OUT OPTIONAL LM_SESSION_KEY* pLanmanSessionKey // [MSV1_0_LANMAN_SESSION_KEY_LENGTH]
  52. );
  53. VOID
  54. Lm20GetNtlmv2Response(
  55. IN NT_OWF_PASSWORD* pNtOwfPassword,
  56. IN UNICODE_STRING* pUserName,
  57. IN UNICODE_STRING* pLogonDomainName,
  58. IN STRING* pTargetInfo,
  59. IN UCHAR ChallengeToClient[MSV1_0_CHALLENGE_LENGTH],
  60. OUT MSV1_0_NTLM3_RESPONSE* pNtlmv2Response,
  61. OUT MSV1_0_LM3_RESPONSE* pLmv2Response,
  62. OUT USER_SESSION_KEY* pNtUserSessionKey,
  63. OUT LM_SESSION_KEY* pLmSessionKey
  64. );
  65. VOID
  66. GetNtlmv2Response(
  67. IN NT_OWF_PASSWORD* pNtOwfPassword,
  68. IN UNICODE_STRING* pUserName,
  69. IN UNICODE_STRING* pLogonDomainName,
  70. IN ULONG TargetInfoLength,
  71. IN UCHAR ChallengeToClient[MSV1_0_CHALLENGE_LENGTH],
  72. IN OUT MSV1_0_NTLM3_RESPONSE* pNtlmv2Response,
  73. OUT USER_SESSION_KEY* pNtUserSessionKey,
  74. OUT LM_SESSION_KEY* pLmSessionKey
  75. );
  76. NTSTATUS
  77. LogonUserWrapper(
  78. IN PCWSTR pszUserName,
  79. IN PCWSTR pszDomainName,
  80. IN PCWSTR pszPassword,
  81. IN DWORD LogonType,
  82. IN DWORD dwLogonProvider,
  83. OUT HANDLE* phToken
  84. );
  85. NTSTATUS
  86. KrbLsaLogonUser(
  87. IN HANDLE hLsa,
  88. IN ULONG PackageId,
  89. IN SECURITY_LOGON_TYPE LogonType,
  90. IN UNICODE_STRING* pUserName,
  91. IN UNICODE_STRING* pDomainName,
  92. IN UNICODE_STRING* pPassword,
  93. IN ULONG Flags,
  94. OUT HANDLE* phToken
  95. );
  96. NTSTATUS
  97. GetKrbS4U2SelfLogonInfo(
  98. IN UNICODE_STRING* pClientUpn,
  99. IN OPTIONAL UNICODE_STRING* pClientRealm,
  100. IN ULONG Flags,
  101. OUT ULONG* pcbLogonInfo,
  102. OUT KERB_S4U_LOGON** ppLogonInfo
  103. );
  104. NTSTATUS
  105. MsvLsaLogonUser(
  106. IN HANDLE hLsa,
  107. IN ULONG PackageId,
  108. IN SECURITY_LOGON_TYPE LogonType,
  109. IN UNICODE_STRING* pUserName,
  110. IN UNICODE_STRING* pDomainName,
  111. IN UNICODE_STRING* pPassword,
  112. IN UNICODE_STRING* pWorkstation,
  113. IN ELogonTypeSubType SubType,
  114. OUT HANDLE* phToken
  115. );
  116. VOID
  117. DebugPrintProfileAndQuotas(
  118. IN ULONG Level,
  119. IN OPTIONAL VOID* pProfile,
  120. IN OPTIONAL QUOTA_LIMITS* pQuota
  121. );
  122. #endif // #ifndef LOGON_HXX