Source
/* #if defined(HAVE_RES_NINIT) && !defined(_AIX) && (defined(HAVE_RES_U_EXT) || defined(HAVE_RES_U_EXT_EXT)) */
/*
** Zabbix
** Copyright (C) 2001-2022 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/* add the library for DnsQuery function */
static const char *decode_type(int q_type)
{
static ZBX_THREAD_LOCAL char buf[16];
switch (q_type)
{
case T_A:
return "A"; /* address */
case T_AAAA:
return "AAAA"; /* v6 address */
case T_NS:
return "NS"; /* name server */
case T_MD:
return "MD"; /* mail destination */ /* obsolete */
case T_MF:
return "MF"; /* mail forwarder */ /* obsolete */
case T_CNAME:
return "CNAME"; /* canonical name */
case T_SOA:
return "SOA"; /* start of authority */
case T_MB:
return "MB"; /* mailbox */ /* experimental */
case T_MG:
return "MG"; /* mail group member */ /* experimental */
case T_MR:
return "MR"; /* mail rename */ /* experimental */
case T_NULL:
return "NULL"; /* null */ /* obsolete */
case T_WKS:
return "WKS"; /* well-known service */ /* obsolete */
case T_PTR:
return "PTR"; /* domain name pointer */
case T_HINFO:
return "HINFO"; /* host information */
case T_MINFO:
return "MINFO"; /* mailbox information */ /* experimental */
case T_MX:
return "MX"; /* mail exchanger */
case T_TXT:
return "TXT"; /* text */
case T_SRV:
return "SRV"; /* service locator */
default:
zbx_snprintf(buf, sizeof(buf), "T_%d", q_type);
return buf;
}
}
static char *get_name(unsigned char *msg, unsigned char *msg_end, unsigned char **msg_ptr)
{
int res;
static char buffer[MAX_STRING_LEN];
if (-1 == (res = dn_expand(msg, msg_end, *msg_ptr, buffer, sizeof(buffer))))
return NULL;