summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDidier Raboud <odyx@debian.org>2014-07-24 22:02:16 +0200
committerDidier Raboud <odyx@debian.org>2014-07-24 22:02:16 +0200
commit12a1e3786b3746339cc671054e2fcc99e9a0ef88 (patch)
treeab5306bc6c5ba3492bfa0a87a151d5968f78dda1
parent0f861b0b853c6211c0722e9e9f9c66db0151d8ec (diff)
downloadcups-12a1e3786b3746339cc671054e2fcc99e9a0ef88.tar.gz
Correct default listening address used under systemd for new installations; also correct the discrepancy on upgrades
Closes: #755807
-rw-r--r--debian/cups-daemon.preinst10
1 files changed, 6 insertions, 4 deletions
diff --git a/debian/cups-daemon.preinst b/debian/cups-daemon.preinst
index 0d0a711a..63087f06 100644
--- a/debian/cups-daemon.preinst
+++ b/debian/cups-daemon.preinst
@@ -10,10 +10,12 @@ install|upgrade)
mv /etc/cups/cupsd.conf /etc/cups/cupsd.conf.conffile-bak
fi
- # If file doesn't exist or if it has two conflicting stanzas
+ # If file doesn't exist, has two conflicting stanzas or has a "listen-to-all" while cupsd.conf says it should 'listen-to-localhost'
if [ ! -f /etc/cups/cupsd-systemd-listen.conf ] || \
( grep -q '^ListenStream=0.0.0.0:' /etc/cups/cupsd-systemd-listen.conf 2>/dev/null && \
- grep -q '^ListenStream=127.0.0.1:' /etc/cups/cupsd-systemd-listen.conf 2>/dev/null ) ;\
+ grep -q '^ListenStream=127.0.0.1:' /etc/cups/cupsd-systemd-listen.conf 2>/dev/null ) ||
+ ( grep -q '^ListenStream=0.0.0.0:' /etc/cups/cupsd-systemd-listen.conf 2>/dev/null && \
+ grep -q '^\s*Listen localhost:' /etc/cups/cupsd.conf 2>/dev/null );\
then
mkdir -p /etc/cups
cat >/etc/cups/cupsd-systemd-listen.conf <<EOF
@@ -43,8 +45,8 @@ EOF
else
cat >>/etc/cups/cupsd-systemd-listen.conf <<EOF
# Matches the default 'Listen localhost:631' from cupsd.conf.default
-ListenStream=0.0.0.0:631
-ListenStream=[::]:631
+ListenStream=127.0.0.1:631
+ListenStream=[::1]:631
EOF
fi
fi