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.

217 lines
6.6 KiB

  1. //+-----------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (c) Microsoft Corporation 1992 - 1996
  6. //
  7. // File: kerbdefs.h
  8. //
  9. // Contents: defines for all internal Kerberos lists
  10. //
  11. //
  12. // History: 03-May-1999 ChandanS Created
  13. //
  14. //------------------------------------------------------------------------
  15. #ifndef __KERBDEFS_H__
  16. #define __KERBDEFS_H__
  17. //
  18. // All Kerberos list structures are defined here
  19. //
  20. typedef struct _KERBEROS_LIST {
  21. LIST_ENTRY List;
  22. RTL_CRITICAL_SECTION Lock;
  23. } KERBEROS_LIST, *PKERBEROS_LIST;
  24. typedef struct _KERBEROS_LIST_ENTRY {
  25. LIST_ENTRY Next;
  26. ULONG ReferenceCount;
  27. } KERBEROS_LIST_ENTRY, *PKERBEROS_LIST_ENTRY;
  28. typedef struct _KERB_TICKET_CACHE_ENTRY {
  29. KERBEROS_LIST_ENTRY ListEntry;
  30. volatile LONG Linked;
  31. PKERB_INTERNAL_NAME ServiceName;
  32. PKERB_INTERNAL_NAME TargetName;
  33. UNICODE_STRING DomainName;
  34. UNICODE_STRING TargetDomainName;
  35. UNICODE_STRING AltTargetDomainName;
  36. UNICODE_STRING ClientDomainName;
  37. PKERB_INTERNAL_NAME ClientName;
  38. ULONG TicketFlags;
  39. ULONG CacheFlags;
  40. KERB_ENCRYPTION_KEY SessionKey;
  41. TimeStamp KeyExpirationTime;
  42. TimeStamp StartTime;
  43. TimeStamp EndTime;
  44. TimeStamp RenewUntil;
  45. KERB_TICKET Ticket;
  46. TimeStamp TimeSkew;
  47. } KERB_TICKET_CACHE_ENTRY, *PKERB_TICKET_CACHE_ENTRY;
  48. typedef struct _KERB_TICKET_CACHE {
  49. LIST_ENTRY CacheEntries;
  50. } KERB_TICKET_CACHE, *PKERB_TICKET_CACHE;
  51. #define CSP_DATA_INITIALIZED 0x01
  52. #define CONTEXT_INITIALIZED_WITH_CRED_MAN_CREDS 0x02
  53. #define CONTEXT_INITIALIZED_WITH_ACH 0x04
  54. typedef struct _KERB_PUBLIC_KEY_CREDENTIALS {
  55. UNICODE_STRING Pin;
  56. LUID LogonId; // logon id used in impersonation...
  57. PCCERT_CONTEXT CertContext;
  58. HCRYPTPROV hProv;
  59. ULONG InitializationInfo;
  60. ULONG CspDataLength;
  61. BYTE CspData[1];
  62. } KERB_PUBLIC_KEY_CREDENTIALS, *PKERB_PUBLIC_KEY_CREDENTIALS;
  63. typedef struct _KERB_PRIMARY_CREDENTIAL {
  64. UNICODE_STRING UserName;
  65. UNICODE_STRING DomainName;
  66. UNICODE_STRING ClearPassword; // this is only present until a ticket has been obtained.
  67. UNICODE_STRING OldUserName; // original user name in explicit
  68. UNICODE_STRING OldDomainName; // original domain name in explicit cred
  69. NT_OWF_PASSWORD OldHashPassword; // hash of encrypted ClearPassword
  70. PKERB_STORED_CREDENTIAL Passwords;
  71. PKERB_STORED_CREDENTIAL OldPasswords;
  72. KERB_TICKET_CACHE ServerTicketCache;
  73. KERB_TICKET_CACHE S4UTicketCache;
  74. KERB_TICKET_CACHE AuthenticationTicketCache;
  75. PKERB_PUBLIC_KEY_CREDENTIALS PublicKeyCreds;
  76. } KERB_PRIMARY_CREDENTIAL, *PKERB_PRIMARY_CREDENTIAL;
  77. typedef struct _KERB_LOGON_SESSION {
  78. KERBEROS_LIST_ENTRY ListEntry;
  79. LIST_ENTRY SspCredentials;
  80. KERBEROS_LIST CredmanCredentials;
  81. LUID LogonId; // constant
  82. TimeStamp Lifetime;
  83. RTL_CRITICAL_SECTION Lock;
  84. KERB_PRIMARY_CREDENTIAL PrimaryCredentials;
  85. ULONG LogonSessionFlags;
  86. } KERB_LOGON_SESSION, *PKERB_LOGON_SESSION;
  87. #define KERB_CREDENTIAL_TAG_ACTIVE (ULONG)'AdrC'
  88. #define KERB_CREDENTIAL_TAG_DELETE (ULONG)'DdrC'
  89. typedef struct _KERB_CREDENTIAL {
  90. KERBEROS_LIST_ENTRY ListEntry;
  91. ULONG HandleCount;
  92. LIST_ENTRY NextForThisLogonSession;
  93. LUID LogonId; // constant
  94. TimeStamp Lifetime;
  95. UNICODE_STRING CredentialName;
  96. ULONG CredentialFlags;
  97. ULONG ClientProcess; // constant
  98. PKERB_PRIMARY_CREDENTIAL SuppliedCredentials;
  99. PKERB_AUTHORIZATION_DATA AuthData;
  100. ULONG CredentialTag;
  101. } KERB_CREDENTIAL, *PKERB_CREDENTIAL;
  102. typedef struct _KERB_CREDMAN_CRED {
  103. KERBEROS_LIST_ENTRY ListEntry;
  104. ULONG CredentialFlags;
  105. UNICODE_STRING CredmanUserName; // added since TGT information can overwrite primary credentials...
  106. UNICODE_STRING CredmanDomainName;
  107. PKERB_PRIMARY_CREDENTIAL SuppliedCredentials;
  108. } KERB_CREDMAN_CRED, *PKERB_CREDMAN_CRED;
  109. typedef enum _KERB_CONTEXT_STATE {
  110. IdleState,
  111. TgtRequestSentState,
  112. TgtReplySentState,
  113. ApRequestSentState,
  114. ApReplySentState,
  115. AuthenticatedState,
  116. ErrorMessageSentState,
  117. InvalidState
  118. } KERB_CONTEXT_STATE, *PKERB_CONTEXT_STATE;
  119. #define KERB_CONTEXT_TAG_ACTIVE (ULONG)'AxtC'
  120. #define KERB_CONTEXT_TAG_DELETE (ULONG)'DxtC'
  121. typedef struct _KERB_CONTEXT {
  122. KERBEROS_LIST_ENTRY ListEntry;
  123. TimeStamp Lifetime; // end time/expiration time
  124. TimeStamp RenewTime; // time to renew until
  125. TimeStamp StartTime;
  126. UNICODE_STRING ClientName;
  127. UNICODE_STRING ClientRealm;
  128. union {
  129. ULONG ClientProcess;
  130. LSA_SEC_HANDLE LsaContextHandle;
  131. };
  132. LUID LogonId;
  133. HANDLE TokenHandle;
  134. ULONG_PTR CredentialHandle;
  135. KERB_ENCRYPTION_KEY SessionKey;
  136. ULONG Nonce;
  137. ULONG ReceiveNonce;
  138. ULONG ContextFlags;
  139. ULONG ContextAttributes;
  140. ULONG EncryptionType;
  141. PSID UserSid;
  142. KERB_CONTEXT_STATE ContextState;
  143. ULONG Retries;
  144. KERB_ENCRYPTION_KEY TicketKey;
  145. PKERB_TICKET_CACHE_ENTRY TicketCacheEntry; // for clients, is ticket to server, for servers, is TGT used in user-to-user
  146. UNICODE_STRING ClientPrincipalName;
  147. UNICODE_STRING ServerPrincipalName;
  148. PKERB_CREDMAN_CRED CredManCredentials;
  149. //
  150. // marshalled target info for DFS/RDR.
  151. //
  152. PBYTE pbMarshalledTargetInfo;
  153. ULONG cbMarshalledTargetInfo;
  154. ULONG ContextTag;
  155. } KERB_CONTEXT, *PKERB_CONTEXT;
  156. typedef struct _KERB_PACKED_CONTEXT {
  157. ULONG ContextType ; // Indicates the type of the context
  158. ULONG Pad; // Pad data
  159. TimeStamp Lifetime; // Matches basic context above
  160. TimeStamp RenewTime ;
  161. TimeStamp StartTime;
  162. UNICODE_STRING32 ClientName ;
  163. UNICODE_STRING32 ClientRealm ;
  164. ULONG LsaContextHandle ;
  165. LUID LogonId ;
  166. ULONG TokenHandle ;
  167. ULONG CredentialHandle ;
  168. ULONG SessionKeyType ;
  169. ULONG SessionKeyOffset ;
  170. ULONG SessionKeyLength ;
  171. ULONG Nonce ;
  172. ULONG ReceiveNonce ;
  173. ULONG ContextFlags ;
  174. ULONG ContextAttributes ;
  175. ULONG EncryptionType ;
  176. KERB_CONTEXT_STATE ContextState ;
  177. ULONG Retries ;
  178. ULONG MarshalledTargetInfo; // offset
  179. ULONG MarshalledTargetInfoLength;
  180. } KERB_PACKED_CONTEXT, * PKERB_PACKED_CONTEXT ;
  181. typedef struct _KERB_SESSION_KEY_ENTRY {
  182. LIST_ENTRY ListEntry;
  183. KERB_ENCRYPTION_KEY SessionKey;
  184. FILETIME ExpireTime; // time when SessionKey expires
  185. } KERB_SESSION_KEY_ENTRY, * PKERB_SESSION_KEY_ENTRY;
  186. #define KERB_PACKED_CONTEXT_MAP 0
  187. #define KERB_PACKED_CONTEXT_EXPORT 1
  188. #endif // __KERBDEFS_H_