[monitoring-plugins] Replace sha1 with sha256 in utils_base

RincewindsHat git at monitoring-plugins.org
Fri Feb 10 11:50:12 CET 2023


 Module: monitoring-plugins
 Branch: master
 Commit: 34c6fae0ca405cddf2d60e76d785fc520d336582
 Author: RincewindsHat <12514511+RincewindsHat at users.noreply.github.com>
   Date: Tue Jan 31 15:17:51 2023 +0100
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=34c6fae

Replace sha1 with sha256 in utils_base

---

 lib/utils_base.c | 8 ++++----
 lib/utils_base.h | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/utils_base.c b/lib/utils_base.c
index 08fa215..eb1823b 100644
--- a/lib/utils_base.c
+++ b/lib/utils_base.c
@@ -402,20 +402,20 @@ int mp_translate_state (char *state_text) {
  * parse of argv, so that uniqueness in parameters are reflected there.
  */
 char *_np_state_generate_key() {
-	struct sha1_ctx ctx;
+	struct sha256_ctx ctx;
 	int i;
 	char **argv = this_monitoring_plugin->argv;
 	unsigned char result[20];
 	char keyname[41];
 	char *p=NULL;
 
-	sha1_init_ctx(&ctx);
+	sha256_init_ctx(&ctx);
 	
 	for(i=0; i<this_monitoring_plugin->argc; i++) {
-		sha1_process_bytes(argv[i], strlen(argv[i]), &ctx);
+		sha256_process_bytes(argv[i], strlen(argv[i]), &ctx);
 	}
 
-	sha1_finish_ctx(&ctx, &result);
+	sha256_finish_ctx(&ctx, &result);
 	
 	for (i=0; i<20; ++i) {
 		sprintf(&keyname[2*i], "%02x", result[i]);
diff --git a/lib/utils_base.h b/lib/utils_base.h
index 9482f23..5906550 100644
--- a/lib/utils_base.h
+++ b/lib/utils_base.h
@@ -2,7 +2,7 @@
 #define _UTILS_BASE_
 /* Header file for Monitoring Plugins utils_base.c */
 
-#include "sha1.h"
+#include "sha256.h"
 
 /* This file holds header information for thresholds - use this in preference to 
    individual plugin logic */



More information about the Commits mailing list