Sophie

Sophie

distrib > * > 2008.0 > x86_64 > by-pkgid > 2a1fb07aca6cd99d018df451bfce66ad > files > 5

hobbit-4.2.0-5mdv2008.0.src.rpm

diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/bbdisplay/bbgen.h ./bbdisplay/bbgen.h
--- /home/henrik/hobbit/release/hobbit-4.2.0/bbdisplay/bbgen.h	2006-08-09 22:09:54.000000000 +0200
+++ ./bbdisplay/bbgen.h	2006-10-03 13:52:28.720493437 +0200
@@ -51,9 +51,9 @@
                                            dialup               column -------> bbgen_col_t
                                            reportwarnlevel      color             name
                                            comment              age               next
-                                           banks                oldage
-                                           banksize             acked
-                                           next                 alert
+                                           next                 oldage
+                                                                acked
+                                                                alert
                                                                 onwap
                                                                 propagate
                                                                 reportinfo
@@ -140,6 +140,9 @@
 	struct state_t	*next;
 } state_t;
 
+/* OSX has a built-in "host_t" type. */
+#define host_t bbgen_host_t
+
 typedef struct host_t {
 	char	*hostname;
 	char	*displayname;
@@ -166,8 +169,6 @@
 	struct bbgen_page_t *parent;
 	double  reportwarnlevel;
 	char	*reporttime;
-	int     *banks;
-	int     banksize;
 	int     nobb2;
 	struct host_t	*next;
 } host_t;
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/bbdisplay/loadbbhosts.c ./bbdisplay/loadbbhosts.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/bbdisplay/loadbbhosts.c	2006-08-09 22:09:54.000000000 +0200
+++ ./bbdisplay/loadbbhosts.c	2006-10-03 13:52:28.731491435 +0200
@@ -174,8 +174,7 @@
 		  int ip1, int ip2, int ip3, int ip4, 
 		  int dialup, double warnpct, char *reporttime,
 		  char *alerts, int nktime, char *waps,
-		  char *nopropyellowtests, char *nopropredtests, char *noproppurpletests, char *nopropacktests,
-		  int modembanksize)
+		  char *nopropyellowtests, char *nopropredtests, char *noproppurpletests, char *nopropacktests)
 {
 	host_t 		*newhost = (host_t *) calloc(1, sizeof(host_t));
 	hostlist_t	*oldlist;
@@ -256,21 +255,6 @@
 	}
 
 	newhost->parent = NULL;
-	newhost->banks = NULL;
-	newhost->banksize = modembanksize;
-	if (modembanksize) {
-		int i;
-		newhost->banks = (int *) calloc(modembanksize, sizeof(int));
-		for (i=0; i<modembanksize; i++) newhost->banks[i] = -1;
-
-		if (comment) {
-			newhost->comment = (char *) realloc(newhost->comment, strlen(newhost->comment) + 22);
-			sprintf(newhost->comment+strlen(newhost->comment), " - [%s]", newhost->ip);
-		}
-		else {
-			newhost->comment = newhost->ip;
-		}
-	}
 	newhost->nobb2 = 0;
 	newhost->next = NULL;
 
@@ -440,7 +424,6 @@
 	host_t	*curhost;
 	char	*curtitle;
 	int	ip1, ip2, ip3, ip4;
-	int	modembanksize;
 	char	*p;
 	int	fqdn = get_fqdn();
 
@@ -482,8 +465,6 @@
 
 		dbgprintf("load_bbhosts: -- got line '%s'\n", STRBUF(inbuf));
 
-		modembanksize = 0;
-
 		if (strncmp(STRBUF(inbuf), pagetag, strlen(pagetag)) == 0) {
 			getnamelink(STRBUF(inbuf), &name, &link);
 			if (curpage == NULL) {
@@ -581,9 +562,7 @@
 			if (curtitle) { curgroup->pretitle = curtitle; curtitle = NULL; }
 			curhost = NULL;
 		}
-		else if ( (sscanf(STRBUF(inbuf), "%3d.%3d.%3d.%3d %s", &ip1, &ip2, &ip3, &ip4, hostname) == 5) ||
-		          (!reportstart && !snapshot && (sscanf(STRBUF(inbuf), "dialup %s %d.%d.%d.%d %d", hostname, &ip1, &ip2, &ip3, &ip4, &modembanksize) == 6) && (modembanksize > 0)) ) {
-
+		else if (sscanf(STRBUF(inbuf), "%3d.%3d.%3d.%3d %s", &ip1, &ip2, &ip3, &ip4, hostname) == 5) {
 			namelist_t *bbhost = NULL;
 			int dialup, nobb2, nktime = 1;
 			double warnpct = reportwarnlevel;
@@ -685,8 +664,7 @@
 							    ip1, ip2, ip3, ip4, dialup, 
 							    warnpct, reporttime,
 							    alertlist, nktime, onwaplist,
-							    nopropyellowlist, nopropredlist, noproppurplelist, nopropacklist,
-							    modembanksize);
+							    nopropyellowlist, nopropredlist, noproppurplelist, nopropacklist);
 					if (curgroup != NULL) {
 						curgroup->hosts = curhost;
 					}
@@ -710,8 +688,7 @@
 									    warnpct, reporttime,
 									    alertlist, nktime, onwaplist,
 									    nopropyellowlist,nopropredlist, 
-									    noproppurplelist, nopropacklist,
-									    modembanksize);
+									    noproppurplelist, nopropacklist);
 				}
 				curhost->parent = (cursubparent ? cursubparent : (cursubpage ? cursubpage : curpage));
 				if (curtitle) { curhost->pretitle = curtitle; curtitle = NULL; }
@@ -758,8 +735,7 @@
 									    warnpct, reporttime,
 									    alertlist, nktime, onwaplist,
 									    nopropyellowlist,nopropredlist, 
-									    noproppurplelist, nopropacklist,
-									    modembanksize);
+									    noproppurplelist, nopropacklist);
 
 						if (wantedgroup > 0) {
 							group_t *gwalk;
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/bbdisplay/loadbbhosts.h ./bbdisplay/loadbbhosts.h
--- /home/henrik/hobbit/release/hobbit-4.2.0/bbdisplay/loadbbhosts.h	2006-08-09 22:09:54.000000000 +0200
+++ ./bbdisplay/loadbbhosts.h	2006-10-03 13:52:28.740489797 +0200
@@ -24,8 +24,7 @@
 			 int dialup,
 			 double warnpct, char *reporttime,
 			 char *alerts, int nktime, char *waps,
-			 char *nopropyellowtests, char *nopropredtests, char *noproppurpletests, char *nopropacktests,
-			 int modembanksize);
+			 char *nopropyellowtests, char *nopropredtests, char *noproppurpletests, char *nopropacktests);
 
 extern char	*nopropyellowdefault;
 extern char	*nopropreddefault;
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/bbdisplay/loaddata.c ./bbdisplay/loaddata.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/bbdisplay/loaddata.c	2006-08-09 22:09:54.000000000 +0200
+++ ./bbdisplay/loaddata.c	2006-10-03 13:52:28.750487977 +0200
@@ -182,12 +182,6 @@
 
 	host = find_host(hostname);
 
-	/* If the host is a modem-bank host, dont mix in normal status messages */
-	if (host && (host->banksize > 0)) {
-		errprintf("Modembank %s has additional status-logs - ignored\n", hostname);
-		return NULL;
-	}
-
 	newstate = (state_t *) calloc(1, sizeof(state_t));
 	newstate->entry = (entry_t *) calloc(1, sizeof(entry_t));
 	newstate->next = NULL;
@@ -347,72 +341,6 @@
 	return newsum;
 }
 
-void init_modembank_status(char *fn, logdata_t *log)
-{
-	char *msgcopy;
-	host_t *targethost;
-	time_t now = time(NULL);
-
-	dbgprintf("init_modembank_status(%s)\n", textornull(fn));
-
-	if (log->validtime < now) return;
-
-	targethost = find_host(fn+strlen("dialup."));
-	if (targethost == NULL) {
-		dbgprintf("Modembank status from unknown host %s - ignored\n", fn+strlen("dialup."));
-		return;
-	}
-
-	msgcopy = strdup(log->msg);
-	if (strlen(msgcopy)) {
-		char *startip, *endip, *tag;
-		int idx = -1;
-
-		startip = endip = NULL;
-		tag = strtok(msgcopy, " \n");
-		while (tag) {
-			if (idx >= 0) {
-				/* Next result */
-				if (idx < targethost->banksize) targethost->banks[idx] = parse_color(tag);
-				idx++;
-			}
-			else if (strcmp(tag, "DATA") == 0) {
-				if (startip && endip) idx = 0;
-				else errprintf("Invalid modembank status logfile %s (missing FROM and/or TO)\n", fn);
-			}
-			else if (strcmp(tag, "FROM") == 0) {
-				tag = strtok(NULL, " \n");
-
-				if (tag) {
-					startip = tag;
-					if (strcmp(startip, targethost->ip) != 0) {
-						errprintf("Modembank in bb-hosts begins with %s, but logfile begins with %s\n",
-						  	targethost->ip, startip);
-					}
-				} else errprintf("Invalid modembank status logfile %s (truncated)\n", fn);
-			}
-			else if (strcmp(tag, "TO") == 0) {
-				tag = strtok(NULL, " \n");
-
-				if (tag) {
-					if (startip) endip = tag;
-					else errprintf("Invalid modembank status logfile %s (no FROM)\n", fn);
-				} else errprintf("Invalid modembank status logfile %s (truncated)\n", fn);
-			}
-
-			if (tag) tag = strtok(NULL, " \n");
-		}
-
-		if ((idx >= 0) && (idx != targethost->banksize)) {
-			errprintf("Modembank status log %s has more entries (%d) than expected (%d)\n", 
-				  fn, (idx-1), targethost->banksize);
-		}
-	}
-
-	xfree(msgcopy);
-}
-
-
 state_t *load_state(dispsummary_t **sumhead)
 {
 	int hobbitdresult;
@@ -506,9 +434,6 @@
 				}
 			}
 		}
