timedb.c revision 499b34cea04a46823d003d4c0520c8b03e8513cb
/*
* Copyright (C) 2000, 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: timedb.c,v 1.7 2001/01/09 21:46:30 bwelling Exp $ */
/*
* A simple database driver that enables the server to return the
* current time in a DNS record.
*/
#include <config.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
#include "timedb.h"
/*
* This database operates on relative names.
*
* "time" and "@" return the time in a TXT record.
* "clock" is a CNAME to "time"
* "current" is a DNAME to "@" (try time.current.time)
*/
static isc_result_t
{
char buf[100];
int n;
/*
* Call ctime to create the string, put it in quotes, and
* remove the trailing newline.
*/
if (n < 0)
return (ISC_R_FAILURE);
if (result != ISC_R_SUCCESS)
return (ISC_R_FAILURE);
if (result != ISC_R_SUCCESS)
return (ISC_R_FAILURE);
if (result != ISC_R_SUCCESS)
return (ISC_R_FAILURE);
} else
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
}
/*
* lookup() does not return SOA or NS records, so authority() must be defined.
*/
static isc_result_t
if (result != ISC_R_SUCCESS)
return (ISC_R_FAILURE);
if (result != ISC_R_SUCCESS)
return (ISC_R_FAILURE);
if (result != ISC_R_SUCCESS)
return (ISC_R_FAILURE);
return (ISC_R_SUCCESS);
}
/*
* This zone does not support zone transfer, so allnodes() is NULL. There
* is no database specific data, so create() and destroy() are NULL.
*/
static dns_sdbmethods_t timedb_methods = {
NULL, /* allnodes */
NULL, /* create */
NULL /* destroy */
};
/*
* Wrapper around dns_sdb_register().
*/
timedb_init(void) {
unsigned int flags;
}
/*
* Wrapper around dns_sdb_unregister().
*/
void
timedb_clear(void) {
}