mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 01:05:39 +02:00
Added a function to generate random identifiers for the agent name
This commit is contained in:
parent
472d484583
commit
cc16225e31
@ -90,7 +90,7 @@ function agents_create_agent ($name, $id_group, $interval, $ip_address, $values
|
||||
|
||||
$id_agent = db_process_sql_insert ('tagente', $values);
|
||||
if ($id_agent === false) {
|
||||
return false;
|
||||
return false;,
|
||||
}
|
||||
|
||||
// Create address for this agent in taddress
|
||||
@ -2622,4 +2622,16 @@ function select_modules_for_agent_group($id_group, $id_agents,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a random name identifier for an agent.
|
||||
*
|
||||
* @param string Descriptive name of the agent.
|
||||
* @param string Address of the agent.
|
||||
*
|
||||
* @return string Random identifier name.
|
||||
*/
|
||||
function agents_generate_name ($alias, $address = '') {
|
||||
return hash('sha256', $alias . '|' . $address . '|' . time() . '|' . sprintf('%04d', rand(0, 10000)));
|
||||
}
|
||||
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user