-		else if (strncmp(fn, "dialup.", 7) == 0) {
-			init_modembank_status(fn, &log);
-		}
 		else {
 			if (acklist && *acklist) {
 				/*
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/bbdisplay/pagegen.c ./bbdisplay/pagegen.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/bbdisplay/pagegen.c	2006-08-09 22:09:54.000000000 +0200
+++ ./bbdisplay/pagegen.c	2006-10-03 13:52:28.763485611 +0200
@@ -322,8 +322,6 @@
 	int	genstatic;
 	int	columncount;
 	char	*bbskin;
-	int	maxbanksize = 0;
-	int	anyplainhosts = 0;
 	int	rowcount = 0;
 
 	if (head == NULL)
@@ -338,27 +336,10 @@
 	else fprintf(output, "<A NAME=hosts-blk-%d>&nbsp;</A>\n\n", hostblkidx);
 	hostblkidx++;
 
-	for (h = head; (h); h = h->next) {
-		if (h->banksize > maxbanksize) maxbanksize = h->banksize;
-		if (h->banksize == 0) anyplainhosts = 1;
-	}
-
-	if (maxbanksize == 0) {
-		/* No modembanks - normal hostlist with columns and stuff */
-		groupcols = gen_column_list(head, pagetype, onlycols, exceptcols);
-		for (columncount=0, gc=groupcols; (gc); gc = gc->next, columncount++) ;
-	}
-	else {
-		/* There are modembanks here! */
-		if (anyplainhosts) {
-			errprintf("WARNING: Modembank displays should be in their own group or page.\nMixing normal hosts with modembanks yield strange output.\n");
-		}
-		groupcols = NULL;
-		columncount = maxbanksize;
-	}
-
-	if (groupcols || (maxbanksize > 0)) {
+	groupcols = gen_column_list(head, pagetype, onlycols, exceptcols);
+	for (columncount=0, gc=groupcols; (gc); gc = gc->next, columncount++) ;
 
+	if (groupcols) {
 		int width;
 
 		width = atoi(xgetenv("DOTWIDTH"));
@@ -386,29 +367,11 @@
 				fprintf(output, "<TD VALIGN=MIDDLE ROWSPAN=2><CENTER><FONT %s>%s</FONT></CENTER></TD>\n", 
 					xgetenv("MKBBTITLE"), (strlen(grouptitle) ? grouptitle : "&nbsp;"));
 
-				if ((groupcols == NULL) && (maxbanksize > 0)) {
-					int i,j;
-
-					fprintf(output, "<TD><TABLE BORDER=0>\n");
-					for (i=0; (i < maxbanksize); i+=16) {
-						fprintf(output, "<TR>\n");
-						for (j=i; (((j-i) < 16) && (j < maxbanksize)); j++) {
-							fprintf(output, " <TD ALIGN=CENTER VALIGN=BOTTOM WIDTH=%d>", width);
-							fprintf(output, " <FONT %s><B>%d</B></FONT>", 
-								xgetenv("MKBBCOLFONT"), j);
-							fprintf(output, " </TD>\n");
-						}
-						fprintf(output, "</TR>\n");
-					}
-					fprintf(output, "</TABLE></TD>\n");
-				}
-				else {
-					for (gc=groupcols; (gc); gc = gc->next) {
-						fprintf(output, " <TD ALIGN=CENTER VALIGN=BOTTOM WIDTH=45>\n");
-						fprintf(output, " <A HREF=\"%s\"><FONT %s><B>%s</B></FONT></A> </TD>\n", 
-							columnlink(gc->column->name), 
-							xgetenv("MKBBCOLFONT"), gc->column->name);
-					}
+				for (gc=groupcols; (gc); gc = gc->next) {
+					fprintf(output, " <TD ALIGN=CENTER VALIGN=BOTTOM WIDTH=45>\n");
+					fprintf(output, " <A HREF=\"%s\"><FONT %s><B>%s</B></FONT></A> </TD>\n", 
+						columnlink(gc->column->name), 
+						xgetenv("MKBBCOLFONT"), gc->column->name);
 				}
 				fprintf(output, "</TR> \n<TR><TD COLSPAN=%d><HR WIDTH=\"100%%\"></TD></TR>\n\n", columncount);
 			}
@@ -421,44 +384,6 @@
 				hostnamehtml(h->hostname, ((pagetype != PAGE_BB) ? hostpage_link(h) : NULL)) );
 
 			/* Then the columns. */
-			if ((groupcols == NULL) && (h->banksize > 0)) {
-				int i, j;
-				char alttag[30];
-				unsigned int baseip, ip1, ip2, ip3, ip4;
-
-				sscanf(h->ip, "%u.%u.%u.%u", &ip1, &ip2, &ip3, &ip4);
-				baseip = IPtou32(ip1, ip2, ip3, ip4);
-
-				fprintf(output, "<TD ALIGN=CENTER><TABLE BORDER=0>");
-				for (i=0; (i < h->banksize); i+=16) {
-					fprintf(output, "<TR>\n");
-					for (j=i; (((j-i) < 16) && (j < h->banksize)); j++) {
-						fprintf(output, "<TD ALIGN=CENTER VALIGN=BOTTOM WIDTH=%d>", width);
-
-						if (genstatic) {
-							/*
-							 * Dont use htmlextension here - it's for the
-							 * pages generated by bbd.
-							 */
-							fprintf(output, "<A HREF=\"%s/html/dialup.%s.html\">",
-								xgetenv("BBWEB"), h->hostname);
-						}
-						else {
-							fprintf(output, "<A HREF=\"%s\">", 
-								hostsvcurl("dialup", commafy(h->hostname), 1));
-						}
-	
-						sprintf(alttag, "%s:%s", u32toIP(baseip+j), colorname(h->banks[j]));
-						fprintf(output, "<IMG SRC=\"%s/%s\" ALT=\"%s\" TITLE=\"%s\" HEIGHT=\"%s\" WIDTH=\"%s\" BORDER=0></A>",
-							bbskin, dotgiffilename(h->banks[j], 0, 0),
-							alttag, alttag, xgetenv("DOTHEIGHT"), xgetenv("DOTWIDTH"));
-
-						fprintf(output, "</TD>\n");
-					}
-					fprintf(output, "</TR>\n");
-				}
-				fprintf(output, "</TABLE></TD>\n");
-			}
 			for (gc = groupcols; (gc); gc = gc->next) {
 				char *htmlalttag;
 
@@ -657,7 +582,7 @@
 
 		if (newhost == NULL) {
 			/* New summary "host" */
-			newhost = init_host(s->row, 1, NULL, NULL, NULL, NULL, 0,0,0,0, 0, 0.0, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, 0);
+			newhost = init_host(s->row, 1, NULL, NULL, NULL, NULL, 0,0,0,0, 0, 0.0, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL);
 
 			/* Insert into sorted host list */
 			if ((!sumhosts) || (strcmp(newhost->hostname, sumhosts->hostname) < 0)) {
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/bbnet/bbtest-net.c ./bbnet/bbtest-net.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/bbnet/bbtest-net.c	2006-08-09 22:09:55.000000000 +0200
+++ ./bbnet/bbtest-net.c	2006-10-03 13:52:28.816475965 +0200
@@ -64,27 +64,13 @@
 	NULL
 };
 
-/* toolid values */
-#define TOOL_CONTEST	0
-#define TOOL_NSLOOKUP	1
-#define TOOL_DIG	2
-#define TOOL_NTP        3
-#define TOOL_FPING      4
-#define TOOL_HTTP       5
-#define TOOL_MODEMBANK  6
-#define TOOL_LDAP	7
-#define TOOL_RPCINFO	8
-
-
 RbtHandle	svctree;			/* All known services, has service_t records */
 service_t	*pingtest = NULL;		/* Identifies the pingtest within svctree list */
 int		pingcount = 0;
 service_t	*dnstest = NULL;		/* Identifies the dnstest within svctree list */
-service_t	*digtest = NULL;		/* Identifies the digtest within svctree list */
 service_t	*httptest = NULL;		/* Identifies the httptest within svctree list */
 service_t	*ldaptest = NULL;		/* Identifies the ldaptest within svctree list */
 service_t	*rpctest = NULL;		/* Identifies the rpctest within svctree list */
-service_t	*modembanktest = NULL;		/* Identifies the modembank test within svctree list */
 RbtHandle       testhosttree;			/* All tested hosts, has testedhost_t records */
 char		*nonetpage = NULL;		/* The "NONETPAGE" env. variable */
 int		dnsmethod = DNS_THEN_IP;	/* How to do DNS lookups */
@@ -157,35 +143,21 @@
 		printf("Service %s, port %d, toolid %d\n", swalk->testname, swalk->portnum, swalk->toolid);
 
 		for (iwalk = swalk->items; (iwalk); iwalk = iwalk->next) {
-			if (swalk == modembanktest) {
-				modembank_t *mentry;
-				int i;
-
-				mentry = iwalk->privdata;
-				printf("\tModembank   : %s\n", textornull(mentry->hostname));
-				printf("\tStart-IP    : %s\n", u32toIP(mentry->startip));
-				printf("\tBanksize    : %d\n", mentry->banksize);
-				printf("\tOpen        :");
-				for (i=0; i<mentry->banksize; i++) printf(" %d", mentry->responses[i]);
-				printf("\n");
-			}
-			else {
-				printf("\tHost        : %s\n", textornull(iwalk->host->hostname));
-				printf("\ttestspec    : %s\n", textornull(iwalk->testspec));
-				printf("\tFlags       :");
-				if (iwalk->dialup) printf(" dialup");
-				if (iwalk->reverse) printf(" reverse");
-				if (iwalk->silenttest) printf(" silenttest");
-				if (iwalk->alwaystrue) printf(" alwaystrue");
-				printf("\n");
-				printf("\tOpen        : %d\n", iwalk->open);
-				printf("\tBanner      : %s\n", textornull(STRBUF(iwalk->banner)));
-				printf("\tcertinfo    : %s\n", textornull(iwalk->certinfo));
-				printf("\tDuration    : %ld.%06ld\n", (long int)iwalk->duration.tv_sec, (long int)iwalk->duration.tv_usec);
-				printf("\tbadtest     : %d:%d:%d\n", iwalk->badtest[0], iwalk->badtest[1], iwalk->badtest[2]);
-				printf("\tdowncount    : %d started %s", iwalk->downcount, ctime(&iwalk->downstart));
-				printf("\n");
-			}
+			printf("\tHost        : %s\n", textornull(iwalk->host->hostname));
+			printf("\ttestspec    : %s\n", textornull(iwalk->testspec));
+			printf("\tFlags       :");
+			if (iwalk->dialup) printf(" dialup");
+			if (iwalk->reverse) printf(" reverse");
+			if (iwalk->silenttest) printf(" silenttest");
+			if (iwalk->alwaystrue) printf(" alwaystrue");
+			printf("\n");
+			printf("\tOpen        : %d\n", iwalk->open);
+			printf("\tBanner      : %s\n", textornull(STRBUF(iwalk->banner)));
+			printf("\tcertinfo    : %s\n", textornull(iwalk->certinfo));
+			printf("\tDuration    : %ld.%06ld\n", (long int)iwalk->duration.tv_sec, (long int)iwalk->duration.tv_usec);
+			printf("\tbadtest     : %d:%d:%d\n", iwalk->badtest[0], iwalk->badtest[1], iwalk->badtest[2]);
+			printf("\tdowncount    : %d started %s", iwalk->downcount, ctime(&iwalk->downstart));
+			printf("\n");
 		}
 
 		printf("\n");
@@ -423,35 +395,6 @@
 
 		if (!wanted_host(hwalk, location)) continue;
 
-		if (argnmatch(hwalk->bbhostname, "@dialup.")) {
-			/* Modembank entry: "dialup displayname startIP count" */
-
-			char *realname;
-			testitem_t *newtest;
-			modembank_t *newentry;
-			int i, ip1, ip2, ip3, ip4, banksize;
-
-			realname = hwalk->bbhostname + strlen("@dialup.");
-			banksize = atoi(bbh_item(hwalk, BBH_BANKSIZE));
-			sscanf(bbh_item(hwalk, BBH_IP), "%d.%d.%d.%d", &ip1, &ip2, &ip3, &ip4);
-
-			newtest = init_testitem(NULL, modembanktest, NULL, 0, 0, 0, 0, 0);
-			newtest->next = modembanktest->items;
-			modembanktest->items = newtest;
-
-			newtest->privdata = (void *)malloc(sizeof(modembank_t));
-			newentry = (modembank_t *)newtest->privdata;
-			newentry->hostname = realname;
-			newentry->startip = IPtou32(ip1, ip2, ip3, ip4);
-			newentry->banksize = banksize;
-			newentry->responses = (int *) malloc(banksize * sizeof(int));
-			for (i=0; i<banksize; i++) newentry->responses[i] = 0;
-
-			/* No more to do for modembanks */
-			continue;
-		}
-
-
 		h = init_testedhost(hwalk->bbhostname);
 
 		p = bbh_custom_item(hwalk, "badconn:");
@@ -645,7 +588,7 @@
 					s = dnstest;
 				}
 				else if (argnmatch(testspec, "dig=")) {
-					s = digtest;
+					s = dnstest;
 				}
 				else {
 					/* 
@@ -1311,60 +1254,6 @@
 	return 0;
 }
 
-void run_modembank_service(service_t *service)
-{
-	testitem_t	*t;
-	char		cmd[1024];
-	char		startip[IP_ADDR_STRLEN], endip[IP_ADDR_STRLEN];
-	char		*p;
-	char		cmdpath[PATH_MAX];
-	FILE		*cmdpipe;
-	char		l[MAX_LINE_LEN];
-	int		ip1, ip2, ip3, ip4;
-
-	for (t=service->items; (t); t = t->next) {
-		modembank_t *req = (modembank_t *)t->privdata;
-
-		p = xgetenv("FPING");
-		strcpy(cmdpath, (p ? p : "hobbitping"));
-		strcpy(startip, u32toIP(req->startip));
-		strcpy(endip, u32toIP(req->startip + req->banksize - 1));
-		sprintf(cmd, "%s -g -Ae %s %s 2>/dev/null", cmdpath, startip, endip);
-
-		dbgprintf("Running command: '%s'\n", cmd);
-		cmdpipe = popen(cmd, "r");
-		if (cmdpipe == NULL) {
-			errprintf("Could not run the hobbitping command %s\n", cmd);
-			return;
-		}
-
-		while (fgets(l, sizeof(l), cmdpipe)) {
-			dbgprintf("modembank response: %s", l);
-
-			if (sscanf(l, "%d.%d.%d.%d ", &ip1, &ip2, &ip3, &ip4) == 4) {
-				unsigned int idx = IPtou32(ip1, ip2, ip3, ip4) - req->startip;
-
-				if (idx >= req->banksize) {
-					errprintf("Unexpected response for IP not in bank - %d.%d.%d.%d", 
-						  ip1, ip2, ip3, ip4);
-				}
-				else {
-					req->responses[idx] = (strstr(l, "is alive") != NULL);
-				}
-			}
-		}
-		pclose(cmdpipe);
-
-		if (debug) {
-			int i;
-
-			dbgprintf("Results for modembank start=%s, length %d\n", u32toIP(req->startip), req->banksize);
-			for (i=0; (i<req->banksize); i++)
-				dbgprintf("\t%s is %d\n", u32toIP(req->startip+i), req->responses[i]);
-		}
-	}
-}
-
 
 int decide_color(service_t *service, char *svcname, testitem_t *test, int failgoesclear, char *cause)
 {
@@ -1756,44 +1645,6 @@
 }
 
 
-void send_modembank_results(service_t *service)
-{
-	testitem_t	*t;
-	char		msgline[1024];
-	int		i, color, inuse;
-	char		startip[IP_ADDR_STRLEN], endip[IP_ADDR_STRLEN];
-
-	for (t=service->items; (t); t = t->next) {
-		modembank_t *req = (modembank_t *)t->privdata;
-
-		inuse = 0;
-		strcpy(startip, u32toIP(req->startip));
-		strcpy(endip, u32toIP(req->startip + req->banksize - 1));
-
-		init_status(COL_GREEN);		/* Modembanks are always green */
-		sprintf(msgline, "status dialup.%s %s %s FROM %s TO %s DATA ", 
-			req->hostname, colorname(COL_GREEN), timestamp, startip, endip);
-		addtostatus(msgline);
-		for (i=0; i<req->banksize; i++) {
-			if (req->responses[i]) {
-				color = COL_GREEN;
-				inuse++;
-			}
-			else {
-				color = COL_CLEAR;
-			}
-
-			sprintf(msgline, "%s ", colorname(color));
-			addtostatus(msgline);
-		}
-
-		sprintf(msgline, "\n\nUsage: %d of %d (%d%%)\n", inuse, req->banksize, ((inuse * 100) / req->banksize));
-		addtostatus(msgline);
-		finish_status();
-	}
-}
-
-
 void send_rpcinfo_results(service_t *service, int failgoesclear)
 {
 	testitem_t	*t;
@@ -2234,14 +2085,12 @@
 		return 0;
 	}
 
-	dnstest = add_service("dns", getportnumber("domain"), 0, TOOL_NSLOOKUP);
-	digtest = add_service("dig", getportnumber("domain"), 0, TOOL_DIG);
+	dnstest = add_service("dns", getportnumber("domain"), 0, TOOL_DNS);
 	add_service("ntp", getportnumber("ntp"),    0, TOOL_NTP);
 	rpctest  = add_service("rpc", getportnumber("sunrpc"), 0, TOOL_RPCINFO);
 	httptest = add_service("http", getportnumber("http"),  0, TOOL_HTTP);
 	ldaptest = add_service("ldapurl", getportnumber("ldap"), strlen("ldap"), TOOL_LDAP);
 	if (pingcolumn) pingtest = add_service(pingcolumn, 0, 0, TOOL_FPING);
-	modembanktest = add_service("dialup", 0, 0, TOOL_MODEMBANK);
 	add_timestamp("Service definitions loaded");
 
 	load_tests();
@@ -2360,18 +2209,14 @@
 	add_timestamp("LDAP tests result collection completed");
 
 
-	/* dns, dig, ntp tests */
+	/* dns, ntp tests */
 	for (handle = rbtBegin(svctree); handle != rbtEnd(svctree); handle = rbtNext(svctree, handle)) {
 		s = (service_t *)gettreeitem(svctree, handle);
 		if (s->items) {
 			switch(s->toolid) {
-				case TOOL_NSLOOKUP:
+				case TOOL_DNS:
 					run_nslookup_service(s); 
-					add_timestamp("NSLOOKUP tests executed");
-					break;
-				case TOOL_DIG:
-					run_nslookup_service(s); 
-					add_timestamp("DIG tests executed");
+					add_timestamp("DNS tests executed");
 					break;
 				case TOOL_NTP:
 					run_ntp_service(s); 
@@ -2381,9 +2226,7 @@
 					run_rpcinfo_service(s); 
 					add_timestamp("RPC tests executed");
 					break;
-				case TOOL_MODEMBANK:
-					run_modembank_service(s); 
-					add_timestamp("Modembank tests executed");
+				default:
 					break;
 			}
 		}
@@ -2394,8 +2237,7 @@
 		s = (service_t *)gettreeitem(svctree, handle);
 		switch (s->toolid) {
 			case TOOL_CONTEST:
-			case TOOL_NSLOOKUP:
-			case TOOL_DIG:
+			case TOOL_DNS:
 			case TOOL_NTP:
 				send_results(s, failgoesclear);
 				break;
@@ -2406,10 +2248,6 @@
 				/* These handle result-transmission internally */
 				break;
 
-			case TOOL_MODEMBANK:
-				send_modembank_results(s);
-				break;
-
 			case TOOL_RPCINFO:
 				send_rpcinfo_results(s, failgoesclear);
 				break;
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/bbnet/bbtest-net.h ./bbnet/bbtest-net.h
--- /home/henrik/hobbit/release/hobbit-4.2.0/bbnet/bbtest-net.h	2006-08-09 22:09:55.000000000 +0200
+++ ./bbnet/bbtest-net.h	2006-10-03 13:52:28.860467957 +0200
@@ -19,6 +19,9 @@
 
 #define MAX_CONTENT_DATA (1024*1024)	/* 1 MB should be enough for most */
 
+/* toolids */
+enum toolid_t { TOOL_CONTEST, TOOL_DNS, TOOL_NTP, TOOL_FPING, TOOL_HTTP, TOOL_LDAP, TOOL_RPCINFO };
+
 /*
  * Structure of the bbtest-net in-memory records
  *
@@ -62,12 +65,11 @@
 	char *testname;		/* Name of the test = column name in Hobbit report */
 	int namelen;		/* Length of name - "testname:port" has this as strlen(testname), others 0 */
 	int portnum;		/* Port number this service runs on */
-	int toolid;		/* Which tool to use */
+	enum toolid_t toolid;	/* Which tool to use */
 	struct testitem_t *items; /* testitem_t linked list of tests for this service */
 } service_t;
 
-#define MULTIPING_BEST 0
-#define MULTIPING_WORST 1
+enum multiping_t { MULTIPING_BEST, MULTIPING_WORST };
 typedef struct ipping_t {
 	char *ip;
 	int  open;
@@ -76,7 +78,7 @@
 } ipping_t;
 
 typedef struct extraping_t {
-	int   matchtype;
+	enum multiping_t matchtype;
 	ipping_t *iplist;
 } extraping_t;
 
@@ -150,13 +152,6 @@
 	struct testitem_t *next;
 } testitem_t;
 
-typedef struct modembank_t {
-	char		*hostname;
-	unsigned int 	startip;	/* Saved as 32-bit binary */
-	int		banksize;
-	int		*responses;
-} modembank_t;
-
 typedef struct dnstest_t {
 	int	testcount;
 	int	okcount;
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/build/bb-commands.sh ./build/bb-commands.sh
--- /home/henrik/hobbit/release/hobbit-4.2.0/build/bb-commands.sh	2006-08-09 22:09:57.000000000 +0200
+++ ./build/bb-commands.sh	2006-10-03 12:55:27.000000000 +0200
@@ -23,23 +23,13 @@
 echo "# Hobbit does not use them, but they are provided here so if you use BB extension"
 echo "# scripts, then they will hopefully run without having to do a lot of tweaking."
 echo ""
-for CMD in uptime awk cat cp cut date egrep expr find grep head id ln ls mv rm sed sort tail touch tr uniq who
+for CMD in uptime awk cat cp cut date egrep expr find grep head id ln ls mv rm sed sort tail top touch tr uniq who
 do
 	ENVNAME=`echo $CMD | tr "[a-z]" "[A-Z]"`
 	PGM=`findbin $CMD | head -n 1`
 	echo "${ENVNAME}=\"${PGM}\""
 done
 
-# TOP can either be "top", or on Solaris the "prstat" command.
-PRSTAT=`findbin prstat | head -n 1`
-if test "$PRSTAT" != ""
-then
-	PGM="$PRSTAT -can 20 1 1"
-else
-	PGM=`findbin top | head -n 1`
-fi
-echo "TOP=\"${PGM}\""
-
 # WC is special
 PGM=`findbin wc | head -n 1`
 echo "WC=\"${PGM} -l\""
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/client/hobbitclient-aix.sh ./client/hobbitclient-aix.sh
--- /home/henrik/hobbit/release/hobbit-4.2.0/client/hobbitclient-aix.sh	2006-08-09 22:09:58.000000000 +0200
+++ ./client/hobbitclient-aix.sh	2006-10-03 13:52:28.934454490 +0200
@@ -36,7 +36,7 @@
 echo "[ifconfig]"
 ifconfig -a
 echo "[route]"
-netstat -r
+netstat -rn
 echo "[netstat]"
 netstat -s
 echo "[ports]"
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/client/hobbitclient-darwin.sh ./client/hobbitclient-darwin.sh
--- /home/henrik/hobbit/release/hobbit-4.2.0/client/hobbitclient-darwin.sh	2006-08-09 22:09:58.000000000 +0200
+++ ./client/hobbitclient-darwin.sh	2006-10-03 13:52:28.944452670 +0200
@@ -33,7 +33,7 @@
 echo "[ifconfig]"
 ifconfig -a
 echo "[route]"
-netstat -r
+netstat -rn
 echo "[netstat]"
 netstat -s
 echo "[ifstat]"
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/client/hobbitclient-sunos.sh ./client/hobbitclient-sunos.sh
--- /home/henrik/hobbit/release/hobbit-4.2.0/client/hobbitclient-sunos.sh	2006-08-09 22:09:58.000000000 +0200
+++ ./client/hobbitclient-sunos.sh	2006-10-03 12:55:27.000000000 +0200
@@ -22,7 +22,7 @@
 
 echo "[df]"
 # All of this because Solaris df cannot show multiple fs-types, or exclude certain fs types.
-FSTYPES=`/bin/df -n -l|awk '{print $3}'|egrep -v "^proc|^fd|^mntfs|^ctfs|^devfs|^objfs|^nfs"|sort|uniq`
+FSTYPES=`/bin/df -n -l|awk '{print $3}'|egrep -v "^proc|^fd|^mntfs|^ctfs|^devfs|^objfs|^nfs|^lofs"|sort|uniq`
 if test "$FSTYPES" = ""; then FSTYPES="ufs"; fi
 set $FSTYPES
 /bin/df -F $1 -k | grep -v " /var/run"
@@ -54,14 +54,13 @@
 echo "[ps]"
 ps -A -o pid,ppid,user,stime,s,pri,pcpu,time,pmem,rss,vsz,args
 
-# $TOP must be set, the install utility should do that for us if it exists.
-if test "$TOP" != ""
+# If TOP is defined, then use it. If not, fall back to the Solaris prstat command.
+echo "[top]"
+if test "$TOP" != "" -a -x "$TOP"
 then
-    if test -x "$TOP"
-    then
-        echo "[top]"
-        $TOP -b 20
-    fi
+	"$TOP" -b 20
+else
+	prstat -can 20 1 1
 fi
 
 # vmstat and iostat (iostat -d provides a cpu utilisation with I/O wait number)
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/client/logfetch.c ./client/logfetch.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/client/logfetch.c	2006-08-09 22:09:58.000000000 +0200
+++ ./client/logfetch.c	2006-10-03 13:52:28.979446300 +0200
@@ -52,8 +52,10 @@
 	long lastpos[POSCOUNT];
 	long maxbytes;
 #endif
-	char *trigger;
-	char *ignore;
+	char **trigger;
+	int triggercount;
+	char **ignore;
+	int ignorecount;
 } logdef_t;
 
 typedef struct filedef_t {
@@ -111,7 +113,7 @@
 	int openerr, i, status, triggerlinecount, done;
 	char *linepos[2*LINES_AROUND_TRIGGER+1];
 	int lpidx;
-	regex_t ignexpr, trigexpr;
+	regex_t *ignexpr = NULL, *trigexpr = NULL;
 #ifdef _LARGEFILE_SOURCE
 	off_t bufsz;
 #else
@@ -188,13 +190,21 @@
 	}
 
 	/* Compile the regex patterns */
-	if (logdef->ignore) {
-		status = regcomp(&ignexpr, logdef->ignore, REG_EXTENDED|REG_ICASE|REG_NOSUB);
-		if (status != 0) logdef->ignore = NULL;
-	}
-	if (logdef->trigger) {
-		status = regcomp(&trigexpr, logdef->trigger, REG_EXTENDED|REG_ICASE|REG_NOSUB);
-		if (status != 0) logdef->trigger = NULL;
+	if (logdef->ignorecount) {
+		int i;
+		ignexpr = (regex_t *) malloc(logdef->ignorecount * sizeof(regex_t));
+		for (i=0; (i < logdef->ignorecount); i++) {
+			status = regcomp(&ignexpr[i], logdef->ignore[i], REG_EXTENDED|REG_ICASE|REG_NOSUB);
+			if (status != 0) logdef->ignore[i] = NULL;
+		}
+	}
+	if (logdef->triggercount) {
+		int i;
+		trigexpr = (regex_t *) malloc(logdef->triggercount * sizeof(regex_t));
+		for (i=0; (i < logdef->triggercount); i++) {
+			status = regcomp(&trigexpr[i], logdef->trigger[i], REG_EXTENDED|REG_ICASE|REG_NOSUB);
+			if (status != 0) logdef->trigger[i] = NULL;
+		}
 	}
 	triggerstartpos = triggerendpos = NULL;
 	triggerlinecount = 0;
@@ -222,17 +232,27 @@
 		}
 
 		/* Check ignore pattern */
-		if (logdef->ignore) {
-			status = regexec(&ignexpr, fillpos, 0, NULL, 0);
-			if (status == 0) continue;
+		if (logdef->ignorecount) {
+			int i, match = 0;
+
+			for (i=0; ((i < logdef->ignorecount) && !match); i++) {
+				match = (regexec(&ignexpr[i], fillpos, 0, NULL, 0) == 0);
+			}
+
+			if (match) continue;
 		}
 
 		linepos[lpidx] = fillpos;
 
 		/* See if this is a trigger line */
-		if (logdef->trigger) {
-			status = regexec(&trigexpr, fillpos, 0, NULL, 0);
-			if (status == 0) {
+		if (logdef->triggercount) {
+			int i, match = 0;
+
+			for (i=0; ((i < logdef->ignorecount) && !match); i++) {
+				match = (regexec(&trigexpr[i], fillpos, 0, NULL, 0) == 0);
+			}
+
+			if (match) {
 				int sidx;
 				
 				sidx = lpidx - LINES_AROUND_TRIGGER; 
@@ -270,6 +290,7 @@
 	if (bytesread > logdef->maxbytes) {
 		char *skiptxt = "<...SKIPPED...>\n";
 
+		/* FIXME: Must make sure to only pass complete lines back to the server */
 		if (triggerstartpos) {
 			/* Skip the beginning of the data up until the trigger was found */
 			startpos = triggerstartpos;
@@ -322,8 +343,24 @@
 
 cleanup:
 	if (fd) fclose(fd);
-	if (logdef->ignore) regfree(&ignexpr);
-	if (logdef->trigger) regfree(&trigexpr);
+
+	{
+		int i;
+
+		if (logdef->ignorecount) {
+			for (i=0; (i < logdef->ignorecount); i++) {
+				if (logdef->ignore[i]) regfree(&ignexpr[i]);
+			}
+			xfree(ignexpr);
+		}
+
+		if (logdef->triggercount) {
+			for (i=0; (i < logdef->triggercount); i++) {
+				if (logdef->trigger[i]) regfree(&trigexpr[i]);
+			}
+			xfree(trigexpr);
+		}
+	}
 
 	return startpos;
 }
@@ -707,12 +744,33 @@
 					checkdef_t *walk = currcfg;
 
 					do {
-						walk->check.logcheck.ignore = strdup(p);
+						walk->check.logcheck.ignorecount++;
+						if (walk->check.logcheck.ignore == NULL) {
+							walk->check.logcheck.ignore = (char **)malloc(sizeof(char *));
+						}
+						else {
+							walk->check.logcheck.ignore = 
+								(char **)realloc(walk->check.logcheck.ignore, 
+										 walk->check.logcheck.ignorecount * sizeof(char **));
+						}
+
+						walk->check.logcheck.ignore[walk->check.logcheck.ignorecount-1] = strdup(p);
+
 						walk = walk->next;
 					} while (walk && (walk != firstpipeitem->next));
 				}
 				else {
-					currcfg->check.logcheck.ignore = strdup(p);
+					currcfg->check.logcheck.ignorecount++;
+					if (currcfg->check.logcheck.ignore == NULL) {
+						currcfg->check.logcheck.ignore = (char **)malloc(sizeof(char *));
+					}
+					else {
+						currcfg->check.logcheck.ignore = 
+							(char **)realloc(currcfg->check.logcheck.ignore, 
+									 currcfg->check.logcheck.ignorecount * sizeof(char **));
+					}
+
+					currcfg->check.logcheck.ignore[currcfg->check.logcheck.ignorecount-1] = strdup(p);
 				}
 			}
 			else if (strncmp(bol, "trigger ", 8) == 0) {
@@ -725,12 +783,33 @@
 					checkdef_t *walk = currcfg;
 
 					do {
-						walk->check.logcheck.trigger = strdup(p);
+						walk->check.logcheck.triggercount++;
+						if (walk->check.logcheck.trigger == NULL) {
+							walk->check.logcheck.trigger = (char **)malloc(sizeof(char *));
+						}
+						else {
+							walk->check.logcheck.trigger = 
+								(char **)realloc(walk->check.logcheck.trigger, 
+										 walk->check.logcheck.triggercount * sizeof(char **));
+						}
+
+						walk->check.logcheck.trigger[walk->check.logcheck.triggercount-1] = strdup(p);
+
 						walk = walk->next;
 					} while (walk && (walk != firstpipeitem->next));
 				}
 				else {
-					currcfg->check.logcheck.trigger = strdup(p);
+					currcfg->check.logcheck.triggercount++;
+					if (currcfg->check.logcheck.trigger == NULL) {
+						currcfg->check.logcheck.trigger = (char **)malloc(sizeof(char *));
+					}
+					else {
+						currcfg->check.logcheck.trigger = 
+							(char **)realloc(currcfg->check.logcheck.trigger, 
+									 currcfg->check.logcheck.triggercount * sizeof(char **));
+					}
+
+					currcfg->check.logcheck.trigger[currcfg->check.logcheck.triggercount-1] = strdup(p);
 				}
 			}
 		}
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/client/msgcache.c ./client/msgcache.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/client/msgcache.c	2006-08-09 22:09:58.000000000 +0200
+++ ./client/msgcache.c	2006-10-03 12:55:27.000000000 +0200
@@ -440,7 +440,9 @@
 			freestrbuffer(zombie->msgbuf);
 			xfree(zombie);
 		}
-		if (!chead) ctail = NULL;
+		ctail = chead;
+		if (ctail) { while (ctail->next) ctail = ctail->next; }
+
 
 		/* Remove expired messages */
 		qwalk = qhead; qprev = NULL;
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/client/runclient.sh ./client/runclient.sh
--- /home/henrik/hobbit/release/hobbit-4.2.0/client/runclient.sh	2006-08-09 22:09:58.000000000 +0200
+++ ./client/runclient.sh	2006-10-03 12:55:27.000000000 +0200
@@ -76,7 +76,7 @@
 
   	if test -s $HOBBITCLIENTHOME/logs/clientlaunch.$MACHINEDOTS.pid; then
 		echo "Hobbit client already running, re-starting it"
-		$0 stop
+		$0 --hostname="$MACHINEDOTS" stop
 		rm -f $HOBBITCLIENTHOME/logs/clientlaunch.$MACHINEDOTS.pid
 	fi
 
@@ -99,12 +99,12 @@
 
   "restart")
   	if test -s $HOBBITCLIENTHOME/logs/clientlaunch.$MACHINEDOTS.pid; then
-		$0 stop
+		$0 --hostname="$MACHINEDOTS" stop
 	else
 		echo "Hobbit client not running, continuing to start it"
 	fi
 
-	$0 start
+	$0 --hostname="$MACHINEDOTS" --os="$BBOSTYPE" start
 	;;
 
   "status")
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/common/bb-hosts.5 ./common/bb-hosts.5
--- /home/henrik/hobbit/release/hobbit-4.2.0/common/bb-hosts.5	2006-08-09 22:09:59.000000000 +0200
+++ ./common/bb-hosts.5	2006-10-03 12:55:27.000000000 +0200
@@ -494,7 +494,7 @@
 tool; the values specified in the "ssldays" tag overrides
 the default.
 
-.IP DOWNTIME=day:starttime:endtime:cause[,day:starttime:endtime:cause]
+.IP DOWNTIME=[columns:]day:starttime:endtime:cause[,day:starttime:endtime:cause]
 This tag can be used to ignore failed checks during
 specific times of the day - e.g. if you run services that
 are only monitored e.g. Mon-Fri 8am-5pm, or you always 
@@ -506,6 +506,10 @@
 will not be triggered and the downtime is not counted in the 
 availability calculations generated by the Hobbit reports.
 
+The "columns" setting is optional - it may be a comma-separated
+list of status columns in which case the DOWNTIME setting only applies
+to these columns.
+
 The "cause" string (optional) is a text that will be displayed on 
 the status web page to explain thy the system is down.
 
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/configure.server ./configure.server
--- /home/henrik/hobbit/release/hobbit-4.2.0/configure.server	2006-08-09 22:10:23.000000000 +0200
+++ ./configure.server	2006-10-03 13:52:28.988444662 +0200
@@ -316,13 +316,16 @@
 echo "top-level directory. I can set this up if you tell me"
 echo "what group-ID your webserver runs with. This is typically"
 echo "'nobody' or 'apache' or 'www-data'"
-echo "If you dont know, just hit ENTER and we will handle it later."
 echo ""
-echo "What group-ID does your webserver use ?"
+echo "What group-ID does your webserver use [nobody] ?"
 if test -z "$HTTPDGID"
 then
 	read HTTPDGID
 fi
+if test -z "$HTTPDGID"
+then
+	HTTPDGID="nobody"
+fi
 echo ""; echo ""
 
 echo "Where to put the Hobbit logfiles [/var/log/hobbit] ? "
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/hobbitd/Makefile ./hobbitd/Makefile
--- /home/henrik/hobbit/release/hobbit-4.2.0/hobbitd/Makefile	2006-08-09 22:10:05.000000000 +0200
+++ ./hobbitd/Makefile	2006-10-03 13:52:28.957450304 +0200
@@ -1,4 +1,4 @@
-PROGRAMS = hobbit.sh hobbitd hobbitd_channel hobbitd_filestore hobbitd_history hobbitd_alert hobbitd_rrd hobbitd_sample hobbitd_client hobbitd_hostdata hobbitd_capture hobbitfetch hobbit-mailack trimhistory bbcombotest hobbitreports.sh moverrd.sh
+PROGRAMS = hobbit.sh hobbitd hobbitd_channel hobbitd_filestore hobbitd_history hobbitd_alert hobbitd_rrd hobbitd_sample hobbitd_client hobbitd_hostdata hobbitd_capture hobbitfetch hobbit-mailack trimhistory bbcombotest hobbitreports.sh moverrd.sh convertnk
 CLIENTPROGRAMS = ../client/hobbitd_client
 
 LIBOBJS = ../lib/libbbgen.a
@@ -17,7 +17,7 @@
 MAILACKOBJS   = hobbit-mailack.o
 TRIMHISTOBJS  = trimhistory.o
 FETCHOBJS     = hobbitfetch.o
-
+CONVERTNKOBJS = convertnk.o
 
 IDTOOL := $(shell if test `uname -s` = "SunOS"; then echo /usr/xpg4/bin/id; else echo id; fi)
 
@@ -91,6 +91,9 @@
 hobbitfetch: $(FETCHOBJS) $(LIBOBJS)
 	$(CC) $(CFLAGS) -o $@ $(RPATHOPT) $(FETCHOBJS) $(LIBOBJS) $(NETLIBS)
 
+convertnk: $(CONVERTNKOBJS) $(LIBOBJS)
+	$(CC) $(CFLAGS) -o $@ $(RPATHOPT) $(CONVERTNKOBJS) $(LIBOBJS) $(NETLIBS)
+
 hobbit.sh: hobbit.sh.DIST
 	cat $< | sed -e 's!@BBHOME@!$(BBHOME)!g' | sed -e 's!@BBLOGDIR@!$(BBLOGDIR)!g' | sed -e 's!@BBUSER@!$(BBUSER)!g' | sed -e 's!@RUNTIMEDEFS@!$(RUNTIMEDEFS)!g' >$@
 	chmod 755 $@
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/hobbitd/client_config.c ./hobbitd/client_config.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/hobbitd/client_config.c	2006-08-09 22:10:05.000000000 +0200
+++ ./hobbitd/client_config.c	2006-10-03 12:55:27.000000000 +0200
@@ -1249,6 +1249,7 @@
 	*abswarn = 0;
 	*abspanic = 0;
 	*ignored = 0;
+	*group = NULL;
 
 	rule = getrule(hostname, pagename, classname, C_DISK);
 	while (rule && !namematch(fsname, rule->rule.disk.fsexp->pattern, rule->rule.disk.fsexp->exp)) {
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/hobbitd/convertnk.c ./hobbitd/convertnk.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/hobbitd/convertnk.c	1970-01-01 01:00:00.000000000 +0100
+++ ./hobbitd/convertnk.c	2006-10-03 13:52:28.964449030 +0200
@@ -0,0 +1,54 @@
+/*----------------------------------------------------------------------------*/
+/* Hobbit utility to convert the deprecated NK tags to a hobbit-nkview.cfg    */
+/*                                                                            */
+/* Copyright (C) 2006 Henrik Storner <henrik@hswn.dk>                         */
+/*                                                                            */
+/* This program is released under the GNU General Public License (GPL),       */
+/* version 2. See the file "COPYING" for details.                             */
+/*                                                                            */
+/*----------------------------------------------------------------------------*/
+
+static char rcsid[] = "$Id: convertnk.c,v 1.1 2006/09/12 21:27:11 henrik Exp $";
+
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+
+#include "libbbgen.h"
+
+int main(int argc, char *argv[])
+{
+	namelist_t *walk;
+
+	load_hostnames(xgetenv("BBHOSTS"), NULL, get_fqdn());
+
+	for (walk = first_host(); (walk); walk=walk->next) {
+		char *nk, *nktime, *tok;
+
+		nk = bbh_item(walk, BBH_NK); if (!nk) continue;
+		nktime = bbh_item(walk, BBH_NKTIME);
+
+		nk = strdup(nk);
+
+		tok = strtok(nk, ",");
+		while (tok) {
+			char *hostname = bbh_item(walk, BBH_HOSTNAME);
+			char *startstr = "", *endstr = "", *ttgroup = "", *ttextra = "", *updinfo = "Migrated";
+			int priority = 2;
+
+			fprintf(stdout, "%s|%s|%s|%s|%s|%d|%s|%s|%s\n",
+				hostname, tok,
+				startstr, endstr,
+				(nktime ? nktime : ""),
+				priority, ttgroup, ttextra, updinfo);
+
+			tok = strtok(NULL, ",");
+		}
+
+		xfree(nk);
+	}
+
+	return 0;
+}
+
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/hobbitd/do_alert.c ./hobbitd/do_alert.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/hobbitd/do_alert.c	2006-08-09 22:10:05.000000000 +0200
+++ ./hobbitd/do_alert.c	2006-10-03 12:55:27.000000000 +0200
@@ -168,7 +168,7 @@
 
 static char *message_text(activealerts_t *alert, recip_t *recip)
 {
-	strbuffer_t *buf = NULL;
+	static strbuffer_t *buf = NULL;
 	char *eoln, *bom, *p;
 	char info[4096];
 
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/hobbitd/hobbitd.c ./hobbitd/hobbitd.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/hobbitd/hobbitd.c	2006-08-09 22:10:05.000000000 +0200
+++ ./hobbitd/hobbitd.c	2006-10-03 13:52:28.880464317 +0200
@@ -124,7 +124,7 @@
 typedef struct hobbitd_hostlist_t {
 	char *hostname;
 	char ip[IP_ADDR_STRLEN];
-	enum { H_NORMAL, H_SUMMARY, H_DIALUP } hosttype;
+	enum { H_NORMAL, H_SUMMARY } hosttype;
 	hobbitd_log_t *logs;
 	hobbitd_log_t *pinglog; /* Points to entry in logs list, but we need it often */
 	time_t clientmsgtstamp;
@@ -431,7 +431,6 @@
 	hitem->hostname = strdup(hostname);
 	strcpy(hitem->ip, ip);
 	if (strcmp(hostname, "summary") == 0) hitem->hosttype = H_SUMMARY;
-	else if (strcmp(hostname, "dialup") == 0) hitem->hosttype = H_DIALUP;
 	else hitem->hosttype = H_NORMAL;
 	rbtInsert(rbhosts, hitem->hostname, hitem);
 
@@ -2787,7 +2786,7 @@
 				continue;
 			}
 
-			/* If there is a hostname filter, drop the "summary" and "dialup 'hosts' */
+			/* If there is a hostname filter, drop the "summary" 'hosts' */
 			if (shost && (hwalk->hosttype != H_NORMAL)) continue;
 
 			firstlog = hwalk->logs;
@@ -2953,7 +2952,7 @@
 		if (!oksender(wwwsenders, NULL, msg->addr.sin_addr, msg->buf)) goto done;
 
 		setup_filter(msg->buf, 
-			     "BBH_HOSTNAME,BBH_IP,BBH_BANKSIZE,BBH_RAW",
+			     "BBH_HOSTNAME,BBH_IP,BBH_RAW",
 			     &spage, &shost, &snet, &stest, &scolor, &acklevel, &fields,
 			     &chspage, &chshost, &chsnet, &chstest);
 
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/hobbitd/hobbitd_alert.c ./hobbitd/hobbitd_alert.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/hobbitd/hobbitd_alert.c	2006-08-09 22:10:05.000000000 +0200
+++ ./hobbitd/hobbitd_alert.c	2006-10-03 12:55:27.000000000 +0200
@@ -124,6 +124,9 @@
 		curr = curr->next;
 
 		if (tmp->state == A_DEAD) {
+			if (tmp->osname) xfree(tmp->osname);
+			if (tmp->classname) xfree(tmp->classname);
+			if (tmp->groups) xfree(tmp->groups);
 			if (tmp->pagemessage) xfree(tmp->pagemessage);
 			if (tmp->ackmessage) xfree(tmp->ackmessage);
 			xfree(tmp);
@@ -285,7 +288,8 @@
 		}
 
 		if (i > 9) {
-			char *key, *valid = NULL;
+			char *valid = NULL;
+
 			activealerts_t *newalert = (activealerts_t *)calloc(1, sizeof(activealerts_t));
 			newalert->hostname = find_name(hostnames, item[0]);
 			newalert->testname = find_name(testnames, item[1]);
@@ -297,10 +301,13 @@
 			newalert->state = A_PAGING;
 
 			if (statusbuf) {
+				char *key;
+
 				key = (char *)malloc(strlen(newalert->hostname) + strlen(newalert->testname) + 100);
 				sprintf(key, "\n%s|%s|%s\n", newalert->hostname, newalert->testname, colorname(newalert->color));
 				valid = strstr(statusbuf, key);
 				if (!valid && (strncmp(statusbuf, key+1, strlen(key+1)) == 0)) valid = statusbuf;
+				xfree(key);
 			}
 			if (!valid) {
 				errprintf("Stale alert for %s:%s dropped\n", newalert->hostname, newalert->testname);
@@ -648,10 +655,12 @@
 
 			strcpy(awalk->ip, metadata[5]);
 			awalk->cookie = atoi(metadata[11]);
+			if (awalk->osname) xfree(awalk->osname);
 			awalk->osname    = (metadata[12] ? strdup(metadata[12]) : NULL);
+			if (awalk->classname) xfree(awalk->classname);
 			awalk->classname = (metadata[13] ? strdup(metadata[13]) : NULL);
+			if (awalk->groups) xfree(awalk->groups);
 			awalk->groups    = (metadata[14] ? strdup(metadata[14]) : NULL);
-
 			if (awalk->pagemessage) xfree(awalk->pagemessage);
 			awalk->pagemessage = strdup(restofmsg);
 		}
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/hobbitd/hobbitd_client.c ./hobbitd/hobbitd_client.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/hobbitd/hobbitd_client.c	2006-08-09 22:10:05.000000000 +0200
+++ ./hobbitd/hobbitd_client.c	2006-10-03 13:52:29.008441022 +0200
@@ -896,7 +896,9 @@
 					swalk->sname+5);
 			}
 			addtobuffer(yellowdata, msgline);
+			addtobuffer(yellowdata, "<pre>\n");
 			addtostrbuffer(yellowdata, logsummary);
+			addtobuffer(yellowdata, "</pre>\n");
 			break;
 
 		  case COL_RED:
@@ -909,7 +911,9 @@
 					swalk->sname+5);
 			}
 			addtobuffer(reddata, msgline);
