ssu.c revision b7e6fc2a4cca2c07bca1aa122a9105786b282743
/*
* Copyright (C) 2004-2008, 2010, 2011, 2013 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000, 2001, 2003 Internet Software Consortium.
*
* 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 ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC 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.
*/
/*! \file */
/*
* $Id: ssu.c,v 1.38 2011/01/06 23:47:00 tbox Exp $
* Principal Author: Brian Wellington
*/
#include <config.h>
#include <dns/fixedname.h>
struct dns_ssurule {
unsigned int magic;
unsigned int matchtype; /*%< which type of pattern match? */
unsigned int ntypes; /*%< number of data types covered */
/*%< defaults to all but SIG,SOA,NS if NULL */
};
struct dns_ssutable {
unsigned int magic;
unsigned int references;
};
return (ISC_R_NOMEMORY);
if (result != ISC_R_SUCCESS) {
return (result);
}
return (ISC_R_SUCCESS);
}
static inline void
}
}
}
}
void
source->references++;
}
void
if (--table->references == 0)
if (done)
}
{
if (matchtype == DNS_SSUMATCHTYPE_WILDCARD)
if (ntypes > 0)
return (ISC_R_NOMEMORY);
goto failure;
}
if (result != ISC_R_SUCCESS)
goto failure;
goto failure;
}
if (result != ISC_R_SUCCESS)
goto failure;
if (ntypes > 0) {
ntypes * sizeof(dns_rdatatype_t));
goto failure;
}
} else
return (ISC_R_SUCCESS);
}
}
ntypes * sizeof(dns_rdatatype_t));
return (result);
}
static inline isc_boolean_t
type != dns_rdatatype_soa &&
type != dns_rdatatype_rrsig));
}
static void
unsigned char *ap;
isc_buffer_t b;
unsigned long l;
case AF_INET:
"%lu.%lu.%lu.%lu.IN-ADDR.ARPA.",
(l >> 0) & 0xff, (l >> 8) & 0xff,
(l >> 16) & 0xff, (l >> 24) & 0xff);
break;
case AF_INET6:
"%x.%x.%x.%x.%x.%x.%x.%x."
"%x.%x.%x.%x.%x.%x.%x.%x."
"%x.%x.%x.%x.%x.%x.%x.%x."
"%x.%x.%x.%x.%x.%x.%x.%x."
"IP6.ARPA.",
break;
default:
INSIST(0);
}
}
static void
char buf[sizeof("X.X.X.X.Y.Y.Y.Y.2.0.0.2.IP6.ARPA.")];
unsigned char *ap;
isc_buffer_t b;
unsigned long l;
case AF_INET:
"%lx.%lx.%lx.%lx.%lx.%lx.%lx.%lx"
"2.0.0.2.IP6.ARPA.",
l & 0xf, (l >> 4) & 0xf,
(l >> 8) & 0xf, (l >> 12) & 0xf,
(l >> 16) & 0xf, (l >> 20) & 0xf,
(l >> 24) & 0xf, (l >> 28) & 0xf);
break;
case AF_INET6:
"%x.%x.%x.%x.%x.%x.%x.%x."
"%x.%x.%x.%x.IP6.ARPA.",
break;
default:
INSIST(0);
}
}
{
unsigned int i;
return (ISC_FALSE);
{
case DNS_SSUMATCHTYPE_NAME:
case DNS_SSUMATCHTYPE_SELF:
case DNS_SSUMATCHTYPE_SELFSUB:
continue;
continue;
} else {
continue;
}
break;
case DNS_SSUMATCHTYPE_SELFMS:
continue;
break;
case DNS_SSUMATCHTYPE_TCPSELF:
continue;
break;
}
case DNS_SSUMATCHTYPE_NAME:
continue;
break;
continue;
break;
continue;
break;
case DNS_SSUMATCHTYPE_SELF:
continue;
break;
case DNS_SSUMATCHTYPE_SELFSUB:
continue;
break;
if (result != ISC_R_SUCCESS)
continue;
continue;
break;
continue;
break;
case DNS_SSUMATCHTYPE_SELFMS:
continue;
break;
continue;
continue;
break;
continue;
continue;
break;
case DNS_SSUMATCHTYPE_TCPSELF:
continue;
} else {
continue;
}
continue;
break;
continue;
} else {
continue;
}
continue;
break;
continue;
break;
case DNS_SSUMATCHTYPE_DLZ:
continue;
break;
}
/*
* If this is a DLZ rule, then the DLZ ssu
* checks will have already checked
* the type.
*/
!isusertype(type))
continue;
} else {
break;
}
continue;
}
}
return (ISC_FALSE);
}
}
}
unsigned int
}
}
unsigned int
}
}
}
/*
* Create a specialised SSU table that points at an external DLZ database
*/
{
if (result != ISC_R_SUCCESS)
return (result);
return (ISC_R_NOMEMORY);
}
return (ISC_R_SUCCESS);
}