diff options
author | Rob Mensching <rob@firegiant.com> | 2021-05-04 22:48:12 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2021-05-04 22:48:12 -0700 |
commit | 7c8e34de56b3348c5a421cd0cced183e1394c5c7 (patch) | |
tree | c2f17867b49e33e0833eae2e1841a00b009c1a15 /src/ext/Iis/ca/scawebprop7.cpp | |
parent | c5c87377d99beefe83a3470aab326d12bdf0f8a4 (diff) | |
download | wix-7c8e34de56b3348c5a421cd0cced183e1394c5c7.tar.gz wix-7c8e34de56b3348c5a421cd0cced183e1394c5c7.tar.bz2 wix-7c8e34de56b3348c5a421cd0cced183e1394c5c7.zip |
Move Iis.wixext into ext
Diffstat (limited to 'src/ext/Iis/ca/scawebprop7.cpp')
-rw-r--r-- | src/ext/Iis/ca/scawebprop7.cpp | 155 |
1 files changed, 155 insertions, 0 deletions
diff --git a/src/ext/Iis/ca/scawebprop7.cpp b/src/ext/Iis/ca/scawebprop7.cpp new file mode 100644 index 00000000..b8d99b0a --- /dev/null +++ b/src/ext/Iis/ca/scawebprop7.cpp | |||
@@ -0,0 +1,155 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | #include "precomp.h" | ||
4 | |||
5 | HRESULT ScaWriteWebDirProperties7( | ||
6 | __in_z LPCWSTR wzWebName, | ||
7 | __in_z LPCWSTR wzRootOfWeb, | ||
8 | __in const SCA_WEB_PROPERTIES* pswp | ||
9 | ) | ||
10 | { | ||
11 | HRESULT hr = S_OK; | ||
12 | WCHAR wz[METADATA_MAX_NAME_LEN + 1]; | ||
13 | |||
14 | //all go to same web/root location tag | ||
15 | hr = ScaWriteConfigID(IIS_DIRPROP_BEGIN); | ||
16 | ExitOnFailure(hr, "Failed to write DirProp begin id"); | ||
17 | hr = ScaWriteConfigString(wzWebName); //site name key | ||
18 | ExitOnFailure(hr, "Failed to write DirProp web key"); | ||
19 | hr = ScaWriteConfigString(wzRootOfWeb); //app path key | ||
20 | ExitOnFailure(hr, "Failed to write DirProp app key"); | ||
21 | |||
22 | // write the access permissions to the metabase | ||
23 | if (MSI_NULL_INTEGER != pswp->iAccess) | ||
24 | { | ||
25 | hr = ScaWriteConfigID(IIS_DIRPROP_ACCESS); | ||
26 | ExitOnFailure(hr, "Failed to write DirProp access id"); | ||
27 | hr = ScaWriteConfigInteger(pswp->iAccess); | ||
28 | ExitOnFailure(hr, "Failed to write access permissions for Web"); | ||
29 | } | ||
30 | |||
31 | if (MSI_NULL_INTEGER != pswp->iAuthorization) | ||
32 | { | ||
33 | hr = ScaWriteConfigID(IIS_DIRPROP_AUTH); | ||
34 | ExitOnFailure(hr, "Failed to write DirProp auth id"); | ||
35 | hr = ScaWriteConfigInteger(pswp->iAuthorization); | ||
36 | ExitOnFailure(hr, "Failed to write authorization for Web"); | ||
37 | } | ||
38 | |||
39 | if (pswp->fHasUser) | ||
40 | { | ||
41 | Assert(pswp->scau.wzName); | ||
42 | // write the user name | ||
43 | if (*pswp->scau.wzDomain) | ||
44 | { | ||
45 | hr = ::StringCchPrintfW(wz, countof(wz), L"%s\\%s", pswp->scau.wzDomain, pswp->scau.wzName); | ||
46 | ExitOnFailure(hr, "Failed to format domain\\username string"); | ||
47 | } | ||
48 | else | ||
49 | { | ||
50 | #pragma prefast(suppress:26037, "Source string is null terminated - it is populated as target of ::StringCchCopyW") | ||
51 | hr = ::StringCchCopyW(wz, countof(wz), pswp->scau.wzName); | ||
52 | ExitOnFailure(hr, "Failed to copy user name"); | ||
53 | } | ||
54 | hr = ScaWriteConfigID(IIS_DIRPROP_USER); | ||
55 | ExitOnFailure(hr, "Failed to write DirProp user id"); | ||
56 | hr = ScaWriteConfigString(wz); | ||
57 | ExitOnFailure(hr, "Failed to write anonymous user name for Web"); | ||
58 | |||
59 | // write the password | ||
60 | hr = ScaWriteConfigID(IIS_DIRPROP_PWD); | ||
61 | ExitOnFailure(hr, "Failed to write DirProp pwd id"); | ||
62 | hr = ScaWriteConfigString(pswp->scau.wzPassword); | ||
63 | ExitOnFailure(hr, "Failed to write anonymous user password for Web"); | ||
64 | |||
65 | if (pswp->fIIsControlledPassword) | ||
66 | { | ||
67 | //Not Supported by IIS7 : pswp->fIIsControlledPassword | ||
68 | WcaLog(LOGMSG_VERBOSE, "Not supported by IIS7: WebDirProperties.IIsControlledPassword, ignoring"); | ||
69 | } | ||
70 | } | ||
71 | |||
72 | if (MSI_NULL_INTEGER != pswp->fLogVisits) | ||
73 | { | ||
74 | hr = ScaWriteConfigID(IIS_DIRPROP_LOGVISITS); | ||
75 | ExitOnFailure(hr, "Failed to write DirProp logVisits id"); | ||
76 | hr = ScaWriteConfigInteger(pswp->fLogVisits ? FALSE : TRUE); // we capture "should log" but IIS7 wants "should not log" | ||
77 | ExitOnFailure(hr, "Failed to write DirProp logVisits"); | ||
78 | } | ||
79 | |||
80 | if (MSI_NULL_INTEGER != pswp->fIndex) | ||
81 | { | ||
82 | //Not Supported by IIS7 : pswp->fIndex | ||
83 | WcaLog(LOGMSG_VERBOSE, "Not supported by IIS7: WebDirProperties.Index, ignoring"); | ||
84 | } | ||
85 | |||
86 | if (pswp->fHasDefaultDoc) | ||
87 | { | ||
88 | hr = ScaWriteConfigID(IIS_DIRPROP_DEFDOCS); | ||
89 | ExitOnFailure(hr, "Failed to write DirProp defdocs id"); | ||
90 | hr = ScaWriteConfigString(pswp->wzDefaultDoc); | ||
91 | ExitOnFailure(hr, "Failed to write default documents for Web"); | ||
92 | } | ||
93 | |||
94 | if (MSI_NULL_INTEGER != pswp->fAspDetailedError) | ||
95 | { | ||
96 | hr = ScaWriteConfigID(IIS_DIRPROP_ASPERROR); | ||
97 | ExitOnFailure(hr, "Failed to write ASP script error id"); | ||
98 | hr = ScaWriteConfigInteger(pswp->fAspDetailedError); | ||
99 | ExitOnFailure(hr, "Failed to write ASP script error for Web"); | ||
100 | } | ||
101 | |||
102 | if (pswp->fHasHttpExp) | ||
103 | { | ||
104 | hr = ScaWriteConfigID(IIS_DIRPROP_HTTPEXPIRES); | ||
105 | ExitOnFailure(hr, "Failed to write DirProp HttpExpires id"); | ||
106 | hr = ScaWriteConfigString(pswp->wzHttpExp); | ||
107 | ExitOnFailure(hr, "Failed to write DirProp HttpExpires value"); | ||
108 | } | ||
109 | |||
110 | if (MSI_NULL_INTEGER != pswp->iCacheControlMaxAge) | ||
111 | { | ||
112 | hr = ScaWriteConfigID(IIS_DIRPROP_MAXAGE); | ||
113 | ExitOnFailure(hr, "Failed to write DirProp MaxAge id"); | ||
114 | hr = ScaWriteConfigInteger(pswp->iCacheControlMaxAge); | ||
115 | ExitOnFailure(hr, "Failed to write DirProp MaxAge value"); | ||
116 | } | ||
117 | |||
118 | if (pswp->fHasCacheControlCustom) | ||
119 | { | ||
120 | hr = ScaWriteConfigID(IIS_DIRPROP_CACHECUST); | ||
121 | ExitOnFailure(hr, "Failed to write DirProp Cache Control Custom id"); | ||
122 | hr = ScaWriteConfigString(pswp->wzCacheControlCustom); | ||
123 | ExitOnFailure(hr, "Failed to write Cache Control Custom for Web"); | ||
124 | } | ||
125 | |||
126 | if (pswp->fNoCustomError) | ||
127 | { | ||
128 | hr = ScaWriteConfigID(IIS_DIRPROP_NOCUSTERROR); | ||
129 | ExitOnFailure(hr, "Failed to write DirProp clear Cust Errors id"); | ||
130 | } | ||
131 | |||
132 | if (MSI_NULL_INTEGER != pswp->iAccessSSLFlags) | ||
133 | { | ||
134 | hr = ScaWriteConfigID(IIS_DIRPROP_SSLFLAGS); | ||
135 | ExitOnFailure(hr, "Failed to write DirProp sslFlags id"); | ||
136 | hr = ScaWriteConfigInteger(pswp->iAccessSSLFlags); | ||
137 | ExitOnFailure(hr, "Failed to write AccessSSLFlags for Web"); | ||
138 | } | ||
139 | |||
140 | if (*pswp->wzAuthenticationProviders) | ||
141 | { | ||
142 | hr = ::StringCchCopyW(wz, countof(wz), pswp->wzAuthenticationProviders); | ||
143 | ExitOnFailure(hr, "Failed to copy authentication providers string"); | ||
144 | hr = ScaWriteConfigID(IIS_DIRPROP_AUTHPROVID); | ||
145 | ExitOnFailure(hr, "Failed to write DirProp AuthProvid id"); | ||
146 | hr = ScaWriteConfigString(wz); | ||
147 | ExitOnFailure(hr, "Failed to write AuthenticationProviders for Web"); | ||
148 | } | ||
149 | //End of Dir Properties | ||
150 | hr = ScaWriteConfigID(IIS_DIRPROP_END); | ||
151 | ExitOnFailure(hr, "Failed to write DirProp end id"); | ||
152 | |||
153 | LExit: | ||
154 | return hr; | ||
155 | } | ||