+			addtobuffer(yellowdata, "<pre>\n");
 			addtostrbuffer(reddata, logsummary);
+			addtobuffer(yellowdata, "</pre>\n");
 			break;
 		}
 
@@ -963,7 +967,9 @@
 				swalk->sname+5);
 		}
 		addtostatus(msgline);
+		addtobuffer(yellowdata, "<pre>\n");
 		addtostatus(swalk->sdata);
+		addtobuffer(yellowdata, "</pre>\n");
 		do { swalk=swalk->next; } while (swalk && strncmp(swalk->sname, "msgs:", 5));
 	}
 
@@ -1490,11 +1496,12 @@
 		else if (strcmp(s, "disk") == 0) {
 			unsigned long warnlevel, paniclevel;
 			int abswarn, abspanic, ignored;
+			char *groups;
 
 			printf("Filesystem: "); fflush(stdout);
 			fgets(s, sizeof(s), stdin); clean_instr(s);
 			cfid = get_disk_thresholds(hinfo, clientclass, s, &warnlevel, &paniclevel, 
-						   &abswarn, &abspanic, &ignored, NULL);
+						   &abswarn, &abspanic, &ignored, &groups);
 			if (ignored) 
 				printf("Ignored\n");
 			else
@@ -1506,6 +1513,7 @@
 			int pchecks = clear_process_counts(hinfo, clientclass);
 			char *pname, *pid;
 			int pcount, pmin, pmax, pcolor, ptrack;
