summaryrefslogtreecommitdiff
path: root/package/fetchmail/patches/patch-mxget_c
diff options
context:
space:
mode:
Diffstat (limited to 'package/fetchmail/patches/patch-mxget_c')
-rw-r--r--package/fetchmail/patches/patch-mxget_c127
1 files changed, 127 insertions, 0 deletions
diff --git a/package/fetchmail/patches/patch-mxget_c b/package/fetchmail/patches/patch-mxget_c
new file mode 100644
index 000000000..ee6d61576
--- /dev/null
+++ b/package/fetchmail/patches/patch-mxget_c
@@ -0,0 +1,127 @@
+$Id$
+--- fetchmail-6.3.8.orig/mxget.c 2006-03-14 11:00:02.000000000 +0100
++++ fetchmail-6.3.8/mxget.c 2008-04-07 23:56:13.000000000 +0200
+@@ -54,6 +54,123 @@
+ /* minimum possible size of MX record in packet */
+ #define MIN_MX_SIZE 8 /* corresp to "a.com 0" w/ terminating space */
+
++/* from bind9 package: */
++/*
++Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC")
++Copyright (C) 1996-2003 Internet Software Consortium.
++
++Permission to use, copy, modify, and distribute this software for any
++purpose with or without fee is hereby granted, provided that the above
++copyright notice and this permission notice appear in all copies.
++
++THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
++REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
++AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
++INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
++LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
++OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
++PERFORMANCE OF THIS SOFTWARE.
++
++$Id: COPYRIGHT,v 1.9.18.3 2007/01/08 02:41:59 marka Exp $
++
++Portions Copyright (C) 1996-2001 Nominum, Inc.
++
++Permission to use, copy, modify, and distribute this software for any
++purpose with or without fee is hereby granted, provided that the above
++copyright notice and this permission notice appear in all copies.
++
++THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES
++WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
++MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR
++ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
++ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
++OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++*/
++#define NS_TYPE_ELT 0x40 /*%< EDNS0 extended label
++type
++*/
++#define NS_CMPRSFLGS 0xc0 /*%< Flag bits indicating name compression. */
++#define DNS_LABELTYPE_BITSTRING 0x41
++static int
++labellen(const u_char *lp)
++{
++ int bitlen;
++ u_char l = *lp;
++
++ if ((l & NS_CMPRSFLGS) == NS_CMPRSFLGS) {
++ /* should be avoided by the caller */
++ return(-1);
++ }
++
++ if ((l & NS_CMPRSFLGS) == NS_TYPE_ELT) {
++ if (l == DNS_LABELTYPE_BITSTRING) {
++ if ((bitlen = *(lp + 1)) == 0)
++ bitlen = 256;
++ return((bitlen + 7 ) / 8 + 1);
++ }
++ return(-1); /*%< unknwon ELT */
++ }
++ return(l);
++}
++/*%
++ * Advance *ptrptr to skip over the compressed name it points at.
++ *
++ * return:
++ *\li 0 on success, -1 (with errno set) on failure.
++ */
++int
++ns_name_skip(const u_char **ptrptr, const u_char *eom)
++{
++ const u_char *cp;
++ u_int n;
++ int l;
++
++ cp = *ptrptr;
++ while (cp < eom && (n = *cp++) != 0) {
++ /* Check for indirection. */
++ switch (n & NS_CMPRSFLGS) {
++ case 0: /*%< normal case, n == len */
++ cp += n;
++ continue;
++ case NS_TYPE_ELT: /*%< EDNS0 extended label */
++ if ((l = labellen(cp - 1)) < 0) {
++// errno = EMSGSIZE; /*%< XXX */
++ return(-1);
++ }
++ cp += l;
++ continue;
++ case NS_CMPRSFLGS: /*%< indirection */
++ cp++;
++ break;
++ default: /*%< illegal type */
++// errno = EMSGSIZE;
++ return (-1);
++ }
++ break;
++ }
++ if (cp > eom) {
++// errno = EMSGSIZE;
++ return (-1);
++ }
++ *ptrptr = cp;
++ return (0);
++}
++
++/*%
++ * Skip over a compressed domain name. Return the size or -1.
++ */
++int
++dn_skipname(const u_char *ptr, const u_char *eom) {
++ const u_char *saveptr = ptr;
++
++ if (ns_name_skip(&ptr, eom) == -1)
++ return (-1);
++ return (ptr - saveptr);
++}
++/* End from Bind9 package */
++
++
+ struct mxentry *getmxrecords(const char *name)
+ /* get MX records for given host */
+ {