From 72a51ac647b2fc33a44434d3d125a844801609ae Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Mon, 19 Jul 2021 07:55:27 +0200 Subject: resolv: Move res_nameinquery to its own file and into libc And reformat to GNU style. This deprecated function is used in the implementation of the stub resolver (for now). Keep the public symbol in libresolv for now (so that no new symbol version is needed), and add a forwarder to libresolv. Reviewed-by: Carlos O'Donell Tested-by: Carlos O'Donell --- resolv/res_send.c | 43 +------------------------------------------ 1 file changed, 1 insertion(+), 42 deletions(-) (limited to 'resolv/res_send.c') diff --git a/resolv/res_send.c b/resolv/res_send.c index dfea9fc..a5a33e6 100644 --- a/resolv/res_send.c +++ b/resolv/res_send.c @@ -191,47 +191,6 @@ static int send_dg(res_state, const u_char *, int, u_char **, int *, int *, int *); static int sock_eq(struct sockaddr_in6 *, struct sockaddr_in6 *); -/* Public. */ - -/* int - * res_nameinquery(name, type, class, buf, eom) - * look for (name,type,class) in the query section of packet (buf,eom) - * requires: - * buf + HFIXEDSZ <= eom - * returns: - * -1 : format error - * 0 : not found - * >0 : found - * author: - * paul vixie, 29may94 - */ -int -res_nameinquery(const char *name, int type, int class, - const u_char *buf, const u_char *eom) -{ - const u_char *cp = buf + HFIXEDSZ; - int qdcount = ntohs(((HEADER*)buf)->qdcount); - - while (qdcount-- > 0) { - char tname[MAXDNAME+1]; - int n, ttype, tclass; - - n = __libc_dn_expand (buf, eom, cp, tname, sizeof tname); - if (n < 0) - return (-1); - cp += n; - if (cp + 2 * INT16SZ > eom) - return (-1); - NS_GET16(ttype, cp); - NS_GET16(tclass, cp); - if (ttype == type && tclass == class - && __libc_ns_samename (tname, name) == 1) - return (1); - } - return (0); -} -libresolv_hidden_def (res_nameinquery) - /* Returns a shift value for the name server index. Used to implement RES_ROTATE. */ static unsigned int @@ -337,7 +296,7 @@ res_queriesmatch(const u_char *buf1, const u_char *eom1, return (-1); NS_GET16(ttype, cp); NS_GET16(tclass, cp); - if (!res_nameinquery(tname, ttype, tclass, buf2, eom2)) + if (!__libc_res_nameinquery (tname, ttype, tclass, buf2, eom2)) return (0); } return (1); -- cgit v1.1