summaryrefslogtreecommitdiff
path: root/debian/patches-applied/namespace_with_awk_not_gawk
blob: a5e8a994b9767eacc95d7fefdfa706d8baedb0d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Patch for Debian bug #518908

The default namespace.init depends on GNU awk extensions.  Make this portable
to POSIX awk.

Authors: Steve Langasek <vorlon@debian.org>

Upstream status: submitted in <20090827064459.GK15373@dario.dodds.net>

Index: pam.deb/modules/pam_namespace/namespace.init
===================================================================
--- pam.deb.orig/modules/pam_namespace/namespace.init
+++ pam.deb/modules/pam_namespace/namespace.init
@@ -15,7 +15,8 @@
                 gid=$(echo "$passwd" | cut -f4 -d":")
                 cp -rT /etc/skel "$homedir"
                 chown -R "$user":"$gid" "$homedir"
-                mode=$(awk '/^UMASK/{gsub("#.*$", "", $2); printf "%o", and(0777,compl(strtonum("0" $2))); exit}' /etc/login.defs)
+                mask=$(awk '/^UMASK/{gsub("#.*$", "", $2); print $2; exit}' /etc/login.defs)
+                mode=$(printf "%o" $((0777 & ~$mask)))
                 chmod ${mode:-700} "$homedir"
                 [ -x /sbin/restorecon ] && /sbin/restorecon -R "$homedir"
         fi