fix2
This commit is contained in:
parent
6bebe97760
commit
58ae4fc4db
|
@ -194,7 +194,7 @@ _FX BOOLEAN WSA_InitNetDnsFilter(HMODULE module)
|
|||
map_init(&WSA_LookupMap, Dll_Pool);
|
||||
|
||||
SCertInfo CertInfo = { 0 };
|
||||
if (!NT_SUCCESS(SbieApi_Call(API_QUERY_DRIVER_INFO, 3, -1, (ULONG_PTR)&CertInfo, sizeof(CertInfo))) || !CERT_IS_ADVANCED(CertInfo)) {
|
||||
if (!NT_SUCCESS(SbieApi_Call(API_QUERY_DRIVER_INFO, 3, -1, (ULONG_PTR)&CertInfo, sizeof(CertInfo))) || !CERT_IS_LEVEL(CertInfo, eCertAdvanced)) {
|
||||
|
||||
const WCHAR* strings[] = { L"NetworkDnsFilter" , NULL };
|
||||
SbieApi_LogMsgExt(-1, 6009, strings);
|
||||
|
|
|
@ -1327,7 +1327,7 @@ _FX BOOLEAN WSA_InitNetProxy()
|
|||
}
|
||||
|
||||
SCertInfo CertInfo = { 0 };
|
||||
if (!NT_SUCCESS(SbieApi_Call(API_QUERY_DRIVER_INFO, 3, -1, (ULONG_PTR)&CertInfo, sizeof(CertInfo))) || !CERT_IS_ADVANCED(CertInfo)) {
|
||||
if (!NT_SUCCESS(SbieApi_Call(API_QUERY_DRIVER_INFO, 3, -1, (ULONG_PTR)&CertInfo, sizeof(CertInfo))) || !CERT_IS_LEVEL(CertInfo, eCertAdvanced)) {
|
||||
|
||||
const WCHAR* strings[] = { L"NetworkUseProxy" , NULL };
|
||||
SbieApi_LogMsgExt(-1, 6009, strings);
|
||||
|
|
|
@ -842,8 +842,13 @@ _FX NTSTATUS KphValidateCertificate()
|
|||
}
|
||||
else if (!level || _wcsicmp(level, L"STANDARD") == 0) // not used, default does not have explicit level
|
||||
Verify_CertInfo.level = eCertStandard;
|
||||
else if (_wcsicmp(level, L"ADVANCED") == 0)
|
||||
Verify_CertInfo.level = eCertAdvanced;
|
||||
else if (_wcsicmp(level, L"ADVANCED") == 0)
|
||||
{
|
||||
if(Verify_CertInfo.type == eCertPatreon || Verify_CertInfo.type == eCertEntryPatreon)
|
||||
Verify_CertInfo.level = eCertAdvanced1;
|
||||
else
|
||||
Verify_CertInfo.level = eCertAdvanced;
|
||||
}
|
||||
// scheme 1.1 >>>
|
||||
else if (CERT_IS_TYPE(Verify_CertInfo, eCertPersonal) || CERT_IS_TYPE(Verify_CertInfo, eCertPatreon))
|
||||
{
|
||||
|
@ -852,8 +857,10 @@ _FX NTSTATUS KphValidateCertificate()
|
|||
Verify_CertInfo.level = eCertMaxLevel;
|
||||
}
|
||||
else if (_wcsicmp(level, L"LARGE") == 0 && cert_date.QuadPart < KphGetDate(1, 04, 2022)) {
|
||||
Verify_CertInfo.level = eCertStandard2;
|
||||
Verify_CertInfo.level = eCertAdvanced1;
|
||||
expiration_date.QuadPart = -2;
|
||||
}
|
||||
// todo: 01.09.2025: remove code for expired case LARGE
|
||||
else if (_wcsicmp(level, L"LARGE") == 0) { // 2 years - personal
|
||||
if(CERT_IS_TYPE(Verify_CertInfo, eCertPatreon))
|
||||
Verify_CertInfo.level = eCertStandard2;
|
||||
|
@ -861,15 +868,11 @@ _FX NTSTATUS KphValidateCertificate()
|
|||
Verify_CertInfo.level = eCertAdvanced;
|
||||
expiration_date.QuadPart = cert_date.QuadPart + KphGetDateInterval(0, 0, 2); // 2 years
|
||||
}
|
||||
// todo: 01.09.2024: remove code for expired case MEDIUM
|
||||
else if (_wcsicmp(level, L"MEDIUM") == 0) { // 1 year - personal
|
||||
Verify_CertInfo.level = eCertStandard2;
|
||||
}
|
||||
else if (_wcsicmp(level, L"ENTRY") == 0) { // PATREON-ENTRY new patreons get only 3 montgs for start
|
||||
Verify_CertInfo.level = eCertStandard2;
|
||||
if(CERT_IS_TYPE(Verify_CertInfo, eCertPatreon))
|
||||
Verify_CertInfo.type = eCertEntryPatreon;
|
||||
expiration_date.QuadPart = cert_date.QuadPart + KphGetDateInterval(0, 3, 0);
|
||||
}
|
||||
// todo: 01.09.2024: remove code for expired case SMALL
|
||||
else if (_wcsicmp(level, L"SMALL") == 0) { // 1 year - subscription
|
||||
Verify_CertInfo.level = eCertStandard2;
|
||||
Verify_CertInfo.type = eCertHome;
|
||||
|
@ -889,7 +892,9 @@ _FX NTSTATUS KphValidateCertificate()
|
|||
// check if this is a subscription type certificate
|
||||
BOOLEAN isSubscription = CERT_IS_SUBSCRIPTION(Verify_CertInfo);
|
||||
|
||||
if (expiration_date.QuadPart != -1)
|
||||
if (expiration_date.QuadPart == -2)
|
||||
Verify_CertInfo.expired = 1; // but not outdated
|
||||
else if (expiration_date.QuadPart != -1)
|
||||
{
|
||||
// check if this certificate is expired
|
||||
if (expiration_date.QuadPart < LocalTime.QuadPart)
|
||||
|
|
|
@ -79,6 +79,7 @@ enum ECertLevel {
|
|||
eCertNoLevel = 0b000,
|
||||
eCertStandard = 0b010,
|
||||
eCertStandard2 = 0b011,
|
||||
eCertAdvanced1 = 0b100,
|
||||
eCertAdvanced = 0b101,
|
||||
eCertMaxLevel = 0b111,
|
||||
};
|
||||
|
@ -86,7 +87,6 @@ enum ECertLevel {
|
|||
#define CERT_IS_TYPE(cert,t) ((cert.type & 0b11100) == (unsigned long)(t))
|
||||
#define CERT_IS_SUBSCRIPTION(cert) (CERT_IS_TYPE(cert, eCertBusiness) || CERT_IS_TYPE(cert, eCertHome) || cert.type == eCertEntryPatreon || CERT_IS_TYPE(cert, eCertEvaluation))
|
||||
#define CERT_IS_INSIDER(cert) (CERT_IS_TYPE(cert, eCertEternal) || cert.type == eCertGreatPatreon)
|
||||
#define CERT_IS_ADVANCED(cert) (CERT_IS_TYPE(cert, eCertEternal) || (CERT_IS_LEVEL(cert, eCertAdvanced) && cert.type != eCertPatreon))
|
||||
#define CERT_IS_LEVEL(cert,l) (cert.active && cert.level >= (unsigned long)(l))
|
||||
|
||||
#ifdef KERNEL_MODE
|
||||
|
|
|
@ -997,7 +997,7 @@ bool MountManager::AcquireBoxRoot(const WCHAR* boxname, const WCHAR* reg_root, c
|
|||
std::wstring TargetNtPath;
|
||||
|
||||
SCertInfo CertInfo = { 0 };
|
||||
if ((UseFileImage || UseRamDisk) && (!NT_SUCCESS(SbieApi_Call(API_QUERY_DRIVER_INFO, 3, -1, (ULONG_PTR)&CertInfo, sizeof(CertInfo))) || !CERT_IS_LEVEL(CertInfo, (UseFileImage ? eCertAdvanced : eCertStandard)))) {
|
||||
if ((UseFileImage || UseRamDisk) && (!NT_SUCCESS(SbieApi_Call(API_QUERY_DRIVER_INFO, 3, -1, (ULONG_PTR)&CertInfo, sizeof(CertInfo))) || !CERT_IS_LEVEL(CertInfo, (UseFileImage ? eCertAdvanced1 : eCertStandard)))) {
|
||||
const WCHAR* strings[] = { boxname, UseFileImage ? L"UseFileImage" : L"UseRamDisk" , NULL };
|
||||
SbieApi_LogMsgExt(session_id, UseFileImage ? 6009 : 6008, strings);
|
||||
errlvl = 0x66;
|
||||
|
|
|
@ -2970,14 +2970,8 @@ bool CSandMan::CheckCertificate(QWidget* pWidget, int iType)
|
|||
QString Message;
|
||||
if (iType == 1 || iType == 2)
|
||||
{
|
||||
if (iType == 1) {
|
||||
if (CERT_IS_LEVEL(g_CertInfo, eCertAdvanced))
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
if (CERT_IS_ADVANCED(g_CertInfo))
|
||||
return true;
|
||||
}
|
||||
if (CERT_IS_LEVEL(g_CertInfo, iType == 1 ? eCertAdvanced1 : eCertAdvanced))
|
||||
return true;
|
||||
|
||||
Message = tr("The selected feature requires an <b>advanced</b> supporter certificate.");
|
||||
if (iType == 2 && CERT_IS_TYPE(g_CertInfo, eCertPatreon))
|
||||
|
|
|
@ -96,9 +96,8 @@ void COptionsWindow::CreateGeneral()
|
|||
}
|
||||
if (!CERT_IS_LEVEL(g_CertInfo, eCertStandard2))
|
||||
COptionsWindow__AddCertIcon(ui.chkConfidential, true);
|
||||
if (!CERT_IS_LEVEL(g_CertInfo, eCertAdvanced)) {
|
||||
if (!CERT_IS_LEVEL(g_CertInfo, eCertAdvanced1))
|
||||
COptionsWindow__AddCertIcon(ui.chkEncrypt, true);
|
||||
}
|
||||
|
||||
|
||||
m_HoldBoxType = false;
|
||||
|
|
|
@ -62,7 +62,7 @@ void COptionsWindow::CreateNetwork()
|
|||
|
||||
connect(ui.tabsInternet, SIGNAL(currentChanged(int)), this, SLOT(OnInternetTab()));
|
||||
|
||||
if (!CERT_IS_ADVANCED(g_CertInfo)) {
|
||||
if (!CERT_IS_LEVEL(g_CertInfo, eCertAdvanced)) {
|
||||
ui.tabDNS->setEnabled(false);
|
||||
ui.tabNetProxy->setEnabled(false);
|
||||
}
|
||||
|
|
|
@ -1436,6 +1436,8 @@ QString CSettingsWindow::GetCertLevel()
|
|||
QString CertLevel;
|
||||
if (g_CertInfo.level == eCertAdvanced)
|
||||
CertLevel = tr("Advanced");
|
||||
else if (g_CertInfo.level == eCertAdvanced1)
|
||||
CertLevel = tr("Advanced (L)");
|
||||
else if (g_CertInfo.level == eCertMaxLevel)
|
||||
CertLevel = tr("Max Level");
|
||||
else if (g_CertInfo.level != eCertStandard && g_CertInfo.level != eCertStandard2)
|
||||
|
|
Loading…
Reference in New Issue