mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-22 13:00:06 +00:00
762a2b2d34
But only as an internal symbol, __libc_ns_samename. The libresolv ABI is preserved. This is because the function is deprecated, and it does not make sense to add new symbol versions for deprecated functions. Also reformat the implementation to GNU style. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
39 lines
1.4 KiB
C
39 lines
1.4 KiB
C
/* Check if two domain names are equal after trailing dot normalization.
|
|
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
|
* Copyright (c) 1995,1999 by Internet Software Consortium.
|
|
*
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
* copyright notice and this permission notice appear in all copies.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
|
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
|
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
|
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
|
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
|
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
|
* SOFTWARE.
|
|
*/
|
|
|
|
#include <arpa/nameser.h>
|
|
#include <string.h>
|
|
|
|
/* Determines whether domain name A is the same as domain name B.
|
|
Returns -1 on error, 0 if names differ, 1 if names are the
|
|
same. */
|
|
int
|
|
__libc_ns_samename (const char *a, const char *b)
|
|
{
|
|
char ta[NS_MAXDNAME], tb[NS_MAXDNAME];
|
|
|
|
if (__libc_ns_makecanon (a, ta, sizeof ta) < 0 ||
|
|
__libc_ns_makecanon (b, tb, sizeof tb) < 0)
|
|
return -1;
|
|
if (__strcasecmp (ta, tb) == 0)
|
|
return 1;
|
|
else
|
|
return 0;
|
|
}
|
|
libc_hidden_def (__libc_ns_samename)
|