Driver: Handle "Restrict access to LAN only" flag

This commit is contained in:
Nodir Temirkhodjaev 2023-01-17 16:21:33 +03:00
parent 58e4385016
commit a8559cd66f
3 changed files with 17 additions and 4 deletions

View File

@ -329,9 +329,16 @@ FORT_API BOOL fort_conf_app_blocked(
{ {
const BOOL app_found = (app_flags.v != 0); const BOOL app_found = (app_flags.v != 0);
if (app_found && !app_flags.use_group_perm) { if (app_found) {
*block_reason = FORT_BLOCK_REASON_PROGRAM; if (app_flags.lan_only) {
return app_flags.blocked; *block_reason = FORT_BLOCK_REASON_LAN_ONLY;
return TRUE;
}
if (!app_flags.use_group_perm) {
*block_reason = FORT_BLOCK_REASON_PROGRAM;
return app_flags.blocked;
}
} }
const UINT32 app_perm_val = app_flags.blocked ? 2 : 1; const UINT32 app_perm_val = app_flags.blocked ? 2 : 1;

View File

@ -15,6 +15,7 @@ enum FortBlockReason {
FORT_BLOCK_REASON_NONE = -1, FORT_BLOCK_REASON_NONE = -1,
FORT_BLOCK_REASON_UNKNOWN = 0, FORT_BLOCK_REASON_UNKNOWN = 0,
FORT_BLOCK_REASON_IP_INET, FORT_BLOCK_REASON_IP_INET,
FORT_BLOCK_REASON_LAN_ONLY,
FORT_BLOCK_REASON_REAUTH, FORT_BLOCK_REASON_REAUTH,
FORT_BLOCK_REASON_PROGRAM, FORT_BLOCK_REASON_PROGRAM,
FORT_BLOCK_REASON_APP_GROUP_FOUND, FORT_BLOCK_REASON_APP_GROUP_FOUND,

View File

@ -178,6 +178,8 @@ QString ConnListModel::blockReasonText(const ConnRow &connRow)
switch (connRow.blockReason) { switch (connRow.blockReason) {
case FORT_BLOCK_REASON_IP_INET: case FORT_BLOCK_REASON_IP_INET:
return tr("Blocked Internet address"); return tr("Blocked Internet address");
case FORT_BLOCK_REASON_LAN_ONLY:
return tr("Restrict access to LAN only");
case FORT_BLOCK_REASON_REAUTH: case FORT_BLOCK_REASON_REAUTH:
return tr("Old connection closed on startup"); return tr("Old connection closed on startup");
case FORT_BLOCK_REASON_PROGRAM: case FORT_BLOCK_REASON_PROGRAM:
@ -195,8 +197,12 @@ QString ConnListModel::connIconPath(const ConnRow &connRow)
{ {
if (connRow.blocked) { if (connRow.blocked) {
switch (connRow.blockReason) { switch (connRow.blockReason) {
case FORT_BLOCK_REASON_NONE:
return ":/icons/error.png";
case FORT_BLOCK_REASON_IP_INET: case FORT_BLOCK_REASON_IP_INET:
return ":/icons/ip.png"; return ":/icons/ip.png";
case FORT_BLOCK_REASON_LAN_ONLY:
return ":/icons/hostname.png";
case FORT_BLOCK_REASON_REAUTH: case FORT_BLOCK_REASON_REAUTH:
return ":/icons/arrow_refresh_small.png"; return ":/icons/arrow_refresh_small.png";
case FORT_BLOCK_REASON_PROGRAM: case FORT_BLOCK_REASON_PROGRAM:
@ -204,7 +210,6 @@ QString ConnListModel::connIconPath(const ConnRow &connRow)
case FORT_BLOCK_REASON_APP_GROUP_FOUND: case FORT_BLOCK_REASON_APP_GROUP_FOUND:
return ":/icons/application_double.png"; return ":/icons/application_double.png";
case FORT_BLOCK_REASON_FILTER_MODE: case FORT_BLOCK_REASON_FILTER_MODE:
default:
return ":/icons/deny.png"; return ":/icons/deny.png";
} }
} }