Resolving Bug 222012 to allow the scripts called from yast to recognize the SLES server so the won't modigy the PAM stack.
This commit is contained in:
		| @@ -1,57 +1,65 @@ | |||||||
| #!/bin/bash | #!/bin/bash | ||||||
| # Adding CASA pam entries to pam files. | # Adding CASA pam entries to pam files only on the desktop. | ||||||
| rm -f *.rpmsave | DESKTOP=`grep -i desktop SuSE-release` | ||||||
|  |  | ||||||
| prefix="/etc/pam.d" | if [ "$DESKTOP" != "" ] | ||||||
| for auth_file in "$prefix/login" "$prefix/sshd" "$prefix/xdm" "$prefix/gdm" "$prefix/kdm" | then | ||||||
| do |  | ||||||
| 	if [ -f $auth_file ] |  | ||||||
| 	then |  | ||||||
| 		sed -i '/pam_micasa/d' $auth_file |  | ||||||
|         |         | ||||||
| 		auth_entry=`echo -e "auth\t required\tpam_micasa.so"` |     rm -f *.rpmsave | ||||||
|      |      | ||||||
| 		var1=`grep ^auth.*required.*pam_unix2.so $auth_file` |     prefix="/etc/pam.d" | ||||||
| 		if [ "$var1" != "" ] |     for auth_file in "$prefix/login" "$prefix/sshd" "$prefix/xdm" "$prefix/gdm" "$prefix/kdm" | ||||||
| 		then |     do | ||||||
| 		  sed -i "/^auth.*required.*pam_unix2.so/a$auth_entry" $auth_file | 	    if [ -f $auth_file ] | ||||||
| 		  continue | 	    then | ||||||
| 		fi | 		    sed -i '/pam_micasa/d' $auth_file | ||||||
|      |      | ||||||
| 		var2=`grep ^auth.*include.*common-auth $auth_file` | 		    auth_entry=`echo -e "auth\t required\tpam_micasa.so"` | ||||||
| 		if [ "$var2" != "" ] |  | ||||||
| 		then |  | ||||||
| 		  sed -i "/^auth.*include.*common-auth/a$auth_entry" $auth_file |  | ||||||
| 		  continue |  | ||||||
| 		fi |  | ||||||
|      |      | ||||||
| 		sed -i "0,/^auth/s/^\(auth.*\)/\1\n$auth_entry/" $auth_file  | 		    var1=`grep ^auth.*required.*pam_unix2.so $auth_file` | ||||||
| 	fi | 		    if [ "$var1" != "" ] | ||||||
| done | 		    then | ||||||
|  | 		      sed -i "/^auth.*required.*pam_unix2.so/a$auth_entry" $auth_file | ||||||
|  | 		      continue | ||||||
|  | 		    fi | ||||||
|  |      | ||||||
|  | 		    var2=`grep ^auth.*include.*common-auth $auth_file` | ||||||
|  | 		    if [ "$var2" != "" ] | ||||||
|  | 		    then | ||||||
|  | 		      sed -i "/^auth.*include.*common-auth/a$auth_entry" $auth_file | ||||||
|  | 		      continue | ||||||
|  | 		    fi | ||||||
|  |      | ||||||
|  | 		    sed -i "0,/^auth/s/^\(auth.*\)/\1\n$auth_entry/" $auth_file  | ||||||
|  | 	    fi | ||||||
|  |     done | ||||||
|      |      | ||||||
|      |      | ||||||
| for password_file in "$prefix/passwd" "$prefix/gnome-passwd" |     for password_file in "$prefix/passwd" "$prefix/gnome-passwd" | ||||||
| do |     do | ||||||
| 	if [ -f $password_file ] | 	    if [ -f $password_file ] | ||||||
| 	then | 	    then | ||||||
| 		sed -i '/pam_micasa/d' $password_file | 		    sed -i '/pam_micasa/d' $password_file | ||||||
|      |      | ||||||
| 		passwd_entry=`echo -e "password required\tpam_micasa.so"` | 		    passwd_entry=`echo -e "password required\tpam_micasa.so"` | ||||||
|      |      | ||||||
| 		var1=`grep ^password.*required.*pam_unix2.so $password_file` | 		    var1=`grep ^password.*required.*pam_unix2.so $password_file` | ||||||
| 		if [ "$var1" != "" ] | 		    if [ "$var1" != "" ] | ||||||
| 		then | 		    then | ||||||
| 		  sed -i "/^password.*required.*pam_unix2.so/a$passwd_entry" $password_file | 		      sed -i "/^password.*required.*pam_unix2.so/a$passwd_entry" $password_file | ||||||
| 		  continue | 		      continue | ||||||
| 		fi | 		    fi | ||||||
|      |      | ||||||
| 		var2=`grep ^password.*include.*common-password $password_file` | 		    var2=`grep ^password.*include.*common-password $password_file` | ||||||
| 		if [ "$var2" != "" ] | 		    if [ "$var2" != "" ] | ||||||
| 		then | 		    then | ||||||
| 		  sed -i "/^password.*include.*common-password/a$passwd_entry" $password_file | 		      sed -i "/^password.*include.*common-password/a$passwd_entry" $password_file | ||||||
| 		  continue | 		      continue | ||||||
| 		fi | 		    fi | ||||||
|  |      | ||||||
|  | 		    sed -i "0,/^password/s/^\(password.*\)/\1\n$passwd_entry/" $password_file  | ||||||
|  | 	    fi | ||||||
|  |     done | ||||||
|  |  | ||||||
|  | fi | ||||||
|  |  | ||||||
| 		sed -i "0,/^password/s/^\(password.*\)/\1\n$passwd_entry/" $password_file  |  | ||||||
| 	fi |  | ||||||
| done |  | ||||||
|   | |||||||
| @@ -1,12 +1,16 @@ | |||||||
| #!/bin/bash | #!/bin/bash | ||||||
| # Remove the CASA pam entries from pam files. | # Remove the CASA pam entries from pam files. | ||||||
|  | DESKTOP=`grep -i desktop SuSE-release` | ||||||
|  |  | ||||||
| prefix="/etc/pam.d" | if [ "$DESKTOP" != "" ] | ||||||
| for pam_file in "$prefix/login" "$prefix/sshd" "$prefix/xdm" "$prefix/gdm" "$prefix/kdm" "$prefix/passwd" "$prefix/gnome-passwd" | then | ||||||
| do |  | ||||||
| 	if [ -f $pam_file ] |  | ||||||
|  	then |  | ||||||
|   		sed -i '/pam_micasa/d' $pam_file |  | ||||||
|  	fi |  | ||||||
| done |  | ||||||
|  |  | ||||||
|  |     prefix="/etc/pam.d" | ||||||
|  |     for pam_file in "$prefix/login" "$prefix/sshd" "$prefix/xdm" "$prefix/gdm" "$prefix/kdm" "$prefix/passwd" "$prefix/gnome-passwd" | ||||||
|  |     do | ||||||
|  | 	    if [ -f $pam_file ] | ||||||
|  | 	    then | ||||||
|  | 		    sed -i '/pam_micasa/d' $pam_file | ||||||
|  | 	    fi | ||||||
|  |     done | ||||||
|  | fi | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user