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.

182 lines
4.2 KiB

  1. //+-----------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (c) Microsoft Corporation 1991 - 1995
  6. //
  7. // File: pac.hxx
  8. //
  9. // Contents: internal structures and definitions for PACs
  10. //
  11. //
  12. // History: 24-May-95 SuChang Created
  13. //
  14. //------------------------------------------------------------------------
  15. #ifndef __PAC_HXX__
  16. #define __PAC_HXX__
  17. extern "C" {
  18. #include <samrpc.h>
  19. #include <logonmsv.h>
  20. #include <samisrv.h>
  21. }
  22. //
  23. // Type Tags for the PAC_INFO_BUFFER that specify one of the three
  24. // structures below.
  25. //
  26. #define PAC_LOGON_INFO 1 // NDR encoded NETLOGON_SAM_VALIDATION_INFO3
  27. #define PAC_CREDENTIAL_TYPE 2 // supp. credentials
  28. #define PAC_SERVER_CHECKSUM 6 // Signature by server
  29. #define PAC_PRIVSVR_CHECKSUM 7 // Signature by privsvr
  30. #define PAC_CLIENT_INFO_TYPE 10 // client name & ticket id
  31. //
  32. // The offset is to use for transmitting, the pointer is for in-memory
  33. // use
  34. //
  35. typedef struct _PAC_INFO_BUFFER {
  36. ULONG ulType;
  37. ULONG cbBufferSize;
  38. union {
  39. PBYTE Data;
  40. ULONG64 Offset;
  41. };
  42. } PAC_INFO_BUFFER, *PPAC_INFO_BUFFER;
  43. typedef struct _PACTYPE {
  44. ULONG cBuffers;
  45. ULONG Version; // for padding
  46. PAC_INFO_BUFFER Buffers[ANYSIZE_ARRAY];
  47. } PACTYPE, *PPACTYPE;
  48. #define PAC_VERSION 0
  49. //
  50. // A PAC may also contain a signature from the KDC. This is used for
  51. // PAC_SERVER_CHECKSUM and PAC_PRIVSVR_CHECKSUM.
  52. //
  53. #include <pshpack1.h>
  54. typedef struct _PAC_SIGNATURE_DATA {
  55. ULONG SignatureType;
  56. UCHAR Signature[ANYSIZE_ARRAY]; // size is from the PAC_INFO_BUFFER - sizeof(ULONG)
  57. } PAC_SIGNATURE_DATA, *PPAC_SIGNATURE_DATA;
  58. #include <poppack.h>
  59. #define PAC_SIGNATURE_SIZE(_x_) (FIELD_OFFSET(PAC_SIGNATURE_DATA, Signature) + (_x_))
  60. #define PAC_CHECKSUM_SIZE(_x_) ((_x_) - FIELD_OFFSET(PAC_SIGNATURE_DATA, Signature))
  61. //
  62. // This type is NDR encoded
  63. //
  64. #ifndef PAC_CREDENTIAL_DATA_DEFINED
  65. #define PAC_CREDENTIAL_DATA_DEFINED
  66. typedef struct _PAC_CREDENTIAL_DATA {
  67. ULONG CredentialCount;
  68. SECPKG_SUPPLEMENTAL_CRED Credentials[ANYSIZE_ARRAY];
  69. } PAC_CREDENTIAL_DATA, *PPAC_CREDENTIAL_DATA;
  70. #endif
  71. #include <pshpack1.h>
  72. typedef struct _PAC_CREDENTIAL_INFO {
  73. ULONG Version;
  74. ULONG EncryptionType;
  75. UCHAR Data[ANYSIZE_ARRAY];
  76. } PAC_CREDENTIAL_INFO, *PPAC_CREDENTIAL_INFO;
  77. typedef struct _PAC_CLIENT_INFO {
  78. TimeStamp ClientId;
  79. USHORT NameLength;
  80. WCHAR Name[ANYSIZE_ARRAY];
  81. } PAC_CLIENT_INFO, *PPAC_CLIENT_INFO;
  82. #include <poppack.h>
  83. ULONG PAC_GetSize( IN PACTYPE *pPac );
  84. ULONG PAC_Marshal( IN PACTYPE *pPac,
  85. IN ULONG cbBuffer,
  86. OUT PBYTE pBuffer);
  87. ULONG
  88. PAC_UnMarshal(
  89. IN PPACTYPE pBuffer,
  90. ULONG cbSize
  91. );
  92. BOOLEAN
  93. PAC_ReMarshal( IN PPACTYPE pPac,
  94. IN ULONG cbSize );
  95. NTSTATUS
  96. PAC_Init(
  97. IN PSAMPR_USER_ALL_INFORMATION UserAll,
  98. IN OPTIONAL PSAMPR_GET_GROUPS_BUFFER GroupsBuffer,
  99. IN OPTIONAL PSID_AND_ATTRIBUTES_LIST ExtraGroups,
  100. IN PSID LogonDomainId,
  101. IN PUNICODE_STRING LogonDomainName,
  102. IN PUNICODE_STRING LogonServer,
  103. IN ULONG SignatureSize,
  104. IN ULONG AdditionalDataCount,
  105. IN PPAC_INFO_BUFFER * AdditionalData,
  106. OUT PACTYPE ** ppPac
  107. );
  108. NTSTATUS
  109. PAC_InitAndUpdateGroups(
  110. IN PNETLOGON_VALIDATION_SAM_INFO3 OldValidationInfo,
  111. IN PSAMPR_PSID_ARRAY ResourceGroups,
  112. IN PPACTYPE OldPac,
  113. OUT PACTYPE ** ppPac
  114. );
  115. PPAC_INFO_BUFFER
  116. PAC_Find( IN PPACTYPE pPac,
  117. IN ULONG ulType,
  118. IN PPAC_INFO_BUFFER pElem);
  119. NTSTATUS
  120. PAC_UnmarshallValidationInfo(
  121. OUT PNETLOGON_VALIDATION_SAM_INFO3 * ValidationInfo,
  122. IN PBYTE MarshalledInfo,
  123. OUT ULONG ValidationInfoSize
  124. );
  125. NTSTATUS
  126. PAC_BuildCredentials(
  127. IN PSAMPR_USER_ALL_INFORMATION UserAll,
  128. OUT PBYTE * Credentials,
  129. OUT PULONG CredentialSize
  130. );
  131. NTSTATUS
  132. PAC_UnmarshallCredentials(
  133. OUT PSECPKG_SUPPLEMENTAL_CRED_ARRAY * Credentials,
  134. IN PBYTE MarshalledInfo,
  135. OUT ULONG CredentialInfoSize
  136. );
  137. NTSTATUS
  138. PAC_EncodeCredentialData(
  139. IN PSECPKG_SUPPLEMENTAL_CRED_ARRAY CredentialData,
  140. OUT PBYTE * EncodedData,
  141. OUT PULONG DataSize
  142. );
  143. #include <pac2.hxx>
  144. #endif // __PAC_HXX__