### ### Copyright 2000-2007 University of Illinois Board of Trustees ### All rights reserved. ### ### Shells.pm - /etc/shell module for psgconf ### ### Campus Information Technologies and Educational Services ### University of Illinois at Urbana-Champaign ### package PSGConf::Control::Shells; use strict; use PSGConf::Action::RunCommand; use PSGConf::Action::GenerateFile::Literal; use PSGConf::Data::List; ############################################################################### ### plugin function for PSGConf::Action::RunCommand ############################################################################### sub _check_login_cfg { my ($self, $psgconf) = @_; my ($shell_list); if (! open(LSSEC, 'lssec -f /etc/security/login.cfg -s usw -a shells |')) { warn "\n\t!!! cannot run lssec: $!\n"; return -1; } $shell_list = ; chomp $shell_list; $shell_list =~ s/usw shells=//; close LSSEC; return 1 if ($shell_list ne join(',', @{$psgconf->data_obj('shells')->get()})); return 0; } ############################################################################### ### decide() method ############################################################################### sub decide { my ($self, $psgconf) = @_; my ($cmd); if ($psgconf->data_obj('platform')->match('aix')) { $cmd = 'chsec -f /etc/security/login.cfg -s usw -a shells=' . join(',', @{$psgconf->data_obj('shells')->get()}); $psgconf->register_actions( PSGConf::Action::RunCommand->new( name => 'Shells in login.cfg', command => $cmd, check_func => \&_check_login_cfg, ) ); } else { $psgconf->register_actions( PSGConf::Action::GenerateFile::Literal->new( name => '/etc/shells', content => join("\n", @{$psgconf->data_obj('shells')->get()}) . "\n", ) ); } } ############################################################################### ### constructor ############################################################################### sub new { my ($class, $psgconf) = @_; my ($self); $self = {}; bless($self, $class); $self->{name} = 'Shells'; $psgconf->register_data( shells => PSGConf::Data::List->new(), ); return $self; } ############################################################################### ### documentation ############################################################################### 1; __END__ =head1 NAME PSGConf::Control::Shells - psgconf control class for generating /etc/shells =head1 SYNOPSIS In F: Control PSGConf::Control::Shells =head1 DESCRIPTION The B module provides a B control object for generating F (or editing F on AIX). 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 containing whose keys are the list of shells to be added to the F or F file. =back =item decide() Registers a B or B object to create F or edit F. =back =head1 SEE ALSO L L L L L L =cut