[Pkg-nagios-changes] [pkg-nagios-plugins] 189/413: add proxy auth

Jan Wagner waja at moszumanska.debian.org
Tue Nov 26 23:13:22 UTC 2013


This is an automated email from the git hooks/post-receive script.

waja pushed a commit to branch master
in repository pkg-nagios-plugins.

commit c5502bfe3316383a9a2cb22c37648c059e57e2ef
Author: Jan Wagner <waja at cyconet.org>
Date:   Wed Oct 14 21:21:41 2009 +0000

    add proxy auth
---
 debian/changelog                               |  2 +
 debian/patches/40_check_http_proxy_auth.dpatch | 82 ++++++++++++++++++++++++++
 2 files changed, 84 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 456af21..1c06676 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -15,6 +15,8 @@ nagios-plugins (1.4.14-1) UNRELEASED; urgency=low
   * Remove coreutils from build-depends, it's essential
   * Raise compat level to 5
   * Update 06_checkircd.dpatch, which got fixed upstream
+  * Add 40_check_http_proxy_auth.dpatch to make check_http able to check proxy
+    authorization
 
  -- Jan Wagner <waja at cyconet.org>  Thu, 06 Aug 2009 00:11:51 +0200
 
diff --git a/debian/patches/40_check_http_proxy_auth.dpatch b/debian/patches/40_check_http_proxy_auth.dpatch
new file mode 100644
index 0000000..bb51600
--- /dev/null
+++ b/debian/patches/40_check_http_proxy_auth.dpatch
@@ -0,0 +1,82 @@
+#! /bin/sh -e
+## 40_check_http_proxy_auth.dpatch
+## From: Thomas Guyot-Sionnest <dermoth at aei.ca>
+## Date: Tue, 22 Sep 2009 01:20:33 +0000 (-0400)
+## Subject: Add proxy-authorization option to check_http (Peter Doherty - #2863772, Bryan Irvine... 
+## X-Git-Url: http://repo.or.cz/w/nagiosplugins.git?a=commitdiff_plain;h=08199792ba8bf19c2dbdc27f68689e571d4240a9
+##
+## DP: Add proxy-authorization option to check_http
+
+ at DPATCH@
+
+diff --git a/plugins/check_http.c b/plugins/check_http.c
+index 79f6adf..b4e6004 100644
+--- a/plugins/check_http.c
++++ b/plugins/check_http.c
+@@ -105,6 +105,7 @@ int check_warning_time = FALSE;
+ double critical_time = 0;
+ int check_critical_time = FALSE;
+ char user_auth[MAX_INPUT_BUFFER] = "";
++char proxy_auth[MAX_INPUT_BUFFER] = "";
+ int display_html = FALSE;
+ char **http_opt_headers;
+ int http_opt_headers_count = 0;
+@@ -192,6 +193,7 @@ process_arguments (int argc, char **argv)
+     {"url", required_argument, 0, 'u'},
+     {"port", required_argument, 0, 'p'},
+     {"authorization", required_argument, 0, 'a'},
++    {"proxy_authorization", required_argument, 0, 'b'},
+     {"string", required_argument, 0, 's'},
+     {"expect", required_argument, 0, 'e'},
+     {"regex", required_argument, 0, 'r'},
+@@ -229,7 +231,7 @@ process_arguments (int argc, char **argv)
+   }
+ 
+   while (1) {
+-    c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option);
++    c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:b:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option);
+     if (c == -1 || c == EOF)
+       break;
+ 
+@@ -350,6 +352,10 @@ process_arguments (int argc, char **argv)
+       strncpy (user_auth, optarg, MAX_INPUT_BUFFER - 1);
+       user_auth[MAX_INPUT_BUFFER - 1] = 0;
+       break;
++    case 'b': /* proxy-authorization info */
++      strncpy (proxy_auth, optarg, MAX_INPUT_BUFFER - 1);
++      proxy_auth[MAX_INPUT_BUFFER - 1] = 0;
++      break;
+     case 'P': /* HTTP POST data in URL encoded format; ignored if settings already */
+       if (! http_post_data)
+         http_post_data = strdup (optarg);
+@@ -836,6 +842,12 @@ check_http (void)
+     asprintf (&buf, "%sAuthorization: Basic %s\r\n", buf, auth);
+   }
+ 
++  /* optionally send the proxy authentication info */
++  if (strlen(proxy_auth)) {
++    base64_encode_alloc (proxy_auth, strlen (proxy_auth), &auth);
++    asprintf (&buf, "%sProxy-Authorization: Basic %s\r\n", buf, auth);
++  }
++
+   /* either send http POST data (any data, not only POST)*/
+   if (http_post_data) {
+     if (http_content_type) {
+@@ -1346,6 +1358,8 @@ print_help (void)
+ 
+   printf (" %s\n", "-a, --authorization=AUTH_PAIR");
+   printf ("    %s\n", _("Username:password on sites with basic authentication"));
++  printf (" %s\n", "-b, --proxy-authorization=AUTH_PAIR");
++  printf (" 	%s\n", _("Username:password on proxy-servers with basic authentication"));
+   printf (" %s\n", "-A, --useragent=STRING");
+   printf ("    %s\n", _("String to be sent in http header as \"User Agent\""));
+   printf (" %s\n", "-k, --header=STRING");
+@@ -1407,7 +1421,7 @@ print_usage (void)
+   printf (_("Usage:"));
+   printf (" %s -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]\n",progname);
+   printf ("       [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n");
+-  printf ("       [-a auth] [-f <ok | warn | critcal | follow | sticky | stickyport>]\n");
++  printf ("       [-a auth] [-b proxy_auth] [-f <ok | warn | critcal | follow | sticky | stickyport>]\n");
+   printf ("       [-e <expect>] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n");
+   printf ("       [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]\n");
+   printf ("       [-A string] [-k string] [-S] [-C <age>] [-T <content-type>] [-j method]\n");

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-nagios/pkg-nagios-plugins.git



More information about the Pkg-nagios-changes mailing list