You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							104 lines
						
					
					
						
							3.3 KiB
						
					
					
				
			
		
		
	
	
							104 lines
						
					
					
						
							3.3 KiB
						
					
					
				# --- SDE-COPYRIGHT-NOTE-BEGIN --- | 
						|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. | 
						|
# | 
						|
# Filename: package/.../uclibc/add-dns-skipname.patch | 
						|
# Copyright (C) 2009 The OpenSDE Project | 
						|
# Copyright (C) 2004 - 2006 The T2 SDE Project | 
						|
# | 
						|
# More information can be found in the files COPYING and README. | 
						|
# | 
						|
# This patch file is dual-licensed. It is available under the license the | 
						|
# patched project is licensed under, as long as it is an OpenSource license | 
						|
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms | 
						|
# of the GNU General Public License as published by the Free Software | 
						|
# Foundation; either version 2 of the License, or (at your option) any later | 
						|
# version. | 
						|
# --- SDE-COPYRIGHT-NOTE-END --- | 
						|
--- uClibc-0.9.27/libc/inet/resolv.c.orig	2005-02-01 11:16:03.000000000 -0800 | 
						|
+++ uClibc-0.9.27/libc/inet/resolv.c	2005-02-01 11:27:30.000000000 -0800 | 
						|
@@ -2543,4 +2543,85 @@ | 
						|
 	return (len); | 
						|
 } | 
						|
 libc_hidden_def(ns_name_unpack) | 
						|
+ | 
						|
+#define NS_TYPE_ELT                     0x40 /* EDNS0 extended label type */ | 
						|
+#define DNS_LABELTYPE_BITSTRING         0x41 | 
						|
+ | 
						|
+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); | 
						|
+} | 
						|
+ | 
						|
+/* | 
						|
+ * ns_name_skip(ptrptr, eom) | 
						|
+ *      Advance *ptrptr to skip over the compressed name it points at. | 
						|
+ * return: | 
						|
+ *      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) { | 
						|
+                                __set_errno(EMSGSIZE); | 
						|
+                                return(-1); | 
						|
+                        } | 
						|
+                        cp += l; | 
						|
+                        continue; | 
						|
+                case NS_CMPRSFLGS:      /* indirection */ | 
						|
+                        cp++; | 
						|
+                        break; | 
						|
+                default:                /* illegal type */ | 
						|
+                        __set_errno(EMSGSIZE); | 
						|
+                        return (-1); | 
						|
+                } | 
						|
+                break; | 
						|
+        } | 
						|
+        if (cp > eom) { | 
						|
+                __set_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); | 
						|
+} | 
						|
 #endif /* L_ns_name */
 | 
						|
 |