Преглед изворни кода

Better error if server requests client based certificate (609382 - Olaf Greis)

git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@265 f882894a-f735-0410-b71e-b25c423dba1c
Ton Voon пре 23 година
родитељ
комит
167ed8f193
1 измењених фајлова са 14 додато и 1 уклоњено
  1. 14 1
      plugins/check_http.c

+ 14 - 1
plugins/check_http.c

@@ -541,6 +541,9 @@ check_http (void)
 	char *x = NULL;
 	char *x = NULL;
 	char *orig_url = NULL;
 	char *orig_url = NULL;
 	double elapsed_time;
 	double elapsed_time;
+#ifdef HAVE_SSL
+	int sslerr;
+#endif
 
 
 	/* try to connect to the host at the given port number */
 	/* try to connect to the host at the given port number */
 #ifdef HAVE_SSL
 #ifdef HAVE_SSL
@@ -674,8 +677,18 @@ check_http (void)
 		pagesize += i;
 		pagesize += i;
 	}
 	}
 
 
-	if (i < 0)
+	if (i < 0) {
+#ifdef HAVE_SSL
+		sslerr=SSL_get_error(ssl, i);
+		if ( sslerr == SSL_ERROR_SSL ) {
+			terminate (STATE_WARNING, "Client Certificate Required\n");
+		} else {
+			terminate (STATE_CRITICAL, "Error in recv()");
+		}
+#else
 		terminate (STATE_CRITICAL, "Error in recv()");
 		terminate (STATE_CRITICAL, "Error in recv()");
+#endif
+	}
 
 
 	/* return a CRITICAL status if we couldn't read any data */
 	/* return a CRITICAL status if we couldn't read any data */
 	if (pagesize == (size_t) 0)
 	if (pagesize == (size_t) 0)