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.

131 lines
2.9 KiB

  1. //+-----------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (c) Microsoft Corporation 1992 - 1996
  6. //
  7. // File: spncache.h
  8. //
  9. // Contents: Prototypes and types for SPN cache
  10. //
  11. //
  12. // History: 29-August-2000 Created MikeSw
  13. //
  14. //------------------------------------------------------------------------
  15. #ifndef __SPNCACHE_H__
  16. #define __SPNCACHE_H__
  17. extern BOOLEAN KerberosSpnCacheInitialized;
  18. extern KERBEROS_LIST KerbSpnCache;
  19. typedef struct _HOST_TO_REALM_KEY {
  20. UNICODE_STRING SpnSuffix; // MUST be the first field
  21. UNICODE_STRING TargetRealm;
  22. #pragma warning(disable:4200)
  23. WCHAR NameBuffer[];
  24. #pragma warning(default:4200)
  25. } HOST_TO_REALM_KEY, *PHOST_TO_REALM_KEY;
  26. //
  27. // The below value tells us when to start scavenging
  28. // our cache
  29. //
  30. #define MAX_CACHE_ENTRIES 350
  31. typedef struct _SPN_CACHE_RESULT {
  32. UNICODE_STRING AccountRealm;
  33. UNICODE_STRING TargetRealm;
  34. ULONG CacheFlags;
  35. TimeStamp CacheStartTime;
  36. } SPN_CACHE_RESULT, *PSPN_CACHE_RESULT;
  37. #define MAX_RESULTS 16
  38. typedef struct _KERB_SPN_CACHE_ENTRY {
  39. KERBEROS_LIST_ENTRY ListEntry;
  40. PKERB_INTERNAL_NAME Spn;
  41. RTL_RESOURCE ResultLock;
  42. ULONG ResultCount;
  43. SPN_CACHE_RESULT Results[MAX_RESULTS];
  44. } KERB_SPN_CACHE_ENTRY, *PKERB_SPN_CACHE_ENTRY;
  45. //
  46. // Valid CacheFlags
  47. //
  48. #define KERB_SPN_UNKNOWN 0x1
  49. #define KERB_SPN_KNOWN 0x2
  50. #define KERB_SPNCACHE_KEY L"System\\CurrentControlSet\\Control\\Lsa\\Kerberos\\SpnCache"
  51. #define KERB_REALM_STRING L"Realm"
  52. #define KERB_HOST_TO_REALM_KEY L"System\\CurrentControlSet\\Control\\Lsa\\Kerberos\\HostToRealm"
  53. #define KERB_HOST_TO_REALM_VAL L"SpnMappings"
  54. VOID
  55. KerbCreateHostToRealmMappings();
  56. VOID
  57. KerbRefreshHostToRealmTable();
  58. NTSTATUS
  59. KerbGetSpnCacheStatus(
  60. IN PKERB_SPN_CACHE_ENTRY CacheEntry,
  61. IN PKERB_PRIMARY_CREDENTIAL Credential,
  62. IN OUT PUNICODE_STRING SpnRealm
  63. );
  64. NTSTATUS
  65. KerbSpnSubstringMatch(
  66. IN PKERB_INTERNAL_NAME Spn,
  67. IN OUT PUNICODE_STRING TargetRealm
  68. );
  69. VOID
  70. KerbCleanupSpnCache(
  71. VOID
  72. );
  73. VOID
  74. KerbFreeSpnCacheEntry(
  75. IN PKERB_SPN_CACHE_ENTRY SpnCacheEntry
  76. );
  77. NTSTATUS
  78. KerbInitSpnCache(
  79. VOID
  80. );
  81. NTSTATUS
  82. KerbInsertSpnCacheEntry(
  83. IN PKERB_SPN_CACHE_ENTRY CacheEntry
  84. );
  85. VOID
  86. KerbDereferenceSpnCacheEntry(
  87. IN PKERB_SPN_CACHE_ENTRY SpnCacheEntry
  88. );
  89. PKERB_SPN_CACHE_ENTRY
  90. KerbLocateSpnCacheEntry(
  91. IN PKERB_INTERNAL_NAME Spn
  92. );
  93. NTSTATUS
  94. KerbUpdateSpnCacheEntry(
  95. IN OPTIONAL PKERB_SPN_CACHE_ENTRY ExistingCacheEntry,
  96. IN PKERB_INTERNAL_NAME Spn,
  97. IN PKERB_PRIMARY_CREDENTIAL AccountCredential,
  98. IN ULONG UpdateFlags,
  99. IN OPTIONAL PUNICODE_STRING NewRealm
  100. );
  101. #endif // __TKTCACHE_H__