[Pkg-nagios-changes] [pkg-monitoring-plugins] 02/03: Add patches/11_check_dhcp_parsing_option from upstream maint branch (Closes: #784319)
Jan Wagner
waja at moszumanska.debian.org
Sun Oct 4 11:09:31 UTC 2015
This is an automated email from the git hooks/post-receive script.
waja pushed a commit to branch master
in repository pkg-monitoring-plugins.
commit 8e98d7f62fa350f88d6804c1c6822cb4e0ebab31
Author: Jan Wagner <waja at cyconet.org>
Date: Sun Oct 4 12:42:07 2015 +0200
Add patches/11_check_dhcp_parsing_option from upstream maint branch (Closes: #784319)
---
debian/patches/11_check_dhcp_parsing_option | 107 ++++++++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 108 insertions(+)
diff --git a/debian/patches/11_check_dhcp_parsing_option b/debian/patches/11_check_dhcp_parsing_option
new file mode 100644
index 0000000..10700c8
--- /dev/null
+++ b/debian/patches/11_check_dhcp_parsing_option
@@ -0,0 +1,107 @@
+From 466cb79e5224327c29fc6b84a1cec99c2b190c5a Mon Sep 17 00:00:00 2001
+From: Holger Weiss <holger at zedat.fu-berlin.de>
+Date: Fri, 2 Oct 2015 12:18:13 +0200
+Subject: [PATCH] check_dhcp: Fix option parsing
+
+The call_getopt() function didn't always return the correct number of
+processed arguments. However, since check_dhcp doesn't support
+non-option arguments, the caller doesn't need this number anyway.
+
+Closes #1345.
+---
+ plugins-root/check_dhcp.c | 43 ++++++++++++-------------------------------
+ 1 file changed, 12 insertions(+), 31 deletions(-)
+
+diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c
+index 5508d5f..25d4ed4 100644
+--- a/plugins-root/check_dhcp.c
++++ b/plugins-root/check_dhcp.c
+@@ -229,7 +229,7 @@ struct in_addr requested_address;
+
+ int process_arguments(int, char **);
+ int call_getopt(int, char **);
+-int validate_arguments(void);
++int validate_arguments(int, int);
+ void print_usage(void);
+ void print_help(void);
+
+@@ -1059,29 +1059,19 @@ int get_results(void){
+
+ /* process command-line arguments */
+ int process_arguments(int argc, char **argv){
+- int c;
++ int arg_index;
+
+ if(argc<1)
+ return ERROR;
+
+- c=0;
+- while((c+=(call_getopt(argc-c,&argv[c])))<argc){
+-
+- /*
+- if(is_option(argv[c]))
+- continue;
+- */
+- }
+-
+- return validate_arguments();
++ arg_index = call_getopt(argc,argv);
++ return validate_arguments(argc,arg_index);
+ }
+
+
+
+ int call_getopt(int argc, char **argv){
+- int c=0;
+- int i=0;
+-
++ extern int optind;
+ int option_index = 0;
+ static struct option long_options[] =
+ {
+@@ -1098,25 +1088,14 @@ int call_getopt(int argc, char **argv){
+ };
+
+ while(1){
+- c=getopt_long(argc,argv,"+hVvt:s:r:t:i:m:u",long_options,&option_index);
++ int c=0;
+
+- i++;
++ c=getopt_long(argc,argv,"+hVvt:s:r:t:i:m:u",long_options,&option_index);
+
+ if(c==-1||c==EOF||c==1)
+ break;
+
+ switch(c){
+- case 'w':
+- case 'r':
+- case 't':
+- case 'i':
+- i++;
+- break;
+- default:
+- break;
+- }
+-
+- switch(c){
+
+ case 's': /* DHCP server address */
+ resolve_host(optarg,&dhcp_ip);
+@@ -1181,12 +1160,14 @@ int call_getopt(int argc, char **argv){
+ break;
+ }
+ }
+-
+- return i;
++ return optind;
+ }
+
+
+-int validate_arguments(void){
++int validate_arguments(int argc, int arg_index){
++
++ if(argc-optind > 0)
++ usage(_("Got unexpected non-option argument"));
+
+ return OK;
+ }
diff --git a/debian/patches/series b/debian/patches/series
index b976f43..87197bc 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
02_check_icmp_links
# commited upstream
10_sslutils_checksslv3
+11_check_dhcp_parsing_option
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-nagios/pkg-monitoring-plugins.git
More information about the Pkg-nagios-changes
mailing list