+			char *groups;
 			FILE *fd;
 
 			if (pchecks == 0) {
@@ -1530,7 +1538,7 @@
 				}
 			} while (*s);
 
-			while ((pname = check_process_count(&pcount, &pmin, &pmax, &pcolor, &pid, &ptrack, NULL)) != NULL) {
+			while ((pname = check_process_count(&pcount, &pmin, &pmax, &pcolor, &pid, &ptrack, &groups)) != NULL) {
 				printf("Process %s color %s: Count=%d, min=%d, max=%d\n",
 					pname, colorname(pcolor), pcount, pmin, pmax);
 			}
@@ -1576,6 +1584,7 @@
 		else if (strcmp(s, "port") == 0) {
 			char *localstr, *remotestr, *statestr, *p, *pname, *pid;
 			int pcount, pmin, pmax, pcolor, pchecks, ptrack;
+			char *groups;
 			int localcol = 4, remotecol = 5, statecol = 6, portcolor = COL_GREEN;
 
 			pchecks = clear_port_counts(hinfo, clientclass);
@@ -1619,7 +1628,7 @@
 			} while (*s);
 
 			/* Check the number found for each monitored port */
- 			while ((pname = check_port_count(&pcount, &pmin, &pmax, &pcolor, &pid, &ptrack, NULL)) != NULL) {
+ 			while ((pname = check_port_count(&pcount, &pmin, &pmax, &pcolor, &pid, &ptrack, &groups)) != NULL) {
  				char limtxt[1024];
 			
 				if (pmax == -1) {
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/hobbitd/hobbitfetch.c ./hobbitd/hobbitfetch.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/hobbitd/hobbitfetch.c	2006-08-09 22:10:05.000000000 +0200
+++ ./hobbitd/hobbitfetch.c	2006-10-03 12:55:27.000000000 +0200
@@ -30,6 +30,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
+#include <arpa/nameser.h>
 #include <netdb.h>
 #include <ctype.h>
 #include <signal.h>
@@ -619,14 +620,36 @@
 					ip = strdup(bbh_item(hostwalk, BBH_IP));
 				}
 				else {
+					/* There is an explicit IP setting in the pulldata tag */
 					char *p;
 
 					ip++; /* Skip the '=' */
 					ip = strdup(ip);
 					p = strchr(ip, ':');
 					if (p) { *p = '\0'; port = atoi(p+1); }
+
+					if (*ip == '\0') {
+						/* No IP given, just a port number */
+						xfree(ip);
+						ip = strdup(bbh_item(hostwalk, BBH_IP));
+					}
+				}
+
+				if (strcmp(ip, "0.0.0.0") == 0) {
+					struct hostent *hent;
+
+					xfree(ip); ip = NULL;
+					hent = gethostbyname(clientwalk->hostname);
+					if (hent) {
+						struct in_addr addr;
+
+						memcpy(&addr, *(hent->h_addr_list), sizeof(addr));
+						ip = strdup(inet_ntoa(addr));
+					}
 				}
 
+				if (!ip) continue;
+
 				/* 
 				 * Build the "pullclient" request, which includes the latest
 				 * clientdata config we got from the server. Keep the clientdata
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/hobbitd/rrd/do_ncv.c ./hobbitd/rrd/do_ncv.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/hobbitd/rrd/do_ncv.c	2006-08-09 22:10:06.000000000 +0200
+++ ./hobbitd/rrd/do_ncv.c	2006-10-03 12:55:27.000000000 +0200
@@ -11,7 +11,7 @@
 /*                                                                            */
 /*----------------------------------------------------------------------------*/
 
-static char ncv_rcsid[] = "$Id: do_ncv.c,v 1.10 2006/06/09 22:23:49 henrik Rel $";
+static char ncv_rcsid[] = "$Id: do_ncv.c,v 1.10 2006/06/09 22:23:49 henrik Rel henrik $";
 
 int do_ncv_rrd(char *hostname, char *testname, char *msg, time_t tstamp) 
 { 
@@ -44,11 +44,22 @@
 
 		l += strspn(l, " \t\n");
 		if (*l) { 
+			/* See if this line contains a '=' or ':' sign */
 			name = l; 
-			l += strcspn(l, ":="); 
-			if( *l ) { *l = '\0'; l++; }
-			else break;
+			l += strcspn(l, ":=\n"); 
+
+			if (*l) {
+				if (( *l == '=') || (*l == ':')) { 
+					*l = '\0'; l++;
+				}
+				else {
+					/* No marker, so skip this line */
+					name = NULL;
+				}
+			}
+			else break;	/* We've hit the end of the message */
 		}
+
 		if (name) { 
 			val = l + strspn(l, " \t"); 
 			l = val + strspn(val, "0123456789."); 
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/hobbitd/webfiles/confreport_front ./hobbitd/webfiles/confreport_front
--- /home/henrik/hobbit/release/hobbit-4.2.0/hobbitd/webfiles/confreport_front	2006-08-09 22:10:10.000000000 +0200
+++ ./hobbitd/webfiles/confreport_front	2006-10-03 12:55:27.000000000 +0200
@@ -7,7 +7,6 @@
             <tr><th align=left valign=top width="25%">Aliases</th><td>Names for this host other than the primary name, e.g. a hostname used by a client installed on the server</td></tr>
             <tr><th align=left valign=top width="25%">Monitoring location</th><td>The location of this host on the Hobbit webpages</td></tr>
             <tr><th align=left valign=top width="25%">Comment<br>Description</th><td>Explanatory text about the host</td></tr>
-            <tr><th align=left valign=top width="25%">NK monitoring period</th><td>Time of day/week when the NK-enabled alerts will appear on the NK monitor</td></tr>
             <tr><th align=left valign=top width="25%">Planned downtime</th><td>Time of day/week when the host monitoring is disabled</td></tr>
             <tr><th align=left valign=top width="25%">SLA Reporting Period</th><td>Time of day/week where the status impacts the SLA availability calculation</td></tr>
          </table>
@@ -17,7 +16,7 @@
       <td>
          <table width="100%">
             <tr><th align=left valign=top width="25%">Service</th><td>Corresponds to the column-name on the Hobbit webpage</td></tr>
-            <tr><th align=left valign=top width="25%">NK</th><td>Whether this test appears on the NK view</td></tr>
+            <tr><th align=left valign=top width="25%">Critical</th><td>Whether this test appears on the Critical Systems view</td></tr>
             <tr><th align=left valign=top width="25%">C/Y/R limits</th><td>If set, this is the number of failures that must happen before the status changes to Clear/Yellow/Red</td></tr>
             <tr><th align=left valign=top width="25%">Specifics</th><td>Details about how this status is monitored</td></tr>
          </table>
@@ -27,7 +26,7 @@
       <td>
          <table width="100%">
             <tr><th align=left valign=top width="25%">Service</th><td>Corresponds to the column-name on the Hobbit webpage</td></tr>
-            <tr><th align=left valign=top width="25%">NK</th><td>Whether this test appears on the NK view</td></tr>
+            <tr><th align=left valign=top width="25%">Critical</th><td>Whether this test appears on the Critical view</td></tr>
             <tr><th align=left valign=top width="25%">C/Y/R limits</th><td>If set, this is the number of failures that must happen before the status changes to Clear/Yellow/Red</td></tr>
             <tr><th align=left valign=top width="25%">Configuration</th><td>Details about how this status is monitored. NOTE: The exact thresholds for each test are configured on the client, and may differ from that listed here.</td></tr>
          </table>
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/hobbitd/webfiles/hobbitnk_footer ./hobbitd/webfiles/hobbitnk_footer
--- /home/henrik/hobbit/release/hobbit-4.2.0/hobbitd/webfiles/hobbitnk_footer	2006-08-09 22:10:10.000000000 +0200
+++ ./hobbitd/webfiles/hobbitnk_footer	2006-10-03 12:55:27.000000000 +0200
@@ -17,6 +17,7 @@
        </TD>
        <TD ALIGN=CENTER>
           <SELECT NAME="MINCOLOR">
+	    <OPTION VALUE="purple" &SELECT_MINCOLOR_PURPLE>Red+Yellow+Purple
 	    <OPTION VALUE="yellow" &SELECT_MINCOLOR_YELLOW>Red+Yellow
 	    <OPTION VALUE="red"    &SELECT_MINCOLOR_RED>Red only
 	  </SELECT>
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/hobbitd/webfiles/info_header ./hobbitd/webfiles/info_header
--- /home/henrik/hobbit/release/hobbit-4.2.0/hobbitd/webfiles/info_header	2006-08-09 22:10:10.000000000 +0200
+++ ./hobbitd/webfiles/info_header	2006-10-03 13:52:29.027437564 +0200
@@ -20,6 +20,15 @@
         else
                 field.checked = val;
 }
+
+function mark4Disable(services) {
+	for(i=0; i<document.disableform.disabletest.length; i++) {
+		if (services.indexOf(',' + document.disableform.disabletest.options[i].value + ',') > -1) {
+			document.disableform.disabletest.options[i].selected = !document.disableform.disabletest.options[i].selected;
+		}
+	}
+}
+
 </script>
 
 <script language="JavaScript1.2" type="text/javascript">
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/hobbitd/webfiles/zoom.js ./hobbitd/webfiles/zoom.js
--- /home/henrik/hobbit/release/hobbit-4.2.0/hobbitd/webfiles/zoom.js	2006-08-09 22:10:10.000000000 +0200
+++ ./hobbitd/webfiles/zoom.js	2006-10-03 12:55:27.000000000 +0200
@@ -601,6 +601,7 @@
   var idxCount =  gUrlObj.getUrlParameterValue("count");
   var graphWidth = gUrlObj.getUrlParameterValue("graph_width");
   var graphHeight = gUrlObj.getUrlParameterValue("graph_height");
+  var bgColor = gUrlObj.getUrlParameterValue("color");
 
   if (firstIdx != "") {
      idxStr = "&first=" + firstIdx;
@@ -609,7 +610,7 @@
      countStr = "&count=" + idxCount; 
   }
 
-  open(urlBase + "&host=" + host + "&service=" + service + "&disp=" + dispName + idxStr + countStr + "&graph_start=" + newGraphStart + "&graph_end=" + newGraphEnd + "&graph_height=" + graphHeight + "&graph_width=" + graphWidth, "_self");
+  open(urlBase + "&host=" + host + "&service=" + service + "&disp=" + dispName + idxStr + countStr + "&graph_start=" + newGraphStart + "&graph_end=" + newGraphEnd + "&graph_height=" + graphHeight + "&graph_width=" + graphWidth + "&color=" + bgColor, "_self");
  }
 
  if ((gMouseObj.leftButtonPressed()) && (gMouseObj.dragging)) {
@@ -655,6 +656,7 @@
    var idxCount =  gUrlObj.getUrlParameterValue("count");
    var graphWidth = gUrlObj.getUrlParameterValue("graph_width");
    var graphHeight = gUrlObj.getUrlParameterValue("graph_height");
+   var bgColor = gUrlObj.getUrlParameterValue("color");
 
    if (firstIdx != "") {
       idxStr = "&first=" + firstIdx;
@@ -663,7 +665,7 @@
       countStr = "&count=" + idxCount; 
    }
 
-   open(urlBase + "&host=" + host + "&service=" + service + "&disp=" + dispName + idxStr + countStr + "&graph_start=" + newGraphStart + "&graph_end=" + newGraphEnd + "&graph_height=" + graphHeight + "&graph_width=" + graphWidth, "_self");
+   open(urlBase + "&host=" + host + "&service=" + service + "&disp=" + dispName + idxStr + countStr + "&graph_start=" + newGraphStart + "&graph_end=" + newGraphEnd + "&graph_height=" + graphHeight + "&graph_width=" + graphWidth + "&color=" + bgColor, "_self");
   }
  }
 }
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/hobbitd/wwwfiles/menu/menu_items.js.DIST ./hobbitd/wwwfiles/menu/menu_items.js.DIST
--- /home/henrik/hobbit/release/hobbit-4.2.0/hobbitd/wwwfiles/menu/menu_items.js.DIST	2006-08-09 22:10:08.000000000 +0200
+++ ./hobbitd/wwwfiles/menu/menu_items.js.DIST	2006-10-03 12:55:27.000000000 +0200
@@ -9,6 +9,7 @@
 		['Availability Report', '@BBCGIURL@/bb-rep.sh'],
 		['Snapshot Report', '@BBCGIURL@/bb-snapshot.sh'],
 		['Config Report', '@BBCGIURL@/hobbit-confreport.sh'],
+		['Config Report (Critical)', '@BBCGIURL@/hobbit-confreport-critical.sh'],
 		['Metrics Report', '@BBCGIURL@/hobbit-hostgraphs.sh'],
 		['Ghost Clients', '@BBCGIURL@/hobbit-ghosts.sh'],
 	],
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/lib/Makefile ./lib/Makefile
--- /home/henrik/hobbit/release/hobbit-4.2.0/lib/Makefile	2006-08-09 22:10:16.000000000 +0200
+++ ./lib/Makefile	2006-10-03 12:55:27.000000000 +0200
@@ -3,7 +3,7 @@
 
 BBGENLIBOBJS = osdefs.o acklog.o availability.o calc.o cgi.o cgiurls.o clientlocal.o color.o digest.o encoding.o environ.o errormsg.o eventlog.o files.o headfoot.o hobbitrrd.o htmllog.o ipaccess.o loadalerts.o loadhosts.o loadnkconf.o links.o matching.o md5.o memory.o misc.o netservices.o rbtr.o reportlog.o rmd160c.o sendmsg.o sha1.o sig.o stackio.o strfunc.o suid.o timefunc.o timing.o url.o
 
