#!/bin/sh # #ident "@(#)i.pam 1.4 99/05/29 SMI" # # Copyright (c) 1998, by Sun Microsystems, Inc. # All rights reserved. # PATH="/usr/bin:/usr/sbin:${PATH}" export PATH trap "rm -f /tmp/$$;exit" 0 1 2 3 13 15 pam_prefix="#SEAM " if [ "$PAM_EDIT" = "1" ] then pam_edit_prefix="" else pam_edit_prefix="$pam_prefix" fi while read src dest do if [ ! -f $dest ] ; then touch $dest fi # find each line in the existing file whose # first four fields does not exist in the new file rm -f /tmp/$$ cat $src | (while read e1 e2 e3 e4 e5 do # skip comments if [ `expr "$e1" : '^[ ]*#'` = 1 ] ; then continue; fi # skip blank lines if [ "$e1" = "" ] ; then continue; fi # See if the entry exists with or without the prefix. grep \ "^$pam_prefix[ ]*$e1[ ][ ]*$e2[ ][ ]*$e3[ ][ ]*$e4[ ]" \ $dest >/dev/null 2>&1 if [ $? = 0 ] ; then continue fi grep \ "^[ ]*$e1[ ][ ]*$e2[ ][ ]*$e3[ ][ ]*$e4[ ]" \ $dest >/dev/null 2>&1 if [ $? = 0 ] ; then continue fi # Doesn't exist, enter into pam.conf echo "${pam_edit_prefix}$e1 $e2 $e3 $e4 $e5" >> /tmp/$$ done) if [ -f /tmp/$$ ] ; then cat /tmp/$$ >> $dest fi rm -f /tmp/$$ done exit 0