1/*
2 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (c) 1995,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 *
--- 5 unchanged lines hidden (view full) ---
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#ifndef lint
19static const char rcsid[] = "$Id: ns_samedomain.c,v 1.1.2.2.4.2 2004/03/16 12:34:17 marka Exp $";
20#endif
21#include <sys/cdefs.h>
22__FBSDID("$FreeBSD: head/lib/libc/nameser/ns_samedomain.c 156956 2006-03-21 15:37:16Z ume $");
23
24#include "port_before.h"
25
26#include <sys/types.h>
27#include <arpa/nameser.h>
28#include <errno.h>
29#include <string.h>
30
31#include "port_after.h"
32
33#ifndef _LIBC
34/*
35 * int
36 * ns_samedomain(a, b)
37 * Check whether a name belongs to a domain.
38 * Inputs:
39 * a - the domain whose ancestory is being verified
40 * b - the potential ancestor we're checking against
41 * Return:
--- 96 unchanged lines hidden (view full) ---
138 if (escaped)
139 return (0);
140
141 /* Now compare aligned trailing substring. */
142 cp = a + diff;
143 return (strncasecmp(cp, b, lb) == 0);
144}
145
146/*
147 * int
148 * ns_subdomain(a, b)
149 * is "a" a subdomain of "b"?
150 */
151int
152ns_subdomain(const char *a, const char *b) {
153 return (ns_samename(a, b) != 1 && ns_samedomain(a, b));
--- 57 unchanged lines hidden ---
2 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (c) 1995,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 *
--- 5 unchanged lines hidden (view full) ---
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#ifndef lint
19static const char rcsid[] = "$Id: ns_samedomain.c,v 1.1.2.2.4.2 2004/03/16 12:34:17 marka Exp $";
20#endif
21#include <sys/cdefs.h>
22__FBSDID("$FreeBSD: head/lib/libc/nameser/ns_samedomain.c 156956 2006-03-21 15:37:16Z ume $");
23
24#include "port_before.h"
25
26#include <sys/types.h>
27#include <arpa/nameser.h>
28#include <errno.h>
29#include <string.h>
30
31#include "port_after.h"
32
33#ifndef _LIBC
34/*
35 * int
36 * ns_samedomain(a, b)
37 * Check whether a name belongs to a domain.
38 * Inputs:
39 * a - the domain whose ancestory is being verified
40 * b - the potential ancestor we're checking against
41 * Return:
--- 96 unchanged lines hidden (view full) ---
138 if (escaped)
139 return (0);
140
141 /* Now compare aligned trailing substring. */
142 cp = a + diff;
143 return (strncasecmp(cp, b, lb) == 0);
144}
145
146/*
147 * int
148 * ns_subdomain(a, b)
149 * is "a" a subdomain of "b"?
150 */
151int
152ns_subdomain(const char *a, const char *b) {
153 return (ns_samename(a, b) != 1 && ns_samedomain(a, b));
--- 57 unchanged lines hidden ---