-CLIENTLIBOBJS = osdefs.o cgiurls.o color.o digest.o encoding.o environ-client.o errormsg.o ipaccess.o loadhosts.o md5.o memory.o misc.o rbtr.o rmd160c.o sendmsg.o sha1.o sig.o stackio.o strfunc.o suid.o timefunc.o
+CLIENTLIBOBJS = osdefs.o cgiurls.o color-client.o digest.o encoding.o environ-client.o errormsg.o ipaccess.o loadhosts.o md5.o memory.o misc.o rbtr.o rmd160c.o sendmsg.o sha1.o sig.o stackio.o strfunc.o suid.o timefunc-client.o
 ifeq ($(LOCALCLIENT),yes)
 	CLIENTLIBOBJS += matching.o
 endif
@@ -53,6 +53,12 @@
 environ-client.o: environ.c
 	$(CC) $(CFLAGS) -DBBTOPDIR=\"$(BBTOPDIR)\" -DBBLOGDIR=\"$(BBLOGDIR)\" -DBBHOSTNAME=\"$(BBHOSTNAME)\" -DBBHOSTIP=\"$(BBHOSTIP)\" -DBBHOSTOS=\"$(BBHOSTOS)\" -DBUILD_HOME=\"$(BBTOPDIR)/client\" -c -o $@ environ.c
 
+color-client.o: color.c
+	$(CC) $(CFLAGS) -DCLIENTONLY -c -o $@ $<
+
+timefunc-client.o: timefunc.c
+	$(CC) $(CFLAGS) -DCLIENTONLY -c -o $@ $<
+
 loadhosts: loadhosts.c libbbgen.a
 	$(CC) $(CFLAGS) -DSTANDALONE -o $@ loadhosts.c ./libbbgen.a
 
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/lib/cgi.c ./lib/cgi.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/lib/cgi.c	2006-08-09 22:10:15.000000000 +0200
+++ ./lib/cgi.c	2006-10-03 12:55:27.000000000 +0200
@@ -139,7 +139,7 @@
 			token = strtok(NULL, "&");
 		}
 	}
-	else if ((cgi_method == CGI_POST) || (conttype && (strcasecmp(conttype, "multipart/form-data") == 0))) {
+	else if ((cgi_method == CGI_POST) && (conttype && (strcasecmp(conttype, "multipart/form-data") == 0))) {
 		char *bol, *eoln, *delim;
 		char eolnchar = '\n';
 		char *currelembegin = NULL, *currelemend = NULL;
@@ -252,3 +252,32 @@
 	return head;
 }
 
+char *get_cookie(char *cookiename)
+{
+	static char *ckdata = NULL;
+	char *tok, *p;
+	int n;
+
+	/* If no cookie, just return NULL */
+	p = getenv("HTTP_COOKIE");
+	if (!p) return NULL;
+
+	if (ckdata) xfree(ckdata);
+	n = strlen(cookiename);
+
+	/* Split the cookie variable into elements, separated by ";" and possible space. */
+	ckdata = strdup(p);
+	tok = strtok(ckdata, "; ");
+	while (tok) {
+		if ((strncmp(cookiename, tok, n) == 0) && (*(tok+n) == '=')) {
+			/* Got it */
+			return (tok+n+1);
+		}
+
+		tok = strtok(NULL, "; ");
+	}
+
+	xfree(ckdata); ckdata = NULL;
+	return NULL;
+}
+
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/lib/cgi.h ./lib/cgi.h
--- /home/henrik/hobbit/release/hobbit-4.2.0/lib/cgi.h	2006-08-09 22:10:15.000000000 +0200
+++ ./lib/cgi.h	2006-10-03 12:55:27.000000000 +0200
@@ -23,6 +23,7 @@
 
 extern char *cgi_error(void);
 extern cgidata_t *cgi_request(void);
+extern char *get_cookie(char *cookiename);
 
 #endif
 
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/lib/color.c ./lib/color.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/lib/color.c	2006-08-09 22:10:16.000000000 +0200
+++ ./lib/color.c	2006-10-03 12:55:27.000000000 +0200
@@ -111,6 +111,7 @@
 	return filename;
 }
 
+#ifndef CLIENTONLY
 int colorset(char *colspec, int excludeset)
 {
 	char *cspeccopy = strdup(colspec);
@@ -131,4 +132,5 @@
 	ac = (ac & ~excludeset);
 	return ac;
 }
