1# Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC") 2# Copyright (C) 2000, 2001 Internet Software Consortium. 3# 4# Permission to use, copy, modify, and/or distribute this software for any 5# purpose with or without fee is hereby granted, provided that the above 6# copyright notice and this permission notice appear in all copies. 7# 8# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 9# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 10# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 11# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 12# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 13# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 14# PERFORMANCE OF THIS SOFTWARE. 15 16# $Id: lookup.tcl,v 1.10 2007/06/19 23:47:08 tbox Exp $ 17 18# 19# Sample lookup procedure for tcldb 20# 21# This lookup procedure defines zones with identical SOA, NS, and MX 22# records at the apex and a single A record that varies from zone to 23# zone at the name "www". 24# 25# Something like this could be used by a web hosting company to serve 26# a number of domains without needing to create a separate master file 27# for each domain. Instead, all per-zone data (in this case, a single 28# IP address) specified in the named.conf file like this: 29# 30# zone "a.com." { type master; database "tcl 10.0.0.42"; }; 31# zone "b.com." { type master; database "tcl 10.0.0.99"; }; 32# 33# Since the tcldb driver doesn't support zone transfers, there should 34# be at least two identically configured master servers. In the 35# example below, they are assumed to be called ns1.isp.nil and 36# ns2.isp.nil. 37# 38 39proc lookup {zone name} { 40 global dbargs 41 switch -- $name { 42 @ { return [list \ 43 {SOA 86400 "ns1.isp.nil. hostmaster.isp.nil. \ 44 1 3600 1800 1814400 3600"} \ 45 {NS 86400 "ns1.isp.nil."} \ 46 {NS 86400 "ns2.isp.nil."} \ 47 {MX 86400 "10 mail.isp.nil."} ] } 48 www { return [list [list A 3600 $dbargs($zone)] ] } 49 } 50 return NXDOMAIN 51} 52