[Nagiosplug-devel] check_ping problem

Jeremy T. Bouse jeremy+nagios at undergrid.net
Fri Jul 23 11:26:10 CEST 2004


	Hmmm... I must be mistaken as it's been awhile since I've look'd
into these functions for verify hostnames and IP addresses given to
is_host() when I was working on the AF-independent code. I thought most
of this had all been re-written but would be in CVS not in the current
1.3.1 code base if I'm correct.

	Regards,
	Jeremy

On Fri, Jul 23, 2004 at 09:15:47AM -0400, Robert Nelson wrote:
> Thanks Karl! I appreciate the quick response. I'll fix and recompile the
> plugins and see if it fixes things. Changing the name of our POP was a
> bit dramatic :)
> 
> In the future, is this the best way for a psuedo programmer like myself
> to pass on bugs and help out, or is there a better way that's less work
> for you guys? Sorry, but I don't know jack about patching and diff'ing
> source files!
> 
> Rob Nelson
> Network Engineer
> Windchannel Communications
> 919-538-6326 
> 
> > -----Original Message-----
> > From: Karl DeBisschop [mailto:karl at debisschop.net] 
> > Sent: Friday, July 23, 2004 7:57 AM
> > To: Robert Nelson
> > Cc: Walt Howard; nagiosplug-devel at lists.sourceforge.net
> > Subject: RE: [Nagiosplug-devel] check_ping problem
> > 
> > 
> > Robert Nelson said:
> > >> A reasonable question is whether this is a problem in the
> > >> nagios plugin
> > >> or in your local resolver library.  If you just type a
> > >>   ping tap-5300h.2wachovia.nc.windchannel.com
> > >> to a shell prompt, do you get normal output or a resolver 
> > error?  If
> > >> the bare ping command works, you may have to tweak the 
> > check_ping to
> > >> use it instead of some ping program that comes with the
> > >> nagios plugins.
> > >> (My nagios box is down at the moment so I can't check exactly where
> > >> nagios gets its ping; I do remember that it configured it 
> > wrong and I
> > >> had to fix that).
> > >
> > > Pings and nslookups themselves resolve fine without 
> > difficulty, which is
> > > why I was so surprised :) I'm using nagios-plugins-1.3.1 
> > and here's what
> > > I found - goes beyond check_ping, in fact:
> > >
> > >
> > > The offending code in check_ping.c is (starting on line 200):
> > >
> > > =====
> > >                 case 'H':       /* hostname */
> > >                         if (is_host (optarg) == FALSE)
> > >                                 usage2 ("Invalid host name/address",
> > > optarg);
> > >                         server_address = optarg;
> > >                         break;
> > > =====
> > >
> > > The is_host seems to be defined in utils.c on line 167:
> > >
> > > =====
> > > int
> > > is_host (char *address)
> > > {
> > >         if (is_dotted_quad (address) || is_hostname (address))
> > >                 return (TRUE);
> > >         return (FALSE);
> > > }
> > > =====
> > >
> > > That then leads to utils.c on line 215:
> > >
> > > =====
> > > int
> > > is_hostname (char *s1)
> > > {
> > >         if (!s1 || strlen (s1) > 255) {
> > >                 return FALSE;
> > >         }
> > >         /* if s1 contains anything but ALPHA, NUM, dash, or period*/
> > >         if (strcspn (s1,
> > > 
> > "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUWVXYZ0123456789-.") !=
> > > 0) {
> > >                 return FALSE;
> > >         }
> > >         /* or if s1 begins with dash or period */
> > >         if (strspn (s1, "-.") == 1) {
> > >                 return FALSE;
> > >         }
> > >   /* '..' and '.-' are not legal either */
> > >         while ((s1 = index (s1, '.'))) {
> > >                 s1++;
> > >                 if (strspn (s1, "0123456789-.") == 1) {
> > >                         return FALSE;
> > >                 }
> > >         }
> > >         return TRUE;
> > > }
> > > =====
> > >
> > > I know enough about code to be dangerous but not offer 
> > anything helpful.
> > > But I'm going to try anyway ;) If I remove the last if test, it will
> > > probably start accepting the domain 2wachovia...However, 
> > I'm not sure
> > > why a check for '..' and '.-' use a regex that will match 
> > '.0' through
> > > '.9' as well. What else would this affect, if I "fixed" that if
> > > statement and recompiled? And how long can I reasonably 
> > expect for any
> > > such fix to happen and be merged with the source?
> > 
> > You can go ahead and make the change - this regex correspnds 
> > to the old
> > definition of an arpa hostname - which is stricter than the present
> > defintion.
> > 
> > Fixing the code in CVS is on the TODO list.
> > 
> > --
> > Karl
> > 
> > 
> > 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by BEA Weblogic Workshop
> FREE Java Enterprise J2EE developer tools!
> Get your free copy of BEA WebLogic Workshop 8.1 today.
> http://ads.osdn.com/?ad_idG21&alloc_id040&op=click
> _______________________________________________
> Nagiosplug-devel mailing list
> Nagiosplug-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel
> ::: Please include plugins version (-v) and OS when reporting any issue.
> ::: Messages without supporting info will risk being sent to /dev/null




More information about the Devel mailing list