Skip to content

Commit

Permalink
1.14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidXanatos committed May 12, 2024
1 parent 4cca2a4 commit 77cd2c9
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 4 deletions.
11 changes: 11 additions & 0 deletions Sandboxie/core/dll/dns_filter.c
Expand Up @@ -31,6 +31,8 @@
#include "wsa_defs.h"
#include "common/pattern.h"
#include "common/str_util.h"
#include "core/drv/api_defs.h"
#include "core/drv/verify.h"


//---------------------------------------------------------------------------
Expand Down Expand Up @@ -192,6 +194,15 @@ _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)) {

const WCHAR* strings[] = { L"NetworkDnsFilter" , NULL };
SbieApi_LogMsgExt(-1, 6009, strings);

WSA_FilterEnabled = FALSE;
}

//
// Setup DNS hooks
//
Expand Down
11 changes: 11 additions & 0 deletions Sandboxie/core/dll/net.c
Expand Up @@ -33,6 +33,8 @@
#include "wsa_defs.h"
#include "core/svc/sbieiniwire.h"
#include "common/base64.c"
#include "core/drv/api_defs.h"
#include "core/drv/verify.h"


//---------------------------------------------------------------------------
Expand Down Expand Up @@ -1324,6 +1326,15 @@ _FX BOOLEAN WSA_InitNetProxy()
return FALSE;
}

SCertInfo CertInfo = { 0 };
if (!NT_SUCCESS(SbieApi_Call(API_QUERY_DRIVER_INFO, 3, -1, (ULONG_PTR)&CertInfo, sizeof(CertInfo))) || !CERT_IS_ADVANCED(CertInfo)) {

const WCHAR* strings[] = { L"NetworkUseProxy" , NULL };
SbieApi_LogMsgExt(-1, 6009, strings);

return FALSE;
}

return TRUE;
}

Expand Down
1 change: 1 addition & 0 deletions Sandboxie/core/drv/verify.h
Expand Up @@ -86,6 +86,7 @@ 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
Expand Down
16 changes: 12 additions & 4 deletions SandboxiePlus/SandMan/SandMan.cpp
Expand Up @@ -2968,13 +2968,21 @@ void CSandMan::SaveMessageLog(QIODevice* pFile)
bool CSandMan::CheckCertificate(QWidget* pWidget, int iType)
{
QString Message;
if (iType == 1)
if (iType == 1 || iType == 2)
{
if (CERT_IS_LEVEL(g_CertInfo, eCertAdvanced))
return true;
if (iType == 1) {
if (CERT_IS_LEVEL(g_CertInfo, eCertAdvanced))
return true;
}
else {
if (CERT_IS_ADVANCED(g_CertInfo))
return true;
}

Message = tr("The selected feature requires an <b>advanced</b> supporter certificate.");
if(g_CertInfo.active)
if (iType == 2 && CERT_IS_TYPE(g_CertInfo, eCertPatreon))
Message.append(tr("<br />you need to be on the Great Patreon level or higher to unlock this feature."));
else if (g_CertInfo.active)
Message.append(tr("<br /><a href=\"https://sandboxie-plus.com/go.php?to=sbie-upgrade-cert\">Upgrade your Certificate</a> to unlock advanced features."));
else
Message.append(tr("<br /><a href=\"https://sandboxie-plus.com/go.php?to=sbie-get-cert\">Become a project supporter</a>, and receive a <a href=\"https://sandboxie-plus.com/go.php?to=sbie-cert\">supporter certificate</a>"));
Expand Down
7 changes: 7 additions & 0 deletions SandboxiePlus/SandMan/Windows/OptionsNetwork.cpp
Expand Up @@ -60,6 +60,13 @@ void COptionsWindow::CreateNetwork()
connect(ui.chkBlockDns, SIGNAL(clicked(bool)), this, SLOT(OnBlockDns()));
connect(ui.chkBlockSamba, SIGNAL(clicked(bool)), this, SLOT(OnBlockSamba()));

connect(ui.tabsInternet, SIGNAL(currentChanged(int)), this, SLOT(OnInternetTab()));

if (!CERT_IS_ADVANCED(g_CertInfo)) {
ui.tabDNS->setEnabled(false);
ui.tabNetProxy->setEnabled(false);
}

ui.chkProxyResolveHostnames->setVisible(false);
}

Expand Down
5 changes: 5 additions & 0 deletions SandboxiePlus/SandMan/Windows/OptionsWindow.cpp
Expand Up @@ -1206,6 +1206,11 @@ void COptionsWindow::UpdateCurrentTab()
{
LoadBlockINet();
}
else if (m_pCurrentTab == ui.tabDNS || m_pCurrentTab == ui.tabNetProxy)
{
if (!m_pCurrentTab->isEnabled())
theGUI->CheckCertificate(this, 2);
}
else if (m_pCurrentTab == ui.tabCOM) {
CheckOpenCOM();
}
Expand Down
1 change: 1 addition & 0 deletions SandboxiePlus/SandMan/Windows/OptionsWindow.h
Expand Up @@ -238,6 +238,7 @@ private slots:

void OnTab() { OnTab(ui.tabs->currentWidget()); }
void OnAccessTab() { OnTab(ui.tabsAccess->currentWidget()); }
void OnInternetTab() { OnTab(ui.tabsInternet->currentWidget()); }

void OnGeneralChanged();
void OnPSTChanged();
Expand Down

0 comments on commit 77cd2c9

Please sign in to comment.