[hobbit] 4.1.0 Premature end of script headers: /usr2/hobbit//cgi-bin/bb-hostsvc.sh

Henrik Stoerner henrik at hswn.dk
Mon Jul 25 15:20:33 CEST 2005


On Mon, Jul 25, 2005 at 01:57:52PM +0200, Etienne Roulland wrote:
> i have installed hobbit 4.1.0 and get 500 error when i go to a url
> like :
> 
> http://sphax.exp33.cvf:8080/hobbit-cgi/bb-hostsvc.sh?HOSTSVC=sphax,exp33,cvf.cpu

Thanks, that is a bug. Doesn't happen normally, since all the URL's
generated by Hobbit include the extra parameters.

This patch should solve it.


Henrik

-------------- next part --------------
--- hobbitd/hobbitsvc.c	2005/07/22 10:07:25	1.45
+++ hobbitd/hobbitsvc.c	2005/07/25 13:17:56
@@ -10,7 +10,7 @@
 /*                                                                            */
 /*----------------------------------------------------------------------------*/
 
-static char rcsid[] = "$Id: hobbitsvc.c,v 1.45 2005/07/22 10:07:25 henrik Exp $";
+static char rcsid[] = "$Id: hobbitsvc.c,v 1.46 2005/07/25 13:17:45 henrik Exp $";
 
 #include <limits.h>
 #include <stdio.h>
@@ -140,6 +140,7 @@
 	char *restofmsg = NULL, *ackmsg = NULL, *dismsg = NULL;			/* These are just used */
 	int ishtmlformatted = 0;
 	int clientavail = 0;
+	namelist_t *hinfo = NULL;
 
 	if (parse_query() != 0) return 1;
 
@@ -148,11 +149,14 @@
 		lastload = now;
 	}
 
-	if (!hostinfo(hostname)) {
+	if ((hinfo = hostinfo(hostname)) == NULL) {
 		errormsg("No such host");
 		return 1;
 	}
 
+	if (!ip) ip = strdup(bbh_item(hinfo, BBH_IP));
+	if (!displayname) displayname = strdup(hostname);
+
 	if (outform == FRM_CLIENT) {
 		char hobbitdreq[200];
 		int hobbitdresult;
@@ -343,9 +347,9 @@
 	else {
 		fprintf(stdout, "Content-type: text/html\n\n");
 		generate_html_log(hostname, 
-			  (displayname ? displayname : hostname), 
+			  displayname,
 			  service, 
-			  (ip ? ip : ""), 
+			  ip,
 		          color, 
 			  (sender ? sender : "Hobbit"), 
 			  (flags ? flags : ""),


More information about the Xymon mailing list