### ### Copyright 2000-2007 University of Illinois Board of Trustees ### All rights reserved. ### ### AIX.pm - AIX module for psgconf ### ### Campus Information Technologies and Educational Services ### University of Illinois at Urbana-Champaign ### package PSGConf::Control::AIX; use strict; use PSGConf::Action::ModifyFile; use PSGConf::Data::String; use PSGConf::Data::List; ############################################################################### ### PSGConf::Action::ModifyFile plugin for /etc/security/login.cfg ############################################################################### sub _modify_etc_security_login_cfg { my ($action, $infh, $fh, $psgconf) = @_; my ($line, $in_default); while ($line = <$infh>) { if ($line =~ m/^default:/) { $in_default = 1; } elsif ($in_default) { next if ($line =~ m/^\s*herald\s*=/); if ($line =~ m/^\s*$/) { print $fh "\therald = \"" . $psgconf->data_obj('console_login_prompt')->get() . "\"\n"; $in_default = 0; } } print $fh $line; } return 1; } ############################################################################### ### policy methods ############################################################################### sub _policy_expand_tokens { my ($self, $psgconf) = @_; return if (!defined $psgconf->data_obj('console_login_prompt')->get()); $psgconf->data_obj('console_login_prompt')->gsub( '%h', $psgconf->data_obj('hostname')->get() ); } ############################################################################### ### decide() method ############################################################################### sub decide { my ($self, $psgconf) = @_; return if (!defined $psgconf->data_obj('console_login_prompt')->get()); $psgconf->register_actions( PSGConf::Action::ModifyFile->new( 'name' => '/etc/security/login.cfg', 'modify_func' => \&_modify_etc_security_login_cfg, 'gid' => (getgrnam('security'))[2], 'mode' => 0640 ) ); } ############################################################################### ### Constructor ############################################################################### sub new { my ($class, $psgconf) = @_; my ($self); $self = {}; bless($self, $class); $self->{name} = 'AIX'; $psgconf->register_data( 'console_login_prompt' => PSGConf::Data::String->new(), 'refresh_daemons' => PSGConf::Data::List->new() ); $psgconf->register_policy($self, login_prompt_expand_tokens => '_policy_expand_tokens' ); return $self; } ############################################################################### ### documentation ############################################################################### 1; __END__ =head1 NAME PSGConf::Control::AIX - psgconf control class for AIX-specific files =head1 SYNOPSIS In F: Control PSGConf::Control::AIX =head1 DESCRIPTION The B module provides a B control object for configuring certain AIX-specific files. 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 represents the contents of the system's console login prompt. =item I A B object that lists all the daemons that can be used with the F command. =back The constructor also registers the following policy methods: =over 4 =item I If the I object is set, replaces the string "%h" in the object's value with the value of the I object (provided by the B module). =back =item decide() If the I object is set, it registers a B action to modify the "herald" attribute in F. =back =head1 SEE ALSO L L L L L L L =cut