2006-05-01 16:28:56 +02:00
|
|
|
/*
|
|
|
|
* DNS support
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006 Hans Leidekker
|
2021-03-30 10:35:28 +02:00
|
|
|
*
|
2006-05-01 16:28:56 +02:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2006-05-01 16:28:56 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winnls.h"
|
|
|
|
#include "windns.h"
|
|
|
|
|
2021-03-30 10:35:28 +02:00
|
|
|
#include "wine/debug.h"
|
2006-05-01 16:28:56 +02:00
|
|
|
#include "dnsapi.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(dnsapi);
|
|
|
|
|
2021-03-30 10:35:27 +02:00
|
|
|
const char *type_to_str( unsigned short type )
|
2006-05-01 16:28:56 +02:00
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
#define X(x) case (x): return #x;
|
|
|
|
X(DNS_TYPE_ZERO)
|
|
|
|
X(DNS_TYPE_A)
|
|
|
|
X(DNS_TYPE_NS)
|
|
|
|
X(DNS_TYPE_MD)
|
|
|
|
X(DNS_TYPE_MF)
|
|
|
|
X(DNS_TYPE_CNAME)
|
|
|
|
X(DNS_TYPE_SOA)
|
|
|
|
X(DNS_TYPE_MB)
|
|
|
|
X(DNS_TYPE_MG)
|
|
|
|
X(DNS_TYPE_MR)
|
|
|
|
X(DNS_TYPE_NULL)
|
|
|
|
X(DNS_TYPE_WKS)
|
|
|
|
X(DNS_TYPE_PTR)
|
|
|
|
X(DNS_TYPE_HINFO)
|
|
|
|
X(DNS_TYPE_MINFO)
|
|
|
|
X(DNS_TYPE_MX)
|
|
|
|
X(DNS_TYPE_TEXT)
|
|
|
|
X(DNS_TYPE_RP)
|
|
|
|
X(DNS_TYPE_AFSDB)
|
|
|
|
X(DNS_TYPE_X25)
|
|
|
|
X(DNS_TYPE_ISDN)
|
|
|
|
X(DNS_TYPE_RT)
|
|
|
|
X(DNS_TYPE_NSAP)
|
|
|
|
X(DNS_TYPE_NSAPPTR)
|
|
|
|
X(DNS_TYPE_SIG)
|
|
|
|
X(DNS_TYPE_KEY)
|
|
|
|
X(DNS_TYPE_PX)
|
|
|
|
X(DNS_TYPE_GPOS)
|
|
|
|
X(DNS_TYPE_AAAA)
|
|
|
|
X(DNS_TYPE_LOC)
|
|
|
|
X(DNS_TYPE_NXT)
|
|
|
|
X(DNS_TYPE_EID)
|
|
|
|
X(DNS_TYPE_NIMLOC)
|
|
|
|
X(DNS_TYPE_SRV)
|
|
|
|
X(DNS_TYPE_ATMA)
|
|
|
|
X(DNS_TYPE_NAPTR)
|
|
|
|
X(DNS_TYPE_KX)
|
|
|
|
X(DNS_TYPE_CERT)
|
|
|
|
X(DNS_TYPE_A6)
|
|
|
|
X(DNS_TYPE_DNAME)
|
|
|
|
X(DNS_TYPE_SINK)
|
|
|
|
X(DNS_TYPE_OPT)
|
|
|
|
X(DNS_TYPE_UINFO)
|
|
|
|
X(DNS_TYPE_UID)
|
|
|
|
X(DNS_TYPE_GID)
|
|
|
|
X(DNS_TYPE_UNSPEC)
|
|
|
|
X(DNS_TYPE_ADDRS)
|
|
|
|
X(DNS_TYPE_TKEY)
|
|
|
|
X(DNS_TYPE_TSIG)
|
|
|
|
X(DNS_TYPE_IXFR)
|
|
|
|
X(DNS_TYPE_AXFR)
|
|
|
|
X(DNS_TYPE_MAILB)
|
|
|
|
X(DNS_TYPE_MAILA)
|
|
|
|
X(DNS_TYPE_ANY)
|
|
|
|
X(DNS_TYPE_WINS)
|
|
|
|
X(DNS_TYPE_WINSR)
|
|
|
|
#undef X
|
|
|
|
default: { static char tmp[7]; sprintf( tmp, "0x%04x", type ); return tmp; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-30 10:35:27 +02:00
|
|
|
static int strcmpX( LPCVOID str1, LPCVOID str2, BOOL wide )
|
2006-05-01 16:28:56 +02:00
|
|
|
{
|
|
|
|
if (wide)
|
2006-09-13 14:36:49 +02:00
|
|
|
return lstrcmpiW( str1, str2 );
|
2006-05-01 16:28:56 +02:00
|
|
|
else
|
2006-09-13 14:36:49 +02:00
|
|
|
return lstrcmpiA( str1, str2 );
|
2006-05-01 16:28:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* DnsRecordCompare [DNSAPI.@]
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
BOOL WINAPI DnsRecordCompare( PDNS_RECORD r1, PDNS_RECORD r2 )
|
|
|
|
{
|
|
|
|
BOOL wide;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
TRACE( "(%p,%p)\n", r1, r2 );
|
|
|
|
|
2013-10-14 15:56:30 +02:00
|
|
|
if (r1->wType != r2->wType ||
|
|
|
|
r1->wDataLength != r2->wDataLength ||
|
|
|
|
r1->Flags.S.Section != r2->Flags.S.Section ||
|
|
|
|
r1->Flags.S.Delete != r2->Flags.S.Delete ||
|
|
|
|
r1->Flags.S.Unused != r2->Flags.S.Unused ||
|
|
|
|
r1->Flags.S.Reserved != r2->Flags.S.Reserved ||
|
|
|
|
r1->dwReserved != r2->dwReserved) return FALSE;
|
2006-05-01 16:28:56 +02:00
|
|
|
|
2013-10-14 15:56:30 +02:00
|
|
|
wide = (r1->Flags.S.CharSet == DnsCharSetUnicode || r1->Flags.S.CharSet == DnsCharSetUnknown);
|
2021-03-30 10:35:27 +02:00
|
|
|
if (strcmpX( r1->pName, r2->pName, wide )) return FALSE;
|
2006-05-01 16:28:56 +02:00
|
|
|
|
|
|
|
switch (r1->wType)
|
|
|
|
{
|
|
|
|
case DNS_TYPE_A:
|
|
|
|
{
|
|
|
|
if (r1->Data.A.IpAddress != r2->Data.A.IpAddress) return FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DNS_TYPE_SOA:
|
|
|
|
{
|
|
|
|
if (r1->Data.SOA.dwSerialNo != r2->Data.SOA.dwSerialNo ||
|
|
|
|
r1->Data.SOA.dwRefresh != r2->Data.SOA.dwRefresh ||
|
|
|
|
r1->Data.SOA.dwRetry != r2->Data.SOA.dwRetry ||
|
|
|
|
r1->Data.SOA.dwExpire != r2->Data.SOA.dwExpire ||
|
|
|
|
r1->Data.SOA.dwDefaultTtl != r2->Data.SOA.dwDefaultTtl)
|
|
|
|
return FALSE;
|
2021-03-30 10:35:28 +02:00
|
|
|
if (strcmpX( r1->Data.SOA.pNamePrimaryServer, r2->Data.SOA.pNamePrimaryServer, wide ) ||
|
|
|
|
strcmpX( r1->Data.SOA.pNameAdministrator, r2->Data.SOA.pNameAdministrator, wide ))
|
2006-05-01 16:28:56 +02:00
|
|
|
return FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DNS_TYPE_PTR:
|
|
|
|
case DNS_TYPE_NS:
|
|
|
|
case DNS_TYPE_CNAME:
|
|
|
|
case DNS_TYPE_MB:
|
|
|
|
case DNS_TYPE_MD:
|
|
|
|
case DNS_TYPE_MF:
|
|
|
|
case DNS_TYPE_MG:
|
|
|
|
case DNS_TYPE_MR:
|
|
|
|
{
|
2021-03-30 10:35:28 +02:00
|
|
|
if (strcmpX( r1->Data.PTR.pNameHost, r2->Data.PTR.pNameHost, wide )) return FALSE;
|
2006-05-01 16:28:56 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DNS_TYPE_MINFO:
|
|
|
|
case DNS_TYPE_RP:
|
|
|
|
{
|
2021-03-30 10:35:28 +02:00
|
|
|
if (strcmpX( r1->Data.MINFO.pNameMailbox, r2->Data.MINFO.pNameMailbox, wide ) ||
|
|
|
|
strcmpX( r1->Data.MINFO.pNameErrorsMailbox, r2->Data.MINFO.pNameErrorsMailbox, wide ))
|
2006-05-01 16:28:56 +02:00
|
|
|
return FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DNS_TYPE_MX:
|
|
|
|
case DNS_TYPE_AFSDB:
|
|
|
|
case DNS_TYPE_RT:
|
|
|
|
{
|
|
|
|
if (r1->Data.MX.wPreference != r2->Data.MX.wPreference)
|
|
|
|
return FALSE;
|
2021-03-30 10:35:28 +02:00
|
|
|
if (strcmpX( r1->Data.MX.pNameExchange, r2->Data.MX.pNameExchange, wide ))
|
2006-05-01 16:28:56 +02:00
|
|
|
return FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DNS_TYPE_HINFO:
|
|
|
|
case DNS_TYPE_ISDN:
|
|
|
|
case DNS_TYPE_TEXT:
|
|
|
|
case DNS_TYPE_X25:
|
|
|
|
{
|
|
|
|
if (r1->Data.TXT.dwStringCount != r2->Data.TXT.dwStringCount)
|
|
|
|
return FALSE;
|
|
|
|
for (i = 0; i < r1->Data.TXT.dwStringCount; i++)
|
|
|
|
{
|
2021-03-30 10:35:28 +02:00
|
|
|
if (strcmpX( r1->Data.TXT.pStringArray[i], r2->Data.TXT.pStringArray[i], wide ))
|
2006-05-01 16:28:56 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DNS_TYPE_NULL:
|
|
|
|
{
|
|
|
|
if (r1->Data.Null.dwByteCount != r2->Data.Null.dwByteCount)
|
|
|
|
return FALSE;
|
|
|
|
if (memcmp( r1->Data.Null.Data,
|
|
|
|
r2->Data.Null.Data, r1->Data.Null.dwByteCount ))
|
|
|
|
return FALSE;
|
|
|
|
break;
|
|
|
|
}
|
2019-03-01 17:37:33 +01:00
|
|
|
case DNS_TYPE_OPT:
|
|
|
|
{
|
|
|
|
if (r1->Data.Opt.wDataLength != r2->Data.Opt.wDataLength)
|
|
|
|
return FALSE;
|
|
|
|
/* ignore wPad */
|
|
|
|
if (memcmp( r1->Data.Opt.Data,
|
|
|
|
r2->Data.Opt.Data, r1->Data.Opt.wDataLength ))
|
|
|
|
return FALSE;
|
|
|
|
break;
|
|
|
|
}
|
2006-05-01 16:28:56 +02:00
|
|
|
case DNS_TYPE_AAAA:
|
|
|
|
{
|
|
|
|
for (i = 0; i < sizeof(IP6_ADDRESS)/sizeof(DWORD); i++)
|
|
|
|
{
|
|
|
|
if (r1->Data.AAAA.Ip6Address.IP6Dword[i] !=
|
|
|
|
r2->Data.AAAA.Ip6Address.IP6Dword[i]) return FALSE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DNS_TYPE_KEY:
|
|
|
|
{
|
|
|
|
if (r1->Data.KEY.wFlags != r2->Data.KEY.wFlags ||
|
|
|
|
r1->Data.KEY.chProtocol != r2->Data.KEY.chProtocol ||
|
|
|
|
r1->Data.KEY.chAlgorithm != r2->Data.KEY.chAlgorithm)
|
|
|
|
return FALSE;
|
|
|
|
if (memcmp( r1->Data.KEY.Key, r2->Data.KEY.Key,
|
|
|
|
r1->wDataLength - sizeof(DNS_KEY_DATA) + 1 ))
|
|
|
|
return FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DNS_TYPE_SIG:
|
|
|
|
{
|
2021-03-30 10:35:28 +02:00
|
|
|
if (strcmpX( r1->Data.SIG.pNameSigner, r2->Data.SIG.pNameSigner, wide ))
|
2006-05-01 16:28:56 +02:00
|
|
|
return FALSE;
|
|
|
|
if (r1->Data.SIG.wTypeCovered != r2->Data.SIG.wTypeCovered ||
|
|
|
|
r1->Data.SIG.chAlgorithm != r2->Data.SIG.chAlgorithm ||
|
|
|
|
r1->Data.SIG.chLabelCount != r2->Data.SIG.chLabelCount ||
|
|
|
|
r1->Data.SIG.dwOriginalTtl != r2->Data.SIG.dwOriginalTtl ||
|
|
|
|
r1->Data.SIG.dwExpiration != r2->Data.SIG.dwExpiration ||
|
|
|
|
r1->Data.SIG.dwTimeSigned != r2->Data.SIG.dwTimeSigned ||
|
|
|
|
r1->Data.SIG.wKeyTag != r2->Data.SIG.wKeyTag)
|
|
|
|
return FALSE;
|
|
|
|
if (memcmp( r1->Data.SIG.Signature, r2->Data.SIG.Signature,
|
|
|
|
r1->wDataLength - sizeof(DNS_SIG_DATAA) + 1 ))
|
|
|
|
return FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DNS_TYPE_ATMA:
|
|
|
|
{
|
|
|
|
if (r1->Data.ATMA.AddressType != r2->Data.ATMA.AddressType)
|
|
|
|
return FALSE;
|
|
|
|
for (i = 0; i < DNS_ATMA_MAX_ADDR_LENGTH; i++)
|
|
|
|
{
|
|
|
|
if (r1->Data.ATMA.Address[i] != r2->Data.ATMA.Address[i])
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DNS_TYPE_NXT:
|
|
|
|
{
|
2021-03-30 10:35:28 +02:00
|
|
|
if (strcmpX( r1->Data.NXT.pNameNext, r2->Data.NXT.pNameNext, wide )) return FALSE;
|
2006-05-01 16:28:56 +02:00
|
|
|
if (r1->Data.NXT.wNumTypes != r2->Data.NXT.wNumTypes) return FALSE;
|
|
|
|
if (memcmp( r1->Data.NXT.wTypes, r2->Data.NXT.wTypes,
|
|
|
|
r1->wDataLength - sizeof(DNS_NXT_DATAA) + sizeof(WORD) ))
|
|
|
|
return FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DNS_TYPE_SRV:
|
|
|
|
{
|
2021-03-30 10:35:28 +02:00
|
|
|
if (strcmpX( r1->Data.SRV.pNameTarget, r2->Data.SRV.pNameTarget, wide )) return FALSE;
|
2006-05-01 16:28:56 +02:00
|
|
|
if (r1->Data.SRV.wPriority != r2->Data.SRV.wPriority ||
|
|
|
|
r1->Data.SRV.wWeight != r2->Data.SRV.wWeight ||
|
|
|
|
r1->Data.SRV.wPort != r2->Data.SRV.wPort)
|
|
|
|
return FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DNS_TYPE_TKEY:
|
|
|
|
{
|
2021-03-30 10:35:28 +02:00
|
|
|
if (strcmpX( r1->Data.TKEY.pNameAlgorithm, r2->Data.TKEY.pNameAlgorithm, wide ))
|
2006-05-01 16:28:56 +02:00
|
|
|
return FALSE;
|
|
|
|
if (r1->Data.TKEY.dwCreateTime != r2->Data.TKEY.dwCreateTime ||
|
|
|
|
r1->Data.TKEY.dwExpireTime != r2->Data.TKEY.dwExpireTime ||
|
|
|
|
r1->Data.TKEY.wMode != r2->Data.TKEY.wMode ||
|
|
|
|
r1->Data.TKEY.wError != r2->Data.TKEY.wError ||
|
|
|
|
r1->Data.TKEY.wKeyLength != r2->Data.TKEY.wKeyLength ||
|
|
|
|
r1->Data.TKEY.wOtherLength != r2->Data.TKEY.wOtherLength ||
|
|
|
|
r1->Data.TKEY.cAlgNameLength != r2->Data.TKEY.cAlgNameLength ||
|
|
|
|
r1->Data.TKEY.bPacketPointers != r2->Data.TKEY.bPacketPointers)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* FIXME: ignoring pAlgorithmPacket field */
|
|
|
|
if (memcmp( r1->Data.TKEY.pKey, r2->Data.TKEY.pKey,
|
|
|
|
r1->Data.TKEY.wKeyLength ) ||
|
|
|
|
memcmp( r1->Data.TKEY.pOtherData, r2->Data.TKEY.pOtherData,
|
|
|
|
r1->Data.TKEY.wOtherLength )) return FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DNS_TYPE_TSIG:
|
|
|
|
{
|
2021-03-30 10:35:28 +02:00
|
|
|
if (strcmpX( r1->Data.TSIG.pNameAlgorithm, r2->Data.TSIG.pNameAlgorithm, wide ))
|
2006-05-01 16:28:56 +02:00
|
|
|
return FALSE;
|
|
|
|
if (r1->Data.TSIG.i64CreateTime != r2->Data.TSIG.i64CreateTime ||
|
|
|
|
r1->Data.TSIG.wFudgeTime != r2->Data.TSIG.wFudgeTime ||
|
|
|
|
r1->Data.TSIG.wOriginalXid != r2->Data.TSIG.wOriginalXid ||
|
|
|
|
r1->Data.TSIG.wError != r2->Data.TSIG.wError ||
|
|
|
|
r1->Data.TSIG.wSigLength != r2->Data.TSIG.wSigLength ||
|
|
|
|
r1->Data.TSIG.wOtherLength != r2->Data.TSIG.wOtherLength ||
|
|
|
|
r1->Data.TSIG.cAlgNameLength != r2->Data.TSIG.cAlgNameLength ||
|
|
|
|
r1->Data.TSIG.bPacketPointers != r2->Data.TSIG.bPacketPointers)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* FIXME: ignoring pAlgorithmPacket field */
|
|
|
|
if (memcmp( r1->Data.TSIG.pSignature, r2->Data.TSIG.pSignature,
|
|
|
|
r1->Data.TSIG.wSigLength ) ||
|
|
|
|
memcmp( r1->Data.TSIG.pOtherData, r2->Data.TSIG.pOtherData,
|
|
|
|
r1->Data.TSIG.wOtherLength )) return FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DNS_TYPE_WINS:
|
|
|
|
{
|
|
|
|
if (r1->Data.WINS.dwMappingFlag != r2->Data.WINS.dwMappingFlag ||
|
|
|
|
r1->Data.WINS.dwLookupTimeout != r2->Data.WINS.dwLookupTimeout ||
|
|
|
|
r1->Data.WINS.dwCacheTimeout != r2->Data.WINS.dwCacheTimeout ||
|
|
|
|
r1->Data.WINS.cWinsServerCount != r2->Data.WINS.cWinsServerCount)
|
|
|
|
return FALSE;
|
|
|
|
if (memcmp( r1->Data.WINS.WinsServers, r2->Data.WINS.WinsServers,
|
|
|
|
r1->wDataLength - sizeof(DNS_WINS_DATA) + sizeof(IP4_ADDRESS) ))
|
|
|
|
return FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DNS_TYPE_WINSR:
|
|
|
|
{
|
|
|
|
if (r1->Data.WINSR.dwMappingFlag != r2->Data.WINSR.dwMappingFlag ||
|
|
|
|
r1->Data.WINSR.dwLookupTimeout != r2->Data.WINSR.dwLookupTimeout ||
|
|
|
|
r1->Data.WINSR.dwCacheTimeout != r2->Data.WINSR.dwCacheTimeout)
|
|
|
|
return FALSE;
|
2021-03-30 10:35:28 +02:00
|
|
|
if (strcmpX( r1->Data.WINSR.pNameResultDomain, r2->Data.WINSR.pNameResultDomain, wide ))
|
2006-05-01 16:28:56 +02:00
|
|
|
return FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
2021-03-30 10:35:27 +02:00
|
|
|
FIXME( "unknown type: %s\n", type_to_str( r1->wType ) );
|
2006-05-01 16:28:56 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
2006-05-01 16:29:14 +02:00
|
|
|
|
2021-03-30 10:35:27 +02:00
|
|
|
static LPVOID strcpyX( LPCVOID src, DNS_CHARSET in, DNS_CHARSET out )
|
2006-05-01 16:29:14 +02:00
|
|
|
{
|
|
|
|
switch (in)
|
|
|
|
{
|
|
|
|
case DnsCharSetUnicode:
|
|
|
|
{
|
|
|
|
switch (out)
|
|
|
|
{
|
2021-03-30 10:35:27 +02:00
|
|
|
case DnsCharSetUnicode: return strdup_w( src );
|
|
|
|
case DnsCharSetUtf8: return strdup_wu( src );
|
|
|
|
case DnsCharSetAnsi: return strdup_wa( src );
|
2006-05-01 16:29:14 +02:00
|
|
|
default:
|
|
|
|
WARN( "unhandled target charset: %d\n", out );
|
|
|
|
break;
|
|
|
|
}
|
2011-03-18 23:18:31 +01:00
|
|
|
break;
|
2006-05-01 16:29:14 +02:00
|
|
|
}
|
|
|
|
case DnsCharSetUtf8:
|
|
|
|
switch (out)
|
|
|
|
{
|
2021-03-30 10:35:27 +02:00
|
|
|
case DnsCharSetUnicode: return strdup_uw( src );
|
|
|
|
case DnsCharSetUtf8: return strdup_u( src );
|
|
|
|
case DnsCharSetAnsi: return strdup_ua( src );
|
2006-05-01 16:29:14 +02:00
|
|
|
default:
|
|
|
|
WARN( "unhandled target charset: %d\n", out );
|
|
|
|
break;
|
|
|
|
}
|
2011-03-18 23:18:31 +01:00
|
|
|
break;
|
2006-05-01 16:29:14 +02:00
|
|
|
case DnsCharSetAnsi:
|
|
|
|
switch (out)
|
|
|
|
{
|
2021-03-30 10:35:27 +02:00
|
|
|
case DnsCharSetUnicode: return strdup_aw( src );
|
|
|
|
case DnsCharSetUtf8: return strdup_au( src );
|
|
|
|
case DnsCharSetAnsi: return strdup_a( src );
|
2006-05-01 16:29:14 +02:00
|
|
|
default:
|
|
|
|
WARN( "unhandled target charset: %d\n", out );
|
|
|
|
break;
|
|
|
|
}
|
2011-03-18 23:18:31 +01:00
|
|
|
break;
|
2006-05-01 16:29:14 +02:00
|
|
|
default:
|
|
|
|
WARN( "unhandled source charset: %d\n", in );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* DnsRecordCopyEx [DNSAPI.@]
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
PDNS_RECORD WINAPI DnsRecordCopyEx( PDNS_RECORD src, DNS_CHARSET in, DNS_CHARSET out )
|
|
|
|
{
|
|
|
|
DNS_RECORD *dst;
|
|
|
|
unsigned int i, size;
|
|
|
|
|
|
|
|
TRACE( "(%p,%d,%d)\n", src, in, out );
|
|
|
|
|
|
|
|
size = FIELD_OFFSET(DNS_RECORD, Data) + src->wDataLength;
|
2007-11-28 00:11:14 +01:00
|
|
|
dst = heap_alloc_zero( size );
|
2006-05-01 16:29:14 +02:00
|
|
|
if (!dst) return NULL;
|
|
|
|
|
|
|
|
memcpy( dst, src, size );
|
|
|
|
|
|
|
|
if (src->Flags.S.CharSet == DnsCharSetUtf8 ||
|
|
|
|
src->Flags.S.CharSet == DnsCharSetAnsi ||
|
|
|
|
src->Flags.S.CharSet == DnsCharSetUnicode) in = src->Flags.S.CharSet;
|
|
|
|
|
|
|
|
dst->Flags.S.CharSet = out;
|
2021-03-30 10:35:27 +02:00
|
|
|
dst->pName = strcpyX( src->pName, in, out );
|
2006-05-01 16:29:14 +02:00
|
|
|
if (!dst->pName) goto error;
|
|
|
|
|
|
|
|
switch (src->wType)
|
|
|
|
{
|
|
|
|
case DNS_TYPE_HINFO:
|
|
|
|
case DNS_TYPE_ISDN:
|
|
|
|
case DNS_TYPE_TEXT:
|
|
|
|
case DNS_TYPE_X25:
|
|
|
|
{
|
|
|
|
for (i = 0; i < src->Data.TXT.dwStringCount; i++)
|
|
|
|
{
|
2021-03-30 10:35:27 +02:00
|
|
|
dst->Data.TXT.pStringArray[i] = strcpyX( src->Data.TXT.pStringArray[i], in, out );
|
2006-05-01 16:29:14 +02:00
|
|
|
if (!dst->Data.TXT.pStringArray[i])
|
|
|
|
{
|
2007-11-28 00:11:14 +01:00
|
|
|
while (i > 0) heap_free( dst->Data.TXT.pStringArray[--i] );
|
2006-05-01 16:29:14 +02:00
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DNS_TYPE_MINFO:
|
|
|
|
case DNS_TYPE_RP:
|
|
|
|
{
|
2021-03-30 10:35:27 +02:00
|
|
|
dst->Data.MINFO.pNameMailbox = strcpyX( src->Data.MINFO.pNameMailbox, in, out );
|
2006-05-01 16:29:14 +02:00
|
|
|
if (!dst->Data.MINFO.pNameMailbox) goto error;
|
|
|
|
|
2021-03-30 10:35:27 +02:00
|
|
|
dst->Data.MINFO.pNameErrorsMailbox = strcpyX( src->Data.MINFO.pNameErrorsMailbox, in, out );
|
2006-05-01 16:29:14 +02:00
|
|
|
if (!dst->Data.MINFO.pNameErrorsMailbox)
|
|
|
|
{
|
2007-11-28 00:11:14 +01:00
|
|
|
heap_free( dst->Data.MINFO.pNameMailbox );
|
2006-05-01 16:29:14 +02:00
|
|
|
goto error;
|
|
|
|
}
|
2019-03-01 17:37:34 +01:00
|
|
|
|
|
|
|
dst->wDataLength = sizeof(dst->Data.MINFO);
|
|
|
|
if (out == DnsCharSetUnicode) dst->wDataLength +=
|
2021-03-30 10:35:29 +02:00
|
|
|
(wcslen( dst->Data.MINFO.pNameMailbox ) + 1) * sizeof(WCHAR) +
|
|
|
|
(wcslen( dst->Data.MINFO.pNameErrorsMailbox ) + 1) * sizeof(WCHAR);
|
2006-05-01 16:29:14 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DNS_TYPE_AFSDB:
|
|
|
|
case DNS_TYPE_RT:
|
|
|
|
case DNS_TYPE_MX:
|
|
|
|
{
|
2021-03-30 10:35:27 +02:00
|
|
|
dst->Data.MX.pNameExchange = strcpyX( src->Data.MX.pNameExchange, in, out );
|
2006-05-01 16:29:14 +02:00
|
|
|
if (!dst->Data.MX.pNameExchange) goto error;
|
2019-03-01 17:37:34 +01:00
|
|
|
|
|
|
|
dst->wDataLength = sizeof(dst->Data.MX);
|
|
|
|
if (out == DnsCharSetUnicode) dst->wDataLength +=
|
2021-03-30 10:35:29 +02:00
|
|
|
(wcslen( dst->Data.MX.pNameExchange ) + 1) * sizeof(WCHAR);
|
2006-05-01 16:29:14 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DNS_TYPE_NXT:
|
|
|
|
{
|
2021-03-30 10:35:27 +02:00
|
|
|
dst->Data.NXT.pNameNext = strcpyX( src->Data.NXT.pNameNext, in, out );
|
2006-05-01 16:29:14 +02:00
|
|
|
if (!dst->Data.NXT.pNameNext) goto error;
|
2019-03-01 17:37:34 +01:00
|
|
|
|
|
|
|
dst->wDataLength = sizeof(dst->Data.NXT);
|
|
|
|
if (out == DnsCharSetUnicode) dst->wDataLength +=
|
2021-03-30 10:35:29 +02:00
|
|
|
(wcslen( dst->Data.NXT.pNameNext ) + 1) * sizeof(WCHAR);
|
2006-05-01 16:29:14 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DNS_TYPE_CNAME:
|
|
|
|
case DNS_TYPE_MB:
|
|
|
|
case DNS_TYPE_MD:
|
|
|
|
case DNS_TYPE_MF:
|
|
|
|
case DNS_TYPE_MG:
|
|
|
|
case DNS_TYPE_MR:
|
|
|
|
case DNS_TYPE_NS:
|
|
|
|
case DNS_TYPE_PTR:
|
|
|
|
{
|
2021-03-30 10:35:27 +02:00
|
|
|
dst->Data.PTR.pNameHost = strcpyX( src->Data.PTR.pNameHost, in, out );
|
2006-05-01 16:29:14 +02:00
|
|
|
if (!dst->Data.PTR.pNameHost) goto error;
|
2019-03-01 17:37:34 +01:00
|
|
|
|
|
|
|
dst->wDataLength = sizeof(dst->Data.PTR);
|
|
|
|
if (out == DnsCharSetUnicode) dst->wDataLength +=
|
2021-03-30 10:35:29 +02:00
|
|
|
(wcslen( dst->Data.PTR.pNameHost ) + 1) * sizeof(WCHAR);
|
2006-05-01 16:29:14 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DNS_TYPE_SIG:
|
|
|
|
{
|
2021-03-30 10:35:27 +02:00
|
|
|
dst->Data.SIG.pNameSigner = strcpyX( src->Data.SIG.pNameSigner, in, out );
|
2006-05-01 16:29:14 +02:00
|
|
|
if (!dst->Data.SIG.pNameSigner) goto error;
|
2019-03-01 17:37:34 +01:00
|
|
|
|
|
|
|
dst->wDataLength = sizeof(dst->Data.SIG);
|
|
|
|
if (out == DnsCharSetUnicode) dst->wDataLength +=
|
2021-03-30 10:35:29 +02:00
|
|
|
(wcslen( dst->Data.SIG.pNameSigner ) + 1) * sizeof(WCHAR);
|
2006-05-01 16:29:14 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DNS_TYPE_SOA:
|
|
|
|
{
|
2021-03-30 10:35:27 +02:00
|
|
|
dst->Data.SOA.pNamePrimaryServer = strcpyX( src->Data.SOA.pNamePrimaryServer, in, out );
|
2006-05-01 16:29:14 +02:00
|
|
|
if (!dst->Data.SOA.pNamePrimaryServer) goto error;
|
|
|
|
|
2021-03-30 10:35:27 +02:00
|
|
|
dst->Data.SOA.pNameAdministrator = strcpyX( src->Data.SOA.pNameAdministrator, in, out );
|
2006-05-01 16:29:14 +02:00
|
|
|
if (!dst->Data.SOA.pNameAdministrator)
|
|
|
|
{
|
2007-11-28 00:11:14 +01:00
|
|
|
heap_free( dst->Data.SOA.pNamePrimaryServer );
|
2006-05-01 16:29:14 +02:00
|
|
|
goto error;
|
|
|
|
}
|
2019-03-01 17:37:34 +01:00
|
|
|
|
|
|
|
dst->wDataLength = sizeof(dst->Data.SOA);
|
|
|
|
if (out == DnsCharSetUnicode) dst->wDataLength +=
|
2021-03-30 10:35:29 +02:00
|
|
|
(wcslen( dst->Data.SOA.pNamePrimaryServer ) + 1) * sizeof(WCHAR) +
|
|
|
|
(wcslen( dst->Data.SOA.pNameAdministrator ) + 1) * sizeof(WCHAR);
|
2006-05-01 16:29:14 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DNS_TYPE_SRV:
|
|
|
|
{
|
2021-03-30 10:35:27 +02:00
|
|
|
dst->Data.SRV.pNameTarget = strcpyX( src->Data.SRV.pNameTarget, in, out );
|
2006-05-01 16:29:14 +02:00
|
|
|
if (!dst->Data.SRV.pNameTarget) goto error;
|
2019-03-01 17:37:34 +01:00
|
|
|
|
|
|
|
dst->wDataLength = sizeof(dst->Data.SRV);
|
|
|
|
if (out == DnsCharSetUnicode) dst->wDataLength +=
|
2021-03-30 10:35:29 +02:00
|
|
|
(wcslen( dst->Data.SRV.pNameTarget ) + 1) * sizeof(WCHAR);
|
2006-05-01 16:29:14 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return dst;
|
|
|
|
|
|
|
|
error:
|
2007-11-28 00:11:14 +01:00
|
|
|
heap_free( dst->pName );
|
|
|
|
heap_free( dst );
|
2006-05-01 16:29:14 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* DnsRecordListFree [DNSAPI.@]
|
|
|
|
*
|
|
|
|
*/
|
2007-08-08 10:47:03 +02:00
|
|
|
VOID WINAPI DnsRecordListFree( PDNS_RECORD list, DNS_FREE_TYPE type )
|
2006-05-01 16:29:14 +02:00
|
|
|
{
|
|
|
|
DNS_RECORD *r, *next;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
TRACE( "(%p,%d)\n", list, type );
|
|
|
|
|
|
|
|
if (!list) return;
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case DnsFreeRecordList:
|
|
|
|
{
|
|
|
|
for (r = list; (list = r); r = next)
|
|
|
|
{
|
2007-11-28 00:11:14 +01:00
|
|
|
heap_free( r->pName );
|
2006-05-01 16:29:14 +02:00
|
|
|
|
|
|
|
switch (r->wType)
|
|
|
|
{
|
|
|
|
case DNS_TYPE_HINFO:
|
|
|
|
case DNS_TYPE_ISDN:
|
|
|
|
case DNS_TYPE_TEXT:
|
|
|
|
case DNS_TYPE_X25:
|
|
|
|
{
|
|
|
|
for (i = 0; i < r->Data.TXT.dwStringCount; i++)
|
2007-11-28 00:11:14 +01:00
|
|
|
heap_free( r->Data.TXT.pStringArray[i] );
|
2006-05-01 16:29:14 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DNS_TYPE_MINFO:
|
|
|
|
case DNS_TYPE_RP:
|
|
|
|
{
|
2007-11-28 00:11:14 +01:00
|
|
|
heap_free( r->Data.MINFO.pNameMailbox );
|
|
|
|
heap_free( r->Data.MINFO.pNameErrorsMailbox );
|
2006-05-01 16:29:14 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DNS_TYPE_AFSDB:
|
|
|
|
case DNS_TYPE_RT:
|
|
|
|
case DNS_TYPE_MX:
|
|
|
|
{
|
2007-11-28 00:11:14 +01:00
|
|
|
heap_free( r->Data.MX.pNameExchange );
|
2006-05-01 16:29:14 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DNS_TYPE_NXT:
|
|
|
|
{
|
2007-11-28 00:11:14 +01:00
|
|
|
heap_free( r->Data.NXT.pNameNext );
|
2006-05-01 16:29:14 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DNS_TYPE_CNAME:
|
|
|
|
case DNS_TYPE_MB:
|
|
|
|
case DNS_TYPE_MD:
|
|
|
|
case DNS_TYPE_MF:
|
|
|
|
case DNS_TYPE_MG:
|
|
|
|
case DNS_TYPE_MR:
|
|
|
|
case DNS_TYPE_NS:
|
|
|
|
case DNS_TYPE_PTR:
|
|
|
|
{
|
2007-11-28 00:11:14 +01:00
|
|
|
heap_free( r->Data.PTR.pNameHost );
|
2006-05-01 16:29:14 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DNS_TYPE_SIG:
|
|
|
|
{
|
2007-11-28 00:11:14 +01:00
|
|
|
heap_free( r->Data.SIG.pNameSigner );
|
2006-05-01 16:29:14 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DNS_TYPE_SOA:
|
|
|
|
{
|
2007-11-28 00:11:14 +01:00
|
|
|
heap_free( r->Data.SOA.pNamePrimaryServer );
|
|
|
|
heap_free( r->Data.SOA.pNameAdministrator );
|
2006-05-01 16:29:14 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DNS_TYPE_SRV:
|
|
|
|
{
|
2007-11-28 00:11:14 +01:00
|
|
|
heap_free( r->Data.SRV.pNameTarget );
|
2006-05-01 16:29:14 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
next = r->pNext;
|
2007-11-28 00:11:14 +01:00
|
|
|
heap_free( r );
|
2006-05-01 16:29:14 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DnsFreeFlat:
|
|
|
|
case DnsFreeParsedMessageFields:
|
|
|
|
{
|
|
|
|
FIXME( "unhandled free type: %d\n", type );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
WARN( "unknown free type: %d\n", type );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-24 10:23:04 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* DnsFree [DNSAPI.@]
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void WINAPI DnsFree( PVOID data, DNS_FREE_TYPE type )
|
|
|
|
{
|
2011-08-27 19:47:39 +02:00
|
|
|
DnsRecordListFree( data, type );
|
2011-08-24 10:23:04 +02:00
|
|
|
}
|
|
|
|
|
2006-05-08 16:39:23 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* DnsRecordSetCompare [DNSAPI.@]
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
BOOL WINAPI DnsRecordSetCompare( PDNS_RECORD set1, PDNS_RECORD set2,
|
|
|
|
PDNS_RECORD *diff1, PDNS_RECORD *diff2 )
|
|
|
|
{
|
|
|
|
BOOL ret = TRUE;
|
2008-04-11 22:40:37 +02:00
|
|
|
DNS_RECORD *r, *t, *u;
|
2006-05-08 16:39:23 +02:00
|
|
|
DNS_RRSET rr1, rr2;
|
|
|
|
|
|
|
|
TRACE( "(%p,%p,%p,%p)\n", set1, set2, diff1, diff2 );
|
|
|
|
|
|
|
|
if (!set1 && !set2) return FALSE;
|
|
|
|
|
|
|
|
if (diff1) *diff1 = NULL;
|
|
|
|
if (diff2) *diff2 = NULL;
|
|
|
|
|
|
|
|
if (set1 && !set2)
|
|
|
|
{
|
|
|
|
if (diff1) *diff1 = DnsRecordSetCopyEx( set1, 0, set1->Flags.S.CharSet );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (!set1 && set2)
|
|
|
|
{
|
|
|
|
if (diff2) *diff2 = DnsRecordSetCopyEx( set2, 0, set2->Flags.S.CharSet );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
DNS_RRSET_INIT( rr1 );
|
|
|
|
DNS_RRSET_INIT( rr2 );
|
|
|
|
|
2008-04-11 22:40:37 +02:00
|
|
|
for (r = set1; r; r = r->pNext)
|
2006-05-08 16:39:23 +02:00
|
|
|
{
|
2008-04-11 22:40:37 +02:00
|
|
|
for (t = set2; t; t = t->pNext)
|
2006-05-08 16:39:23 +02:00
|
|
|
{
|
|
|
|
u = DnsRecordCopyEx( r, r->Flags.S.CharSet, t->Flags.S.CharSet );
|
|
|
|
if (!u) goto error;
|
|
|
|
|
|
|
|
if (!DnsRecordCompare( t, u ))
|
|
|
|
{
|
|
|
|
DNS_RRSET_ADD( rr1, u );
|
|
|
|
ret = FALSE;
|
|
|
|
}
|
2008-07-19 19:53:35 +02:00
|
|
|
else DnsRecordListFree( u, DnsFreeRecordList );
|
2006-05-08 16:39:23 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-04-11 22:40:37 +02:00
|
|
|
for (t = set2; t; t = t->pNext)
|
2006-05-08 16:39:23 +02:00
|
|
|
{
|
2008-04-11 22:40:37 +02:00
|
|
|
for (r = set1; r; r = r->pNext)
|
2006-05-08 16:39:23 +02:00
|
|
|
{
|
|
|
|
u = DnsRecordCopyEx( t, t->Flags.S.CharSet, r->Flags.S.CharSet );
|
|
|
|
if (!u) goto error;
|
|
|
|
|
|
|
|
if (!DnsRecordCompare( r, u ))
|
|
|
|
{
|
|
|
|
DNS_RRSET_ADD( rr2, u );
|
|
|
|
ret = FALSE;
|
|
|
|
}
|
2008-07-19 19:53:35 +02:00
|
|
|
else DnsRecordListFree( u, DnsFreeRecordList );
|
2006-05-08 16:39:23 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DNS_RRSET_TERMINATE( rr1 );
|
|
|
|
DNS_RRSET_TERMINATE( rr2 );
|
2021-03-30 10:35:28 +02:00
|
|
|
|
2006-05-08 16:39:23 +02:00
|
|
|
if (diff1) *diff1 = rr1.pFirstRR;
|
2008-07-19 19:53:35 +02:00
|
|
|
else DnsRecordListFree( rr1.pFirstRR, DnsFreeRecordList );
|
|
|
|
|
2006-05-08 16:39:23 +02:00
|
|
|
if (diff2) *diff2 = rr2.pFirstRR;
|
2008-07-19 19:53:35 +02:00
|
|
|
else DnsRecordListFree( rr2.pFirstRR, DnsFreeRecordList );
|
2006-05-08 16:39:23 +02:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
error:
|
|
|
|
DNS_RRSET_TERMINATE( rr1 );
|
|
|
|
DNS_RRSET_TERMINATE( rr2 );
|
|
|
|
|
|
|
|
DnsRecordListFree( rr1.pFirstRR, DnsFreeRecordList );
|
|
|
|
DnsRecordListFree( rr2.pFirstRR, DnsFreeRecordList );
|
2021-03-30 10:35:28 +02:00
|
|
|
|
2006-05-08 16:39:23 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2006-05-01 16:29:14 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* DnsRecordSetCopyEx [DNSAPI.@]
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
PDNS_RECORD WINAPI DnsRecordSetCopyEx( PDNS_RECORD src_set, DNS_CHARSET in, DNS_CHARSET out )
|
|
|
|
{
|
|
|
|
DNS_RRSET dst_set;
|
|
|
|
DNS_RECORD *src, *dst;
|
|
|
|
|
|
|
|
TRACE( "(%p,%d,%d)\n", src_set, in, out );
|
|
|
|
|
|
|
|
DNS_RRSET_INIT( dst_set );
|
|
|
|
|
|
|
|
for (src = src_set; (src_set = src); src = src_set->pNext)
|
|
|
|
{
|
|
|
|
dst = DnsRecordCopyEx( src, in, out );
|
|
|
|
if (!dst)
|
|
|
|
{
|
|
|
|
DNS_RRSET_TERMINATE( dst_set );
|
|
|
|
DnsRecordListFree( dst_set.pFirstRR, DnsFreeRecordList );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
DNS_RRSET_ADD( dst_set, dst );
|
|
|
|
}
|
|
|
|
|
|
|
|
DNS_RRSET_TERMINATE( dst_set );
|
|
|
|
return dst_set.pFirstRR;
|
|
|
|
}
|
2006-09-13 14:36:33 +02:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* DnsRecordSetDetach [DNSAPI.@]
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
PDNS_RECORD WINAPI DnsRecordSetDetach( PDNS_RECORD set )
|
|
|
|
{
|
|
|
|
DNS_RECORD *r, *s;
|
|
|
|
|
|
|
|
TRACE( "(%p)\n", set );
|
|
|
|
|
|
|
|
for (r = set; (set = r); r = set->pNext)
|
|
|
|
{
|
|
|
|
if (r->pNext && !r->pNext->pNext)
|
|
|
|
{
|
|
|
|
s = r->pNext;
|
|
|
|
r->pNext = NULL;
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|