3 # A perl script that will enable or disable
4 # AFS login on a machine, depending on the
5 # first argument to the script.
7 # openafs-tools, Version 1.2.2
9 # Copyright 2001, International Business Machines Corporation and others.
10 # All Rights Reserved.
12 # This software has been released under the terms of the IBM Public
13 # License. For details, see the LICENSE file in the top-level source
14 # directory or online at http://www.openafs.org/dl/license10.html
17 open( LOGIN, "</etc/pam.d/login");
21 open( LOGIN, ">/etc/pam.d/login");
23 if( $ARGV[0] eq "enable" ) {
27 foreach $line (@login) {
28 @splitline = split( /\s+/, $line);
29 # only enable if: it's directly before the pwdb line (without the "shadow nullock",
30 # it hasn't been enabled yet in this script
31 if( $splitline[2] eq "/lib/security/pam_pwdb.so" && $splitline[3] eq "" && $enabled == 0 ) {
32 print LOGIN "auth\t sufficient\t/lib/security/pam_afs.so try_first_pass ignore_root\n";
35 # If you encounter the line, turn enabled on
36 if( $splitline[2] eq "/lib/scurity/pam_afs.so" ) {
44 foreach $line (@login) {
45 @splitline = split( /\s+/, $line);
46 if( $splitline[2] ne "/lib/security/pam_afs.so" ) {