summaryrefslogtreecommitdiff
path: root/debian/openssh-server.postinst
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2017-01-06 08:40:38 +0000
committerColin Watson <cjwatson@debian.org>2017-01-06 08:40:38 +0000
commit1f8af0f8fa5f06438721a20a9ac284e15884aa9b (patch)
tree3e77acd8963630e9af7231e2dfd2bbd6b7f40a47 /debian/openssh-server.postinst
parentd9c574e7a458051e85033a74440aae1a0521ff55 (diff)
Remove temporary file on exit from postinst (closes: #850275).
Diffstat (limited to 'debian/openssh-server.postinst')
-rw-r--r--debian/openssh-server.postinst10
1 files changed, 10 insertions, 0 deletions
diff --git a/debian/openssh-server.postinst b/debian/openssh-server.postinst
index 391efc43b..90d346674 100644
--- a/debian/openssh-server.postinst
+++ b/debian/openssh-server.postinst
@@ -72,6 +72,15 @@ create_keys() {
72} 72}
73 73
74 74
75new_config=
76
77cleanup() {
78 if [ "$new_config" ]; then
79 rm -f "$new_config"
80 fi
81}
82
83
75create_sshdconfig() { 84create_sshdconfig() {
76 # XXX cjwatson 2016-12-24: This debconf template is very confusingly 85 # XXX cjwatson 2016-12-24: This debconf template is very confusingly
77 # named; its description is "Disable SSH password authentication for 86 # named; its description is "Disable SSH password authentication for
@@ -80,6 +89,7 @@ create_sshdconfig() {
80 db_get openssh-server/permit-root-login 89 db_get openssh-server/permit-root-login
81 permit_root_login="$RET" 90 permit_root_login="$RET"
82 91
92 trap cleanup EXIT
83 new_config="$(tempfile)" 93 new_config="$(tempfile)"
84 cp -a /usr/share/openssh/sshd_config "$new_config" 94 cp -a /usr/share/openssh/sshd_config "$new_config"
85 if [ "$permit_root_login" != true ]; then 95 if [ "$permit_root_login" != true ]; then