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.

171 lines
3.9 KiB

  1. //#--------------------------------------------------------------
  2. //
  3. // File: validator.cpp
  4. //
  5. // Synopsis: Implementation of CValidator class methods
  6. //
  7. //
  8. // History: 9/23/97 MKarki Created
  9. //
  10. // Copyright (C) 1997-98 Microsoft Corporation
  11. // All rights reserved.
  12. //
  13. //----------------------------------------------------------------
  14. #include "radcommon.h"
  15. #include "validator.h"
  16. //++--------------------------------------------------------------
  17. //
  18. // Function: CValidator
  19. //
  20. // Synopsis: This is the constructor of the CValidator class
  21. //
  22. // Arguments: NONE
  23. //
  24. // Returns: NONE
  25. //
  26. //
  27. // History: MKarki Created 9/26/97
  28. //
  29. //----------------------------------------------------------------
  30. CValidator::CValidator()
  31. {
  32. } // end of CValidator class constructor
  33. //++--------------------------------------------------------------
  34. //
  35. // Function: ~CValidator
  36. //
  37. // Synopsis: This is the destructor of the CValidator class
  38. //
  39. // Arguments: NONE
  40. //
  41. // Returns: NONE
  42. //
  43. //
  44. // History: MKarki Created 9/26/97
  45. //
  46. //----------------------------------------------------------------
  47. CValidator::~CValidator()
  48. {
  49. return;
  50. }
  51. //++--------------------------------------------------------------
  52. //
  53. // Function: ValidateInPacket
  54. //
  55. // Synopsis: This is the CValidator class public method which
  56. // validates the inbound RADIUS packet
  57. //
  58. // Arguments: NONE
  59. //
  60. // Returns: NONE
  61. //
  62. //
  63. // History: MKarki Created 9/26/97
  64. //
  65. //----------------------------------------------------------------
  66. HRESULT CValidator::ValidateInPacket(
  67. CPacketRadius * pCPacketRadius
  68. )
  69. {
  70. return (S_OK);
  71. }
  72. //++--------------------------------------------------------------
  73. //
  74. // Function: ValidateInPacket
  75. //
  76. // Synopsis: This is the CValidator class public method which
  77. // validates the outbound RADIUS packet
  78. //
  79. // Arguments: NONE
  80. //
  81. // Returns: NONE
  82. //
  83. //
  84. // History: MKarki Created 9/26/97
  85. //
  86. //----------------------------------------------------------------
  87. HRESULT
  88. CValidator::ValidateOutPacket(
  89. CPacketRadius * pCPacketRadius
  90. )
  91. {
  92. HRESULT hr = S_OK;
  93. DWORD dwClientAddress = 0;
  94. CClient *pCClient = NULL;
  95. _ASSERT (pCPacketRadius);
  96. __try
  97. {
  98. //
  99. // validate the attributes
  100. //
  101. hr = m_pCValAttributes->Validate (pCPacketRadius);
  102. if (FAILED (hr)) { __leave; }
  103. //
  104. // now give the packet for processing
  105. //
  106. hr = m_pCPreProcessor->StartOutProcessing (pCPacketRadius);
  107. if (FAILED (hr)) { __leave; }
  108. }
  109. __finally
  110. {
  111. //
  112. // nothing here for now
  113. //
  114. }
  115. return (hr);
  116. }
  117. //++--------------------------------------------------------------
  118. //
  119. // Function: Init
  120. //
  121. // Synopsis: This is the intialization code
  122. //
  123. // Arguments: NONE
  124. //
  125. // Returns: NONE
  126. //
  127. //
  128. // History: MKarki Created 9/28/97
  129. //
  130. // Calleed By: CPreValidator class method
  131. //
  132. //----------------------------------------------------------------
  133. BOOL
  134. CValidator::Init(
  135. CValAttributes *pCValAttributes,
  136. CPreProcessor *pCPreProcessor,
  137. CClients *pCClients,
  138. CHashMD5 *pCHashMD5,
  139. CReportEvent *pCReportEvent
  140. )
  141. {
  142. _ASSERT (
  143. (NULL != pCValAttributes) &&
  144. (NULL != pCPreProcessor) &&
  145. (NULL != pCClients) &&
  146. (NULL != pCHashMD5) &&
  147. (NULL != pCReportEvent)
  148. );
  149. //
  150. // assign values now
  151. //
  152. m_pCValAttributes = pCValAttributes;
  153. m_pCPreProcessor = pCPreProcessor;
  154. m_pCClients = pCClients;
  155. m_pCHashMD5 = pCHashMD5;
  156. m_pCReportEvent = pCReportEvent;
  157. return (TRUE);
  158. } // end of CValidator::Init method