summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog21
-rw-r--r--ChangeLog.Ylonen578
-rw-r--r--Makefile.in2
-rw-r--r--README2
-rw-r--r--authfd.c9
-rw-r--r--fingerprint.c39
-rw-r--r--fingerprint.h6
-rw-r--r--hostfile.c4
-rw-r--r--serverloop.c5
-rw-r--r--ssh-add.18
-rw-r--r--ssh-add.c44
-rw-r--r--ssh-agent.14
-rw-r--r--ssh-keygen.112
-rw-r--r--ssh-keygen.c198
-rw-r--r--ssh.15
-rw-r--r--sshconnect.c20
-rw-r--r--sshd.c30
17 files changed, 269 insertions, 718 deletions
diff --git a/ChangeLog b/ChangeLog
index 9d6d07a1d..f42fdc738 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
119991117
2 - Merged OpenBSD CVS changes
3 - [ChangeLog.Ylonen] noone needs this anymore
4 - [authfd.c] close-on-exec for auth-socket, ok deraadt
5 - [hostfile.c]
6 in known_hosts key lookup the entry for the bits does not need
7 to match, all the information is contained in n and e. This
8 solves the problem with buggy servers announcing the wrong
9 modulus length. markus and me.
10 - [serverloop.c]
11 bugfix: check for space if child has terminated, from:
12 iedowse@maths.tcd.ie
13 - [ssh-add.1 ssh-add.c ssh-keygen.1 ssh-keygen.c sshconnect.c]
14 [fingerprint.c fingerprint.h]
15 rsa key fingerprints, idea from Bjoern Groenvall <bg@sics.se>
16 - [ssh-agent.1] typo
17 - [ssh.1] add OpenSSH information to AUTHOR section. okay markus@
18 - [sshd.c]
19 force logging to stderr while loading private key file
20 (lost while converting to new log-levels)
21
119991116 2219991116
2 - Fix some Linux libc5 problems reported by Miles Wilson <mw@mctitle.com> 23 - Fix some Linux libc5 problems reported by Miles Wilson <mw@mctitle.com>
3 - Merged OpenBSD CVS changes: 24 - Merged OpenBSD CVS changes:
diff --git a/ChangeLog.Ylonen b/ChangeLog.Ylonen
deleted file mode 100644
index 08d90f78d..000000000
--- a/ChangeLog.Ylonen
+++ /dev/null
@@ -1,578 +0,0 @@
1Fri Nov 17 16:19:20 1995 Tatu Ylonen <ylo@trance.olari.clinet.fi>
2
3 * Released 1.2.12.
4
5 * channels.c: Commented out debugging messages about output draining.
6
7 * Added file OVERVIEW to give some idea about the structure of the
8 ssh software.
9
10Thu Nov 16 16:40:17 1995 Tatu Ylonen <ylo@trance.olari.clinet.fi>
11
12 * canohost.c (get_remote_hostname): Don't ever return NULL (causes
13 segmentation violation).
14
15 * sshconnect.c: Host ip address printed incorrectly with -v.
16
17 * Implemented SSH_TTY environment variable.
18
19Wed Nov 15 01:47:40 1995 Tatu Ylonen <ylo@trance.olari.clinet.fi>
20
21 * Implemented server and client option KeepAlive to specify
22 whether to set SO_KEEPALIVE. Both default to "yes"; to disable
23 keepalives, set the value to "no" in both the server and the
24 client configuration files. Updated manual pages.
25
26 * sshd.c: Fixed Solaris utmp problem: wrong pid stored in utmp
27 (patch from Petri Virkkula <argon@bat.cs.hut.fi>).
28
29 * login.c (record_logout): Fixed removing user from utmp on BSD
30 (with HAVE_LIBUTIL_LOGIN).
31
32 * Added cleanup functions to be called from fatal(). Arranged for
33 utmp to be cleaned if sshd terminates by calling fatal (e.g.,
34 after dropping connection). Eliminated separate client-side
35 fatal() functions and moved fatal() to log-client.c. Made all
36 cleanups, including channel_stop_listening() and packet_close()
37 be called using this mechanism.
38
39Thu Nov 9 09:58:05 1995 Tatu Ylonen <ylo@soikko.cs.hut.fi>
40
41 * sshd.c: Permit immediate login with empty password only if
42 password authentication is allowed.
43
44Wed Nov 8 00:43:55 1995 Tatu Ylonen <ylo@soikko.cs.hut.fi>
45
46 * Eliminated unix-domain X11 forwarding. Inet-domain forwarding is
47 now the only supported form. Renamed server option
48 X11InetForwarding to X11Forwarding, and eliminated
49 X11UnixForwarding. Updated documentation. Updated RFC (marked
50 the SSH_CMSG_X11_REQUEST_FORWARDING message (code 26) as
51 obsolete, and removed all references to it). Increased protocol
52 version number to 1.3.
53
54 * scp.c (main): Added -B (BatchMode). Updated manual page.
55
56 * Cleaned up and updated all manual pages.
57
58 * clientloop.c: Added new escape sequences ~# (lists forwarded
59 connections), ~& (background ssh when waiting for forwarded
60 connections to terminate), ~? (list available escapes).
61 Polished the output of the connection listing. Updated
62 documentation.
63
64 * uidswap.c: If _POSIX_SAVED_IDS is defined, don't change the real
65 uid. Assume that _POSIX_SAVED_IDS also applies to seteuid.
66 This may solve problems with tcp_wrappers (libwrap) showing
67 connections as coming from root.
68
69Tue Nov 7 20:28:57 1995 Tatu Ylonen <ylo@soikko.cs.hut.fi>
70
71 * Added RandomSeed server configuration option. The argument
72 specifies the location of the random seed file. Updated
73 documentation.
74
75 * Locate perl5 in configure. Generate make-ssh-known-hosts (with
76 the correct path for perl5) in Makefile.in, and install it with
77 the other programs. Updated manual page.
78
79 * sshd.c (main): Added a call to umask to set the umask to a
80 reasonable value.
81
82 * compress.c (buffer_compress): Fixed to follow the zlib
83 documentation (which is slightly confusing).
84
85 * INSTALL: Added information about Linux libc.so.4 problem.
86
87Mon Nov 6 15:42:36 1995 Tatu Ylonen <ylo@soikko.cs.hut.fi>
88
89 * (Actually autoconf fix) Installed patch to AC_ARG_PROGRAM.
90
91 * sshd.c, sshd.8.in: Renamed $HOME/.environment ->
92 $HOME/.ssh/environment.
93
94 * configure.in: Disable shadow password checking on convex.
95 Convex has /etc/shadow, but sets pw_passwd automatically if
96 running as root.
97
98 * Eliminated HAVE_ETC_MASTER_PASSWD (NetBSD, FreeBSD); the
99 pw_passwd field is automatically filled if running as root.
100 Put explicit code in configure.in to prevent shadow password
101 checking on FreeBSD and NetBSD.
102
103 * serverloop.c (signchld_handler): Don't print error if wait
104 returns -1.
105
106 * Makefile.in (install): Fixed modes of data files.
107
108 * Makefile.in (install): Make links for slogin.1.
109
110 * make-ssh-known-hosts: Merged a patch from melo@ci.uminho.pt to
111 fix the ping command.
112
113Fri Nov 3 16:25:28 1995 Tatu Ylonen <ylo@soikko.cs.hut.fi>
114
115 * ssh.1.in: Added more information about X11 forwarding.
116
117Thu Nov 2 18:42:13 1995 Tatu Ylonen <ylo@soikko.cs.hut.fi>
118
119 * Changes to use O_NONBLOCK_BROKEN consistently.
120
121 * pty.c (pty_make_controlling_tty): Use setpgid instead of
122 setsid() on Ultrix.
123
124 * includes.h: Removed redundant #undefs for Ultrix and Sony News;
125 these are already handled in configure.in.
126
127Tue Oct 31 13:31:28 1995 Tatu Ylonen <ylo@soikko.cs.hut.fi>
128
129 * configure.in: Define SSH_WTMP to /var/adm/wtmp is wtmp not found.
130
131 * configure.in: Disable vhangup on Ultrix. I am told this fixes
132 the server problems.
133
134Sat Oct 28 14:22:05 1995 Tatu Ylonen <ylo@soikko.cs.hut.fi>
135
136 * sshconnect.c: Fixed a bug in connecting to a multi-homed host.
137 Restructured the connecting code to never try to use the same
138 socket a second time after a failed connection.
139
140 * Makefile.in: Added explicit -m option to install, and umask 022
141 when creating directories and the host key.
142
143Fri Oct 27 01:05:10 1995 Tatu Ylonen <ylo@soikko.cs.hut.fi>
144
145 * Makefile.in: Added cleaning of $(ZLIBDIR) to clean and distclean.
146
147 * login.c (get_last_login_time): Fixed a typo (define -> defined).
148
149Thu Oct 26 01:28:07 1995 Tatu Ylonen <ylo@soikko.cs.hut.fi>
150
151 * configure.in: Moved testing for ANSI C compiler after the host
152 specific code (problems on HPUX).
153
154 * Minor fixes to /etc/default/login stuff from Bryan O'Sullivan.
155
156 * Fixed .SH NAME sections in manual pages.
157
158 * compress.c: Trying to fix a mysterious bug in the compression
159 glue.
160
161 * ssh-1.2.11.
162
163 * scp.c: disable agent forwarding when running ssh from scp.
164
165 * Added compression of plaintext packets using the gzip library
166 (zlib). Client configuration options Compression and
167 CompressionLevel (1-9 as in gzip). New ssh and scp option -C
168 (to enable compression). Updated RFC.
169
170Wed Oct 25 05:11:55 1995 Tatu Ylonen <ylo@soikko.cs.hut.fi>
171
172 * Implemented ProxyCommand stuff based on patches from Bryan
173 O'Sullivan <bos@serpentine.com>.
174
175 * Merged BSD login/logout/lastlog patches from Mark Treacy
176 <mark@labtam.oz.au>.
177
178 * sshd.c: Added chdir("/").
179
180Tue Oct 24 00:29:01 1995 Tatu Ylonen <ylo@soikko.cs.hut.fi>
181
182 * Merged RSA environment= patches from Felix Leitner
183 <leitner@prz.tu-berlin.de> with some changes.
184
185 * sshd.c: Made the packet code use two separate descriptors for
186 the connection (one for input, the other for output). This will
187 make future extensions easier (e.g., non-socket transports, etc.).
188 sshd -i now uses both stdin and stdout separately.
189
190Mon Oct 23 21:29:28 1995 Tatu Ylonen <ylo@soikko.cs.hut.fi>
191
192 * sshd.c: Merged execle -> execve patches from Mark Martinec
193 <Mark.Martinec@nsc.ijs.si>. This may help with execle bugs on
194 Convex (environment not getting passed properly). This might
195 also solve similar problems on Sonys; please test!
196
197 * Removed all compatibility code for protocol version 1.0.
198 THIS MEANS THAT WE ARE NO LONGER COMPATIBLE WITH SSH VERSIONS
199 PRIOR TO 1.1.0.
200
201 * randoms.c (random_acquire_light_environmental_noise): If
202 /dev/random is available, read up to 32 bytes (256 bits) from
203 there in non-blocking mode, and mix the new random bytes into
204 the pool.
205
206 * Added client configuration option StrictHostKeyChecking
207 (disabled by default). If this is enabled, the client will not
208 automatically add new host keys to $HOME/.ssh/known_hosts;
209 instead the connection will be refused if the host key is not
210 known. Similarly, if the host key has changed, the connection
211 will be refused instead if just issuing a warning. This
212 provides additional security against man-in-the-middle/trojan
213 horse attacks (especially in scripts where there is no-one to
214 see the warnings), but may be quite inconvenient in everyday
215 interactive use unless /etc/ssh_known_hosts is very complete,
216 because new host keys must now be added manually.
217
218 * sshconnect.c (ssh_connect): Use the user's uid when creating the
219 socket and connecting it. I am hoping that this might help with
220 tcp_wrappers showing the remote user as root.
221
222 * ssh.c: Try inet-domain X11 forwarding regardless of whether we
223 can get local authorization information. If we don't, we just
224 come up with fake information; the forwarding code will anyway
225 generate its own fake information and validate that the client
226 knows that information. It will then substitute our fake
227 information for that, but that info should get ignored by the
228 server if it doesn't support it.
229
230 * Added option BatchMode to disable password/passphrase querying
231 in scripts.
232
233 * auth-rh-rsa.c: Changed to use uid-swapping when reading
234 .ssh/known_hosts.
235
236 * sshd.8.in (command): Improved documentation of file permissions
237 on the manual pages.
238
239Thu Oct 19 21:05:51 1995 Tatu Ylonen <ylo@soikko.cs.hut.fi>
240
241 * ssh-add.c (add_file): Fixed a bug causing ssh to sometimes refer
242 to freed memory (comment -> saved_comment).
243
244 * log-server.c: Added a prefix to debug/warning/error/fatal
245 messages describing message types. Syslog does not include that
246 information automatically.
247
248Sun Oct 8 01:56:01 1995 Tatu Ylonen <ylo@shadows.cs.hut.fi>
249
250 * Merged /etc/default/login and MAIL environment variable changes
251 from Bryan O'Sullivan <bos@serpentine.com>.
252 - mail spool file location
253 - process /etc/default/login
254 - add HAVE_ETC_DEFAULT_LOGIN
255 - new function child_get_env and read_etc_default_login (sshd.c)
256
257 * ssh-add.c (add_file): Fixed asking for passphrase.
258
259 * Makefile.in: Fixed installing configure-generated man pages when
260 compiling in a separate object directory.
261
262 * sshd.c (main): Moved RSA key generation until after allocating
263 the port number. (Actually, the code got duplicated because we
264 never listen when run from inetd.)
265
266 * ssh.c: Fixed a problem that caused scp to hang when called with
267 stdin closed.
268
269Sat Oct 7 03:08:06 1995 Tatu Ylonen <ylo@shadows.cs.hut.fi>
270
271 * Added server config option StrictModes. It specifies whether to
272 check ownership and modes of home directory and .rhosts files.
273
274 * ssh.c: If ssh is renamed/linked to a host name, connect to that
275 host.
276
277 * serverloop.c, clientloop.c: Ignore EAGAIN reported on read from
278 connection. Solaris has a kernel bug which causes select() to
279 sometimes wake up even though there is no data available.
280
281 * Display all open connections when printing the "Waiting for
282 forwarded connections to terminate" message.
283
284 * sshd.c, readconf.c: Added X11InetForwarding and
285 X11UnixForwarding server config options.
286
287Thu Oct 5 17:41:16 1995 Tatu Ylonen <ylo@shadows.cs.hut.fi>
288
289 * Some more SCO fixes.
290
291Tue Oct 3 01:04:34 1995 Tatu Ylonen <ylo@shadows.cs.hut.fi>
292
293 * Fixes and cleanups in README, INSTALL, COPYING.
294
295Mon Oct 2 03:36:08 1995 Tatu Ylonen <ylo@shadows.cs.hut.fi>
296
297 * ssh-add.c (add_file): Fixed a bug in ssh-add (xfree: NULL ...).
298
299 * Removed .BR from ".SH NAME" in man pages.
300
301Sun Oct 1 04:16:07 1995 Tatu Ylonen <ylo@shadows.cs.hut.fi>
302
303 * ssh-1.2.10.
304
305 * configure.in: When checking that the compiler works, check that
306 it understands ANSI C prototypes.
307
308 * Made uidswap error message a debug() to avoid confusing errors
309 on AIX (AIX geteuid is brain-damaged and fails even for root).
310
311 * Fixed an error in sshd.8 (FacistLogging -> FascistLogging).
312
313 * Fixed distribution in Makefile.in (missing manual page .in files).
314
315Sat Sep 30 17:38:46 1995 Tatu Ylonen <ylo@shadows.cs.hut.fi>
316
317 * auth-rhosts.c: Fixed serious security problem in
318 /etc/hosts.equiv authentication.
319
320Fri Sep 29 00:41:02 1995 Tatu Ylonen <ylo@shadows.cs.hut.fi>
321
322 * Include machine/endian.h on Paragon.
323
324 * ssh-add.c (add_file): Made ssh-add keep asking for the
325 passphrase until the user just types return or cancels.
326 Make the dialog display the comment of the key.
327
328 * Read use shosts.equiv in addition to /etc/hosts.equiv.
329
330 * sshd.8 is now sshd.8.in and is processed by configure to
331 substitute the proper paths for various files. Ditto for ssh.1.
332 Ditto for make-ssh-known-hosts.1.
333
334 * configure.in: Moved /etc/sshd_pid to PIDDIR/sshd.pid. PIDDIR
335 will be /var/run if it exists, and ETCDIR otherwise.
336
337Thu Sep 28 21:52:42 1995 Tatu Ylonen <ylo@shadows.cs.hut.fi>
338
339 * On Ultrix, check if sys/syslog.h needs to be included in
340 addition to syslog.h.
341
342 * make-ssh-known-hosts.pl: Merged Kivinen's fixes for HPUX.
343
344 * configure.in: Put -lwrap, -lsocks, etc. at the head of LIBS.
345
346 * Fixed case-insensitivity in auth-rhosts.c.
347
348 * Added missing socketpair.c to EXTRA_SRCS (needed on SCO), plus
349 other SCO fixes.
350
351 * Makefile.in: Fixed missing install_prefixes.
352
353Wed Sep 27 03:57:00 1995 Tatu Ylonen <ylo@shadows.cs.hut.fi>
354
355 * ssh-1.2.9.
356
357 * Added SOCKS support.
358
359 * Fixed default setting of IgnoreRhosts option.
360
361 * Pass the magic cookie to xauth in stdin instead of command line;
362 the command line is visible in ps.
363
364 * Added processing $HOME/.ssh/rc and /etc/sshrc.
365
366 * Added a section to sshd.8 on what happens at login time.
367
368Tue Sep 26 01:27:40 1995 Tatu Ylonen <ylo@shadows.cs.hut.fi>
369
370 * Don't define speed_t on SunOS 4.1.1; it conflicts with system
371 headers.
372
373 * Added support for .hushlogin.
374
375 * Added --with-etcdir.
376
377 * Read $HOME/.environment after /etc/environment.
378
379Mon Sep 25 03:26:06 1995 Tatu Ylonen <ylo@shadows.cs.hut.fi>
380
381 * Merged patches for SCO Unix (from Michael Henits).
382
383Sun Sep 24 22:28:02 1995 Tatu Ylonen <ylo@shadows.cs.hut.fi>
384
385 * Added ssh option ConnectionAttempts.
386
387Sat Sep 23 12:30:15 1995 Tatu Ylonen <ylo@shadows.cs.hut.fi>
388
389 * sshd.c: Don't print last login time and /etc/motd if a command
390 has been specified (with ssh -t host command).
391
392 * Added support for passing the screen number in X11 forwarding.
393 It is implemented as a compatible protocol extension, signalled
394 by SSH_PROTOFLAG_SCREEN_NUMBER by the child.
395
396 * clientloop.c: Fixed bugs in the order in which things were
397 processed. This may solve problems with some data not getting
398 sent to the server as soon as possible (probably solves the TCP
399 forwarding delayed close problem). Also, it looked like window
400 changes might not get transmitted as early as possible in some
401 cases.
402
403 * clientloop.c: Changed to detect window size change that
404 happened while ssh was suspended.
405
406 * ssh.c: Moved the do_session function (client main loop) to
407 clientloop.c. Divided it into smaller functions. General cleanup.
408
409 * ssh-1.2.8
410
411Fri Sep 22 22:07:46 1995 Tatu Ylonen <ylo@shadows.cs.hut.fi>
412
413 * sshconnect.c (ssh_login): Made ssh_login take the options
414 structure as argument, instead of the individual arguments.
415
416 * auth-rhosts.c (check_rhosts_file): Added support for netgroups.
417
418 * auth-rhosts.c (check_rhosts_file): Added support for negated
419 entries.
420
421Thu Sep 21 00:07:56 1995 Tatu Ylonen <ylo@shadows.cs.hut.fi>
422
423 * auth-rhosts.c: Restructured rhosts authentication code.
424 Hosts.equiv now has same format as .rhosts: user names are allowed.
425
426 * Added support for the Intel Paragon.
427
428 * sshd.c: Don't use X11 forwarding with spoofing if no xauth
429 program. Changed configure.in to not define XAUTH_PATH if
430 there is no xauth program.
431
432 * ssh-1.2.7
433
434 * sshd.c: Rewrote the code to build the environment. Now also reads
435 /etc/environment.
436
437 * sshd.c: Fixed problems in libwrap code. --with-libwrap now
438 takes optional library name/path.
439
440 * ssh-1.2.6
441
442 * Define USE_PIPES by default.
443
444 * Added support for Univel Unixware and MachTen.
445
446 * Added IgnoreRhosts server option.
447
448 * Added USE_STRLEN_FOR_AF_UNIX; it is needed at least on MachTen.
449
450Wed Sep 20 02:41:02 1995 Tatu Ylonen <ylo@shadows.cs.hut.fi>
451
452 * sshd.c (do_child): don't call packet_close when /etc/nologin,
453 because packet_close does shutdown, and the message does not get
454 sent.
455
456 * pty.c (pty_allocate): Push ttcompat streams module.
457
458 * randoms.c (random_acquire_light_environmental_noise): Don't use
459 the second argument to gettimeofday as it is not supported on
460 all systems.
461
462 * login.c (record_login): Added NULL second argument to gettimeofday.
463
464Tue Sep 19 13:25:48 1995 Tatu Ylonen <ylo@shadows.cs.hut.fi>
465
466 * fixed pclose wait() in sshd key regeneration (now only collects
467 easily available noise).
468
469 * configure.in: test for bsdi before bsd*.
470
471 * ssh.c: Don't print "Connection closed" if -q.
472
473Wed Sep 13 04:19:52 1995 Tatu Ylonen <ylo@shadows.cs.hut.fi>
474
475 * Released ssh-1.2.5.
476
477 * Hopefully fixed "Waiting for forwarded connections to terminate"
478 message.
479
480 * randoms.c, md5.c: Large modifications to make these work on Cray
481 (which has no 32 bit integer type).
482
483 * Fixed a problem with forwarded connection closes not being
484 reported immediately.
485
486 * ssh.c: fixed rhosts authentication (broken by uid-swapping).
487
488 * scp.c: Don't use -l if server user not specified (it made
489 setting User in the configuration file not work).
490
491 * configure.in: don't use -pipe on BSDI.
492
493 * randoms.c: Major modifications to make it work without 32 bit
494 integers (e.g. Cray).
495
496 * md5.c: Major modifications to make it work without 32 bit
497 integers (e.g. Cray).
498
499 * Eliminated HPSUX_BROKEN_PTYS. The code is now enabled by
500 default on all systems.
501
502Mon Sep 11 00:53:12 1995 Tatu Ylonen <ylo@shadows.cs.hut.fi>
503
504 * sshd.c: don't include sshd pathname in log messages.
505
506 * Added libwrap stuff (includes support for identd).
507
508 * Added OSF/1 C2 extended security stuff.
509
510 * Fixed interactions between getuid() and uid-swap stuff.
511
512Sun Sep 10 00:29:27 1995 Tatu Ylonen <ylo@shadows.cs.hut.fi>
513
514 * serverloop.c: Don't send stdout data to client until after a few
515 milliseconds if there is very little data. This is because some
516 systems give data from pty one character at a time, which would
517 multiply data size by about 16.
518
519 * serverloop.c: Moved server do_session to a separate file and
520 renamed it server_loop. Split it into several functions and
521 partially rewrote it. Fixed "cat /etc/termcap | ssh foo cat" hangup.
522
523 * Screwed up something while checking stuff in under cvs. No harm,
524 but bogus log entries...
525
526Sat Sep 9 02:24:51 1995 Tatu Ylonen <ylo@shadows.cs.hut.fi>
527
528 * minfd.c (_get_permanent_fd): Use SHELL environment variable.
529
530 * channels.c (x11_create_display_inet): Created
531 HPSUX_NONSTANDARD_X11_KLUDGE; it causes DISPLAY to contain the
532 IP address of the host instead of the name, because HPSUX uses
533 some magic shared memory communication for local connections.
534
535 * Changed SIGHUP processing in server; it should now work multiple
536 times.
537
538 * Added length limits in many debug/log/error/fatal calls just in
539 case.
540
541 * login.c (get_last_login_time): Fixed location of lastlog.
542
543 * Rewrote all uid-swapping code. New files uidswap.h, uidswap.c.
544
545 * Fixed several security problems involving chmod and chgrp (race
546 conditions). Added warnings about dubious modes for /tmp/.X11-unix.
547
548Fri Sep 8 20:03:36 1995 Tatu Ylonen <ylo@shadows.cs.hut.fi>
549
550 * Changed readconf.c to never display anything from the config
551 file. This should now be prevented otherwise, but let's play safe.
552
553 * log-server.c: Use %.500s in syslog() just to be sure (they
554 should already be shorter than 1024 though).
555
556 * sshd.c: Moved setuid in child a little earlier (just to be
557 conservative, there was no security problem that I could detect).
558
559 * README, INSTALL: Added info about mailing list and WWW page.
560
561 * sshd.c: Added code to use SIGCHLD and wait zombies immediately.
562
563 * Merged patch to set ut_addr in utmp.
564
565 * Created ChangeLog and added it to Makefile.in.
566
567 * Use read_passphrase instead of getpass().
568
569 * Added SSH_FALLBACK_CIPHER. Fixed a bug in default cipher
570 selection (IDEA used to be selected even if not supported by the
571 server).
572
573 * Use no encryption for key files if empty passphrase.
574
575 * Added section about --without-idea in INSTALL.
576
577 * Version 1.2.0 was released a couple of days ago.
578
diff --git a/Makefile.in b/Makefile.in
index 93c4a0c01..664920d14 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -31,7 +31,7 @@ OBJS= authfd.o authfile.o auth-passwd.o auth-rhosts.o auth-rh-rsa.o \
31 31
32all: $(OBJS) $(TARGETS) 32all: $(OBJS) $(TARGETS)
33 33
34libssh.a: authfd.o authfile.o bufaux.o buffer.o canohost.o channels.o cipher.o compat.o compress.o crc32.o deattack.o hostfile.o match.o mpaux.o nchan.o packet.o readpass.o rsa.o tildexpand.o ttymodes.o uidswap.o xmalloc.o helper.o rc4.o mktemp.o strlcpy.o log.o 34libssh.a: authfd.o authfile.o bufaux.o buffer.o canohost.o channels.o cipher.o compat.o compress.o crc32.o deattack.o hostfile.o match.o mpaux.o nchan.o packet.o readpass.o rsa.o tildexpand.o ttymodes.o uidswap.o xmalloc.o helper.o rc4.o mktemp.o strlcpy.o log.o fingerprint.o
35 $(AR) rv $@ $^ 35 $(AR) rv $@ $^
36 $(RANLIB) $@ 36 $(RANLIB) $@
37 37
diff --git a/README b/README
index 4ab0bd15a..f19e953d6 100644
--- a/README
+++ b/README
@@ -4,6 +4,8 @@ OpenSSH is based on the last free version of Tatu Ylonen's SSH with
4all patent-encumbered algorithms removed, all known security bugs 4all patent-encumbered algorithms removed, all known security bugs
5fixed, new features reintroduced and many other clean-ups. More 5fixed, new features reintroduced and many other clean-ups. More
6information about SSH itself can be found in the file README.Ylonen. 6information about SSH itself can be found in the file README.Ylonen.
7OpenSSH has been created by Aaron Cambell, Bob Beck, Markus Friedl,
8Niels Provos, Theo de Raadt, and Dug Song.
7 9
8This port consists of the re-introduction of autoconf support, PAM 10This port consists of the re-introduction of autoconf support, PAM
9support (for Linux and Solaris), EGD[1] support, and replacements for 11support (for Linux and Solaris), EGD[1] support, and replacements for
diff --git a/authfd.c b/authfd.c
index 84a5fc742..55ad13e3a 100644
--- a/authfd.c
+++ b/authfd.c
@@ -14,7 +14,7 @@ Functions for connecting the local authentication agent.
14*/ 14*/
15 15
16#include "includes.h" 16#include "includes.h"
17RCSID("$Id: authfd.c,v 1.4 1999/11/16 02:37:16 damien Exp $"); 17RCSID("$Id: authfd.c,v 1.5 1999/11/17 06:29:08 damien Exp $");
18 18
19#include "ssh.h" 19#include "ssh.h"
20#include "rsa.h" 20#include "rsa.h"
@@ -50,6 +50,13 @@ ssh_get_authentication_socket()
50 sock = socket(AF_UNIX, SOCK_STREAM, 0); 50 sock = socket(AF_UNIX, SOCK_STREAM, 0);
51 if (sock < 0) 51 if (sock < 0)
52 return -1; 52 return -1;
53
54 /* close on exec */
55 if (fcntl(sock, F_SETFD, 1) == -1)
56 {
57 close(sock);
58 return -1;
59 }
53 60
54 if (connect(sock, (struct sockaddr *)&sunaddr, sizeof(sunaddr)) < 0) 61 if (connect(sock, (struct sockaddr *)&sunaddr, sizeof(sunaddr)) < 0)
55 { 62 {
diff --git a/fingerprint.c b/fingerprint.c
new file mode 100644
index 000000000..c319fa230
--- /dev/null
+++ b/fingerprint.c
@@ -0,0 +1,39 @@
1#include "includes.h"
2RCSID("$Id: fingerprint.c,v 1.1 1999/11/16 22:49:28 markus Exp $");
3
4#include "ssh.h"
5#include "xmalloc.h"
6#include <ssl/md5.h>
7
8#define FPRINT "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x"
9
10/* Generate key fingerprint in ascii format.
11 Based on ideas and code from Bjoern Groenvall <bg@sics.se> */
12
13char *
14fingerprint(BIGNUM *e, BIGNUM *n)
15{
16 static char retval[80];
17 MD5_CTX md;
18 unsigned char d[16];
19 char *buf;
20 int nlen, elen;
21
22 nlen = BN_num_bytes(n);
23 elen = BN_num_bytes(e);
24
25 buf = xmalloc(nlen + elen);
26
27 BN_bn2bin(n, buf);
28 BN_bn2bin(e, buf + nlen);
29
30 MD5_Init(&md);
31 MD5_Update(&md, buf, nlen + elen);
32 MD5_Final(d, &md);
33 snprintf(retval, sizeof(retval), FPRINT,
34 d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7],
35 d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15]);
36 memset(buf, 0, nlen + elen);
37 xfree(buf);
38 return retval;
39}
diff --git a/fingerprint.h b/fingerprint.h
new file mode 100644
index 000000000..c4ec22fc4
--- /dev/null
+++ b/fingerprint.h
@@ -0,0 +1,6 @@
1/* RCSID("$Id: fingerprint.h,v 1.1 1999/11/16 22:49:28 markus Exp $"); */
2
3#ifndef FINGERPRINT_H
4#define FINGERPRINT_H
5char * fingerprint(BIGNUM *e, BIGNUM *n);
6#endif
diff --git a/hostfile.c b/hostfile.c
index 79ff7f988..de21c904e 100644
--- a/hostfile.c
+++ b/hostfile.c
@@ -14,7 +14,7 @@ Functions for manipulating the known hosts files.
14*/ 14*/
15 15
16#include "includes.h" 16#include "includes.h"
17RCSID("$Id: hostfile.c,v 1.3 1999/11/16 02:37:16 damien Exp $"); 17RCSID("$Id: hostfile.c,v 1.4 1999/11/17 06:29:08 damien Exp $");
18 18
19#include "packet.h" 19#include "packet.h"
20#include "ssh.h" 20#include "ssh.h"
@@ -231,7 +231,7 @@ check_host_in_hostfile(const char *filename, const char *host,
231 } 231 }
232 232
233 /* Check if the current key is the same as the given key. */ 233 /* Check if the current key is the same as the given key. */
234 if (kbits == bits && BN_cmp(ke, e) == 0 && BN_cmp(kn, n) == 0) 234 if (BN_cmp(ke, e) == 0 && BN_cmp(kn, n) == 0)
235 { 235 {
236 /* Ok, they match. */ 236 /* Ok, they match. */
237 fclose(f); 237 fclose(f);
diff --git a/serverloop.c b/serverloop.c
index 552c69c29..2aec2cf19 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -269,8 +269,9 @@ retry_select:
269 if (channel_max_fd() > max_fd) 269 if (channel_max_fd() > max_fd)
270 max_fd = channel_max_fd(); 270 max_fd = channel_max_fd();
271 271
272 /* If child has terminated, read as much as is available and then exit. */ 272 /* If child has terminated and there is enough buffer space to read from
273 if (child_terminated) 273 it, then read as much as is available and exit. */
274 if (child_terminated && packet_not_very_much_data_to_write())
274 if (max_time_milliseconds == 0) 275 if (max_time_milliseconds == 0)
275 max_time_milliseconds = 100; 276 max_time_milliseconds = 100;
276 277
diff --git a/ssh-add.1 b/ssh-add.1
index 0ab93dc67..cbcca4718 100644
--- a/ssh-add.1
+++ b/ssh-add.1
@@ -9,7 +9,7 @@
9.\" 9.\"
10.\" Created: Sat Apr 22 23:55:14 1995 ylo 10.\" Created: Sat Apr 22 23:55:14 1995 ylo
11.\" 11.\"
12.\" $Id: ssh-add.1,v 1.3 1999/10/28 23:15:49 damien Exp $ 12.\" $Id: ssh-add.1,v 1.4 1999/11/17 06:29:08 damien Exp $
13.\" 13.\"
14.Dd September 25, 1999 14.Dd September 25, 1999
15.Dt SSH-ADD 1 15.Dt SSH-ADD 1
@@ -19,7 +19,7 @@
19.Nd adds identities for the authentication agent 19.Nd adds identities for the authentication agent
20.Sh SYNOPSIS 20.Sh SYNOPSIS
21.Nm ssh-add 21.Nm ssh-add
22.Op Fl ldD 22.Op Fl lLdD
23.Op Ar 23.Op Ar
24.Sh DESCRIPTION 24.Sh DESCRIPTION
25.Nm 25.Nm
@@ -41,7 +41,9 @@ to work.
41The options are as follows: 41The options are as follows:
42.Bl -tag -width Ds 42.Bl -tag -width Ds
43.It Fl l 43.It Fl l
44Lists all identities currently represented by the agent. 44Lists fingerprints of all identities currently represented by the agent.
45.It Fl L
46Lists public key parameters of all identities currently represented by the agent.
45.It Fl d 47.It Fl d
46Instead of adding the identity, removes the identity from the agent. 48Instead of adding the identity, removes the identity from the agent.
47.It Fl D 49.It Fl D
diff --git a/ssh-add.c b/ssh-add.c
index 2a0f0de98..cdd5ca1d0 100644
--- a/ssh-add.c
+++ b/ssh-add.c
@@ -14,12 +14,13 @@ Adds an identity to the authentication server, or removes an identity.
14*/ 14*/
15 15
16#include "includes.h" 16#include "includes.h"
17RCSID("$Id: ssh-add.c,v 1.9 1999/11/16 02:37:16 damien Exp $"); 17RCSID("$Id: ssh-add.c,v 1.10 1999/11/17 06:29:08 damien Exp $");
18 18
19#include "rsa.h" 19#include "rsa.h"
20#include "ssh.h" 20#include "ssh.h"
21#include "xmalloc.h" 21#include "xmalloc.h"
22#include "authfd.h" 22#include "authfd.h"
23#include "fingerprint.h"
23 24
24#ifdef USE_EXTERNAL_ASKPASS 25#ifdef USE_EXTERNAL_ASKPASS
25int askpass(const char *filename, RSA *key, const char *saved_comment, char **comment); 26int askpass(const char *filename, RSA *key, const char *saved_comment, char **comment);
@@ -115,7 +116,6 @@ add_file(AuthenticationConnection *ac, const char *filename)
115 xfree(pass); 116 xfree(pass);
116 if (success) 117 if (success)
117 break; 118 break;
118
119 printf("Bad passphrase.\n"); 119 printf("Bad passphrase.\n");
120 } 120 }
121 } 121 }
@@ -130,7 +130,7 @@ add_file(AuthenticationConnection *ac, const char *filename)
130} 130}
131 131
132void 132void
133list_identities(AuthenticationConnection *ac) 133list_identities(AuthenticationConnection *ac, int fp)
134{ 134{
135 BIGNUM *e, *n; 135 BIGNUM *e, *n;
136 int status; 136 int status;
@@ -144,21 +144,25 @@ list_identities(AuthenticationConnection *ac)
144 status; 144 status;
145 status = ssh_get_next_identity(ac, e, n, &comment)) 145 status = ssh_get_next_identity(ac, e, n, &comment))
146 { 146 {
147 char *ebuf, *nbuf; 147 unsigned int bits = BN_num_bits(n);
148 had_identities = 1; 148 had_identities = 1;
149 ebuf = BN_bn2dec(e); 149 if (fp) {
150 if (ebuf == NULL) { 150 printf("%d %s %s\n", bits, fingerprint(e, n), comment);
151 error("list_identities: BN_bn2dec(e) failed."); 151 } else {
152 }else{ 152 char *ebuf, *nbuf;
153 nbuf = BN_bn2dec(n); 153 ebuf = BN_bn2dec(e);
154 if (nbuf == NULL) { 154 if (ebuf == NULL) {
155 error("list_identities: BN_bn2dec(n) failed."); 155 error("list_identities: BN_bn2dec(e) failed.");
156 }else{ 156 }else{
157 unsigned int bits = BN_num_bits(n); 157 nbuf = BN_bn2dec(n);
158 printf("%d %s %s %s\n", bits, ebuf, nbuf, comment); 158 if (nbuf == NULL) {
159 free(nbuf); 159 error("list_identities: BN_bn2dec(n) failed.");
160 } 160 }else{
161 free(ebuf); 161 printf("%d %s %s %s\n", bits, ebuf, nbuf, comment);
162 free(nbuf);
163 }
164 free(ebuf);
165 }
162 } 166 }
163 xfree(comment); 167 xfree(comment);
164 } 168 }
@@ -180,6 +184,7 @@ main(int argc, char **argv)
180 184
181 /* check if RSA support exists */ 185 /* check if RSA support exists */
182 if (rsa_alive() == 0) { 186 if (rsa_alive() == 0) {
187 extern char *__progname;
183 188
184 fprintf(stderr, 189 fprintf(stderr,
185 "%s: no RSA support in libssl and libcrypto. See ssl(8).\n", 190 "%s: no RSA support in libssl and libcrypto. See ssl(8).\n",
@@ -196,9 +201,10 @@ main(int argc, char **argv)
196 201
197 for (i = 1; i < argc; i++) 202 for (i = 1; i < argc; i++)
198 { 203 {
199 if (strcmp(argv[i], "-l") == 0) 204 if ((strcmp(argv[i], "-l") == 0) ||
205 (strcmp(argv[i], "-L") == 0))
200 { 206 {
201 list_identities(ac); 207 list_identities(ac, argv[i][1] == 'l' ? 1 : 0);
202 no_files = 0; /* Don't default-add/delete if -l. */ 208 no_files = 0; /* Don't default-add/delete if -l. */
203 continue; 209 continue;
204 } 210 }
diff --git a/ssh-agent.1 b/ssh-agent.1
index 3fef3a479..f8084e299 100644
--- a/ssh-agent.1
+++ b/ssh-agent.1
@@ -1,11 +1,11 @@
1.\" $OpenBSD: ssh-agent.1,v 1.7 1999/10/28 08:43:10 markus Exp $ 1.\" $OpenBSD: ssh-agent.1,v 1.8 1999/11/16 23:59:21 deraadt Exp $
2.\" 2.\"
3.\" -*- nroff -*- 3.\" -*- nroff -*-
4.\" 4.\"
5.\" ssh-agent.1 5.\" ssh-agent.1
6.\" 6.\"
7.\" Author: Tatu Ylonen <ylo@cs.hut.fi> 7.\" Author: Tatu Ylonen <ylo@cs.hut.fi>
8pp.\" 8.\"
9.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 9.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
10.\" All rights reserved 10.\" All rights reserved
11.\" 11.\"
diff --git a/ssh-keygen.1 b/ssh-keygen.1
index dd01e63df..6975ef9ef 100644
--- a/ssh-keygen.1
+++ b/ssh-keygen.1
@@ -9,7 +9,7 @@
9.\" 9.\"
10.\" Created: Sat Apr 22 23:55:14 1995 ylo 10.\" Created: Sat Apr 22 23:55:14 1995 ylo
11.\" 11.\"
12.\" $Id: ssh-keygen.1,v 1.4 1999/11/15 12:33:56 damien Exp $ 12.\" $Id: ssh-keygen.1,v 1.5 1999/11/17 06:29:08 damien Exp $
13.\" 13.\"
14.Dd September 25, 1999 14.Dd September 25, 1999
15.Dt SSH-KEYGEN 1 15.Dt SSH-KEYGEN 1
@@ -23,14 +23,20 @@
23.Op Fl b Ar bits 23.Op Fl b Ar bits
24.Op Fl N Ar new_passphrase 24.Op Fl N Ar new_passphrase
25.Op Fl C Ar comment 25.Op Fl C Ar comment
26.Op Fl f Ar keyfile
26.Nm ssh-keygen 27.Nm ssh-keygen
27.Fl p 28.Fl p
28.Op Fl P Ar old_passphrase 29.Op Fl P Ar old_passphrase
29.Op Fl N Ar new_passphrase 30.Op Fl N Ar new_passphrase
31.Op Fl f Ar keyfile
30.Nm ssh-keygen 32.Nm ssh-keygen
31.Fl c 33.Fl c
32.Op Fl P Ar passphrase 34.Op Fl P Ar passphrase
33.Op Fl C Ar comment 35.Op Fl C Ar comment
36.Op Fl f Ar keyfile
37.Nm ssh-keygen
38.Fl l
39.Op Fl f Ar keyfile
34.Sh DESCRIPTION 40.Sh DESCRIPTION
35.Nm 41.Nm
36generates and manages authentication keys for 42generates and manages authentication keys for
@@ -79,6 +85,10 @@ default is 1024 bits.
79Requests changing the comment in the private and public key files. 85Requests changing the comment in the private and public key files.
80The program will prompt for the file containing the private keys, for 86The program will prompt for the file containing the private keys, for
81passphrase if the key has one, and for the new comment. 87passphrase if the key has one, and for the new comment.
88.It Fl f
89Specifies the filename of the key file.
90.It Fl l
91Show fingerprint of specified private or public key file.
82.It Fl p 92.It Fl p
83Requests changing the passphrase of a private key file instead of 93Requests changing the passphrase of a private key file instead of
84creating a new private key. The program will prompt for the file 94creating a new private key. The program will prompt for the file
diff --git a/ssh-keygen.c b/ssh-keygen.c
index 10289cab7..deb08dd96 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -14,11 +14,12 @@ Identity and host key generation and maintenance.
14*/ 14*/
15 15
16#include "includes.h" 16#include "includes.h"
17RCSID("$Id: ssh-keygen.c,v 1.4 1999/11/15 06:10:57 damien Exp $"); 17RCSID("$Id: ssh-keygen.c,v 1.5 1999/11/17 06:29:08 damien Exp $");
18 18
19#include "rsa.h" 19#include "rsa.h"
20#include "ssh.h" 20#include "ssh.h"
21#include "xmalloc.h" 21#include "xmalloc.h"
22#include "fingerprint.h"
22 23
23#ifdef HAVE___PROGNAME 24#ifdef HAVE___PROGNAME
24extern char *__progname; 25extern char *__progname;
@@ -46,6 +47,9 @@ int change_comment = 0;
46 47
47int quiet = 0; 48int quiet = 0;
48 49
50/* Flag indicating that we just want to see the key fingerprint */
51int print_fingerprint = 0;
52
49/* This is set to the identity file name if given on the command line. */ 53/* This is set to the identity file name if given on the command line. */
50char *identity_file = NULL; 54char *identity_file = NULL;
51 55
@@ -61,42 +65,101 @@ char *identity_comment = NULL;
61/* Perform changing a passphrase. The argument is the passwd structure 65/* Perform changing a passphrase. The argument is the passwd structure
62 for the current user. */ 66 for the current user. */
63 67
64void 68char *
65do_change_passphrase(struct passwd *pw) 69get_filename(struct passwd *pw, const char *prompt)
66{ 70{
67 char buf[1024], *comment; 71 char buf[1024], default_file[1024];
68 char *old_passphrase, *passphrase1, *passphrase2;
69 struct stat st;
70 RSA *private_key;
71 72
72 /* Read key file name. */ 73 /* Read key file name. */
73 if (identity_file != NULL) { 74 if (identity_file != NULL) {
74 strncpy(buf, identity_file, sizeof(buf)); 75 return xstrdup(identity_file);
75 buf[sizeof(buf) - 1] = '\0';
76 } else { 76 } else {
77 printf("Enter file in which the key is ($HOME/%s): ", SSH_CLIENT_IDENTITY); 77 snprintf(default_file, sizeof default_file, "%s/%s",
78 pw->pw_dir, SSH_CLIENT_IDENTITY);
79 printf("%s (%s): ", prompt, default_file);
78 fflush(stdout); 80 fflush(stdout);
79 if (fgets(buf, sizeof(buf), stdin) == NULL) 81 if (fgets(buf, sizeof(buf), stdin) == NULL)
80 exit(1); 82 exit(1);
81 if (strchr(buf, '\n')) 83 if (strchr(buf, '\n'))
82 *strchr(buf, '\n') = 0; 84 *strchr(buf, '\n') = 0;
83 if (strcmp(buf, "") == 0) 85 if (strcmp(buf, "") == 0)
84 snprintf(buf, sizeof buf, "%s/%s", pw->pw_dir, SSH_CLIENT_IDENTITY); 86 return xstrdup(default_file);
85 } 87 }
88 return xstrdup(buf);
89}
86 90
91void
92do_fingerprint(struct passwd *pw)
93{
94 char *file, *comment;
95 RSA *public_key;
96 struct stat st;
97
98 file = get_filename(pw, "Enter file in which the key is");
99 if (stat(file, &st) < 0)
100 {
101 perror(file);
102 exit(1);
103 }
104 public_key = RSA_new();
105 if (!load_public_key(file, public_key, &comment)) {
106 char *cp, line[1024];
107 BIGNUM *e, *n;
108 int dummy, invalid = 0;
109 FILE *f = fopen(file, "r");
110 n = BN_new();
111 e = BN_new();
112 if (f && fgets(line, sizeof(line), f)) {
113 cp = line;
114 line[strlen(line)-1] = '\0';
115 if (auth_rsa_read_key(&cp, &dummy, e, n)) {
116 public_key->e = e;
117 public_key->n = n;
118 comment = xstrdup(cp ? cp : "no comment");
119 } else {
120 invalid = 1;
121 }
122 } else {
123 invalid = 1;
124 }
125 if (invalid) {
126 printf("%s is not a valid key file.\n", file);
127 BN_free(e);
128 BN_free(n);
129 exit(1);
130 }
131 }
132
133 printf("%d %s %s\n", BN_num_bits(public_key->n),
134 fingerprint(public_key->e, public_key->n),
135 comment);
136 RSA_free(public_key);
137 exit(0);
138}
139
140
141void
142do_change_passphrase(struct passwd *pw)
143{
144 char *file, *comment;
145 char *old_passphrase, *passphrase1, *passphrase2;
146 struct stat st;
147 RSA *private_key;
148
149 file = get_filename(pw, "Enter file in which the key is");
87 /* Check if the file exists. */ 150 /* Check if the file exists. */
88 if (stat(buf, &st) < 0) 151 if (stat(file, &st) < 0)
89 { 152 {
90 perror(buf); 153 perror(file);
91 exit(1); 154 exit(1);
92 } 155 }
93 156
94 /* Try to load the public key from the file the verify that it is 157 /* Try to load the public key from the file the verify that it is
95 readable and of the proper format. */ 158 readable and of the proper format. */
96 public_key = RSA_new(); 159 public_key = RSA_new();
97 if (!load_public_key(buf, public_key, NULL)) 160 if (!load_public_key(file, public_key, NULL))
98 { 161 {
99 printf("%s is not a valid key file.\n", buf); 162 printf("%s is not a valid key file.\n", file);
100 exit(1); 163 exit(1);
101 } 164 }
102 /* Clear the public key since we are just about to load the whole file. */ 165 /* Clear the public key since we are just about to load the whole file. */
@@ -104,14 +167,14 @@ do_change_passphrase(struct passwd *pw)
104 167
105 /* Try to load the file with empty passphrase. */ 168 /* Try to load the file with empty passphrase. */
106 private_key = RSA_new(); 169 private_key = RSA_new();
107 if (!load_private_key(buf, "", private_key, &comment)) { 170 if (!load_private_key(file, "", private_key, &comment)) {
108 /* Read passphrase from the user. */ 171 /* Read passphrase from the user. */
109 if (identity_passphrase) 172 if (identity_passphrase)
110 old_passphrase = xstrdup(identity_passphrase); 173 old_passphrase = xstrdup(identity_passphrase);
111 else 174 else
112 old_passphrase = read_passphrase("Enter old passphrase: ", 1); 175 old_passphrase = read_passphrase("Enter old passphrase: ", 1);
113 /* Try to load using the passphrase. */ 176 /* Try to load using the passphrase. */
114 if (!load_private_key(buf, old_passphrase, private_key, &comment)) 177 if (!load_private_key(file, old_passphrase, private_key, &comment))
115 { 178 {
116 memset(old_passphrase, 0, strlen(old_passphrase)); 179 memset(old_passphrase, 0, strlen(old_passphrase));
117 xfree(old_passphrase); 180 xfree(old_passphrase);
@@ -152,10 +215,10 @@ do_change_passphrase(struct passwd *pw)
152 } 215 }
153 216
154 /* Save the file using the new passphrase. */ 217 /* Save the file using the new passphrase. */
155 if (!save_private_key(buf, passphrase1, private_key, comment)) 218 if (!save_private_key(file, passphrase1, private_key, comment))
156 { 219 {
157 printf("Saving the key failed: %s: %s.\n", 220 printf("Saving the key failed: %s: %s.\n",
158 buf, strerror(errno)); 221 file, strerror(errno));
159 memset(passphrase1, 0, strlen(passphrase1)); 222 memset(passphrase1, 0, strlen(passphrase1));
160 xfree(passphrase1); 223 xfree(passphrase1);
161 RSA_free(private_key); 224 RSA_free(private_key);
@@ -177,51 +240,33 @@ do_change_passphrase(struct passwd *pw)
177void 240void
178do_change_comment(struct passwd *pw) 241do_change_comment(struct passwd *pw)
179{ 242{
180 char buf[1024], new_comment[1024], *comment; 243 char new_comment[1024], *file, *comment;
181 RSA *private_key; 244 RSA *private_key;
182 char *passphrase; 245 char *passphrase;
183 struct stat st; 246 struct stat st;
184 FILE *f; 247 FILE *f;
185 char *tmpbuf; 248 char *tmpbuf;
186 249
187 /* Read key file name. */ 250 file = get_filename(pw, "Enter file in which the key is");
188 if (identity_file)
189 {
190 strncpy(buf, identity_file, sizeof(buf));
191 buf[sizeof(buf) - 1] = '\0';
192 }
193 else
194 {
195 printf("Enter file in which the key is ($HOME/%s): ",
196 SSH_CLIENT_IDENTITY);
197 fflush(stdout);
198 if (fgets(buf, sizeof(buf), stdin) == NULL)
199 exit(1);
200 if (strchr(buf, '\n'))
201 *strchr(buf, '\n') = 0;
202 if (strcmp(buf, "") == 0)
203 snprintf(buf, sizeof buf, "%s/%s", pw->pw_dir, SSH_CLIENT_IDENTITY);
204 }
205
206 /* Check if the file exists. */ 251 /* Check if the file exists. */
207 if (stat(buf, &st) < 0) 252 if (stat(file, &st) < 0)
208 { 253 {
209 perror(buf); 254 perror(file);
210 exit(1); 255 exit(1);
211 } 256 }
212 257
213 /* Try to load the public key from the file the verify that it is 258 /* Try to load the public key from the file the verify that it is
214 readable and of the proper format. */ 259 readable and of the proper format. */
215 public_key = RSA_new(); 260 public_key = RSA_new();
216 if (!load_public_key(buf, public_key, NULL)) 261 if (!load_public_key(file, public_key, NULL))
217 { 262 {
218 printf("%s is not a valid key file.\n", buf); 263 printf("%s is not a valid key file.\n", file);
219 exit(1); 264 exit(1);
220 } 265 }
221 266
222 private_key = RSA_new(); 267 private_key = RSA_new();
223 /* Try to load the file with empty passphrase. */ 268 /* Try to load the file with empty passphrase. */
224 if (load_private_key(buf, "", private_key, &comment)) 269 if (load_private_key(file, "", private_key, &comment))
225 passphrase = xstrdup(""); 270 passphrase = xstrdup("");
226 else 271 else
227 { 272 {
@@ -234,7 +279,7 @@ do_change_comment(struct passwd *pw)
234 else 279 else
235 passphrase = read_passphrase("Enter passphrase: ", 1); 280 passphrase = read_passphrase("Enter passphrase: ", 1);
236 /* Try to load using the passphrase. */ 281 /* Try to load using the passphrase. */
237 if (!load_private_key(buf, passphrase, private_key, &comment)) 282 if (!load_private_key(file, passphrase, private_key, &comment))
238 { 283 {
239 memset(passphrase, 0, strlen(passphrase)); 284 memset(passphrase, 0, strlen(passphrase));
240 xfree(passphrase); 285 xfree(passphrase);
@@ -246,8 +291,7 @@ do_change_comment(struct passwd *pw)
246 291
247 if (identity_comment) 292 if (identity_comment)
248 { 293 {
249 strncpy(new_comment, identity_comment, sizeof(new_comment)); 294 strlcpy(new_comment, identity_comment, sizeof(new_comment));
250 new_comment[sizeof(new_comment) - 1] = '\0';
251 } 295 }
252 else 296 else
253 { 297 {
@@ -266,10 +310,10 @@ do_change_comment(struct passwd *pw)
266 } 310 }
267 311
268 /* Save the file using the new passphrase. */ 312 /* Save the file using the new passphrase. */
269 if (!save_private_key(buf, passphrase, private_key, new_comment)) 313 if (!save_private_key(file, passphrase, private_key, new_comment))
270 { 314 {
271 printf("Saving the key failed: %s: %s.\n", 315 printf("Saving the key failed: %s: %s.\n",
272 buf, strerror(errno)); 316 file, strerror(errno));
273 memset(passphrase, 0, strlen(passphrase)); 317 memset(passphrase, 0, strlen(passphrase));
274 xfree(passphrase); 318 xfree(passphrase);
275 RSA_free(private_key); 319 RSA_free(private_key);
@@ -284,11 +328,11 @@ do_change_comment(struct passwd *pw)
284 328
285 /* Save the public key in text format in a file with the same name but 329 /* Save the public key in text format in a file with the same name but
286 .pub appended. */ 330 .pub appended. */
287 strcat(buf, ".pub"); 331 strcat(file, ".pub");
288 f = fopen(buf, "w"); 332 f = fopen(file, "w");
289 if (!f) 333 if (!f)
290 { 334 {
291 printf("Could not save your public key in %s\n", buf); 335 printf("Could not save your public key in %s\n", file);
292 exit(1); 336 exit(1);
293 } 337 }
294 fprintf(f, "%d ", BN_num_bits(public_key->n)); 338 fprintf(f, "%d ", BN_num_bits(public_key->n));
@@ -313,7 +357,7 @@ main(int ac, char **av)
313{ 357{
314 char buf[16384], buf2[1024], *passphrase1, *passphrase2; 358 char buf[16384], buf2[1024], *passphrase1, *passphrase2;
315 struct passwd *pw; 359 struct passwd *pw;
316 char *tmpbuf; 360 char *file, *tmpbuf;
317 int opt; 361 int opt;
318 struct stat st; 362 struct stat st;
319 FILE *f; 363 FILE *f;
@@ -323,6 +367,7 @@ main(int ac, char **av)
323 367
324 /* check if RSA support exists */ 368 /* check if RSA support exists */
325 if (rsa_alive() == 0) { 369 if (rsa_alive() == 0) {
370 extern char *__progname;
326 371
327 fprintf(stderr, 372 fprintf(stderr,
328 "%s: no RSA support in libssl and libcrypto. See ssl(8).\n", 373 "%s: no RSA support in libssl and libcrypto. See ssl(8).\n",
@@ -345,7 +390,7 @@ main(int ac, char **av)
345 error("Could not create directory '%s'.", buf); 390 error("Could not create directory '%s'.", buf);
346 391
347 /* Parse command line arguments. */ 392 /* Parse command line arguments. */
348 while ((opt = getopt(ac, av, "qpcb:f:P:N:C:")) != EOF) 393 while ((opt = getopt(ac, av, "qpclb:f:P:N:C:")) != EOF)
349 { 394 {
350 switch (opt) 395 switch (opt)
351 { 396 {
@@ -358,6 +403,10 @@ main(int ac, char **av)
358 } 403 }
359 break; 404 break;
360 405
406 case 'l':
407 print_fingerprint = 1;
408 break;
409
361 case 'p': 410 case 'p':
362 change_passphrase = 1; 411 change_passphrase = 1;
363 break; 412 break;
@@ -404,6 +453,9 @@ main(int ac, char **av)
404 exit(1); 453 exit(1);
405 } 454 }
406 455
456 if (print_fingerprint)
457 do_fingerprint(pw);
458
407 /* If the user requested to change the passphrase, do it now. This 459 /* If the user requested to change the passphrase, do it now. This
408 function never returns. */ 460 function never returns. */
409 if (change_passphrase) 461 if (change_passphrase)
@@ -426,29 +478,12 @@ main(int ac, char **av)
426 478
427 ask_file_again: 479 ask_file_again:
428 480
429 /* Ask for a file to save the key in. */ 481 file = get_filename(pw, "Enter file in which to save the key");
430 if (identity_file)
431 {
432 strncpy(buf, identity_file, sizeof(buf));
433 buf[sizeof(buf) - 1] = '\0';
434 }
435 else
436 {
437 printf("Enter file in which to save the key ($HOME/%s): ",
438 SSH_CLIENT_IDENTITY);
439 fflush(stdout);
440 if (fgets(buf, sizeof(buf), stdin) == NULL)
441 exit(1);
442 if (strchr(buf, '\n'))
443 *strchr(buf, '\n') = 0;
444 if (strcmp(buf, "") == 0)
445 snprintf(buf, sizeof buf, "%s/%s", pw->pw_dir, SSH_CLIENT_IDENTITY);
446 }
447 482
448 /* If the file aready exists, ask the user to confirm. */ 483 /* If the file aready exists, ask the user to confirm. */
449 if (stat(buf, &st) >= 0) 484 if (stat(file, &st) >= 0)
450 { 485 {
451 printf("%s already exists.\n", buf); 486 printf("%s already exists.\n", file);
452 printf("Overwrite (y/n)? "); 487 printf("Overwrite (y/n)? ");
453 fflush(stdout); 488 fflush(stdout);
454 if (fgets(buf2, sizeof(buf2), stdin) == NULL) 489 if (fgets(buf2, sizeof(buf2), stdin) == NULL)
@@ -501,12 +536,13 @@ main(int ac, char **av)
501 } 536 }
502 537
503 /* Save the key with the given passphrase and comment. */ 538 /* Save the key with the given passphrase and comment. */
504 if (!save_private_key(buf, passphrase1, private_key, buf2)) 539 if (!save_private_key(file, passphrase1, private_key, buf2))
505 { 540 {
506 printf("Saving the key failed: %s: %s.\n", 541 printf("Saving the key failed: %s: %s.\n",
507 buf, strerror(errno)); 542 file, strerror(errno));
508 memset(passphrase1, 0, strlen(passphrase1)); 543 memset(passphrase1, 0, strlen(passphrase1));
509 xfree(passphrase1); 544 xfree(passphrase1);
545 xfree(file);
510 goto ask_file_again; 546 goto ask_file_again;
511 } 547 }
512 /* Clear the passphrase. */ 548 /* Clear the passphrase. */
@@ -518,7 +554,7 @@ main(int ac, char **av)
518 arc4random_stir(); 554 arc4random_stir();
519 555
520 if (!quiet) 556 if (!quiet)
521 printf("Your identification has been saved in %s.\n", buf); 557 printf("Your identification has been saved in %s.\n", file);
522 558
523 /* Display the public key on the screen. */ 559 /* Display the public key on the screen. */
524 if (!quiet) { 560 if (!quiet) {
@@ -534,11 +570,11 @@ main(int ac, char **av)
534 570
535 /* Save the public key in text format in a file with the same name but 571 /* Save the public key in text format in a file with the same name but
536 .pub appended. */ 572 .pub appended. */
537 strcat(buf, ".pub"); 573 strcat(file, ".pub");
538 f = fopen(buf, "w"); 574 f = fopen(file, "w");
539 if (!f) 575 if (!f)
540 { 576 {
541 printf("Could not save your public key in %s\n", buf); 577 printf("Could not save your public key in %s\n", file);
542 exit(1); 578 exit(1);
543 } 579 }
544 fprintf(f, "%d ", BN_num_bits(public_key->n)); 580 fprintf(f, "%d ", BN_num_bits(public_key->n));
@@ -551,7 +587,7 @@ main(int ac, char **av)
551 fclose(f); 587 fclose(f);
552 588
553 if (!quiet) 589 if (!quiet)
554 printf("Your public key has been saved in %s\n", buf); 590 printf("Your public key has been saved in %s\n", file);
555 591
556 exit(0); 592 exit(0);
557} 593}
diff --git a/ssh.1 b/ssh.1
index 34a8ce96f..1cd6ad050 100644
--- a/ssh.1
+++ b/ssh.1
@@ -9,7 +9,7 @@
9.\" 9.\"
10.\" Created: Sat Apr 22 21:55:14 1995 ylo 10.\" Created: Sat Apr 22 21:55:14 1995 ylo
11.\" 11.\"
12.\" $Id: ssh.1,v 1.6 1999/11/11 06:57:40 damien Exp $ 12.\" $Id: ssh.1,v 1.7 1999/11/17 06:29:08 damien Exp $
13.\" 13.\"
14.Dd September 25, 1999 14.Dd September 25, 1999
15.Dt SSH 1 15.Dt SSH 1
@@ -962,6 +962,9 @@ supports one-time password authentication with
962The libraries described in 962The libraries described in
963.Xr ssl 8 963.Xr ssl 8
964are required for proper operation. 964are required for proper operation.
965.Pp
966OpenSSH has been created by Aaron Cambell, Bob Beck, Markus Friedl,
967Niels Provos, Theo de Raadt, and Dug Song.
965.Sh SEE ALSO 968.Sh SEE ALSO
966.Xr rlogin 1 , 969.Xr rlogin 1 ,
967.Xr rsh 1 , 970.Xr rsh 1 ,
diff --git a/sshconnect.c b/sshconnect.c
index 17c660979..be0a6c4b9 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -15,7 +15,7 @@ login (authentication) dialog.
15*/ 15*/
16 16
17#include "includes.h" 17#include "includes.h"
18RCSID("$Id: sshconnect.c,v 1.9 1999/11/16 02:37:17 damien Exp $"); 18RCSID("$Id: sshconnect.c,v 1.10 1999/11/17 06:29:08 damien Exp $");
19 19
20#ifdef HAVE_OPENSSL 20#ifdef HAVE_OPENSSL
21#include <openssl/bn.h> 21#include <openssl/bn.h>
@@ -1081,9 +1081,9 @@ void ssh_login(int host_key_valid,
1081 1081
1082 rbits = BN_num_bits(public_key->n); 1082 rbits = BN_num_bits(public_key->n);
1083 if (bits != rbits) { 1083 if (bits != rbits) {
1084 log("Warning: Server lies about size of server public key,"); 1084 log("Warning: Server lies about size of server public key: "
1085 log("Warning: this may be due to an old implementation of ssh."); 1085 "actual size is %d bits vs. announced %d.", rbits, bits);
1086 log("Warning: (actual size %d bits, announced size %d bits)", rbits, bits); 1086 log("Warning: This may be due to an old implementation of ssh.");
1087 } 1087 }
1088 1088
1089 /* Get the host key. */ 1089 /* Get the host key. */
@@ -1098,9 +1098,9 @@ void ssh_login(int host_key_valid,
1098 1098
1099 rbits = BN_num_bits(host_key->n); 1099 rbits = BN_num_bits(host_key->n);
1100 if (bits != rbits) { 1100 if (bits != rbits) {
1101 log("Warning: Server lies about size of server host key,"); 1101 log("Warning: Server lies about size of server host key: "
1102 log("Warning: this may be due to an old implementation of ssh."); 1102 "actual size is %d bits vs. announced %d.", rbits, bits);
1103 log("Warning: (actual size %d bits, announced size %d bits)", rbits, bits); 1103 log("Warning: This may be due to an old implementation of ssh.");
1104 } 1104 }
1105 1105
1106 /* Store the host key from the known host file in here 1106 /* Store the host key from the known host file in here
@@ -1205,10 +1205,12 @@ void ssh_login(int host_key_valid,
1205 fatal("No host key is known for %.200s and you have requested strict checking.", host); 1205 fatal("No host key is known for %.200s and you have requested strict checking.", host);
1206 } else if (options.strict_host_key_checking == 2) { /* The default */ 1206 } else if (options.strict_host_key_checking == 2) { /* The default */
1207 char prompt[1024]; 1207 char prompt[1024];
1208 char *fp = fingerprint(host_key->e, host_key->n);
1208 snprintf(prompt, sizeof(prompt), 1209 snprintf(prompt, sizeof(prompt),
1209 "The authenticity of host '%.200s' can't be established.\n" 1210 "The authenticity of host '%.200s' can't be established.\n"
1210 "Are you sure you want to continue connecting (yes/no)? ", 1211 "Key fingerprint is %d %s.\n"
1211 host); 1212 "Are you sure you want to continue connecting (yes/no)? ",
1213 host, BN_num_bits(host_key->n), fp);
1212 if (!read_yes_or_no(prompt, -1)) 1214 if (!read_yes_or_no(prompt, -1))
1213 fatal("Aborted by user!\n"); 1215 fatal("Aborted by user!\n");
1214 } 1216 }
diff --git a/sshd.c b/sshd.c
index a08252844..a40324cbe 100644
--- a/sshd.c
+++ b/sshd.c
@@ -18,7 +18,7 @@ agent connections.
18*/ 18*/
19 19
20#include "includes.h" 20#include "includes.h"
21RCSID("$Id: sshd.c,v 1.21 1999/11/16 02:37:17 damien Exp $"); 21RCSID("$Id: sshd.c,v 1.22 1999/11/17 06:29:08 damien Exp $");
22 22
23#include "xmalloc.h" 23#include "xmalloc.h"
24#include "rsa.h" 24#include "rsa.h"
@@ -486,35 +486,29 @@ main(int ac, char **av)
486 exit(1); 486 exit(1);
487 } 487 }
488 488
489 /* Initialize the log (it is reinitialized below in case we forked). */ 489 /* Force logging to stderr while loading the private host key
490 490 unless started from inetd */
491 if (debug_flag && !inetd_flag) 491 log_init(av0, options.log_level, options.log_facility, !inetd_flag);
492 log_stderr = 1;
493
494 log_init(av0, options.log_level, options.log_facility, log_stderr);
495 492
496 debug("sshd version %.100s", SSH_VERSION); 493 debug("sshd version %.100s", SSH_VERSION);
497 494
498 sensitive_data.host_key = RSA_new(); 495 sensitive_data.host_key = RSA_new();
496 errno = 0;
499 /* Load the host key. It must have empty passphrase. */ 497 /* Load the host key. It must have empty passphrase. */
500 if (!load_private_key(options.host_key_file, "", 498 if (!load_private_key(options.host_key_file, "",
501 sensitive_data.host_key, &comment)) 499 sensitive_data.host_key, &comment))
502 { 500 {
503 if (debug_flag) 501 error("Could not load host key: %.200s: %.100s",
504 fprintf(stderr, "Could not load host key: %s: %s\n", 502 options.host_key_file, strerror(errno));
505 options.host_key_file, strerror(errno));
506 else
507 {
508 int err = errno;
509 /* force logging */
510 log_init(av0, SYSLOG_LEVEL_DEBUG, options.log_facility, log_stderr);
511 error("Could not load host key: %.200s: %.100s",
512 options.host_key_file, strerror(err));
513 }
514 exit(1); 503 exit(1);
515 } 504 }
516 xfree(comment); 505 xfree(comment);
517 506
507 /* Initialize the log (it is reinitialized below in case we forked). */
508 if (debug_flag && !inetd_flag)
509 log_stderr = 1;
510 log_init(av0, options.log_level, options.log_facility, log_stderr);
511
518 /* If not in debugging mode, and not started from inetd, disconnect from 512 /* If not in debugging mode, and not started from inetd, disconnect from
519 the controlling terminal, and fork. The original process exits. */ 513 the controlling terminal, and fork. The original process exits. */
520 if (!debug_flag && !inetd_flag) 514 if (!debug_flag && !inetd_flag)