3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
29
30 /*
31 * University Copyright- Copyright (c) 1982, 1986, 1988
32 * The Regents of the University of California
33 * All Rights Reserved
34 *
35 * University Acknowledgment- Portions of this document are derived from
36 * software developed by the University of California, Berkeley, and its
37 * contributors.
38 */
39
40 #pragma ident "%Z%%M% %I% %E% SMI"
41
42 #include <sys/types.h>
43 #include <netinet/in.h>
44 #include <stdio.h>
45 #include <arpa/nameser.h>
46
47 extern char *p_cdname(), *p_rr(), *p_type(), *p_class(), *p_time();
48 extern char *inet_ntoa();
49 void fp_query(char *msg, FILE *file);
50
51 char *_res_opcodes[] = {
52 "QUERY",
53 "IQUERY",
54 "CQUERYM",
55 "CQUERYU",
56 "4",
57 "5",
58 "6",
59 "7",
60 "8",
61 "UPDATEA",
62 "UPDATED",
63 "UPDATEDA",
64 "UPDATEM",
65 "UPDATEMA",
66 "ZONEINIT",
67 "ZONEREF",
68 };
178 */
179 if (n = ntohs(hp->arcount)) {
180 fprintf(file, "ADDITIONAL RECORDS:\n");
181 while (--n >= 0) {
182 fprintf(file, "\t");
183 cp = p_rr(cp, msg, file);
184 if (cp == NULL)
185 return;
186 }
187 }
188 }
189
190 char *
191 p_cdname(cp, msg, file)
192 char *cp, *msg;
193 FILE *file;
194 {
195 char name[MAXDNAME];
196 int n;
197
198 if ((n = dn_expand(msg, msg + 512, cp, name, sizeof (name))) < 0)
199 return (NULL);
200 if (name[0] == '\0') {
201 name[0] = '.';
202 name[1] = '\0';
203 }
204 fputs(name, file);
205 return (cp + n);
206 }
207
208 /*
209 * Print resource record fields in human readable form.
210 */
211 char *
212 p_rr(cp, msg, file)
213 char *cp, *msg;
214 FILE *file;
215 {
216 int type, class, dlen, n, c;
217 struct in_addr inaddr;
218 char *cp1, *cp2;
|
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2015 Gary Mills
24 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
26 */
27
28 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
29 /* All Rights Reserved */
30
31 /*
32 * University Copyright- Copyright (c) 1982, 1986, 1988
33 * The Regents of the University of California
34 * All Rights Reserved
35 *
36 * University Acknowledgment- Portions of this document are derived from
37 * software developed by the University of California, Berkeley, and its
38 * contributors.
39 */
40
41 #include <sys/types.h>
42 #include <sys/socket.h>
43 #include <netinet/in.h>
44 #include <arpa/inet.h>
45 #include <stdio.h>
46 #include <string.h>
47 #include <arpa/nameser.h>
48 #include <resolv.h>
49 #include "crossl.h"
50
51 void fp_query(char *msg, FILE *file);
52
53 char *_res_opcodes[] = {
54 "QUERY",
55 "IQUERY",
56 "CQUERYM",
57 "CQUERYU",
58 "4",
59 "5",
60 "6",
61 "7",
62 "8",
63 "UPDATEA",
64 "UPDATED",
65 "UPDATEDA",
66 "UPDATEM",
67 "UPDATEMA",
68 "ZONEINIT",
69 "ZONEREF",
70 };
180 */
181 if (n = ntohs(hp->arcount)) {
182 fprintf(file, "ADDITIONAL RECORDS:\n");
183 while (--n >= 0) {
184 fprintf(file, "\t");
185 cp = p_rr(cp, msg, file);
186 if (cp == NULL)
187 return;
188 }
189 }
190 }
191
192 char *
193 p_cdname(cp, msg, file)
194 char *cp, *msg;
195 FILE *file;
196 {
197 char name[MAXDNAME];
198 int n;
199
200 if ((n = dn_expand((u_char *)msg, (u_char *)(msg + 512), (u_char *)cp,
201 (u_char *)name, sizeof (name))) < 0)
202 return (NULL);
203 if (name[0] == '\0') {
204 name[0] = '.';
205 name[1] = '\0';
206 }
207 fputs(name, file);
208 return (cp + n);
209 }
210
211 /*
212 * Print resource record fields in human readable form.
213 */
214 char *
215 p_rr(cp, msg, file)
216 char *cp, *msg;
217 FILE *file;
218 {
219 int type, class, dlen, n, c;
220 struct in_addr inaddr;
221 char *cp1, *cp2;
|