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.

227 lines
4.7 KiB

  1. //=============================================================================
  2. //
  3. // MODULE: ASN1PaData.cxx
  4. //
  5. // Description:
  6. //
  7. // Implementation of pre-authentication data parsing logic
  8. //
  9. // Modification History
  10. //
  11. // Mark Pustilnik Date: 06/16/02 - created
  12. //
  13. //=============================================================================
  14. #include "ASN1Parser.hxx"
  15. DWORD
  16. ASN1ParserPaData::DisplayCollectedValues(
  17. IN ASN1FRAME * Frame,
  18. IN ULONG Length,
  19. IN ULPBYTE Address
  20. )
  21. {
  22. DWORD dw;
  23. ASN1VALUE * PaDataType;
  24. ASN1VALUE * PaDataValue;
  25. ASN1FRAME FrameHere;
  26. if ( QueryCollectedCount() != 2 )
  27. {
  28. dw = ERROR_INTERNAL_ERROR;
  29. goto Cleanup;
  30. }
  31. //
  32. // First handle the first element - the padata-type
  33. //
  34. PaDataType = QueryCollectedValue( 0 );
  35. if ( PaDataType->ut != utInteger )
  36. {
  37. dw = ERROR_INTERNAL_ERROR;
  38. goto Cleanup;
  39. }
  40. dw = Display(
  41. Frame,
  42. PaDataType,
  43. PROP( PA_DATA_type ),
  44. 0
  45. );
  46. if ( dw != ERROR_SUCCESS )
  47. {
  48. goto Cleanup;
  49. }
  50. //
  51. // Now display the padata-value in a type-specific fashion
  52. //
  53. PaDataValue = QueryCollectedValue( 1 );
  54. //
  55. // Sequences of length zero are valid in some cases
  56. //
  57. if ( PaDataValue->Length == 0 )
  58. {
  59. goto Cleanup;
  60. }
  61. Frame->Level += 1;
  62. //
  63. // NOTE: Must use the actual address within the frame (PaDataValue->Address)
  64. // rather than the (potentially dynamically allocated) address of the octet string
  65. // since Netmon cares that the addresses passed to it during display belong
  66. // within the frame being parsed
  67. //
  68. FrameHere.Address = PaDataValue->Address;
  69. FrameHere.hFrame = Frame->hFrame;
  70. FrameHere.Level = Frame->Level;
  71. switch ( PaDataType->dw )
  72. {
  73. case PA_APTGS_REQ:
  74. {
  75. if ( FrameHere.Address &&
  76. PaDataValue->Length > 0 &&
  77. *FrameHere.Address == BuildDescriptor(
  78. ctApplication,
  79. pcConstructed,
  80. ASN1_KRB_AP_REQ ))
  81. {
  82. ASN1ParserApReq
  83. ap_req( FALSE, 0, NULL );
  84. dw = ap_req.Parse( &FrameHere );
  85. }
  86. else
  87. {
  88. //
  89. // TODO: add other non-default parsers
  90. //
  91. dw = Display(
  92. Frame,
  93. PaDataValue,
  94. PROP( PA_DATA_value ),
  95. 0
  96. );
  97. }
  98. break;
  99. }
  100. case PA_ENC_TIMESTAMP:
  101. case PA_CLIENT_VERSION:
  102. case PA_XBOX_SERVICE_REQUEST:
  103. case PA_XBOX_SERVICE_ADDRESS:
  104. case PA_XBOX_ACCOUNT_CREATION:
  105. {
  106. ASN1ParserEncryptedData
  107. encrypted_data( FALSE, 0, NULL );
  108. dw = encrypted_data.Parse( &FrameHere );
  109. break;
  110. }
  111. case PA_PW_SALT:
  112. {
  113. dw = Display(
  114. &FrameHere,
  115. PaDataValue,
  116. PROP( PA_PW_SALT_salt ),
  117. 0
  118. );
  119. break;
  120. }
  121. case PA_ETYPE_INFO:
  122. {
  123. ASN1ParserKerbEtypeInfo
  124. etype_info( FALSE, 0, NULL );
  125. dw = etype_info.Parse( &FrameHere );
  126. break;
  127. }
  128. case PA_PAC_REQUEST:
  129. {
  130. ASN1ParserKerbPaPacRequest
  131. pa_pac_request( FALSE, 0, NULL );
  132. dw = pa_pac_request.Parse( &FrameHere );
  133. break;
  134. }
  135. case PA_FOR_USER:
  136. {
  137. ASN1ParserKerbPaForUser
  138. pa_for_user( FALSE, 0, NULL );
  139. dw = pa_for_user.Parse( &FrameHere );
  140. break;
  141. }
  142. case PA_PAC_REQUEST_EX:
  143. {
  144. ASN1ParserPaPacRequestEx
  145. pa_pac_request_ex(
  146. FALSE,
  147. 0,
  148. NULL );
  149. dw = pa_pac_request_ex.Parse( &FrameHere );
  150. break;
  151. }
  152. case PA_COMPOUND_IDENTITY:
  153. {
  154. //
  155. // KERB-PA-COMPOUND-IDENTITY ::= SEQUENCE OF KERB-TICKET
  156. //
  157. ASN1ParserTicketSequence
  158. pa_compound_identity(
  159. FALSE,
  160. 0,
  161. PROP( CompoundIdentity ),
  162. PROP( CompoundIdentityTicket ));
  163. dw = pa_compound_identity.Parse( &FrameHere );
  164. break;
  165. }
  166. default:
  167. dw = Display(
  168. Frame,
  169. PaDataValue,
  170. PROP( PA_DATA_value ),
  171. 0
  172. );
  173. }
  174. Frame->Level -= 1;
  175. if ( dw != ERROR_SUCCESS )
  176. {
  177. goto Cleanup;
  178. }
  179. Cleanup:
  180. return dw;
  181. }