[Nagiosplug-checkins] nagiosplug/plugins check_http.c,1.105,1.106

Holger Weiss hweiss at users.sourceforge.net
Fri Jun 15 20:37:15 CEST 2007


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv11047

Modified Files:
	check_http.c 
Log Message:
When following redirects, the plugin supported 'Location:' header fields
which spanned multiple lines.  However, it was not checked whether extra
lines are preceeded with white space, which could lead to the following
header field name being interpreted as the value of the 'Location:'
field if the latter was empty for some reason.


Index: check_http.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_http.c,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -d -r1.105 -r1.106
--- check_http.c	15 Jun 2007 18:31:37 -0000	1.105
+++ check_http.c	15 Jun 2007 18:37:13 -0000	1.106
@@ -1099,7 +1099,19 @@
     }
 
     pos += i;
-    pos += strspn (pos, " \t\r\n");
+    pos += strspn (pos, " \t");
+
+    /*
+     * RFC 2616 (4.2):  ``Header fields can be extended over multiple lines by
+     * preceding each extra line with at least one SP or HT.''
+     */
+    for (; (i = strspn (pos, "\r\n")); pos += i) {
+      pos += i;
+      if (!(i = strspn (pos, " \t"))) {
+        die (STATE_UNKNOWN, _("HTTP UNKNOWN - Empty redirect location%s\n"),
+             display_html ? "</A>" : "");
+      }
+    }
 
     url = realloc (url, strcspn (pos, "\r\n") + 1);
     if (url == NULL)





More information about the Commits mailing list