[Nagiosplug-devel] [ nagiosplug-Bugs-3556040 ] check_smtp error when combining -S and -e

SourceForge.net noreply at sourceforge.net
Fri Aug 10 14:39:48 CEST 2012


Bugs item #3556040, was opened at 2012-08-10 05:39
Message generated for change (Tracker Item Submitted) made by lgarrett
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=3556040&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: Argument proccessing
Group: CVS
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: lgarrett (lgarrett)
Assigned to: Nobody/Anonymous (nobody)
Summary: check_smtp error when combining -S and -e

Initial Comment:
Hi,

tested with git checkout as of today:

$ ./check_smtp -S -H mail.programmfabrik.de -e "220 mail.berlin.programmfabrik.de ESMTP Postfix (Debian/GNU)" -p 25 -D 30 -v 
HELOCMD: EHLO mycomputer
220 mail.berlin.programmfabrik.de ESMTP Postfix (Debian/GNU)
Server does not support STARTTLS
sent QUIT
^C

In fact, our SMTP server does support STARTTLS, as shown here:

$ ./check_smtp -S -H mail.programmfabrik.de  -p 25 -D 30 -v 
HELOCMD: EHLO lgarrett-Inspiron-531
220 mail.berlin.programmfabrik.de ESMTP Postfix (Debian/GNU)
sent EHLO mycomputer
250-mail.berlin.programmfabrik.de
250-PIPELINING
250-SIZE 157286400
250-VRFY
250-ETRN
250-AUTH DIGEST-MD5 PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
sent QUIT
received 221 2.0.0 Bye

SMTP OK - 0.027 sec. response time, 221 2.0.0 Bye
|time=0.027238s;;;0.000000


Running check_smtp in gdb showed me the following:

$ gdb --args ./check_smtp -S -H mail.programmfabrik.de -e "220 mail.berlin.programmfabrik.de ESMTP Postfix (Debian/GNU)" -p 25 -D 30 -v 
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /scratch/nagios/nagios-plugins/plugins/check_smtp...done.
(gdb) b 235
Breakpoint 1 at 0x403e4f: file check_smtp.c, line 235.
(gdb) run
Starting program: /scratch/nagios/nagios-plugins/plugins/check_smtp -S -H mail.programmfabrik.de -e 220\ mail.berlin.programmfabrik.de\ ESMTP\ Postfix\ \(Debian/GNU\) -p 25 -D 30 -v
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
HELOCMD: EHLO mycomputer
220 mail.berlin.programmfabrik.de ESMTP Postfix (Debian/GNU)

Breakpoint 1, main (argc=<optimized out>, argv=<optimized out>) at check_smtp.c:235
235			    printf (_("Server does not support STARTTLS\n"));
(gdb) print buffer
$1 = "220 2.0.0 Ready to start TLS\r\n\000de\r\n250-PIPELINING\r\n250-SIZE 157286400\r\n250-VRFY\r\n250-ETRN\r\n250-STARTTLS\r\n250-AUTH DIGEST-MD5 PLAIN\r\n250-ENHANCEDSTATUSCODES\r\n250-8BITMIME\r\n250 DSN\r\n", '\000' <repeats 8011 times>
(gdb) print server_expect
$2 = 0x7fffffffe12e "220 mail.berlin.programmfabrik.de ESMTP Postfix (Debian/GNU)"
(gdb) q
A debugging session is active.

	Inferior 1 [process 30377] will be killed.

Quit anyway? (y or n) y



Looking into the code, we are checking for the expect string in line 198 of check_smtp.c. However, we do the same again in line 234, this time matching against the returned string after the 'STARTTLS' command being sent. This looks like a bug to me. Commenting out the if-block solved my problem, I don't know if it's a proper fix though.

Regards,
Lee

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

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




More information about the Devel mailing list