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.

166 lines
5.1 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2000 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // CClusSvcAccountConfig.h
  7. //
  8. // Description:
  9. // Header file for CClusSvcAccountConfig class.
  10. // The CClusSvcAccountConfig class is an action that grants
  11. // the required rights to the cluster service account.
  12. //
  13. // Implementation Files:
  14. // CClusSvcAccountConfig.cpp
  15. //
  16. // Maintained By:
  17. // Vij Vasu (Vvasu) 03-MAR-2000
  18. //
  19. //////////////////////////////////////////////////////////////////////////////
  20. // Make sure that this file is included only once per compile path.
  21. #pragma once
  22. //////////////////////////////////////////////////////////////////////////
  23. // Include Files
  24. //////////////////////////////////////////////////////////////////////////
  25. // For the CAction base class
  26. #include "CAction.h"
  27. // For LsaClose, LSA_HANDLE, etc.
  28. #include <ntsecapi.h>
  29. //////////////////////////////////////////////////////////////////////////
  30. // Forward declarations
  31. //////////////////////////////////////////////////////////////////////////
  32. // The parent action of this action.
  33. class CBaseClusterAddNode;
  34. //////////////////////////////////////////////////////////////////////////////
  35. //++
  36. //
  37. // class CClusSvcAccountConfig
  38. //
  39. // Description:
  40. // The CClusSvcAccountConfigAccountConfig class is an action that grants
  41. // the required rights to the cluster service account.
  42. //
  43. //--
  44. //////////////////////////////////////////////////////////////////////////////
  45. class CClusSvcAccountConfig : public CAction
  46. {
  47. public:
  48. //////////////////////////////////////////////////////////////////////////
  49. // Public constructors and destructors
  50. //////////////////////////////////////////////////////////////////////////
  51. // Constructor.
  52. CClusSvcAccountConfig( CBaseClusterAddNode * pbcanParentActionIn );
  53. // Default destructor.
  54. ~CClusSvcAccountConfig();
  55. //////////////////////////////////////////////////////////////////////////
  56. // Public methods
  57. //////////////////////////////////////////////////////////////////////////
  58. //
  59. // Grant the required rights to the account.
  60. //
  61. void Commit();
  62. //
  63. // Revert the account to its previous state.
  64. //
  65. void Rollback();
  66. // Returns the number of progress messages that this action will send.
  67. UINT
  68. UiGetMaxProgressTicks() const throw()
  69. {
  70. //
  71. // The notification is:
  72. // 1. Configuring the cluster service account
  73. //
  74. return 1;
  75. }
  76. private:
  77. //////////////////////////////////////////////////////////////////////////
  78. // Private type definitions
  79. //////////////////////////////////////////////////////////////////////////
  80. typedef CAction BaseClass;
  81. typedef CSmartResource< CHandleTrait< PSID, PVOID, FreeSid > > SmartSid;
  82. typedef CSmartGenericPtr< CArrayPtrTrait< LSA_UNICODE_STRING > > SmartLSAUnicodeStringArray;
  83. //////////////////////////////////////////////////////////////////////////
  84. // Private member functions
  85. //////////////////////////////////////////////////////////////////////////
  86. // Copy constructor
  87. CClusSvcAccountConfig( const CClusSvcAccountConfig & );
  88. // Assignment operator
  89. CClusSvcAccountConfig & operator =( const CClusSvcAccountConfig & );
  90. // Assign the required rights to the account.
  91. void
  92. ConfigureAccount();
  93. // Undo the changes made in ConfigureAccount()
  94. void
  95. RevertAccount();
  96. // Initialize an LSA_UNICODE_STRING structure.
  97. void
  98. InitLsaString(
  99. LPWSTR pszSourceIn
  100. , PLSA_UNICODE_STRING plusUnicodeStringOut
  101. );
  102. // Add/remove an account from the administrators account.
  103. bool
  104. FChangeAdminGroupMembership( PSID psidAccountSidIn, bool fAddIn );
  105. //////////////////////////////////////////////////////////////////////////
  106. // Private data
  107. //////////////////////////////////////////////////////////////////////////
  108. // Pointer the parent of this action.
  109. CBaseClusterAddNode * m_pbcanParentAction;
  110. // SID of the administrators group.
  111. SmartSid m_ssidAdminSid;
  112. // Name of the administrators group.
  113. SmartSz m_sszAdminGroupName;
  114. // Indicates if the cluster service account was already in the admin group or not.
  115. bool m_fWasAreadyInGroup;
  116. // List of unicode strings containing names of rights to be granted.
  117. SmartLSAUnicodeStringArray m_srglusRightsToBeGrantedArray;
  118. // Number of strings in the above array.
  119. ULONG m_ulRightsToBeGrantedCount;
  120. // Indicate if all the rights assigned to this account should be removed.
  121. bool m_fRemoveAllRights;
  122. // Were any rights granted to the account.
  123. bool m_fRightsGrantSuccessful;
  124. }; //*** class CClusSvcAccountConfig