summaryrefslogtreecommitdiff
path: root/contrib/cygwin
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2006-03-04 08:50:31 +1100
committerDarren Tucker <dtucker@zip.com.au>2006-03-04 08:50:31 +1100
commit18614c254d83466ab706ffd0d4f58a8a018dcddf (patch)
treea10658d13b726620f2d2f615eb84466a4492ca51 /contrib/cygwin
parent54b75fe742c43aeaca7277a4c310eba43d057e4d (diff)
downloadopenssh-git-18614c254d83466ab706ffd0d4f58a8a018dcddf.tar.gz
- (dtucker) [contrib/cygwin/ssh-host-config] Require use of lastlog as a
file rather than directory, required as Cygwin will be importing lastlog(1). Also tightens up permissions on the file. Patch from vinschen@redhat.com.
Diffstat (limited to 'contrib/cygwin')
-rw-r--r--contrib/cygwin/ssh-host-config40
1 files changed, 25 insertions, 15 deletions
diff --git a/contrib/cygwin/ssh-host-config b/contrib/cygwin/ssh-host-config
index 0540890e..09cc3fcf 100644
--- a/contrib/cygwin/ssh-host-config
+++ b/contrib/cygwin/ssh-host-config
@@ -153,22 +153,31 @@ fi
# Create /var/log and /var/log/lastlog if not already existing
-if [ -f ${LOCALSTATEDIR}/log ]
+if [ -e ${LOCALSTATEDIR}/log -a ! -d ${LOCALSTATEDIR}/log ]
then
- echo "Creating ${LOCALSTATEDIR}/log failed!"
-else
- if [ ! -d ${LOCALSTATEDIR}/log ]
- then
- mkdir -p ${LOCALSTATEDIR}/log
- fi
- if [ -d ${LOCALSTATEDIR}/log/lastlog ]
- then
- chmod 777 ${LOCALSTATEDIR}/log/lastlog
- elif [ ! -f ${LOCALSTATEDIR}/log/lastlog ]
- then
- cat /dev/null > ${LOCALSTATEDIR}/log/lastlog
- chmod 666 ${LOCALSTATEDIR}/log/lastlog
- fi
+ echo
+ echo "${LOCALSTATEDIR}/log is existant but not a directory."
+ echo "Cannot create ssh host configuration."
+ echo
+ exit 1
+fi
+if [ ! -e ${LOCALSTATEDIR}/log ]
+then
+ mkdir -p ${LOCALSTATEDIR}/log
+fi
+
+if [ -e ${LOCALSTATEDIR}/log/lastlog -a ! -f ${LOCALSTATEDIR}/log/lastlog ]
+then
+ echo
+ echo "${LOCALSTATEDIR}/log/lastlog exists, but is not a file."
+ echo "Cannot create ssh host configuration."
+ echo
+ exit 1
+fi
+if [ ! -e ${LOCALSTATEDIR}/log/lastlog ]
+then
+ cat /dev/null > ${LOCALSTATEDIR}/log/lastlog
+ chmod 644 ${LOCALSTATEDIR}/log/lastlog
fi
# Create /var/empty file used as chroot jail for privilege separation
@@ -578,6 +587,7 @@ then
fi
chown "${_user}" ${SYSCONFDIR}/ssh*
chown "${_user}".544 ${LOCALSTATEDIR}/empty
+ chown "${_user}".544 ${LOCALSTATEDIR}/log/lastlog
if [ -f ${LOCALSTATEDIR}/log/sshd.log ]
then
chown "${_user}".544 ${LOCALSTATEDIR}/log/sshd.log