mirror of
https://github.com/Cacti/spine.git
synced 2026-12-05 14:51:21 +09:00
QA: Improving memory management and snmpv3 support
This commit is contained in:
1 parent
5b25fe34ee
commit
dd5186a17c
7 files changed
+65
-62
No files matched your search
@@ -418,9 +418,9 @@ int ping_icmp(host_t *host, ping_t *ping) {
|
||||
|
||||
if (total_time < host_timeout) {
|
||||
#if !(defined(__CYGWIN__))
|
||||
return_code = recvfrom(icmp_socket, socket_reply, BUFSIZE, MSG_WAITALL, (struct sockaddr *) &recvname, &fromlen);
|
||||
return_code = recvfrom(icmp_socket, socket_reply, LRG_BUFSIZE, MSG_WAITALL, (struct sockaddr *) &recvname, &fromlen);
|
||||
#else
|
||||
return_code = recvfrom(icmp_socket, socket_reply, BUFSIZE, MSG_PEEK, (struct sockaddr *) &recvname, &fromlen);
|
||||
return_code = recvfrom(icmp_socket, socket_reply, LRG_BUFSIZE, MSG_PEEK, (struct sockaddr *) &recvname, &fromlen);
|
||||
#endif
|
||||
|
||||
if (return_code < 0) {
|
||||
@@ -1131,20 +1131,20 @@ void update_host_status(int status, host_t *host, ping_t *ping, int availability
|
||||
case AVAIL_SNMP_OR_PING:
|
||||
case AVAIL_SNMP_AND_PING:
|
||||
if (strlen(host->snmp_community) == 0 && host->snmp_version < 3) {
|
||||
snprintf(host->status_last_error, BUFSIZE, "%s", ping->ping_response);
|
||||
snprintf(host->status_last_error, LRG_BUFSIZE, "%s", ping->ping_response);
|
||||
} else {
|
||||
snprintf(host->status_last_error, BUFSIZE, "%s, %s", ping->snmp_response, ping->ping_response);
|
||||
snprintf(host->status_last_error, LRG_BUFSIZE, "%s, %s", ping->snmp_response, ping->ping_response);
|
||||
}
|
||||
break;
|
||||
case AVAIL_SNMP:
|
||||
if (strlen(host->snmp_community) == 0 && host->snmp_version < 3) {
|
||||
snprintf(host->status_last_error, BUFSIZE, "%s", "Device does not require SNMP");
|
||||
snprintf(host->status_last_error, LRG_BUFSIZE, "%s", "Device does not require SNMP");
|
||||
} else {
|
||||
snprintf(host->status_last_error, BUFSIZE, "%s", ping->snmp_response);
|
||||
snprintf(host->status_last_error, LRG_BUFSIZE, "%s", ping->snmp_response);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
snprintf(host->status_last_error, BUFSIZE, "%s", ping->ping_response);
|
||||
snprintf(host->status_last_error, LRG_BUFSIZE, "%s", ping->ping_response);
|
||||
}
|
||||
|
||||
/* determine if to send an alert and update remainder of statistics */
|
||||
|
||||
@@ -564,7 +564,7 @@ void poll_host(int device_counter, int host_id, int host_thread, int host_thread
|
||||
num_rows = mysql_num_rows(result);
|
||||
|
||||
if (num_rows != 1) {
|
||||
mysql_free_result(result);
|
||||
db_free_result(result);
|
||||
|
||||
if (local_cnn != NULL) {
|
||||
db_release_connection(LOCAL, local_cnn->id);
|
||||
@@ -698,7 +698,7 @@ void poll_host(int device_counter, int host_id, int host_thread, int host_thread
|
||||
}
|
||||
|
||||
/* free the host result */
|
||||
mysql_free_result(result);
|
||||
db_free_result(result);
|
||||
|
||||
if (((host->snmp_version >= 1) && (host->snmp_version <= 2) &&
|
||||
(strlen(host->snmp_community) > 0)) ||
|
||||
@@ -1207,7 +1207,7 @@ void poll_host(int device_counter, int host_id, int host_thread, int host_thread
|
||||
}
|
||||
|
||||
/* free the host result */
|
||||
mysql_free_result(result);
|
||||
db_free_result(result);
|
||||
} else {
|
||||
SPINE_LOG(("Device[%i] HT[%i] ERROR: RECACHE Query Returned Null Result!", host->id, host_thread));
|
||||
}
|
||||
@@ -1309,7 +1309,7 @@ void poll_host(int device_counter, int host_id, int host_thread, int host_thread
|
||||
}
|
||||
|
||||
/* free the mysql result */
|
||||
mysql_free_result(result);
|
||||
db_free_result(result);
|
||||
|
||||
/* create an array for snmp oids */
|
||||
snmp_oids = (snmp_oids_t *) calloc(host->max_oids, sizeof(snmp_oids_t));
|
||||
@@ -1437,9 +1437,9 @@ void poll_host(int device_counter, int host_id, int host_thread, int host_thread
|
||||
thread_end = get_time_as_double();
|
||||
|
||||
if (is_debug_device(host_id)) {
|
||||
SPINE_LOG(("Device[%i] HT[%i] DS[%i] TT[%.2f] SNMP: v%i: %s, dsname: %s, oid: %s, value: %s", host_id, host_thread, poller_items[snmp_oids[j].array_position].local_data_id, (thread_end - thread_start) * 1000, host->snmp_version, host->hostname, poller_items[snmp_oids[j].array_position].rrd_name, poller_items[snmp_oids[j].array_position].arg1, poller_items[snmp_oids[j].array_position].result));
|
||||
SPINE_LOG(("Device[%i] HT[%i] DS[%i] TT[%.2f] SNMP: v%i: %s, dsname: %s, oid: %s, value: %s", host_id, host_thread, poller_items[snmp_oids[j].array_position].local_data_id, (float) ((thread_end - thread_start) * 1000), host->snmp_version, host->hostname, poller_items[snmp_oids[j].array_position].rrd_name, poller_items[snmp_oids[j].array_position].arg1, poller_items[snmp_oids[j].array_position].result));
|
||||
} else {
|
||||
SPINE_LOG_MEDIUM(("Device[%i] HT[%i] DS[%i] TT[%.2f] SNMP: v%i: %s, dsname: %s, oid: %s, value: %s", host_id, host_thread, poller_items[snmp_oids[j].array_position].local_data_id, (thread_end - thread_start) * 1000, host->snmp_version, host->hostname, poller_items[snmp_oids[j].array_position].rrd_name, poller_items[snmp_oids[j].array_position].arg1, poller_items[snmp_oids[j].array_position].result));
|
||||
SPINE_LOG_MEDIUM(("Device[%i] HT[%i] DS[%i] TT[%.2f] SNMP: v%i: %s, dsname: %s, oid: %s, value: %s", host_id, host_thread, poller_items[snmp_oids[j].array_position].local_data_id, (float) ((thread_end - thread_start) * 1000), host->snmp_version, host->hostname, poller_items[snmp_oids[j].array_position].rrd_name, poller_items[snmp_oids[j].array_position].arg1, poller_items[snmp_oids[j].array_position].result));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1538,9 +1538,9 @@ void poll_host(int device_counter, int host_id, int host_thread, int host_thread
|
||||
thread_end = get_time_as_double();
|
||||
|
||||
if (is_debug_device(host_id)) {
|
||||
SPINE_LOG(("Device[%i] HT[%i] DS[%i] TT[%.2f] SNMP: v%i: %s, dsname: %s, oid: %s, value: %s", host_id, host_thread, poller_items[snmp_oids[j].array_position].local_data_id, (thread_end - thread_start) * 1000, host->snmp_version, host->hostname, poller_items[snmp_oids[j].array_position].rrd_name, poller_items[snmp_oids[j].array_position].arg1, poller_items[snmp_oids[j].array_position].result));
|
||||
SPINE_LOG(("Device[%i] HT[%i] DS[%i] TT[%.2f] SNMP: v%i: %s, dsname: %s, oid: %s, value: %s", host_id, host_thread, poller_items[snmp_oids[j].array_position].local_data_id, (float) ((thread_end - thread_start) * 1000), host->snmp_version, host->hostname, poller_items[snmp_oids[j].array_position].rrd_name, poller_items[snmp_oids[j].array_position].arg1, poller_items[snmp_oids[j].array_position].result));
|
||||
} else {
|
||||
SPINE_LOG_MEDIUM(("Device[%i] HT[%i] DS[%i] TT[%.2f] SNMP: v%i: %s, dsname: %s, oid: %s, value: %s", host_id, host_thread, poller_items[snmp_oids[j].array_position].local_data_id, (thread_end - thread_start) * 1000, host->snmp_version, host->hostname, poller_items[snmp_oids[j].array_position].rrd_name, poller_items[snmp_oids[j].array_position].arg1, poller_items[snmp_oids[j].array_position].result));
|
||||
SPINE_LOG_MEDIUM(("Device[%i] HT[%i] DS[%i] TT[%.2f] SNMP: v%i: %s, dsname: %s, oid: %s, value: %s", host_id, host_thread, poller_items[snmp_oids[j].array_position].local_data_id, (float) ((thread_end - thread_start) * 1000), host->snmp_version, host->hostname, poller_items[snmp_oids[j].array_position].rrd_name, poller_items[snmp_oids[j].array_position].arg1, poller_items[snmp_oids[j].array_position].result));
|
||||
}
|
||||
|
||||
if (!IS_UNDEFINED(poller_items[snmp_oids[j].array_position].result)) {
|
||||
@@ -1606,9 +1606,9 @@ void poll_host(int device_counter, int host_id, int host_thread, int host_thread
|
||||
thread_end = get_time_as_double();
|
||||
|
||||
if (is_debug_device(host_id)) {
|
||||
SPINE_LOG(("Device[%i] HT[%i] DS[%i] TT[%.2f] SCRIPT: %s, output: %s", host_id, host_thread, poller_items[i].local_data_id, (thread_end - thread_start) * 1000, poller_items[i].arg1, poller_items[i].result));
|
||||
SPINE_LOG(("Device[%i] HT[%i] DS[%i] TT[%.2f] SCRIPT: %s, output: %s", host_id, host_thread, poller_items[i].local_data_id, (float) ((thread_end - thread_start) * 1000), poller_items[i].arg1, poller_items[i].result));
|
||||
} else {
|
||||
SPINE_LOG_MEDIUM(("Device[%i] HT[%i] DS[%i] TT[%.2f] SCRIPT: %s, output: %s", host_id, host_thread, poller_items[i].local_data_id, (thread_end - thread_start) * 1000, poller_items[i].arg1, poller_items[i].result));
|
||||
SPINE_LOG_MEDIUM(("Device[%i] HT[%i] DS[%i] TT[%.2f] SCRIPT: %s, output: %s", host_id, host_thread, poller_items[i].local_data_id, (float) ((thread_end - thread_start) * 1000), poller_items[i].arg1, poller_items[i].result));
|
||||
}
|
||||
|
||||
if (!IS_UNDEFINED(poller_items[i].result)) {
|
||||
@@ -1664,9 +1664,9 @@ void poll_host(int device_counter, int host_id, int host_thread, int host_thread
|
||||
thread_end = get_time_as_double();
|
||||
|
||||
if (is_debug_device(host_id)) {
|
||||
SPINE_LOG(("Device[%i] HT[%i] DS[%i] TT[%.2f] SS[%i] SERVER: %s, output: %s", host_id, host_thread, poller_items[i].local_data_id, (thread_end - thread_start) * 1000, php_process, poller_items[i].arg1, poller_items[i].result));
|
||||
SPINE_LOG(("Device[%i] HT[%i] DS[%i] TT[%.2f] SS[%i] SERVER: %s, output: %s", host_id, host_thread, poller_items[i].local_data_id, (float) ((thread_end - thread_start) * 1000), php_process, poller_items[i].arg1, poller_items[i].result));
|
||||
} else {
|
||||
SPINE_LOG_MEDIUM(("Device[%i] HT[%i] DS[%i] TT[%.2f] SS[%i] SERVER: %s, output: %s", host_id, host_thread, poller_items[i].local_data_id, (thread_end - thread_start) * 1000, php_process, poller_items[i].arg1, poller_items[i].result));
|
||||
SPINE_LOG_MEDIUM(("Device[%i] HT[%i] DS[%i] TT[%.2f] SS[%i] SERVER: %s, output: %s", host_id, host_thread, poller_items[i].local_data_id, (float) ((thread_end - thread_start) * 1000), php_process, poller_items[i].arg1, poller_items[i].result));
|
||||
}
|
||||
|
||||
if (IS_UNDEFINED(poller_items[i].result)) {
|
||||
@@ -1750,9 +1750,9 @@ void poll_host(int device_counter, int host_id, int host_thread, int host_thread
|
||||
thread_end = get_time_as_double();
|
||||
|
||||
if (is_debug_device(host_id)) {
|
||||
SPINE_LOG(("Device[%i] HT[%i] DS[%i] TT[%.2f] SNMP: v%i: %s, dsname: %s, oid: %s, value: %s", host_id, host_thread, poller_items[snmp_oids[j].array_position].local_data_id, (thread_end - thread_start) * 1000, host->snmp_version, host->hostname, poller_items[snmp_oids[j].array_position].rrd_name, poller_items[snmp_oids[j].array_position].arg1, poller_items[snmp_oids[j].array_position].result));
|
||||
SPINE_LOG(("Device[%i] HT[%i] DS[%i] TT[%.2f] SNMP: v%i: %s, dsname: %s, oid: %s, value: %s", host_id, host_thread, poller_items[snmp_oids[j].array_position].local_data_id, (float) ((thread_end - thread_start) * 1000), host->snmp_version, host->hostname, poller_items[snmp_oids[j].array_position].rrd_name, poller_items[snmp_oids[j].array_position].arg1, poller_items[snmp_oids[j].array_position].result));
|
||||
} else {
|
||||
SPINE_LOG_MEDIUM(("Device[%i] HT[%i] DS[%i] TT[%.2f] SNMP: v%i: %s, dsname: %s, oid: %s, value: %s", host_id, host_thread, poller_items[snmp_oids[j].array_position].local_data_id, (thread_end - thread_start) * 1000, host->snmp_version, host->hostname, poller_items[snmp_oids[j].array_position].rrd_name, poller_items[snmp_oids[j].array_position].arg1, poller_items[snmp_oids[j].array_position].result));
|
||||
SPINE_LOG_MEDIUM(("Device[%i] HT[%i] DS[%i] TT[%.2f] SNMP: v%i: %s, dsname: %s, oid: %s, value: %s", host_id, host_thread, poller_items[snmp_oids[j].array_position].local_data_id, (float) ((thread_end - thread_start) * 1000), host->snmp_version, host->hostname, poller_items[snmp_oids[j].array_position].rrd_name, poller_items[snmp_oids[j].array_position].arg1, poller_items[snmp_oids[j].array_position].result));
|
||||
}
|
||||
|
||||
if (!IS_UNDEFINED(poller_items[snmp_oids[j].array_position].result)) {
|
||||
@@ -1895,7 +1895,7 @@ void poll_host(int device_counter, int host_id, int host_thread, int host_thread
|
||||
SPINE_FREE(snmp_oids);
|
||||
} else {
|
||||
/* free the mysql result */
|
||||
mysql_free_result(result);
|
||||
db_free_result(result);
|
||||
}
|
||||
|
||||
SPINE_FREE(host);
|
||||
|
||||
@@ -223,7 +223,7 @@ void *snmp_host_init(int host_id, char *hostname, int snmp_version, char *snmp_c
|
||||
session.securityAuthProto = snmp_duplicate_objid(usmHMACSHA1AuthProtocol, USM_AUTH_PROTO_SHA_LEN);
|
||||
session.securityAuthProtoLen = USM_AUTH_PROTO_SHA_LEN;
|
||||
} else if (strcmp(snmp_auth_protocol, "SHA224") == 0) {
|
||||
#if defined(HAVE_EVP_SHA224) && defined(NETSNMP_USMAUTH_HMAC128SHA224)
|
||||
#if defined(NETSNMP_USMAUTH_HMAC128SHA224)
|
||||
session.securityAuthProto = snmp_duplicate_objid(usmHMAC128SHA224AuthProtocol, OID_LENGTH(usmHMAC128SHA224AuthProtocol));
|
||||
session.securityAuthProtoLen = OID_LENGTH(usmHMAC128SHA224AuthProtocol);
|
||||
#else
|
||||
@@ -231,7 +231,7 @@ void *snmp_host_init(int host_id, char *hostname, int snmp_version, char *snmp_c
|
||||
return 0;
|
||||
#endif
|
||||
} else if (strcmp(snmp_auth_protocol, "SHA256") == 0) {
|
||||
#if defined(HAVE_EVP_SHA224) && defined(NETSNMP_USMAUTH_HMAC192SHA256)
|
||||
#if defined(NETSNMP_USMAUTH_HMAC192SHA256)
|
||||
session.securityAuthProto = snmp_duplicate_objid(usmHMAC192SHA256AuthProtocol, OID_LENGTH(usmHMAC192SHA256AuthProtocol));
|
||||
session.securityAuthProtoLen = OID_LENGTH(usmHMAC192SHA256AuthProtocol);
|
||||
#else
|
||||
@@ -239,7 +239,7 @@ void *snmp_host_init(int host_id, char *hostname, int snmp_version, char *snmp_c
|
||||
return 0;
|
||||
#endif
|
||||
} else if (strcmp(snmp_auth_protocol, "SHA384") == 0) {
|
||||
#if defined(HAVE_EVP_SHA384) && defined(NETSNMP_USMAUTH_HMAC256SHA384)
|
||||
#if defined(NETSNMP_USMAUTH_HMAC256SHA384)
|
||||
session.securityAuthProto = snmp_duplicate_objid(usmHMAC256SHA384AuthProtocol, OID_LENGTH(usmHMAC256SHA384AuthProtocol));
|
||||
session.securityAuthProtoLen = USM_HMAC256SHA384_AUTH_LEN;
|
||||
#else
|
||||
@@ -247,7 +247,7 @@ void *snmp_host_init(int host_id, char *hostname, int snmp_version, char *snmp_c
|
||||
return 0;
|
||||
#endif
|
||||
} else if (strcmp(snmp_auth_protocol, "SHA512") == 0) {
|
||||
#if defined(HAVE_EVP_SHA384) && defined(NETSNMP_USMAUTH_HMAC384SHA512)
|
||||
#if defined(NETSNMP_USMAUTH_HMAC384SHA512)
|
||||
session.securityAuthProto = snmp_duplicate_objid(usmHMAC384SHA512AuthProtocol, OID_LENGTH(usmHMAC384SHA512AuthProtocol));
|
||||
session.securityAuthProtoLen = USM_HMAC384SHA512_AUTH_LEN;
|
||||
#else
|
||||
|
||||
@@ -367,17 +367,17 @@ typedef struct config_struct {
|
||||
char host_id_list[BIG_BUFSIZE];
|
||||
int has_device_0;
|
||||
/* database connection information */
|
||||
char db_host[SMALL_BUFSIZE];
|
||||
char db_db[SMALL_BUFSIZE];
|
||||
char db_user[SMALL_BUFSIZE];
|
||||
char db_pass[SMALL_BUFSIZE];
|
||||
char db_host[LRG_BUFSIZE];
|
||||
char db_db[LRG_BUFSIZE];
|
||||
char db_user[LRG_BUFSIZE];
|
||||
char db_pass[LRG_BUFSIZE];
|
||||
int db_ssl;
|
||||
char db_ssl_key[BIG_BUFSIZE];
|
||||
char db_ssl_cert[BIG_BUFSIZE];
|
||||
char db_ssl_ca[BIG_BUFSIZE];
|
||||
int d_b;
|
||||
unsigned int db_port;
|
||||
char dbversion[SMALL_BUFSIZE];
|
||||
char dbversion[LRG_BUFSIZE];
|
||||
int dbonupdate;
|
||||
int cacti_version;
|
||||
/* path information */
|
||||
@@ -390,7 +390,7 @@ typedef struct config_struct {
|
||||
int log_perror;
|
||||
int log_pwarn;
|
||||
int log_pstats;
|
||||
char selective_device_debug[SMALL_BUFSIZE];
|
||||
char selective_device_debug[LRG_BUFSIZE];
|
||||
int spine_log_level;
|
||||
int log_datetime_separator;
|
||||
int log_datetime_format;
|
||||
@@ -406,7 +406,7 @@ typedef struct config_struct {
|
||||
/* snmp options */
|
||||
int snmp_max_get_size;
|
||||
int snmp_retries;
|
||||
char snmp_clientaddr[SMALL_BUFSIZE];
|
||||
char snmp_clientaddr[LRG_BUFSIZE];
|
||||
int mibs;
|
||||
/* PHP Script Server Options */
|
||||
int php_required;
|
||||
@@ -421,16 +421,16 @@ typedef struct config_struct {
|
||||
/* Remote polling mode */
|
||||
int mode;
|
||||
/* remote database connection information */
|
||||
char rdb_host[SMALL_BUFSIZE];
|
||||
char rdb_db[SMALL_BUFSIZE];
|
||||
char rdb_user[SMALL_BUFSIZE];
|
||||
char rdb_pass[SMALL_BUFSIZE];
|
||||
char rdb_host[LRG_BUFSIZE];
|
||||
char rdb_db[LRG_BUFSIZE];
|
||||
char rdb_user[LRG_BUFSIZE];
|
||||
char rdb_pass[LRG_BUFSIZE];
|
||||
int rdb_ssl;
|
||||
char rdb_ssl_key[BIG_BUFSIZE];
|
||||
char rdb_ssl_cert[BIG_BUFSIZE];
|
||||
char rdb_ssl_ca[BIG_BUFSIZE];
|
||||
unsigned int rdb_port;
|
||||
char rdbversion[SMALL_BUFSIZE];
|
||||
char rdbversion[LRG_BUFSIZE];
|
||||
int rdbonupdate;
|
||||
} config_t;
|
||||
|
||||
@@ -582,11 +582,11 @@ typedef struct host_reindex_struct {
|
||||
*
|
||||
*/
|
||||
typedef struct ping_results {
|
||||
char hostname[SMALL_BUFSIZE];
|
||||
char hostname[LRG_BUFSIZE];
|
||||
char ping_status[50];
|
||||
char ping_response[SMALL_BUFSIZE];
|
||||
char ping_response[LRG_BUFSIZE];
|
||||
char snmp_status[50];
|
||||
char snmp_response[SMALL_BUFSIZE];
|
||||
char snmp_response[LRG_BUFSIZE];
|
||||
} ping_t;
|
||||
|
||||
/*! Name Result Structure
|
||||
@@ -596,7 +596,7 @@ typedef struct ping_results {
|
||||
*/
|
||||
typedef struct name_port {
|
||||
// Method = 0 - default, 1 - tcp, 2 - udp
|
||||
char hostname[SMALL_BUFSIZE];
|
||||
char hostname[LRG_BUFSIZE];
|
||||
int method;
|
||||
int port;
|
||||
} name_t;
|
||||
|
||||
@@ -386,6 +386,8 @@ void db_disconnect(MYSQL *mysql) {
|
||||
if (mysql != NULL) {
|
||||
mysql_close(mysql);
|
||||
}
|
||||
|
||||
mysql = NULL;
|
||||
}
|
||||
|
||||
/*! \fn void db_create_connection_pool(int type)
|
||||
|
||||
@@ -108,14 +108,14 @@ static const char *getsetting(MYSQL *psql, int mode, const char *setting) {
|
||||
db_free_result(result);
|
||||
return retval;
|
||||
}else{
|
||||
return 0;
|
||||
return strdup("");
|
||||
}
|
||||
}else{
|
||||
db_free_result(result);
|
||||
return 0;
|
||||
return strdup("");
|
||||
}
|
||||
}else{
|
||||
return 0;
|
||||
return strdup("");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@ void read_config_options() {
|
||||
char sqlbuf[HUGE_BUFSIZE];
|
||||
char *sqlp = sqlbuf;
|
||||
const char *res;
|
||||
char spine_capabilities[SMALL_BUFSIZE];
|
||||
char spine_capabilities[LRG_BUFSIZE];
|
||||
|
||||
/* publish spine snmpv3 capabilities to the database */
|
||||
memset(spine_capabilities, 0, sizeof(spine_capabilities));
|
||||
@@ -357,7 +357,7 @@ void read_config_options() {
|
||||
|
||||
/* get the mysql server version */
|
||||
if ((res = getglobalvariable(&mysql, LOCAL, "version")) != 0) {
|
||||
snprintf(set.dbversion, SMALL_BUFSIZE, "%s", res);
|
||||
snprintf(set.dbversion, LRG_BUFSIZE, "%s", res);
|
||||
free((char *)res);
|
||||
}
|
||||
|
||||
@@ -384,7 +384,7 @@ void read_config_options() {
|
||||
|
||||
/* determine script server path operation and default log file processing */
|
||||
if ((res = getsetting(&mysql, LOCAL, "path_webroot")) != 0) {
|
||||
snprintf(set.path_php_server, SMALL_BUFSIZE, "%s/script_server.php", res);
|
||||
snprintf(set.path_php_server, LRG_BUFSIZE, "%s/script_server.php", res);
|
||||
snprintf(web_root, BUFSIZE, "%s", res);
|
||||
free((char *)res);
|
||||
}
|
||||
@@ -688,11 +688,11 @@ void read_config_options() {
|
||||
/* log the requirement for the script server */
|
||||
if (!strlen(set.host_id_list)) {
|
||||
sqlp = sqlbuf;
|
||||
sqlp += snprintf(sqlp, SMALL_BUFSIZE, "SELECT SQL_NO_CACHE action FROM poller_item");
|
||||
sqlp += snprintf(sqlp, SMALL_BUFSIZE, " WHERE action=%d", POLLER_ACTION_PHP_SCRIPT_SERVER);
|
||||
sqlp += snprintf(sqlp, LRG_BUFSIZE, "SELECT SQL_NO_CACHE action FROM poller_item");
|
||||
sqlp += snprintf(sqlp, LRG_BUFSIZE, " WHERE action=%d", POLLER_ACTION_PHP_SCRIPT_SERVER);
|
||||
sqlp += append_hostrange(sqlp, "host_id");
|
||||
sqlp += snprintf(sqlp, SMALL_BUFSIZE, " AND poller_id=%i", set.poller_id);
|
||||
sqlp += snprintf(sqlp, SMALL_BUFSIZE, " LIMIT 1");
|
||||
sqlp += snprintf(sqlp, LRG_BUFSIZE, " AND poller_id=%i", set.poller_id);
|
||||
sqlp += snprintf(sqlp, LRG_BUFSIZE, " LIMIT 1");
|
||||
|
||||
result = db_query(&mysql, LOCAL, sqlbuf);
|
||||
num_rows = mysql_num_rows(result);
|
||||
@@ -706,11 +706,11 @@ void read_config_options() {
|
||||
num_rows));
|
||||
} else {
|
||||
sqlp = sqlbuf;
|
||||
sqlp += snprintf(sqlp, SMALL_BUFSIZE, "SELECT SQL_NO_CACHE action FROM poller_item");
|
||||
sqlp += snprintf(sqlp, SMALL_BUFSIZE, " WHERE action=%d", POLLER_ACTION_PHP_SCRIPT_SERVER);
|
||||
sqlp += snprintf(sqlp, SMALL_BUFSIZE, " AND host_id IN(%s)", set.host_id_list);
|
||||
sqlp += snprintf(sqlp, SMALL_BUFSIZE, " AND poller_id=%i", set.poller_id);
|
||||
sqlp += snprintf(sqlp, SMALL_BUFSIZE, " LIMIT 1");
|
||||
sqlp += snprintf(sqlp, LRG_BUFSIZE, "SELECT SQL_NO_CACHE action FROM poller_item");
|
||||
sqlp += snprintf(sqlp, LRG_BUFSIZE, " WHERE action=%d", POLLER_ACTION_PHP_SCRIPT_SERVER);
|
||||
sqlp += snprintf(sqlp, LRG_BUFSIZE, " AND host_id IN(%s)", set.host_id_list);
|
||||
sqlp += snprintf(sqlp, LRG_BUFSIZE, " AND poller_id=%i", set.poller_id);
|
||||
sqlp += snprintf(sqlp, LRG_BUFSIZE, " LIMIT 1");
|
||||
|
||||
result = db_query(&mysql, LOCAL, sqlbuf);
|
||||
num_rows = mysql_num_rows(result);
|
||||
@@ -750,10 +750,10 @@ void read_config_options() {
|
||||
|
||||
strcat(spine_capabilities, "SHA");
|
||||
|
||||
#if defined(HAVE_EVP_SHA224) && defined(usmHMAC192SHA256AuthProtocol)
|
||||
#if defined(usmHMAC192SHA256AuthProtocol)
|
||||
strcat(spine_capabilities, ",SHA224,SHA256");
|
||||
#endif
|
||||
#if defined(HAVE_EVP_SHA384) && defined(usmHMAC384SHA512AuthProtocol)
|
||||
#if defined(usmHMAC384SHA512AuthProtocol)
|
||||
strcat(spine_capabilities, ",SHA384,SHA512");
|
||||
#endif
|
||||
strcat(spine_capabilities, "\"");
|
||||
@@ -1246,7 +1246,7 @@ int spine_log(const char *format, ...) {
|
||||
/* keep track of an errored log file */
|
||||
static int log_error = FALSE;
|
||||
|
||||
char logprefix[SMALL_BUFSIZE]; /* Formatted Log Prefix */
|
||||
char logprefix[LRG_BUFSIZE]; /* Formatted Log Prefix */
|
||||
char ulogmessage[LOGSIZE]; /* Un-Formatted Log Message */
|
||||
char flogmessage[LRG_LOGSIZE]; /* Formatted Log Message */
|
||||
char stdoutmessage[LRG_LOGSIZE]; /* Message for stdout */
|
||||
@@ -1262,7 +1262,7 @@ int spine_log(const char *format, ...) {
|
||||
|
||||
/* log message prefix */
|
||||
|
||||
snprintf(logprefix, SMALL_BUFSIZE, "SPINE: Poller[%i] PID[%i] PT[%ld] ", set.poller_id, getpid(), (unsigned long int)pthread_self());
|
||||
snprintf(logprefix, LRG_BUFSIZE, "SPINE: Poller[%i] PID[%i] PT[%ld] ", set.poller_id, getpid(), (unsigned long int)pthread_self());
|
||||
|
||||
/* get time for poller_output table */
|
||||
nowbin = time(&nowbin);
|
||||
|
||||
@@ -72,7 +72,8 @@ extern int char_count(const char *str, int chr);
|
||||
unsigned long long hex2dec(char *str);
|
||||
|
||||
/* macro to copy string to string with an ending null */
|
||||
#define STRNCOPY(dst, src) strncopy((dst), (src), sizeof(dst))
|
||||
#define STRNCOPY(dst, src) strncopy((dst), (src), sizeof(dst))
|
||||
#define USTRNCOPY(dst, src) ustrncopy((dst), (src), sizeof(dst))
|
||||
|
||||
/* macro to duplicate string and die if fails */
|
||||
#define STRDUP_OR_DIE(dst, src, reason) \
|
||||
|
||||
Reference in new issue
Block a user