From patchwork Fri Jun 30 10:39:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 782775 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wzY484y8Zz9s5L for ; Fri, 30 Jun 2017 20:41:44 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="oCefWYgH"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:to:subject:mime-version:content-type :content-transfer-encoding:message-id:from; q=dns; s=default; b= Hj8yG9XHuh0aqacSybYFgWOghbqJzsKPKIDB5GYfVwFwPIPKq5doSrTbxMdq8KIA xThJXJHsYwWAueIpaJXaGwkTGeP6NfImoYtJ6TNQFGyndsKgg3pH1O6egty6jXoi rzFD4aubBWlQXFhHbQokcb9rX/IgGbY7gMajlIlH0bM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:to:subject:mime-version:content-type :content-transfer-encoding:message-id:from; s=default; bh=AFvp28 Qq9U9S6h1ZeySchighQXM=; b=oCefWYgHKdoUHwev8URJBDHStx80XcfzCCxVpM OfBUYwPQ2QvfUWad6GXq1L5PCdUrhzkmLv3mmuY051ZBn9zEM+ACCz1JEd7WHm7R SB73zU/6yOq657Bg+FPvPb/SYjm055KopGOWuuv8YHLmPYbjC3cG5oRLIfTqG+9n sxAx4= Received: (qmail 64739 invoked by alias); 30 Jun 2017 10:39:13 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 64670 invoked by uid 89); 30 Jun 2017 10:39:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=inh X-HELO: mx1.redhat.com DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3FBA91E2F0 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=fweimer@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3FBA91E2F0 Date: Fri, 30 Jun 2017 12:39:07 +0200 To: libc-alpha@sourceware.org Subject: [PATCH COMMITTED] resolv: Move res_query, res_search res_querydomain, hostalias User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Message-Id: <20170630103907.284FC439942F0@oldenburg.str.redhat.com> From: fweimer@redhat.com (Florian Weimer) From res_data.c to query.c 2017-06-30 Florian Weimer * resolv/res_data.c (res_query, res_search, res_querydomain) (hostalias): Move to ... * resolv/res_Send.c (res_query, res_search, res_querydomain) (hostalias): here. diff --git a/resolv/res_data.c b/resolv/res_data.c index b790b4b..5e7688c 100644 --- a/resolv/res_data.c +++ b/resolv/res_data.c @@ -15,35 +15,7 @@ * SOFTWARE. */ -#include -#include -#include -#include - -#include -#include -#include - -#include -#include #include -#include -#include -#include -#include - -int -res_query(const char *name, /* domain name */ - int class, int type, /* class and type of query */ - u_char *answer, /* buffer to put answer */ - int anslen) /* size of answer buffer */ -{ - if (__res_maybe_init (&_res, 1) == -1) { - RES_SET_H_ERRNO(&_res, NETDB_INTERNAL); - return (-1); - } - return (res_nquery(&_res, name, class, type, answer, anslen)); -} void res_close(void) { @@ -60,55 +32,3 @@ res_close(void) { did it and it would be done implicitly on shutdown. */ __res_iclose(&_res, false); } - -int -res_search(const char *name, /* domain name */ - int class, int type, /* class and type of query */ - u_char *answer, /* buffer to put answer */ - int anslen) /* size of answer */ -{ - if (__res_maybe_init (&_res, 1) == -1) { - RES_SET_H_ERRNO(&_res, NETDB_INTERNAL); - return (-1); - } - - return (res_nsearch(&_res, name, class, type, answer, anslen)); -} - -int -res_querydomain(const char *name, - const char *domain, - int class, int type, /* class and type of query */ - u_char *answer, /* buffer to put answer */ - int anslen) /* size of answer */ -{ - if (__res_maybe_init (&_res, 1) == -1) { - RES_SET_H_ERRNO(&_res, NETDB_INTERNAL); - return (-1); - } - - return (res_nquerydomain(&_res, name, domain, - class, type, - answer, anslen)); -} - -const char * -hostalias(const char *name) { - static char abuf[MAXDNAME]; - - return (res_hostalias(&_res, name, abuf, sizeof abuf)); -} -libresolv_hidden_def (hostalias) - - - -#include - -#if SHLIB_COMPAT(libresolv, GLIBC_2_0, GLIBC_2_2) -# undef res_query -# undef res_querydomain -# undef res_search -weak_alias (__res_query, res_query); -weak_alias (__res_querydomain, res_querydomain); -weak_alias (__res_search, res_search); -#endif diff --git a/resolv/res_query.c b/resolv/res_query.c index 0ca3a65..5312c8e 100644 --- a/resolv/res_query.c +++ b/resolv/res_query.c @@ -78,7 +78,7 @@ #include #include #include -#include +#include /* Options. Leave them on. */ /* #undef DEBUG */ @@ -319,6 +319,18 @@ res_nquery(res_state statp, } libresolv_hidden_def (res_nquery) +int +res_query (const char *name, int class, int type, + unsigned char *answer, int anslen) +{ + if (__res_maybe_init (&_res, 1) == -1) + { + RES_SET_H_ERRNO (&_res, NETDB_INTERNAL); + return -1; + } + return res_nquery (&_res, name, class, type, answer, anslen); +} + /* * Formulate a normal query, send, and retrieve answer in supplied buffer. * Return the size of the response on success, -1 on error. @@ -545,6 +557,19 @@ res_nsearch(res_state statp, } libresolv_hidden_def (res_nsearch) +int +res_search (const char *name, int class, int type, + unsigned char *answer, int anslen) +{ + if (__res_maybe_init (&_res, 1) == -1) + { + RES_SET_H_ERRNO (&_res, NETDB_INTERNAL); + return -1; + } + + return res_nsearch (&_res, name, class, type, answer, anslen); +} + /* * Perform a call on res_query on the concatenation of name and domain. */ @@ -610,6 +635,19 @@ res_nquerydomain(res_state statp, } libresolv_hidden_def (res_nquerydomain) +int +res_querydomain (const char *name, const char *domain, int class, int type, + unsigned char *answer, int anslen) +{ + if (__res_maybe_init (&_res, 1) == -1) + { + RES_SET_H_ERRNO (&_res, NETDB_INTERNAL); + return -1; + } + + return res_nquerydomain (&_res, name, domain, class, type, answer, anslen); +} + const char * res_hostalias(const res_state statp, const char *name, char *dst, size_t siz) { char *file, *cp1, *cp2; @@ -647,3 +685,20 @@ res_hostalias(const res_state statp, const char *name, char *dst, size_t siz) { return (NULL); } libresolv_hidden_def (res_hostalias) + +const char * +hostalias (const char *name) +{ + static char abuf[MAXDNAME]; + return res_hostalias (&_res, name, abuf, sizeof abuf); +} +libresolv_hidden_def (hostalias) + +#if SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_2) +# undef res_query +# undef res_querydomain +# undef res_search +weak_alias (__res_query, res_query); +weak_alias (__res_querydomain, res_querydomain); +weak_alias (__res_search, res_search); +#endif