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.

152 lines
3.5 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 RTL_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 0x1 // ticket is primary TGT
  38. #define KERB_TICKET_CACHE_DELEGATION_TGT 0x2 // ticket is delegation TGT
  39. #define KERB_TICKET_CACHE_TKT_ENC_IN_SKEY 0x10 // ticket is encrypted with a session key
  40. #ifdef WIN32_CHICAGO
  41. #define KerbWriteLockTicketCache() (EnterCriticalSection(&KerberosTicketCacheLock))
  42. #define KerbReadLockTicketCache() (EnterCriticalSection(&KerberosTicketCacheLock))
  43. #define KerbUnlockTicketCache() (LeaveCriticalSection(&KerberosTicketCacheLock))
  44. #else // WIN32_CHICAGO
  45. #define KerbWriteLockTicketCache() (RtlAcquireResourceExclusive(&KerberosTicketCacheLock,TRUE))
  46. #define KerbReadLockTicketCache() (RtlAcquireResourceShared(&KerberosTicketCacheLock, TRUE))
  47. #define KerbUnlockTicketCache() (RtlReleaseResource(&KerberosTicketCacheLock))
  48. #endif // WIN32_CHICAGO
  49. VOID
  50. KerbReferenceTicketCacheEntry(
  51. IN PKERB_TICKET_CACHE_ENTRY TicketCacheEntry
  52. );
  53. VOID
  54. KerbFreeTicketCacheEntry(
  55. IN PKERB_TICKET_CACHE_ENTRY TicketCacheEntry
  56. );
  57. VOID
  58. KerbReleaseTicketCacheEntry(
  59. IN PKERB_TICKET_CACHE_ENTRY TicketCacheEntry
  60. );
  61. VOID
  62. KerbDereferenceTicketCacheEntry(
  63. IN PKERB_TICKET_CACHE_ENTRY TicketCacheEntry
  64. );
  65. NTSTATUS
  66. KerbInitTicketCaching(
  67. VOID
  68. );
  69. VOID
  70. KerbFreeTicketCache(
  71. VOID
  72. );
  73. NTSTATUS
  74. KerbCacheTicket(
  75. IN OPTIONAL PKERB_TICKET_CACHE TicketCache,
  76. IN PKERB_KDC_REPLY KdcReply,
  77. IN PKERB_ENCRYPTED_KDC_REPLY KdcReplyBody,
  78. IN OPTIONAL PKERB_INTERNAL_NAME TargetName,
  79. IN OPTIONAL PUNICODE_STRING TargetRealm,
  80. IN ULONG Flags,
  81. IN BOOLEAN LinkEntry,
  82. OUT PKERB_TICKET_CACHE_ENTRY * NewCacheEntry
  83. );
  84. VOID
  85. KerbPurgeTicketCache(
  86. IN PKERB_TICKET_CACHE Cache
  87. );
  88. VOID
  89. KerbInitTicketCache(
  90. IN PKERB_TICKET_CACHE TicketCache
  91. );
  92. PKERB_TICKET_CACHE_ENTRY
  93. KerbLocateTicketCacheEntry(
  94. IN PKERB_TICKET_CACHE TicketCache,
  95. IN PKERB_INTERNAL_NAME FullServiceName,
  96. IN PUNICODE_STRING RealmName
  97. );
  98. PKERB_TICKET_CACHE_ENTRY
  99. KerbLocateTicketCacheEntryByRealm(
  100. IN PKERB_TICKET_CACHE TicketCache,
  101. IN PUNICODE_STRING RealmName,
  102. IN ULONG RequiredFlags
  103. );
  104. VOID
  105. KerbInsertTicketCacheEntry(
  106. IN PKERB_TICKET_CACHE TicketCache,
  107. IN PKERB_TICKET_CACHE_ENTRY TicketCacheEntry
  108. );
  109. VOID
  110. KerbRemoveTicketCacheEntry(
  111. IN PKERB_TICKET_CACHE_ENTRY TicketCacheEntry
  112. );
  113. BOOLEAN
  114. KerbTicketIsExpiring(
  115. IN PKERB_TICKET_CACHE_ENTRY CacheEntry,
  116. IN BOOLEAN AllowSkew
  117. );
  118. VOID
  119. KerbSetTicketCacheEntryTarget(
  120. IN PUNICODE_STRING TargetName,
  121. IN PKERB_TICKET_CACHE_ENTRY TicketCacheEntry
  122. );
  123. #endif // __TKTCACHE_H__