aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-07-19 07:55:27 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-07-19 07:56:21 +0200
commit276e9822b3402d49a3c9bea713f89dc855812152 (patch)
tree1599a1be8b294d39144157e6ac701b19095b8f03
parent4e1d3db1e86804283cd21f3186e06d397284ac70 (diff)
downloadglibc-276e9822b3402d49a3c9bea713f89dc855812152.tar.xz
glibc-276e9822b3402d49a3c9bea713f89dc855812152.zip
resolv: Move ns_name_pton into its own file and into libc
And reformat to GNU style, and eliminate the digits variable. The symbol was moved using scripts/move-symbol-to-libc.py. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
-rw-r--r--include/arpa/nameser.h3
-rw-r--r--resolv/Makefile1
-rw-r--r--resolv/Versions3
-rw-r--r--resolv/ns_name.c125
-rw-r--r--resolv/ns_name_pton.c157
-rw-r--r--sysdeps/mach/hurd/i386/libc.abilist2
-rw-r--r--sysdeps/mach/hurd/i386/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/aarch64/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/aarch64/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/alpha/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/arc/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/arc/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/arm/be/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/arm/be/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/arm/le/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/arm/le/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/csky/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/csky/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/hppa/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/hppa/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/i386/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/i386/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/ia64/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/ia64/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/m68k/coldfire/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/m68k/m680x0/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/microblaze/be/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/microblaze/be/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/microblaze/le/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/microblaze/le/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips32/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/n32/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/n64/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/nios2/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/nios2/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/riscv/rv32/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/riscv/rv64/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/sh/be/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/sh/be/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/sh/le/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/sh/le/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/64/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/64/libresolv.abilist1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/x32/libresolv.abilist1
69 files changed, 229 insertions, 157 deletions
diff --git a/include/arpa/nameser.h b/include/arpa/nameser.h
index dcceff823d..c27008b5ff 100644
--- a/include/arpa/nameser.h
+++ b/include/arpa/nameser.h
@@ -65,7 +65,6 @@ libresolv_hidden_proto (ns_put32)
libresolv_hidden_proto (ns_initparse)
libresolv_hidden_proto (ns_skiprr)
libresolv_hidden_proto (ns_parserr)
-libresolv_hidden_proto (ns_name_pton)
libresolv_hidden_proto (ns_name_pack)
libresolv_hidden_proto (ns_name_compress)
libresolv_hidden_proto (ns_sprintrr)
@@ -77,6 +76,8 @@ libresolv_hidden_proto (ns_format_ttl)
extern __typeof (ns_name_ntop) __ns_name_ntop;
libc_hidden_proto (__ns_name_ntop)
+extern __typeof (ns_name_pton) __ns_name_pton;
+libc_hidden_proto (__ns_name_pton)
extern __typeof (ns_name_skip) __ns_name_skip;
libc_hidden_proto (__ns_name_skip)
extern __typeof (ns_name_uncompress) __ns_name_uncompress;
diff --git a/resolv/Makefile b/resolv/Makefile
index 3145ddebb7..7839e1fb3c 100644
--- a/resolv/Makefile
+++ b/resolv/Makefile
@@ -33,6 +33,7 @@ routines := \
inet_ntop \
inet_pton \
ns_name_ntop \
+ ns_name_pton \
ns_name_skip \
ns_name_uncompress \
ns_name_unpack \
diff --git a/resolv/Versions b/resolv/Versions
index 9e8762f984..770a2b8d6b 100644
--- a/resolv/Versions
+++ b/resolv/Versions
@@ -26,6 +26,7 @@ libc {
}
GLIBC_2.9 {
ns_name_ntop;
+ ns_name_pton;
ns_name_skip;
ns_name_uncompress;
ns_name_unpack;
@@ -38,6 +39,7 @@ libc {
getaddrinfo_a;
%endif
ns_name_ntop;
+ ns_name_pton;
ns_name_skip;
ns_name_uncompress;
ns_name_unpack;
@@ -50,6 +52,7 @@ libc {
__inet_aton_exact;
__inet_pton_length;
__ns_name_ntop;
+ __ns_name_pton;
__ns_name_skip;
__ns_name_uncompress;
__ns_name_unpack;
diff --git a/resolv/ns_name.c b/resolv/ns_name.c
index 35e25cbd83..9f7ca4a506 100644
--- a/resolv/ns_name.c
+++ b/resolv/ns_name.c
@@ -29,10 +29,6 @@
# define SPRINTF(x) ((size_t)sprintf x)
-/* Data. */
-
-static const char digits[] = "0123456789";
-
/* Forward. */
static int dn_find(const u_char *, const u_char *,
@@ -42,127 +38,6 @@ static int labellen(const u_char *);
/* Public. */
-
-/*%
- * Convert an ascii string into an encoded domain name as per RFC1035.
- *
- * return:
- *
- *\li -1 if it fails
- *\li 1 if string was fully qualified
- *\li 0 is string was not fully qualified
- *
- * notes:
- *\li Enforces label and domain length limits.
- */
-
-int
-ns_name_pton(const char *src, u_char *dst, size_t dstsiz)
-{
- u_char *label, *bp, *eom;
- int c, n, escaped;
- char *cp;
-
- escaped = 0;
- bp = dst;
- eom = dst + dstsiz;
- label = bp++;
-
- while ((c = *src++) != 0) {
- if (escaped) {
- if ((cp = strchr(digits, c)) != NULL) {
- n = (cp - digits) * 100;
- if ((c = *src++) == 0 ||
- (cp = strchr(digits, c)) == NULL) {
- __set_errno (EMSGSIZE);
- return (-1);
- }
- n += (cp - digits) * 10;
- if ((c = *src++) == 0 ||
- (cp = strchr(digits, c)) == NULL) {
- __set_errno (EMSGSIZE);
- return (-1);
- }
- n += (cp - digits);
- if (n > 255) {
- __set_errno (EMSGSIZE);
- return (-1);
- }
- c = n;
- }
- escaped = 0;
- } else if (c == '\\') {
- escaped = 1;
- continue;
- } else if (c == '.') {
- c = (bp - label - 1);
- if ((c & NS_CMPRSFLGS) != 0) { /*%< Label too big. */
- __set_errno (EMSGSIZE);
- return (-1);
- }
- if (label >= eom) {
- __set_errno (EMSGSIZE);
- return (-1);
- }
- *label = c;
- /* Fully qualified ? */
- if (*src == '\0') {
- if (c != 0) {
- if (bp >= eom) {
- __set_errno (EMSGSIZE);
- return (-1);
- }
- *bp++ = '\0';
- }
- if ((bp - dst) > MAXCDNAME) {
- __set_errno (EMSGSIZE);
- return (-1);
- }
- return (1);
- }
- if (c == 0 || *src == '.') {
- __set_errno (EMSGSIZE);
- return (-1);
- }
- label = bp++;
- continue;
- }
- if (bp >= eom) {
- __set_errno (EMSGSIZE);
- return (-1);
- }
- *bp++ = (