aboutsummaryrefslogtreecommitdiff
path: root/modules/pam_namespace
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@strace.io>2024-01-20 08:00:00 +0000
committerDmitry V. Levin <ldv@strace.io>2024-01-20 08:00:00 +0000
commiteeaf310a26b5cb56bdd49885f27621c430c9898d (patch)
tree3b59d1777bda6c1c12de052ce9d57517beb10340 /modules/pam_namespace
parent1c9ddfb4c3825611bf1b06563a7bc9bb6dafe979 (diff)
downloadpam-eeaf310a26b5cb56bdd49885f27621c430c9898d.tar.gz
pam-eeaf310a26b5cb56bdd49885f27621c430c9898d.tar.bz2
pam-eeaf310a26b5cb56bdd49885f27621c430c9898d.zip
pam_namespace: use sed instead of awk in namespace.init
Given that sed is considered a more lightweight dependency than awk, and since sed is used by pam_namespace_helper anyway, use sed instead of awk in namespace.init as well. * modules/pam_namespace/namespace.init: Use sed instead of awk to obtain the UMASK value from /etc/login.defs.
Diffstat (limited to 'modules/pam_namespace')
-rwxr-xr-xmodules/pam_namespace/namespace.init2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/pam_namespace/namespace.init b/modules/pam_namespace/namespace.init
index d9053a13..1a6b6243 100755
--- a/modules/pam_namespace/namespace.init
+++ b/modules/pam_namespace/namespace.init
@@ -15,7 +15,7 @@ if [ "$3" = 1 ]; then
gid=$(echo "$passwd" | cut -f4 -d":")
cp -rT /etc/skel "$homedir"
chown -R "$user":"$gid" "$homedir"
- mask=$(awk '/^UMASK/{gsub("#.*$", "", $2); print $2; exit}' /etc/login.defs)
+ mask=$(sed -E -n 's/^UMASK[[:space:]]+([^#[:space:]]+).*/\1/p' /etc/login.defs)
mode=$(printf "%o" $((0777 & ~mask)))
chmod ${mode:-700} "$homedir"
[ -x /sbin/restorecon ] && /sbin/restorecon -R "$homedir"