[Nagiosplug-devel] RE: nagiosplug- check_snmp

Karl DeBisschop karl at debisschop.net
Fri Nov 15 04:21:00 CET 2002

On Fri, 2002-11-15 at 00:12, Subhendu Ghosh wrote:
> Another issue in check_snmp - process_arguments()
> case 's' and case 'r'
> eval_method[jj++] can go out of bounds.  
> Since we are only supporting one string match or regex match - and 
> always for the last provided OID, should not increment jj.

ISTM it would be nice to not require that it be the last OID. Actually,
I'd like to be able to check more than one string, but that can wait.

So what it really needs is just a check against MAX_OID (or we need to
change that structure and realloc eval_method). In general, I support
removing precomiled limits.

> How jj is determined is an issue since there are a couple of pathways
> through the switch statement depending on the order of the arguments on
> the command line.

Yes there are several paths. In my thinking, there are sort of three
forks -- jj gets incremented by either

1) a string test (-s, -r, -R)
2) an existence test (-e, -E, when they really work)
3) an integer test (-w and -c)

But the last is unique in that you need to allow both WARN and CRIT

Overall, there's alot of work that can be done to clean up that
processing. For the release, unless there are serious objections, maybe
we don't need to commit to making it truly bullet proof. As long as it's
possible to specify what the docs say you can, I suggest deferring a
major rewrite for 1.3.1

But a rewrite is probably waranted.

> So long as -s and -r are specifed immediately after -o, we are ok.  If we 
> get -w, or -c between -o and -s/-r : we will have out of bounds.

Can't we just add a check against MAX_OID?

Karl DeBisschop <karl at debisschop.net>

More information about the Devel mailing list