Skip to content
Snippets Groups Projects
Commit e3d31ff7 authored by Tomáš Plesník's avatar Tomáš Plesník
Browse files

do procesu autorizace pridana kontrola validity klienta

parent b745722a
No related branches found
No related tags found
No related merge requests found
...@@ -104,15 +104,15 @@ sub authorizeClient ...@@ -104,15 +104,15 @@ sub authorizeClient
my ($alt_names, $ip, $service_type, $client_type, $function_name) = @_; my ($alt_names, $ip, $service_type, $client_type, $function_name) = @_;
my ($sth, $rc); my ($sth, $rc);
# obtain cidr based on rigth common name and alternate names, service and client_type # check if client is valid and obtain client_id, ip_net_client and receive_own_events
if($function_name eq 'saveNewEvent') { if($function_name eq 'saveNewEvent') {
$sth = $DBH->prepare("SELECT client_id, ip_net_client, receive_own_events FROM clients WHERE hostname IN ($alt_names) AND service = ? AND client_type = ? ORDER BY SUBSTRING_INDEX(ip_net_client,'/', -1) DESC;"); $sth = $DBH->prepare("SELECT client_id, ip_net_client, receive_own_events FROM clients WHERE hostname IN ($alt_names) AND service = ? AND client_type = ? ORDER BY SUBSTRING_INDEX(ip_net_client,'/', -1) DESC AND valid = 't';");
} elsif($function_name eq 'getNewEvents') { } elsif($function_name eq 'getNewEvents') {
$sth = $DBH->prepare("SELECT client_id, ip_net_client, receive_own_events FROM clients WHERE hostname IN ($alt_names) AND (type = ? OR type = '_any_') AND client_type = ? ORDER BY SUBSTRING_INDEX(ip_net_client,'/', -1) DESC;"); $sth = $DBH->prepare("SELECT client_id, ip_net_client, receive_own_events FROM clients WHERE hostname IN ($alt_names) AND (type = ? OR type = '_any_') AND client_type = ? ORDER BY SUBSTRING_INDEX(ip_net_client,'/', -1) DESC AND valid = 't';");
} elsif($function_name eq 'getClientInfo') { } elsif($function_name eq 'getClientInfo') {
$sth = $DBH->prepare("SELECT client_id, ip_net_client, receive_own_events FROM clients WHERE hostname IN ($alt_names) ORDER BY SUBSTRING_INDEX(ip_net_client,'/', -1) DESC;"); $sth = $DBH->prepare("SELECT client_id, ip_net_client, receive_own_events FROM clients WHERE hostname IN ($alt_names) ORDER BY SUBSTRING_INDEX(ip_net_client,'/', -1) DESC AND valid = 't';");
} elsif($function_name eq 'getLastId') { } elsif($function_name eq 'getLastId') {
$sth = $DBH->prepare("SELECT client_id, ip_net_client, receive_own_events FROM clients WHERE hostname IN ($alt_names) AND client_type = 'r' ORDER BY SUBSTRING_INDEX(ip_net_client,'/', -1) DESC;"); $sth = $DBH->prepare("SELECT client_id, ip_net_client, receive_own_events FROM clients WHERE hostname IN ($alt_names) AND client_type = 'r' ORDER BY SUBSTRING_INDEX(ip_net_client,'/', -1) DESC AND valid = 't';");
} }
# check if db handler is defined # check if db handler is defined
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment