Parse group_id XML attributes.

This commit is contained in:
Ramon Novoa 2016-12-13 14:38:09 +01:00
parent 8ec5f53100
commit c11b1c1150
2 changed files with 8 additions and 2 deletions

View File

@ -386,7 +386,6 @@ Pandora_Windows_Service::getXmlHeader () {
string agent_name, os_name, os_version, encoding, value, xml, address, parent_agent_name, agent_name_cmd; string agent_name, os_name, os_version, encoding, value, xml, address, parent_agent_name, agent_name_cmd;
string custom_id, url_address, latitude, longitude, altitude, position_description, gis_exec, gis_result, agent_mode; string custom_id, url_address, latitude, longitude, altitude, position_description, gis_exec, gis_result, agent_mode;
string group_password, group_id, ehorus_conf; string group_password, group_id, ehorus_conf;
string group_password, group_id;
time_t ctime; time_t ctime;
struct tm *ctime_tm = NULL; struct tm *ctime_tm = NULL;
int pos; int pos;

View File

@ -344,7 +344,14 @@ sub process_xml_data ($$$$$) {
my $os = pandora_get_os ($dbh, $data->{'os_name'}); my $os = pandora_get_os ($dbh, $data->{'os_name'});
my $group_id = $pa_config->{'autocreate_group'}; my $group_id = $pa_config->{'autocreate_group'};
if (! defined (get_group_name ($dbh, $group_id))) { if (! defined (get_group_name ($dbh, $group_id))) {
if (defined ($data->{'group'}) && $data->{'group'} ne '') { if (defined ($data->{'group_id'}) && $data->{'group_id'} ne '') {
$group_id = $data->{'group_id'};
if (! defined (get_group_name ($dbh, $group_id))) {
pandora_event ($pa_config, "Unable to create agent '$agent_name': group ID '" . $group_id . "' does not exist.", 0, 0, 0, 0, 0, 'error', 0, $dbh);
logger($pa_config, "Group ID " . $group_id . " does not exist.", 3);
return;
}
} elsif (defined ($data->{'group'}) && $data->{'group'} ne '') {
$group_id = get_group_id ($dbh, $data->{'group'}); $group_id = get_group_id ($dbh, $data->{'group'});
if (! defined (get_group_name ($dbh, $group_id))) { if (! defined (get_group_name ($dbh, $group_id))) {
pandora_event ($pa_config, "Unable to create agent '$agent_name': group '" . $data->{'group'} . "' does not exist.", 0, 0, 0, 0, 0, 'error', 0, $dbh); pandora_event ($pa_config, "Unable to create agent '$agent_name': group '" . $data->{'group'} . "' does not exist.", 0, 0, 0, 0, 0, 'error', 0, $dbh);