From 9a278d2481c767167b94a50ffa48f8e8d99dbed2 Mon Sep 17 00:00:00 2001 From: Tomas Plesnik <plesnik@ics.muni.cz> Date: Wed, 13 Mar 2013 11:01:58 +0100 Subject: [PATCH] pri registraci vraceno ID registrovaneho klienta a zapsano do syslogu --- src/warden-server/bin/registerReceiver.pl | 5 +++-- src/warden-server/bin/registerSender.pl | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/warden-server/bin/registerReceiver.pl b/src/warden-server/bin/registerReceiver.pl index 0aac8ee..b327a82 100755 --- a/src/warden-server/bin/registerReceiver.pl +++ b/src/warden-server/bin/registerReceiver.pl @@ -128,8 +128,9 @@ if (defined $result) { $sth = $dbh->prepare("INSERT INTO clients VALUES (?,?,?,?,?,?,?,?,?,?,?);") or die "Cannot prepare statement: " . $dbh->errstr; my $ret_val = $sth->execute(undef, $hostname, $registered, $requestor, $service, $client_type, $type, $receive_own_events, $description_tags, $ip_net_client, $valid) or die "Cannot execute statement: " . $sth->errstr; if ($ret_val == 1) { - sendMsg("info", "New receiver [Hostname: '$hostname', Requestor: '$requestor', Type: '$type', ROE: '$receive_own_events', CIDR: '$ip_net_client'] has been registered"); - WardenCommon::succMsg("Registration of receiver $hostname ($type) was SUCCESSFUL!!!"); + my $last_insert_id = $dbh->last_insert_id(undef, undef, "clients", undef); + sendMsg("info", "New receiver [ID: '$last_insert_id', Hostname: '$hostname', Requestor: '$requestor', Type: '$type', ROE: '$receive_own_events', CIDR: '$ip_net_client'] has been registered"); + WardenCommon::succMsg("Registration of receiver (#$last_insert_id) was SUCCESSFUL!!!"); } else { WardenCommon::errMsg("Registration of receiver $hostname ($type) FAILED!!!"); } diff --git a/src/warden-server/bin/registerSender.pl b/src/warden-server/bin/registerSender.pl index 83dc56f..5d5b03d 100755 --- a/src/warden-server/bin/registerSender.pl +++ b/src/warden-server/bin/registerSender.pl @@ -127,8 +127,9 @@ if (defined $result) { $sth = $dbh->prepare("INSERT INTO clients VALUES (?,?,?,?,?,?,?,?,?,?,?);") or die "Cannot prepare statement: " . $dbh->errstr; my $ret_val = $sth->execute(undef, $hostname, $registered, $requestor, $service, $client_type, $type, $receive_own_events, $description_tags, $ip_net_client, $valid) or die "Cannot execute statement: " . $sth->errstr; if ($ret_val == 1) { - sendMsg("info", "New sender [Hostname: '$hostname', Requestor: '$requestor', Service: '$service', Description_tags: '$description_tags', CIDR: '$ip_net_client'] has been registered"); - WardenCommon::succMsg("Registration of sender $hostname ($service) was SUCCESSFUL!!!"); + my $last_insert_id = $dbh->last_insert_id(undef, undef, "clients", undef); + sendMsg("info", "New sender [ID: '$last_insert_id', Hostname: '$hostname', Requestor: '$requestor', Service: '$service', Description_tags: '$description_tags', CIDR: '$ip_net_client'] has been registered"); + WardenCommon::succMsg("Registration of sender (#$last_insert_id) was SUCCESSFUL!!!"); } else { WardenCommon::errMsg("Registration of sender $hostname ($service) FAILED!!!"); } -- GitLab