From 9c886c390d6c1327d294744eb7cdc586b0faf9fb Mon Sep 17 00:00:00 2001 From: Apple Date: Tue, 6 Mar 2018 00:51:23 +0000 Subject: [PATCH] libresolv-65.200.2.tar.gz --- dns.c | 6 ++-- dns_private.h | 2 ++ dns_util.c | 55 ++--------------------------- dns_util.h | 1 + dst.h | 4 +++ dst_hmac_link.c | 8 +---- dst_internal.h | 5 ++- installapi.h | 13 +++++++ libresolv.xcodeproj/project.pbxproj | 1 - res_data.c | 1 + res_debug.c | 20 ++--------- res_init.c | 7 +++- res_private.h | 8 +++++ res_query.c | 10 ++++-- res_send.c | 4 +-- res_update.h | 4 +++ resolv.h | 13 +------ xcodescripts/libresolv.xcconfig | 5 +++ xcodescripts/links.sh | 10 ++++++ xcodescripts/manpages.sh | 3 +- 20 files changed, 79 insertions(+), 101 deletions(-) create mode 100644 installapi.h diff --git a/dns.c b/dns.c index fa2e658..61dcccb 100644 --- a/dns.c +++ b/dns.c @@ -728,7 +728,7 @@ _pdns_check_search_list(pdns_handle_t *pdns) } } -__private_extern__ void +__attribute__((__visibility__("hidden"))) void _check_cache(sdns_handle_t *sdns) { int i, n, status, refresh, sc_dns_count; @@ -1405,7 +1405,7 @@ _pdns_query(sdns_handle_t *sdns, pdns_handle_t *pdns, const char *name, uint32_t return res_nquery_soa_min(pdns->res, name, class, type, (u_char *)buf, len, from, (int32_t *)fromlen, min); } -__private_extern__ int +__attribute__((__visibility__("hidden"))) int _pdns_search(sdns_handle_t *sdns, pdns_handle_t *pdns, const char *name, uint32_t class, uint32_t type, char *buf, uint32_t len, struct sockaddr *from, uint32_t *fromlen) { char *dot, *qname; @@ -1520,7 +1520,7 @@ _sdns_send(sdns_handle_t *sdns, const char *name, uint32_t class, uint32_t type, return n; } -__private_extern__ int +__attribute__((__visibility__("hidden"))) int _sdns_search(sdns_handle_t *sdns, const char *name, uint32_t class, uint32_t type, uint32_t fqdn, uint32_t recurse, char *buf, uint32_t len, struct sockaddr *from, uint32_t *fromlen, int *min) { pdns_handle_t *primary, **pdns; diff --git a/dns_private.h b/dns_private.h index 8320ab7..c097db6 100644 --- a/dns_private.h +++ b/dns_private.h @@ -1,6 +1,8 @@ #ifndef __DNS_PRIVATE_H__ #define __DNS_PRIVATE_H__ +#include +#include #include #define MDNS_HANDLE_NAME "*MDNS*" diff --git a/dns_util.c b/dns_util.c index f44a008..51159e1 100644 --- a/dns_util.c +++ b/dns_util.c @@ -74,9 +74,6 @@ #define MAXPACKET 1024 -extern void res_client_close(res_state res); -extern int __res_nquery(res_state statp, const char *name, int class, int type, u_char *answer, int anslen); -extern int dns_res_send(res_state statp, const u_char *buf, int buflen, u_char *ans, int *anssiz, struct sockaddr *from, int *fromlen); extern void _check_cache(sdns_handle_t *sdns); extern int _sdns_search(sdns_handle_t *sdns, const char *name, uint32_t class, uint32_t type, uint32_t fqdn, uint32_t recurse, char *buf, uint32_t len, struct sockaddr *from, uint32_t *fromlen, int *min); extern int _pdns_search(sdns_handle_t *sdns, pdns_handle_t *pdns, const char *name, uint32_t class, uint32_t type, char *buf, uint32_t len, struct sockaddr *from, uint32_t *fromlen); @@ -316,6 +313,7 @@ _dns_parse_domain_name(const char *p, char **x, int32_t *remaining) return name; } +static dns_resource_record_t * _dns_parse_resource_record_internal(const char *p, char **x, int32_t *remaining) { @@ -742,6 +740,7 @@ dns_parse_resource_record(const char *buf, uint32_t len) return _dns_parse_resource_record_internal(buf, &x, &remaining); } +static dns_question_t * _dns_parse_question_internal(const char *p, char **x, int32_t *remaining) { @@ -1159,55 +1158,6 @@ _dns_append_resource_record(dns_resource_record_t *r, char **s, uint16_t *l) } } -char * -dns_build_reply(dns_reply_t *dnsr, uint16_t *rl) -{ - uint16_t i, len; - dns_header_t *h; - char *s, *x; - - if (dnsr == NULL) return NULL; - - len = NS_HFIXEDSZ; - - s = malloc(len); - x = s + len; - - memset(s, 0, len); - *rl = len; - - h = (dns_header_t *)s; - - h->xid = htons(dnsr->header->xid); - h->flags = htons(dnsr->header->flags); - h->qdcount = htons(dnsr->header->qdcount); - h->ancount = htons(dnsr->header->ancount); - h->nscount = htons(dnsr->header->nscount); - h->arcount = htons(dnsr->header->arcount); - - for (i = 0; i < dnsr->header->qdcount; i++) - { - _dns_append_question(dnsr->question[i], &s, rl); - } - - for (i = 0; i < dnsr->header->ancount; i++) - { - _dns_append_resource_record(dnsr->answer[i], &s, rl); - } - - for (i = 0; i < dnsr->header->nscount; i++) - { - _dns_append_resource_record(dnsr->authority[i], &s, rl); - } - - for (i = 0; i < dnsr->header->arcount; i++) - { - _dns_append_resource_record(dnsr->additional[i], &s, rl); - } - - return s; -} - void dns_free_question(dns_question_t *q) { @@ -1247,6 +1197,7 @@ dns_get_buffer_size(dns_handle_t d) return dns->recvsize; } +static dns_reply_t * dns_lookup_soa_min(dns_handle_t d, const char *name, uint32_t class, uint32_t type, int *min) { diff --git a/dns_util.h b/dns_util.h index c29dfd7..5f9da7d 100644 --- a/dns_util.h +++ b/dns_util.h @@ -31,6 +31,7 @@ #include #include #include +#include /* * Status returned in a dns_reply_t diff --git a/dst.h b/dst.h index 791bd82..c769dea 100644 --- a/dst.h +++ b/dst.h @@ -1,6 +1,8 @@ #ifndef DST_H #define DST_H +#pragma GCC visibility push(hidden) + #ifndef HAS_DST_KEY #define DST_KEY RES_9_DST_KEY typedef struct dst_key { @@ -153,4 +155,6 @@ u_int16_t dst_s_id_calc(const u_char *key_data, const int key_len); #define MISSING_KEY_OR_SIGNATURE (-30) #define UNSUPPORTED_KEYALG (-31) +#pragma GCC visibility pop + #endif /* DST_H */ diff --git a/dst_hmac_link.c b/dst_hmac_link.c index b5b3375..e4b47d8 100644 --- a/dst_hmac_link.c +++ b/dst_hmac_link.c @@ -466,16 +466,10 @@ dst_hmac_md5_init() } #else +#include "dst_internal.h" #define dst_hmac_md5_init res_9_dst_hmac_md5_init int dst_hmac_md5_init(){ return (0); } #endif - - - - - - - diff --git a/dst_internal.h b/dst_internal.h index 177af3a..40ece0d 100644 --- a/dst_internal.h +++ b/dst_internal.h @@ -18,6 +18,7 @@ * WITH THE USE OR PERFORMANCE OF THE SOFTWARE. */ #include +#include #include #if (!defined(BSD)) || (BSD < 199306) # include @@ -55,6 +56,8 @@ typedef struct dst_key { #include #endif +#pragma GCC visibility push(hidden) + /* * define what crypto systems are supported for RSA, * BSAFE is prefered over RSAREF; only one can be set at any time @@ -183,6 +186,6 @@ void dst_s_dump(const int mode, const u_char *data, const int size, const char *msg); - +#pragma GCC visibility pop #endif /* DST_INTERNAL_H */ diff --git a/installapi.h b/installapi.h new file mode 100644 index 0000000..7f3fbb0 --- /dev/null +++ b/installapi.h @@ -0,0 +1,13 @@ +#include +#include +#include +#include + +// These are declared in Libinfo's headers. These declarations should eventually move into headers provided by libresolv. + +typedef void (*dns_async_callback)(int32_t status, char *buf, uint32_t len, struct sockaddr *from, int fromlen, void *context); +int32_t dns_async_start(mach_port_t *p, const char *name, uint16_t dnsclass, uint16_t dnstype, uint32_t do_search, dns_async_callback callback, void *context); +int32_t dns_async_send(mach_port_t *p, const char *name, uint16_t dnsclass, uint16_t dnstype, uint32_t do_search); +int32_t dns_async_receive(mach_port_t p, char **buf, uint32_t *len, struct sockaddr **from, uint32_t *fromlen); +int32_t dns_async_handle_reply(void *msg); +void dns_async_cancel(mach_port_t p); diff --git a/libresolv.xcodeproj/project.pbxproj b/libresolv.xcodeproj/project.pbxproj index 096ccb2..b4aa9f5 100644 --- a/libresolv.xcodeproj/project.pbxproj +++ b/libresolv.xcodeproj/project.pbxproj @@ -237,7 +237,6 @@ runOnlyForDeploymentPostprocessing = 1; shellPath = /bin/sh; shellScript = "sh \"$PROJECT_DIR\"/xcodescripts/headers.sh\nsh \"$PROJECT_DIR\"/xcodescripts/manpages.sh\nsh \"$PROJECT_DIR\"/xcodescripts/links.sh"; - showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ diff --git a/res_data.c b/res_data.c index 64af8f3..d7de0d6 100644 --- a/res_data.c +++ b/res_data.c @@ -47,6 +47,7 @@ struct __res_9_state _res_9; extern int __res_vinit(res_state, int); +__attribute__((__visibility__("hidden"))) const char *__res_opcodes[] = { "QUERY", "IQUERY", diff --git a/res_debug.c b/res_debug.c index 0dbe115..ad74dff 100644 --- a/res_debug.c +++ b/res_debug.c @@ -364,6 +364,7 @@ p_fqname(const u_char *cp, const u_char *msg, FILE *file) { * that ns_c_any is a qclass but not a class. (You can ask for records of class * ns_c_any, but you can't have any records of that class in the database.) */ +static const struct res_sym __res_p_class_syms[] = { {ns_c_in, "IN", (char *)0}, {ns_c_chaos, "CHAOS", (char *)0}, @@ -399,24 +400,6 @@ const struct res_sym __res_p_update_section_syms[] = { {0, (char *)0, (char *)0} }; -const struct res_sym __res_p_key_syms[] = { - {NS_ALG_MD5RSA, "RSA", "RSA KEY with MD5 hash"}, - {NS_ALG_DH, "DH", "Diffie Hellman"}, - {NS_ALG_DSA, "DSA", "Digital Signature Algorithm"}, - {NS_ALG_EXPIRE_ONLY, "EXPIREONLY", "No algorithm"}, - {NS_ALG_PRIVATE_OID, "PRIVATE", "Algorithm obtained from OID"}, - {0, NULL, NULL} -}; - -const struct res_sym __res_p_cert_syms[] = { - {cert_t_pkix, "PKIX", "PKIX (X.509v3) Certificate"}, - {cert_t_spki, "SPKI", "SPKI certificate"}, - {cert_t_pgp, "PGP", "PGP certificate"}, - {cert_t_url, "URL", "URL Private"}, - {cert_t_oid, "OID", "OID Private"}, - {0, NULL, NULL} -}; - /* * Names of RR types and qtypes. Types and qtypes are the same, except * that T_ANY is a qtype but not a type. (You can ask for records of type @@ -478,6 +461,7 @@ const struct res_sym __p_type_syms[] = { /* * Names of DNS rcodes. */ +static const struct res_sym __res_p_rcode_syms[] = { {ns_r_noerror, "NOERROR", "no error"}, {ns_r_formerr, "FORMERR", "format error"}, diff --git a/res_init.c b/res_init.c index bdb3845..dc3b5e1 100644 --- a/res_init.c +++ b/res_init.c @@ -130,6 +130,7 @@ static u_int32_t net_mask __P((struct in_addr)); * Resolver state default settings. */ +__attribute__((__visibility__("hidden"))) res_state res_build_start(res_state x) { @@ -172,6 +173,7 @@ res_build_start(res_state x) return res; } +__attribute__((__visibility__("hidden"))) int res_build_finish(res_state res, uint32_t timeout, uint16_t port) { @@ -207,6 +209,7 @@ res_build_finish(res_state res, uint32_t timeout, uint16_t port) return 0; } +__attribute__((__visibility__("hidden"))) int res_build_sortlist(res_state res, struct in_addr addr, struct in_addr mask) { @@ -225,6 +228,7 @@ res_build_sortlist(res_state res, struct in_addr addr, struct in_addr mask) return 0; } +__attribute__((__visibility__("hidden"))) char * res_next_word(char **p) { @@ -256,6 +260,7 @@ res_next_word(char **p) return s; } +__attribute__((__visibility__("hidden"))) int res_build(res_state res, uint16_t port, uint32_t *nsrch, char *key, char *val) { @@ -518,7 +523,7 @@ res_build(res_state res, uint16_t port, uint32_t *nsrch, char *key, char *val) * * Return 0 if completes successfully, -1 on error */ - +static int res_vinit_from_file(res_state statp, int preinit, char *resconf_file) { diff --git a/res_private.h b/res_private.h index 34bf952..755163e 100644 --- a/res_private.h +++ b/res_private.h @@ -4,6 +4,8 @@ #include #include +#pragma GCC visibility push(hidden) + /* * status codes from dns_res_xxx SPIs * positive numbers are ns_rcode values. @@ -107,4 +109,10 @@ void res_interrupt_request(void *token); void *res_init_interrupt_token(void); void res_delete_interrupt_token(void *token); +extern void res_client_close(res_state res); +extern int __res_nquery(res_state statp, const char *name, int class, int type, u_char *answer, int anslen); +extern int dns_res_send(res_state statp, const u_char *buf, int buflen, u_char *ans, int *anssiz, struct sockaddr *from, int *fromlen); + +#pragma GCC visibility pop + #endif diff --git a/res_query.c b/res_query.c index be6a52f..93e80b0 100644 --- a/res_query.c +++ b/res_query.c @@ -101,8 +101,8 @@ static const char rcsid[] = "$Id: res_query.c,v 1.1 2006/03/01 19:01:38 majka Ex #endif /* interrupt mechanism is implemented in res_send.c */ -__private_extern__ int interrupt_pipe_enabled; -__private_extern__ pthread_key_t interrupt_pipe_key; +extern int interrupt_pipe_enabled; +extern pthread_key_t interrupt_pipe_key; /* Options. Leave them on. */ #define DEBUG @@ -584,7 +584,7 @@ res_soa_minimum(const u_char *msg, int len) * * Caller must parse answer and determine whether it answers the question. */ -__private_extern__ int +__attribute__((__visibility__("hidden"))) int res_nquery_soa_min(res_state statp, const char *name, int class, int type, u_char *answer, int anslen, struct sockaddr *from, int *fromlen, int *min) { u_char buf[MAXPACKET]; @@ -676,6 +676,7 @@ again: return (n); } +__attribute__((__visibility__("hidden"))) int res_nquery_2(res_state statp, const char *name, int class, int type, u_char *answer, int anslen, struct sockaddr *from, int *fromlen) { @@ -699,6 +700,7 @@ res_nquery(res_state statp, const char *name, int class, int type, u_char *answe * Perform a call on res_query on the concatenation of name and domain, * removing a trailing dot from name if domain is NULL. */ +__attribute__((__visibility__("hidden"))) int res_nquerydomain_2(res_state statp, const char *name, const char *domain, int class, int type, u_char *answer, int anslen, struct sockaddr *from, int *fromlen) { @@ -766,6 +768,7 @@ res_nquerydomain(res_state statp, const char *name, const char *domain, int clas * If enabled, implement search rules until answer or unrecoverable failure * is detected. Error code, if any, is left in H_ERRNO. */ +__attribute__((__visibility__("hidden"))) int res_nsearch_2(res_state statp, const char *name, int class, int type, u_char *answer, int anslen, struct sockaddr *from, int *fromlen) { @@ -897,6 +900,7 @@ res_nsearch_2(res_state statp, const char *name, int class, int type, u_char *an return (-1); } +__attribute__((__visibility__("hidden"))) int __res_nsearch_list_2(res_state statp, const char *name, int class, int type, u_char *answer, int anslen, struct sockaddr *from, int *fromlen, int nsearch, char **search) { diff --git a/res_send.c b/res_send.c index 7a0f6c4..f391fb4 100644 --- a/res_send.c +++ b/res_send.c @@ -159,8 +159,8 @@ static int dns_pselect(int, void *, void *, void *, struct timespec *, const si static const int niflags = NI_NUMERICHOST | NI_NUMERICSERV; /* interrupt mechanism is shared with res_query.c */ -int interrupt_pipe_enabled = 0; -pthread_key_t interrupt_pipe_key; +__attribute__((__visibility__("hidden"))) int interrupt_pipe_enabled = 0; +__attribute__((__visibility__("hidden"))) pthread_key_t interrupt_pipe_key; static int bind_random(int sock, int family) diff --git a/res_update.h b/res_update.h index 1dbaed0..657bcdd 100644 --- a/res_update.h +++ b/res_update.h @@ -79,6 +79,8 @@ #endif #include +#pragma GCC visibility push(hidden) + /* * This RR-like structure is particular to UPDATE. */ @@ -114,4 +116,6 @@ void res_freeupdrec __P((ns_updrec *)); int res_nmkupdate __P((res_state, ns_updrec *, u_char *, int)); int res_nupdate __P((res_state, ns_updrec *, ns_tsig_key *)); +#pragma GCC visibility pop + #endif /*_RES_UPDATE_H_*/ diff --git a/resolv.h b/resolv.h index d2dbd43..a6d96ca 100644 --- a/resolv.h +++ b/resolv.h @@ -303,7 +303,7 @@ union res_sockaddr_union { /* 0x00010000 */ /* Things involving an internal (static) resolver context. */ -#ifndef __BIND_NOSTATIC +#if !defined(__BIND_NOSTATIC) && !defined(__BIND_INSTALLAPI) extern struct __res_state _res; #endif @@ -351,17 +351,8 @@ __END_DECLS * */ #define res_sym res_9_sym -#define __p_key_syms __res_9_p_key_syms -#define __p_cert_syms __res_9_p_cert_syms -#define __p_class_syms __res_9_p_class_syms #define __p_type_syms __res_9_p_type_syms -#define __p_rcode_syms __res_9_p_rcode_syms - -extern const struct res_sym __p_key_syms[]; -extern const struct res_sym __p_cert_syms[]; -extern const struct res_sym __p_class_syms[]; extern const struct res_sym __p_type_syms[]; -extern const struct res_sym __p_rcode_syms[]; #endif /* SHARED_LIBBIND */ #define b64_ntop res_9_b64_ntop @@ -472,8 +463,6 @@ int res_findzonecut __P((res_state, const char *, ns_class, int, char *, size_t int res_findzonecut2 __P((res_state, const char *, ns_class, int, char *, size_t, union res_sockaddr_union *, int)); void res_nclose __P((res_state)); int res_nopt __P((res_state, int, u_char *, int, int)); -void res_send_setqhook __P((res_send_qhook hook)); -void res_send_setrhook __P((res_send_rhook hook)); int __res_vinit __P((res_state, int)); void res_destroyservicelist __P((void)); const char * res_servicename __P((u_int16_t port, const char *proto)); diff --git a/xcodescripts/libresolv.xcconfig b/xcodescripts/libresolv.xcconfig index 0ff1cce..7ec25ea 100644 --- a/xcodescripts/libresolv.xcconfig +++ b/xcodescripts/libresolv.xcconfig @@ -1,5 +1,6 @@ #include "/Makefiles/CoreOS/Xcode/BSD.xcconfig" +VERSION_INFO_PREFIX=__attribute__((visibility("hidden"))) PRODUCT_NAME = $(TARGET_NAME).$(FRAMEWORK_VERSION) DEBUG_INFORMATION_FORMAT = dwarf-with-dsym CODE_SIGN_IDENTITY = - @@ -21,3 +22,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES GCC_WARN_UNUSED_VARIABLE = YES GCC_ENABLE_OBJC_EXCEPTIONS = YES INSTALLHDRS_SCRIPT_PHASE = YES +IS_ZIPPERED = YES +SUPPORTS_TEXT_BASED_API = YES +TAPI_VERIFY_MODE = Pedantic +OTHER_TAPI_FLAGS = -D__BIND_INSTALLAPI -extra-public-header $(SRCROOT)/installapi.h diff --git a/xcodescripts/links.sh b/xcodescripts/links.sh index 151c4e3..de0d287 100644 --- a/xcodescripts/links.sh +++ b/xcodescripts/links.sh @@ -4,6 +4,16 @@ set -e -x if [ "$ACTION" = installhdrs ]; then exit 0; fi LIBDIR="$DSTROOT"/usr/lib + +# installapi runs the script *before* calling tapi... sigh... +mkdir -p "$LIBDIR" + +ln -s libresolv.9.tbd "$LIBDIR"/libresolv.tbd +chown -h "$INSTALL_OWNER:$INSTALL_GROUP" "$LIBDIR"/libresolv.tbd + +# don't install man pages for installhdrs, installapi, or iOS builds +if [ "$ACTION" = installapi ]; then exit 0; fi + ln -s libresolv.9.dylib "$LIBDIR"/libresolv.dylib chown -h "$INSTALL_OWNER:$INSTALL_GROUP" "$LIBDIR"/libresolv.dylib chmod -h 0755 "$LIBDIR"/libresolv.dylib diff --git a/xcodescripts/manpages.sh b/xcodescripts/manpages.sh index f0c9072..48715ca 100644 --- a/xcodescripts/manpages.sh +++ b/xcodescripts/manpages.sh @@ -1,7 +1,8 @@ #!/bin/bash set -e -x -# don't install man pages for installhdrs or iOS builds +# don't install man pages for installhdrs, installapi, or iOS builds +if [ "$ACTION" = installapi ]; then exit 0; fi if [ "$ACTION" = installhdrs ]; then exit 0; fi if [ "${PLATFORM_NAME}" != "macosx" ]; then exit 0; fi -- 2.45.2