Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate

Advertising

Miscellany
Monday, April 14th, 2008 at 5:46:00pm UTC 

  1. diff -u nagios-plugins-1.4.11/debian/changelog nagios-plugins-1.4.11/debian/changelog
  2. --- nagios-plugins-1.4.11/debian/changelog
  3. +++ nagios-plugins-1.4.11/debian/changelog
  4. @@ -1,3 +1,10 @@
  5. +nagios-plugins (1.4.11-1ubuntu3) hardy; urgency=low
  6. +
  7. +  * debian/patches/99_check_http_segfault.dpatch.
  8. +    - Fix segfaulting when check_http -a x. (LP: #201054)
  9. +
  10. + -- Chuck Short <[email protected]>  Mon, 14 Apr 2008 12:47:52 -0400
  11. +
  12.  nagios-plugins (1.4.11-1ubuntu2) hardy; urgency=low
  13.  
  14.    * Replace nagios-plugins-extras. (LP: #212632)
  15. diff -u nagios-plugins-1.4.11/debian/patches/00list nagios-plugins-1.4.11/debian/patches/00list
  16. --- nagios-plugins-1.4.11/debian/patches/00list
  17. +++ nagios-plugins-1.4.11/debian/patches/00list
  18. @@ -11,0 +12 @@
  19. +99_check_http_segfault.dpatch
  20. only in patch2:
  21. unchanged:
  22. --- nagios-plugins-1.4.11.orig/debian/patches/99_check_http_segfault.dpatch
  23. +++ nagios-plugins-1.4.11/debian/patches/99_check_http_segfault.dpatch
  24. @@ -0,0 +1,759 @@
  25. +#! /bin/sh /usr/share/dpatch/dpatch-run
  26. +
  27. +diff -Naur nagios-plugins-1.4.11.orig/lib/base64.c nagios-plugins-1.4.11/lib/base64.c
  28. +--- nagios-plugins-1.4.11.orig/lib/base64.c    2007-11-09 16:17:03.000000000 -0500
  29. ++++ nagios-plugins-1.4.11/lib/base64.c 2008-04-14 11:12:35.000000000 -0400
  30. [email protected]@ -1,50 +1,425 @@
  31. +-/****************************************************************************
  32. +-* Function to encode in Base64
  33. +-*
  34. +-* Written by Lauri Alanko
  35. +-*
  36. +-*****************************************************************************/
  37. ++/* base64.c -- Encode binary data using printable characters.
  38. ++   Copyright (C) 1999, 2000, 2001, 2004, 2005, 2006 Free Software
  39. ++   Foundation, Inc.
  40. +
  41. +-#include "common.h"
  42. ++   This program is free software; you can redistribute it and/or modify
  43. ++   it under the terms of the GNU General Public License as published by
  44. ++   the Free Software Foundation; either version 3, or (at your option)
  45. ++   any later version.
  46. ++
  47. ++   This program is distributed in the hope that it will be useful,
  48. ++   but WITHOUT ANY WARRANTY; without even the implied warranty of
  49. ++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  50. ++   GNU General Public License for more details.
  51. ++
  52. ++   You should have received a copy of the GNU General Public License
  53. ++   along with this program; if not, write to the Free Software Foundation,
  54. ++   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  55. ++
  56. ++/* Written by Simon Josefsson.  Partially adapted from GNU MailUtils
  57. ++ * (mailbox/filter_trans.c, as of 2004-11-28).  Improved by review
  58. ++ * from Paul Eggert, Bruno Haible, and Stepan Kasal.
  59. ++ *
  60. ++ * See also RFC 3548 <http://www.ietf.org/rfc/rfc3548.txt>.
  61. ++ *
  62. ++ * Be careful with error checking.  Here is how you would typically
  63. ++ * use these functions:
  64. ++ *
  65. ++ * bool ok = base64_decode_alloc (in, inlen, &out, &outlen);
  66. ++ * if (!ok)
  67. ++ *   FAIL: input was not valid base64
  68. ++ * if (out == NULL)
  69. ++ *   FAIL: memory allocation error
  70. ++ * OK: data in OUT/OUTLEN
  71. ++ *
  72. ++ * size_t outlen = base64_encode_alloc (in, inlen, &out);
  73. ++ * if (out == NULL && outlen == 0 && inlen != 0)
  74. ++ *   FAIL: input too long
  75. ++ * if (out == NULL)
  76. ++ *   FAIL: memory allocation error
  77. ++ * OK: data in OUT/OUTLEN.
  78. ++ *
  79. ++ */
  80. ++
  81. ++#include <config.h>
  82. ++
  83. ++/* Get prototype. */
  84. + #include "base64.h"
  85. +
  86. +-char *
  87. +-base64 (const char *bin, size_t len)
  88. ++/* Get malloc. */
  89. ++#include <stdlib.h>
  90. ++
  91. ++/* Get UCHAR_MAX. */
  92. ++#include <limits.h>
  93. ++
  94. ++/* C89 compliant way to cast 'char' to 'unsigned char'. */
  95. ++static inline unsigned char
  96. ++to_uchar (char ch)
  97. ++{
  98. ++  return ch;
  99. ++}
  100. ++
  101. ++/* Base64 encode IN array of size INLEN into OUT array of size OUTLEN.
  102. ++   If OUTLEN is less than BASE64_LENGTH(INLEN), write as many bytes as
  103. ++   possible.  If OUTLEN is larger than BASE64_LENGTH(INLEN), also zero
  104. ++   terminate the output buffer. */
  105. ++void
  106. ++base64_encode (const char *restrict in, size_t inlen,
  107. ++             char *restrict out, size_t outlen)
  108. ++{
  109. ++  static const char b64str[64] =
  110. ++    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  111. ++
  112. ++  while (inlen && outlen)
  113. ++    {
  114. ++      *out++ = b64str[(to_uchar (in[0]) >> 2) & 0x3f];
  115. ++      if (!--outlen)
  116. ++      break;
  117. ++      *out++ = b64str[((to_uchar (in[0]) << 4)
  118. ++                   + (--inlen ? to_uchar (in[1]) >> 4 : 0))
  119. ++                  & 0x3f];
  120. ++      if (!--outlen)
  121. ++      break;
  122. ++      *out++ =
  123. ++      (inlen
  124. ++       ? b64str[((to_uchar (in[1]) << 2)
  125. ++               + (--inlen ? to_uchar (in[2]) >> 6 : 0))
  126. ++              & 0x3f]
  127. ++       : '=');
  128. ++      if (!--outlen)
  129. ++      break;
  130. ++      *out++ = inlen ? b64str[to_uchar (in[2]) & 0x3f] : '=';
  131. ++      if (!--outlen)
  132. ++      break;
  133. ++      if (inlen)
  134. ++      inlen--;
  135. ++      if (inlen)
  136. ++      in += 3;
  137. ++    }
  138. ++
  139. ++  if (outlen)
  140. ++    *out = '\0';
  141. ++}
  142. ++
  143. ++/* Allocate a buffer and store zero terminated base64 encoded data
  144. ++   from array IN of size INLEN, returning BASE64_LENGTH(INLEN), i.e.,
  145. ++   the length of the encoded data, excluding the terminating zero.  On
  146. ++   return, the OUT variable will hold a pointer to newly allocated
  147. ++   memory that must be deallocated by the caller.  If output string
  148. ++   length would overflow, 0 is returned and OUT is set to NULL.  If
  149. ++   memory allocation failed, OUT is set to NULL, and the return value
  150. ++   indicates length of the requested memory block, i.e.,
  151. ++   BASE64_LENGTH(inlen) + 1. */
  152. ++size_t
  153. ++base64_encode_alloc (const char *in, size_t inlen, char **out)
  154. + {
  155. ++  size_t outlen = 1 + BASE64_LENGTH (inlen);
  156. ++
  157. ++  /* Check for overflow in outlen computation.
  158. ++   *
  159. ++   * If there is no overflow, outlen >= inlen.
  160. ++   *
  161. ++   * If the operation (inlen + 2) overflows then it yields at most +1, so
  162. ++   * outlen is 0.
  163. ++   *
  164. ++   * If the multiplication overflows, we lose at least half of the
  165. ++   * correct value, so the result is < ((inlen + 2) / 3) * 2, which is
  166. ++   * less than (inlen + 2) * 0.66667, which is less than inlen as soon as
  167. ++   * (inlen > 4).
  168. ++   */
  169. ++  if (inlen > outlen)
  170. ++    {
  171. ++      *out = NULL;
  172. ++      return 0;
  173. ++    }
  174. ++
  175. ++  *out = malloc (outlen);
  176. ++  if (!*out)
  177. ++    return outlen;
  178. ++
  179. ++  base64_encode (in, inlen, *out, outlen);
  180. +
  181. +-      char *buf = (char *) malloc ((len + 2) / 3 * 4 + 1);
  182. +-      size_t i = 0, j = 0;
  183. ++  return outlen - 1;
  184. ++}
  185. ++
  186. ++/* With this approach this file works independent of the charset used
  187. ++   (think EBCDIC).  However, it does assume that the characters in the
  188. ++   Base64 alphabet (A-Za-z0-9+/) are encoded in 0..255.  POSIX
  189. ++   1003.1-2001 require that char and unsigned char are 8-bit
  190. ++   quantities, though, taking care of that problem.  But this may be a
  191. ++   potential problem on non-POSIX C99 platforms.
  192. ++
  193. ++   IBM C V6 for AIX mishandles "#define B64(x) ...'x'...", so use "_"
  194. ++   as the formal parameter rather than "x".  */
  195. ++#define B64(_)                                        \
  196. ++  ((_) == 'A' ? 0                    \
  197. ++   : (_) == 'B' ? 1            \
  198. ++   : (_) == 'C' ? 2            \
  199. ++   : (_) == 'D' ? 3            \
  200. ++   : (_) == 'E' ? 4            \
  201. ++   : (_) == 'F' ? 5            \
  202. ++   : (_) == 'G' ? 6            \
  203. ++   : (_) == 'H' ? 7            \
  204. ++   : (_) == 'I' ? 8            \
  205. ++   : (_) == 'J' ? 9            \
  206. ++   : (_) == 'K' ? 10        \
  207. ++   : (_) == 'L' ? 11        \
  208. ++   : (_) == 'M' ? 12        \
  209. ++   : (_) == 'N' ? 13        \
  210. ++   : (_) == 'O' ? 14        \
  211. ++   : (_) == 'P' ? 15        \
  212. ++   : (_) == 'Q' ? 16        \
  213. ++   : (_) == 'R' ? 17        \
  214. ++   : (_) == 'S' ? 18        \
  215. ++   : (_) == 'T' ? 19        \
  216. ++   : (_) == 'U' ? 20        \
  217. ++   : (_) == 'V' ? 21        \
  218. ++   : (_) == 'W' ? 22        \
  219. ++   : (_) == 'X' ? 23        \
  220. ++   : (_) == 'Y' ? 24        \
  221. ++   : (_) == 'Z' ? 25        \
  222. ++   : (_) == 'a' ? 26        \
  223. ++   : (_) == 'b' ? 27        \
  224. ++   : (_) == 'c' ? 28        \
  225. ++   : (_) == 'd' ? 29        \
  226. ++   : (_) == 'e' ? 30        \
  227. ++   : (_) == 'f' ? 31        \
  228. ++   : (_) == 'g' ? 32        \
  229. ++   : (_) == 'h' ? 33        \
  230. ++   : (_) == 'i' ? 34        \
  231. ++   : (_) == 'j' ? 35        \
  232. ++   : (_) == 'k' ? 36        \
  233. ++   : (_) == 'l' ? 37        \
  234. ++   : (_) == 'm' ? 38        \
  235. ++   : (_) == 'n' ? 39        \
  236. ++   : (_) == 'o' ? 40        \
  237. ++   : (_) == 'p' ? 41        \
  238. ++   : (_) == 'q' ? 42        \
  239. ++   : (_) == 'r' ? 43        \
  240. ++   : (_) == 's' ? 44        \
  241. ++   : (_) == 't' ? 45        \
  242. ++   : (_) == 'u' ? 46        \
  243. ++   : (_) == 'v' ? 47        \
  244. ++   : (_) == 'w' ? 48        \
  245. ++   : (_) == 'x' ? 49        \
  246. ++   : (_) == 'y' ? 50        \
  247. ++   : (_) == 'z' ? 51        \
  248. ++   : (_) == '0' ? 52        \
  249. ++   : (_) == '1' ? 53        \
  250. ++   : (_) == '2' ? 54        \
  251. ++   : (_) == '3' ? 55        \
  252. ++   : (_) == '4' ? 56        \
  253. ++   : (_) == '5' ? 57        \
  254. ++   : (_) == '6' ? 58        \
  255. ++   : (_) == '7' ? 59        \
  256. ++   : (_) == '8' ? 60        \
  257. ++   : (_) == '9' ? 61        \
  258. ++   : (_) == '+' ? 62        \
  259. ++   : (_) == '/' ? 63        \
  260. ++   : -1)
  261. +
  262. +-      char BASE64_END = '=';
  263. +-      char base64_table[64];
  264. +-      strncpy (base64_table, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", 64);
  265. +-
  266. +-      while (j < len - 2) {
  267. +-            buf[i++] = base64_table[bin[j] >> 2];
  268. +-            buf[i++] = base64_table[((bin[j] & 3) << 4) | (bin[j + 1] >> 4)];
  269. +-            buf[i++] = base64_table[((bin[j + 1] & 15) << 2) | (bin[j + 2] >> 6)];
  270. +-            buf[i++] = base64_table[bin[j + 2] & 63];
  271. +-            j += 3;
  272. ++static const signed char b64[0x100] = {
  273. ++  B64 (0), B64 (1), B64 (2), B64 (3),
  274. ++  B64 (4), B64 (5), B64 (6), B64 (7),
  275. ++  B64 (8), B64 (9), B64 (10), B64 (11),
  276. ++  B64 (12), B64 (13), B64 (14), B64 (15),
  277. ++  B64 (16), B64 (17), B64 (18), B64 (19),
  278. ++  B64 (20), B64 (21), B64 (22), B64 (23),
  279. ++  B64 (24), B64 (25), B64 (26), B64 (27),
  280. ++  B64 (28), B64 (29), B64 (30), B64 (31),
  281. ++  B64 (32), B64 (33), B64 (34), B64 (35),
  282. ++  B64 (36), B64 (37), B64 (38), B64 (39),
  283. ++  B64 (40), B64 (41), B64 (42), B64 (43),
  284. ++  B64 (44), B64 (45), B64 (46), B64 (47),
  285. ++  B64 (48), B64 (49), B64 (50), B64 (51),
  286. ++  B64 (52), B64 (53), B64 (54), B64 (55),
  287. ++  B64 (56), B64 (57), B64 (58), B64 (59),
  288. ++  B64 (60), B64 (61), B64 (62), B64 (63),
  289. ++  B64 (64), B64 (65), B64 (66), B64 (67),
  290. ++  B64 (68), B64 (69), B64 (70), B64 (71),
  291. ++  B64 (72), B64 (73), B64 (74), B64 (75),
  292. ++  B64 (76), B64 (77), B64 (78), B64 (79),
  293. ++  B64 (80), B64 (81), B64 (82), B64 (83),
  294. ++  B64 (84), B64 (85), B64 (86), B64 (87),
  295. ++  B64 (88), B64 (89), B64 (90), B64 (91),
  296. ++  B64 (92), B64 (93), B64 (94), B64 (95),
  297. ++  B64 (96), B64 (97), B64 (98), B64 (99),
  298. ++  B64 (100), B64 (101), B64 (102), B64 (103),
  299. ++  B64 (104), B64 (105), B64 (106), B64 (107),
  300. ++  B64 (108), B64 (109), B64 (110), B64 (111),
  301. ++  B64 (112), B64 (113), B64 (114), B64 (115),
  302. ++  B64 (116), B64 (117), B64 (118), B64 (119),
  303. ++  B64 (120), B64 (121), B64 (122), B64 (123),
  304. ++  B64 (124), B64 (125), B64 (126), B64 (127),
  305. ++  B64 (128), B64 (129), B64 (130), B64 (131),
  306. ++  B64 (132), B64 (133), B64 (134), B64 (135),
  307. ++  B64 (136), B64 (137), B64 (138), B64 (139),
  308. ++  B64 (140), B64 (141), B64 (142), B64 (143),
  309. ++  B64 (144), B64 (145), B64 (146), B64 (147),
  310. ++  B64 (148), B64 (149), B64 (150), B64 (151),
  311. ++  B64 (152), B64 (153), B64 (154), B64 (155),
  312. ++  B64 (156), B64 (157), B64 (158), B64 (159),
  313. ++  B64 (160), B64 (161), B64 (162), B64 (163),
  314. ++  B64 (164), B64 (165), B64 (166), B64 (167),
  315. ++  B64 (168), B64 (169), B64 (170), B64 (171),
  316. ++  B64 (172), B64 (173), B64 (174), B64 (175),
  317. ++  B64 (176), B64 (177), B64 (178), B64 (179),
  318. ++  B64 (180), B64 (181), B64 (182), B64 (183),
  319. ++  B64 (184), B64 (185), B64 (186), B64 (187),
  320. ++  B64 (188), B64 (189), B64 (190), B64 (191),
  321. ++  B64 (192), B64 (193), B64 (194), B64 (195),
  322. ++  B64 (196), B64 (197), B64 (198), B64 (199),
  323. ++  B64 (200), B64 (201), B64 (202), B64 (203),
  324. ++  B64 (204), B64 (205), B64 (206), B64 (207),
  325. ++  B64 (208), B64 (209), B64 (210), B64 (211),
  326. ++  B64 (212), B64 (213), B64 (214), B64 (215),
  327. ++  B64 (216), B64 (217), B64 (218), B64 (219),
  328. ++  B64 (220), B64 (221), B64 (222), B64 (223),
  329. ++  B64 (224), B64 (225), B64 (226), B64 (227),
  330. ++  B64 (228), B64 (229), B64 (230), B64 (231),
  331. ++  B64 (232), B64 (233), B64 (234), B64 (235),
  332. ++  B64 (236), B64 (237), B64 (238), B64 (239),
  333. ++  B64 (240), B64 (241), B64 (242), B64 (243),
  334. ++  B64 (244), B64 (245), B64 (246), B64 (247),
  335. ++  B64 (248), B64 (249), B64 (250), B64 (251),
  336. ++  B64 (252), B64 (253), B64 (254), B64 (255)
  337. ++};
  338. ++
  339. ++#if UCHAR_MAX == 255
  340. ++# define uchar_in_range(c) true
  341. ++#else
  342. ++# define uchar_in_range(c) ((c) <= 255)
  343. ++#endif
  344. ++
  345. ++/* Return true if CH is a character from the Base64 alphabet, and
  346. ++   false otherwise.  Note that '=' is padding and not considered to be
  347. ++   part of the alphabet.  */
  348. ++bool
  349. ++isbase64 (char ch)
  350. ++{
  351. ++  return uchar_in_range (to_uchar (ch)) && 0 <= b64[to_uchar (ch)];
  352. ++}
  353. ++
  354. ++/* Decode base64 encoded input array IN of length INLEN to output
  355. ++   array OUT that can hold *OUTLEN bytes.  Return true if decoding was
  356. ++   successful, i.e. if the input was valid base64 data, false
  357. ++   otherwise.  If *OUTLEN is too small, as many bytes as possible will
  358. ++   be written to OUT.  On return, *OUTLEN holds the length of decoded
  359. ++   bytes in OUT.  Note that as soon as any non-alphabet characters are
  360. ++   encountered, decoding is stopped and false is returned.  This means
  361. ++   that, when applicable, you must remove any line terminators that is
  362. ++   part of the data stream before calling this function.  */
  363. ++bool
  364. ++base64_decode (const char *restrict in, size_t inlen,
  365. ++             char *restrict out, size_t *outlen)
  366. ++{
  367. ++  size_t outleft = *outlen;
  368. ++
  369. ++  while (inlen >= 2)
  370. ++    {
  371. ++      if (!isbase64 (in[0]) || !isbase64 (in[1]))
  372. ++      break;
  373. ++
  374. ++      if (outleft)
  375. ++      {
  376. ++        *out++ = ((b64[to_uchar (in[0])] << 2)
  377. ++                | (b64[to_uchar (in[1])] >> 4));
  378. ++        outleft--;
  379. +       }
  380. +
  381. +-      switch (len - j) {
  382. +-      case 1:
  383. +-            buf[i++] = base64_table[bin[j] >> 2];
  384. +-            buf[i++] = base64_table[(bin[j] & 3) << 4];
  385. +-            buf[i++] = BASE64_END;
  386. +-            buf[i++] = BASE64_END;
  387. +-            break;
  388. +-      case 2:
  389. +-            buf[i++] = base64_table[bin[j] >> 2];
  390. +-            buf[i++] = base64_table[((bin[j] & 3) << 4) | (bin[j + 1] >> 4)];
  391. +-            buf[i++] = base64_table[(bin[j + 1] & 15) << 2];
  392. +-            buf[i++] = BASE64_END;
  393. ++      if (inlen == 2)
  394. ++      break;
  395. ++
  396. ++      if (in[2] == '=')
  397. ++      {
  398. ++        if (inlen != 4)
  399. ++          break;
  400. ++
  401. ++        if (in[3] != '=')
  402. ++          break;
  403. ++
  404. ++      }
  405. ++      else
  406. ++      {
  407. ++        if (!isbase64 (in[2]))
  408. ++          break;
  409. ++
  410. ++        if (outleft)
  411. ++          {
  412. ++            *out++ = (((b64[to_uchar (in[1])] << 4) & 0xf0)
  413. ++                  | (b64[to_uchar (in[2])] >> 2));
  414. ++            outleft--;
  415. ++          }
  416. ++
  417. ++        if (inlen == 3)
  418. ++          break;
  419. ++
  420. ++        if (in[3] == '=')
  421. ++          {
  422. ++            if (inlen != 4)
  423. +             break;
  424. +-      case 0:
  425. ++          }
  426. ++        else
  427. ++          {
  428. ++            if (!isbase64 (in[3]))
  429. +             break;
  430. ++
  431. ++            if (outleft)
  432. ++            {
  433. ++              *out++ = (((b64[to_uchar (in[2])] << 6) & 0xc0)
  434. ++                      | b64[to_uchar (in[3])]);
  435. ++              outleft--;
  436. ++            }
  437. ++          }
  438. +       }
  439. +
  440. +-      buf[i] = '\0';
  441. +-      return buf;
  442. ++      in += 4;
  443. ++      inlen -= 4;
  444. ++    }
  445. ++
  446. ++  *outlen -= outleft;
  447. ++
  448. ++  if (inlen != 0)
  449. ++    return false;
  450. ++
  451. ++  return true;
  452. + }
  453. +
  454. ++/* Allocate an output buffer in *OUT, and decode the base64 encoded
  455. ++   data stored in IN of size INLEN to the *OUT buffer.  On return, the
  456. ++   size of the decoded data is stored in *OUTLEN.  OUTLEN may be NULL,
  457. ++   if the caller is not interested in the decoded length.  *OUT may be
  458. ++   NULL to indicate an out of memory error, in which case *OUTLEN
  459. ++   contains the size of the memory block needed.  The function returns
  460. ++   true on successful decoding and memory allocation errors.  (Use the
  461. ++   *OUT and *OUTLEN parameters to differentiate between successful
  462. ++   decoding and memory error.)  The function returns false if the
  463. ++   input was invalid, in which case *OUT is NULL and *OUTLEN is
  464. ++   undefined. */
  465. ++bool
  466. ++base64_decode_alloc (const char *in, size_t inlen, char **out,
  467. ++                 size_t *outlen)
  468. ++{
  469. ++  /* This may allocate a few bytes too much, depending on input,
  470. ++     but it's not worth the extra CPU time to compute the exact amount.
  471. ++     The exact amount is 3 * inlen / 4, minus 1 if the input ends
  472. ++     with "=" and minus another 1 if the input ends with "==".
  473. ++     Dividing before multiplying avoids the possibility of overflow.  */
  474. ++  size_t needlen = 3 * (inlen / 4) + 2;
  475. ++
  476. ++  *out = malloc (needlen);
  477. ++  if (!*out)
  478. ++    return true;
  479. ++
  480. ++  if (!base64_decode (in, inlen, *out, &needlen))
  481. ++    {
  482. ++      free (*out);
  483. ++      *out = NULL;
  484. ++      return false;
  485. ++    }
  486. ++
  487. ++  if (outlen)
  488. ++    *outlen = needlen;
  489. ++
  490. ++  return true;
  491. ++}
  492. +diff -Naur nagios-plugins-1.4.11.orig/lib/base64.h nagios-plugins-1.4.11/lib/base64.h
  493. +--- nagios-plugins-1.4.11.orig/lib/base64.h    2007-11-09 16:17:03.000000000 -0500
  494. ++++ nagios-plugins-1.4.11/lib/base64.h 2008-04-14 11:12:35.000000000 -0400
  495. [email protected]@ -1,4 +1,45 @@
  496. +-/* Header file for base64.c */
  497. ++/* base64.h -- Encode binary data using printable characters.
  498. ++   Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
  499. ++   Written by Simon Josefsson.
  500. +
  501. +-char *base64 (const char *bin, size_t len);
  502. ++   This program is free software; you can redistribute it and/or modify
  503. ++   it under the terms of the GNU General Public License as published by
  504. ++   the Free Software Foundation; either version 3, or (at your option)
  505. ++   any later version.
  506. +
  507. ++   This program is distributed in the hope that it will be useful,
  508. ++   but WITHOUT ANY WARRANTY; without even the implied warranty of
  509. ++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  510. ++   GNU General Public License for more details.
  511. ++
  512. ++   You should have received a copy of the GNU General Public License
  513. ++   along with this program; if not, write to the Free Software Foundation,
  514. ++   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  515. ++
  516. ++#ifndef BASE64_H
  517. ++# define BASE64_H
  518. ++
  519. ++/* Get size_t. */
  520. ++# include <stddef.h>
  521. ++
  522. ++/* Get bool. */
  523. ++# include <stdbool.h>
  524. ++
  525. ++/* This uses that the expression (n+(k-1))/k means the smallest
  526. ++   integer >= n/k, i.e., the ceiling of n/k.  */
  527. ++# define BASE64_LENGTH(inlen) ((((inlen) + 2) / 3) * 4)
  528. ++
  529. ++extern bool isbase64 (char ch);
  530. ++
  531. ++extern void base64_encode (const char *restrict in, size_t inlen,
  532. ++                     char *restrict out, size_t outlen);
  533. ++
  534. ++extern size_t base64_encode_alloc (const char *in, size_t inlen, char **out);
  535. ++
  536. ++extern bool base64_decode (const char *restrict in, size_t inlen,
  537. ++                     char *restrict out, size_t *outlen);
  538. ++
  539. ++extern bool base64_decode_alloc (const char *in, size_t inlen,
  540. ++                         char **out, size_t *outlen);
  541. ++
  542. ++#endif /* BASE64_H */
  543. +diff -Naur nagios-plugins-1.4.11.orig/plugins/check_http.c nagios-plugins-1.4.11/plugins/check_http.c
  544. +--- nagios-plugins-1.4.11.orig/plugins/check_http.c    2007-12-11 00:57:35.000000000 -0500
  545. ++++ nagios-plugins-1.4.11/plugins/check_http.c 2008-04-14 11:13:57.000000000 -0400
  546. [email protected]@ -1,54 +1,51 @@
  547. +-/******************************************************************************
  548. +-*
  549. ++/*****************************************************************************
  550. ++*
  551. + * Nagios check_http plugin
  552. +-*
  553. ++*
  554. + * License: GPL
  555. +-* Copyright (c) 1999-2006 nagios-plugins team
  556. +-*
  557. +-* Last Modified: $Date: 2007-12-11 05:57:35 +0000 (Tue, 11 Dec 2007) $
  558. +-*
  559. ++* Copyright (c) 1999-2008 Nagios Plugins Development Team
  560. ++*
  561. ++* Last Modified: $Date: 2008-03-14 20:14:49 -0400 (Fri, 14 Mar 2008) $
  562. ++*
  563. + * Description:
  564. +-*
  565. ++*
  566. + * This file contains the check_http plugin
  567. +-*
  568. +-*  This plugin tests the HTTP service on the specified host. It can test
  569. +-*  normal (http) and secure (https) servers, follow redirects, search for
  570. +-*  strings and regular expressions, check connection times, and report on
  571. +-*  certificate expiration times.
  572. +-*
  573. +-*
  574. +-* License Information:
  575. +-*
  576. +-* This program is free software; you can redistribute it and/or modify
  577. ++*
  578. ++* This plugin tests the HTTP service on the specified host. It can test
  579. ++* normal (http) and secure (https) servers, follow redirects, search for
  580. ++* strings and regular expressions, check connection times, and report on
  581. ++* certificate expiration times.
  582. ++*
  583. ++*
  584. ++* This program is free software: you can redistribute it and/or modify
  585. + * it under the terms of the GNU General Public License as published by
  586. +-* the Free Software Foundation; either version 2 of the License, or
  587. ++* the Free Software Foundation, either version 3 of the License, or
  588. + * (at your option) any later version.
  589. +-*
  590. ++*
  591. + * This program is distributed in the hope that it will be useful,
  592. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  593. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  594. + * GNU General Public License for more details.
  595. +-*
  596. ++*
  597. + * You should have received a copy of the GNU General Public License
  598. +-* along with this program; if not, write to the Free Software
  599. +-* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  600. ++* along with this program.  If not, see <http://www.gnu.org/licenses/>.
  601. ++*
  602. ++* $Id: check_http.c 1944 2008-03-15 00:14:49Z psychotrahe $
  603. ++*
  604. ++*****************************************************************************/
  605. +
  606. +- $Id: check_http.c 1861 2007-12-11 05:57:35Z dermoth $
  607. +-
  608. +-******************************************************************************/
  609. + /* splint -I. -I../../plugins -I../../lib/ -I/usr/kerberos/include/ ../../plugins/check_http.c */
  610. +
  611. + const char *progname = "check_http";
  612. +-const char *revision = "$Revision: 1861 $";
  613. +-const char *copyright = "1999-2006";
  614. ++const char *revision = "$Revision: 1944 $";
  615. ++const char *copyright = "1999-2008";
  616. + const char *email = "[email protected]";
  617. +
  618. +-#include <ctype.h>
  619. +-
  620. + #include "common.h"
  621. + #include "netutils.h"
  622. + #include "utils.h"
  623. + #include "base64.h"
  624. ++#include <ctype.h>
  625. +
  626. + #define INPUT_DELIMITER ";"
  627. +
  628. [email protected]@ -174,6 +171,7 @@
  629. + process_arguments (int argc, char **argv)
  630. + {
  631. +   int c = 1;
  632. ++  char *p;
  633. +
  634. +   enum {
  635. +     INVERT_REGEX = CHAR_MAX + 1
  636. [email protected]@ -317,8 +315,12 @@
  637. +     /* Note: H, I, and u must be malloc'd or will fail on redirects */
  638. +     case 'H': /* Host Name (virtual host) */
  639. +       host_name = strdup (optarg);
  640. +-      if (strstr (optarg, ":"))
  641. +-        sscanf (optarg, "%*[^:]:%d", &server_port);
  642. ++      if (host_name[0] == '[') {
  643. ++        if ((p = strstr (host_name, "]:")) != NULL) /* [IPv6]:port */
  644. ++          server_port = atoi (p + 2);
  645. ++      } else if ((p = strchr (host_name, ':')) != NULL
  646. ++                 && strchr (++p, ':') == NULL) /* IPv4:port or host:port */
  647. ++          server_port = atoi (p);
  648. +       break;
  649. +     case 'I': /* Server IP-address */
  650. +       server_address = strdup (optarg);
  651. [email protected]@ -748,7 +750,7 @@
  652. +
  653. +   /* optionally send the host header info */
  654. +   if (host_name)
  655. +-    asprintf (&buf, "%sHost: %s\r\n", buf, host_name);
  656. ++    asprintf (&buf, "%sHost: %s:%d\r\n", buf, host_name, server_port);
  657. +
  658. +   /* optionally send any other header tag */
  659. +   if (http_opt_headers_count) {
  660. [email protected]@ -761,7 +763,7 @@
  661. +
  662. +   /* optionally send the authentication info */
  663. +   if (strlen(user_auth)) {
  664. +-    auth = base64 (user_auth, strlen (user_auth));
  665. ++    base64_encode_alloc (user_auth, strlen (user_auth), &auth);
  666. +     asprintf (&buf, "%sAuthorization: Basic %s\r\n", buf, auth);
  667. +   }
  668. +
  669. +diff -Naur nagios-plugins-1.4.11.orig/plugins/check_smtp.c nagios-plugins-1.4.11/plugins/check_smtp.c
  670. +--- nagios-plugins-1.4.11.orig/plugins/check_smtp.c    2007-11-09 16:17:03.000000000 -0500
  671. ++++ nagios-plugins-1.4.11/plugins/check_smtp.c 2008-04-14 11:13:27.000000000 -0400
  672. [email protected]@ -1,52 +1,48 @@
  673. +-/******************************************************************************
  674. +-*
  675. ++/*****************************************************************************
  676. ++*
  677. + * Nagios check_smtp plugin
  678. +-*
  679. ++*
  680. + * License: GPL
  681. +-* Copyright (c) 1999-2006 nagios-plugins team
  682. +-*
  683. +-* Last Modified: $Date: 2007-11-09 21:17:03 +0000 (Fri, 09 Nov 2007) $
  684. +-*
  685. ++* Copyright (c) 2000-2007 Nagios Plugins Development Team
  686. ++*
  687. ++* Last Modified: $Date: 2008-03-14 18:35:29 -0400 (Fri, 14 Mar 2008) $
  688. ++*
  689. + * Description:
  690. +-*
  691. ++*
  692. + * This file contains the check_smtp plugin
  693. +-*
  694. +-*  This plugin will attempt to open an SMTP connection with the host.
  695. +-*
  696. +-*
  697. +-* License Information:
  698. +-*
  699. +-* This program is free software; you can redistribute it and/or modify
  700. ++*
  701. ++* This plugin will attempt to open an SMTP connection with the host.
  702. ++*
  703. ++*
  704. ++* This program is free software: you can redistribute it and/or modify
  705. + * it under the terms of the GNU General Public License as published by
  706. +-* the Free Software Foundation; either version 2 of the License, or
  707. ++* the Free Software Foundation, either version 3 of the License, or
  708. + * (at your option) any later version.
  709. +-*
  710. ++*
  711. + * This program is distributed in the hope that it will be useful,
  712. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  713. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  714. + * GNU General Public License for more details.
  715. +-*
  716. ++*
  717. + * You should have received a copy of the GNU General Public License
  718. +-* along with this program; if not, write to the Free Software
  719. +-* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  720. +-*
  721. +-*
  722. +-* $Id: check_smtp.c 1817 2007-11-09 21:17:03Z dermoth $
  723. ++* along with this program.  If not, see <http://www.gnu.org/licenses/>.
  724. + *
  725. +-******************************************************************************/
  726. ++* $Id: check_smtp.c 1942 2008-03-14 22:35:29Z psychotrahe $
  727. ++*
  728. ++*****************************************************************************/
  729. +
  730. + const char *progname = "check_smtp";
  731. +-const char *revision = "$Revision: 1817 $";
  732. +-const char *copyright = "2000-2006";
  733. ++const char *revision = "$Revision: 1942 $";
  734. ++const char *copyright = "2000-2007";
  735. + const char *email = "[email protected]";
  736. +
  737. +-#include <ctype.h>
  738. +-
  739. + #include "common.h"
  740. + #include "netutils.h"
  741. + #include "utils.h"
  742. + #include "base64.h"
  743. +
  744. ++#include <ctype.h>
  745. ++
  746. + #ifdef HAVE_SSL
  747. + int check_cert = FALSE;
  748. + int days_till_exp;
  749. [email protected]@ -198,10 +194,10 @@
  750. +                   /* make sure we find the response we are looking for */
  751. +                   if (!strstr (buffer, server_expect)) {
  752. +                         if (server_port == SMTP_PORT)
  753. +-                              printf (_("Invalid SMTP response received from host\n"));
  754. ++                              printf (_("Invalid SMTP response received from host: %s\n"), buffer);
  755. +                         else
  756. +-                              printf (_("Invalid SMTP response received from host on port %d\n"),
  757. +-                                                      server_port);
  758. ++                              printf (_("Invalid SMTP response received from host on port %d: %s\n"),
  759. ++                                                      server_port, buffer);
  760. +                         result = STATE_WARNING;
  761. +                   }
  762. +             }
  763. [email protected]@ -370,7 +366,8 @@
  764. +                               }
  765. +
  766. +                               /* encode authuser with base64 */
  767. +-                              abuf = base64 (authuser, strlen(authuser));
  768. ++                              base64_encode_alloc (authuser, strlen(authuser), &abuf);
  769. ++                              /* FIXME: abuf shouldn't have enough space to strcat a '\r\n' into it. */
  770. +                               strcat (abuf, "\r\n");
  771. +                               my_send(abuf, strlen(abuf));
  772. +                               if (verbose)
  773. [email protected]@ -390,7 +387,8 @@
  774. +                                     break;
  775. +                               }
  776. +                               /* encode authpass with base64 */
  777. +-                              abuf = base64 (authpass, strlen(authpass));
  778. ++                              base64_encode_alloc (authpass, strlen(authpass), &abuf);
  779. ++                              /* FIXME: abuf shouldn't have enough space to strcat a '\r\n' into it. */
  780. +                               strcat (abuf, "\r\n");
  781. +                               my_send(abuf, strlen(abuf));
  782. +                               if (verbose) {

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will not expire by default. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right