Xymon Mailing List Archive search

[bug?] expect in bb-services should set banner automagically

list Henrik Størner
Mon, 10 Jul 2006 10:39:49 +0200
Message-Id: <user-0542f2425543@xymon.invalid>

On Mon, Jul 10, 2006 at 09:32:47AM +0200, Charles Goyard wrote:
Henrik Stoerner a écrit :
Won't it be nice to have an "auto banner ON" when expecting some
feedback from the server ?
No, I don't think so. Some of the data you get back might very well be
binary that you don't want to display.
That is, when I drop the banner option, all my ajp13 tests go yellow
saying "Unexpected service response". As soon as I put the banner option
back, they turn green.

It that case, I get binary data I don't want to display, but omitting
the banner options fails :

2006-07-10 09:29:25 Adding to combo msg: status mywonderfultomcat.ajp13 yellow
    <!-- [flags:OrdastLe] --> Mon Jul 10 09:28:21 2006 ajp13 NOT ok 
2006-07-10 09:29:25 tcp_got_expected: No data in banner

This is why I suspect a bug, or at least a misfeature ;)
OK, I see now. Could you try if the attached patch solves this problem?

Regards,
Henrik

-------------- next part --------------
--- bbnet/contest.c	2006/05/03 21:12:33	1.85
+++ bbnet/contest.c	2006/07/10 08:37:45
@@ -1014,9 +1014,12 @@
 						 * If we have anything to send then send it.
 						 * If we want the banner, set the "readpending" flag to initiate
 						 * select() for read()'s.
+						 * NB: We want the banner EITHER if the GET_BANNER flag is set,
+						 *     OR if we need it to match the expect string in the servicedef.
 						 */
 
-						item->readpending = (do_talk && !item->silenttest && (item->svcinfo->flags & TCP_GET_BANNER));
+						item->readpending = (do_talk && !item->silenttest && 
+							( (item->svcinfo->flags & TCP_GET_BANNER) || item->svcinfo->exptext ));
 						if (do_talk) {
 							if (item->telnetnegotiate && item->telnetbuflen) {
 								/*