+#endif
 
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/lib/headfoot.c ./lib/headfoot.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/lib/headfoot.c	2006-08-09 22:10:16.000000000 +0200
+++ ./lib/headfoot.c	2006-10-03 13:52:28.892462134 +0200
@@ -316,7 +316,7 @@
 	walk = statusboard;
 	while (walk) {
 		eoln = strchr(walk, '\n'); if (eoln) *eoln = '\0';
-		if (strlen(walk) && (strncmp(walk, "summary|", 8) != 0) && (strncmp(walk, "dialup|", 7) != 0)) {
+		if (strlen(walk) && (strncmp(walk, "summary|", 8) != 0)) {
 			char *buf, *hname = NULL, *tname = NULL;
 			treerec_t *newrec;
 
@@ -1233,8 +1233,6 @@
 		inbuf[st.st_size] = '\0';
 		close(formfile);
 
-		printf("Content-Type: %s\n\n", xgetenv("HTMLCONTENTTYPE"));
-
 		headfoot(output, headertemplate, "", "header", color);
 		if (pretext) fprintf(output, "%s", pretext);
 		output_parsed(output, inbuf, color, seltime);
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/lib/hobbitrrd.c ./lib/hobbitrrd.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/lib/hobbitrrd.c	2006-08-09 22:10:16.000000000 +0200
+++ ./lib/hobbitrrd.c	2006-10-03 12:55:27.000000000 +0200
@@ -194,7 +194,7 @@
 }
 
 
-static char *hobbit_graph_text(char *hostname, char *dispname, char *service, 
+static char *hobbit_graph_text(char *hostname, char *dispname, char *service, int bgcolor,
 			      hobbitgraph_t *graphdef, int itemcount, hg_stale_rrds_t nostale, const char *fmt)
 {
 	static char *rrdurl = NULL;
@@ -273,6 +273,7 @@
 			strcat(svcurl, urlencode(dispname ? dispname : hostname));
 
 			if (nostale == HG_WITHOUT_STALE_RRDS) strcat(svcurl, "&amp;nostale");
+			if (bgcolor != -1) sprintf(svcurl+strlen(svcurl), "&amp;color=%s", colorname(bgcolor));
 
 			sprintf(rrdparturl, fmt, rrdservicename, svcurl, svcurl, rrdservicename, svcurl, xgetenv("BBSKIN"));
 			if ((strlen(rrdparturl) + strlen(rrdurl) + 1) >= rrdurlsize) {
@@ -294,12 +295,12 @@
 	return rrdurl;
 }
 
-char *hobbit_graph_data(char *hostname, char *dispname, char *service, 
+char *hobbit_graph_data(char *hostname, char *dispname, char *service, int bgcolor,
 			hobbitgraph_t *graphdef, int itemcount,
 			hg_stale_rrds_t nostale, hg_link_t wantmeta)
 {
 	return hobbit_graph_text(hostname, dispname, 
-				 service, graphdef, 
+				 service, bgcolor, graphdef, 
 				 itemcount, nostale,
 				 ((wantmeta == HG_META_LINK) ? metafmt : hobbitlinkfmt));
 }
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/lib/hobbitrrd.h ./lib/hobbitrrd.h
--- /home/henrik/hobbit/release/hobbit-4.2.0/lib/hobbitrrd.h	2006-08-09 22:10:16.000000000 +0200
+++ ./lib/hobbitrrd.h	2006-10-03 12:55:27.000000000 +0200
@@ -37,7 +37,8 @@
 
 extern hobbitrrd_t *find_hobbit_rrd(char *service, char *flags);
 extern hobbitgraph_t *find_hobbit_graph(char *rrdname);
-extern char *hobbit_graph_data(char *hostname, char *dispname, char *service, hobbitgraph_t *graphdef, int itemcount, 
+extern char *hobbit_graph_data(char *hostname, char *dispname, char *service, int bgcolor,
+		hobbitgraph_t *graphdef, int itemcount, 
 		hg_stale_rrds_t nostale, hg_link_t wantmeta);
 
 #endif
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/lib/htmllog.c ./lib/htmllog.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/lib/htmllog.c	2006-08-09 22:10:16.000000000 +0200
+++ ./lib/htmllog.c	2006-10-03 12:55:27.000000000 +0200
@@ -358,7 +358,7 @@
 		xfree(multikey);
 
 		fprintf(output, "<!-- linecount=%d -->\n", linecount);
-		fprintf(output, "%s\n", hobbit_graph_data(hostname, displayname, service, graph, linecount, HG_WITHOUT_STALE_RRDS, HG_PLAIN_LINK));
+		fprintf(output, "%s\n", hobbit_graph_data(hostname, displayname, service, color, graph, linecount, HG_WITHOUT_STALE_RRDS, HG_PLAIN_LINK));
 	}
 
 	if (histlocation == HIST_BOTTOM) {
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/lib/loadhosts.c ./lib/loadhosts.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/lib/loadhosts.c	2006-08-09 22:10:16.000000000 +0200
+++ ./lib/loadhosts.c	2006-10-03 13:52:28.905459768 +0200
@@ -134,7 +134,6 @@
 
 	bbh_item_name[BBH_IP]                  = "BBH_IP";
 	bbh_item_name[BBH_CLIENTALIAS]         = "BBH_CLIENTALIAS";
-	bbh_item_name[BBH_BANKSIZE]            = "BBH_BANKSIZE";
 	bbh_item_name[BBH_HOSTNAME]            = "BBH_HOSTNAME";
 	bbh_item_name[BBH_PAGENAME]            = "BBH_PAGENAME";
 	bbh_item_name[BBH_PAGEPATH]            = "BBH_PAGEPATH";
@@ -300,9 +299,8 @@
 	/* If default method, just say yes */
 	if (ghosthandling == 0) return result;
 
-	/* Allow all summaries and modembanks */
+	/* Allow all summaries */
 	if (strcmp(hostname, "summary") == 0) return result;
-	if (strcmp(hostname, "dialup") == 0) return result;
 
 	return (walk ? result : NULL);
 }
@@ -403,11 +401,6 @@
 		  else return bbh_find_item(host, item);
 		  break;
 
-	  case BBH_BANKSIZE:
-		  if (host->banksize == 0) return NULL;
-		  sprintf(inttxt, "%d", host->banksize);
-		  return inttxt;
-
 	  case BBH_HOSTNAME: 
 		  return host->bbhostname;
 
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/lib/loadhosts.h ./lib/loadhosts.h
--- /home/henrik/hobbit/release/hobbit-4.2.0/lib/loadhosts.h	2006-08-09 22:10:16.000000000 +0200
+++ ./lib/loadhosts.h	2006-10-03 13:52:28.915457948 +0200
@@ -53,7 +53,6 @@
 	BBH_LDAPLOGIN,
 	BBH_IP,
 	BBH_HOSTNAME,
-	BBH_BANKSIZE,
 	BBH_DOCURL,
 	BBH_NOPROP,
 	BBH_PAGEINDEX,
@@ -80,7 +79,6 @@
 	char *bbhostname;	/* Name for item 2 of bb-hosts */
 	char *logname;		/* Name of the host directory in BBHISTLOGS (underscores replaces dots). */
 	int preference;		/* For host with multiple entries, mark if we have the preferred one */
-	int banksize;		/* For modem-bank entries only */
 	pagelist_t *page;	/* Host location in the page/subpage/subparent tree */
 	void *data;		/* Misc. data supplied by the user of this library function */
 	struct namelist_t *defaulthost;	/* Points to the latest ".default." host */
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/lib/loadhosts_file.c ./lib/loadhosts_file.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/lib/loadhosts_file.c	2006-08-09 22:10:16.000000000 +0200
+++ ./lib/loadhosts_file.c	2006-10-03 13:52:28.926455946 +0200
@@ -49,7 +49,7 @@
 {
 	static void *bbhfiles = NULL;
 	FILE *bbhosts;
-	int ip1, ip2, ip3, ip4, banksize, groupid, pageidx;
+	int ip1, ip2, ip3, ip4, groupid, pageidx;
 	char hostname[4096];
 	strbuffer_t *inbuf;
 	pagelist_t *curtoppage, *curpage, *pgtail;
@@ -285,30 +285,6 @@
 			MEMUNDEFINE(clientname);
 			MEMUNDEFINE(downtime);
 		}
-		else if (sscanf(STRBUF(inbuf), "dialup %s %d.%d.%d.%d %d", hostname, &ip1, &ip2, &ip3, &ip4, &banksize) == 6) {
-			char groupidstr[10];
-			namelist_t *newitem = calloc(1, sizeof(namelist_t));
-
-			sprintf(newitem->ip, "%d.%d.%d.%d", ip1, ip2, ip3, ip4);
-			sprintf(groupidstr, "%d", groupid);
-			newitem->bbhostname = (char *)malloc(strlen("@dialup.") + strlen(hostname) + 1);
-			sprintf(newitem->bbhostname, "@dialup.%s", hostname);
-			newitem->clientname = newitem->bbhostname;
-			newitem->page = curpage;
-			newitem->elems = (char **)malloc(sizeof(char *));
-			newitem->elems[0] = NULL;
-			newitem->banksize = banksize;
-			newitem->groupid = strdup(groupidstr);
-			newitem->pageindex = pageidx++;
-			newitem->next = NULL;
-
-			if (namehead == NULL) 
-				namehead = nametail = newitem;
-			else {
-				nametail->next = newitem;
-				nametail = newitem;
-			}
-		}
 	}
 	stackfclose(bbhosts);
 	freestrbuffer(inbuf);
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/lib/loadhosts_net.c ./lib/loadhosts_net.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/lib/loadhosts_net.c	2006-08-09 22:10:16.000000000 +0200
+++ ./lib/loadhosts_net.c	1970-01-01 01:00:00.000000000 +0100
@@ -1,182 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* Hobbit monitor library.                                                    */
-/*                                                                            */
-/* This is a library module for Hobbit, responsible for loading the host      */
-/* configuration from hobbitd.                                                */
-/*                                                                            */
-/* Copyright (C) 2006      Henrik Storner <henrik@hswn.dk>                    */
-/*                                                                            */
-/* This program is released under the GNU General Public License (GPL),       */
-/* version 2. See the file "COPYING" for details.                             */
-/*                                                                            */
-/*----------------------------------------------------------------------------*/
-
-static char rcsid_file[] = "$Id: loadhosts_net.c,v 1.1 2006/03/30 19:59:50 henrik Rel $";
-
-namelist_t *load_hostnames_net(void)
-{
-	char *configbuf = NULL, *inbuf = NULL;
-	namelist_t *nametail = NULL;
-	char bbmsg[200];
-	char *cnfptr;
-
-	configloaded = 1;
-	initialize_hostlist();
-
-	strcpy(bbmsg, "hostinfo fields=BBH_HOSTNAME,BBH_PAGEPATH,BBH_GROUPID,BBH_BANKSIZE,BBH_IP,BBH_RAW");
-	if (xgetenv("BBLOCATION")) sprintf(bbmsg+strlen(bbmsg), " net=%s", xgetenv("BBLOCATION"));
-
-	if (sendmessage(bbmsg, NULL, NULL, &configbuf, 1, BBTALK_TIMEOUT) != BB_OK) return NULL;
-	inbuf = strtok_r(bbmsg, "\n", &cnfptr);
-	while (inbuf) {
-		char *hostname, *pagepath, *groupid, *banksize, *ip;
-
-		namelist_t *newitem = calloc(1, sizeof(namelist_t));
-
-		hostname = pagepath = groupid = banksize = ip = NULL;
-		hostname = gettok(inbuf, "|");
-		if (hostname) pagepath = gettok(NULL, "|");
-		if (pagepath) groupid = gettok(NULL, "|");
-		if (groupid) banksize = gettok(NULL, "|");
-		if (banksize) ip = gettok(NULL, "|");
-
-		newitem->bbhostname = strdup(hostname);
-		newitem->clientname = newitem->bbhostname;
-		newitem->page = setup_page(pagepath);
-		newitem->groupid = strdup(groupid);
-		newitem->banksize = atoi(banksize);
-		strcpy(newitem->ip, ip);
-
-		if (strncmp(hostname, "@dialup", 7) == 0) {
-			/* No other elements for this type of entry */
-			newitem->elems = (char **)malloc(sizeof(char *));
-			newitem->elems[0] = NULL;
-			newitem->next = NULL;
-		}
-
-		if (namehead == NULL) 
-			namehead = nametail = newitem;
-		else {
-			nametail->next = newitem;
-			nametail = newitem;
-		}
-
-			newitem->bbhostname = strdup(hostname);
-			if (ip1 || ip2 || ip3 || ip4) newitem->preference = 1; else newitem->preference = 0;
-			newitem->clientname = NULL;
-			newitem->logname = strdup(newitem->bbhostname);
-			{ char *p = newitem->logname; while ((p = strchr(p, '.')) != NULL) { *p = '_'; } }
-			newitem->downtime = NULL;
-			newitem->page = curpage;
-			newitem->data = NULL;
-			newitem->defaulthost = defaulthost;
-
-			clientname[0] = downtime[0] = '\0';
-			startoftags = strchr(inbuf, '#');
-			if (startoftags == NULL) startoftags = ""; else startoftags++;
-			startoftags += strspn(startoftags, " \t\r\n");
-			newitem->allelems = strdup(startoftags);
-			elemsize = 5;
-			newitem->elems = (char **)malloc((elemsize+1)*sizeof(char *));
-
-			tag = newitem->allelems; elemidx = 0;
-			while (tag && *tag) {
-				if (elemidx == elemsize) {
-					elemsize += 5;
-					newitem->elems = (char **)realloc(newitem->elems, (elemsize+1)*sizeof(char *));
-				}
-				newitem->elems[elemidx] = tag;
-
-				/* Skip until we hit a whitespace or a quote */
-				tag += strcspn(tag, " \t\r\n\"");
-				if (*tag == '"') {
-					delim = tag;
-
-					/* Hit a quote - skip until the next matching quote */
-					tag = strchr(tag+1, '"');
-					if (tag != NULL) { 
-						/* Found end-quote, NULL the item here and move on */
-						*tag = '\0'; tag++; 
-					}
-
-					/* Now move quoted data one byte down (including the NUL) to kill quotechar */
-					memmove(delim, delim+1, strlen(delim));
-				}
-				else if (*tag) {
-					/* Normal end of item, NULL it and move on */
-					*tag = '\0'; tag++;
-				}
-				else {
-					/* End of line - no more to do. */
-					tag = NULL;
-				}
-
-				/* 
-				 * If we find a "noconn", drop preference value to 0.
-				 * If we find a "prefer", up reference value to 2.
-				 */
-				if ((newitem->preference == 1) && (strcmp(newitem->elems[elemidx], "noconn") == 0))
-					newitem->preference = 0;
-				else if (strcmp(newitem->elems[elemidx], "prefer") == 0)
-					newitem->preference = 2;
-
-				/* Skip whitespace until start of next tag */
-				if (tag) tag += strspn(tag, " \t\r\n");
-				elemidx++;
-			}
-
-			newitem->elems[elemidx] = NULL;
-
-			/* See if this host is defined before */
-			for (iwalk = namehead, iprev = NULL; (iwalk && strcmp(iwalk->bbhostname, newitem->bbhostname)); iprev = iwalk, iwalk = iwalk->next) ;
-			if (strcasecmp(newitem->bbhostname, ".default.") == 0) {
-				/* The pseudo DEFAULT host */
-				newitem->next = NULL;
-				defaulthost = newitem;
-			}
-			else if (iwalk == NULL) {
-				/* New item, so add to end of list */
-				newitem->next = NULL;
-				if (namehead == NULL) 
-					namehead = nametail = newitem;
-				else {
-					nametail->next = newitem;
-					nametail = newitem;
-				}
-			}
- 			else if (newitem->preference <= iwalk->preference) {
-				/* Add after the existing (more preferred) entry */
-				newitem->next = iwalk->next;
-				iwalk->next = newitem;
-			}
-			else {
-				/* New item has higher preference, so add before the iwalk item (i.e. after iprev) */
-				if (iprev == NULL) {
-					newitem->next = namehead;
-					namehead = newitem;
-				}
-				else {
-					newitem->next = iprev->next;
-					iprev->next = newitem;
-				}
-			}
-
-			newitem->clientname = bbh_find_item(newitem, BBH_CLIENTALIAS);
-			if (newitem->clientname == NULL) newitem->clientname = newitem->bbhostname;
-			newitem->downtime = bbh_find_item(newitem, BBH_DOWNTIME);
-
-			MEMUNDEFINE(clientname);
-			MEMUNDEFINE(downtime);
-		}
-
-
-		inbuf = strtok_r(NULL, "\n", &cnfptr);
-	}
-	xfree(configbuf);
-
-	build_hosttree();
-	return namehead;
-}
-
-
-
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/lib/timefunc.c ./lib/timefunc.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/lib/timefunc.c	2006-08-09 22:10:16.000000000 +0200
+++ ./lib/timefunc.c	2006-10-03 13:52:29.040435198 +0200
@@ -245,6 +245,7 @@
 	return found;
 }
 
+#ifndef CLIENTONLY
 char *check_downtime(char *hostname, char *testname)
 {
 	namelist_t *hinfo = hostinfo(hostname);
@@ -300,6 +301,7 @@
 
 	return NULL;
 }
+#endif
 
 int periodcoversnow(char *tag)
 {
@@ -415,20 +417,30 @@
 	 */
 
 	int result = 0;
-	char *p;
-	char modifier;
+	char *startofval;
 
-	p = dur + strspn(dur, "0123456789");
-	modifier = *p;
-	*p = '\0';
-	result = atoi(dur);
-	*p = modifier;
+	startofval = dur;
+
+	while (startofval && (isdigit((int)*startofval))) {
+		char *p;
+		char modifier;
+		int oneval = 0;
+
+		p = startofval + strspn(startofval, "0123456789");
+		modifier = *p;
+		*p = '\0';
+		oneval = atoi(startofval);
+		*p = modifier;
+
+		switch (modifier) {
+		  case 'm': break;			/* minutes */
+		  case 'h': oneval *= 60; break;	/* hours */
+		  case 'd': oneval *= 1440; break;	/* days */
+		  case 'w': oneval *= 10080; break;	/* weeks */
+		}
 
-	switch (modifier) {
-	  case 'm': break;			/* minutes */
-	  case 'h': result *= 60; break;	/* hours */
-	  case 'd': result *= 1440; break;	/* days */
-	  case 'w': result *= 10080; break;	/* weeks */
+		result += oneval;
+		startofval = ((*p) ? p+1 : NULL);
 	}
 
 	return result;
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/web/Makefile ./web/Makefile
--- /home/henrik/hobbit/release/hobbit-4.2.0/web/Makefile	2006-08-09 22:10:13.000000000 +0200
+++ ./web/Makefile	2006-10-03 12:55:27.000000000 +0200
@@ -1,5 +1,5 @@
 PROGRAMS = bb-hist.cgi bb-eventlog.cgi bb-rep.cgi bb-replog.cgi bb-snapshot.cgi bb-findhost.cgi bb-csvinfo.cgi bb-ack.cgi bb-webpage bb-datepage.cgi hobbitgraph.cgi hobbitsvc.cgi hobbit-enadis.cgi hobbit-confreport.cgi hobbit-nkview.cgi hobbit-nkedit.cgi hobbit-ackinfo.cgi hobbit-statusreport.cgi boilerplate.cgi hobbit-hostgraphs.cgi hobbit-ghosts.cgi
-CGISCRIPTS = bb-hist.sh bb-eventlog.sh bb-rep.sh bb-replog.sh bb-snapshot.sh bb-findhost.sh bb-csvinfo.sh hobbitcolumn.sh bb-datepage.sh hobbitgraph.sh bb-hostsvc.sh bb-histlog.sh hobbit-confreport.sh hobbit-nkview.sh hobbit-certreport.sh hobbit-nongreen.sh hobbit-hostgraphs.sh hobbit-ghosts.sh
+CGISCRIPTS = bb-hist.sh bb-eventlog.sh bb-rep.sh bb-replog.sh bb-snapshot.sh bb-findhost.sh bb-csvinfo.sh hobbitcolumn.sh bb-datepage.sh hobbitgraph.sh bb-hostsvc.sh bb-histlog.sh hobbit-confreport.sh hobbit-confreport-critical.sh hobbit-nkview.sh hobbit-certreport.sh hobbit-nongreen.sh hobbit-hostgraphs.sh hobbit-ghosts.sh
 SECCGISCRIPTS = bb-ack.sh hobbit-enadis.sh hobbit-nkedit.sh hobbit-ackinfo.sh
 
 LIBOBJS = ../lib/libbbgen.a
@@ -178,6 +178,10 @@
 	cat $< | sed -e 's!@BBHOME@!$(BBHOME)!g' | sed -e 's!@RUNTIMEDEFS@!$(RUNTIMEDEFS)!g' >$@
 	chmod 755 $@
 
+hobbit-confreport-critical.sh: hobbit-confreport-critical.sh.DIST
+	cat $< | sed -e 's!@BBHOME@!$(BBHOME)!g' | sed -e 's!@RUNTIMEDEFS@!$(RUNTIMEDEFS)!g' >$@
+	chmod 755 $@
+
 hobbit-certreport.sh: hobbit-certreport.sh.DIST
 	cat $< | sed -e 's!@BBHOME@!$(BBHOME)!g' | sed -e 's!@RUNTIMEDEFS@!$(RUNTIMEDEFS)!g' >$@
 	chmod 755 $@
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/web/bb-ack.c ./web/bb-ack.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/web/bb-ack.c	2006-08-09 22:10:12.000000000 +0200
+++ ./web/bb-ack.c	2006-10-03 13:52:29.051433196 +0200
@@ -133,7 +133,7 @@
 				}
 
 				if (acknum) awalk->acknum = atoi(acknum);
-				if (validity) awalk->validity = atoi(validity);
+				if (validity) awalk->validity = durationvalue(validity);
 				if (ackmsg) awalk->ackmsg = strdup(ackmsg);
 				if (hostname) awalk->hostname = strdup(hostname);
 				if (testname) awalk->testname = strdup(testname);
@@ -161,7 +161,7 @@
 
 	fprintf(output, "    <td>%s</td>\n", (hname ? hname : "&nbsp;"));
 	fprintf(output, "    <td>%s</td>\n", (tname ? tname : "&nbsp;"));
-	fprintf(output, "    <TD><INPUT TYPE=TEXT NAME=\"DELAY_%s\" SIZE=4 MAXLENGTH=4></TD>\n", numstr);
+	fprintf(output, "    <TD><INPUT TYPE=TEXT NAME=\"DELAY_%s\" SIZE=8 MAXLENGTH=20></TD>\n", numstr);
 	fprintf(output, "    <TD><INPUT TYPE=TEXT NAME=\"MESSAGE_%s\" SIZE=60 MAXLENGTH=80></TD>\n", numstr);
 
 	fprintf(output, "    <TD>\n");
@@ -224,42 +224,31 @@
 				 NULL, NULL);
 		}
 		else {
-			char cmd[1024];
+			char *cmd;
 			char *respbuf = NULL;
-                	char *cookie = NULL, *p;
+			char *hostname, *pagename;
 			int gotfilter = 0;
 
 			headfoot(stdout, "acknowledge", "", "header", COL_RED);
 
+			cmd = (char *)malloc(1024);
 			strcpy(cmd, "hobbitdboard color=red,yellow fields=hostname,testname,cookie");
 
-			p = getenv("HTTP_COOKIE"); 
-			if (p) cookie = strdup(p);
-
-			if (obeycookies && cookie && ((p = strstr(cookie, "host=")) != NULL)) {
-				char *hostname;
-				
-				hostname = p + strlen("host=");
-				p = strchr(hostname, ';'); if (p) *p = '\0';
+			if (obeycookies && !gotfilter && ((hostname = get_cookie("host")) != NULL)) {
 				if (*hostname) {
-					sprintf(cmd + strlen(cmd), " host=%s", hostname);
+					cmd = (char *)realloc(cmd, 1024 + strlen(hostname));
+					sprintf(cmd + strlen(cmd), " host=^%s$", hostname);
 					gotfilter = 1;
 				}
-				if (p) *p = ';';
 			}
 
-			if (obeycookies && cookie && !gotfilter && ((p = strstr(cookie, "pagepath=")) != NULL)) {
-				char *pagename;
-
-				pagename = p + strlen("pagepath=");
-				p = strchr(pagename, ';'); if (p) *p = '\0';
+			if (obeycookies && !gotfilter && ((pagename = get_cookie("pagepath")) != NULL)) {
 				if (*pagename) {
-					sprintf(cmd + strlen(cmd), " page=^%s$", pagename);
+					cmd = (char *)realloc(cmd, 1024 + 2*strlen(pagename));
+					sprintf(cmd + strlen(cmd), " page=^%s$|^%s/.+", pagename, pagename);
 					gotfilter = 1;
 				}
-				if (p) *p = ';';
 			}
-			xfree(cookie);
 
 			if (sendmessage(cmd, NULL, NULL, &respbuf, 1, BBTALK_TIMEOUT) == BB_OK) {
 				char *bol, *eoln;
@@ -327,7 +316,7 @@
 
 			if (reqtype == ACK_MANY) {
 				if (!awalk->ackmsg) awalk->ackmsg = ackmsgall;
-				if (!awalk->validity && validityall) awalk->validity = atoi(validityall);
+				if (!awalk->validity && validityall) awalk->validity = durationvalue(validityall);
 			}
 
 			count++;
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/web/bb-datepage.c ./web/bb-datepage.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/web/bb-datepage.c	2006-08-09 22:10:12.000000000 +0200
+++ ./web/bb-datepage.c	2006-10-03 12:55:27.000000000 +0200
@@ -108,30 +108,21 @@
 	parse_query();
 
 	if (cgi_method == CGI_POST) {
-		char *cookie, *pagepath, *p;
-		char *endurl;
+		char *pagepath, *cookie, *endurl;
 
-		cookie = getenv("HTTP_COOKIE");
-		if (cookie == NULL) {
-			errormsg("Cookies must be enabled\n");
-			return 1;
+		cookie = get_cookie("pagepath");
+
+		if (cookie && *cookie) {
+			pagepath = strdup(cookie);
 		}
+		else {
+			cookie = get_cookie("host");
 
-		p = strstr(cookie, "pagepath="); if (p) p+= strlen("pagepath=");
-		if ((p == NULL) || (strlen(p) == 0) || (*p == ';')) {
-			p = strstr(cookie, "host="); if (p) p += strlen("host=");
-			if ((p == NULL) || (strlen(p) == 0) || (*p == ';')) {
-				pagepath = "";
-			}
-			else {
-				char *hname;
+			if (cookie && *cookie) {
 				namelist_t *hinfo;
 
-				hname = strdup(p);
-				p = strchr(hname, ';'); if (p) *p = '\0';
-
 				load_hostnames(xgetenv("BBHOSTS"), NULL, get_fqdn());
-				hinfo = hostinfo(hname);
+				hinfo = hostinfo(cookie);
 				if (hinfo) {
 					pagepath = bbh_item(hinfo, BBH_PAGEPATH);
 				}
@@ -139,10 +130,9 @@
 					pagepath = "";
 				}
 			}
-		}
-		else {
-			pagepath = strdup(p);
-			p = strchr(pagepath, ';'); if (p) *p = '\0';
+			else {
+				pagepath = "";
+			}
 		}
 
 		endurl = (char *)malloc(strlen(urlprefix) + strlen(pagepath) + 1024);
@@ -201,6 +191,7 @@
 		}
 
 		sethostenv("", "", "", colorname(bgcolor), NULL);
+		fprintf(stdout, "Content-type: %s\n\n", xgetenv("HTMLCONTENTTYPE"));
 		showform(stdout, hffile, formfn, COL_BLUE, seltime, NULL, NULL);
 	}
 
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/web/bb-eventlog.c ./web/bb-eventlog.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/web/bb-eventlog.c	2006-08-09 22:10:12.000000000 +0200
+++ ./web/bb-eventlog.c	2006-10-03 12:55:27.000000000 +0200
@@ -114,6 +114,8 @@
 
 	redirect_cgilog("bb-eventlog");
 
+	fprintf(stdout, "Content-type: %s\n\n", xgetenv("HTMLCONTENTTYPE"));
+
 	cgidata = cgi_request();
 	if (cgidata == NULL) {
 		/* Present the query form */
@@ -126,8 +128,6 @@
 	load_hostnames(xgetenv("BBHOSTS"), NULL, get_fqdn());
 
 	/* Now generate the webpage */
-	printf("Content-Type: %s\n\n", xgetenv("HTMLCONTENTTYPE"));
-
 	headfoot(stdout, "event", "", "header", COL_GREEN);
 	fprintf(stdout, "<center>\n");
 	do_eventlog(stdout, maxcount, maxminutes, fromtime, totime, 
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/web/bb-findhost.c ./web/bb-findhost.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/web/bb-findhost.c	2006-08-09 22:10:12.000000000 +0200
+++ ./web/bb-findhost.c	2006-10-03 12:55:27.000000000 +0200
@@ -152,6 +152,7 @@
 	if (cgidata == NULL) {
 		/* Present the query form */
 		sethostenv("", "", "", colorname(COL_BLUE), NULL);
+		printf("Content-type: %s\n\n", xgetenv("HTMLCONTENTTYPE"));
 		showform(stdout, "findhost", "findhost_form", COL_BLUE, getcurrenttime(NULL), NULL, NULL);
 		return 0;
 	}
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/web/bb-rep.c ./web/bb-rep.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/web/bb-rep.c	2006-08-09 22:10:12.000000000 +0200
+++ ./web/bb-rep.c	2006-10-03 12:55:27.000000000 +0200
@@ -230,6 +230,7 @@
 	if (cgidata == NULL) {
 		/* Present the query form */
 		sethostenv("", "", "", colorname(COL_BLUE), NULL);
+		printf("Content-type: %s\n\n", xgetenv("HTMLCONTENTTYPE"));
 		showform(stdout, "report", "report_form", COL_BLUE, getcurrenttime(NULL)-86400, NULL, NULL);
 		return 0;
 	}
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/web/bb-snapshot.c ./web/bb-snapshot.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/web/bb-snapshot.c	2006-08-09 22:10:12.000000000 +0200
+++ ./web/bb-snapshot.c	2006-10-03 12:55:27.000000000 +0200
@@ -173,6 +173,7 @@
 	if (cgidata == NULL) {
 		/* Present the query form */
 		sethostenv("", "", "", colorname(COL_BLUE), NULL);
+		printf("Content-type: %s\n\n", xgetenv("HTMLCONTENTTYPE"));
 		showform(stdout, "snapshot", "snapshot_form", COL_BLUE, getcurrenttime(NULL), NULL, NULL);
 		return 0;
 	}
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/web/hobbit-confreport-critical.sh.DIST ./web/hobbit-confreport-critical.sh.DIST
--- /home/henrik/hobbit/release/hobbit-4.2.0/web/hobbit-confreport-critical.sh.DIST	1970-01-01 01:00:00.000000000 +0100
+++ ./web/hobbit-confreport-critical.sh.DIST	2006-10-03 12:55:27.000000000 +0200
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+# This is the Hobbit CGI script interface to hobbit-confreport.cgi
+# It shows only the statuses on the Critical systems view
+#
+# Install this script in your webservers' cgi-bin directory
+
+. @BBHOME@/etc/hobbitcgi.cfg
+@RUNTIMEDEFS@ exec @BBHOME@/bin/hobbit-confreport.cgi $CGI_HOBBITCONFREPORT_OPTS --critical
+
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/web/hobbit-confreport.c ./web/hobbit-confreport.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/web/hobbit-confreport.c	2006-08-09 22:10:12.000000000 +0200
+++ ./web/hobbit-confreport.c	2006-10-03 12:56:57.000000000 +0200
@@ -8,7 +8,7 @@
 /*                                                                            */
 /*----------------------------------------------------------------------------*/
 
-static char rcsid[] = "$Id: hobbit-confreport.c,v 1.15 2006/05/31 16:12:38 henrik Rel $";
+static char rcsid[] = "$Id: hobbit-confreport.c,v 1.18 2006/08/19 06:25:27 henrik Exp $";
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -45,6 +45,8 @@
 static char *coldelim = ";";
 static coltext_t *chead = NULL;
 static int ccount = 0;
+static int nkonly = 0;
+static int newnkconfig = 1;
 
 void errormsg(char *msg)
 {
@@ -131,6 +133,39 @@
 	closedir(d);
 }
 
+char *nkval(char *hname, char *tname, char *nkalerts)
+{
+	static char *result = NULL;
+
+	if (result) xfree(result);
+
+	if (newnkconfig) {
+		char *key;
+		nkconf_t *nkrec;
+
+		key = (char *)malloc(strlen(hname) + strlen(tname) + 2);
+		sprintf(key, "%s|%s", hname, tname);
+		nkrec = get_nkconfig(key, NKCONF_FIRSTMATCH, NULL);
+		if (!nkrec) {
+			result = strdup("No");
+		}
+		else {
+			char *tspec;
+
+			tspec = (nkrec->nktime ? timespec_text(nkrec->nktime) : "24x7");
+			result = (char *)malloc(strlen(tspec) + 30);
+			sprintf(result, "%s&nbsp;prio&nbsp;%d", tspec, nkrec->priority);
+		}
+		xfree(key);
+	}
+	else {
+		result = strdup((checkalert(nkalerts, tname) ? "Yes" : "No"));
+	}
+
+	return result;
+}
+
+
 static void print_host(hostlist_t *host, htnames_t *testnames[], int testcount)
 {
 	int testi, rowcount, netcount;
@@ -157,6 +192,7 @@
 	comment = bbh_item(hinfo, BBH_COMMENT);
 	description = bbh_item(hinfo, BBH_DESCRIPTION); 
 	net = bbh_item(hinfo, BBH_NET);
+	nkalerts = bbh_item(hinfo, BBH_NK);
 	nktime = bbh_item(hinfo, BBH_NKTIME); if (!nktime) nktime = "24x7"; else nktime = strdup(timespec_text(nktime));
 	downtime = bbh_item(hinfo, BBH_DOWNTIME); if (downtime) downtime = strdup(timespec_text(downtime));
 	reporttime = bbh_item(hinfo, BBH_REPORTTIME); if (!reporttime) reporttime = "24x7"; else reporttime = strdup(timespec_text(reporttime));
@@ -166,7 +202,7 @@
 	if (dispname || clientalias) rowcount++;
 	if (comment) rowcount++;
 	if (description) rowcount++;
-	if (nktime) rowcount++;
+	if (!newnkconfig && nktime) rowcount++;
 	if (downtime) rowcount++;
 	if (reporttime) rowcount++;
 
@@ -185,13 +221,11 @@
 	if (pagepathtitle) fprintf(stdout, "<tr><td>Monitoring location: %s</td></tr>\n", pagepathtitle);
 	if (comment) fprintf(stdout, "<tr><td>Comment: %s</td></tr>\n", comment);
 	if (description) fprintf(stdout, "<tr><td>Description: %s</td></tr>\n", description);
-	if (nktime) fprintf(stdout, "<tr><td>NK monitoring period: %s</td></tr>\n", nktime);
+	if (!newnkconfig && nktime) fprintf(stdout, "<tr><td>NK monitoring period: %s</td></tr>\n", nktime);
 	if (downtime) fprintf(stdout, "<tr><td>Planned downtime: %s</td></tr>\n", downtime);
 	if (reporttime) fprintf(stdout, "<tr><td>SLA Reporting Period: %s</td></tr>\n", reporttime);
 
 
-	nkalerts = bbh_item(hinfo, BBH_NK);
-
 	/* Build a list of the network tests */
 	itm = bbh_item_walk(hinfo);
 	while (itm) {
@@ -344,7 +378,7 @@
 		use_columndoc(testnames[testi]->name);
 		fprintf(stdout, "<tr>");
 		fprintf(stdout, "<td valign=top>%s</td>", testnames[testi]->name);
-		fprintf(stdout, "<td valign=top>%s</td>", (checkalert(nkalerts, testnames[testi]->name) ? "Yes" : "No"));
+		fprintf(stdout, "<td valign=top>%s</td>", nkval(host->hostname, testnames[testi]->name, nkalerts));
 
 		fprintf(stdout, "<td valign=top>");
 		if (twalk->b1 || twalk->b2 || twalk->b3) {
@@ -384,7 +418,7 @@
 		use_columndoc(testnames[testi]->name);
 		fprintf(stdout, "<tr>");
 		fprintf(stdout, "<td valign=top>%s</td>", testnames[testi]->name);
-		fprintf(stdout, "<td valign=top>%s</td>", (checkalert(nkalerts, testnames[testi]->name) ? "Yes" : "No"));
+		fprintf(stdout, "<td valign=top>%s</td>", nkval(host->hostname, testnames[testi]->name, nkalerts));
 		fprintf(stdout, "<td valign=top>-/-/-</td>");
 
 		/* Make up some default configuration data */
@@ -599,8 +633,8 @@
 {
 	int argi, hosti, testi;
 	char *pagepattern = NULL, *hostpattern = NULL;
-	char *envarea = NULL, *cookie = NULL, *p, *nexthost;
-	char hobbitcmd[1024], procscmd[1024], svcscmd[1024];
+	char *envarea = NULL, *cookie = NULL, *nexthost;
+	char *hobbitcmd, *procscmd, *svcscmd;
         int alertcolors, alertinterval;
 	char configfn[PATH_MAX];
 	char *respbuf = NULL, *procsbuf = NULL, *svcsbuf = NULL;
@@ -627,38 +661,50 @@
 			char *p = strchr(argv[argi], '=');
 			coldelim = strdup(p+1);
 		}
+		else if (strcmp(argv[argi], "--critical") == 0) {
+			nkonly = 1;
+		}
+		else if (strcmp(argv[argi], "--old-nk-config") == 0) {
+			newnkconfig = 0;
+		}
 	}
 
 	redirect_cgilog("hobbit-confreport");
 
-	/* Setup the filter we use for the report */
-	cookie = getenv("HTTP_COOKIE");
-	if (cookie && ((p = strstr(cookie, "pagepath=")) != NULL)) {
-		p += strlen("pagepath=");
-		pagepattern = strdup(p);
-		p = strchr(pagepattern, ';'); if (p) *p = '\0';
-		if (strlen(pagepattern) == 0) { xfree(pagepattern); pagepattern = NULL; }
-	}
+	load_hostnames(xgetenv("BBHOSTS"), NULL, get_fqdn());
+	load_nkconfig(NULL);
 
-	if (cookie && (!pagepattern) && ((p = strstr(cookie, "host=")) != NULL)) {
-		p += strlen("host=");
-		hostpattern = strdup(p);
-		p = strchr(hostpattern, ';'); if (p) *p = '\0';
-		if (strlen(hostpattern) == 0) { xfree(hostpattern); hostpattern = NULL; }
-	}
+	/* Setup the filter we use for the report */
+	cookie = get_cookie("pagepath"); if (cookie && *cookie) pagepattern = strdup(cookie);
+	cookie = get_cookie("host");     if (cookie && *cookie) hostpattern = strdup(cookie);
 
 	/* Fetch the list of host+test statuses we currently know about */
 	if (pagepattern) {
-		sprintf(hobbitcmd, "hobbitdboard page=%s fields=hostname,testname", pagepattern);
-		sprintf(procscmd,  "hobbitdboard page=%s test=procs fields=hostname,msg", pagepattern);
-		sprintf(svcscmd,   "hobbitdboard page=%s test=svcs fields=hostname,msg", pagepattern);
+		hobbitcmd = (char *)malloc(2*strlen(pagepattern) + 1024);
+		procscmd = (char *)malloc(2*strlen(pagepattern) + 1024);
+		svcscmd = (char *)malloc(2*strlen(pagepattern) + 1024);
+
+		sprintf(hobbitcmd, "hobbitdboard page=^%s$|^%s/.+ fields=hostname,testname", 
+			pagepattern, pagepattern);
+		sprintf(procscmd,  "hobbitdboard page=^%s$|^%s/.+ test=procs fields=hostname,msg",
+			pagepattern, pagepattern);
+		sprintf(svcscmd,   "hobbitdboard page=^%s$|^%s/.+ test=svcs fields=hostname,msg",
+			pagepattern, pagepattern);
 	}
 	else if (hostpattern) {
-		sprintf(hobbitcmd, "hobbitdboard host=%s fields=hostname,testname", hostpattern);
-		sprintf(procscmd,  "hobbitdboard host=%s test=procs fields=hostname,msg", hostpattern);
-		sprintf(svcscmd,   "hobbitdboard host=%s test=svcs fields=hostname,msg", hostpattern);
+		hobbitcmd = (char *)malloc(strlen(hostpattern) + 1024);
+		procscmd = (char *)malloc(strlen(hostpattern) + 1024);
+		svcscmd = (char *)malloc(strlen(hostpattern) + 1024);
+
+		sprintf(hobbitcmd, "hobbitdboard host=^%s$ fields=hostname,testname", hostpattern);
+		sprintf(procscmd,  "hobbitdboard host=^%s$ test=procs fields=hostname,msg", hostpattern);
+		sprintf(svcscmd,   "hobbitdboard host=^%s$ test=svcs fields=hostname,msg", hostpattern);
 	}
 	else {
+		hobbitcmd = (char *)malloc(1024);
+		procscmd = (char *)malloc(1024);
+		svcscmd = (char *)malloc(1024);
+
 		sprintf(hobbitcmd, "hobbitdboard fields=hostname,testname");
 		sprintf(procscmd,  "hobbitdboard test=procs fields=hostname,msg");
 		sprintf(svcscmd,   "hobbitdboard test=svcs fields=hostname,msg");
@@ -686,12 +732,20 @@
 	nexthost = respbuf;
 	do {
 		char *hname, *tname, *eoln;
+		int wanted = 1;
 
 		eoln = strchr(nexthost, '\n'); if (eoln) *eoln = '\0';
 		hname = nexthost;
 		tname = strchr(nexthost, '|'); if (tname) { *tname = '\0'; tname++; }
 
-		if (hname && tname && strcmp(hname, "summary") && strcmp(tname, xgetenv("INFOCOLUMN")) && strcmp(tname, xgetenv("TRENDSCOLUMN"))) {
+		if (nkonly) {
+			namelist_t *hinfo = hostinfo(hname);
+			char *nkalerts = bbh_item(hinfo, BBH_NK);
+
+			if (!nkalerts || (strcmp(nkval(hname, tname, nkalerts), "No") == 0)) wanted = 0;
+		}
+
+		if (wanted && hname && tname && strcmp(hname, "summary") && strcmp(tname, xgetenv("INFOCOLUMN")) && strcmp(tname, xgetenv("TRENDSCOLUMN"))) {
 			htnames_t *newitem = (htnames_t *)malloc(sizeof(htnames_t));
 
 			for (hwalk = hosthead; (hwalk && strcmp(hwalk->hostname, hname)); hwalk = hwalk->next);
@@ -726,7 +780,6 @@
 	qsort(&allhosts[0], hostcount, sizeof(hostlist_t **), host_compare);
 
 	/* Get the static info */
-	load_hostnames(xgetenv("BBHOSTS"), NULL, get_fqdn());
 	load_all_links();
 	init_tcp_services();
 	pingcolumn = xgetenv("PINGCOLUMN");
@@ -753,6 +806,9 @@
 		fprintf(stdout, "%s ", allhosts[hosti]->hostname);
 	}
 	fprintf(stdout, "</td></tr>\n");
+	if (nkonly) {
+		fprintf(stdout, "<tr><th valign=top align=left>Filter</th><td>Only data for the &quot;Critical Systems&quot; view reported</td></tr>\n");
+	}
 	fprintf(stdout, "</table>\n");
 
 	headfoot(stdout, "confreport", "", "front", COL_BLUE);
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/web/hobbit-confreport.cgi.1 ./web/hobbit-confreport.cgi.1
--- /home/henrik/hobbit/release/hobbit-4.2.0/web/hobbit-confreport.cgi.1	2006-08-09 22:10:12.000000000 +0200
+++ ./web/hobbit-confreport.cgi.1	2006-10-03 12:55:27.000000000 +0200
@@ -23,6 +23,14 @@
 the Hobbit system.
 
 .SH OPTIONS
+.IP "--critical"
+Report only on the statuses that are configured to show up on the
+\fBCritical Systems\fR view.
+
+.IP "--old-nk-config"
+Use the deprecated \fBNK\fR tag in bb-hosts to determine if tests
+appear on the Critical Systems view.
+
 .IP "--env=FILENAME"
 Loads the environment defined in FILENAME before executing the CGI script.
 
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/web/hobbit-enadis.c ./web/hobbit-enadis.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/web/hobbit-enadis.c	2006-08-09 22:10:12.000000000 +0200
+++ ./web/hobbit-enadis.c	2006-10-03 12:55:27.000000000 +0200
@@ -289,21 +289,15 @@
 
 	if (cgi_method == CGI_GET) {
 		/*
-		 * It's a GET , so the initial request.
+		 * It's a GET, so the initial request.
 		 * If we have a pagepath cookie, use that as the initial
 		 * host-name filter.
 		 */
-		char *cookie, *p;
+		char *pagepath;
 
 		action = ACT_FILTER;
-
-		cookie = getenv("HTTP_COOKIE");
-		if (obeycookies && cookie && ((p = strstr(cookie, "pagepath=")) != NULL)) {
-			p += strlen("pagepath=");
-			pagepattern = strdup(p);
-			p = strchr(pagepattern, ';'); if (p) *p = '\0';
-			if (strlen(pagepattern) == 0) { xfree(pagepattern); pagepattern = 0; }
-		}
+		pagepath = get_cookie("pagepath");
+		if (obeycookies && pagepath && *pagepath) pagepattern = strdup(pagepath);
 	}
 
 	if (action == ACT_FILTER) {
@@ -312,6 +306,7 @@
 		load_hostnames(xgetenv("BBHOSTS"), NULL, get_fqdn());
 		sethostenv("", "", "", colorname(COL_BLUE), NULL);
 		sethostenv_filter(hostpattern, pagepattern, ippattern);
+		printf("Content-type: %s\n\n", xgetenv("HTMLCONTENTTYPE"));
 		showform(stdout, "maint", "maint_form", COL_BLUE, getcurrenttime(NULL), NULL, NULL);
 		return 0;
 	}
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/web/hobbit-hostgraphs.c ./web/hobbit-hostgraphs.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/web/hobbit-hostgraphs.c	2006-08-09 22:10:13.000000000 +0200
+++ ./web/hobbit-hostgraphs.c	2006-10-03 12:55:27.000000000 +0200
@@ -209,24 +209,13 @@
 	fprintf(stdout, "Content-type: %s\n\n", xgetenv("HTMLCONTENTTYPE"));
 
 	if (action == A_SELECT) {
-                char *cookie, *p;
+                char *cookie;
 
-		cookie = getenv("HTTP_COOKIE");
-		if (cookie && !pagepattern && ((p = strstr(cookie, "pagepath=")) != NULL)) {
-			/* Match ONLY the exact pagename by using start/end of line markers */
-
-			p += strlen("pagepath=");
-			pagepattern = (char *)malloc(strlen(p) + 3);
-			sprintf(pagepattern, "^%s", p);
-			p = strchr(pagepattern, ';'); if (p) *p = '\0';
-
-			if (strlen(pagepattern) == 0) { 
-				xfree(pagepattern); 
-				pagepattern = NULL;
-			}
-			else {
-				strcat(pagepattern, "$");
-			}
+		cookie = get_cookie("pagepath");
+		if (!pagepattern && cookie && *cookie) {
+			/* Match the exact pagename and sub-pages */
+			pagepattern = (char *)malloc(10 + 2*strlen(cookie));
+			sprintf(pagepattern, "^%s$|^%s/.+", cookie, cookie);
 		}
 
 		if (hostpattern || pagepattern || ippattern)
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/web/hobbit-nkedit.c ./web/hobbit-nkedit.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/web/hobbit-nkedit.c	2006-08-09 22:10:13.000000000 +0200
+++ ./web/hobbit-nkedit.c	2006-10-03 12:55:27.000000000 +0200
@@ -238,6 +238,7 @@
 	if (isaclone && isclonewarning) sprintf(warnmsg, "<SCRIPT LANGUAGE=\"Javascript\" type=\"text/javascript\"> alert('%s'); </SCRIPT>\n", isclonewarning);
 	if (hasclones && hascloneswarning) sprintf(warnmsg, "<SCRIPT LANGUAGE=\"Javascript\" type=\"text/javascript\"> alert('%s'); </SCRIPT>\n", hascloneswarning);
 
+	printf("Content-type: %s\n\n", xgetenv("HTMLCONTENTTYPE"));
 	showform(stdout, "nkedit", "nkedit_form", COL_BLUE, getcurrenttime(NULL), warnmsg, NULL);
 }
 
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/web/hobbit-nkview.c ./web/hobbit-nkview.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/web/hobbit-nkview.c	2006-08-09 22:10:13.000000000 +0200
+++ ./web/hobbit-nkview.c	2006-10-03 12:55:27.000000000 +0200
@@ -46,8 +46,10 @@
 	char *bol, *eol;
 	time_t now;
 	char msg[1024];
+	int i;
 
-	sprintf(msg, "hobbitdboard color=red,yellow acklevel=%d fields=hostname,testname,color,lastchange,logtime,validtime,acklist", nkacklevel);
+	sprintf(msg, "hobbitdboard acklevel=%d fields=hostname,testname,color,lastchange,logtime,validtime,acklist color=%s", nkacklevel,colorname(mincolor));
+	for (i=mincolor+1; (i < COL_COUNT); i++) sprintf(msg+strlen(msg), ",%s", colorname(i));
 
 	hobbitdresult = sendmessage(msg, NULL, NULL, &board, 1, BBTALK_TIMEOUT);
 	if (hobbitdresult != BB_OK) {
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/web/hobbit-statusreport.c ./web/hobbit-statusreport.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/web/hobbit-statusreport.c	2006-08-09 22:10:13.000000000 +0200
+++ ./web/hobbit-statusreport.c	2006-10-03 12:55:27.000000000 +0200
@@ -26,7 +26,7 @@
 {
 	char *envarea = NULL;
 	char *server = NULL;
-	char *cookie, *p, *pagefilter = "";
+	char *cookie, *pagefilter = "";
 	char *filter = NULL;
 	char *heading = NULL;
 	int  showcolors = 1;
@@ -108,13 +108,10 @@
 
 	if (!allhosts) {
       		/* Setup the filter we use for the report */
-		cookie = getenv("HTTP_COOKIE");
-		if (cookie && ((p = strstr(cookie, "pagepath=")) != NULL)) {
-			p += strlen("pagepath=");
-			pagefilter = malloc(strlen(p) + 6);
-			sprintf(pagefilter, "page=%s", p);
-			p = strchr(pagefilter, ';'); if (p) *p = '\0';
-			if (strlen(pagefilter) == 0) { xfree(pagefilter); pagefilter = ""; }
+		cookie = get_cookie("pagepath");
+		if (cookie && *cookie) {
+			pagefilter = malloc(10 + 2*strlen(cookie));
+			sprintf(pagefilter, "page=^%s$|^%s/.+", cookie, cookie);
 		}
 	}
 
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/web/hobbitgraph.c ./web/hobbitgraph.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/web/hobbitgraph.c	2006-08-09 22:10:13.000000000 +0200
+++ ./web/hobbitgraph.c	2006-10-03 12:55:27.000000000 +0200
@@ -63,6 +63,7 @@
 int graphwidth = 0;
 int graphheight = 0;
 int ignorestalerrds = 0;
+int bgcolor = COL_GREEN;
 
 int coloridx = 0;
 char *colorlist[] = { 
@@ -216,6 +217,10 @@
 		else if (strcmp(cwalk->name, "nostale") == 0) {
 			ignorestalerrds = 1;
 		}
+		else if (strcmp(cwalk->name, "color") == 0) {
+			int color = parse_color(cwalk->value);
+			if (color != -1) bgcolor = color;
+		}
 
 		cwalk = cwalk->next;
 	}
@@ -440,8 +445,8 @@
 	  case ACT_MENU:
 		fprintf(output, "  <td align=\"left\"><img src=\"%s&amp;action=view&amp;graph=%s\" alt=\"%s graph\"></td>\n",
 			uri, grtype, grtype);
-		fprintf(output, "  <td align=\"left\" valign=\"top\"> <a href=\"%s&amp;graph=%s&amp;action=selzoom\"> <img src=\"%s/zoom.gif\" border=0 alt=\"Zoom graph\" style='padding: 3px'> </a> </td>\n",
-			uri, grtype, getenv("BBSKIN"));
+		fprintf(output, "  <td align=\"left\" valign=\"top\"> <a href=\"%s&amp;graph=%s&amp;action=selzoom&amp;color=%s\"> <img src=\"%s/zoom.gif\" border=0 alt=\"Zoom graph\" style='padding: 3px'> </a> </td>\n",
+			uri, grtype, colorname(bgcolor), getenv("BBSKIN"));
 		break;
 
 	  case ACT_SELZOOM:
@@ -538,8 +543,8 @@
 	else
 		p += sprintf(p, "?host=%s", hostname);
 
-	p += sprintf(p, "&amp;service=%s&amp;graph_height=%d&amp;graph_width=%d", 
-		     service, graphheight, graphwidth);
+	p += sprintf(p, "&amp;service=%s&amp;graph_height=%d&amp;graph_width=%d&amp;color=%s", 
+		     service, graphheight, graphwidth, colorname(bgcolor));
 	if (displayname != hostname) p += sprintf(p, "&amp;disp=%s", displayname);
 	if (firstidx != -1) p += sprintf(p, "&amp;first=%d", firstidx+1);
 	if (idxcount != -1) p += sprintf(p, "&amp;count=%d", idxcount);
@@ -548,8 +553,8 @@
 	switch (action) {
 	  case ACT_MENU:
 		fprintf(stdout, "Content-type: %s\n\n", xgetenv("HTMLCONTENTTYPE"));
-		sethostenv(displayname, "", service, colorname(COL_GREEN), hostname);
-		headfoot(stdout, "graphs", "", "header", COL_GREEN);
+		sethostenv(displayname, "", service, colorname(bgcolor), hostname);
+		headfoot(stdout, "graphs", "", "header", bgcolor);
 
 		fprintf(stdout, "<table align=\"center\" summary=\"Graphs\">\n");
 
@@ -560,13 +565,13 @@
 
 		fprintf(stdout, "</table>\n");
 
-		headfoot(stdout, "graphs", "", "footer", COL_GREEN);
+		headfoot(stdout, "graphs", "", "footer", bgcolor);
 		return 0;
 
 	  case ACT_SELZOOM:
 		fprintf(stdout, "Content-type: %s\n\n", xgetenv("HTMLCONTENTTYPE"));
-		sethostenv(displayname, "", service, colorname(COL_GREEN), hostname);
-		headfoot(stdout, "graphs", "", "header", COL_GREEN);
+		sethostenv(displayname, "", service, colorname(bgcolor), hostname);
+		headfoot(stdout, "graphs", "", "header", bgcolor);
 
 
 		fprintf(stdout, "  <div id='zoomBox' style='position:absolute; overflow:none; left:0px; top:0px; width:0px; height:0px; visibility:visible; background:red; filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity:0.5'></div>\n");
@@ -608,13 +613,13 @@
 		}
 
 
-		headfoot(stdout, "graphs", "", "footer", COL_GREEN);
+		headfoot(stdout, "graphs", "", "footer", bgcolor);
 		return 0;
 
 	  case ACT_SHOWZOOM:
 		fprintf(stdout, "Content-type: %s\n\n", xgetenv("HTMLCONTENTTYPE"));
-		sethostenv(displayname, "", service, colorname(COL_GREEN), hostname);
-		headfoot(stdout, "graphs", "", "header", COL_GREEN);
+		sethostenv(displayname, "", service, colorname(bgcolor), hostname);
+		headfoot(stdout, "graphs", "", "header", bgcolor);
 
 		fprintf(stdout, "<table align=\"center\" summary=\"Graphs\">\n");
 
@@ -622,7 +627,7 @@
 
 		fprintf(stdout, "</table>\n");
 
-		headfoot(stdout, "graphs", "", "footer", COL_GREEN);
+		headfoot(stdout, "graphs", "", "footer", bgcolor);
 		return 0;
 
 	  case ACT_VIEW:
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/web/hobbitsvc-info.c ./web/hobbitsvc-info.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/web/hobbitsvc-info.c	2006-08-09 22:10:13.000000000 +0200
+++ ./web/hobbitsvc-info.c	2006-10-03 13:52:29.020438838 +0200
@@ -40,7 +40,7 @@
 	char *name;
 	int color;
 	char *dismsg;
-	time_t distime;
+	time_t distime, lastchange;
 	struct hinf_t *next;
 } hinf_t;
 hinf_t *tnames = NULL;
@@ -73,7 +73,7 @@
 	int testsz;
 	int haveuname = 0;
 
-	sprintf(hobbitcmd, "hobbitdboard fields=testname,color,disabletime,dismsg,client host=%s", hostname);
+	sprintf(hobbitcmd, "hobbitdboard fields=testname,color,disabletime,dismsg,client,lastchange host=^%s$", hostname);
 	if (sendmessage(hobbitcmd, NULL, NULL, &statuslist, 1, BBTALK_TIMEOUT) != BB_OK) {
 		return 1;
 	}
@@ -94,7 +94,8 @@
 			if (tok) { tnames[testcount].color = parse_color(tok); tok = gettok(NULL, "|"); }
 			if (tok) { tnames[testcount].distime = atol(tok); tok = gettok(NULL, "|"); }
 			if (tok) { tnames[testcount].dismsg = strdup(tok); tok = gettok(NULL, "|"); }
-			if (tok) { haveuname |= (*tok == 'Y'); }
+			if (tok) { haveuname |= (*tok == 'Y'); tok = gettok(NULL, "|"); }
+			if (tok) { tnames[testcount].lastchange = atol(tok); }
 			tnames[testcount].next = NULL;
 			testcount++;
 			if (testcount == testsz) {
@@ -113,7 +114,7 @@
 
 	/* Sort them so the display looks prettier */
 	qsort(&tnames[0], testcount, sizeof(hinf_t), test_name_compare);
-	xfree(statuslist); statuslist = NULL;
+	if (statuslist) xfree(statuslist); statuslist = NULL;
 
 
 	sprintf(hobbitcmd, "schedule");
@@ -241,6 +242,108 @@
 }
 
 
+static void generate_hobbit_statuslist(char *hostname, strbuffer_t *buf)
+{
+	char msgline[4096];
+	char datestr[100];
+	int i, btncount;
+	char *bbdatefmt;
+	strbuffer_t *servRed, *servYellow, *servPurple, *servBlue;
+	time_t logage;
+
+	bbdatefmt = xgetenv("BBDATEFORMAT");
+
+	servRed = newstrbuffer(0);
+	servYellow = newstrbuffer(0);
+	servPurple = newstrbuffer(0);
+	servBlue = newstrbuffer(0);
+
+	addtobuffer(buf, "<tr><th align=left valign=top>Status summary</th><td align=left>\n");
+	addtobuffer(buf, "<form name=\"colorsel\" action=\"nosubmit\" method=\"GET\">\n");
+	addtobuffer(buf, "<table summary=\"Status summary\" border=1>\n");
+	addtobuffer(buf, "<tr><th>Service</th><th>Since</th><th>Duration</th></tr>\n");
+
+	for (i = 0; i < testcount; i++) {
+		strftime(datestr, sizeof(datestr), bbdatefmt, localtime(&tnames[i].lastchange));
+		logage = time(NULL) - tnames[i].lastchange;
+
+		addtobuffer(buf, "<tr>");
+
+		sprintf(msgline, "<td><img src=\"%s/%s\" height=\"%s\" width=\"%s\" border=0 alt=\"%s status\"> %s</td>",
+			xgetenv("BBSKIN"), dotgiffilename(tnames[i].color, 0, 1),
+			xgetenv("DOTHEIGHT"), xgetenv("DOTWIDTH"),
+			colorname(tnames[i].color), tnames[i].name);
+		addtobuffer(buf, msgline);
+
+		sprintf(msgline, "<td>%s</td>", datestr);
+		addtobuffer(buf, msgline);
+
+		sprintf(msgline, "<td align=right>%d days, %02d hours, %02d minutes</td>",
+			(int)(logage / 86400),(int) ((logage % 86400) / 3600),(int) ((logage % 3600) / 60));
+		addtobuffer(buf, msgline);
+
+		addtobuffer(buf, "</tr>\n");
+
+		sprintf(msgline, ",%s", tnames[i].name);
+		switch (tnames[i].color) {
+		  case COL_BLUE   : addtobuffer(servBlue, msgline);   break;
+		  case COL_RED    : addtobuffer(servRed, msgline);    break;
+		  case COL_YELLOW : addtobuffer(servYellow, msgline); break;
+		  case COL_PURPLE : addtobuffer(servPurple, msgline); break;
+		}
+	}
+
+	btncount = 0;
+	if (STRBUFLEN(servRed) > 0)    btncount++;
+	if (STRBUFLEN(servYellow) > 0) btncount++;
+	if (STRBUFLEN(servPurple) > 0) btncount++;
+	if (STRBUFLEN(servBlue) > 0)   btncount++;
+	if (btncount > 0) {
+		addtobuffer(buf, "<tr><td colspan=3>\n");
+
+		addtobuffer(buf, "<table width=\"100%\">\n");
+		sprintf(msgline, "<tr><th colspan=%d><center><i>Toggle tests to disable</i></center></th></tr>\n", btncount);
+		addtobuffer(buf, msgline);
+
+		addtobuffer(buf, "<tr>\n");
+		if (STRBUFLEN(servRed) > 0) {
+			addtobuffer(buf, "<td align=center><input type=button value=\"Toggle red\" onClick=\"mark4Disable('");
+			addtostrbuffer(buf, servRed);
+			addtobuffer(buf, ",');\"></td>\n");
+		} 
+		if (STRBUFLEN(servYellow) > 0) {
+			addtobuffer(buf, "<td align=center><input type=button value=\"Toggle yellow\" onClick=\"mark4Disable('");
+			addtostrbuffer(buf, servYellow);
+			addtobuffer(buf, ",');\"></td>\n");
+		} 
+		if (STRBUFLEN(servPurple) > 0) {
+			addtobuffer(buf, "<td align=center><input type=button value=\"Toggle purple\" onClick=\"mark4Disable('");
+			addtostrbuffer(buf, servPurple);
+			addtobuffer(buf, ",');\"></td>\n");
+		} 
+		if (STRBUFLEN(servBlue) > 0) {
+			addtobuffer(buf, "<td align=center><input type=button value=\"Toggle blue\" onClick=\"mark4Disable('");
+			addtostrbuffer(buf, servBlue);
+			addtobuffer(buf, ",');\"></td>\n");
+		} 
+
+		addtobuffer(buf, "</tr>\n");
+		addtobuffer(buf, "</table>\n");
+
+		addtobuffer(buf,"</td></tr>\n");
+
+	}
+
+	addtobuffer(buf,"</table></form>\n");
+	addtobuffer(buf, "</td></tr>\n");
+	addtobuffer(buf, "<tr><td colspan=2>&nbsp;</td></tr>\n");
+
+	freestrbuffer(servRed);
+	freestrbuffer(servYellow);
+	freestrbuffer(servPurple);
+	freestrbuffer(servBlue);
+}
+
 static void generate_hobbit_disable(char *hostname, strbuffer_t *buf)
 {
 	int i;
@@ -256,7 +359,7 @@
 	beginyear = nowtm->tm_year + 1900;
 	endyear = nowtm->tm_year + 1900 + 5;
 
-	sprintf(l, "<form method=\"post\" action=\"%s/hobbit-enadis.sh\">\n", xgetenv("SECURECGIBINURL"));
+	sprintf(l, "<form name=\"disableform\" method=\"post\" action=\"%s/hobbit-enadis.sh\">\n", xgetenv("SECURECGIBINURL"));
 	addtobuffer(buf, l);
 	sprintf(l, "<table summary=\"%s disable\" border=1>\n", hostname);
 	addtobuffer(buf, l);
@@ -266,7 +369,18 @@
 	addtobuffer(buf, "<td rowspan=2><select multiple size=\"15\" name=\"disabletest\">\n");
 	addtobuffer(buf, "<option value=\"*\">ALL</option>\n");
 	for (i=0; (i < testcount); i++) {
-		sprintf(l, "<option value=\"%s\">%s</option>\n", tnames[i].name, tnames[i].name);
+		char *colstyle;
+		switch (tnames[i].color) {
+		  case COL_RED:	   colstyle = "color: red"; break;
+		  case COL_YELLOW: colstyle = "color: #FFDE0F"; break;
+		  case COL_GREEN:  colstyle = "color: green"; break;
+		  case COL_BLUE:   colstyle = "color: blue;"; break;
+		  case COL_PURPLE: colstyle = "color: fuchsia;"; break;
+		  default:         colstyle = "color: black;"; break;
+		}
+
+		sprintf(l, "<option value=\"%s\" style=\"%s\">%s</option>\n", 
+			tnames[i].name, colstyle, tnames[i].name);
 		addtobuffer(buf, l);
 	}
 	addtobuffer(buf, "</select></td>\n");
@@ -544,7 +658,7 @@
 	if (strcmp(val, "0.0.0.0") == 0) {
 		struct in_addr addr;
 		struct hostent *hent;
-		static char hostip[IP_ADDR_STRLEN];
+		static char hostip[IP_ADDR_STRLEN + 20];
 
 		hent = gethostbyname(hostname);
 		if (hent) {
@@ -809,6 +923,7 @@
 	if (gotstatus && showenadis) {
 		int i, anydisabled = 0;
 
+		generate_hobbit_statuslist(hostname, infobuf);
 		addtobuffer(infobuf, "<tr><th align=left valign=top>Disable tests</th><td align=left>\n");
 		generate_hobbit_disable(hostname, infobuf);
 		addtobuffer(infobuf, "</td></tr>\n");
diff -urN /home/henrik/hobbit/release/hobbit-4.2.0/web/hobbitsvc-trends.c ./web/hobbitsvc-trends.c
--- /home/henrik/hobbit/release/hobbit-4.2.0/web/hobbitsvc-trends.c	2006-08-09 22:10:13.000000000 +0200
+++ ./web/hobbitsvc-trends.c	2006-10-03 12:55:27.000000000 +0200
@@ -125,7 +125,7 @@
 	/* If no rrdgraphs definition, include all with default links */
 	if (hostrrdgraphs == NULL) {
 		dbgprintf("rrdlink_text: Standard URL (no rrdgraphs)\n");
-		return hobbit_graph_data(host->bbhostname, hostdisplayname, NULL, rrd->gdef, rrd->count, 
+		return hobbit_graph_data(host->bbhostname, hostdisplayname, NULL, -1, rrd->gdef, rrd->count, 
 					 HG_WITH_STALE_RRDS, wantmeta);
 	}
 
@@ -141,7 +141,7 @@
 			dbgprintf("rrdlink_text: Default URL included\n");
 
 			/* Yes, return default link for this RRD */
-			return hobbit_graph_data(host->bbhostname, hostdisplayname, NULL, rrd->gdef, rrd->count, 
+			return hobbit_graph_data(host->bbhostname, hostdisplayname, NULL, -1, rrd->gdef, rrd->count, 
 						 HG_WITH_STALE_RRDS, wantmeta);
 		}
 		else {
@@ -193,7 +193,7 @@
 			myrrd->gdef->maxgraphs = 0;
 			myrrd->count = rrd->count;
 			myrrd->next = NULL;
-			partlink = hobbit_graph_data(host->bbhostname, hostdisplayname, NULL, myrrd->gdef, myrrd->count, 
+			partlink = hobbit_graph_data(host->bbhostname, hostdisplayname, NULL, -1, myrrd->gdef, myrrd->count, 
 						     HG_WITH_STALE_RRDS, wantmeta);
 			if ((strlen(rrdlink) + strlen(partlink) + 1) >= rrdlinksize) {
 				rrdlinksize += strlen(partlink) + 4096;
@@ -215,7 +215,7 @@
 	}
 	else {
 		/* It is included with the default graph */
-		return hobbit_graph_data(host->bbhostname, hostdisplayname, NULL, rrd->gdef, rrd->count, 
+		return hobbit_graph_data(host->bbhostname, hostdisplayname, NULL, -1, rrd->gdef, rrd->count, 
 					 HG_WITH_STALE_RRDS, wantmeta);
 	}