Skip to content

Commit 1e872fd

Browse files
committed
Add -errLogPath option to override the default error path
1 parent 52b5dd0 commit 1e872fd

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/verifySignedfile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ bool SecurityGuard::verifySignedBinary(const std::wstring& filepath)
121121

122122
if (vtrust)
123123
{
124-
writeSecurityError(filepath.c_str(), L": trust verification failed");
124+
writeSecurityError(filepath.c_str(), L": chain of trust verification failed");
125125
return false;
126126
}
127127

src/winmain.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ static constexpr wchar_t FLAG_CHKCERT_NAME[] = L"-chkCertName=";
9999
static constexpr wchar_t FLAG_CHKCERT_SUBJECT[] = L"-chkCertSubject=";
100100
static constexpr wchar_t FLAG_CHKCERT_KEYID[] = L"-chkCertKeyId=";
101101
static constexpr wchar_t FLAG_CHKCERT_AUTHORITYKEYID[] = L"-chkCertAuthorityKeyId=";
102+
static constexpr wchar_t FLAG_ERRLOGPATH[] = L"-errLogPath=";
102103

103104
static constexpr wchar_t MSGID_HELP[] =
104105
L"Usage:\r\n\
@@ -134,17 +135,20 @@ gup [-vVERSION_VALUE] [-infoUrl=URL] [-forceDomain=URL_PREFIX]\r\n\
134135
Update mode:\r\n\
135136
\r\n\
136137
gup [-vVERSION_VALUE] [-infoUrl=URL] [-chkCertSig=YES_NO] [-chkCertTrustChain]\r\n\
137-
[-chkCertRevoc] [-chkCertName=CERT_NAME] [-chkCertSubject=CERT_SUBNAME]\r\n\
138+
[-chkCertRevoc] [-chkCertName=\"CERT_NAME\][-chkCertSubject = \"CERT_SUBNAME\"]\r\n\
138139
[-chkCertKeyId=CERT_KEYID] [-chkCertAuthorityKeyId=CERT_AUTHORITYKEYID]\r\n\
140+
[-errLogPath=\"YOUR\\ERR\\LOG\\PATH.LOG\"]\r\n\
139141
\r\n\
140142
-chkCertSig= : Enable signature check on downloaded binary with \"-chkCertSig=yes\".\r\n\
141143
Otherwise all the other \"-chkCert*\" options will be ignored.\r\n\
142-
-chkCertTrustChain : Enable signature trust chain verification.\r\n\
144+
-chkCertTrustChain : Enable signature chain of trust verification.\r\n\
143145
-chkCertRevoc : Enable the verification of certificate revocation state.\r\n\
144146
-chkCertName= : Verify certificate name (quotes allowed for white-spaces).\r\n\
145147
-chkCertSubject= : Verify subject name (quotes allowed for white-spaces).\r\n\
146148
-chkCertKeyId= : Verify certificate key identifier.\r\n\
147149
-chkCertAuthorityKeyId= : Verify certificate authority key identifier.\r\n\
150+
-errLogPath= : override the default error log path. The default value is:\r\n\
151+
\"%LOCALAPPDATA%\\WinGUp\\log\\securityError.log\"\r\n\
148152
\r\n\
149153
Download & unzip mode:\r\n\
150154
\r\n\
@@ -1362,6 +1366,12 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR lpszCmdLine, int)
13621366
securityGuard.setAuthorityKeyId(authority_key_id);
13631367
}
13641368

1369+
wstring errLogPath;
1370+
if (getParamValFromString(FLAG_ERRLOGPATH, params, errLogPath))
1371+
{
1372+
securityGuard.setErrLogPath(errLogPath);
1373+
}
1374+
13651375
// Object (gupParams) is moved here because we need app icon form configuration file
13661376
GupParameters gupParams(L"gup.xml");
13671377
appIconFile = gupParams.getSoftwareIcon();
@@ -1652,7 +1662,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR lpszCmdLine, int)
16521662
if (downloadURL.size() <= forceDomain.size() // download URL must be longer than forceDomain
16531663
|| downloadURL.compare(0, forceDomain.size(), forceDomain) != 0) // Check if forceDomain is a prefix of download URL
16541664
{
1655-
securityGuard.writeSecurityError(L"Domain is not matched for download URL:", downloadURL);
1665+
securityGuard.writeSecurityError(L"Download URL does not match the expected domain:", downloadURL);
16561666
return -1;
16571667
}
16581668
}

0 commit comments

Comments
 (0)