[PC-BSD Commits] r19419 - pcbsd/current/src-sh/pc-adctl/scripts

svn at pcbsd.org svn at pcbsd.org
Wed Sep 19 19:56:53 PDT 2012


Author: johnh
Date: 2012-09-20 02:56:53 +0000 (Thu, 20 Sep 2012)
New Revision: 19419

Modified:
   pcbsd/current/src-sh/pc-adctl/scripts/pc-pam
Log:
One more bugfix for removing lines from pam files.



Modified: pcbsd/current/src-sh/pc-adctl/scripts/pc-pam
===================================================================
--- pcbsd/current/src-sh/pc-adctl/scripts/pc-pam	2012-09-20 02:32:06 UTC (rev 19418)
+++ pcbsd/current/src-sh/pc-adctl/scripts/pc-pam	2012-09-20 02:56:53 UTC (rev 19419)
@@ -146,7 +146,7 @@
 	local class="${2}"
 	local index
 
-	index="$(egrep "^${class}" "${file}" |awk '{ printf("%d %s\n", n++, $0); }'|grep required|awk '{ print $1 }')"
+	index="$(egrep "^${class}" "${file}"|awk '{ printf("%d %s\n", n++, $0); }'|grep required|awk '{ print $1 }'|head -1)"
 	if [ -z "${index}" ]
 	then
 		index=0
@@ -258,12 +258,15 @@
 			then
 				if pam_auth_isset "${s}" && [ -n "${auth}" ]
 				then
-					__auth="-m "${auth}""
 					if echo "${auth}" | grep -q '^(+|^)' && \
 						! pam_service_configured "${pam_file}" "${auth}"
 					then
 						local index="$(get_auth_index "${pam_file}")"
 						__auth="-m "$(echo "${auth}" | sed -E "s|^\+|+${index}|")""
+
+					elif echo "${auth}" | grep -q '^-'
+					then
+						__auth="-m "${auth}""
 					fi
 					doconf=1
 				else
@@ -271,12 +274,15 @@
 				fi
 				if pam_account_isset "${s}" && [ -n "${account}" ]
 				then
-					__account=" -m "${account}""
 					if echo "${account}" | grep -q '^(+|^)' && \
 						! pam_service_configured "${pam_file}" "${account}"
 					then
 						local index="$(get_account_index "${pam_file}")"
 						__account="-m "$(echo "${account}" | sed -E "s|^\+|+${index}|")""
+
+					elif echo "${account}" | grep -q '^-'
+					then
+						__account="-m "${account}""
 					fi
 					doconf=1
 				else
@@ -284,12 +290,15 @@
 				fi
 				if pam_session_isset "${s}" && [ -n "${session}" ]
 				then
-					__session="-m "${session}""
 					if echo "${session}" | grep -q '^(+|^)' && \
 						! pam_service_configured "${pam_file}" "${session}"
 					then
 						local index="$(get_session_index "${pam_file}")"
 						__session="-m "$(echo "${session}" | sed -E "s|^\+|+${index}|")""
+
+					elif echo "${session}" | grep -q '^-'
+					then
+						__session="-m "${session}""
 					fi
 					doconf=1
 				else
@@ -297,12 +306,15 @@
 				fi
 				if pam_password_isset "${s}" && [ -n "${password}" ]
 				then
-					__password="-m "${password}""
 					if echo "${password}" | grep -q '^(+|^)' && \
 						! pam_service_configured "${pam_file}" "${password}"
 					then
 						local index="$(get_password_index "${pam_file}")"
 						__password="-m "$(echo "${password}" | sed -E "s|^\+|+${index}|")""
+
+					elif echo "${password}" | grep -q '^-'
+					then
+						__password="-m "${password}""
 					fi
 					doconf=1
 				else



More information about the Commits mailing list