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.

166 lines
4.4 KiB

  1. //+-----------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (c) Microsoft Corporation 1992 - 1996
  6. //
  7. // File: tktcache.h
  8. //
  9. // Contents: Prototypes and types for ticket cache
  10. //
  11. //
  12. // History: 16-April-1996 Created MikeSw
  13. //
  14. //------------------------------------------------------------------------
  15. #ifndef __TKTCACHE_H__
  16. #define __TKTCACHE_H__
  17. //
  18. // All global variables declared as EXTERN will be allocated in the file
  19. // that defines TKTCACHE_ALLOCATE
  20. //
  21. #ifdef EXTERN
  22. #undef EXTERN
  23. #endif
  24. #ifdef TKTCACHE_ALLOCATE
  25. #define EXTERN
  26. #else
  27. #define EXTERN extern
  28. #endif
  29. #ifdef WIN32_CHICAGO
  30. EXTERN CRITICAL_SECTION KerberosTicketCacheLock;
  31. #else // WIN32_CHICAGO
  32. EXTERN SAFE_RESOURCE KerberosTicketCacheLock;
  33. #endif // WIN32_CHICAGO
  34. EXTERN BOOLEAN KerberosTicketCacheInitialized;
  35. EXTERN LONG KerbTicketCacheHits;
  36. EXTERN LONG KerbTicketCacheMisses;
  37. #define KERB_TICKET_CACHE_PRIMARY_TGT 0x01 // ticket is primary TGT
  38. #define KERB_TICKET_CACHE_DELEGATION_TGT 0x02 // ticket is delegation TGT
  39. #define KERB_TICKET_CACHE_S4U_TICKET 0x04 // ticket is an S4U ticket
  40. #define KERB_TICKET_CACHE_ASC_TICKET 0x08 // ticket is from AcceptSecurityContext
  41. #define KERB_TICKET_CACHE_TKT_ENC_IN_SKEY 0x10 // ticket is encrypted with a session key
  42. #ifdef WIN32_CHICAGO
  43. #define KerbWriteLockTicketCache() (EnterCriticalSection(&KerberosTicketCacheLock));g_lpLastLock = THIS_FILE;g_uLine = __LINE__
  44. #define KerbReadLockTicketCache() (EnterCriticalSection(&KerberosTicketCacheLock));g_lpLastLock = THIS_FILE;g_uLine = __LINE__
  45. #define KerbUnlockTicketCache() (LeaveCriticalSection(&KerberosTicketCacheLock));g_lpLastLock = NULL;g_uLine = 0
  46. #else // WIN32_CHICAGO
  47. #define KerbWriteLockTicketCache() (SafeAcquireResourceExclusive(&KerberosTicketCacheLock,TRUE));g_lpLastLock = THIS_FILE;g_uLine = __LINE__
  48. #define KerbReadLockTicketCache() (SafeAcquireResourceShared(&KerberosTicketCacheLock, TRUE));g_lpLastLock = THIS_FILE;g_uLine = __LINE__
  49. #define KerbUnlockTicketCache() (SafeReleaseResource(&KerberosTicketCacheLock));g_lpLastLock = NULL;g_uLine = 0
  50. #endif // WIN32_CHICAGO
  51. VOID
  52. KerbReferenceTicketCacheEntry(
  53. IN PKERB_TICKET_CACHE_ENTRY TicketCacheEntry
  54. );
  55. VOID
  56. KerbDereferenceTicketCacheEntry(
  57. IN PKERB_TICKET_CACHE_ENTRY TicketCacheEntry
  58. );
  59. NTSTATUS
  60. KerbInitTicketCaching(
  61. VOID
  62. );
  63. VOID
  64. KerbAgeTickets(
  65. IN PKERB_TICKET_CACHE TicketCache
  66. );
  67. VOID
  68. KerbFreeTicketCache(
  69. VOID
  70. );
  71. NTSTATUS
  72. KerbCreateTicketCacheEntry(
  73. IN PKERB_KDC_REPLY KdcReply,
  74. IN PKERB_ENCRYPTED_KDC_REPLY KdcReplyBody,
  75. IN OPTIONAL PKERB_INTERNAL_NAME TargetName,
  76. IN OPTIONAL PUNICODE_STRING TargetRealm,
  77. IN ULONG Flags,
  78. IN OPTIONAL PKERB_TICKET_CACHE TicketCache,
  79. IN OPTIONAL PKERB_ENCRYPTION_KEY CredentialKey,
  80. OUT PKERB_TICKET_CACHE_ENTRY * NewCacheEntry
  81. );
  82. NTSTATUS
  83. KerbDuplicateTicketCacheEntry(
  84. IN PKERB_TICKET_CACHE_ENTRY CacheEntry,
  85. IN OUT PKERB_TICKET_CACHE_ENTRY * NewCacheEntry
  86. );
  87. VOID
  88. KerbPurgeTicketCache(
  89. IN PKERB_TICKET_CACHE Cache
  90. );
  91. VOID
  92. KerbInitTicketCache(
  93. IN PKERB_TICKET_CACHE TicketCache
  94. );
  95. PKERB_TICKET_CACHE_ENTRY
  96. KerbLocateTicketCacheEntry(
  97. IN PKERB_TICKET_CACHE TicketCache,
  98. IN PKERB_INTERNAL_NAME FullServiceName,
  99. IN PUNICODE_STRING RealmName
  100. );
  101. PKERB_TICKET_CACHE_ENTRY
  102. KerbLocateTicketCacheEntryByRealm(
  103. IN PKERB_TICKET_CACHE TicketCache,
  104. IN PUNICODE_STRING RealmName,
  105. IN ULONG RequiredFlags
  106. );
  107. VOID
  108. KerbInsertTicketCacheEntry(
  109. IN PKERB_TICKET_CACHE TicketCache,
  110. IN PKERB_TICKET_CACHE_ENTRY TicketCacheEntry
  111. );
  112. VOID
  113. KerbRemoveTicketCacheEntry(
  114. IN PKERB_TICKET_CACHE_ENTRY TicketCacheEntry
  115. );
  116. BOOLEAN
  117. KerbTicketIsExpiring(
  118. IN PKERB_TICKET_CACHE_ENTRY CacheEntry,
  119. IN BOOLEAN AllowSkew
  120. );
  121. VOID
  122. KerbSetTicketCacheEntryTarget(
  123. IN PUNICODE_STRING TargetName,
  124. IN PKERB_TICKET_CACHE_ENTRY TicketCacheEntry
  125. );
  126. VOID
  127. KerbScheduleTgtRenewal(
  128. IN KERB_TICKET_CACHE_ENTRY * CacheEntry
  129. );
  130. void
  131. KerbTicketScavenger(
  132. void * TaskHandle,
  133. void * TaskItem
  134. );
  135. #endif // __TKTCACHE_H__