/*****************************************************************
**
** @(#) nscomm.c (c) 2005 - 2009 Holger Zuleger hznet.de
**
** Copyright (c) 2005 - 2009, 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>
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "config_zkt.h"
#include "zconf.h"
#define extern
#include "nscomm.h"
#undef extern
/*****************************************************************
** dyn_update_freeze ()
*****************************************************************/
{
char *action;
if ( freeze )
action = "freeze";
else
action = "thaw";
if ( z->view )
else
if ( z->view )
else
*str = '\0';
if ( z->noexec == 0 )
{
return -1;
}
return 0;
}
/*****************************************************************
** distribute and reload a zone via "distribute_command"
** what is
** 1 for zone distribution and relaod
** 2 for key distribution (used by dynamic zoes)
*****************************************************************/
{
char *view;
return 0;
{
char *mesg;
if ( getuid () == 0 )
mesg = "\tDistribution command %s not run as root\n";
else
mesg = "\tDistribution command %s not run due to strange file mode settings\n";
lg_mesg (LG_ERROR, "exec of distribution command %s disabled due to security reasons", zp->conf->dist_cmd);
return -1;
}
{
}
else
if ( what == 2 )
{
*str = '\0';
{
return -2;
verbmesg (2, zp->conf, "\t %s distribute return: \"%s\"\n", zp->conf->dist_cmd, str_chop (str, '\n'));
}
return 0;
}
snprintf (cmdline, sizeof (cmdline), "%s distribute %s %s %s", zp->conf->dist_cmd, zp->zone, path, view);
*str = '\0';
{
return -2;
verbmesg (2, zp->conf, "\t %s distribute return: \"%s\"\n", zp->conf->dist_cmd, str_chop (str, '\n'));
}
snprintf (cmdline, sizeof (cmdline), "%s reload %s %s %s", zp->conf->dist_cmd, zp->zone, path, view);
*str = '\0';
{
return -2;
}
return 0;
}
/*****************************************************************
** reload a zone via "rndc"
*****************************************************************/
{
if ( z->view )
else
if ( z->view )
else
*str = '\0';
if ( z->noexec == 0 )
{
return -1;
}
return 0;
}