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.

110 lines
2.2 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1998, Microsoft Corp. All rights reserved.
  4. //
  5. // FILE
  6. //
  7. // NTGroups.h
  8. //
  9. // SYNOPSIS
  10. //
  11. // This file declares the class NTGroups.
  12. //
  13. // MODIFICATION HISTORY
  14. //
  15. // 02/04/1998 Original version.
  16. //
  17. ///////////////////////////////////////////////////////////////////////////////
  18. #ifndef _NTGROUPS_H_
  19. #define _NTGROUPS_H_
  20. #include <condition.h>
  21. #include <nocopy.h>
  22. #include <vector>
  23. ///////////////////////////////////////////////////////////////////////////////
  24. //
  25. // CLASS
  26. //
  27. // SidSet
  28. //
  29. // DESCRIPTION
  30. //
  31. // Simple wrapper around a collection of SIDs.
  32. //
  33. ///////////////////////////////////////////////////////////////////////////////
  34. class SidSet
  35. : NonCopyable
  36. {
  37. public:
  38. ~SidSet() throw ()
  39. {
  40. for (Sids::iterator it = sids.begin() ; it != sids.end(); ++it)
  41. {
  42. FreeSid(*it);
  43. }
  44. }
  45. bool contains(PSID sid) const throw ()
  46. {
  47. for (Sids::const_iterator it = sids.begin() ; it != sids.end(); ++it)
  48. {
  49. if (EqualSid(sid, *it)) { return true; }
  50. }
  51. return false;
  52. }
  53. void insert(PSID sid)
  54. {
  55. sids.push_back(sid);
  56. }
  57. void swap(SidSet& s) throw ()
  58. {
  59. sids.swap(s.sids);
  60. }
  61. protected:
  62. typedef std::vector<PSID> Sids;
  63. Sids sids;
  64. };
  65. ///////////////////////////////////////////////////////////////////////////////
  66. //
  67. // CLASS
  68. //
  69. // NTGroups
  70. //
  71. // DESCRIPTION
  72. //
  73. // Policy condition that evaluates NT Group membership.
  74. //
  75. ///////////////////////////////////////////////////////////////////////////////
  76. class ATL_NO_VTABLE NTGroups :
  77. public Condition,
  78. public CComCoClass<NTGroups, &__uuidof(NTGroups)>
  79. {
  80. public:
  81. IAS_DECLARE_REGISTRY(NTGroups, 1, IAS_REGISTRY_AUTO, NetworkPolicy)
  82. //////////
  83. // ICondition
  84. //////////
  85. STDMETHOD(IsTrue)(/*[in]*/ IRequest* pRequest,
  86. /*[out, retval]*/ VARIANT_BOOL *pVal);
  87. //////////
  88. // IConditionText
  89. //////////
  90. STDMETHOD(put_ConditionText)(/*[in]*/ BSTR newVal);
  91. protected:
  92. SidSet groups; // Set of allowed groups.
  93. };
  94. #endif //_NTGROUPS_H_