mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-14 13:02:58 +02:00
OpenVPN: Fix query when selecting sessions only
Previously some sessions were selected which did not qualify for the search. Signed-off-by: Michael Tremer <michael.tremer@ipfire.org> Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
This commit is contained in:
committed by
Arne Fitzenreiter
parent
3e10b3de4a
commit
70e1d58745
@@ -107,27 +107,31 @@ my $database_query = qq(
|
||||
ELSE DATETIME('$from_datestring', 'localtime', 'start of day')
|
||||
END
|
||||
), 'utc')
|
||||
)
|
||||
) AS duration
|
||||
FROM sessions
|
||||
WHERE
|
||||
disconnected_at IS NULL
|
||||
OR
|
||||
DATETIME(disconnected_at, 'localtime') > DATETIME('$from_datestring', 'localtime', 'start of day')
|
||||
OR
|
||||
(
|
||||
disconnected_at IS NULL
|
||||
OR
|
||||
DATETIME(disconnected_at, 'localtime') > DATETIME('$from_datestring', 'localtime', 'start of day')
|
||||
)
|
||||
AND
|
||||
DATETIME(connected_at, 'localtime') < DATETIME('$to_datestring', 'localtime', 'start of day', '+86399 seconds')
|
||||
GROUP BY common_name
|
||||
ORDER BY common_name;
|
||||
ORDER BY common_name, duration DESC;
|
||||
);
|
||||
|
||||
if ($cgiparams{'CONNECTION_NAME'}) {
|
||||
$database_query = qq(
|
||||
SELECT *
|
||||
FROM sessions
|
||||
SELECT * FROM sessions
|
||||
WHERE
|
||||
common_name = '$cgiparams{"CONNECTION_NAME"}' AND (
|
||||
DATETIME(disconnected_at, 'localtime') > DATETIME('$from_datestring', 'localtime', 'start of day')
|
||||
OR
|
||||
DATETIME(connected_at, 'localtime') < DATETIME('$to_datestring', 'localtime', 'start of day', '+86399 seconds'));
|
||||
common_name = '$cgiparams{"CONNECTION_NAME"}'
|
||||
AND (
|
||||
DATETIME(disconnected_at, 'localtime') > DATETIME('$from_datestring', 'localtime', 'start of day')
|
||||
AND
|
||||
DATETIME(connected_at, 'localtime') < DATETIME('$to_datestring', 'localtime', 'start of day', '+86399 seconds')
|
||||
)
|
||||
ORDER BY connected_at;
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user