diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2012-06-13 12:36:42 +0200 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2012-06-13 12:36:42 +0200 |
commit | f091d59e0f9abec9304d9d230fafc2dec001baba (patch) | |
tree | 8485cbc75a5ec6cc90f97a21119d44797805607b | |
parent | a80eafbf9cab9d80c526c504edf2ee4446a072d9 (diff) | |
download | monitoring-plugins-f091d59e0f9abec9304d9d230fafc2dec001baba.tar.gz |
check_dhcp: Fix handling of "pad" options
Don't let "pad" options[*] terminate the parsing of DHCP options. This
bug was triggered by using check_dhcp against Windows 2003 DHCP servers
(see #3503921).
[*] Cf. RFC 2132, 3.1.
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | plugins-root/check_dhcp.c | 7 |
2 files changed, 5 insertions, 3 deletions
@@ -24,6 +24,7 @@ This file documents the major additions and syntax changes between releases. | |||
24 | Fix segfault in check_host when hostname returns multiple IP addresses (Sebastian Harl) | 24 | Fix segfault in check_host when hostname returns multiple IP addresses (Sebastian Harl) |
25 | Fix check_smtp and check_tcp where duplicate messages were displayed for certificate errors | 25 | Fix check_smtp and check_tcp where duplicate messages were displayed for certificate errors |
26 | Fix check_ping's parsing of the output of Debian's ping6(1) implementation (#1894850 - Matej Vela) | 26 | Fix check_ping's parsing of the output of Debian's ping6(1) implementation (#1894850 - Matej Vela) |
27 | Fix a check_dhcp bug which was triggered by using it to check Windows 2003 DHCP servers (#3503921) | ||
27 | Disable RFC4507 support, to work around SSL negotiation issues with (at least) some Tomcat versions | 28 | Disable RFC4507 support, to work around SSL negotiation issues with (at least) some Tomcat versions |
28 | 29 | ||
29 | 1.4.15 27th July 2010 | 30 | 1.4.15 27th July 2010 |
diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c index 2a1875c4..ac892747 100644 --- a/plugins-root/check_dhcp.c +++ b/plugins-root/check_dhcp.c | |||
@@ -839,8 +839,7 @@ int add_dhcp_offer(struct in_addr source,dhcp_packet *offer_packet){ | |||
839 | /* process all DHCP options present in the packet */ | 839 | /* process all DHCP options present in the packet */ |
840 | for(x=4;x<MAX_DHCP_OPTIONS_LENGTH;){ | 840 | for(x=4;x<MAX_DHCP_OPTIONS_LENGTH;){ |
841 | 841 | ||
842 | /* end of options (0 is really just a pad, but bail out anyway) */ | 842 | if((int)offer_packet->options[x]==-1) |
843 | if((int)offer_packet->options[x]==-1 || (int)offer_packet->options[x]==0) | ||
844 | break; | 843 | break; |
845 | 844 | ||
846 | /* get option type */ | 845 | /* get option type */ |
@@ -872,7 +871,9 @@ int add_dhcp_offer(struct in_addr source,dhcp_packet *offer_packet){ | |||
872 | } | 871 | } |
873 | 872 | ||
874 | /* skip option data we're ignoring */ | 873 | /* skip option data we're ignoring */ |
875 | if(option_type!=DHCP_OPTION_REBINDING_TIME) | 874 | if(option_type==0) /* "pad" option, see RFC 2132 (3.1) */ |
875 | x+=1; | ||
876 | else | ||
876 | x+=option_length; | 877 | x+=option_length; |
877 | } | 878 | } |
878 | 879 | ||