diff options
author | Damien Miller <djm@mindrot.org> | 2000-06-22 20:57:11 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2000-06-22 20:57:11 +1000 |
commit | 099f505f9526311e48f828e95d90d488fe237219 (patch) | |
tree | 38d1401b60647403fb082f38b5b632d13d1e4665 | |
parent | 2f02295d31a34820d2c5a862ffeffd0d042502b2 (diff) |
- (djm) Automatically generate host key during "make install". Suggested
by Gary E. Miller <gem@rellim.com>
- (djm) Paranoia before kill() system call
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | Makefile.in | 17 | ||||
-rw-r--r-- | session.c | 4 |
3 files changed, 23 insertions, 3 deletions
@@ -1,3 +1,8 @@ | |||
1 | 20000622 | ||
2 | - (djm) Automatically generate host key during "make install". Suggested | ||
3 | by Gary E. Miller <gem@rellim.com> | ||
4 | - (djm) Paranoia before kill() system call | ||
5 | |||
1 | 20000620 | 6 | 20000620 |
2 | - (djm) Replace use of '-o' and '-a' logical operators in configure tests | 7 | - (djm) Replace use of '-o' and '-a' logical operators in configure tests |
3 | with '||' and '&&'. As suggested by Jim Knoble <jmknoble@pint-stowp.cx> | 8 | with '||' and '&&'. As suggested by Jim Knoble <jmknoble@pint-stowp.cx> |
diff --git a/Makefile.in b/Makefile.in index b18444d3d..f5af10d7e 100644 --- a/Makefile.in +++ b/Makefile.in | |||
@@ -112,7 +112,9 @@ catman-do: | |||
112 | >$${f%%.[18]}.0 ; \ | 112 | >$${f%%.[18]}.0 ; \ |
113 | done | 113 | done |
114 | 114 | ||
115 | install: manpages $(TARGETS) | 115 | install: manpages $(TARGETS) install-files host-key |
116 | |||
117 | install-files: | ||
116 | ./mkinstalldirs $(DESTDIR)$(bindir) | 118 | ./mkinstalldirs $(DESTDIR)$(bindir) |
117 | ./mkinstalldirs $(DESTDIR)$(sbindir) | 119 | ./mkinstalldirs $(DESTDIR)$(sbindir) |
118 | ./mkinstalldirs $(DESTDIR)$(mandir) | 120 | ./mkinstalldirs $(DESTDIR)$(mandir) |
@@ -134,7 +136,6 @@ install: manpages $(TARGETS) | |||
134 | ln -s ssh $(DESTDIR)$(bindir)/slogin | 136 | ln -s ssh $(DESTDIR)$(bindir)/slogin |
135 | -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1 | 137 | -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1 |
136 | ln -s ssh.1 $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1 | 138 | ln -s ssh.1 $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1 |
137 | |||
138 | if [ ! -f $(DESTDIR)$(sysconfdir)/ssh_config -a ! -f $(DESTDIR)$(sysconfdir)/sshd_config ]; then \ | 139 | if [ ! -f $(DESTDIR)$(sysconfdir)/ssh_config -a ! -f $(DESTDIR)$(sysconfdir)/sshd_config ]; then \ |
139 | ./mkinstalldirs $(DESTDIR)$(sysconfdir); \ | 140 | ./mkinstalldirs $(DESTDIR)$(sysconfdir); \ |
140 | $(INSTALL) -m 644 ssh_config.out $(DESTDIR)$(sysconfdir)/ssh_config; \ | 141 | $(INSTALL) -m 644 ssh_config.out $(DESTDIR)$(sysconfdir)/ssh_config; \ |
@@ -146,6 +147,18 @@ install: manpages $(TARGETS) | |||
146 | fi | 147 | fi |
147 | 148 | ||
148 | host-key: ssh-keygen | 149 | host-key: ssh-keygen |
150 | if [ -f "$(sysconfdir)/ssh_host_key" ] ; then \ | ||
151 | echo "$(sysconfdir)/ssh_host_key already exists, skipping." ; \ | ||
152 | else \ | ||
153 | ./ssh-keygen -b 1024 -f $(sysconfdir)/ssh_host_key -N "" ; \ | ||
154 | fi ; \ | ||
155 | if [ -f $(sysconfdir)/ssh_host_dsa_key ] ; then \ | ||
156 | echo "$(sysconfdir)/ssh_host_dsa_key already exists, skipping." ; \ | ||
157 | else \ | ||
158 | ./ssh-keygen -d -f $(sysconfdir)/ssh_host_dsa_key -N "" ; \ | ||
159 | fi ; | ||
160 | |||
161 | host-key-force: ssh-keygen | ||
149 | ./ssh-keygen -b 1024 -f $(sysconfdir)/ssh_host_key -N "" | 162 | ./ssh-keygen -b 1024 -f $(sysconfdir)/ssh_host_key -N "" |
150 | ./ssh-keygen -d -f $(sysconfdir)/ssh_host_dsa_key -N "" | 163 | ./ssh-keygen -d -f $(sysconfdir)/ssh_host_dsa_key -N "" |
151 | 164 | ||
@@ -1608,7 +1608,9 @@ session_close_by_channel(int id, void *arg) | |||
1608 | session_close(s); | 1608 | session_close(s); |
1609 | } else { | 1609 | } else { |
1610 | /* notify child, delay session cleanup */ | 1610 | /* notify child, delay session cleanup */ |
1611 | if (kill(s->pid, (s->ttyfd == -1) ? SIGTERM : SIGHUP) < 0) | 1611 | if (s->pid <= 1) |
1612 | error("session_close_by_channel: Unsafe s->pid = %d", s->pid); | ||
1613 | else if (kill(s->pid, (s->ttyfd == -1) ? SIGTERM : SIGHUP) < 0) | ||
1612 | error("session_close_by_channel: kill %d: %s", | 1614 | error("session_close_by_channel: kill %d: %s", |
1613 | s->pid, strerror(errno)); | 1615 | s->pid, strerror(errno)); |
1614 | } | 1616 | } |