Home | History | Annotate | Download | only in SUNWtsr
      1 #!/bin/sh
      2 #
      3 # CDDL HEADER START
      4 #
      5 # The contents of this file are subject to the terms of the
      6 # Common Development and Distribution License (the "License").
      7 # You may not use this file except in compliance with the License.
      8 #
      9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
     10 # or http://www.opensolaris.org/os/licensing.
     11 # See the License for the specific language governing permissions
     12 # and limitations under the License.
     13 #
     14 # When distributing Covered Code, include this CDDL HEADER in each
     15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     16 # If applicable, add the following below this CDDL HEADER, with the
     17 # fields enclosed by brackets "[]" replaced with your own identifying
     18 # information: Portions Copyright [yyyy] [name of copyright owner]
     19 #
     20 # CDDL HEADER END
     21 #
     22 #
     23 # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
     24 # Use is subject to license terms.
     25 #
     26 #ident	"%Z%%M%	%I%	%E% SMI"
     27 #
     28 
     29 # Remove the TX tsoljds-tstripe s10u4 workaround in pam.conf if found.
     30 # (This was added in previous SUNWtsr postinstall and is not needed now.)
     31 # Use a new stack that will be correct whether TX is enabled or not.
     32 
     33 PAM_DEST=$BASEDIR/etc/pam.conf
     34 TMPFILE=/tmp/pam_conf.$$
     35 
     36 if [ ! -f ${PAM_DEST} ]; then
     37 	exit 0
     38 fi
     39 
     40 JDSLINES=`grep '^tsoljds-tstripe.*account' $PAM_DEST |wc -l`
     41 if [ $JDSLINES -ne 2 ]; then
     42 	exit 0
     43 fi
     44 
     45 grep '^tsoljds-tstripe.*account.*pam_roles' $PAM_DEST > /dev/null 2>&1
     46 if [ $? -ne 0 ]; then
     47 	exit 0
     48 fi
     49 
     50 grep '^tsoljds-tstripe.*account.*pam_tsol_account' $PAM_DEST > /dev/null 2>&1
     51 if [ $? -ne 0 ]; then
     52 	exit 0
     53 fi
     54 
     55 # First remove old entries
     56 grep -v '^tsoljds-tstripe.*account' $PAM_DEST > $TMPFILE
     57 
     58 # Append correct new stack
     59 # No comments or blank lines allowed in entries below.
     60 cat >> $TMPFILE << EOF
     61 tsoljds-tstripe		account		requisite	pam_roles.so.1
     62 tsoljds-tstripe		account		required	pam_unix_account.so.1
     63 EOF
     64 
     65 echo "$0: $PAM_DEST "tsoljds-tstripe" entries corrected"
     66 
     67 cp $TMPFILE $PAM_DEST
     68 rm -f $TMPFILE
     69 
     70 exit 0
     71