summaryrefslogtreecommitdiffstats
path: root/lib/utils_base.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/utils_base.c')
-rw-r--r--lib/utils_base.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/utils_base.c b/lib/utils_base.c
index fd7058d..c458cf6 100644
--- a/lib/utils_base.c
+++ b/lib/utils_base.c
@@ -24,7 +24,7 @@
24* 24*
25*****************************************************************************/ 25*****************************************************************************/
26 26
27#include "common.h" 27#include "../plugins/common.h"
28#include <stdarg.h> 28#include <stdarg.h>
29#include "utils_base.h" 29#include "utils_base.h"
30#include <ctype.h> 30#include <ctype.h>
@@ -128,6 +128,7 @@ range
128 temp_range->end = 0; 128 temp_range->end = 0;
129 temp_range->end_infinity = TRUE; 129 temp_range->end_infinity = TRUE;
130 temp_range->alert_on = OUTSIDE; 130 temp_range->alert_on = OUTSIDE;
131 temp_range->text = strdup(str);
131 132
132 if (str[0] == '@') { 133 if (str[0] == '@') {
133 temp_range->alert_on = INSIDE; 134 temp_range->alert_on = INSIDE;
@@ -318,18 +319,18 @@ char *np_extract_value(const char *varlist, const char *name, char sep) {
318 319
319 while (1) { 320 while (1) {
320 /* Strip any leading space */ 321 /* Strip any leading space */
321 for (varlist; isspace(varlist[0]); varlist++); 322 for (; isspace(varlist[0]); varlist++);
322 323
323 if (strncmp(name, varlist, strlen(name)) == 0) { 324 if (strncmp(name, varlist, strlen(name)) == 0) {
324 varlist += strlen(name); 325 varlist += strlen(name);
325 /* strip trailing spaces */ 326 /* strip trailing spaces */
326 for (varlist; isspace(varlist[0]); varlist++); 327 for (; isspace(varlist[0]); varlist++);
327 328
328 if (varlist[0] == '=') { 329 if (varlist[0] == '=') {
329 /* We matched the key, go past the = sign */ 330 /* We matched the key, go past the = sign */
330 varlist++; 331 varlist++;
331 /* strip leading spaces */ 332 /* strip leading spaces */
332 for (varlist; isspace(varlist[0]); varlist++); 333 for (; isspace(varlist[0]); varlist++);
333 334
334 if (tmp = index(varlist, sep)) { 335 if (tmp = index(varlist, sep)) {
335 /* Value is delimited by a comma */ 336 /* Value is delimited by a comma */
@@ -401,20 +402,20 @@ int mp_translate_state (char *state_text) {
401 * parse of argv, so that uniqueness in parameters are reflected there. 402 * parse of argv, so that uniqueness in parameters are reflected there.
402 */ 403 */
403char *_np_state_generate_key() { 404char *_np_state_generate_key() {
404 struct sha1_ctx ctx; 405 struct sha256_ctx ctx;
405 int i; 406 int i;
406 char **argv = this_monitoring_plugin->argv; 407 char **argv = this_monitoring_plugin->argv;
407 unsigned char result[20]; 408 unsigned char result[20];
408 char keyname[41]; 409 char keyname[41];
409 char *p=NULL; 410 char *p=NULL;
410 411
411 sha1_init_ctx(&ctx); 412 sha256_init_ctx(&ctx);
412 413
413 for(i=0; i<this_monitoring_plugin->argc; i++) { 414 for(i=0; i<this_monitoring_plugin->argc; i++) {
414 sha1_process_bytes(argv[i], strlen(argv[i]), &ctx); 415 sha256_process_bytes(argv[i], strlen(argv[i]), &ctx);
415 } 416 }
416 417
417 sha1_finish_ctx(&ctx, &result); 418 sha256_finish_ctx(&ctx, &result);
418 419
419 for (i=0; i<20; ++i) { 420 for (i=0; i<20; ++i) {
420 sprintf(&keyname[2*i], "%02x", result[i]); 421 sprintf(&keyname[2*i], "%02x", result[i]);
@@ -706,4 +707,3 @@ void np_state_write_string(time_t data_time, char *data_string) {
706 707
707 np_free(temp_file); 708 np_free(temp_file);
708} 709}
709