check.c revision e608c9829f664274d86ff1451224f877f5330b39
/*
* Copyright (C) 2001 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.
*/
/* $Id: check.c,v 1.9 2001/03/09 19:07:30 bwelling Exp $ */
#include <config.h>
#include <stdlib.h>
#include <string.h>
static isc_result_t
"no matching 'forwarders' statement");
return (ISC_R_FAILURE);
}
return (ISC_R_SUCCESS);
}
#define MASTERZONE 1
#define SLAVEZONE 2
#define STUBZONE 4
#define HINTZONE 8
#define FORWARDZONE 16
typedef struct {
const char *name;
int allowed;
} optionstable;
static isc_result_t
const char *zname;
const char *typestr;
unsigned int ztype;
unsigned int i;
static optionstable options[] = {
{ "sig-validity-interval", MASTERZONE },
{ "allow-update", MASTERZONE },
{ "allow-update-forwarding", SLAVEZONE },
{ "update-policy", MASTERZONE },
};
static optionstable dialups[] = {
{ "notify-passive", SLAVEZONE },
};
"zone '%s': type not present", zname);
return (ISC_R_FAILURE);
}
ztype = MASTERZONE;
ztype = FORWARDZONE;
else {
"zone '%s': invalid type %s",
return (ISC_R_FAILURE);
}
/*
* Look for an already existing zone.
*/
if (tresult == ISC_R_EXISTS) {
"zone '%s': already exists ", zname);
} else if (tresult != ISC_R_SUCCESS)
return (tresult);
/*
* Look for inappropriate options for the given zone type.
*/
{
"option '%s' is not allowed in '%s' "
"zone '%s'",
}
}
/*
* Slave & stub zones must have a "masters" field.
*/
"zone '%s': missing 'masters' entry",
zname);
}
}
/*
* Master zones can't have both "allow-update" and "update-policy".
*/
if (ztype == MASTERZONE) {
"zone '%s': 'allow-update' is ignored "
"when 'update-policy' is present",
zname);
}
}
/*
* Check the excessively complicated "dialup" option.
*/
for (i = 0;
i++)
{
continue;
"dialup type '%s' is not "
"allowed in '%s' "
"zone '%s'",
}
break;
}
"invalid dialup type '%s' in zone "
}
}
}
/*
* Check that forwarding is reasonable.
*/
return (result);
}
static isc_result_t
{
/*
* Check that all zone statements are syntactically correct and
* there are no duplicate zones.
*/
if (tresult != ISC_R_SUCCESS)
return (ISC_R_NOMEMORY);
{
}
/*
* Check that all key statements are syntactically correct and
* there are no duplicate keys.
*/
if (tresult != ISC_R_SUCCESS)
return (ISC_R_NOMEMORY);
{
if (tresult == ISC_R_EXISTS) {
"key '%s': already exists ", keyname);
} else if (tresult != ISC_R_SUCCESS) {
return (tresult);
}
"key '%s' must have both 'secret' and "
"algorithm defined",
keyname);
}
}
/*
* Check that forwarding is reasonable.
*/
} else {
}
return (result);
}
!= ISC_R_SUCCESS)
} else {
"when using 'view' statements, "
"all zones must be in views");
}
"when using 'view' statements, "
"all server statements must be in views");
}
}
{
mctx) != ISC_R_SUCCESS)
}
if (tresult == ISC_R_SUCCESS) {
"'cache-file' cannot be a global "
"option if views are present");
}
}
/*
* Check that max-cache-size does not have the illegal value
* 'default'.
*/
if (tresult == ISC_R_SUCCESS &&
{
"'max-cache-size' cannot have the "
"value 'default'");
}
}
return (result);
}