builtin.c revision 70e5a7403f0e0a3bd292b8287c5fed5772c15270
/*
* Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 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.
*/
/* $Id: builtin.c,v 1.12 2007/06/19 23:46:59 tbox Exp $ */
/*! \file
* \brief
* The built-in "version", "hostname", "id", "authors" and "empty" databases.
*/
#include <config.h>
#include <string.h>
#include <stdio.h>
/*
* We can't use function pointers as the db_data directly
* because ANSI C does not guarantee that function pointers
* can safely be cast to void pointers and back.
*/
struct builtin {
char *server;
char *contact;
};
static dns_sdbimplementation_t *builtin_impl;
static isc_result_t
{
else
return (ISC_R_NOTFOUND);
}
static isc_result_t
unsigned char buf[256];
if (len > 255)
}
static isc_result_t
if (ns_g_server->version_set) {
return (ISC_R_SUCCESS);
else
} else {
}
}
static isc_result_t
if (ns_g_server->hostname_set) {
return (ISC_R_SUCCESS);
else
} else {
char buf[256];
if (result != ISC_R_SUCCESS)
return (result);
}
}
static isc_result_t
const char **p;
static const char *authors[] = {
"Mark Andrews",
"James Brister",
"Ben Cottrell",
"Michael Graff",
"Andreas Gustafsson",
"Bob Halley",
"David Lawrence",
"Danny Mayer",
"Damien Neil",
"Matt Nelson",
"Michael Sawyer",
"Brian Wellington",
};
/*
* If a version string is specified, disable the authors.bind zone.
*/
if (ns_g_server->version_set)
return (ISC_R_SUCCESS);
if (result != ISC_R_SUCCESS)
return (result);
}
return (ISC_R_SUCCESS);
}
static isc_result_t
if (ns_g_server->server_usehostname) {
char buf[256];
if (result != ISC_R_SUCCESS)
return (result);
}
return (ISC_R_SUCCESS);
else
}
static isc_result_t
return (ISC_R_SUCCESS);
}
static isc_result_t
const char *contact = "hostmaster";
const char *server = "@";
if (b == &empty_builtin) {
server = ".";
contact = ".";
} else {
}
if (result != ISC_R_SUCCESS)
return (ISC_R_FAILURE);
if (result != ISC_R_SUCCESS)
return (ISC_R_FAILURE);
return (ISC_R_SUCCESS);
}
static isc_result_t
void *driverdata, void **dbdata)
{
if (argc != 3)
return (DNS_R_SYNTAX);
} else if (argc != 1)
return (DNS_R_SYNTAX);
*dbdata = &version_builtin;
*dbdata = &hostname_builtin;
*dbdata = &authors_builtin;
*dbdata = &id_builtin;
char *server;
char *contact;
/*
* We don't want built-in zones to fail. Fallback to
* the static configuration if memory allocation fails.
*/
*dbdata = &empty_builtin;
} else {
}
} else
return (ISC_R_NOTIMPLEMENTED);
return (ISC_R_SUCCESS);
}
static void
/*
* Don't free the static versions.
*/
*dbdata == &empty_builtin)
return;
isc_mem_put(ns_g_mctx, b, sizeof (*b));
}
static dns_sdbmethods_t builtin_methods = {
NULL, /* allnodes */
};
ns_builtin_init(void) {
== ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
}
void
ns_builtin_deinit(void) {
}