]>
Commit | Line | Data |
---|---|---|
4e1d3db1 FW |
1 | /* Expand compressed domain name to presentation format. |
2 | * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") | |
3 | * Copyright (c) 1996,1999 by Internet Software Consortium. | |
4 | * | |
5 | * Permission to use, copy, modify, and distribute this software for any | |
6 | * purpose with or without fee is hereby granted, provided that the above | |
7 | * copyright notice and this permission notice appear in all copies. | |
8 | * | |
9 | * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES | |
10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR | |
12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT | |
15 | * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
16 | */ | |
17 | ||
18 | #include <arpa/nameser.h> | |
19 | #include <shlib-compat.h> | |
20 | ||
21 | /* Expand compressed domain name to presentation format. Returns the | |
22 | number of bytes read out of `src', or -1 (with errno set). The | |
23 | root domain is returned as ".", not "". */ | |
24 | int | |
25 | ___ns_name_uncompress (const unsigned char *msg, const unsigned char *eom, | |
26 | const unsigned char *src, char *dst, size_t dstsiz) | |
27 | { | |
28 | unsigned char tmp[NS_MAXCDNAME]; | |
29 | int n = __ns_name_unpack (msg, eom, src, tmp, sizeof tmp); | |
30 | if (n < 0) | |
31 | return -1; | |
32 | if (__ns_name_ntop (tmp, dst, dstsiz) < 0) | |
33 | return -1; | |
34 | return n; | |
35 | } | |
36 | versioned_symbol (libc, ___ns_name_uncompress, ns_name_uncompress, | |
37 | GLIBC_2_34); | |
38 | versioned_symbol (libc, ___ns_name_uncompress, __ns_name_uncompress, | |
39 | GLIBC_PRIVATE); | |
40 | libc_hidden_ver (___ns_name_uncompress, __ns_name_uncompress) | |
41 | ||
42 | #if OTHER_SHLIB_COMPAT (libresolv, GLIBC_2_9, GLIBC_2_34) | |
43 | compat_symbol (libresolv, ___ns_name_uncompress, ns_name_uncompress, | |
44 | GLIBC_2_9); | |
45 | #endif |