diff options
author | Florian Weimer <fweimer@redhat.com> | 2021-07-19 07:55:27 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2021-07-19 07:56:21 +0200 |
commit | 2fbe5860d33ca2318b35ea6d31beefa381b4ac8a (patch) | |
tree | bf8baa77f1b3565eaf5a872331d8bd2a01943221 /resolv | |
parent | 391e02236b931132c0e8b5ba4c3b087c2aaa1044 (diff) | |
download | glibc-2fbe5860d33ca2318b35ea6d31beefa381b4ac8a.tar.gz glibc-2fbe5860d33ca2318b35ea6d31beefa381b4ac8a.tar.xz glibc-2fbe5860d33ca2318b35ea6d31beefa381b4ac8a.zip |
resolv: Rename res_comp.c to res-name-checking.c and move into libc
This reflects what the remaining functions in the file do. The __res_dnok, __res_hnok, __res_mailok, __res_ownok were moved with the script, using --no-new-version, and turned into compat symbols. __libc_res_dnok@@GLIBC_PRIVATE and __libc_res_hnok@@GLIBC_PRIVATE are added for internal use, to avoid accidentally binding to compatibility symbols. The new public symbols res_dnok, res_hnok, res_mailok, res_ownok were added using make update-all-abi. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'resolv')
-rw-r--r-- | resolv/Makefile | 2 | ||||
-rw-r--r-- | resolv/Versions | 14 | ||||
-rw-r--r-- | resolv/res-name-checking.c (renamed from resolv/res_comp.c) | 48 | ||||
-rw-r--r-- | resolv/resolv.h | 4 |
4 files changed, 41 insertions, 27 deletions
diff --git a/resolv/Makefile b/resolv/Makefile index e1a608f4ac..7e142b9a14 100644 --- a/resolv/Makefile +++ b/resolv/Makefile @@ -44,6 +44,7 @@ routines := \ ns_name_unpack \ nsap_addr \ res-close \ + res-name-checking \ res-state \ res_hconf \ res_init \ @@ -142,7 +143,6 @@ libresolv-routines := \ ns_samedomain \ ns_ttl \ res-putget \ - res_comp \ res_data \ res_debug \ res_enable_icmp \ diff --git a/resolv/Versions b/resolv/Versions index 634c7833a8..3e3b89a0b2 100644 --- a/resolv/Versions +++ b/resolv/Versions @@ -3,6 +3,10 @@ libc { __dn_comp; __dn_skipname; __h_errno_location; + __res_dnok; + __res_hnok; + __res_mailok; + __res_ownok; __res_randomid; _res; dn_expand; @@ -54,6 +58,10 @@ libc { ns_name_skip; ns_name_uncompress; ns_name_unpack; + res_dnok; + res_hnok; + res_mailok; + res_ownok; } GLIBC_PRIVATE { %if !PTHREAD_IN_LIBC @@ -64,6 +72,8 @@ libc { __inet_pton_length; __libc_dn_expand; __libc_dn_skipname; + __libc_res_dnok; + __libc_res_hnok; __ns_name_compress; __ns_name_ntop; __ns_name_pack; @@ -107,12 +117,8 @@ libresolv { __putlong; __putshort; __res_close; - __res_dnok; - __res_hnok; __res_isourserver; - __res_mailok; __res_nameinquery; - __res_ownok; __res_queriesmatch; __res_send; __sym_ntop; diff --git a/resolv/res_comp.c b/resolv/res-name-checking.c index 16f7e02111..2c603494fa 100644 --- a/resolv/res_comp.c +++ b/resolv/res-name-checking.c @@ -1,4 +1,4 @@ -/* Domain name processing functions. +/* Syntax checking for DNS domain names. Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -82,15 +82,9 @@ * SOFTWARE. */ -#include <sys/types.h> -#include <sys/param.h> -#include <netinet/in.h> #include <arpa/nameser.h> -#include <ctype.h> #include <resolv.h> -#include <stdio.h> -#include <string.h> -#include <unistd.h> +#include <shlib-compat.h> /* Return true if the string consists of printable ASCII characters only. */ @@ -148,25 +142,30 @@ binary_leading_dash (const unsigned char *dn) contain [0-9a-zA-Z_-] characters, and the name must not start with a '-'. The latter is to avoid confusion with program options. */ int -res_hnok (const char *dn) +___res_hnok (const char *dn) { unsigned char buf[NS_MAXCDNAME]; if (!printable_string (dn) - || ns_name_pton (dn, buf, sizeof (buf)) < 0 + || __ns_name_pton (dn, buf, sizeof (buf)) < 0 || binary_leading_dash (buf)) return 0; return binary_hnok (buf); } -libresolv_hidden_def (res_hnok) +versioned_symbol (libc, ___res_hnok, res_hnok, GLIBC_2_34); +versioned_symbol (libc, ___res_hnok, __libc_res_hnok, GLIBC_PRIVATE); +libc_hidden_ver (___res_hnok, __libc_res_hnok) +#if OTHER_SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_34) +compat_symbol (libresolv, ___res_hnok, __res_hnok, GLIBC_2_0); +#endif /* Hostname-like (A, MX, WKS) owners can have "*" as their first label but must otherwise be as a host name. */ int -res_ownok (const char *dn) +___res_ownok (const char *dn) { unsigned char buf[NS_MAXCDNAME]; if (!printable_string (dn) - || ns_name_pton (dn, buf, sizeof (buf)) < 0 + || __ns_name_pton (dn, buf, sizeof (buf)) < 0 || binary_leading_dash (buf)) return 0; if (buf[0] == 1 && buf [1] == '*') @@ -175,15 +174,19 @@ res_ownok (const char *dn) else return binary_hnok (buf); } +versioned_symbol (libc, ___res_ownok, res_ownok, GLIBC_2_34); +#if OTHER_SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_34) +compat_symbol (libresolv, ___res_ownok, __res_ownok, GLIBC_2_0); +#endif /* SOA RNAMEs and RP RNAMEs can have any byte in their first label, but the rest of the name has to look like a host name. */ int -res_mailok (const char *dn) +___res_mailok (const char *dn) { unsigned char buf[NS_MAXCDNAME]; if (!printable_string (dn) - || ns_name_pton (dn, buf, sizeof (buf)) < 0) + || __ns_name_pton (dn, buf, sizeof (buf)) < 0) return 0; unsigned char label_length = buf[0]; /* "." is a valid missing representation */ @@ -196,13 +199,22 @@ res_mailok (const char *dn) return 0; return binary_hnok (tail); } +versioned_symbol (libc, ___res_mailok, res_mailok, GLIBC_2_34); +#if OTHER_SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_34) +compat_symbol (libresolv, ___res_mailok, __res_mailok, GLIBC_2_0); +#endif /* Return 1 if DN is a syntactically valid domain name. Empty names are accepted. */ int -res_dnok (const char *dn) +___res_dnok (const char *dn) { unsigned char buf[NS_MAXCDNAME]; - return printable_string (dn) && ns_name_pton (dn, buf, sizeof (buf)) >= 0; + return printable_string (dn) && __ns_name_pton (dn, buf, sizeof (buf)) >= 0; } -libresolv_hidden_def (res_dnok) +versioned_symbol (libc, ___res_dnok, res_dnok, GLIBC_2_34); +versioned_symbol (libc, ___res_dnok, __libc_res_dnok, GLIBC_PRIVATE); +libc_hidden_ver (___res_dnok, __libc_res_dnok) +#if OTHER_SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_34) +compat_symbol (libresolv, ___res_dnok, __res_dnok, GLIBC_2_0); +#endif diff --git a/resolv/resolv.h b/resolv/resolv.h index a10ad99a16..9cce53f67b 100644 --- a/resolv/resolv.h +++ b/resolv/resolv.h @@ -225,10 +225,7 @@ __END_DECLS #define p_rcode __p_rcode #define putlong __putlong #define putshort __putshort -#define res_dnok __res_dnok -#define res_hnok __res_hnok #define res_hostalias __res_hostalias -#define res_mailok __res_mailok #define res_nameinquery __res_nameinquery #define res_nclose __res_nclose #define res_ninit __res_ninit @@ -237,7 +234,6 @@ __END_DECLS #define res_nquerydomain __res_nquerydomain #define res_nsearch __res_nsearch #define res_nsend __res_nsend -#define res_ownok __res_ownok #define res_queriesmatch __res_queriesmatch #define res_randomid __res_randomid #define sym_ntop __sym_ntop |