### ### Copyright 2000-2007 University of Illinois Board of Trustees ### All rights reserved. ### ### Resolver.pm - DNS resolver configuration module for psgconf ### ### Campus Information Technologies and Educational Services ### University of Illinois at Urbana-Champaign ### package PSGConf::Control::Resolver; use strict; use PSGConf::Action::GenerateFile::resolv_conf; use PSGConf::Data::List; ############################################################################### ### policy method ############################################################################### sub _policy_default_search_list { my ($self, $psgconf) = @_; my (@tmp); if (! $psgconf->data_obj('dns_search')->count()) { @tmp = split(/\./, $psgconf->data_obj('hostname')->get()); while (shift(@tmp) && @tmp > 1) { $psgconf->data_obj('dns_search')->add(join('.', @tmp)); } } } ############################################################################### ### decide() method ############################################################################### sub decide { my ($self, $psgconf) = @_; return if (! $psgconf->data_obj('dns_servers')->count() ); $psgconf->register_actions( PSGConf::Action::GenerateFile::resolv_conf->new( name => '/etc/resolv.conf', description => 'resolver configuration file', dns_search => $psgconf->data_obj('dns_search')->get(), dns_sortlist => $psgconf->data_obj('dns_sortlist')->get(), dns_servers => $psgconf->data_obj('dns_servers')->get() ) ); } ############################################################################### ### constructor ############################################################################### sub new { my ($class, $psgconf) = @_; my ($self); $self = {}; bless($self, $class); $self->{name} = 'Resolver'; $psgconf->register_data( dns_search => PSGConf::Data::List->new(), dns_sortlist => PSGConf::Data::List->new(), dns_servers => PSGConf::Data::List->new() ); $psgconf->register_policy($self, resolver_default_search_list => '_policy_default_search_list' ); return $self; } ############################################################################### ### documentation ############################################################################### 1; __END__ =head1 NAME PSGConf::Control::Resolver - psgconf control class for DNS resolver configuration =head1 SYNOPSIS In F: Control PSGConf::Control::Resolver =head1 DESCRIPTION The B module provides a B control object for configuring DNS lookups. It supports the following methods: =over 4 =item new() The constructor. Its parameter is a reference to the B object. It registers the following data objects: =over 4 =item I A B object that contains an ordered list of domains to try for DNS lookups. =item I A B object that contains an ordered list of network and netmask tuples to put into the DNS sortlist. =item I A B object that contains an ordered list of DNS servers. =back The constructor also registers the following policy method: =over 4 =item I If I is not set, set it to start with the subdomain that the I object is in, and then iterates through all parent domains until the top-level domain. =back =item decide() If I is set, instantiates and registers a B object to create F. =back =head1 SEE ALSO L resolver(5) L L L L =cut