[monitoring-plugins] more tolerant CERTINFO parsing

Andreas Baumann git at monitoring-plugins.org
Thu May 4 10:20:12 CEST 2017


 Module: monitoring-plugins
 Branch: feature_check_curl
 Commit: 0390474e9f3f7f8dcaa8ded5d009062deefd35a6
 Author: Andreas Baumann <mail at andreasbaumann.cc>
   Date: Thu May  4 08:16:33 2017 +0000
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=0390474

more tolerant CERTINFO parsing

---

 plugins/check_curl.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/plugins/check_curl.c b/plugins/check_curl.c
index 1aee5eb..d96f861 100644
--- a/plugins/check_curl.c
+++ b/plugins/check_curl.c
@@ -1841,18 +1841,18 @@ net_noopenssl_check_certificate (cert_ptr_union* cert_ptr, int days_till_exp_war
       /* find first common name in subject, TODO: check alternative subjects for
        * multi-host certificate, check wildcards
        */
-      if (strncmp (slist->data, "Subject:", 8) == 0) {
+      if (strncasecmp (slist->data, "Subject:", 8) == 0) {
         char* p = strstr (slist->data, "CN=");
         if (p != NULL) {
           if (strncmp (host_name, p+3, strlen (host_name)) == 0) {
             cname_found = 1;
           }
         }
-      } else if (strncmp (slist->data, "Start Date:", 11) == 0) {
+      } else if (strncasecmp (slist->data, "Start Date:", 11) == 0) {
         start_date_str = &slist->data[11];
-      } else if (strncmp (slist->data, "Expire Date:", 12) == 0) {
+      } else if (strncasecmp (slist->data, "Expire Date:", 12) == 0) {
         end_date_str = &slist->data[12];
-      } else if (strncmp (slist->data, "Cert:", 5) == 0) {
+      } else if (strncasecmp (slist->data, "Cert:", 5) == 0) {
         goto HAVE_FIRST_CERT;
       }
       if (verbose >= 2)



More information about the Commits mailing list