zoneconf.c revision 2bd70b68227f7141ba6b4d813cf84f94e68c1809
/*
* Copyright (C) 1999, 2000 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: zoneconf.c,v 1.71 2000/11/18 02:54:22 gson Exp $ */
#include <config.h>
#include <dns/zoneconf.h>
/*
* These are BIND9 server defaults, not necessarily identical to the
* library defaults defined in zone.c.
*/
#define RETERR(x) do { \
isc_result_t _r = (x); \
if (_r != ISC_R_SUCCESS) \
return (_r); \
} while (0)
/*
* Convenience function for configuring a single zone ACL.
*/
static isc_result_t
dns_c_ipmatchlist_t **),
, dns_c_ipmatchlist_t **),
dns_c_ipmatchlist_t **),
void (*clearzacl)(dns_zone_t *))
{
}
}
if (result == ISC_R_SUCCESS) {
if (result != ISC_R_SUCCESS)
return (result);
return (ISC_R_SUCCESS);
} else if (result == ISC_R_NOTFOUND) {
return (ISC_R_SUCCESS);
} else {
return (result);
}
}
/*
* Conver a config file zone type into a server zone type.
*/
static dns_zonetype_t
switch (cztype) {
case dns_c_zone_master:
return dns_zone_master;
case dns_c_zone_slave:
return dns_zone_slave;
case dns_c_zone_stub:
return dns_zone_stub;
default:
/*
* Hint and forward zones are not really zones;
* they should never get this far.
*/
INSIST(0);
return (dns_zone_none); /*NOTREACHED*/
}
}
/*
* Helper function for strtoargv(). Pardon the gratuitous recursion.
*/
static isc_result_t
char ***argvp, unsigned int n)
{
/* Discard leading whitespace. */
while (*s == ' ' || *s == '\t')
s++;
if (*s == '\0') {
/* We have reached the end of the string. */
*argcp = n;
return (ISC_R_NOMEMORY);
} else {
char *p = s;
while (*p != ' ' && *p != '\t' && *p != '\0')
p++;
if (*p != '\0')
*p++ = '\0';
if (result != ISC_R_SUCCESS)
return (result);
(*argvp)[n] = s;
}
return (ISC_R_SUCCESS);
}
/*
* Tokenize the string "s" into whitespace-separated words,
* return the number of words in '*argcp' and an array
* of pointers to the words in '*argvp'. The caller
* must free the array using isc_mem_put(). The string
* is modified in-place.
*/
static isc_result_t
}
{
#ifdef notyet
#endif
char *cpval;
unsigned int dbargc;
char **dbargv;
static char default_dbtype[] = "rbt";
/*
* Configure values common to all zone types.
*/
#ifdef notyet
if (result != ISC_R_SUCCESS)
#endif
if (result != ISC_R_SUCCESS)
/*
* ANSI C is strange here. There is no logical reason why (char **)
* cannot be promoted automatically to (const char * const *) by the
* compiler w/o generating a warning.
*/
if (result != ISC_R_SUCCESS)
#ifdef notyet
if (result == ISC_R_SUCCESS)
else
#endif
#ifndef NOMINUM_PUBLIC
#endif /* NOMINUM_PUBLIC */
/*
* XXXAG This probably does not make sense for stubs.
*/
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS)
if (statistics)
else
#ifndef NOMINUM_PUBLIC
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS)
uintval = 0;
}
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS)
}
#endif /* NOMINUM_PUBLIC */
/*
* Configure master functionality. This applies
* to primary masters (type "master") and slaves
* acting as masters (type "slave"), but not to stubs.
*/
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS)
if (result == ISC_R_SUCCESS) {
if (result != ISC_R_SUCCESS)
return (result);
} else
&uintval);
if (result != ISC_R_SUCCESS)
&uintval);
if (result != ISC_R_SUCCESS)
&uintval);
if (result != ISC_R_SUCCESS)
&uintval);
if (result != ISC_R_SUCCESS)
}
/*
* Configure update-related options. These apply to
* primary masters only.
*/
if (result == ISC_R_SUCCESS)
&uintval);
if (result != ISC_R_SUCCESS)
&uintval);
if (result != ISC_R_SUCCESS)
}
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS)
/*
* Configure slave functionality.
*/
case dns_c_zone_slave:
case dns_c_zone_stub:
if (result == ISC_R_SUCCESS)
#ifndef NOMINUM_PUBLIC
#else /* NOMINUM_PUBLIC */
#endif /* NOMINUM_PUBLIC */
else
if (result != ISC_R_SUCCESS)
&uintval);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS)
&uintval);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS)
break;
default:
break;
}
return (ISC_R_SUCCESS);
}
const char *cfilename;
const char *zfilename;
return (ISC_FALSE);
return (ISC_FALSE);
return (ISC_TRUE);
}
if (result != ISC_R_SUCCESS)
val = 10;
if (result != ISC_R_SUCCESS)
val = 2;
return (ISC_R_SUCCESS);
}