mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-09 08:02:06 -04:00
Remove outdated perllib integration
The code in conftools/ directory hasn't been touched since 2000. Nobody knows what it does and nobody even knows how to build it or test it. Just remove the whole directory.
This commit is contained in:
parent
069c6c2265
commit
391e743c30
5 changed files with 0 additions and 530 deletions
|
|
@ -1,52 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define CONCAT(a, b) a##b
|
||||
#define DNSCONF_SET_STRING(FIELD) \
|
||||
void CONCAT(DNSConf_set, FIELD)(DNSConf * cfg, const char *arg) { \
|
||||
DBGPRINT("inside DNSConf_set" #FIELD "\n"); \
|
||||
\
|
||||
if (!DNSConf_initctx(cfg)) \
|
||||
return; \
|
||||
\
|
||||
if (arg == NULL) { \
|
||||
DBGPRINT("null pointer\n"); \
|
||||
CONCAT(dns_c_ctx_unset, FIELD)(cfg->confctx); \
|
||||
} else if (*arg == '\0') { \
|
||||
DBGPRINT("empty string\n"); \
|
||||
CONCAT(dns_c_ctx_unset, FIELD)(cfg->confctx); \
|
||||
} else \
|
||||
CONCAT(dns_c_ctx_set, FIELD)(cfg->confctx, arg); \
|
||||
}
|
||||
|
||||
#define DNSCONF_GET_STRING(FIELD) \
|
||||
char *CONCAT(DNSConf_get, FIELD)(DNSConf * cfg) { \
|
||||
char *result = NULL; \
|
||||
isc_result_t tmpres; \
|
||||
\
|
||||
if (cfg == NULL || cfg->confctx == NULL) \
|
||||
return (NULL); \
|
||||
\
|
||||
tmpres = CONCAT(dns_c_ctx_get, FIELD)(cfg->confctx, &result); \
|
||||
if (tmpres == ISC_R_NOTFOUND) \
|
||||
return (NULL); \
|
||||
\
|
||||
return (result); \
|
||||
}
|
||||
|
||||
#define STRING_FIELD_DEFS(FIELD) \
|
||||
DNSCONF_GET_STRING(FIELD) DNSCONF_SET_STRING(FIELD)
|
||||
|
||||
#define INT_FIELD_DEFS(FIELD)
|
||||
|
|
@ -1,335 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
%module DNSConf
|
||||
|
||||
%{
|
||||
|
||||
#include <stdio.h>
|
||||
#include <isc/result.h>
|
||||
#include <dns/confctx.h>
|
||||
#include <dns/log.h>
|
||||
|
||||
#include "DNSConf-macros.h"
|
||||
|
||||
#define DEBUG_PRINT 1
|
||||
|
||||
#if DEBUG_PRINT
|
||||
#define DBGPRINT xprintf
|
||||
#else
|
||||
#define DBGPRINT ((void) 0)
|
||||
#endif
|
||||
|
||||
static struct {
|
||||
isc_mem_t *mem;
|
||||
isc_log_t *log;
|
||||
isc_logconfig_t *logcfg;
|
||||
int count;
|
||||
} ctx ;
|
||||
|
||||
typedef struct DNSConf {
|
||||
dns_c_ctx_t *confctx;
|
||||
} DNSConf;
|
||||
|
||||
|
||||
|
||||
int xprintf(const char *fmt, ...) {
|
||||
va_list ap ;
|
||||
|
||||
va_start (ap, fmt) ;
|
||||
vfprintf (stderr, fmt, ap) ;
|
||||
va_end (ap) ;
|
||||
}
|
||||
|
||||
|
||||
int ctx_init(void) {
|
||||
int returnval = 0;
|
||||
|
||||
DBGPRINT("Starting ctx_init()\n");
|
||||
|
||||
if (ctx.mem != NULL) {
|
||||
returnval = 1;
|
||||
goto done;
|
||||
}
|
||||
|
||||
isc_mem_create(&ctx.mem);
|
||||
|
||||
isc_log_create(ctx.mem, &ctx.log, &ctx.logcfg);
|
||||
|
||||
isc_log_setcontext(ctx.log);
|
||||
dns_log_init(ctx.log);
|
||||
dns_log_setcontext(ctx.log);
|
||||
|
||||
if (isc_log_usechannel(ctx.logcfg, "default_stderr", NULL, NULL) !=
|
||||
ISC_R_SUCCESS)
|
||||
goto done;
|
||||
|
||||
dns_lctx = ctx.log;
|
||||
|
||||
ctx.count = 0;
|
||||
|
||||
returnval = 1;
|
||||
|
||||
done:
|
||||
DBGPRINT("Finished ctx_init()\n");
|
||||
|
||||
return (returnval);
|
||||
}
|
||||
|
||||
void *ctx_destroy(void) {
|
||||
DBGPRINT("starting ctx_destroy()\n");
|
||||
|
||||
if (ctx.count == 0) {
|
||||
DBGPRINT("count == 0\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (--ctx.count > 0) {
|
||||
DBGPRINT("count > 0\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DBGPRINT("destroying ctx\n");
|
||||
|
||||
dns_lctx = NULL;
|
||||
isc_log_destroy(&ctx.log);
|
||||
isc_mem_destroy(&ctx.mem);
|
||||
|
||||
DBGPRINT("finished ctx_destroy\n");
|
||||
}
|
||||
|
||||
|
||||
DNSConf *new_DNSConf() {
|
||||
DNSConf *ptr = malloc(sizeof (DNSConf));
|
||||
|
||||
DBGPRINT("inside new_DNSConf\n");
|
||||
|
||||
ptr->confctx = NULL;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void clear_DNSConf(DNSConf *ctx) {
|
||||
if (ctx->confctx != NULL) {
|
||||
DBGPRINT("deleting config context\n");
|
||||
dns_c_ctx_delete(&ctx->confctx);
|
||||
ctx_destroy();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void delete_DNSConf(DNSConf *ctx) {
|
||||
DBGPRINT("inside delete_DNSConf\n");
|
||||
|
||||
clear_DNSConf(ctx);
|
||||
|
||||
free(ctx);
|
||||
}
|
||||
|
||||
int DNSConf_parse(DNSConf *conf, const char *filename) {
|
||||
|
||||
DBGPRINT("inside parse\n");
|
||||
|
||||
if (!ctx_init())
|
||||
return;
|
||||
|
||||
clear_DNSConf(conf);
|
||||
|
||||
if (dns_c_parse_namedconf(filename, ctx.mem, &conf->confctx, NULL)
|
||||
== ISC_R_SUCCESS) {
|
||||
ctx.count++;
|
||||
|
||||
DBGPRINT("count now: %d\n", ctx.count);
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int DNSConf_initctx(DNSConf *cfg) {
|
||||
if (cfg == NULL)
|
||||
return 0;
|
||||
|
||||
if (cfg->confctx != NULL)
|
||||
return 1;
|
||||
|
||||
if (!ctx_init())
|
||||
return 0;
|
||||
|
||||
if (dns_c_ctx_new(ctx.mem, &cfg->confctx) != ISC_R_SUCCESS)
|
||||
return 0;
|
||||
|
||||
ctx.count++;
|
||||
|
||||
DBGPRINT("count is now: %d\n", ctx.count);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void DNSConf_print(DNSConf *ptr, FILE *outfile) {
|
||||
|
||||
DBGPRINT("inside print\n");
|
||||
|
||||
if (ptr == NULL || ptr->confctx == NULL)
|
||||
return;
|
||||
|
||||
dns_c_ctx_print(outfile, 0, ptr->confctx);
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
void DNSConf_setdirectory(DNSConf *cfg, const char *directory) {
|
||||
|
||||
DBGPRINT("inside DNSConf_setdirectory\n");
|
||||
|
||||
if (!DNSConf_initctx(cfg))
|
||||
return;
|
||||
|
||||
if (directory == NULL) {
|
||||
DBGPRINT("null pointer\n");
|
||||
dns_c_ctx_unsetdirectory(cfg->confctx);
|
||||
} else if (*directory == '\0') {
|
||||
DBGPRINT("empty string\n");
|
||||
dns_c_ctx_unsetdirectory(cfg->confctx);
|
||||
} else
|
||||
dns_c_ctx_setdirectory(cfg->confctx, directory);
|
||||
}
|
||||
|
||||
char *DNSConf_getdirectory(DNSConf *cfg) {
|
||||
char *dir = NULL;
|
||||
isc_result_t tmpres;
|
||||
|
||||
if (cfg == NULL || cfg->confctx == NULL)
|
||||
return NULL;
|
||||
|
||||
tmpres = dns_c_ctx_getdirectory(cfg->confctx, &dir);
|
||||
if (tmpres == ISC_R_NOTFOUND)
|
||||
return NULL;
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
STRING_FIELD_DEFS(directory)
|
||||
STRING_FIELD_DEFS(version)
|
||||
STRING_FIELD_DEFS(dumpfilename)
|
||||
STRING_FIELD_DEFS(pidfilename)
|
||||
STRING_FIELD_DEFS(statsfilename)
|
||||
STRING_FIELD_DEFS(memstatsfilename)
|
||||
STRING_FIELD_DEFS(namedxfer)
|
||||
|
||||
|
||||
|
||||
void DNSConf_settransfersin(DNSConf *cfg, unsigned int *transfersin) {
|
||||
|
||||
DBGPRINT("inside DNSConf_settransfersin %p\n", transfersin);
|
||||
|
||||
if (!DNSConf_initctx(cfg))
|
||||
return;
|
||||
|
||||
if (transfersin == NULL) {
|
||||
DBGPRINT("null pointer\n");
|
||||
dns_c_ctx_unsettransfersin(cfg->confctx);
|
||||
} else
|
||||
dns_c_ctx_settransfersin(cfg->confctx, transfersin);
|
||||
}
|
||||
|
||||
unsigned int DNSConf_gettransfersin(DNSConf *cfg) {
|
||||
unsigned int result;
|
||||
isc_result_t tmpres;
|
||||
|
||||
if (cfg == NULL || cfg->confctx == NULL)
|
||||
return NULL;
|
||||
|
||||
tmpres = dns_c_ctx_gettransfersin(cfg->confctx, &result);
|
||||
if (tmpres == ISC_R_NOTFOUND)
|
||||
return NULL;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
INT_FIELD_DEFS(transfersin)
|
||||
INT_FIELD_DEFS(transfersperns)
|
||||
INT_FIELD_DEFS(transfersout)
|
||||
INT_FIELD_DEFS(maxlogsizeixfr)
|
||||
INT_FIELD_DEFS(cleaninterval)
|
||||
INT_FIELD_DEFS(interfaceinterval)
|
||||
INT_FIELD_DEFS(statsinterval)
|
||||
INT_FIELD_DEFS(heartbeatinterval)
|
||||
INT_FIELD_DEFS(maxtransfertimein)
|
||||
INT_FIELD_DEFS(maxtransfertimeout)
|
||||
INT_FIELD_DEFS(maxtransferidlein)
|
||||
INT_FIELD_DEFS(maxtransferidleout)
|
||||
INT_FIELD_DEFS(lamettl)
|
||||
INT_FIELD_DEFS(tcpclients)
|
||||
INT_FIELD_DEFS(recursiveclients)
|
||||
INT_FIELD_DEFS(minroots)
|
||||
INT_FIELD_DEFS(serialqueries)
|
||||
INT_FIELD_DEFS(sigvalidityinterval)
|
||||
INT_FIELD_DEFS(maxcachesize)
|
||||
INT_FIELD_DEFS(maxncachettl)
|
||||
INT_FIELD_DEFS(maxcachettl)
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
%}
|
||||
|
||||
|
||||
%typemap(perl5, out) char * {
|
||||
$target = sv_newmortal();
|
||||
sv_setpv($target,$source);
|
||||
argvi++;
|
||||
}
|
||||
|
||||
%typemap(perl5, out) int, short, long {
|
||||
$target = sv_newmortal();
|
||||
sv_setiv($target,(IV)$source);
|
||||
argvi++;
|
||||
}
|
||||
|
||||
%typemap(perl5,in) FILE * {
|
||||
$target = IoIFP(sv_2io($source));
|
||||
}
|
||||
|
||||
|
||||
%typemap(perl5, in) unsigned int {
|
||||
static unsigned int val;
|
||||
val = $target;
|
||||
$source = &val;
|
||||
}
|
||||
|
||||
|
||||
struct DNSConf {
|
||||
%addmethods {
|
||||
DNSConf();
|
||||
~DNSConf();
|
||||
void print(FILE *outfile);
|
||||
void parse(const char *filename);
|
||||
|
||||
void setdirectory(const char *arg);
|
||||
char *getdirectory();
|
||||
|
||||
void settransfersin(unsigned int arg);
|
||||
unsigned int gettransfersin();
|
||||
}
|
||||
%readonly
|
||||
dns_c_ctx_t *confctx;
|
||||
};
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
# See the COPYRIGHT file distributed with this work for additional
|
||||
# information regarding copyright ownership.
|
||||
|
||||
use ExtUtils::MakeMaker;
|
||||
|
||||
$ENV{CC} = "gcc";
|
||||
|
||||
WriteMakefile('NAME' => 'DNSConf',
|
||||
'OPTIMIZE' => '-g',
|
||||
'PERLMAINCC' => 'gcc',
|
||||
'LIBS' => [ '-L../../isc -L../../dns -ldns -lisc -lc_r' ],
|
||||
'INC' => '-I../../isc/include -I../../dns/include',
|
||||
'dynamic_lib' => { OTHERLDFLAGS => '-pthread' },
|
||||
'OBJECT' => 'DNSConf_wrap.o');
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
options {
|
||||
# port 8888;
|
||||
directory "/etc/namedb"
|
||||
pid-file "/tmp/named.pid";
|
||||
allow-query { 127.0.0.1; };
|
||||
listen-on port 8888 { any; };
|
||||
};
|
||||
|
||||
controls {
|
||||
inet * port 523 allow { 10/8 ; }; // a bad idea
|
||||
};
|
||||
|
||||
logging {
|
||||
channel "channel" { file "/dev/null"; };
|
||||
category lame-servers { foobar; };
|
||||
};
|
||||
|
||||
zone "." {
|
||||
type hint;
|
||||
file "/etc/namedb/root.cache";
|
||||
};
|
||||
|
||||
#view "default-view" IN {
|
||||
#
|
||||
# zone "." {
|
||||
# type hint;
|
||||
# file "/etc/namedb/root.cache";
|
||||
# };
|
||||
#
|
||||
# zone "0.0.127.in-addr.arpa" {
|
||||
# type primary;
|
||||
# file "/etc/namedb/localhost.rev";
|
||||
# };
|
||||
#
|
||||
# zone "10.in-addr.arpa" {
|
||||
# type primary;
|
||||
# file "/etc/namedb/primary/10";
|
||||
# };
|
||||
#
|
||||
# zone "jab.fr" {
|
||||
# type primary;
|
||||
# file "/etc/namedb/primary/jab.fr";
|
||||
# };
|
||||
#
|
||||
## zone "test-zone.com" {
|
||||
## type primary;
|
||||
## file "/usr/tmp/test-zone.com";
|
||||
## };
|
||||
#};
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
#
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
# See the COPYRIGHT file distributed with this work for additional
|
||||
# information regarding copyright ownership.
|
||||
|
||||
push(@ARGV, "/etc/named.conf") if ! @ARGV;
|
||||
|
||||
use DNSConf;
|
||||
|
||||
##
|
||||
## First get the current named.conf file and print it.
|
||||
##
|
||||
$named = new DNSConf;
|
||||
|
||||
$named->parse($ARGV[0]);
|
||||
|
||||
$dir = $named->getdirectory();
|
||||
|
||||
print "the directory value in $ARGV[0] is: ";
|
||||
if (!defined($dir)) {
|
||||
print "undefined\n";
|
||||
} else {
|
||||
print $dir, "\n";
|
||||
}
|
||||
|
||||
print "\n\nAnd the full file is:\n\n";
|
||||
$named->print(STDOUT);
|
||||
|
||||
|
||||
|
||||
##
|
||||
## Now create out own and fill it up.
|
||||
##
|
||||
|
||||
$anothernamed = new DNSConf;
|
||||
|
||||
$thedir = "/var/tmp";
|
||||
|
||||
print "Created a virgin config structure and added \"$thedir\"\n";
|
||||
print "as the directory\n";
|
||||
|
||||
$anothernamed->setdirectory($thedir);
|
||||
|
||||
$anothernamed->settransfersin(300);
|
||||
|
||||
$str = $anothernamed->getdirectory();
|
||||
print "Pulling that value out again yields: \"", $str, "\"\n";
|
||||
|
||||
print "And the full file contents is: \n\n";
|
||||
$anothernamed->print(STDOUT);
|
||||
|
||||
undef($named);
|
||||
undef($anothernamed);
|
||||
Loading…
Reference in a new issue