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.

481 lines
9.0 KiB

  1. /*++
  2. Copyright (c) 1994-1998 Microsoft Corporation
  3. Module Name :
  4. pwiz.h
  5. Abstract:
  6. IIS Security Wizard
  7. Author:
  8. Ronald Meijer (ronaldm)
  9. Project:
  10. Internet Services Manager
  11. Revision History:
  12. --*/
  13. #ifndef __IISPWIZ_H__
  14. #define __IISPWIZ_H__
  15. class CBlob;
  16. #define NUM_ACCESS_RECORDS (2)
  17. typedef CList<DWORD, DWORD> CDWORDList;
  18. //
  19. // Structure to map a flag to a string ID
  20. //
  21. typedef struct tagFLAGTOSTRING
  22. {
  23. DWORD dwFlag;
  24. UINT nID;
  25. BOOL fSet;
  26. } FLAGTOSTRING;
  27. class COMDLL CIISSecurityTemplate : public CMetaProperties
  28. /*++
  29. Class Description:
  30. Security template info
  31. Public Interface:
  32. CIISSecurityTemplate : Constructor
  33. ApplySettings : Apply template to destination path
  34. ClearSummary : Clear the text summary
  35. GenerateSummary : Generate the text summary
  36. --*/
  37. {
  38. public:
  39. CIISSecurityTemplate(
  40. IN const CMetaKey * pKey,
  41. IN LPCTSTR lpszMDPath,
  42. IN BOOL fInherit
  43. );
  44. public:
  45. //
  46. // Apply settings to destination path
  47. //
  48. virtual HRESULT ApplySettings(
  49. IN BOOL fUseTemplates,
  50. IN LPCTSTR lpszServerName,
  51. IN LPCTSTR lpszService,
  52. IN DWORD dwInstance = MASTER_INSTANCE,
  53. IN LPCTSTR lpszParent = NULL,
  54. IN LPCTSTR lpszAlias = NULL
  55. );
  56. //
  57. // Build summary strings from security settings. Clear summary
  58. // before calling GenerateSummary().
  59. //
  60. virtual void GenerateSummary(
  61. IN BOOL fUseTemplates,
  62. IN LPCTSTR lpszServerName,
  63. IN LPCTSTR lpszService,
  64. IN DWORD dwInstance = MASTER_INSTANCE,
  65. IN LPCTSTR lpszParent = NULL,
  66. IN LPCTSTR lpszAlias = NULL
  67. );
  68. void ClearSummary() { m_strlSummary.RemoveAll(); }
  69. POSITION GetHeadPosition() { return m_strlSummary.GetHeadPosition(); }
  70. CString & GetNext(POSITION & pos) { return m_strlSummary.GetNext(pos); }
  71. void AddSummaryString(
  72. IN LPCTSTR szTextItem,
  73. IN int cIndentLevel = 0
  74. );
  75. void AddSummaryString(
  76. IN UINT nID,
  77. IN int cIndentLevel = 0
  78. );
  79. protected:
  80. //
  81. // Break out GetAllData() data to data fields
  82. //
  83. virtual void ParseFields();
  84. public:
  85. MP_DWORD m_dwAccessPerms;
  86. MP_CBlob m_ipl;
  87. protected:
  88. //
  89. // The derived class is expected to add its managed properties
  90. // to this list in its constructor
  91. //
  92. CDWORDList m_dlProperties;
  93. CStringList m_strlSummary;
  94. };
  95. //
  96. // Method to allocate security template. This is used by the service
  97. // configuration dll to allocate a CIISSecurityTemplate-derived class
  98. // specific to their service.
  99. //
  100. typedef CIISSecurityTemplate * (* pfnNewSecurityTemplate)(
  101. IN const CMetaKey * pKey,
  102. IN LPCTSTR lpszMDPath,
  103. IN BOOL fInherit
  104. );
  105. //
  106. // Launch security wizard
  107. //
  108. HRESULT COMDLL
  109. COMDLL_ISMSecurityWizard(
  110. IN pfnNewSecurityTemplate pfnTemplateAllocator,
  111. IN CMetaInterface * pInterface,
  112. IN UINT nLeftBmpId,
  113. IN UINT nHeadBmpId,
  114. IN LPCTSTR lpszService,
  115. IN DWORD dwInstance,
  116. IN LPCTSTR lpszParent,
  117. IN LPCTSTR lpszAlias
  118. );
  119. class CIISSecWizSettings : public CObjectPlus
  120. /*++
  121. Class Description:
  122. Security wizard settings -- passed around from page
  123. to page.
  124. Public Interface:
  125. CIISSecWizSettings : Constructor
  126. --*/
  127. {
  128. //
  129. // Constructor/Destructor
  130. //
  131. public:
  132. CIISSecWizSettings(
  133. IN pfnNewSecurityTemplate pfnTemplateAllocator,
  134. IN LPCTSTR lpszServer,
  135. IN LPCTSTR lpszService,
  136. IN DWORD dwInstance,
  137. IN LPCTSTR lpszParent,
  138. IN LPCTSTR lpszAlias
  139. );
  140. ~CIISSecWizSettings();
  141. public:
  142. //
  143. // Fetch the metabase properties from the open key
  144. // (could be template or another vroot)
  145. //
  146. HRESULT FetchProperties(
  147. IN CMetaKey & mk,
  148. IN LPCTSTR lpszPath = NULL,
  149. IN BOOL fInherit = FALSE
  150. );
  151. //
  152. // Data Members
  153. //
  154. public:
  155. BOOL m_fSetAcls;
  156. BOOL m_fReplaceAcls;
  157. BOOL m_fRedirected;
  158. BOOL m_fUseTemplate;
  159. DWORD m_dwInstance;
  160. DWORD m_AccessMaskAdmin;
  161. DWORD m_AccessMaskEveryone;
  162. DWORD m_AccessMaskDefault;
  163. HRESULT m_hResult;
  164. CString m_strServer;
  165. CString m_strService;
  166. CString m_strParent;
  167. CString m_strAlias;
  168. CString m_strPath;
  169. CIISSecurityTemplate * m_pist;
  170. pfnNewSecurityTemplate m_pfnTemplateAllocator;
  171. EXPLICIT_ACCESS m_rgaae[NUM_ACCESS_RECORDS];
  172. };
  173. //
  174. // Permissions Wizard Source Page
  175. //
  176. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  177. class COMDLL CPWSource : public CIISWizardPage
  178. {
  179. DECLARE_DYNCREATE(CPWSource)
  180. //
  181. // Construction
  182. //
  183. public:
  184. CPWSource(IN CIISSecWizSettings * pSettings = NULL);
  185. ~CPWSource();
  186. //
  187. // Dialog Data
  188. //
  189. protected:
  190. enum { RADIO_INHERITANCE, RADIO_TEMPLATE, };
  191. //{{AFX_DATA(CPWSource)
  192. enum { IDD = IDD_PERMWIZ_SOURCE };
  193. int m_nSource;
  194. //}}AFX_DATA
  195. //
  196. // Overrides
  197. //
  198. protected:
  199. // ClassWizard generate virtual function overrides
  200. //{{AFX_VIRTUAL(CPWSource)
  201. public:
  202. virtual BOOL OnSetActive();
  203. virtual LRESULT OnWizardNext();
  204. protected:
  205. virtual void DoDataExchange(CDataExchange * pDX);
  206. //}}AFX_VIRTUAL
  207. //
  208. // Implementation
  209. //
  210. protected:
  211. // Generated message map functions
  212. //{{AFX_MSG(CPWSource)
  213. //}}AFX_MSG
  214. DECLARE_MESSAGE_MAP()
  215. void SetControlStates();
  216. private:
  217. CIISSecWizSettings * m_pSettings;
  218. };
  219. //
  220. // Permissions Wizard Template Page
  221. //
  222. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  223. class COMDLL CPWTemplate : public CIISWizardPage
  224. {
  225. DECLARE_DYNCREATE(CPWTemplate)
  226. //
  227. // Construction
  228. //
  229. public:
  230. CPWTemplate(IN CIISSecWizSettings * pSettings = NULL);
  231. ~CPWTemplate();
  232. //
  233. // Dialog Data
  234. //
  235. protected:
  236. //{{AFX_DATA(CPWTemplate)
  237. enum { IDD = IDD_PERMWIZ_TEMPLATE };
  238. CListBox m_list_Templates;
  239. CEdit m_edit_Description;
  240. //}}AFX_DATA
  241. //
  242. // Overrides
  243. //
  244. protected:
  245. // ClassWizard generate virtual function overrides
  246. //{{AFX_VIRTUAL(CPWTemplate)
  247. public:
  248. virtual BOOL OnSetActive();
  249. virtual LRESULT OnWizardNext();
  250. protected:
  251. virtual void DoDataExchange(CDataExchange * pDX);
  252. //}}AFX_VIRTUAL
  253. //
  254. // Implementation
  255. //
  256. protected:
  257. // Generated message map functions
  258. //{{AFX_MSG(CPWTemplate)
  259. virtual BOOL OnInitDialog();
  260. afx_msg void OnSelchangeListTemplates();
  261. //}}AFX_MSG
  262. DECLARE_MESSAGE_MAP()
  263. void SetControlStates();
  264. private:
  265. CIISSecWizSettings * m_pSettings;
  266. };
  267. //
  268. // Permissions Wizard ACL Page
  269. //
  270. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  271. class COMDLL CPWACL : public CIISWizardPage
  272. {
  273. DECLARE_DYNCREATE(CPWACL)
  274. //
  275. // Construction
  276. //
  277. public:
  278. CPWACL(IN CIISSecWizSettings * pSettings = NULL);
  279. ~CPWACL();
  280. //
  281. // Dialog Data
  282. //
  283. protected:
  284. enum { RADIO_MAXIMUM, RADIO_MINIMUM, RADIO_NONE, };
  285. //{{AFX_DATA(CPWACL)
  286. enum { IDD = IDD_PERMWIZ_ACL };
  287. CStatic m_static_Line4;
  288. CStatic m_static_Line3;
  289. CStatic m_static_Line2;
  290. CStatic m_static_Line1;
  291. int m_nRadioAclType;
  292. //}}AFX_DATA
  293. //
  294. // Overrides
  295. //
  296. protected:
  297. // ClassWizard generate virtual function overrides
  298. //{{AFX_VIRTUAL(CPWACL)
  299. public:
  300. virtual BOOL OnSetActive();
  301. virtual LRESULT OnWizardNext();
  302. protected:
  303. virtual void DoDataExchange(CDataExchange * pDX);
  304. //}}AFX_VIRTUAL
  305. //
  306. // Implementation
  307. //
  308. protected:
  309. // Generated message map functions
  310. //{{AFX_MSG(CPWACL)
  311. //}}AFX_MSG
  312. DECLARE_MESSAGE_MAP()
  313. void SetControlStates();
  314. private:
  315. CIISSecWizSettings * m_pSettings;
  316. };
  317. //
  318. // Permissions Wizard Summary Page
  319. //
  320. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  321. class COMDLL CPWSummary : public CIISWizardPage
  322. {
  323. DECLARE_DYNCREATE(CPWSummary)
  324. //
  325. // Construction
  326. //
  327. public:
  328. CPWSummary(IN CIISSecWizSettings * pSettings = NULL);
  329. ~CPWSummary();
  330. //
  331. // Dialog Data
  332. //
  333. protected:
  334. //{{AFX_DATA(CPWSummary)
  335. enum { IDD = IDD_PERMWIZ_SUMMARY };
  336. CListBox m_list_Summary;
  337. //}}AFX_DATA
  338. //
  339. // Overrides
  340. //
  341. protected:
  342. // ClassWizard generate virtual function overrides
  343. //{{AFX_VIRTUAL(CPWSummary)
  344. public:
  345. virtual BOOL OnSetActive();
  346. virtual LRESULT OnWizardNext();
  347. protected:
  348. virtual void DoDataExchange(CDataExchange * pDX);
  349. //}}AFX_VIRTUAL
  350. //
  351. // Implementation
  352. //
  353. protected:
  354. // Generated message map functions
  355. //{{AFX_MSG(CPWSummary)
  356. virtual BOOL OnInitDialog();
  357. //}}AFX_MSG
  358. DECLARE_MESSAGE_MAP()
  359. void SetControlStates();
  360. void GenerateAclSummary();
  361. void DisplaySummary();
  362. HRESULT ApplyACLSToFiles();
  363. HRESULT
  364. SetPermToChildren(
  365. IN CString& FileName,
  366. IN SECURITY_INFORMATION si,
  367. IN PACL pDacl,
  368. IN PACL pSacl
  369. );
  370. private:
  371. CIISSecWizSettings * m_pSettings;
  372. };
  373. #endif // __IISPWIZ_H__