/*****************************************************************
**
** @(#) zone.c (c) Mar 2005 Holger Zuleger hznet.de
**
** Copyright (c) Mar 2005, Holger Zuleger HZnet. All rights reserved.
**
** This software is open source.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** Redistributions of source code must retain the above copyright notice,
** this list of conditions and the following disclaimer.
**
** Redistributions in binary form must reproduce the above copyright notice,
** this list of conditions and the following disclaimer in the documentation
**
** Neither the name of Holger Zuleger HZnet nor the names of its contributors may
** be used to endorse or promote products derived from this software without
** specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
** POSSIBILITY OF SUCH DAMAGE.
**
*****************************************************************/
# include <stdio.h>
# include <string.h>
# include <stdlib.h>
# include <dirent.h>
# include <assert.h>
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
# include "config_zkt.h"
# include "debug.h"
# include "domaincmp.h"
# include "misc.h"
# include "zconf.h"
# include "dki.h"
#define extern
# include "zone.h"
#undef extern
/*****************************************************************
** private (static) function declaration and definition
*****************************************************************/
/*****************************************************************
** zone_alloc ()
*****************************************************************/
{
{
return zp;
}
"zone_alloc: Out of memory");
return NULL;
}
/*****************************************************************
** zone_cmp () return <0 | 0 | >0
*****************************************************************/
{
if ( a == NULL ) return -1;
if ( b == NULL ) return 1;
}
/*****************************************************************
** public function definition
*****************************************************************/
/*****************************************************************
** zone_free ()
*****************************************************************/
{
#if 0
/* TODO: actually there are some problems freeing the config :-( */
#endif
}
/*****************************************************************
** zone_freelist ()
*****************************************************************/
{
while ( curr )
{
}
if ( *listp )
}
/*****************************************************************
** zone_new ()
** allocate memory for new zone structure and initialize it
*****************************************************************/
zone_t *zone_new (zone_t **zp, const char *zone, const char *dir, const char *file, const char *signed_ext, const zconf_t *cp)
{
dir = ".";
else
{ /* check if file contains a path */
const char *p;
{
file = p+1;
}
}
{
char *p;
/* check if file ends with ".signed" ? */
{
*p = '\0';
}
else
{
}
}
}
/*****************************************************************
** zone_readdir ()
*****************************************************************/
int zone_readdir (const char *dir, const char *zone, const char *zfile, zone_t **listp, const zconf_t *conf, int dyn_zone)
{
char *p;
{
zone++;
else
}
return 0;
dbg_val4 ("zone_readdir: (dir: \"%s\", zone: \"%s\", zfile: \"%s\", zp, cp, dyn_zone = %d)\n",
if ( dyn_zone )
signed_ext = ".dsigned";
{
}
else
{
/* do not free localconf, because a ptr to it will be added to the zone by zone_new() */
}
{
}
else
{
else
}
{
dbg_val0("no!\n");
return 0; /* ... not a secure zone ! */
}
dbg_val0("yes!\n");
return 1;
}
/*****************************************************************
** zone_geterrstr ()
** return error string
*****************************************************************/
const char *zone_geterrstr ()
{
return zone_estr;
}
/*****************************************************************
** zone_add ()
*****************************************************************/
{
return NULL;
return *list;
{
}
else /* add node at end or between two nodes */
return new;
}
/*****************************************************************
** zone_search ()
*****************************************************************/
{
return NULL;
return list;
}
/*****************************************************************
** zone_print ()
*****************************************************************/
{
if ( !z )
return 0;
{
}
return 1;
}