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.

131 lines
3.3 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright(C) 2000 Microsoft Corporation all rights reserved.
  4. //
  5. // Module: Realms.cpp
  6. //
  7. // Project: Windows 2000 IAS
  8. //
  9. // Description: Implementation of the CProperties class
  10. // works only with m_StdSession (database being upgraded)
  11. //
  12. // Author: tperraut
  13. //
  14. // Revision 02/24/2000 created
  15. //
  16. /////////////////////////////////////////////////////////////////////////////
  17. #include "stdafx.h"
  18. #include "Realms.h"
  19. #include "utils.h"
  20. //////////////////////////////////////////////////////////////////////////////
  21. // Contructor
  22. //////////////////////////////////////////////////////////////////////////////
  23. CRealms::CRealms(CSession& Session)
  24. {
  25. Init(Session);
  26. };
  27. //////////////////////////////////////////////////////////////////////////////
  28. // GetRealm
  29. //////////////////////////////////////////////////////////////////////////////
  30. void CRealms::GetRealm(const _bstr_t& Profile)
  31. {
  32. lstrcpynW(m_ProfileParam, Profile, REALM_COLUMN_SIZE);
  33. _com_util::CheckError(BaseExecute());
  34. }
  35. //////////////////////////////////////////////////////////////////////////////
  36. // GetRealmIndex
  37. //////////////////////////////////////////////////////////////////////////////
  38. HRESULT CRealms::GetRealmIndex(const _bstr_t& Profile, LONG Index)
  39. {
  40. lstrcpynW(m_ProfileParam, Profile, REALM_COLUMN_SIZE);
  41. return BaseExecute(Index);
  42. }
  43. //////////////////////////////////////////////////////////////////////////////
  44. // SetRealmDetails
  45. //////////////////////////////////////////////////////////////////////////////
  46. void CRealms::SetRealmDetails(CPolicy& TempPolicy, CUtils& m_Utils)
  47. {
  48. const LONG ACCT_PROVIDER_RADIUS_PROXY = 2;
  49. // From the Realm. Reg key should be used
  50. _bstr_t Constraint = L"MATCH(\"";
  51. DWORD Identity = 1;
  52. if ( m_Utils.UserIdentityAttributeSet() )
  53. {
  54. Identity = m_Utils.GetUserIdentityAttribute();
  55. switch (Identity)
  56. {
  57. case 30: //hardcoded value
  58. {
  59. Constraint += L"Called-Station-Id=";
  60. break;
  61. }
  62. case 31: //hardcoded value
  63. {
  64. Constraint += L"Calling-Station-Id=";
  65. break;
  66. }
  67. case 1: //hardcoded value
  68. default:
  69. {
  70. Constraint += L"User-Name=";
  71. break;
  72. }
  73. }
  74. }
  75. else
  76. {
  77. Constraint += L"User-Name=";
  78. }
  79. // beginning of line
  80. if ( m_Prefix )
  81. {
  82. Constraint += L"^";
  83. }
  84. _bstr_t SuffixPrefix = m_SuffixPrefix;
  85. Constraint += SuffixPrefix;
  86. // end of line
  87. if ( !m_Prefix )
  88. {
  89. Constraint += L"$";
  90. }
  91. Constraint += L"\")";
  92. TempPolicy.SetmsNPConstraint(Constraint);
  93. TempPolicy.SetmsManipulationTarget(Identity);
  94. _bstr_t Search;
  95. _bstr_t Replace = L"";
  96. // If Strip is set, then replace (by nothing) the Suffix or Prefix
  97. if ( m_StripSuffixPrefix )
  98. {
  99. if ( m_Prefix )
  100. {
  101. Search += L"^";
  102. }
  103. Search += m_SuffixPrefix;
  104. if ( !m_Prefix )
  105. {
  106. Search += L"$";
  107. }
  108. TempPolicy.SetmsManipulationRules(Search, Replace);
  109. }
  110. // Forward Accounting bit
  111. if ( m_ForwardAccounting )
  112. {
  113. TempPolicy.SetmsAcctProviderType(ACCT_PROVIDER_RADIUS_PROXY);
  114. }
  115. }