Source code of Windows XP (NT5)
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.

204 lines
4.3 KiB

  1. //+-----------------------------------------------------------------------
  2. //
  3. // File: kdcsvr.hxx
  4. //
  5. // Contents: KDC Private definitions
  6. //
  7. //
  8. // History: <whenever> RichardW Created
  9. // 16-Jan-93 WadeR Converted to C++
  10. //
  11. //------------------------------------------------------------------------
  12. #ifndef _INC_KDCSVR_HXX_
  13. #define _INC_KDCSVR_HXX_
  14. #include <secpch2.hxx>
  15. extern "C"
  16. {
  17. #include <lsarpc.h>
  18. #include <samrpc.h>
  19. #include <lmsname.h>
  20. #include <samisrv.h> // SamIFree_XXX
  21. #include <logonmsv.h>
  22. #include <lsaisrv.h> // LsaIFree_XXX
  23. #include <config.h>
  24. #include <lmerr.h>
  25. #include <netlibnt.h>
  26. #include <lsaitf.h>
  27. #include <msaudite.h>
  28. #include <wintrust.h> // for WinVerifyTrust and wincrypt.h
  29. }
  30. #include <kerbcomm.h>
  31. #include <kerberr.h>
  32. #include <kdcevent.h>
  33. #include <exterr.h> // whack this soon
  34. #include <events.hxx>
  35. #include <authen.hxx>
  36. #include <fileno.h>
  37. //
  38. // Global typedefs
  39. //
  40. typedef struct _KDC_TICKET_INFO
  41. {
  42. UNICODE_STRING AccountName;
  43. UNICODE_STRING TrustedForest;
  44. LARGE_INTEGER PasswordExpires;
  45. ULONG fTicketOpts;
  46. ULONG UserAccountControl;
  47. ULONG UserId;
  48. ULONG TrustAttributes;
  49. PKERB_STORED_CREDENTIAL Passwords;
  50. PKERB_STORED_CREDENTIAL OldPasswords;
  51. PSID TrustSid;
  52. } KDC_TICKET_INFO, *PKDC_TICKET_INFO;
  53. typedef enum {
  54. Unknown,
  55. Inbound,
  56. Outbound
  57. } KDC_DOMAIN_INFO_DIRECTION, *PKDC_DOMAIN_INFO_DIRECTION;
  58. #include "debug.hxx"
  59. #include "secdata.hxx"
  60. #include "tktutil.hxx"
  61. #include "pkserv.h"
  62. #define KdcLsaIAuditKdcEvent(_a_, _b_, _c_, _d_, _e_, _f_, _g_, _h_, _i_, _j_, _k_, _l_ ) \
  63. LsaIAuditKdcEvent(_a_, _b_, _c_, _d_, _e_, _f_, _g_, _h_, _i_, _j_, _k_, _l_ )
  64. //
  65. // Global prototypes:
  66. //
  67. void
  68. ServiceMain(
  69. ULONG ArgC,
  70. LPSTR * ArgV
  71. );
  72. NTSTATUS
  73. ShutDown(
  74. LPTSTR String
  75. );
  76. BOOLEAN
  77. UpdateStatus(
  78. ULONG Status
  79. );
  80. extern "C"
  81. BOOLEAN
  82. InitializeChangeNotify(
  83. VOID
  84. );
  85. //
  86. // Global data defn's
  87. //
  88. typedef enum {
  89. Stopped,
  90. Starting,
  91. Running
  92. } KDC_STATE;
  93. extern TimeStamp tsInfinity;
  94. extern KDC_STATE KdcState;
  95. extern LARGE_INTEGER SkewTime;
  96. extern BOOLEAN fStopKDC;
  97. extern HANDLE hKdcHandles[];
  98. extern CRITICAL_SECTION ApiCriticalSection;
  99. extern ULONG CurrentApiCallers;
  100. extern UNICODE_STRING GlobalDomainName;
  101. extern UNICODE_STRING GlobalKerberosName;
  102. extern UNICODE_STRING GlobalKdcName;
  103. extern BOOL KdcGlobalAvoidPdcOnWan;
  104. extern UNICODE_STRING KdcForestRootDomainName;
  105. extern BOOLEAN KdcIsGc;
  106. extern BOOLEAN KdcForestRoot;
  107. extern BOOLEAN KdcCrossForestEnabled;
  108. extern LIST_ENTRY KdcReferralCache;
  109. extern PKERB_INTERNAL_NAME GlobalKpasswdName;
  110. extern PSID GlobalDomainSid;
  111. extern SAMPR_HANDLE GlobalAccountDomainHandle;
  112. extern LSAPR_HANDLE GlobalPolicyHandle;
  113. extern BYTE GlobalLocalhostAddress[4];
  114. #define GET_CLIENT_ADDRESS(_x_) \
  115. (((_x_) != NULL ) ? \
  116. ((PBYTE) (&((struct sockaddr_in *)(_x_))->sin_addr.S_un.S_addr)) : \
  117. GlobalLocalhostAddress)
  118. //
  119. // KDC handle definitions
  120. //
  121. #define hKdcShutdownEvent hKdcHandles[0]
  122. #define MAX_KDC_HANDLE 1
  123. // class CAuthenticatorList;
  124. extern CAuthenticatorList * Authenticators;
  125. extern CAuthenticatorList * FailedRequests;
  126. class CSecurityData;
  127. extern CSecurityData SecData;
  128. //
  129. // Global constants
  130. //
  131. const ULONG ulInfinity = 0xFFFFFFFF;
  132. const ULONG ulTsPerSecond = 10000000L;
  133. // Number of creds supplied in DS for LM_OWF but no NT_OWF support
  134. #define CRED_ONLY_LM_OWF 1
  135. //
  136. // Global macros
  137. //
  138. #define _str_(a) #a
  139. #define _xstr_(a) _str_(a)
  140. #define DIAGNOSTIC(num, txt) message(__FILE__ "(" _xstr_(__LINE__) \
  141. ") : diagnostic V" _xstr_(num) " : "#txt)
  142. #define MEMO(txt) message( __FILE__ "(" _xstr_(__LINE__) ") : Memo : " #txt )
  143. #define KdcGetTime(_x_) ((_x_).QuadPart)
  144. #define MAX_EXPR_LEN 50
  145. #define MAX_SID_LEN (sizeof(SID) + sizeof(ULONG) * SID_MAX_SUB_AUTHORITIES)
  146. #define KdcMakeAccountSid( _buffer_, _rid_) \
  147. { \
  148. PSID TempSid = (PSID) _buffer_; \
  149. RtlCopyMemory( _buffer_, GlobalDomainSid, RtlLengthSid(GlobalDomainSid)); \
  150. *RtlSubAuthoritySid(TempSid, *RtlSubAuthorityCountSid(TempSid)) = _rid_; \
  151. *RtlSubAuthorityCountSid(TempSid) += 1; \
  152. }
  153. #define KdcFreeEncodedData(_x_) MIDL_user_free(_x_)
  154. //
  155. // Global inline functions.
  156. //
  157. #endif // _INC_KDCSVR_HXX_