[Nagiosplug-devel] [ nagiosplug-Patches-1346104 ] check_tcp -s/-q line ends not handled consistently

SourceForge.net noreply at sourceforge.net
Wed Mar 22 08:54:05 CET 2006


Patches item #1346104, was opened at 2005-11-02 16:06
Message generated for change (Comment added) made by tonvoon
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1346104&group_id=29880

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Bugfix
Group: None
Status: Closed
Resolution: Accepted
Priority: 5
Submitted By: John Rouillard (rouilj)
Assigned to: Ton Voon (tonvoon)
Summary: check_tcp -s/-q line ends not handled consistently

Initial Comment:
check_tcp adds a \r\n to the quit string specified by
-q but
not to the send string specified with -s. This is confusing
and also makes it a major pain to test services using
check_tcp where the service expects an alternate line
ending.

This is even more difficult if using something like
check_by_ssh to perform the remote check_tcp invocation.

The attached patch against the 1.4.2 released check_tcp
adds a "-l <b|e|n|r>" flag that allows the line ending
to be set
to 'b'oth <cr><lf>, 'e'mpty, 'n'ewline or 'r'eturn. The
default
is "-l e" for the -s string and "-l b" for the quit
string replicating current behavior.

-- rouilj-np at renesys.com


----------------------------------------------------------------------

>Comment By: Ton Voon (tonvoon)
Date: 2006-03-22 16:53

Message:
Logged In: YES 
user_id=664364

John,

I think the bug you see re: the quit is a line that was missing in your patch:

case 'e':
  lineend = strdup("");
  lineendquit = lineend;
  break;

You missed the lineendquit in your patch, so it was not getting reset to blank.

However, the real gem is nc! That looks very interesting as I think I can do 
lots of simulation for testing now. Thanks for the pointer!

Ton

----------------------------------------------------------------------

Comment By: John Rouillard (rouilj)
Date: 2006-03-22 16:36

Message:
Logged In: YES 
user_id=707416

Set up a simple server using netcat 
nc -l -p 3333 | od -c ) and connect to it using:

  check_tcp -le -s send -le -q quit -H localhost -p 3333

you should see "s e n d q u i t". Which may be an bug
as I see: "s   e   n   d   q   u   i   t  \r  \n" when
I tried the above. Looks like the -le argument isn't
suppressing the \r\n line ending for the quit string.

  check_tcp -ln -s send -q quit -H localhost -p 3333

should (and does) produce:

  "s   e   n   d  \n   q   u   i   t  \n"

and so forth.

-- rouilj



----------------------------------------------------------------------

Comment By: Ton Voon (tonvoon)
Date: 2006-03-22 15:44

Message:
Logged In: YES 
user_id=664364

John,

Thanks for the patch. Have applied to CVS HEAD.

Have you got any suggestions on how to test?

Ton


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1346104&group_id=29880




More information about the Devel mailing list