diff options
author | Colin Watson <cjwatson@debian.org> | 2007-06-12 16:16:35 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2007-06-12 16:16:35 +0000 |
commit | b7e40fa9da0b5491534a429dadb321eab5a77558 (patch) | |
tree | bed1da11e9f829925797aa093e379fc0b5868ecd | |
parent | 4f84beedf1005e44ff33c854abd6b711ffc0adb7 (diff) | |
parent | 086ea76990b1e6287c24b6db74adffd4605eb3b0 (diff) |
* New upstream release (closes: #395507, #397961, #420035). Important
changes not previously backported to 4.3p2:
- 4.4/4.4p1 (http://www.openssh.org/txt/release-4.4):
+ On portable OpenSSH, fix a GSSAPI authentication abort that could be
used to determine the validity of usernames on some platforms.
+ Implemented conditional configuration in sshd_config(5) using the
"Match" directive. This allows some configuration options to be
selectively overridden if specific criteria (based on user, group,
hostname and/or address) are met. So far a useful subset of
post-authentication options are supported and more are expected to
be added in future releases.
+ Add support for Diffie-Hellman group exchange key agreement with a
final hash of SHA256.
+ Added a "ForceCommand" directive to sshd_config(5). Similar to the
command="..." option accepted in ~/.ssh/authorized_keys, this forces
the execution of the specified command regardless of what the user
requested. This is very useful in conjunction with the new "Match"
option.
+ Add a "PermitOpen" directive to sshd_config(5). This mirrors the
permitopen="..." authorized_keys option, allowing fine-grained
control over the port-forwardings that a user is allowed to
establish.
+ Add optional logging of transactions to sftp-server(8).
+ ssh(1) will now record port numbers for hosts stored in
~/.ssh/known_hosts when a non-standard port has been requested
(closes: #50612).
+ Add an "ExitOnForwardFailure" option to cause ssh(1) to exit (with a
non-zero exit code) when requested port forwardings could not be
established.
+ Extend sshd_config(5) "SubSystem" declarations to allow the
specification of command-line arguments.
+ Replacement of all integer overflow susceptible invocations of
malloc(3) and realloc(3) with overflow-checking equivalents.
+ Many manpage fixes and improvements.
+ Add optional support for OpenSSL hardware accelerators (engines),
enabled using the --with-ssl-engine configure option.
+ Tokens in configuration files may be double-quoted in order to
contain spaces (closes: #319639).
+ Move a debug() call out of a SIGCHLD handler, fixing a hang when the
session exits very quickly (closes: #307890).
+ Fix some incorrect buffer allocation calculations (closes: #410599).
+ ssh-add doesn't ask for a passphrase if key file permissions are too
liberal (closes: #103677).
+ Likewise, ssh doesn't ask either (closes: #99675).
- 4.6/4.6p1 (http://www.openssh.org/txt/release-4.6):
+ sshd now allows the enabling and disabling of authentication methods
on a per user, group, host and network basis via the Match directive
in sshd_config.
+ Fixed an inconsistent check for a terminal when displaying scp
progress meter (closes: #257524).
+ Fix "hang on exit" when background processes are running at the time
of exit on a ttyful/login session (closes: #88337).
* Update to current GSSAPI patch from
http://www.sxw.org.uk/computing/patches/openssh-4.6p1-gsskex-20070312.patch;
install ChangeLog.gssapi.
287 files changed, 14093 insertions, 8260 deletions
diff --git a/.cvsignore b/.cvsignore index 98f48ff50..4244eeb3b 100644 --- a/.cvsignore +++ b/.cvsignore | |||
@@ -1,24 +1,30 @@ | |||
1 | ssh | 1 | *.out |
2 | Makefile | ||
3 | autom4te.cache | ||
4 | build-deb | ||
5 | build-deb-stamp | ||
6 | build-udeb | ||
7 | build-udeb-stamp | ||
8 | buildit.sh | ||
9 | buildpkg.sh | ||
10 | config.cache | ||
11 | config.h | ||
12 | config.log | ||
13 | config.status | ||
14 | openssh.xml | ||
15 | opensshd.init | ||
2 | scp | 16 | scp |
3 | sshd | 17 | sftp |
18 | sftp-server | ||
19 | ssh | ||
4 | ssh-add | 20 | ssh-add |
21 | ssh-agent | ||
5 | ssh-keygen | 22 | ssh-keygen |
6 | ssh-keyscan | 23 | ssh-keyscan |
7 | ssh-keysign | 24 | ssh-keysign |
8 | ssh-agent | ||
9 | sftp-server | ||
10 | sftp | ||
11 | config.h | ||
12 | config.status | ||
13 | config.cache | ||
14 | config.log | ||
15 | stamp-h.in | ||
16 | Makefile | ||
17 | ssh_prng_cmds | ||
18 | *.out | ||
19 | buildit.sh | ||
20 | ssh-rand-helper | 25 | ssh-rand-helper |
21 | build-deb | 26 | ssh_prng_cmds |
22 | build-deb-stamp | 27 | sshd |
23 | build-udeb | 28 | stamp-h.in |
24 | build-udeb-stamp | 29 | survey |
30 | survey.sh | ||
@@ -25,6 +25,7 @@ Chris, the Young One <cky@pobox.com> - Password auth fixes | |||
25 | Christos Zoulas <christos@zoulas.com> - Autoconf fixes | 25 | Christos Zoulas <christos@zoulas.com> - Autoconf fixes |
26 | Chun-Chung Chen <cjj@u.washington.edu> - RPM fixes | 26 | Chun-Chung Chen <cjj@u.washington.edu> - RPM fixes |
27 | Corinna Vinschen <vinschen@redhat.com> - Cygwin support | 27 | Corinna Vinschen <vinschen@redhat.com> - Cygwin support |
28 | Chad Mynhier <mynhier@interstel.net> - Solaris Process Contract support | ||
28 | Dan Brosemer <odin@linuxfreak.com> - Autoconf support, build fixes | 29 | Dan Brosemer <odin@linuxfreak.com> - Autoconf support, build fixes |
29 | Darren Hall <dhall@virage.org> - AIX patches | 30 | Darren Hall <dhall@virage.org> - AIX patches |
30 | Darren Tucker <dtucker@zip.com.au> - AIX BFF package scripts | 31 | Darren Tucker <dtucker@zip.com.au> - AIX BFF package scripts |
@@ -100,5 +101,5 @@ Apologies to anyone I have missed. | |||
100 | 101 | ||
101 | Damien Miller <djm@mindrot.org> | 102 | Damien Miller <djm@mindrot.org> |
102 | 103 | ||
103 | $Id: CREDITS,v 1.80 2005/08/26 20:15:20 tim Exp $ | 104 | $Id: CREDITS,v 1.81 2006/08/30 17:24:41 djm Exp $ |
104 | 105 | ||
@@ -1,13 +1,1969 @@ | |||
1 | 20060211 | 1 | 20070306 |
2 | - (dtucker) [README] Bump release notes URL. | 2 | - (djm) OpenBSD CVS Sync |
3 | - (djm) Release 4.3p2 | 3 | - jmc@cvs.openbsd.org 2007/03/01 16:19:33 |
4 | [sshd_config.5] | ||
5 | sort the `match' keywords; | ||
6 | - djm@cvs.openbsd.org 2007/03/06 10:13:14 | ||
7 | [version.h] | ||
8 | openssh-4.6; "please" deraadt@ | ||
9 | - (djm) [contrib/caldera/openssh.spec contrib/redhat/openssh.spec] | ||
10 | [contrib/suse/openssh.spec] crank spec files for release | ||
11 | - (djm) [README] correct link to release notes | ||
12 | - (djm) Release 4.6p1 | ||
13 | |||
14 | 20070304 | ||
15 | - (djm) [configure.ac] add a --without-openssl-header-check option to | ||
16 | configure, as some platforms (OS X) ship OpenSSL headers whose version | ||
17 | does not match that of the shipping library. ok dtucker@ | ||
18 | - (dtucker) [openbsd-compat/openssl-compat.h] Bug #1291: Work around a | ||
19 | bug in OpenSSL 0.9.8e that prevents aes256-ctr, aes192-ctr and arcfour256 | ||
20 | ciphers from working correctly (disconnects with "Bad packet length" | ||
21 | errors) as found by Ben Harris. ok djm@ | ||
22 | |||
23 | 20070303 | ||
24 | - (dtucker) [regress/agent-ptrace.sh] Make ttrace gdb error a little more | ||
25 | general to cover newer gdb versions on HP-UX. | ||
26 | |||
27 | 20070302 | ||
28 | - (dtucker) [configure.ac] For Cygwin, read files in textmode (which allows | ||
29 | CRLF as well as LF lineendings) and write in binary mode. Patch from | ||
30 | vinschen at redhat.com. | ||
31 | - (dtucker) [INSTALL] Update to autoconf-2.61. | ||
32 | |||
33 | 20070301 | ||
34 | - (dtucker) OpenBSD CVS Sync | ||
35 | - dtucker@cvs.openbsd.org 2007/03/01 10:28:02 | ||
36 | [auth2.c sshd_config.5 servconf.c] | ||
37 | Remove ChallengeResponseAuthentication support inside a Match | ||
38 | block as its interaction with KbdInteractive makes it difficult to | ||
39 | support. Also, relocate the CR/kbdint option special-case code into | ||
40 | servconf. "please commit" djm@, ok markus@ for the relocation. | ||
41 | - (tim) [buildpkg.sh.in openssh.xml.in] Clean up Solaris 10 smf(5) bits. | ||
42 | "Looks sane" dtucker@ | ||
43 | |||
44 | 20070228 | ||
45 | - (dtucker) OpenBSD CVS Sync | ||
46 | - dtucker@cvs.openbsd.org 2007/02/28 00:55:30 | ||
47 | [ssh-agent.c] | ||
48 | Remove expired keys periodically so they don't remain in memory when | ||
49 | the agent is entirely idle, as noted by David R. Piegdon. This is the | ||
50 | simple fix, a more efficient one will be done later. With markus, | ||
51 | deraadt, with & ok djm. | ||
52 | |||
53 | 20070225 | ||
54 | - (dtucker) OpenBSD CVS Sync | ||
55 | - djm@cvs.openbsd.org 2007/02/20 10:25:14 | ||
56 | [clientloop.c] | ||
57 | set maximum packet and window sizes the same for multiplexed clients | ||
58 | as normal connections; ok markus@ | ||
59 | - dtucker@cvs.openbsd.org 2007/02/21 11:00:05 | ||
60 | [sshd.c] | ||
61 | Clear alarm() before restarting sshd on SIGHUP. Without this, if there's | ||
62 | a SIGALRM pending (for SSH1 key regeneration) when sshd is SIGHUP'ed, the | ||
63 | newly exec'ed sshd will get the SIGALRM and not have a handler for it, | ||
64 | and the default action will terminate the listening sshd. Analysis and | ||
65 | patch from andrew at gaul.org. | ||
66 | - dtucker@cvs.openbsd.org 2007/02/22 12:58:40 | ||
67 | [servconf.c] | ||
68 | Check activep so Match and GatewayPorts work together; ok markus@ | ||
69 | - ray@cvs.openbsd.org 2007/02/24 03:30:11 | ||
70 | [moduli.c] | ||
71 | - strlen returns size_t, not int. | ||
72 | - Pass full buffer size to fgets. | ||
73 | OK djm@, millert@, and moritz@. | ||
74 | |||
75 | 20070219 | ||
76 | - (dtucker) OpenBSD CVS Sync | ||
77 | - jmc@cvs.openbsd.org 2007/01/10 13:23:22 | ||
78 | [ssh_config.5] | ||
79 | do not use a list for SYNOPSIS; | ||
80 | this is actually part of a larger report sent by eric s. raymond | ||
81 | and forwarded by brad, but i only read half of it. spotted by brad. | ||
82 | - jmc@cvs.openbsd.org 2007/01/12 20:20:41 | ||
83 | [ssh-keygen.1 ssh-keygen.c] | ||
84 | more secsh -> rfc 4716 updates; | ||
85 | spotted by wiz@netbsd | ||
86 | ok markus | ||
87 | - dtucker@cvs.openbsd.org 2007/01/17 23:22:52 | ||
88 | [readconf.c] | ||
89 | Honour activep for times (eg ServerAliveInterval) while parsing | ||
90 | ssh_config and ~/.ssh/config so they work properly with Host directives. | ||
91 | From mario.lorenz@wincor-nixdorf.com via bz #1275. ok markus@ | ||
92 | - stevesk@cvs.openbsd.org 2007/01/21 01:41:54 | ||
93 | [auth-skey.c kex.c ssh-keygen.c session.c clientloop.c] | ||
94 | spaces | ||
95 | - stevesk@cvs.openbsd.org 2007/01/21 01:45:35 | ||
96 | [readconf.c] | ||
97 | spaces | ||
98 | - djm@cvs.openbsd.org 2007/01/22 11:32:50 | ||
99 | [sftp-client.c] | ||
100 | return error from do_upload() when a write fails. fixes bz#1252: zero | ||
101 | exit status from sftp when uploading to a full device. report from | ||
102 | jirkat AT atlas.cz; ok dtucker@ | ||
103 | - djm@cvs.openbsd.org 2007/01/22 13:06:21 | ||
104 | [scp.c] | ||
105 | fix detection of whether we should show progress meter or not: scp | ||
106 | tested isatty(stderr) but wrote the progress meter to stdout. This patch | ||
107 | makes it test stdout. bz#1265 reported by junkmail AT bitsculpture.com; | ||
108 | of dtucker@ | ||
109 | - stevesk@cvs.openbsd.org 2007/02/14 14:32:00 | ||
110 | [bufbn.c] | ||
111 | typos in comments; ok jmc@ | ||
112 | - dtucker@cvs.openbsd.org 2007/02/19 10:45:58 | ||
113 | [monitor_wrap.c servconf.c servconf.h monitor.c sshd_config.5] | ||
114 | Teach Match how handle config directives that are used before | ||
115 | authentication. This allows configurations such as permitting password | ||
116 | authentication from the local net only while requiring pubkey from | ||
117 | offsite. ok djm@, man page bits ok jmc@ | ||
118 | - (dtucker) [contrib/findssl.sh] Add "which" as a shell function since some | ||
119 | platforms don't have it. Patch from dleonard at vintela.com. | ||
120 | - (dtucker) [openbsd-compat/getrrsetbyname.c] Don't attempt to calloc | ||
121 | an array for signatures when there are none since "calloc(0, n) returns | ||
122 | NULL on some platforms (eg Tru64), which is explicitly permitted by | ||
123 | POSIX. Diagnosis and patch by svallet genoscope.cns.fr. | ||
124 | |||
125 | 20070128 | ||
126 | - (djm) [channels.c serverloop.c] Fix so-called "hang on exit" (bz #52) | ||
127 | when closing a tty session when a background process still holds tty | ||
128 | fds open. Great detective work and patch by Marc Aurele La France, | ||
129 | slightly tweaked by me; ok dtucker@ | ||
130 | |||
131 | 20070123 | ||
132 | - (dtucker) [openbsd-compat/bsd-snprintf.c] Static declarations for public | ||
133 | library interfaces aren't very helpful. Fix up the DOPR_OUTCH macro | ||
134 | so it works properly and modify its callers so that they don't pre or | ||
135 | post decrement arguments that are conditionally evaluated. While there, | ||
136 | put SNPRINTF_CONST back as it prevents build failures in some | ||
137 | configurations. ok djm@ (for most of it) | ||
138 | |||
139 | 20070122 | ||
140 | - (djm) [ssh-rand-helper.8] manpage nits; | ||
141 | from dleonard AT vintela.com (bz#1529) | ||
142 | |||
143 | 20070117 | ||
144 | - (dtucker) [packet.c] Re-remove in_systm.h since it's already in includes.h | ||
145 | and multiple including it causes problems on old IRIXes. (It snuck back | ||
146 | in during a sync.) Found (again) by Georg Schwarz. | ||
147 | |||
148 | 20070114 | ||
149 | - (dtucker) [ssh-keygen.c] av -> argv to match earlier sync. | ||
150 | - (djm) [openbsd-compat/bsd-snprintf.c] Fix integer overflow in return | ||
151 | value of snprintf replacement, similar to bugs in various libc | ||
152 | implementations. This overflow is not exploitable in OpenSSH. | ||
153 | While I'm fiddling with it, make it a fair bit faster by inlining the | ||
154 | append-char routine; ok dtucker@ | ||
155 | |||
156 | 20070105 | ||
157 | - (djm) OpenBSD CVS Sync | ||
158 | - deraadt@cvs.openbsd.org 2006/11/14 19:41:04 | ||
159 | [ssh-keygen.c] | ||
160 | use argc and argv not some made up short form | ||
161 | - ray@cvs.openbsd.org 2006/11/23 01:35:11 | ||
162 | [misc.c sftp.c] | ||
163 | Don't access buf[strlen(buf) - 1] for zero-length strings. | ||
164 | ``ok by me'' djm@. | ||
165 | - markus@cvs.openbsd.org 2006/12/11 21:25:46 | ||
166 | [ssh-keygen.1 ssh.1] | ||
167 | add rfc 4716 (public key format); ok jmc | ||
168 | - djm@cvs.openbsd.org 2006/12/12 03:58:42 | ||
169 | [channels.c compat.c compat.h] | ||
170 | bz #1019: some ssh.com versions apparently can't cope with the | ||
171 | remote port forwarding bind_address being a hostname, so send | ||
172 | them an address for cases where they are not explicitly | ||
173 | specified (wildcard or localhost bind). reported by daveroth AT | ||
174 | acm.org; ok dtucker@ deraadt@ | ||
175 | - dtucker@cvs.openbsd.org 2006/12/13 08:34:39 | ||
176 | [servconf.c] | ||
177 | Make PermitOpen work with multiple values like the man pages says. | ||
178 | bz #1267 with details from peter at dmtz.com, with & ok djm@ | ||
179 | - dtucker@cvs.openbsd.org 2006/12/14 10:01:14 | ||
180 | [servconf.c] | ||
181 | Make "PermitOpen all" first-match within a block to match the way other | ||
182 | options work. ok markus@ djm@ | ||
183 | - jmc@cvs.openbsd.org 2007/01/02 09:57:25 | ||
184 | [sshd_config.5] | ||
185 | do not use lists for SYNOPSIS; | ||
186 | from eric s. raymond via brad | ||
187 | - stevesk@cvs.openbsd.org 2007/01/03 00:53:38 | ||
188 | [ssh-keygen.c] | ||
189 | remove small dead code; arnaud.lacombe.1@ulaval.ca via Coverity scan | ||
190 | - stevesk@cvs.openbsd.org 2007/01/03 03:01:40 | ||
191 | [auth2-chall.c channels.c dns.c sftp.c ssh-keygen.c ssh.c] | ||
192 | spaces | ||
193 | - stevesk@cvs.openbsd.org 2007/01/03 04:09:15 | ||
194 | [sftp.c] | ||
195 | ARGSUSED for lint | ||
196 | - stevesk@cvs.openbsd.org 2007/01/03 07:22:36 | ||
197 | [sftp-server.c] | ||
198 | spaces | ||
199 | |||
200 | 20061205 | ||
201 | - (djm) [auth.c] Fix NULL pointer dereference in fakepw(). Crash would | ||
202 | occur if the server did not have the privsep user and an invalid user | ||
203 | tried to login and both privsep and krb5 auth are disabled; ok dtucker@ | ||
204 | - (djm) [bsd-asprintf.c] Better test for bad vsnprintf lengths; ok dtucker@ | ||
205 | |||
206 | 20061108 | ||
207 | - (dtucker) OpenBSD CVS Sync | ||
208 | - markus@cvs.openbsd.org 2006/11/07 13:02:07 | ||
209 | [dh.c] | ||
210 | BN_hex2bn returns int; from dtucker@ | ||
211 | |||
212 | 20061107 | ||
213 | - (dtucker) [sshd.c] Use privsep_pw if we have it, but only require it | ||
214 | if we absolutely need it. Pointed out by Corinna, ok djm@ | ||
215 | - (dtucker) OpenBSD CVS Sync | ||
216 | - markus@cvs.openbsd.org 2006/11/06 21:25:28 | ||
217 | [auth-rsa.c kexgexc.c kexdhs.c key.c ssh-dss.c sshd.c kexgexs.c | ||
218 | ssh-keygen.c bufbn.c moduli.c scard.c kexdhc.c sshconnect1.c dh.c rsa.c] | ||
219 | add missing checks for openssl return codes; with & ok djm@ | ||
220 | - markus@cvs.openbsd.org 2006/11/07 10:31:31 | ||
221 | [monitor.c version.h] | ||
222 | correctly check for bad signatures in the monitor, otherwise the monitor | ||
223 | and the unpriv process can get out of sync. with dtucker@, ok djm@, | ||
224 | dtucker@ | ||
225 | - (dtucker) [README contrib/{caldera,redhat,contrib}/openssh.spec] Bump | ||
226 | versions. | ||
227 | - (dtucker) Release 4.5p1. | ||
228 | |||
229 | 20061105 | ||
230 | - (djm) OpenBSD CVS Sync | ||
231 | - otto@cvs.openbsd.org 2006/10/28 18:08:10 | ||
232 | [ssh.1] | ||
233 | correct/expand example of usage of -w; ok jmc@ stevesk@ | ||
234 | - markus@cvs.openbsd.org 2006/10/31 16:33:12 | ||
235 | [kexdhc.c kexdhs.c kexgexc.c kexgexs.c] | ||
236 | check DH_compute_key() for -1 even if it should not happen because of | ||
237 | earlier calls to dh_pub_is_valid(); report krahmer at suse.de; ok djm | ||
238 | |||
239 | 20061101 | ||
240 | - (dtucker) [openbsd-compat/port-solaris.c] Bug #1255: Make only hwerr | ||
241 | events fatal in Solaris process contract support and tell it to signal | ||
242 | only processes in the same process group when something happens. | ||
243 | Based on information from andrew.benham at thus.net and similar to | ||
244 | a patch from Chad Mynhier. ok djm@ | ||
245 | |||
246 | 20061027 | ||
247 | - (djm) [auth.c] gc some dead code | ||
248 | |||
249 | 20061023 | ||
250 | - (djm) OpenBSD CVS Sync | ||
251 | - ray@cvs.openbsd.org 2006/09/30 17:48:22 | ||
252 | [sftp.c] | ||
253 | Clear errno before calling the strtol functions. | ||
254 | From Paul Stoeber <x0001 at x dot de1 dot cc>. | ||
255 | OK deraadt@. | ||
256 | - djm@cvs.openbsd.org 2006/10/06 02:29:19 | ||
257 | [ssh-agent.c ssh-keyscan.c ssh.c] | ||
258 | sys/resource.h needs sys/time.h; prompted by brad@ | ||
259 | (NB. Id sync only for portable) | ||
260 | - djm@cvs.openbsd.org 2006/10/09 23:36:11 | ||
261 | [session.c] | ||
262 | xmalloc -> xcalloc that was missed previously, from portable | ||
263 | (NB. Id sync only for portable, obviously) | ||
264 | - markus@cvs.openbsd.org 2006/10/10 10:12:45 | ||
265 | [sshconnect.c] | ||
266 | sleep before retrying (not after) since sleep changes errno; fixes | ||
267 | pr 5250; rad@twig.com; ok dtucker djm | ||
268 | - markus@cvs.openbsd.org 2006/10/11 12:38:03 | ||
269 | [clientloop.c serverloop.c] | ||
270 | exit instead of doing a blocking tcp send if we detect a client/server | ||
271 | timeout, since the tcp sendqueue might be already full (of alive | ||
272 | requests); ok dtucker, report mpf | ||
273 | - djm@cvs.openbsd.org 2006/10/22 02:25:50 | ||
274 | [sftp-client.c] | ||
275 | cancel progress meter when upload write fails; ok deraadt@ | ||
276 | - (tim) [Makefile.in scard/Makefile.in] Add datarootdir= lines to keep | ||
277 | autoconf 2.60 from complaining. | ||
278 | |||
279 | 20061018 | ||
280 | - (dtucker) OpenBSD CVS Sync | ||
281 | - ray@cvs.openbsd.org 2006/09/25 04:55:38 | ||
282 | [ssh-keyscan.1 ssh.1] | ||
283 | Change "a SSH" to "an SSH". Hurray, I'm not the only one who | ||
284 | pronounces "SSH" as "ess-ess-aich". | ||
285 | OK jmc@ and stevesk@. | ||
286 | - (dtucker) [sshd.c] Reshuffle storing of pw struct; prevents warnings | ||
287 | on older versions of OS X. ok djm@ | ||
288 | |||
289 | 20061016 | ||
290 | - (dtucker) [monitor_fdpass.c] Include sys/in.h, required for cmsg macros | ||
291 | on older (2.0) Linuxes. Based on patch from thmo-13 at gmx de. | ||
292 | |||
293 | 20061006 | ||
294 | - (tim) [buildpkg.sh.in] Use uname -r instead of -v in OS_VER for Solaris. | ||
295 | Differentiate between OpenServer 5 and OpenServer 6 | ||
296 | - (dtucker) [configure.ac] Set put -lselinux into $LIBS while testing for | ||
297 | SELinux functions so they're detected correctly. Patch from pebenito at | ||
298 | gentoo.org. | ||
299 | - (tim) [buildpkg.sh.in] Some systems have really limited nawk (OpenServer). | ||
300 | Allow setting alternate awk in openssh-config.local. | ||
301 | |||
302 | 20061003 | ||
303 | - (tim) [configure.ac] Move CHECK_HEADERS test before platform specific | ||
304 | section so additional platform specific CHECK_HEADER tests will work | ||
305 | correctly. Fixes "<net/if_tap.h> on FreeBSD" problem report by des AT des.no | ||
306 | Feedback and "seems like a good idea" dtucker@ | ||
307 | |||
308 | 20061001 | ||
309 | - (dtucker) [audit-bsm.c] Include errno.h. Pointed out by des at des.no. | ||
310 | |||
311 | 20060929 | ||
312 | - (dtucker) [configure.ac] Bug #1239: Fix configure test for OpenSSH engine | ||
313 | support. Patch from andrew.benham at thus net. | ||
314 | |||
315 | 20060928 | ||
316 | - (dtucker) [entropy.c] Bug #1238: include signal.h to fix compilation error | ||
317 | on Solaris 8 w/out /dev/random or prngd. Patch from rl at | ||
318 | math.technion.ac.il. | ||
319 | |||
320 | 20060926 | ||
321 | - (dtucker) [bufaux.h] nuke bufaux.h; it's already gone from OpenBSD and not | ||
322 | referenced any more. ok djm@ | ||
323 | - (dtucker) [sftp-server.8] Resync; spotted by djm@ | ||
324 | - (dtucker) Release 4.4p1. | ||
325 | |||
326 | 20060924 | ||
327 | - (tim) [configure.ac] Remove CFLAGS hack for UnixWare 1.x/2.x (added | ||
328 | to rev 1.308) to work around broken gcc 2.x header file. | ||
329 | |||
330 | 20060923 | ||
331 | - (dtucker) [configure.ac] Bug #1234: Put opensc libs into $LIBS rather than | ||
332 | $LDFLAGS. Patch from vapier at gentoo org. | ||
333 | |||
334 | 20060922 | ||
335 | - (dtucker) [packet.c canohost.c] Include arpa/inet.h for htonl macros on | ||
336 | some platforms (eg HP-UX 11.00). From santhi.amirta at gmail com. | ||
337 | |||
338 | 20060921 | ||
339 | - (dtucker) OpenBSD CVS Sync | ||
340 | - otto@cvs.openbsd.org 2006/09/19 05:52:23 | ||
341 | [sftp.c] | ||
342 | Use S_IS* macros insted of masking with S_IF* flags. The latter may | ||
343 | have multiple bits set, which lead to surprising results. Spotted by | ||
344 | Paul Stoeber, more to come. ok millert@ pedro@ jaredy@ djm@ | ||
345 | - markus@cvs.openbsd.org 2006/09/19 21:14:08 | ||
346 | [packet.c] | ||
347 | client NULL deref on protocol error; Tavis Ormandy, Google Security Team | ||
348 | - (dtucker) [defines.h] Include unistd.h before defining getpgrp; fixes | ||
349 | build error on Ultrix. From Bernhard Simon. | ||
350 | |||
351 | 20060918 | ||
352 | - (dtucker) [configure.ac] On AIX, check to see if the compiler will allow | ||
353 | macro redefinitions, and if not, remove "-qlanglvl=ansi" from the flags. | ||
354 | Allows build out of the box with older VAC and XLC compilers. Found by | ||
355 | David Bronder and Bernhard Simon. | ||
356 | - (dtucker) [openbsd-compat/port-aix.{c,h}] Reduce scope of includes. | ||
357 | Prevents macro redefinition warnings of "RDONLY". | ||
358 | |||
359 | 20060916 | ||
360 | - OpenBSD CVS Sync | ||
361 | - djm@cvs.openbsd.org 2006/09/16 19:53:37 | ||
362 | [deattack.c deattack.h packet.c] | ||
363 | limit maximum work performed by the CRC compensation attack detector, | ||
364 | problem reported by Tavis Ormandy, Google Security Team; | ||
365 | ok markus@ deraadt@ | ||
366 | - (djm) Add openssh.xml to .cvsignore and sort it | ||
367 | - (dtucker) [auth-pam.c] Propogate TZ environment variable to PAM auth | ||
368 | process so that any logging it does is with the right timezone. From | ||
369 | Scott Strickler, ok djm@. | ||
370 | - (dtucker) [monitor.c] Correctly handle auditing of single commands when | ||
371 | using Protocol 1. From jhb at freebsd. | ||
372 | - (djm) [sshd.c] Fix warning/API abuse; ok dtucker@ | ||
373 | - (dtucker) [INSTALL] Add info about audit support. | ||
374 | |||
375 | 20060912 | ||
376 | - (djm) [Makefile.in buildpkg.sh.in configure.ac openssh.xml.in] | ||
377 | Support SMF in Solaris Packages if enabled by configure. Patch from | ||
378 | Chad Mynhier, tested by dtucker@ | ||
379 | |||
380 | 20060911 | ||
381 | - (dtucker) [cipher-aes.c] Include string.h for memcpy and friends. Noted | ||
382 | by Pekka Savola. | ||
383 | |||
384 | 20060910 | ||
385 | - (dtucker) [contrib/aix/buildbff.sh] Ensure that perl is available. | ||
386 | - (dtucker) [configure.ac] Add -lcrypt to let DragonFly build OOTB. | ||
387 | |||
388 | 20060909 | ||
389 | - (dtucker) [openbsd-compat/bsd-snprintf.c] Add stdarg.h. | ||
390 | - (dtucker) [contrib/aix/buildbff.sh] Always create privsep user. | ||
391 | - (dtucker) [buildpkg.sh.in] Always create privsep user. ok djm@ | ||
392 | |||
393 | 20060908 | ||
394 | - (dtucker) [auth-sia.c] Add includes required for build on Tru64. Patch | ||
395 | from Chris Adams. | ||
396 | - (dtucker) [configure.ac] The BSM header test needs time.h in some cases. | ||
397 | |||
398 | 20060907 | ||
399 | - (djm) [sshd.c auth.c] Set up fakepw() with privsep uid/gid, so it can | ||
400 | be used to drop privilege to; fixes Solaris GSSAPI crash reported by | ||
401 | Magnus Abrante; suggestion and feedback dtucker@ | ||
402 | NB. this change will require that the privilege separation user must | ||
403 | exist on all the time, not just when UsePrivilegeSeparation=yes | ||
404 | - (tim) [configure.ac] s/BROKEN_UPDWTMP/BROKEN_UPDWTMPX/ on SCO OSR6 | ||
405 | - (dtucker) [loginrec.c] Wrap paths.h in HAVE_PATHS_H. | ||
406 | - (dtucker) [regress/cfgmatch.sh] stop_client is racy, so give us a better | ||
407 | chance of winning. | ||
408 | |||
409 | 20060905 | ||
410 | - (dtucker) [configure.ac] s/AC_DEFINES/AC_DEFINE/ spotted by Roumen Petrov. | ||
411 | - (dtucker) [loginrec.c] Include paths.h for _PATH_BTMP. | ||
412 | |||
413 | 20060904 | ||
414 | - (dtucker) [configure.ac] Define BROKEN_UPDWTMP on SCO OSR6 as the native | ||
415 | updwdtmp seems to generate invalid wtmp entries. From Roger Cornelius, | ||
416 | ok djm@ | ||
417 | |||
418 | 20060903 | ||
419 | - (dtucker) [configure.ac openbsd-compat/openbsd-compat.h] Check for | ||
420 | declaration of writev(2) and declare it ourselves if necessary. Makes | ||
421 | the atomiciov() calls build on really old systems. ok djm@ | ||
422 | |||
423 | 20060902 | ||
424 | - (dtucker) [openbsd-compat/port-irix.c] Add errno.h, found by Iain Morgan. | ||
425 | - (dtucker) [ssh-keyscan.c ssh-rand-helper.c ssh.c sshconnect.c | ||
426 | openbsd-compat/bindresvport.c openbsd-compat/getrrsetbyname.c | ||
427 | openbsd-compat/port-tun.c openbsd-compat/rresvport.c] Include <arpa/inet.h> | ||
428 | for hton* and ntoh* macros. Required on (at least) HP-UX since we define | ||
429 | _XOPEN_SOURCE_EXTENDED. Found by santhi.amirta at gmail com. | ||
430 | |||
431 | 20060901 | ||
432 | - (djm) [audit-bsm.c audit.c auth-bsdauth.c auth-chall.c auth-pam.c] | ||
433 | [auth-rsa.c auth-shadow.c auth-sia.c auth1.c auth2-chall.c] | ||
434 | [auth2-gss.c auth2-kbdint.c auth2-none.c authfd.c authfile.c] | ||
435 | [cipher-3des1.c cipher-aes.c cipher-bf1.c cipher-ctr.c clientloop.c] | ||
436 | [dh.c dns.c entropy.c gss-serv-krb5.c gss-serv.c hostfile.c kex.c] | ||
437 | [kexdhc.c kexdhs.c kexgexc.c kexgexs.c key.c loginrec.c mac.c] | ||
438 | [md5crypt.c monitor.c monitor_wrap.c readconf.c rsa.c] | ||
439 | [scard-opensc.c scard.c session.c ssh-add.c ssh-agent.c ssh-dss.c] | ||
440 | [ssh-keygen.c ssh-keysign.c ssh-rsa.c ssh.c sshconnect.c] | ||
441 | [sshconnect1.c sshconnect2.c sshd.c] | ||
442 | [openbsd-compat/bsd-cray.c openbsd-compat/port-aix.c] | ||
443 | [openbsd-compat/port-linux.c openbsd-compat/port-solaris.c] | ||
444 | [openbsd-compat/port-uw.c] | ||
445 | Lots of headers for SCO OSR6, mainly adding stdarg.h for log.h; | ||
446 | compile problems reported by rac AT tenzing.org | ||
447 | - (djm) [includes.h monitor.c openbsd-compat/bindresvport.c] | ||
448 | [openbsd-compat/rresvport.c] Some more headers: netinet/in.h | ||
449 | sys/socket.h and unistd.h in various places | ||
450 | - (dtucker) [openbsd-compat/bsd-cygwin_util.c] Fix implict declaration | ||
451 | warnings for binary_open and binary_close. Patch from Corinna Vinschen. | ||
452 | - (dtucker) [configure.ac includes.h openbsd-compat/glob.{c,h}] Explicitly | ||
453 | test for GLOB_NOMATCH and use our glob functions if it's not found. | ||
454 | Stops sftp from segfaulting when attempting to get a nonexistent file on | ||
455 | Cygwin (previous versions of OpenSSH didn't use the native glob). Partly | ||
456 | from and tested by Corinna Vinschen. | ||
457 | - (dtucker) [README contrib/{caldera,redhat,suse}/openssh.spec] Crank | ||
458 | versions. | ||
459 | |||
460 | 20060831 | ||
461 | - (djm) [CREDITS LICENCE Makefile.in auth.c configure.ac includes.h ] | ||
462 | [platform.c platform.h sshd.c openbsd-compat/Makefile.in] | ||
463 | [openbsd-compat/openbsd-compat.h openbsd-compat/port-solaris.c] | ||
464 | [openbsd-compat/port-solaris.h] Add support for Solaris process | ||
465 | contracts, enabled with --use-solaris-contracts. Patch from Chad | ||
466 | Mynhier, tweaked by dtucker@ and myself; ok dtucker@ | ||
467 | - (dtucker) [contrib/cygwin/ssh-host-config] Add SeTcbPrivilege privilege | ||
468 | while setting up the ssh service account. Patch from Corinna Vinschen. | ||
469 | |||
470 | 20060830 | ||
471 | - (djm) OpenBSD CVS Sync | ||
472 | - dtucker@cvs.openbsd.org 2006/08/21 08:14:01 | ||
473 | [sshd_config.5] | ||
474 | Document HostbasedUsesNameFromPacketOnly. Corrections from jmc@, | ||
475 | ok jmc@ djm@ | ||
476 | - dtucker@cvs.openbsd.org 2006/08/21 08:15:57 | ||
477 | [sshd.8] | ||
478 | Add more detail about what permissions are and aren't accepted for | ||
479 | authorized_keys files. Corrections jmc@, ok djm@, "looks good" jmc@ | ||
480 | - djm@cvs.openbsd.org 2006/08/29 10:40:19 | ||
481 | [channels.c session.c] | ||
482 | normalise some inconsistent (but harmless) NULL pointer checks | ||
483 | spotted by the Stanford SATURN tool, via Isil Dillig; | ||
484 | ok markus@ deraadt@ | ||
485 | - dtucker@cvs.openbsd.org 2006/08/29 12:02:30 | ||
486 | [gss-genr.c] | ||
487 | Work around a problem in Heimdal that occurs when KRB5CCNAME file is | ||
488 | missing, by checking whether or not kerberos allocated us a context | ||
489 | before attempting to free it. Patch from Simon Wilkinson, tested by | ||
490 | biorn@, ok djm@ | ||
491 | - dtucker@cvs.openbsd.org 2006/08/30 00:06:51 | ||
492 | [sshconnect2.c] | ||
493 | Fix regression where SSH2 banner is printed at loglevels ERROR and FATAL | ||
494 | where previously it weren't. bz #1221, found by Dean Kopesky, ok djm@ | ||
495 | - djm@cvs.openbsd.org 2006/08/30 00:14:37 | ||
496 | [version.h] | ||
497 | crank to 4.4 | ||
498 | - (djm) [openbsd-compat/xcrypt.c] needs unistd.h | ||
499 | - (dtucker) [auth.c openbsd-compat/port-aix.c] Bug #1207: always call | ||
500 | loginsuccess on AIX immediately after authentication to clear the failed | ||
501 | login count. Previously this would only happen when an interactive | ||
502 | session starts (ie when a pty is allocated) but this means that accounts | ||
503 | that have primarily non-interactive sessions (eg scp's) may gradually | ||
504 | accumulate enough failures to lock out an account. This change may have | ||
505 | a side effect of creating two audit records, one with a tty of "ssh" | ||
506 | corresponding to the authentication and one with the allocated pty per | ||
507 | interactive session. | ||
508 | |||
509 | 20060824 | ||
510 | - (dtucker) [openbsd-compat/basename.c] Include errno.h. | ||
511 | - (dtucker) [openbsd-compat/bsd-misc.c] Add includes needed for select(2) on | ||
512 | older systems. | ||
513 | - (dtucker) [openbsd-compat/bsd-misc.c] Include <sys/select.h> for select(2) | ||
514 | on POSIX systems. | ||
515 | - (dtucker) [openbsd-compat/bsd-openpty.c] Include for ioctl(2). | ||
516 | - (dtucker) [openbsd-compat/rresvport.c] Include <stdlib.h> for malloc. | ||
517 | - (dtucker) [openbsd-compat/xmmap.c] Move #define HAVE_MMAP to prevent | ||
518 | unused variable warning when we have a broken or missing mmap(2). | ||
519 | |||
520 | 20060822 | ||
521 | - (dtucker) [Makefile.in] Bug #1177: fix incorrect path for sshrc in | ||
522 | Makefile. Patch from santhi.amirta at gmail, ok djm. | ||
523 | |||
524 | 20060820 | ||
525 | - (dtucker) [log.c] Move ifdef to prevent unused variable warning. | ||
526 | - (dtucker) [configure.ac] Save $LIBS during PAM library tests and restore | ||
527 | afterward. Removes the need to mangle $LIBS later to remove -lpam and -ldl. | ||
528 | - (dtucker) [configure.ac] Relocate --with-pam parts in preparation for | ||
529 | fixing bug #1181. No changes yet. | ||
530 | - (dtucker) [configure.ac] Bug #1181: Explicitly test to see if OpenSSL | ||
531 | (0.9.8a and presumably newer) requires -ldl to successfully link. | ||
532 | - (dtucker) [configure.ac] Remove errant "-". | ||
533 | |||
534 | 20060819 | ||
535 | - (djm) OpenBSD CVS Sync | ||
536 | - djm@cvs.openbsd.org 2006/08/18 22:41:29 | ||
537 | [gss-genr.c] | ||
538 | GSSAPI error code should be 0 and not -1; from simon@sxw.org.uk | ||
539 | - (dtucker) [openbsd-compat/regress/Makefile.in] Add $(EXEEXT) and add a | ||
540 | single rule for the test progs. | ||
541 | |||
542 | 20060818 | ||
543 | - (dtucker) [configure.ac openbsd-compat/bsd-closefrom.c] Resync with | ||
544 | closefrom.c from sudo. | ||
545 | - (dtucker) [openbsd-compat/bsd-closefrom.c] Comment out rcsid. | ||
546 | - (dtucker) [openbsd-compat/regress/snprintftest.c] Newline on error. | ||
547 | - (dtucker) [openbsd-compat/regress/Makefile.in] Use implicit rules for the | ||
548 | test progs instead; they work better than what we have. | ||
549 | - (djm) OpenBSD CVS Sync | ||
550 | - stevesk@cvs.openbsd.org 2006/08/06 01:13:32 | ||
551 | [compress.c monitor.c monitor_wrap.c] | ||
552 | "zlib.h" can be <zlib.h>; ok djm@ markus@ | ||
553 | - miod@cvs.openbsd.org 2006/08/12 20:46:46 | ||
554 | [monitor.c monitor_wrap.c] | ||
555 | Revert previous include file ordering change, for ssh to compile under | ||
556 | gcc2 (or until openssl include files are cleaned of parameter names | ||
557 | in function prototypes) | ||
558 | - dtucker@cvs.openbsd.org 2006/08/14 12:40:25 | ||
559 | [servconf.c servconf.h sshd_config.5] | ||
560 | Add ability to match groups to Match keyword in sshd_config. Feedback | ||
561 | djm@, stevesk@, ok stevesk@. | ||
562 | - djm@cvs.openbsd.org 2006/08/16 11:47:15 | ||
563 | [sshd.c] | ||
564 | factor inetd connection, TCP listen and main TCP accept loop out of | ||
565 | main() into separate functions to improve readability; ok markus@ | ||
566 | - deraadt@cvs.openbsd.org 2006/08/18 09:13:26 | ||
567 | [log.c log.h sshd.c] | ||
568 | make signal handler termination path shorter; risky code pointed out by | ||
569 | mark dowd; ok djm markus | ||
570 | - markus@cvs.openbsd.org 2006/08/18 09:15:20 | ||
571 | [auth.h session.c sshd.c] | ||
572 | delay authentication related cleanups until we're authenticated and | ||
573 | all alarms have been cancelled; ok deraadt | ||
574 | - djm@cvs.openbsd.org 2006/08/18 10:27:16 | ||
575 | [misc.h] | ||
576 | reorder so prototypes are sorted by the files they refer to; no | ||
577 | binary change | ||
578 | - djm@cvs.openbsd.org 2006/08/18 13:54:54 | ||
579 | [gss-genr.c ssh-gss.h sshconnect2.c] | ||
580 | bz #1218 - disable SPNEGO as per RFC4462; diff from simon AT sxw.org.uk | ||
581 | ok markus@ | ||
582 | - djm@cvs.openbsd.org 2006/08/18 14:40:34 | ||
583 | [gss-genr.c ssh-gss.h] | ||
584 | constify host argument to match the rest of the GSSAPI functions and | ||
585 | unbreak compilation with -Werror | ||
586 | - (djm) Disable sigdie() for platforms that cannot safely syslog inside | ||
587 | a signal handler (basically all of them, excepting OpenBSD); | ||
588 | ok dtucker@ | ||
589 | |||
590 | 20060817 | ||
591 | - (dtucker) [openbsd-compat/fake-rfc2553.c openbsd-compat/setproctitle.c] | ||
592 | Include stdlib.h for malloc and friends. | ||
593 | - (dtucker) [configure.ac openbsd-compat/bsd-closefrom.c] Use F_CLOSEM fcntl | ||
594 | for closefrom() on AIX. Pointed out by William Ahern. | ||
595 | - (dtucker) [openbsd-compat/regress/{Makefile.in,closefromtest.c}] Regress | ||
596 | test for closefrom() in compat code. | ||
597 | |||
598 | 20060816 | ||
599 | - (djm) [audit-bsm.c] Sprinkle in some headers | ||
600 | |||
601 | 20060815 | ||
602 | - (dtucker) [LICENCE] Add Reyk to the list for the compat dir. | ||
603 | |||
604 | 20060806 | ||
605 | - (djm) [openbsd-compat/bsd-getpeereid.c] Add some headers to quiet warnings | ||
606 | on Solaris 10 | ||
607 | |||
608 | 20060806 | ||
609 | - (dtucker) [defines.h] With the includes.h changes we no longer get the | ||
610 | name clash on "YES" so we can remove the workaround for it. | ||
611 | - (dtucker) [openbsd-compat/{bsd-asprintf.c,bsd-openpty.c,bsd-snprintf.c, | ||
612 | glob.c}] Include stdlib.h for malloc and friends in compat code. | ||
613 | |||
614 | 20060805 | ||
615 | - (djm) OpenBSD CVS Sync | ||
616 | - stevesk@cvs.openbsd.org 2006/07/24 13:58:22 | ||
617 | [sshconnect.c] | ||
618 | disable tunnel forwarding when no strict host key checking | ||
619 | and key changed; ok djm@ markus@ dtucker@ | ||
620 | - stevesk@cvs.openbsd.org 2006/07/25 02:01:34 | ||
621 | [scard.c] | ||
622 | need #include <string.h> | ||
623 | - stevesk@cvs.openbsd.org 2006/07/25 02:59:21 | ||
624 | [channels.c clientloop.c packet.c scp.c serverloop.c sftp-client.c] | ||
625 | [sftp-server.c ssh-agent.c ssh-keyscan.c sshconnect.c sshd.c] | ||
626 | move #include <sys/time.h> out of includes.h | ||
627 | - stevesk@cvs.openbsd.org 2006/07/26 02:35:17 | ||
628 | [atomicio.c auth.c dh.c authfile.c buffer.c clientloop.c kex.c] | ||
629 | [groupaccess.c gss-genr.c kexgexs.c misc.c monitor.c monitor_mm.c] | ||
630 | [packet.c scp.c serverloop.c session.c sftp-client.c sftp-common.c] | ||
631 | [sftp-server.c sftp.c ssh-add.c ssh-agent.c ssh-keygen.c sshlogin.c] | ||
632 | [uidswap.c xmalloc.c] | ||
633 | move #include <sys/param.h> out of includes.h | ||
634 | - stevesk@cvs.openbsd.org 2006/07/26 13:57:17 | ||
635 | [authfd.c authfile.c dh.c canohost.c channels.c clientloop.c compat.c] | ||
636 | [hostfile.c kex.c log.c misc.c moduli.c monitor.c packet.c readpass.c] | ||
637 | [scp.c servconf.c session.c sftp-server.c sftp.c ssh-add.c ssh-agent.c] | ||
638 | [ssh-keygen.c ssh-keyscan.c ssh-keysign.c ssh.c sshconnect.c] | ||
639 | [sshconnect1.c sshd.c xmalloc.c] | ||
640 | move #include <stdlib.h> out of includes.h | ||
641 | - jmc@cvs.openbsd.org 2006/07/27 08:00:50 | ||
642 | [ssh_config.5] | ||
643 | avoid confusing wording in HashKnownHosts: | ||
644 | originally spotted by alan amesbury; | ||
645 | ok deraadt | ||
646 | - jmc@cvs.openbsd.org 2006/07/27 08:00:50 | ||
647 | [ssh_config.5] | ||
648 | avoid confusing wording in HashKnownHosts: | ||
649 | originally spotted by alan amesbury; | ||
650 | ok deraadt | ||
651 | - dtucker@cvs.openbsd.org 2006/08/01 11:34:36 | ||
652 | [sshconnect.c] | ||
653 | Allow fallback to known_hosts entries without port qualifiers for | ||
654 | non-standard ports too, so that all existing known_hosts entries will be | ||
655 | recognised. Requested by, feedback and ok markus@ | ||
656 | - stevesk@cvs.openbsd.org 2006/08/01 23:22:48 | ||
657 | [auth-passwd.c auth-rhosts.c auth-rsa.c auth.c auth.h auth1.c] | ||
658 | [auth2-chall.c auth2-pubkey.c authfile.c buffer.c canohost.c] | ||
659 | [channels.c clientloop.c dh.c dns.c dns.h hostfile.c kex.c kexdhc.c] | ||
660 | [kexgexc.c kexgexs.c key.c key.h log.c misc.c misc.h moduli.c] | ||
661 | [monitor_wrap.c packet.c progressmeter.c readconf.c readpass.c scp.c] | ||
662 | [servconf.c session.c sftp-client.c sftp-common.c sftp-server.c sftp.c] | ||
663 | [ssh-add.c ssh-agent.c ssh-keygen.c ssh-keyscan.c ssh.c sshconnect.c] | ||
664 | [sshconnect1.c sshconnect2.c sshd.c sshlogin.c sshtty.c uuencode.c] | ||
665 | [uuencode.h xmalloc.c] | ||
666 | move #include <stdio.h> out of includes.h | ||
667 | - stevesk@cvs.openbsd.org 2006/08/01 23:36:12 | ||
668 | [authfile.c channels.c progressmeter.c scard.c servconf.c ssh.c] | ||
669 | clean extra spaces | ||
670 | - deraadt@cvs.openbsd.org 2006/08/03 03:34:42 | ||
671 | [OVERVIEW atomicio.c atomicio.h auth-bsdauth.c auth-chall.c auth-krb5.c] | ||
672 | [auth-options.c auth-options.h auth-passwd.c auth-rh-rsa.c auth-rhosts.c] | ||
673 | [auth-rsa.c auth-skey.c auth.c auth.h auth1.c auth2-chall.c auth2-gss.c] | ||
674 | [auth2-hostbased.c auth2-kbdint.c auth2-none.c auth2-passwd.c ] | ||
675 | [auth2-pubkey.c auth2.c authfd.c authfd.h authfile.c bufaux.c bufbn.c] | ||
676 | [buffer.c buffer.h canohost.c channels.c channels.h cipher-3des1.c] | ||
677 | [cipher-bf1.c cipher-ctr.c cipher.c cleanup.c clientloop.c compat.c] | ||
678 | [compress.c deattack.c dh.c dispatch.c dns.c dns.h fatal.c groupaccess.c] | ||
679 | [groupaccess.h gss-genr.c gss-serv-krb5.c gss-serv.c hostfile.c kex.c] | ||
680 | [kex.h kexdh.c kexdhc.c kexdhs.c kexgex.c kexgexc.c kexgexs.c key.c] | ||
681 | [key.h log.c log.h mac.c match.c md-sha256.c misc.c misc.h moduli.c] | ||
682 | [monitor.c monitor_fdpass.c monitor_mm.c monitor_mm.h monitor_wrap.c] | ||
683 | [monitor_wrap.h msg.c nchan.c packet.c progressmeter.c readconf.c] | ||
684 | [readconf.h readpass.c rsa.c scard.c scard.h scp.c servconf.c servconf.h] | ||
685 | [serverloop.c session.c session.h sftp-client.c sftp-common.c] | ||
686 | [sftp-common.h sftp-glob.c sftp-server.c sftp.c ssh-add.c ssh-agent.c] | ||
687 | [ssh-dss.c ssh-gss.h ssh-keygen.c ssh-keyscan.c ssh-keysign.c ssh-rsa.c] | ||
688 | [ssh.c ssh.h sshconnect.c sshconnect.h sshconnect1.c sshconnect2.c] | ||
689 | [sshd.c sshlogin.c sshlogin.h sshpty.c sshpty.h sshtty.c ttymodes.c] | ||
690 | [uidswap.c uidswap.h uuencode.c uuencode.h xmalloc.c xmalloc.h] | ||
691 | [loginrec.c loginrec.h openbsd-compat/port-aix.c openbsd-compat/port-tun.h] | ||
692 | almost entirely get rid of the culture of ".h files that include .h files" | ||
693 | ok djm, sort of ok stevesk | ||
694 | makes the pain stop in one easy step | ||
695 | NB. portable commit contains everything *except* removing includes.h, as | ||
696 | that will take a fair bit more work as we move headers that are required | ||
697 | for portability workarounds to defines.h. (also, this step wasn't "easy") | ||
698 | - stevesk@cvs.openbsd.org 2006/08/04 20:46:05 | ||
699 | [monitor.c session.c ssh-agent.c] | ||
700 | spaces | ||
701 | - (djm) [auth-pam.c defines.h] Move PAM related bits to auth-pam.c | ||
702 | - (djm) [auth-pam.c auth.c bufaux.h entropy.c openbsd-compat/port-tun.c] | ||
703 | remove last traces of bufaux.h - it was merged into buffer.h in the big | ||
704 | includes.h commit | ||
705 | - (djm) [auth.c loginrec.c] Missing netinet/in.h for loginrec | ||
706 | - (djm) [openbsd-compat/regress/snprintftest.c] | ||
707 | [openbsd-compat/regress/strduptest.c] Add missing includes so they pass | ||
708 | compilation with "-Wall -Werror" | ||
709 | - (djm) [auth-pam.c auth-shadow.c auth2-none.c cleanup.c sshd.c] | ||
710 | [openbsd-compat/port-tun.c openbsd-compat/port-tun.h] Sprinkle more | ||
711 | includes for Linux in | ||
712 | - (dtucker) [cleanup.c] Need defines.h for __dead. | ||
713 | - (dtucker) [auth2-gss.c] We still need the #ifdef GSSAPI in -portable. | ||
714 | - (dtucker) [openbsd-compat/{bsd-arc4random.c,port-tun.c,xmmap.c}] Lots of | ||
715 | #include stdarg.h, needed for log.h. | ||
716 | - (dtucker) [entropy.c] Needs unistd.h too. | ||
717 | - (dtucker) [ssh-rand-helper.c] Needs stdarg.h for log.h. | ||
718 | - (dtucker) [openbsd-compat/getrrsetbyname.c] Nees stdlib.h for malloc. | ||
719 | - (dtucker) [openbsd-compat/strtonum.c] Include stdlib.h for strtoll, | ||
720 | otherwise it is implicitly declared as returning an int. | ||
721 | - (dtucker) OpenBSD CVS Sync | ||
722 | - dtucker@cvs.openbsd.org 2006/08/05 07:52:52 | ||
723 | [auth2-none.c sshd.c monitor_wrap.c] | ||
724 | Add headers required to build with KERBEROS5=no. ok djm@ | ||
725 | - dtucker@cvs.openbsd.org 2006/08/05 08:00:33 | ||
726 | [auth-skey.c] | ||
727 | Add headers required to build with -DSKEY. ok djm@ | ||
728 | - dtucker@cvs.openbsd.org 2006/08/05 08:28:24 | ||
729 | [monitor_wrap.c auth-skey.c auth2-chall.c] | ||
730 | Zap unused variables in -DSKEY code. ok djm@ | ||
731 | - dtucker@cvs.openbsd.org 2006/08/05 08:34:04 | ||
732 | [packet.c] | ||
733 | Typo in comment | ||
734 | - (dtucker) [openbsd-compat/bsd-cygwin_util.c] Add headers required to compile | ||
735 | on Cygwin. | ||
736 | - (dtucker) [openbsd-compat/fake-rfc2553.c] Add headers needed for inet_ntoa. | ||
737 | - (dtucker) [auth-skey.c] monitor_wrap.h needs ssh-gss.h. | ||
738 | - (dtucker) [audit.c audit.h] Repair headers. | ||
739 | - (dtucker) [audit-bsm.c] Add additional headers now required. | ||
740 | |||
741 | 20060804 | ||
742 | - (dtucker) [configure.ac] The "crippled AES" test does not work on recent | ||
743 | versions of Solaris, so use AC_LINK_IFELSE to actually link the test program | ||
744 | rather than just compiling it. Spotted by dlg@. | ||
745 | |||
746 | 20060802 | ||
747 | - (dtucker) [openbsd-compat/daemon.c] Add unistd.h for fork() prototype. | ||
748 | |||
749 | 20060725 | ||
750 | - (dtucker) [openbsd-compat/xmmap.c] Need fcntl.h for O_RDRW. | ||
751 | |||
752 | 20060724 | ||
753 | - (djm) OpenBSD CVS Sync | ||
754 | - jmc@cvs.openbsd.org 2006/07/12 13:39:55 | ||
755 | [sshd_config.5] | ||
756 | - new sentence, new line | ||
757 | - s/The the/The/ | ||
758 | - kill a bad comma | ||
759 | - stevesk@cvs.openbsd.org 2006/07/12 22:28:52 | ||
760 | [auth-options.c canohost.c channels.c includes.h readconf.c] | ||
761 | [servconf.c ssh-keyscan.c ssh.c sshconnect.c sshd.c] | ||
762 | move #include <netdb.h> out of includes.h; ok djm@ | ||
763 | - stevesk@cvs.openbsd.org 2006/07/12 22:42:32 | ||
764 | [includes.h ssh.c ssh-rand-helper.c] | ||
765 | move #include <stddef.h> out of includes.h | ||
766 | - stevesk@cvs.openbsd.org 2006/07/14 01:15:28 | ||
767 | [monitor_wrap.h] | ||
768 | don't need incompletely-typed 'struct passwd' now with | ||
769 | #include <pwd.h>; ok markus@ | ||
770 | - stevesk@cvs.openbsd.org 2006/07/17 01:31:10 | ||
771 | [authfd.c authfile.c channels.c cleanup.c clientloop.c groupaccess.c] | ||
772 | [includes.h log.c misc.c msg.c packet.c progressmeter.c readconf.c] | ||
773 | [readpass.c scp.c servconf.c sftp-client.c sftp-server.c sftp.c] | ||
774 | [ssh-add.c ssh-agent.c ssh-keygen.c ssh-keyscan.c ssh-keysign.c ssh.c] | ||
775 | [sshconnect.c sshlogin.c sshpty.c uidswap.c] | ||
776 | move #include <unistd.h> out of includes.h | ||
777 | - dtucker@cvs.openbsd.org 2006/07/17 12:02:24 | ||
778 | [auth-options.c] | ||
779 | Use '\0' rather than 0 to terminates strings; ok djm@ | ||
780 | - dtucker@cvs.openbsd.org 2006/07/17 12:06:00 | ||
781 | [channels.c channels.h servconf.c sshd_config.5] | ||
782 | Add PermitOpen directive to sshd_config which is equivalent to the | ||
783 | "permitopen" key option. Allows server admin to allow TCP port | ||
784 | forwarding only two specific host/port pairs. Useful when combined | ||
785 | with Match. | ||
786 | If permitopen is used in both sshd_config and a key option, both | ||
787 | must allow a given connection before it will be permitted. | ||
788 | Note that users can still use external forwarders such as netcat, | ||
789 | so to be those must be controlled too for the limits to be effective. | ||
790 | Feedback & ok djm@, man page corrections & ok jmc@. | ||
791 | - jmc@cvs.openbsd.org 2006/07/18 07:50:40 | ||
792 | [sshd_config.5] | ||
793 | tweak; ok dtucker | ||
794 | - jmc@cvs.openbsd.org 2006/07/18 07:56:28 | ||
795 | [scp.1] | ||
796 | replace DIAGNOSTICS with .Ex; | ||
797 | - jmc@cvs.openbsd.org 2006/07/18 08:03:09 | ||
798 | [ssh-agent.1 sshd_config.5] | ||
799 | mark up angle brackets; | ||
800 | - dtucker@cvs.openbsd.org 2006/07/18 08:22:23 | ||
801 | [sshd_config.5] | ||
802 | Clarify description of Match, with minor correction from jmc@ | ||
803 | - stevesk@cvs.openbsd.org 2006/07/18 22:27:55 | ||
804 | [dh.c] | ||
805 | remove unneeded includes; ok djm@ | ||
806 | - dtucker@cvs.openbsd.org 2006/07/19 08:56:41 | ||
807 | [servconf.c sshd_config.5] | ||
808 | Add support for X11Forwaring, X11DisplayOffset and X11UseLocalhost to | ||
809 | Match. ok djm@ | ||
810 | - dtucker@cvs.openbsd.org 2006/07/19 13:07:10 | ||
811 | [servconf.c servconf.h session.c sshd.8 sshd_config sshd_config.5] | ||
812 | Add ForceCommand keyword to sshd_config, equivalent to the "command=" | ||
813 | key option, man page entry and example in sshd_config. | ||
814 | Feedback & ok djm@, man page corrections & ok jmc@ | ||
815 | - stevesk@cvs.openbsd.org 2006/07/20 15:26:15 | ||
816 | [auth1.c serverloop.c session.c sshconnect2.c] | ||
817 | missed some needed #include <unistd.h> when KERBEROS5=no; issue from | ||
818 | massimo@cedoc.mo.it | ||
819 | - dtucker@cvs.openbsd.org 2006/07/21 12:43:36 | ||
820 | [channels.c channels.h servconf.c servconf.h sshd_config.5] | ||
821 | Make PermitOpen take a list of permitted ports and act more like most | ||
822 | other keywords (ie the first match is the effective setting). This | ||
823 | also makes it easier to override a previously set PermitOpen. ok djm@ | ||
824 | - stevesk@cvs.openbsd.org 2006/07/21 21:13:30 | ||
825 | [channels.c] | ||
826 | more ARGSUSED (lint) for dispatch table-driven functions; ok djm@ | ||
827 | - stevesk@cvs.openbsd.org 2006/07/21 21:26:55 | ||
828 | [progressmeter.c] | ||
829 | ARGSUSED for signal handler | ||
830 | - stevesk@cvs.openbsd.org 2006/07/22 19:08:54 | ||
831 | [includes.h moduli.c progressmeter.c scp.c sftp-common.c] | ||
832 | [sftp-server.c ssh-agent.c sshlogin.c] | ||
833 | move #include <time.h> out of includes.h | ||
834 | - stevesk@cvs.openbsd.org 2006/07/22 20:48:23 | ||
835 | [atomicio.c auth-options.c auth-passwd.c auth-rhosts.c auth-rsa.c] | ||
836 | [auth.c auth1.c auth2-chall.c auth2-hostbased.c auth2-passwd.c auth2.c] | ||
837 | [authfd.c authfile.c bufaux.c bufbn.c buffer.c canohost.c channels.c] | ||
838 | [cipher-3des1.c cipher-bf1.c cipher-ctr.c cipher.c clientloop.c] | ||
839 | [compat.c deattack.c dh.c dns.c gss-genr.c gss-serv.c hostfile.c] | ||
840 | [includes.h kex.c kexdhc.c kexdhs.c kexgexc.c kexgexs.c key.c log.c] | ||
841 | [mac.c match.c md-sha256.c misc.c moduli.c monitor.c monitor_fdpass.c] | ||
842 | [monitor_mm.c monitor_wrap.c msg.c nchan.c packet.c rsa.c] | ||
843 | [progressmeter.c readconf.c readpass.c scp.c servconf.c serverloop.c] | ||
844 | [session.c sftp-client.c sftp-common.c sftp-glob.c sftp-server.c sftp.c] | ||
845 | [ssh-add.c ssh-agent.c ssh-dss.c ssh-keygen.c ssh-keyscan.c] | ||
846 | [ssh-keysign.c ssh-rsa.c ssh.c sshconnect.c sshconnect1.c sshconnect2.c] | ||
847 | [sshd.c sshlogin.c sshpty.c ttymodes.c uidswap.c xmalloc.c] | ||
848 | move #include <string.h> out of includes.h | ||
849 | - stevesk@cvs.openbsd.org 2006/07/23 01:11:05 | ||
850 | [auth.h dispatch.c kex.h sftp-client.c] | ||
851 | #include <signal.h> for sig_atomic_t; need this prior to <sys/param.h> | ||
852 | move | ||
853 | - (djm) [acss.c auth-krb5.c auth-options.c auth-pam.c auth-shadow.c] | ||
854 | [canohost.c channels.c cipher-acss.c defines.h dns.c gss-genr.c] | ||
855 | [gss-serv-krb5.c gss-serv.c log.h loginrec.c logintest.c readconf.c] | ||
856 | [servconf.c ssh-keygen.c ssh-keyscan.c ssh-keysign.c ssh-rand-helper.c] | ||
857 | [ssh.c sshconnect.c sshd.c openbsd-compat/bindresvport.c] | ||
858 | [openbsd-compat/bsd-arc4random.c openbsd-compat/bsd-misc.c] | ||
859 | [openbsd-compat/getrrsetbyname.c openbsd-compat/glob.c] | ||
860 | [openbsd-compat/mktemp.c openbsd-compat/port-linux.c] | ||
861 | [openbsd-compat/port-tun.c openbsd-compat/readpassphrase.c] | ||
862 | [openbsd-compat/setproctitle.c openbsd-compat/xmmap.c] | ||
863 | make the portable tree compile again - sprinkle unistd.h and string.h | ||
864 | back in. Don't redefine __unused, as it turned out to be used in | ||
865 | headers on Linux, and replace its use in auth-pam.c with ARGSUSED | ||
866 | - (djm) [openbsd-compat/glob.c] | ||
867 | Move get_arg_max() into the ifdef HAVE_GLOB block so that it compiles | ||
868 | on OpenBSD (or other platforms with a decent glob implementation) with | ||
869 | -Werror | ||
870 | - (djm) [uuencode.c] | ||
871 | Add resolv.h, is it contains the prototypes for __b64_ntop/__b64_pton on | ||
872 | some platforms | ||
873 | - (djm) [session.c] | ||
874 | fix compile error with -Werror -Wall: 'path' is only used in | ||
875 | do_setup_env() if HAVE_LOGIN_CAP is not defined | ||
876 | - (djm) [openbsd-compat/basename.c openbsd-compat/bsd-closefrom.c] | ||
877 | [openbsd-compat/bsd-cray.c openbsd-compat/bsd-openpty.c] | ||
878 | [openbsd-compat/bsd-snprintf.c openbsd-compat/fake-rfc2553.c] | ||
879 | [openbsd-compat/port-aix.c openbsd-compat/port-irix.c] | ||
880 | [openbsd-compat/rresvport.c] | ||
881 | These look to need string.h and/or unistd.h (based on a grep for function | ||
882 | names) | ||
883 | - (djm) [Makefile.in] | ||
884 | Remove generated openbsd-compat/regress/Makefile in distclean target | ||
885 | - (djm) [regress/Makefile regress/agent-getpeereid.sh regress/cfgmatch.sh] | ||
886 | [regress/cipher-speed.sh regress/forcecommand.sh regress/forwarding.sh] | ||
887 | Sync regress tests to -current; include dtucker@'s new cfgmatch and | ||
888 | forcecommand tests. Add cipher-speed.sh test (not linked in yet) | ||
889 | - (dtucker) [cleanup.c] Since config.h defines _LARGE_FILES on AIX, including | ||
890 | system headers before defines.h will cause conflicting definitions. | ||
891 | - (dtucker) [regress/forcecommand.sh] Portablize. | ||
892 | |||
893 | 20060713 | ||
894 | - (dtucker) [auth-krb5.c auth-pam.c] Still more errno.h | ||
895 | |||
896 | 20060712 | ||
897 | - (dtucker) [configure.ac defines.h] Only define SHUT_RD (and friends) and | ||
898 | O_NONBLOCK if they're really needed. Fixes build errors on HP-UX, old | ||
899 | Linuxes and probably more. | ||
900 | - (dtucker) [configure.ac] OpenBSD needs <sys/types.h> before <sys/socket.h> | ||
901 | for SHUT_RD. | ||
902 | - (dtucker) [openbsd-compat/port-tun.c] OpenBSD needs <netinet/in.h> before | ||
903 | <netinet/ip.h>. | ||
904 | - (dtucker) OpenBSD CVS Sync | ||
905 | - stevesk@cvs.openbsd.org 2006/07/10 16:01:57 | ||
906 | [sftp-glob.c sftp-common.h sftp.c] | ||
907 | buffer.h only needed in sftp-common.h and remove some unneeded | ||
908 | user includes; ok djm@ | ||
909 | - jmc@cvs.openbsd.org 2006/07/10 16:04:21 | ||
910 | [sshd.8] | ||
911 | s/and and/and/ | ||
912 | - stevesk@cvs.openbsd.org 2006/07/10 16:37:36 | ||
913 | [readpass.c log.h scp.c fatal.c xmalloc.c includes.h ssh-keyscan.c misc.c | ||
914 | auth.c packet.c log.c] | ||
915 | move #include <stdarg.h> out of includes.h; ok markus@ | ||
916 | - dtucker@cvs.openbsd.org 2006/07/11 10:12:07 | ||
917 | [ssh.c] | ||
918 | Only copy the part of environment variable that we actually use. Prevents | ||
919 | ssh bailing when SendEnv is used and an environment variable with a really | ||
920 | long value exists. ok djm@ | ||
921 | - markus@cvs.openbsd.org 2006/07/11 18:50:48 | ||
922 | [clientloop.c ssh.1 ssh.c channels.c ssh_config.5 readconf.h session.c | ||
923 | channels.h readconf.c] | ||
924 | add ExitOnForwardFailure: terminate the connection if ssh(1) | ||
925 | cannot set up all requested dynamic, local, and remote port | ||
926 | forwardings. ok djm, dtucker, stevesk, jmc | ||
927 | - stevesk@cvs.openbsd.org 2006/07/11 20:07:25 | ||
928 | [scp.c auth.c monitor.c serverloop.c sftp-server.c sshpty.c readpass.c | ||
929 | sshd.c monitor_wrap.c monitor_fdpass.c ssh-agent.c ttymodes.c atomicio.c | ||
930 | includes.h session.c sshlogin.c monitor_mm.c packet.c sshconnect2.c | ||
931 | sftp-client.c nchan.c clientloop.c sftp.c misc.c canohost.c channels.c | ||
932 | ssh-keygen.c progressmeter.c uidswap.c msg.c readconf.c sshconnect.c] | ||
933 | move #include <errno.h> out of includes.h; ok markus@ | ||
934 | - stevesk@cvs.openbsd.org 2006/07/11 20:16:43 | ||
935 | [ssh.c] | ||
936 | cast asterisk field precision argument to int to remove warning; | ||
937 | ok markus@ | ||
938 | - stevesk@cvs.openbsd.org 2006/07/11 20:27:56 | ||
939 | [authfile.c ssh.c] | ||
940 | need <errno.h> here also (it's also included in <openssl/err.h>) | ||
941 | - dtucker@cvs.openbsd.org 2006/07/12 11:34:58 | ||
942 | [sshd.c servconf.h servconf.c sshd_config.5 auth.c] | ||
943 | Add support for conditional directives to sshd_config via a "Match" | ||
944 | keyword, which works similarly to the "Host" directive in ssh_config. | ||
945 | Lines after a Match line override the default set in the main section | ||
946 | if the condition on the Match line is true, eg | ||
947 | AllowTcpForwarding yes | ||
948 | Match User anoncvs | ||
949 | AllowTcpForwarding no | ||
950 | will allow port forwarding by all users except "anoncvs". | ||
951 | Currently only a very small subset of directives are supported. | ||
952 | ok djm@ | ||
953 | - (dtucker) [loginrec.c openbsd-compat/xmmap.c openbsd-compat/bindresvport.c | ||
954 | openbsd-compat/glob.c openbsd-compat/mktemp.c openbsd-compat/port-tun.c | ||
955 | openbsd-compat/readpassphrase.c openbsd-compat/strtonum.c] Include <errno.h>. | ||
956 | - (dtucker) [openbsd-compat/setproctitle.c] Include stdarg.h. | ||
957 | - (dtucker) [ssh-keyscan.c ssh-rand-helper.c] More errno.h here too. | ||
958 | - (dtucker) [openbsd-compat/openbsd-compat.h] v*printf needs stdarg.h. | ||
959 | - (dtucker) [openbsd-compat/bsd-asprintf.c openbsd-compat/port-aix.c | ||
960 | openbsd-compat/rresvport.c] More errno.h. | ||
961 | |||
962 | 20060711 | ||
963 | - (dtucker) [configure.ac ssh-keygen.c openbsd-compat/bsd-openpty.c | ||
964 | openbsd-compat/daemon.c] Add includes needed by open(2). Conditionally | ||
965 | include paths.h. Fixes build error on Solaris. | ||
966 | - (dtucker) [entropy.c] More fcntl.h, this time on AIX (and probably | ||
967 | others). | ||
968 | |||
969 | 20060710 | ||
970 | - (dtucker) [INSTALL] New autoconf version: 2.60. | ||
971 | - OpenBSD CVS Sync | ||
972 | - djm@cvs.openbsd.org 2006/06/14 10:50:42 | ||
973 | [sshconnect.c] | ||
974 | limit the number of pre-banner characters we will accept; ok markus@ | ||
975 | - djm@cvs.openbsd.org 2006/06/26 10:36:15 | ||
976 | [clientloop.c] | ||
977 | mention optional bind_address in runtime port forwarding setup | ||
978 | command-line help. patch from santhi.amirta AT gmail.com | ||
979 | - stevesk@cvs.openbsd.org 2006/07/02 17:12:58 | ||
980 | [ssh.1 ssh.c ssh_config.5 sshd_config.5] | ||
981 | more details and clarity for tun(4) device forwarding; ok and help | ||
982 | jmc@ | ||
983 | - stevesk@cvs.openbsd.org 2006/07/02 18:36:47 | ||
984 | [gss-serv-krb5.c gss-serv.c] | ||
985 | no "servconf.h" needed here | ||
986 | (gss-serv-krb5.c change not applied, portable needs the server options) | ||
987 | - stevesk@cvs.openbsd.org 2006/07/02 22:45:59 | ||
988 | [groupaccess.c groupaccess.h includes.h session.c sftp-common.c sshpty.c] | ||
989 | move #include <grp.h> out of includes.h | ||
990 | (portable needed uidswap.c too) | ||
991 | - stevesk@cvs.openbsd.org 2006/07/02 23:01:55 | ||
992 | [clientloop.c ssh.1] | ||
993 | use -KR[bind_address:]port here; ok djm@ | ||
994 | - stevesk@cvs.openbsd.org 2006/07/03 08:54:20 | ||
995 | [includes.h ssh.c sshconnect.c sshd.c] | ||
996 | move #include "version.h" out of includes.h; ok markus@ | ||
997 | - stevesk@cvs.openbsd.org 2006/07/03 17:59:32 | ||
998 | [channels.c includes.h] | ||
999 | move #include <arpa/inet.h> out of includes.h; old ok djm@ | ||
1000 | (portable needed session.c too) | ||
1001 | - stevesk@cvs.openbsd.org 2006/07/05 02:42:09 | ||
1002 | [canohost.c hostfile.c includes.h misc.c packet.c readconf.c] | ||
1003 | [serverloop.c sshconnect.c uuencode.c] | ||
1004 | move #include <netinet/in.h> out of includes.h; ok deraadt@ | ||
1005 | (also ssh-rand-helper.c logintest.c loginrec.c) | ||
1006 | - djm@cvs.openbsd.org 2006/07/06 10:47:05 | ||
1007 | [servconf.c servconf.h session.c sshd_config.5] | ||
1008 | support arguments to Subsystem commands; ok markus@ | ||
1009 | - djm@cvs.openbsd.org 2006/07/06 10:47:57 | ||
1010 | [sftp-server.8 sftp-server.c] | ||
1011 | add commandline options to enable logging of transactions; ok markus@ | ||
1012 | - stevesk@cvs.openbsd.org 2006/07/06 16:03:53 | ||
1013 | [auth-options.c auth-options.h auth-passwd.c auth-rh-rsa.c] | ||
1014 | [auth-rhosts.c auth-rsa.c auth.c auth.h auth2-hostbased.c] | ||
1015 | [auth2-pubkey.c auth2.c includes.h misc.c misc.h monitor.c] | ||
1016 | [monitor_wrap.c monitor_wrap.h scp.c serverloop.c session.c] | ||
1017 | [session.h sftp-common.c ssh-add.c ssh-keygen.c ssh-keysign.c] | ||
1018 | [ssh.c sshconnect.c sshconnect.h sshd.c sshpty.c sshpty.h uidswap.c] | ||
1019 | [uidswap.h] | ||
1020 | move #include <pwd.h> out of includes.h; ok markus@ | ||
1021 | - stevesk@cvs.openbsd.org 2006/07/06 16:22:39 | ||
1022 | [ssh-keygen.c] | ||
1023 | move #include "dns.h" up | ||
1024 | - stevesk@cvs.openbsd.org 2006/07/06 17:36:37 | ||
1025 | [monitor_wrap.h] | ||
1026 | typo in comment | ||
1027 | - stevesk@cvs.openbsd.org 2006/07/08 21:47:12 | ||
1028 | [authfd.c canohost.c clientloop.c dns.c dns.h includes.h] | ||
1029 | [monitor_fdpass.c nchan.c packet.c servconf.c sftp.c ssh-agent.c] | ||
1030 | [ssh-keyscan.c ssh.c sshconnect.h sshd.c sshlogin.h] | ||
1031 | move #include <sys/socket.h> out of includes.h | ||
1032 | - stevesk@cvs.openbsd.org 2006/07/08 21:48:53 | ||
1033 | [monitor.c session.c] | ||
1034 | missed these from last commit: | ||
1035 | move #include <sys/socket.h> out of includes.h | ||
1036 | - stevesk@cvs.openbsd.org 2006/07/08 23:30:06 | ||
1037 | [log.c] | ||
1038 | move user includes after /usr/include files | ||
1039 | - stevesk@cvs.openbsd.org 2006/07/09 15:15:11 | ||
1040 | [auth2-none.c authfd.c authfile.c includes.h misc.c monitor.c] | ||
1041 | [readpass.c scp.c serverloop.c sftp-client.c sftp-server.c] | ||
1042 | [ssh-add.c ssh-agent.c ssh-keygen.c ssh-keysign.c ssh.c sshd.c] | ||
1043 | [sshlogin.c sshpty.c] | ||
1044 | move #include <fcntl.h> out of includes.h | ||
1045 | - stevesk@cvs.openbsd.org 2006/07/09 15:27:59 | ||
1046 | [ssh-add.c] | ||
1047 | use O_RDONLY vs. 0 in open(); no binary change | ||
1048 | - djm@cvs.openbsd.org 2006/07/10 11:24:54 | ||
1049 | [sftp-server.c] | ||
1050 | remove optind - it isn't used here | ||
1051 | - djm@cvs.openbsd.org 2006/07/10 11:25:53 | ||
1052 | [sftp-server.c] | ||
1053 | don't log variables that aren't yet set | ||
1054 | - (djm) [loginrec.c ssh-rand-helper.c sshd.c openbsd-compat/glob.c] | ||
1055 | [openbsd-compat/mktemp.c openbsd-compat/openbsd-compat.h] | ||
1056 | [openbsd-compat/port-tun.c openbsd-compat/readpassphrase.c] | ||
1057 | [openbsd-compat/xcrypt.c] Fix includes.h fallout, mainly fcntl.h | ||
1058 | - OpenBSD CVS Sync | ||
1059 | - djm@cvs.openbsd.org 2006/07/10 12:03:20 | ||
1060 | [scp.c] | ||
1061 | duplicate argv at the start of main() because it gets modified later; | ||
1062 | pointed out by deraadt@ ok markus@ | ||
1063 | - djm@cvs.openbsd.org 2006/07/10 12:08:08 | ||
1064 | [channels.c] | ||
1065 | fix misparsing of SOCKS 5 packets that could result in a crash; | ||
1066 | reported by mk@ ok markus@ | ||
1067 | - dtucker@cvs.openbsd.org 2006/07/10 12:46:51 | ||
1068 | [misc.c misc.h sshd.8 sshconnect.c] | ||
1069 | Add port identifier to known_hosts for non-default ports, based originally | ||
1070 | on a patch from Devin Nate in bz#910. | ||
1071 | For any connection using the default port or using a HostKeyAlias the | ||
1072 | format is unchanged, otherwise the host name or address is enclosed | ||
1073 | within square brackets in the same format as sshd's ListenAddress. | ||
1074 | Tested by many, ok markus@. | ||
1075 | - (dtucker) [openbsd-compat/openbsd-compat.h] Need to include <sys/socket.h> | ||
1076 | for struct sockaddr on platforms that use the fake-rfc stuff. | ||
1077 | |||
1078 | 20060706 | ||
1079 | - (dtucker) [configure.ac] Try AIX blibpath test in different order when | ||
1080 | compiling with gcc. gcc 4.1.x will accept (but ignore) -b flags so | ||
1081 | configure would not select the correct libpath linker flags. | ||
1082 | - (dtucker) [INSTALL] A bit more info on autoconf. | ||
1083 | |||
1084 | 20060705 | ||
1085 | - (dtucker) [ssh-rand-helper.c] Don't exit if mkdir fails because the | ||
1086 | target already exists. | ||
1087 | |||
1088 | 20060630 | ||
1089 | - (dtucker) [openbsd-compat/openbsd-compat.h] SNPRINTF_CONST for snprintf | ||
1090 | declaration too. Patch from russ at sludge.net. | ||
1091 | - (dtucker) [openbsd-compat/getrrsetbyname.c] Undef _res before defining it, | ||
1092 | prevents warnings on platforms where _res is in the system headers. | ||
1093 | - (dtucker) [INSTALL] Bug #1202: Note when autoconf is required and which | ||
1094 | version. | ||
1095 | |||
1096 | 20060627 | ||
1097 | - (dtucker) [configure.ac] Bug #1203: Add missing '[', which causes problems | ||
1098 | with autoconf 2.60. Patch from vapier at gentoo.org. | ||
1099 | |||
1100 | 20060625 | ||
1101 | - (dtucker) [channels.c serverloop.c] Apply the bug #1102 workaround to ptys | ||
1102 | only, otherwise sshd can hang exiting non-interactive sessions. | ||
1103 | |||
1104 | 20060624 | ||
1105 | - (dtucker) [configure.ac] Bug #1193: Define PASSWD_NEEDS_USERNAME on Solaris. | ||
1106 | Works around limitation in Solaris' passwd program for changing passwords | ||
1107 | where the username is longer than 8 characters. ok djm@ | ||
1108 | - (dtucker) [serverloop.c] Get ifdef/ifndef the right way around for the bug | ||
1109 | #1102 workaround. | ||
1110 | |||
1111 | 20060623 | ||
1112 | - (dtucker) [README.platform configure.ac openbsd-compat/port-tun.c] Add | ||
1113 | tunnel support for Mac OS X/Darwin via a third-party tun driver. Patch | ||
1114 | from reyk@, tested by anil@ | ||
1115 | - (dtucker) [channels.c configure.ac serverloop.c] Bug #1102: Around AIX | ||
1116 | 4.3.3 ML3 or so, the AIX pty layer starting passing zero-length writes | ||
1117 | on the pty slave as zero-length reads on the pty master, which sshd | ||
1118 | interprets as the descriptor closing. Since most things don't do zero | ||
1119 | length writes this rarely matters, but occasionally it happens, and when | ||
1120 | it does the SSH pty session appears to hang, so we add a special case for | ||
1121 | this condition. ok djm@ | ||
1122 | |||
1123 | 20060613 | ||
1124 | - (djm) [getput.h] This file has been replaced by functions in misc.c | ||
1125 | - OpenBSD CVS Sync | ||
1126 | - djm@cvs.openbsd.org 2006/05/08 10:49:48 | ||
1127 | [sshconnect2.c] | ||
1128 | uint32_t -> u_int32_t (which we use everywhere else) | ||
1129 | (Id sync only - portable already had this) | ||
1130 | - markus@cvs.openbsd.org 2006/05/16 09:00:00 | ||
1131 | [clientloop.c] | ||
1132 | missing free; from Kylene Hall | ||
1133 | - markus@cvs.openbsd.org 2006/05/17 12:43:34 | ||
1134 | [scp.c sftp.c ssh-agent.c ssh-keygen.c sshconnect.c] | ||
1135 | fix leak; coverity via Kylene Jo Hall | ||
1136 | - miod@cvs.openbsd.org 2006/05/18 21:27:25 | ||
1137 | [kexdhc.c kexgexc.c] | ||
1138 | paramter -> parameter | ||
1139 | - dtucker@cvs.openbsd.org 2006/05/29 12:54:08 | ||
1140 | [ssh_config.5] | ||
1141 | Add gssapi-with-mic to PreferredAuthentications default list; ok jmc | ||
1142 | - dtucker@cvs.openbsd.org 2006/05/29 12:56:33 | ||
1143 | [ssh_config] | ||
1144 | Add GSSAPIAuthentication and GSSAPIDelegateCredentials to examples in | ||
1145 | sample ssh_config. ok markus@ | ||
1146 | - jmc@cvs.openbsd.org 2006/05/29 16:10:03 | ||
1147 | [ssh_config.5] | ||
1148 | oops - previous was too long; split the list of auths up | ||
1149 | - mk@cvs.openbsd.org 2006/05/30 11:46:38 | ||
1150 | [ssh-add.c] | ||
1151 | Sync usage() with man page and reality. | ||
1152 | ok deraadt dtucker | ||
1153 | - jmc@cvs.openbsd.org 2006/05/29 16:13:23 | ||
1154 | [ssh.1] | ||
1155 | add GSSAPI to the list of authentication methods supported; | ||
1156 | - mk@cvs.openbsd.org 2006/05/30 11:46:38 | ||
1157 | [ssh-add.c] | ||
1158 | Sync usage() with man page and reality. | ||
1159 | ok deraadt dtucker | ||
1160 | - markus@cvs.openbsd.org 2006/06/01 09:21:48 | ||
1161 | [sshd.c] | ||
1162 | call get_remote_ipaddr() early; fixes logging after client disconnects; | ||
1163 | report mpf@; ok dtucker@ | ||
1164 | - markus@cvs.openbsd.org 2006/06/06 10:20:20 | ||
1165 | [readpass.c sshconnect.c sshconnect.h sshconnect2.c uidswap.c] | ||
1166 | replace remaining setuid() calls with permanently_set_uid() and | ||
1167 | check seteuid() return values; report Marcus Meissner; ok dtucker djm | ||
1168 | - markus@cvs.openbsd.org 2006/06/08 14:45:49 | ||
1169 | [readpass.c sshconnect.c sshconnect2.c uidswap.c uidswap.h] | ||
1170 | do not set the gid, noted by solar; ok djm | ||
1171 | - djm@cvs.openbsd.org 2006/06/13 01:18:36 | ||
1172 | [ssh-agent.c] | ||
1173 | always use a format string, even when printing a constant | ||
1174 | - djm@cvs.openbsd.org 2006/06/13 02:17:07 | ||
1175 | [ssh-agent.c] | ||
1176 | revert; i am on drugs. spotted by alexander AT beard.se | ||
1177 | |||
1178 | 20060521 | ||
1179 | - (dtucker) [auth.c monitor.c] Now that we don't log from both the monitor | ||
1180 | and slave, we can remove the special-case handling in the audit hook in | ||
1181 | auth_log. | ||
1182 | |||
1183 | 20060517 | ||
1184 | - (dtucker) [ssh-rand-helper.c] Check return code of mkdir and fix file | ||
1185 | pointer leak. From kjhall at us.ibm.com, found by coverity. | ||
1186 | |||
1187 | 20060515 | ||
1188 | - (dtucker) [openbsd-compat/getrrsetbyname.c] Use _compat_res instead of | ||
1189 | _res, prevents problems on some platforms that have _res as a global but | ||
1190 | don't have getrrsetbyname(), eg IRIX 5.3. Found and tested by | ||
1191 | georg.schwarz at freenet.de, ok djm@. | ||
1192 | - (dtucker) [defines.h] Find a value for IOV_MAX or use a conservative | ||
1193 | default. Patch originally from tim@, ok djm | ||
1194 | - (dtucker) [auth-pam.c] Bug #1188: pass result of do_pam_account back and | ||
1195 | do not allow kbdint again after the PAM account check fails. ok djm@ | ||
1196 | |||
1197 | 20060506 | ||
1198 | - (dtucker) OpenBSD CVS Sync | ||
1199 | - dtucker@cvs.openbsd.org 2006/04/25 08:02:27 | ||
1200 | [authfile.c authfile.h sshconnect2.c ssh.c sshconnect1.c] | ||
1201 | Prevent ssh from trying to open private keys with bad permissions more than | ||
1202 | once or prompting for their passphrases (which it subsequently ignores | ||
1203 | anyway), similar to a previous change in ssh-add. bz #1186, ok djm@ | ||
1204 | - djm@cvs.openbsd.org 2006/05/04 14:55:23 | ||
1205 | [dh.c] | ||
1206 | tighter DH exponent checks here too; feedback and ok markus@ | ||
1207 | - djm@cvs.openbsd.org 2006/04/01 05:37:46 | ||
1208 | [OVERVIEW] | ||
1209 | $OpenBSD$ in here too | ||
1210 | - dtucker@cvs.openbsd.org 2006/05/06 08:35:40 | ||
1211 | [auth-krb5.c] | ||
1212 | Add $OpenBSD$ in comment here too | ||
1213 | |||
1214 | 20060504 | ||
1215 | - (dtucker) [auth-pam.c groupaccess.c monitor.c monitor_wrap.c scard-opensc.c | ||
1216 | session.c ssh-rand-helper.c sshd.c openbsd-compat/bsd-cygwin_util.c | ||
1217 | openbsd-compat/setproctitle.c] Convert malloc(foo*bar) -> calloc(foo,bar) | ||
1218 | in Portable-only code; since calloc zeros, remove now-redundant memsets. | ||
1219 | Also add a couple of sanity checks. With & ok djm@ | ||
1220 | |||
1221 | 20060503 | ||
1222 | - (dtucker) [packet.c] Remove in_systm.h since it's also in includes.h | ||
1223 | and double including it on IRIX 5.3 causes problems. From Georg Schwarz, | ||
1224 | "no objections" tim@ | ||
1225 | |||
1226 | 20060423 | ||
1227 | - (djm) OpenBSD CVS Sync | ||
1228 | - deraadt@cvs.openbsd.org 2006/04/01 05:42:20 | ||
1229 | [scp.c] | ||
1230 | minimal lint cleanup (unused crud, and some size_t); ok djm | ||
1231 | - djm@cvs.openbsd.org 2006/04/01 05:50:29 | ||
1232 | [scp.c] | ||
1233 | xasprintification; ok deraadt@ | ||
1234 | - djm@cvs.openbsd.org 2006/04/01 05:51:34 | ||
1235 | [atomicio.c] | ||
1236 | ANSIfy; requested deraadt@ | ||
1237 | - dtucker@cvs.openbsd.org 2006/04/02 08:34:52 | ||
1238 | [ssh-keysign.c] | ||
1239 | sessionid can be 32 bytes now too when sha256 kex is used; ok djm@ | ||
1240 | - djm@cvs.openbsd.org 2006/04/03 07:10:38 | ||
1241 | [gss-genr.c] | ||
1242 | GSSAPI buffers shouldn't be nul-terminated, spotted in bugzilla #1066 | ||
1243 | by dleonard AT vintela.com. use xasprintf() to simplify code while in | ||
1244 | there; "looks right" deraadt@ | ||
1245 | - djm@cvs.openbsd.org 2006/04/16 00:48:52 | ||
1246 | [buffer.c buffer.h channels.c] | ||
1247 | Fix condition where we could exit with a fatal error when an input | ||
1248 | buffer became too large and the remote end had advertised a big window. | ||
1249 | The problem was a mismatch in the backoff math between the channels code | ||
1250 | and the buffer code, so make a buffer_check_alloc() function that the | ||
1251 | channels code can use to propsectivly check whether an incremental | ||
1252 | allocation will succeed. bz #1131, debugged with the assistance of | ||
1253 | cove AT wildpackets.com; ok dtucker@ deraadt@ | ||
1254 | - djm@cvs.openbsd.org 2006/04/16 00:52:55 | ||
1255 | [atomicio.c atomicio.h] | ||
1256 | introduce atomiciov() function that wraps readv/writev to retry | ||
1257 | interrupted transfers like atomicio() does for read/write; | ||
1258 | feedback deraadt@ dtucker@ stevesk@ ok deraadt@ | ||
1259 | - djm@cvs.openbsd.org 2006/04/16 00:54:10 | ||
1260 | [sftp-client.c] | ||
1261 | avoid making a tiny 4-byte write to send the packet length of sftp | ||
1262 | commands, which would result in a separate tiny packet on the wire by | ||
1263 | using atomiciov(writev, ...) to write the length and the command in one | ||
1264 | pass; ok deraadt@ | ||
1265 | - djm@cvs.openbsd.org 2006/04/16 07:59:00 | ||
1266 | [atomicio.c] | ||
1267 | reorder sanity test so that it cannot dereference past the end of the | ||
1268 | iov array; well spotted canacar@! | ||
1269 | - dtucker@cvs.openbsd.org 2006/04/18 10:44:28 | ||
1270 | [bufaux.c bufbn.c Makefile.in] | ||
1271 | Move Buffer bignum functions into their own file, bufbn.c. This means | ||
1272 | that sftp and sftp-server (which use the Buffer functions in bufaux.c | ||
1273 | but not the bignum ones) no longer need to be linked with libcrypto. | ||
1274 | ok markus@ | ||
1275 | - djm@cvs.openbsd.org 2006/04/20 09:27:09 | ||
1276 | [auth.h clientloop.c dispatch.c dispatch.h kex.h] | ||
1277 | replace the last non-sig_atomic_t flag used in a signal handler with a | ||
1278 | sig_atomic_t, unfortunately with some knock-on effects in other (non- | ||
1279 | signal) contexts in which it is used; ok markus@ | ||
1280 | - markus@cvs.openbsd.org 2006/04/20 09:47:59 | ||
1281 | [sshconnect.c] | ||
1282 | simplify; ok djm@ | ||
1283 | - djm@cvs.openbsd.org 2006/04/20 21:53:44 | ||
1284 | [includes.h session.c sftp.c] | ||
1285 | Switch from using pipes to socketpairs for communication between | ||
1286 | sftp/scp and ssh, and between sshd and its subprocesses. This saves | ||
1287 | a file descriptor per session and apparently makes userland ppp over | ||
1288 | ssh work; ok markus@ deraadt@ (ID Sync only - portable makes this | ||
1289 | decision on a per-platform basis) | ||
1290 | - djm@cvs.openbsd.org 2006/04/22 04:06:51 | ||
1291 | [uidswap.c] | ||
1292 | use setres[ug]id() to permanently revoke privileges; ok deraadt@ | ||
1293 | (ID Sync only - portable already uses setres[ug]id() whenever possible) | ||
1294 | - stevesk@cvs.openbsd.org 2006/04/22 18:29:33 | ||
1295 | [crc32.c] | ||
1296 | remove extra spaces | ||
1297 | - (djm) [auth.h dispatch.h kex.h] sprinkle in signal.h to get | ||
1298 | sig_atomic_t | ||
1299 | |||
1300 | 20060421 | ||
1301 | - (djm) [Makefile.in configure.ac session.c sshpty.c] | ||
1302 | [contrib/redhat/sshd.init openbsd-compat/Makefile.in] | ||
1303 | [openbsd-compat/openbsd-compat.h openbsd-compat/port-linux.c] | ||
1304 | [openbsd-compat/port-linux.h] Add support for SELinux, setting | ||
1305 | the execution and TTY contexts. based on patch from Daniel Walsh, | ||
1306 | bz #880; ok dtucker@ | ||
1307 | |||
1308 | 20060418 | ||
1309 | - (djm) [canohost.c] Reorder IP options check so that it isn't broken | ||
1310 | by mapped addresses; bz #1179 reported by markw wtech-llc.com; | ||
1311 | ok dtucker@ | ||
1312 | |||
1313 | 20060331 | ||
1314 | - OpenBSD CVS Sync | ||
1315 | - deraadt@cvs.openbsd.org 2006/03/27 01:21:18 | ||
1316 | [xmalloc.c] | ||
1317 | we can do the size & nmemb check before the integer overflow check; | ||
1318 | evol | ||
1319 | - deraadt@cvs.openbsd.org 2006/03/27 13:03:54 | ||
1320 | [dh.c] | ||
1321 | use strtonum() instead of atoi(), limit dhg size to 64k; ok djm | ||
1322 | - djm@cvs.openbsd.org 2006/03/27 23:15:46 | ||
1323 | [sftp.c] | ||
1324 | always use a format string for addargs; spotted by mouring@ | ||
1325 | - deraadt@cvs.openbsd.org 2006/03/28 00:12:31 | ||
1326 | [README.tun ssh.c] | ||
1327 | spacing | ||
1328 | - deraadt@cvs.openbsd.org 2006/03/28 01:52:28 | ||
1329 | [channels.c] | ||
1330 | do not accept unreasonable X ports numbers; ok djm | ||
1331 | - deraadt@cvs.openbsd.org 2006/03/28 01:53:43 | ||
1332 | [ssh-agent.c] | ||
1333 | use strtonum() to parse the pid from the file, and range check it | ||
1334 | better; ok djm | ||
1335 | - djm@cvs.openbsd.org 2006/03/30 09:41:25 | ||
1336 | [channels.c] | ||
1337 | ARGSUSED for dispatch table-driven functions | ||
1338 | - djm@cvs.openbsd.org 2006/03/30 09:58:16 | ||
1339 | [authfd.c bufaux.c deattack.c gss-serv.c mac.c misc.c misc.h] | ||
1340 | [monitor_wrap.c msg.c packet.c sftp-client.c sftp-server.c ssh-agent.c] | ||
1341 | replace {GET,PUT}_XXBIT macros with functionally similar functions, | ||
1342 | silencing a heap of lint warnings. also allows them to use | ||
1343 | __bounded__ checking which can't be applied to macros; requested | ||
1344 | by and feedback from deraadt@ | ||
1345 | - djm@cvs.openbsd.org 2006/03/30 10:41:25 | ||
1346 | [ssh.c ssh_config.5] | ||
1347 | add percent escape chars to the IdentityFile option, bz #1159 based | ||
1348 | on a patch by imaging AT math.ualberta.ca; feedback and ok dtucker@ | ||
1349 | - dtucker@cvs.openbsd.org 2006/03/30 11:05:17 | ||
1350 | [ssh-keygen.c] | ||
1351 | Correctly handle truncated files while converting keys; ok djm@ | ||
1352 | - dtucker@cvs.openbsd.org 2006/03/30 11:40:21 | ||
1353 | [auth.c monitor.c] | ||
1354 | Prevent duplicate log messages when privsep=yes; ok djm@ | ||
1355 | - jmc@cvs.openbsd.org 2006/03/31 09:09:30 | ||
1356 | [ssh_config.5] | ||
1357 | kill trailing whitespace; | ||
1358 | - djm@cvs.openbsd.org 2006/03/31 09:13:56 | ||
1359 | [ssh_config.5] | ||
1360 | remote user escape is %r not %h; spotted by jmc@ | ||
1361 | |||
1362 | 20060326 | ||
1363 | - OpenBSD CVS Sync | ||
1364 | - jakob@cvs.openbsd.org 2006/03/15 08:46:44 | ||
1365 | [ssh-keygen.c] | ||
1366 | if no key file are given when printing the DNS host record, use the | ||
1367 | host key file(s) as default. ok djm@ | ||
1368 | - biorn@cvs.openbsd.org 2006/03/16 10:31:45 | ||
1369 | [scp.c] | ||
1370 | Try to display errormessage even if remout == -1 | ||
1371 | ok djm@, markus@ | ||
1372 | - djm@cvs.openbsd.org 2006/03/17 22:31:50 | ||
1373 | [authfd.c] | ||
1374 | another unreachable found by lint | ||
1375 | - djm@cvs.openbsd.org 2006/03/17 22:31:11 | ||
1376 | [authfd.c] | ||
1377 | unreachanble statement, found by lint | ||
1378 | - djm@cvs.openbsd.org 2006/03/19 02:22:32 | ||
1379 | [serverloop.c] | ||
1380 | memory leaks detected by Coverity via elad AT netbsd.org; | ||
1381 | ok deraadt@ dtucker@ | ||
1382 | - djm@cvs.openbsd.org 2006/03/19 02:22:56 | ||
1383 | [sftp.c] | ||
1384 | more memory leaks detected by Coverity via elad AT netbsd.org; | ||
1385 | deraadt@ ok | ||
1386 | - djm@cvs.openbsd.org 2006/03/19 02:23:26 | ||
1387 | [hostfile.c] | ||
1388 | FILE* leak detected by Coverity via elad AT netbsd.org; | ||
1389 | ok deraadt@ | ||
1390 | - djm@cvs.openbsd.org 2006/03/19 02:24:05 | ||
1391 | [dh.c readconf.c servconf.c] | ||
1392 | potential NULL pointer dereferences detected by Coverity | ||
1393 | via elad AT netbsd.org; ok deraadt@ | ||
1394 | - djm@cvs.openbsd.org 2006/03/19 07:41:30 | ||
1395 | [sshconnect2.c] | ||
1396 | memory leaks detected by Coverity via elad AT netbsd.org; | ||
1397 | deraadt@ ok | ||
1398 | - dtucker@cvs.openbsd.org 2006/03/19 11:51:52 | ||
1399 | [servconf.c] | ||
1400 | Correct strdelim null test; ok djm@ | ||
1401 | - deraadt@cvs.openbsd.org 2006/03/19 18:52:11 | ||
1402 | [auth1.c authfd.c channels.c] | ||
1403 | spacing | ||
1404 | - deraadt@cvs.openbsd.org 2006/03/19 18:53:12 | ||
1405 | [kex.c kex.h monitor.c myproposal.h session.c] | ||
1406 | spacing | ||
1407 | - deraadt@cvs.openbsd.org 2006/03/19 18:56:41 | ||
1408 | [clientloop.c progressmeter.c serverloop.c sshd.c] | ||
1409 | ARGSUSED for signal handlers | ||
1410 | - deraadt@cvs.openbsd.org 2006/03/19 18:59:49 | ||
1411 | [ssh-keyscan.c] | ||
1412 | please lint | ||
1413 | - deraadt@cvs.openbsd.org 2006/03/19 18:59:30 | ||
1414 | [ssh.c] | ||
1415 | spacing | ||
1416 | - deraadt@cvs.openbsd.org 2006/03/19 18:59:09 | ||
1417 | [authfile.c] | ||
1418 | whoever thought that break after return was a good idea needs to | ||
1419 | get their head examimed | ||
1420 | - djm@cvs.openbsd.org 2006/03/20 04:09:44 | ||
1421 | [monitor.c] | ||
1422 | memory leaks detected by Coverity via elad AT netbsd.org; | ||
1423 | deraadt@ ok | ||
1424 | that should be all of them now | ||
1425 | - djm@cvs.openbsd.org 2006/03/20 11:38:46 | ||
1426 | [key.c] | ||
1427 | (really) last of the Coverity diffs: avoid possible NULL deref in | ||
1428 | key_free. via elad AT netbsd.org; markus@ ok | ||
1429 | - deraadt@cvs.openbsd.org 2006/03/20 17:10:19 | ||
1430 | [auth.c key.c misc.c packet.c ssh-add.c] | ||
1431 | in a switch (), break after return or goto is stupid | ||
1432 | - deraadt@cvs.openbsd.org 2006/03/20 17:13:16 | ||
1433 | [key.c] | ||
1434 | djm did a typo | ||
1435 | - deraadt@cvs.openbsd.org 2006/03/20 17:17:23 | ||
1436 | [ssh-rsa.c] | ||
1437 | in a switch (), break after return or goto is stupid | ||
1438 | - deraadt@cvs.openbsd.org 2006/03/20 18:14:02 | ||
1439 | [channels.c clientloop.c monitor_wrap.c monitor_wrap.h serverloop.c] | ||
1440 | [ssh.c sshpty.c sshpty.h] | ||
1441 | sprinkle u_int throughout pty subsystem, ok markus | ||
1442 | - deraadt@cvs.openbsd.org 2006/03/20 18:17:20 | ||
1443 | [auth1.c auth2.c sshd.c] | ||
1444 | sprinkle some ARGSUSED for table driven functions (which sometimes | ||
1445 | must ignore their args) | ||
1446 | - deraadt@cvs.openbsd.org 2006/03/20 18:26:55 | ||
1447 | [channels.c monitor.c session.c session.h ssh-agent.c ssh-keygen.c] | ||
1448 | [ssh-rsa.c ssh.c sshlogin.c] | ||
1449 | annoying spacing fixes getting in the way of real diffs | ||
1450 | - deraadt@cvs.openbsd.org 2006/03/20 18:27:50 | ||
1451 | [monitor.c] | ||
1452 | spacing | ||
1453 | - deraadt@cvs.openbsd.org 2006/03/20 18:35:12 | ||
1454 | [channels.c] | ||
1455 | x11_fake_data is only ever used as u_char * | ||
1456 | - deraadt@cvs.openbsd.org 2006/03/20 18:41:43 | ||
1457 | [dns.c] | ||
1458 | cast xstrdup to propert u_char * | ||
1459 | - deraadt@cvs.openbsd.org 2006/03/20 18:42:27 | ||
1460 | [canohost.c match.c ssh.c sshconnect.c] | ||
1461 | be strict with tolower() casting | ||
1462 | - deraadt@cvs.openbsd.org 2006/03/20 18:48:34 | ||
1463 | [channels.c fatal.c kex.c packet.c serverloop.c] | ||
1464 | spacing | ||
1465 | - deraadt@cvs.openbsd.org 2006/03/20 21:11:53 | ||
1466 | [ttymodes.c] | ||
1467 | spacing | ||
1468 | - djm@cvs.openbsd.org 2006/03/25 00:05:41 | ||
1469 | [auth-bsdauth.c auth-skey.c auth.c auth2-chall.c channels.c] | ||
1470 | [clientloop.c deattack.c gss-genr.c kex.c key.c misc.c moduli.c] | ||
1471 | [monitor.c monitor_wrap.c packet.c scard.c sftp-server.c ssh-agent.c] | ||
1472 | [ssh-keyscan.c ssh.c sshconnect.c sshconnect2.c sshd.c uuencode.c] | ||
1473 | [xmalloc.c xmalloc.h] | ||
1474 | introduce xcalloc() and xasprintf() failure-checked allocations | ||
1475 | functions and use them throughout openssh | ||
1476 | |||
1477 | xcalloc is particularly important because malloc(nmemb * size) is a | ||
1478 | dangerous idiom (subject to integer overflow) and it is time for it | ||
1479 | to die | ||
1480 | |||
1481 | feedback and ok deraadt@ | ||
1482 | - djm@cvs.openbsd.org 2006/03/25 01:13:23 | ||
1483 | [buffer.c channels.c deattack.c misc.c scp.c session.c sftp-client.c] | ||
1484 | [sftp-server.c ssh-agent.c ssh-rsa.c xmalloc.c xmalloc.h auth-pam.c] | ||
1485 | [uidswap.c] | ||
1486 | change OpenSSH's xrealloc() function from being xrealloc(p, new_size) | ||
1487 | to xrealloc(p, new_nmemb, new_itemsize). | ||
1488 | |||
1489 | realloc is particularly prone to integer overflows because it is | ||
1490 | almost always allocating "n * size" bytes, so this is a far safer | ||
1491 | API; ok deraadt@ | ||
1492 | - djm@cvs.openbsd.org 2006/03/25 01:30:23 | ||
1493 | [sftp.c] | ||
1494 | "abormally" is a perfectly cromulent word, but "abnormally" is better | ||
1495 | - djm@cvs.openbsd.org 2006/03/25 13:17:03 | ||
1496 | [atomicio.c auth-bsdauth.c auth-chall.c auth-options.c auth-passwd.c] | ||
1497 | [auth-rh-rsa.c auth-rhosts.c auth-rsa.c auth-skey.c auth.c auth1.c] | ||
1498 | [auth2-chall.c auth2-hostbased.c auth2-kbdint.c auth2-none.c] | ||
1499 | [auth2-passwd.c auth2-pubkey.c auth2.c authfd.c authfile.c bufaux.c] | ||
1500 | [buffer.c canohost.c channels.c cipher-3des1.c cipher-bf1.c] | ||
1501 | [cipher-ctr.c cipher.c cleanup.c clientloop.c compat.c compress.c] | ||
1502 | [deattack.c dh.c dispatch.c fatal.c groupaccess.c hostfile.c kex.c] | ||
1503 | [kexdh.c kexdhc.c kexdhs.c kexgex.c kexgexc.c kexgexs.c key.c log.c] | ||
1504 | [mac.c match.c md-sha256.c misc.c monitor.c monitor_fdpass.c] | ||
1505 | [monitor_mm.c monitor_wrap.c msg.c nchan.c packet.c progressmeter.c] | ||
1506 | [readconf.c readpass.c rsa.c scard.c scp.c servconf.c serverloop.c] | ||
1507 | [session.c sftp-client.c sftp-common.c sftp-glob.c sftp-server.c] | ||
1508 | [sftp.c ssh-add.c ssh-agent.c ssh-dss.c ssh-keygen.c ssh-keyscan.c] | ||
1509 | [ssh-keysign.c ssh-rsa.c ssh.c sshconnect.c sshconnect1.c] | ||
1510 | [sshconnect2.c sshd.c sshlogin.c sshpty.c sshtty.c ttymodes.c] | ||
1511 | [uidswap.c uuencode.c xmalloc.c] | ||
1512 | Put $OpenBSD$ tags back (as comments) to replace the RCSID()s that | ||
1513 | Theo nuked - our scripts to sync -portable need them in the files | ||
1514 | - deraadt@cvs.openbsd.org 2006/03/25 18:29:35 | ||
1515 | [auth-rsa.c authfd.c packet.c] | ||
1516 | needed casts (always will be needed) | ||
1517 | - deraadt@cvs.openbsd.org 2006/03/25 18:30:55 | ||
1518 | [clientloop.c serverloop.c] | ||
1519 | spacing | ||
1520 | - deraadt@cvs.openbsd.org 2006/03/25 18:36:15 | ||
1521 | [sshlogin.c sshlogin.h] | ||
1522 | nicer size_t and time_t types | ||
1523 | - deraadt@cvs.openbsd.org 2006/03/25 18:40:14 | ||
1524 | [ssh-keygen.c] | ||
1525 | cast strtonum() result to right type | ||
1526 | - deraadt@cvs.openbsd.org 2006/03/25 18:41:45 | ||
1527 | [ssh-agent.c] | ||
1528 | mark two more signal handlers ARGSUSED | ||
1529 | - deraadt@cvs.openbsd.org 2006/03/25 18:43:30 | ||
1530 | [channels.c] | ||
1531 | use strtonum() instead of atoi() [limit X screens to 400, sorry] | ||
1532 | - deraadt@cvs.openbsd.org 2006/03/25 18:56:55 | ||
1533 | [bufaux.c channels.c packet.c] | ||
1534 | remove (char *) casts to a function that accepts void * for the arg | ||
1535 | - deraadt@cvs.openbsd.org 2006/03/25 18:58:10 | ||
1536 | [channels.c] | ||
1537 | delete cast not required | ||
1538 | - djm@cvs.openbsd.org 2006/03/25 22:22:43 | ||
1539 | [atomicio.h auth-options.h auth.h auth2-gss.c authfd.h authfile.h] | ||
1540 | [bufaux.h buffer.h canohost.h channels.h cipher.h clientloop.h] | ||
1541 | [compat.h compress.h crc32.c crc32.h deattack.h dh.h dispatch.h] | ||
1542 | [dns.c dns.h getput.h groupaccess.h gss-genr.c gss-serv-krb5.c] | ||
1543 | [gss-serv.c hostfile.h includes.h kex.h key.h log.h mac.h match.h] | ||
1544 | [misc.h monitor.h monitor_fdpass.h monitor_mm.h monitor_wrap.h msg.h] | ||
1545 | [myproposal.h packet.h pathnames.h progressmeter.h readconf.h rsa.h] | ||
1546 | [scard.h servconf.h serverloop.h session.h sftp-common.h sftp.h] | ||
1547 | [ssh-gss.h ssh.h ssh1.h ssh2.h sshconnect.h sshlogin.h sshpty.h] | ||
1548 | [ttymodes.h uidswap.h uuencode.h xmalloc.h] | ||
1549 | standardise spacing in $OpenBSD$ tags; requested by deraadt@ | ||
1550 | - deraadt@cvs.openbsd.org 2006/03/26 01:31:48 | ||
1551 | [uuencode.c] | ||
1552 | typo | ||
1553 | |||
1554 | 20060325 | ||
1555 | - OpenBSD CVS Sync | ||
1556 | - djm@cvs.openbsd.org 2006/03/16 04:24:42 | ||
1557 | [ssh.1] | ||
1558 | Add RFC4419 (Diffie-Hellman group exchange KEX) to the list of SSH RFCs | ||
1559 | that OpenSSH supports | ||
1560 | - deraadt@cvs.openbsd.org 2006/03/19 18:51:18 | ||
1561 | [atomicio.c auth-bsdauth.c auth-chall.c auth-krb5.c auth-options.c] | ||
1562 | [auth-pam.c auth-passwd.c auth-rh-rsa.c auth-rhosts.c auth-rsa.c] | ||
1563 | [auth-shadow.c auth-skey.c auth.c auth1.c auth2-chall.c] | ||
1564 | [auth2-hostbased.c auth2-kbdint.c auth2-none.c auth2-passwd.c] | ||
1565 | [auth2-pubkey.c auth2.c authfd.c authfile.c bufaux.c buffer.c] | ||
1566 | [canohost.c channels.c cipher-3des1.c cipher-acss.c cipher-aes.c] | ||
1567 | [cipher-bf1.c cipher-ctr.c cipher.c cleanup.c clientloop.c compat.c] | ||
1568 | [compress.c deattack.c dh.c dispatch.c dns.c entropy.c fatal.c] | ||
1569 | [groupaccess.c hostfile.c includes.h kex.c kexdh.c kexdhc.c] | ||
1570 | [kexdhs.c kexgex.c kexgexc.c kexgexs.c key.c log.c loginrec.c] | ||
1571 | [loginrec.h logintest.c mac.c match.c md-sha256.c md5crypt.c misc.c] | ||
1572 | [monitor.c monitor_fdpass.c monitor_mm.c monitor_wrap.c msg.c] | ||
1573 | [nchan.c packet.c progressmeter.c readconf.c readpass.c rsa.c] | ||
1574 | [scard.c scp.c servconf.c serverloop.c session.c sftp-client.c] | ||
1575 | [sftp-common.c sftp-glob.c sftp-server.c sftp.c ssh-add.c] | ||
1576 | [ssh-agent.c ssh-dss.c ssh-keygen.c ssh-keyscan.c ssh-keysign.c] | ||
1577 | [ssh-rand-helper.c ssh-rsa.c ssh.c sshconnect.c sshconnect1.c] | ||
1578 | [sshconnect2.c sshd.c sshlogin.c sshpty.c sshtty.c ttymodes.c] | ||
1579 | [uidswap.c uuencode.c xmalloc.c openbsd-compat/bsd-arc4random.c] | ||
1580 | [openbsd-compat/bsd-closefrom.c openbsd-compat/bsd-cygwin_util.c] | ||
1581 | [openbsd-compat/bsd-getpeereid.c openbsd-compat/bsd-misc.c] | ||
1582 | [openbsd-compat/bsd-nextstep.c openbsd-compat/bsd-snprintf.c] | ||
1583 | [openbsd-compat/bsd-waitpid.c openbsd-compat/fake-rfc2553.c] | ||
1584 | RCSID() can die | ||
1585 | - deraadt@cvs.openbsd.org 2006/03/19 18:53:12 | ||
1586 | [kex.h myproposal.h] | ||
1587 | spacing | ||
1588 | - djm@cvs.openbsd.org 2006/03/20 04:07:22 | ||
1589 | [auth2-gss.c] | ||
1590 | GSSAPI related leaks detected by Coverity via elad AT netbsd.org; | ||
1591 | reviewed by simon AT sxw.org.uk; deraadt@ ok | ||
1592 | - djm@cvs.openbsd.org 2006/03/20 04:07:49 | ||
1593 | [gss-genr.c] | ||
1594 | more GSSAPI related leaks detected by Coverity via elad AT netbsd.org; | ||
1595 | reviewed by simon AT sxw.org.uk; deraadt@ ok | ||
1596 | - djm@cvs.openbsd.org 2006/03/20 04:08:18 | ||
1597 | [gss-serv.c] | ||
1598 | last lot of GSSAPI related leaks detected by Coverity via | ||
1599 | elad AT netbsd.org; reviewed by simon AT sxw.org.uk; deraadt@ ok | ||
1600 | - deraadt@cvs.openbsd.org 2006/03/20 18:14:02 | ||
1601 | [monitor_wrap.h sshpty.h] | ||
1602 | sprinkle u_int throughout pty subsystem, ok markus | ||
1603 | - deraadt@cvs.openbsd.org 2006/03/20 18:26:55 | ||
1604 | [session.h] | ||
1605 | annoying spacing fixes getting in the way of real diffs | ||
1606 | - deraadt@cvs.openbsd.org 2006/03/20 18:41:43 | ||
1607 | [dns.c] | ||
1608 | cast xstrdup to propert u_char * | ||
1609 | - jakob@cvs.openbsd.org 2006/03/22 21:16:24 | ||
1610 | [ssh.1] | ||
1611 | simplify SSHFP example; ok jmc@ | ||
1612 | - djm@cvs.openbsd.org 2006/03/22 21:27:15 | ||
1613 | [deattack.c deattack.h] | ||
1614 | remove IV support from the CRC attack detector, OpenSSH has never used | ||
1615 | it - it only applied to IDEA-CFB, which we don't support. | ||
1616 | prompted by NetBSD Coverity report via elad AT netbsd.org; | ||
1617 | feedback markus@ "nuke it" deraadt@ | ||
1618 | |||
1619 | 20060318 | ||
1620 | - (djm) [auth-pam.c] Fix memleak in error path, from Coverity via | ||
1621 | elad AT NetBSD.org | ||
1622 | - (dtucker) [openbsd-compat/bsd-snprintf.c] Bug #1173: make fmtint() take | ||
1623 | a LLONG rather than a long. Fixes scp'ing of large files on platforms | ||
1624 | with missing/broken snprintfs. Patch from e.borovac at bom.gov.au. | ||
1625 | |||
1626 | 20060316 | ||
1627 | - (dtucker) [entropy.c] Add headers for WIFEXITED and friends. | ||
1628 | - (dtucker) [configure.ac md-sha256.c] NetBSD has sha2.h in | ||
1629 | /usr/include/crypto. Hint from djm@. | ||
1630 | - (tim) [kex.c myproposal.h md-sha256.c openbsd-compat/sha2.c,h] | ||
1631 | Disable sha256 when openssl < 0.9.7. Patch from djm@. | ||
1632 | - (djm) [kex.c] Slightly more clean deactivation of dhgex-sha256 on old | ||
1633 | OpenSSL; ok tim | ||
1634 | |||
1635 | 20060315 | ||
1636 | - (djm) OpenBSD CVS Sync: | ||
1637 | - msf@cvs.openbsd.org 2006/02/06 15:54:07 | ||
1638 | [ssh.1] | ||
1639 | - typo fix | ||
1640 | ok jmc@ | ||
1641 | - jmc@cvs.openbsd.org 2006/02/06 21:44:47 | ||
1642 | [ssh.1] | ||
1643 | make this a little less ambiguous... | ||
1644 | - stevesk@cvs.openbsd.org 2006/02/07 01:08:04 | ||
1645 | [auth-rhosts.c includes.h] | ||
1646 | move #include <netgroup.h> out of includes.h; ok markus@ | ||
1647 | - stevesk@cvs.openbsd.org 2006/02/07 01:18:09 | ||
1648 | [includes.h ssh-agent.c ssh-keyscan.c sshconnect2.c] | ||
1649 | move #include <sys/queue.h> out of includes.h; ok markus@ | ||
1650 | - stevesk@cvs.openbsd.org 2006/02/07 01:42:00 | ||
1651 | [channels.c clientloop.c clientloop.h includes.h packet.h] | ||
1652 | [serverloop.c sshpty.c sshpty.h sshtty.c ttymodes.c] | ||
1653 | move #include <termios.h> out of includes.h; ok markus@ | ||
1654 | - stevesk@cvs.openbsd.org 2006/02/07 01:52:50 | ||
1655 | [sshtty.c] | ||
1656 | "log.h" not needed | ||
1657 | - stevesk@cvs.openbsd.org 2006/02/07 03:47:05 | ||
1658 | [hostfile.c] | ||
1659 | "packet.h" not needed | ||
1660 | - stevesk@cvs.openbsd.org 2006/02/07 03:59:20 | ||
1661 | [deattack.c] | ||
1662 | duplicate #include | ||
1663 | - stevesk@cvs.openbsd.org 2006/02/08 12:15:27 | ||
1664 | [auth.c clientloop.c includes.h misc.c monitor.c readpass.c] | ||
1665 | [session.c sftp.c ssh-agent.c ssh-keysign.c ssh.c sshconnect.c] | ||
1666 | [sshd.c sshpty.c] | ||
1667 | move #include <paths.h> out of includes.h; ok markus@ | ||
1668 | - stevesk@cvs.openbsd.org 2006/02/08 12:32:49 | ||
1669 | [includes.h misc.c] | ||
1670 | move #include <netinet/tcp.h> out of includes.h; ok markus@ | ||
1671 | - stevesk@cvs.openbsd.org 2006/02/08 13:15:44 | ||
1672 | [gss-serv.c monitor.c] | ||
1673 | small KNF | ||
1674 | - stevesk@cvs.openbsd.org 2006/02/08 14:16:59 | ||
1675 | [sshconnect.c] | ||
1676 | <openssl/bn.h> not needed | ||
1677 | - stevesk@cvs.openbsd.org 2006/02/08 14:31:30 | ||
1678 | [includes.h ssh-agent.c ssh-keyscan.c ssh.c] | ||
1679 | move #include <sys/resource.h> out of includes.h; ok markus@ | ||
1680 | - stevesk@cvs.openbsd.org 2006/02/08 14:38:18 | ||
1681 | [includes.h packet.c] | ||
1682 | move #include <netinet/in_systm.h> and <netinet/ip.h> out of | ||
1683 | includes.h; ok markus@ | ||
1684 | - stevesk@cvs.openbsd.org 2006/02/08 23:51:24 | ||
1685 | [includes.h scp.c sftp-glob.c sftp-server.c] | ||
1686 | move #include <dirent.h> out of includes.h; ok markus@ | ||
1687 | - stevesk@cvs.openbsd.org 2006/02/09 00:32:07 | ||
1688 | [includes.h] | ||
1689 | #include <sys/endian.h> not needed; ok djm@ | ||
1690 | NB. ID Sync only - we still need this (but it may move later) | ||
1691 | - jmc@cvs.openbsd.org 2006/02/09 10:10:47 | ||
1692 | [sshd.8] | ||
1693 | - move some text into a CAVEATS section | ||
1694 | - merge the COMMAND EXECUTION... section into AUTHENTICATION | ||
1695 | - stevesk@cvs.openbsd.org 2006/02/10 00:27:13 | ||
1696 | [channels.c clientloop.c includes.h misc.c progressmeter.c sftp.c] | ||
1697 | [ssh.c sshd.c sshpty.c] | ||
1698 | move #include <sys/ioctl.h> out of includes.h; ok markus@ | ||
1699 | - stevesk@cvs.openbsd.org 2006/02/10 01:44:27 | ||
1700 | [includes.h monitor.c readpass.c scp.c serverloop.c session.c] | ||
1701 | [sftp.c sshconnect.c sshconnect2.c sshd.c] | ||
1702 | move #include <sys/wait.h> out of includes.h; ok markus@ | ||
1703 | - otto@cvs.openbsd.org 2006/02/11 19:31:18 | ||
1704 | [atomicio.c] | ||
1705 | type correctness; from Ray Lai in PR 5011; ok millert@ | ||
1706 | - djm@cvs.openbsd.org 2006/02/12 06:45:34 | ||
1707 | [ssh.c ssh_config.5] | ||
1708 | add a %l expansion code to the ControlPath, which is filled in with the | ||
1709 | local hostname at runtime. Requested by henning@ to avoid some problems | ||
1710 | with /home on NFS; ok dtucker@ | ||
1711 | - djm@cvs.openbsd.org 2006/02/12 10:44:18 | ||
1712 | [readconf.c] | ||
1713 | raise error when the user specifies a RekeyLimit that is smaller than 16 | ||
1714 | (the smallest of our cipher's blocksize) or big enough to cause integer | ||
1715 | wraparound; ok & feedback dtucker@ | ||
1716 | - jmc@cvs.openbsd.org 2006/02/12 10:49:44 | ||
1717 | [ssh_config.5] | ||
1718 | slight rewording; ok djm | ||
1719 | - jmc@cvs.openbsd.org 2006/02/12 10:52:41 | ||
1720 | [sshd.8] | ||
1721 | rework the description of authorized_keys a little; | ||
1722 | - jmc@cvs.openbsd.org 2006/02/12 17:57:19 | ||
1723 | [sshd.8] | ||
1724 | sort the list of options permissable w/ authorized_keys; | ||
1725 | ok djm dtucker | ||
1726 | - jmc@cvs.openbsd.org 2006/02/13 10:16:39 | ||
1727 | [sshd.8] | ||
1728 | no need to subsection the authorized_keys examples - instead, convert | ||
1729 | this to look like an actual file. also use proto 2 keys, and use IETF | ||
1730 | example addresses; | ||
1731 | - jmc@cvs.openbsd.org 2006/02/13 10:21:25 | ||
1732 | [sshd.8] | ||
1733 | small tweaks for the ssh_known_hosts section; | ||
1734 | - jmc@cvs.openbsd.org 2006/02/13 11:02:26 | ||
1735 | [sshd.8] | ||
1736 | turn this into an example ssh_known_hosts file; ok djm | ||
1737 | - jmc@cvs.openbsd.org 2006/02/13 11:08:43 | ||
1738 | [sshd.8] | ||
1739 | - avoid nasty line split | ||
1740 | - `*' does not need to be escaped | ||
1741 | - jmc@cvs.openbsd.org 2006/02/13 11:27:25 | ||
1742 | [sshd.8] | ||
1743 | sort FILES and use a -compact list; | ||
1744 | - david@cvs.openbsd.org 2006/02/15 05:08:24 | ||
1745 | [sftp-client.c] | ||
1746 | typo in comment; ok djm@ | ||
1747 | - jmc@cvs.openbsd.org 2006/02/15 16:53:20 | ||
1748 | [ssh.1] | ||
1749 | remove the IETF draft references and replace them with some updated RFCs; | ||
1750 | - jmc@cvs.openbsd.org 2006/02/15 16:55:33 | ||
1751 | [sshd.8] | ||
1752 | remove ietf draft references; RFC list now maintained in ssh.1; | ||
1753 | - jmc@cvs.openbsd.org 2006/02/16 09:05:34 | ||
1754 | [sshd.8] | ||
1755 | sync some of the FILES entries w/ ssh.1; | ||
1756 | - jmc@cvs.openbsd.org 2006/02/19 19:52:10 | ||
1757 | [sshd.8] | ||
1758 | move the sshrc stuff out of FILES, and into its own section: | ||
1759 | FILES is not a good place to document how stuff works; | ||
1760 | - jmc@cvs.openbsd.org 2006/02/19 20:02:17 | ||
1761 | [sshd.8] | ||
1762 | sync the (s)hosts.equiv FILES entries w/ those from ssh.1; | ||
1763 | - jmc@cvs.openbsd.org 2006/02/19 20:05:00 | ||
1764 | [sshd.8] | ||
1765 | grammar; | ||
1766 | - jmc@cvs.openbsd.org 2006/02/19 20:12:25 | ||
1767 | [ssh_config.5] | ||
1768 | add some vertical space; | ||
1769 | - stevesk@cvs.openbsd.org 2006/02/20 16:36:15 | ||
1770 | [authfd.c channels.c includes.h session.c ssh-agent.c ssh.c] | ||
1771 | move #include <sys/un.h> out of includes.h; ok djm@ | ||
1772 | - stevesk@cvs.openbsd.org 2006/02/20 17:02:44 | ||
1773 | [clientloop.c includes.h monitor.c progressmeter.c scp.c] | ||
1774 | [serverloop.c session.c sftp.c ssh-agent.c ssh.c sshd.c] | ||
1775 | move #include <signal.h> out of includes.h; ok markus@ | ||
1776 | - stevesk@cvs.openbsd.org 2006/02/20 17:19:54 | ||
1777 | [auth-rhosts.c auth-rsa.c auth.c auth2-none.c auth2-pubkey.c] | ||
1778 | [authfile.c clientloop.c includes.h readconf.c scp.c session.c] | ||
1779 | [sftp-client.c sftp-common.c sftp-common.h sftp-glob.c] | ||
1780 | [sftp-server.c sftp.c ssh-add.c ssh-keygen.c ssh.c sshconnect.c] | ||
1781 | [sshconnect2.c sshd.c sshpty.c] | ||
1782 | move #include <sys/stat.h> out of includes.h; ok markus@ | ||
1783 | - stevesk@cvs.openbsd.org 2006/02/22 00:04:45 | ||
1784 | [canohost.c clientloop.c includes.h match.c readconf.c scp.c ssh.c] | ||
1785 | [sshconnect.c] | ||
1786 | move #include <ctype.h> out of includes.h; ok djm@ | ||
1787 | - jmc@cvs.openbsd.org 2006/02/24 10:25:14 | ||
1788 | [ssh_config.5] | ||
1789 | add section on patterns; | ||
1790 | from dtucker + myself | ||
1791 | - jmc@cvs.openbsd.org 2006/02/24 10:33:54 | ||
1792 | [sshd_config.5] | ||
1793 | signpost to PATTERNS; | ||
1794 | - jmc@cvs.openbsd.org 2006/02/24 10:37:07 | ||
1795 | [ssh_config.5] | ||
1796 | tidy up the refs to PATTERNS; | ||
1797 | - jmc@cvs.openbsd.org 2006/02/24 10:39:52 | ||
1798 | [sshd.8] | ||
1799 | signpost to PATTERNS section; | ||
1800 | - jmc@cvs.openbsd.org 2006/02/24 20:22:16 | ||
1801 | [ssh-keysign.8 ssh_config.5 sshd_config.5] | ||
1802 | some consistency fixes; | ||
1803 | - jmc@cvs.openbsd.org 2006/02/24 20:31:31 | ||
1804 | [ssh.1 ssh_config.5 sshd.8 sshd_config.5] | ||
1805 | more consistency fixes; | ||
1806 | - jmc@cvs.openbsd.org 2006/02/24 23:20:07 | ||
1807 | [ssh_config.5] | ||
1808 | some grammar/wording fixes; | ||
1809 | - jmc@cvs.openbsd.org 2006/02/24 23:43:57 | ||
1810 | [sshd_config.5] | ||
1811 | some grammar/wording fixes; | ||
1812 | - jmc@cvs.openbsd.org 2006/02/24 23:51:17 | ||
1813 | [sshd_config.5] | ||
1814 | oops - bits i missed; | ||
1815 | - jmc@cvs.openbsd.org 2006/02/25 12:26:17 | ||
1816 | [ssh_config.5] | ||
1817 | document the possible values for KbdInteractiveDevices; | ||
1818 | help/ok dtucker | ||
1819 | - jmc@cvs.openbsd.org 2006/02/25 12:28:34 | ||
1820 | [sshd_config.5] | ||
1821 | document the order in which allow/deny directives are processed; | ||
1822 | help/ok dtucker | ||
1823 | - jmc@cvs.openbsd.org 2006/02/26 17:17:18 | ||
1824 | [ssh_config.5] | ||
1825 | move PATTERNS to the end of the main body; requested by dtucker | ||
1826 | - jmc@cvs.openbsd.org 2006/02/26 18:01:13 | ||
1827 | [sshd_config.5] | ||
1828 | subsection is pointless here; | ||
1829 | - jmc@cvs.openbsd.org 2006/02/26 18:03:10 | ||
1830 | [ssh_config.5] | ||
1831 | comma; | ||
1832 | - djm@cvs.openbsd.org 2006/02/28 01:10:21 | ||
1833 | [session.c] | ||
1834 | fix logout recording when privilege separation is disabled, analysis and | ||
1835 | patch from vinschen at redhat.com; tested by dtucker@ ok deraadt@ | ||
1836 | NB. ID sync only - patch already in portable | ||
1837 | - djm@cvs.openbsd.org 2006/03/04 04:12:58 | ||
1838 | [serverloop.c] | ||
1839 | move a debug() outside of a signal handler; ok markus@ a little while back | ||
1840 | - djm@cvs.openbsd.org 2006/03/12 04:23:07 | ||
1841 | [ssh.c] | ||
1842 | knf nit | ||
1843 | - djm@cvs.openbsd.org 2006/03/13 08:16:00 | ||
1844 | [sshd.c] | ||
1845 | don't log that we are listening on a socket before the listen() call | ||
1846 | actually succeeds, bz #1162 reported by Senthil Kumar; ok dtucker@ | ||
1847 | - dtucker@cvs.openbsd.org 2006/03/13 08:33:00 | ||
1848 | [packet.c] | ||
1849 | Set TCP_NODELAY for all connections not just "interactive" ones. Fixes | ||
1850 | poor performance and protocol stalls under some network conditions (mindrot | ||
1851 | bugs #556 and #981). Patch originally from markus@, ok djm@ | ||
1852 | - dtucker@cvs.openbsd.org 2006/03/13 08:43:16 | ||
1853 | [ssh-keygen.c] | ||
1854 | Make ssh-keygen handle CR and CRLF line termination when converting IETF | ||
1855 | format keys, in adition to vanilla LF. mindrot #1157, tested by Chris | ||
1856 | Pepper, ok djm@ | ||
1857 | - dtucker@cvs.openbsd.org 2006/03/13 10:14:29 | ||
1858 | [misc.c ssh_config.5 sshd_config.5] | ||
1859 | Allow config directives to contain whitespace by surrounding them by double | ||
1860 | quotes. mindrot #482, man page help from jmc@, ok djm@ | ||
1861 | - dtucker@cvs.openbsd.org 2006/03/13 10:26:52 | ||
1862 | [authfile.c authfile.h ssh-add.c] | ||
1863 | Make ssh-add check file permissions before attempting to load private | ||
1864 | key files multiple times; it will fail anyway and this prevents confusing | ||
1865 | multiple prompts and warnings. mindrot #1138, ok djm@ | ||
1866 | - djm@cvs.openbsd.org 2006/03/14 00:15:39 | ||
1867 | [canohost.c] | ||
1868 | log the originating address and not just the name when a reverse | ||
1869 | mapping check fails, requested by linux AT linuon.com | ||
1870 | - markus@cvs.openbsd.org 2006/03/14 16:32:48 | ||
1871 | [ssh_config.5 sshd_config.5] | ||
1872 | *AliveCountMax applies to protcol v2 only; ok dtucker, djm | ||
1873 | - djm@cvs.openbsd.org 2006/03/07 09:07:40 | ||
1874 | [kex.c kex.h monitor.c myproposal.h ssh-keyscan.c sshconnect2.c sshd.c] | ||
1875 | Implement the diffie-hellman-group-exchange-sha256 key exchange method | ||
1876 | using the SHA256 code in libc (and wrapper to make it into an OpenSSL | ||
1877 | EVP), interop tested against CVS PuTTY | ||
1878 | NB. no portability bits committed yet | ||
1879 | - (djm) [configure.ac defines.h kex.c md-sha256.c] | ||
1880 | [openbsd-compat/sha2.h openbsd-compat/openbsd-compat.h] | ||
1881 | [openbsd-compat/sha2.c] First stab at portability glue for SHA256 | ||
1882 | KEX support, should work with libc SHA256 support or OpenSSL | ||
1883 | EVP_sha256 if present | ||
1884 | - (djm) [includes.h] Restore accidentally dropped netinet/in.h | ||
1885 | - (djm) [Makefile.in openbsd-compat/Makefile.in] Add added files | ||
1886 | - (djm) [md-sha256.c configure.ac] md-sha256.c needs sha2.h if present | ||
1887 | - (djm) [regress/.cvsignore] Ignore Makefile here | ||
1888 | - (djm) [loginrec.c] Need stat.h | ||
1889 | - (djm) [openbsd-compat/sha2.h] Avoid include macro clash with | ||
1890 | system sha2.h | ||
1891 | - (djm) [ssh-rand-helper.c] Needs a bunch of headers | ||
1892 | - (djm) [ssh-agent.c] Restore dropped stat.h | ||
1893 | - (djm) [openbsd-compat/sha2.h openbsd-compat/sha2.c] Comment out | ||
1894 | SHA384, which we don't need and doesn't compile without tweaks | ||
1895 | - (djm) [auth-pam.c clientloop.c includes.h monitor.c session.c] | ||
1896 | [sftp-client.c ssh-keysign.c ssh.c sshconnect.c sshconnect2.c] | ||
1897 | [sshd.c openbsd-compat/bsd-misc.c openbsd-compat/bsd-openpty.c] | ||
1898 | [openbsd-compat/glob.c openbsd-compat/mktemp.c] | ||
1899 | [openbsd-compat/readpassphrase.c] Lots of include fixes for | ||
1900 | OpenSolaris | ||
1901 | - (tim) [includes.h] put sys/stat.h back in to quiet some "macro redefined:" | ||
1902 | - (tim) [openssh/sshpty.c openssh/openbsd-compat/port-tun.c] put in some | ||
1903 | includes removed from includes.h | ||
1904 | - (dtucker) [configure.ac] Fix glob test conversion to AC_TRY_COMPILE | ||
1905 | - (djm) [includes.h] Put back paths.h, it is needed in defines.h | ||
1906 | - (dtucker) [openbsd-compat/openbsd-compat.h] AIX (at least) needs | ||
1907 | sys/ioctl.h for struct winsize. | ||
1908 | - (dtucker) [configure.ac] login_cap.h requires sys/types.h on NetBSD. | ||
1909 | |||
1910 | 20060313 | ||
1911 | - (dtucker) [configure.ac] Bug #1171: Don't use printf("%lld", longlong) | ||
1912 | since not all platforms support it. Instead, use internal equivalent while | ||
1913 | computing LLONG_MIN and LLONG_MAX. Remove special case for alpha-dec-osf* | ||
1914 | as it's no longer required. Tested by Bernhard Simon, ok djm@ | ||
1915 | |||
1916 | 20060304 | ||
1917 | - (dtucker) [contrib/cygwin/ssh-host-config] Require use of lastlog as a | ||
1918 | file rather than directory, required as Cygwin will be importing lastlog(1). | ||
1919 | Also tightens up permissions on the file. Patch from vinschen@redhat.com. | ||
1920 | - (dtucker) [gss-serv-krb5.c] Bug #1166: Correct #ifdefs for gssapi_krb5.h | ||
1921 | includes. Patch from gentoo.riverrat at gmail.com. | ||
1922 | |||
1923 | 20060226 | ||
1924 | - (dtucker) [configure.ac] Bug #1156: QNX apparently needs SSHD_ACQUIRES_CTTY | ||
1925 | patch from kraai at ftbfs.org. | ||
1926 | |||
1927 | 20060223 | ||
1928 | - (dtucker) [sshd_config sshd_config.5] Update UsePAM to reflect current | ||
1929 | reality. Pointed out by tryponraj at gmail.com. | ||
1930 | |||
1931 | 20060222 | ||
1932 | - (dtucker) [openbsd-compat/openssl-compat.{c,h}] Minor tidy up: only | ||
1933 | compile in compat code if required. | ||
1934 | |||
1935 | 20060221 | ||
1936 | - (dtucker) [openbsd-compat/openssl-compat.h] Prevent warning about | ||
1937 | redefinition of SSLeay_add_all_algorithms. | ||
1938 | |||
1939 | 20060220 | ||
1940 | - (dtucker) [INSTALL configure.ac openbsd-compat/openssl-compat.{c,h}] | ||
1941 | Add optional enabling of OpenSSL's (hardware) Engine support, via | ||
1942 | configure --with-ssl-engine. Based in part on a diff by michal at | ||
1943 | logix.cz. | ||
1944 | |||
1945 | 20060219 | ||
1946 | - (dtucker) [Makefile.in configure.ac, added openbsd-compat/regress/] | ||
1947 | Add first attempt at regress tests for compat library. ok djm@ | ||
1948 | |||
1949 | 20060214 | ||
1950 | - (tim) [buildpkg.sh.in] Make the names consistent. | ||
1951 | s/pkg_post_make_install_fixes.sh/pkg-post-make-install-fixes.sh/ OK dtucker@ | ||
1952 | |||
1953 | 20060212 | ||
1954 | - (dtucker) [openbsd-compat/bsd-cygwin_util.c] Make loop counter unsigned | ||
1955 | to silence compiler warning, from vinschen at redhat.com. | ||
1956 | - (tim) [configure.ac] Bug #1149. Disable /etc/default/login check for QNX. | ||
1957 | - (dtucker) [README version.h contrib/caldera/openssh.spec | ||
1958 | contrib/redhat/openssh.spec contrib/suse/openssh.spec] Bump version | ||
1959 | strings to match 4.3p2 release. | ||
4 | 1960 | ||
5 | 20060208 | 1961 | 20060208 |
6 | - (tim) [session.c] Logout records were not updated on systems with | 1962 | - (tim) [session.c] Logout records were not updated on systems with |
7 | post auth privsep disabled due to bug 1086 changes. Analysis and patch | 1963 | post auth privsep disabled due to bug 1086 changes. Analysis and patch |
8 | by vinschen at redhat.com. OK tim@, dtucker@. | 1964 | by vinschen at redhat.com. OK tim@, dtucker@. |
9 | - (dtucker) [configure.ac] Typo in Ultrix and NewsOS sections (NEED_SETPRGP | 1965 | - (dtucker) [configure.ac] Typo in Ultrix and NewsOS sections (NEED_SETPRGP |
10 | -> NEED_SETPGRP), reported by Berhard Simon. ok tim@ | 1966 | -> NEED_SETPGRP), reported by Bernhard Simon. ok tim@ |
11 | 1967 | ||
12 | 20060206 | 1968 | 20060206 |
13 | - (tim) [configure.ac] Remove unnecessary tests for net/if.h and | 1969 | - (tim) [configure.ac] Remove unnecessary tests for net/if.h and |
@@ -860,3019 +2816,4 @@ | |||
860 | OpenServer 6 and add osr5bigcrypt support so when someone migrates | 2816 | OpenServer 6 and add osr5bigcrypt support so when someone migrates |
861 | passwords between UnixWare and OpenServer they will still work. OK dtucker@ | 2817 | passwords between UnixWare and OpenServer they will still work. OK dtucker@ |
862 | 2818 | ||
863 | 20050901 | 2819 | $Id: ChangeLog,v 1.4635.2.1 2007/03/06 10:27:55 djm Exp $ |
864 | - (djm) Update RPM spec file versions | ||
865 | |||
866 | 20050831 | ||
867 | - (djm) OpenBSD CVS Sync | ||
868 | - djm@cvs.openbsd.org 2005/08/30 22:08:05 | ||
869 | [gss-serv.c sshconnect2.c] | ||
870 | destroy credentials if krb5_kuserok() call fails. Stops credentials being | ||
871 | delegated to users who are not authorised for GSSAPIAuthentication when | ||
872 | GSSAPIDeletegateCredentials=yes and another authentication mechanism | ||
873 | succeeds; bz#1073 reported by paul.moore AT centrify.com, fix by | ||
874 | simon AT sxw.org.uk, tested todd@ biorn@ jakob@; ok deraadt@ | ||
875 | - markus@cvs.openbsd.org 2005/08/31 09:28:42 | ||
876 | [version.h] | ||
877 | 4.2 | ||
878 | - (dtucker) [README] Update release note URL to 4.2 | ||
879 | - (tim) [configure.ac auth.c defines.h session.c openbsd-compat/port-uw.c | ||
880 | openbsd-compat/port-uw.h openbsd-compat/xcrypt.c] libiaf cleanup. Disable | ||
881 | libiaf bits for OpenServer6. Free memory allocated by ia_get_logpwd(). | ||
882 | Feedback and OK dtucker@ | ||
883 | |||
884 | 20050830 | ||
885 | - (tim) [configure.ac] Back out last change. It needs to be done differently. | ||
886 | |||
887 | 20050829 | ||
888 | - (tim) [configure.ac] ia_openinfo() seems broken on OSR6. Limit UW long | ||
889 | password support to 7.x for now. | ||
890 | |||
891 | 20050826 | ||
892 | - (tim) [CREDITS LICENCE auth.c configure.ac defines.h includes.h session.c | ||
893 | openbsd-compat/Makefile.in openbsd-compat/openbsd-compat.h | ||
894 | openbsd-compat/xcrypt.c] New files [openssh/openbsd-compat/port-uw.c | ||
895 | openssh/openbsd-compat/port-uw.h] Support long passwords (> 8-char) | ||
896 | on UnixWare 7 from Dhiraj Gulati and Ahsan Rashid. Cleanup and testing | ||
897 | by tim@. Feedback and OK dtucker@ | ||
898 | |||
899 | 20050823 | ||
900 | - (dtucker) [regress/test-exec.sh] Do not prepend an extra "/" to a fully- | ||
901 | qualified sshd pathname since some systems (eg Cygwin) may consider "/foo" | ||
902 | and "//foo" to be different. Spotted by vinschen at redhat.com. | ||
903 | - (tim) [configure.ac] Not all gcc's support -Wsign-compare. Enhancements | ||
904 | and OK dtucker@ | ||
905 | - (tim) [defines.h] PATH_MAX bits for OpenServer OK dtucker@ | ||
906 | |||
907 | 20050821 | ||
908 | - (dtucker) [configure.ac defines.h includes.h sftp.c] Add support for | ||
909 | LynxOS, patch from Olli Savia (ops at iki.fi). ok djm@ | ||
910 | |||
911 | 20050816 | ||
912 | - (djm) [ttymodes.c] bugzilla #1025: Fix encoding of _POSIX_VDISABLE, | ||
913 | from Jacob Nevins; ok dtucker@ | ||
914 | |||
915 | 20050815 | ||
916 | - (tim) [sftp.c] wrap el_end() in #ifdef USE_LIBEDIT | ||
917 | - (tim) [configure.ac] corrections to libedit tests. Report and patches | ||
918 | by skeleten AT shillest.net | ||
919 | |||
920 | 20050812 | ||
921 | - (djm) OpenBSD CVS Sync | ||
922 | - markus@cvs.openbsd.org 2005/07/28 17:36:22 | ||
923 | [packet.c] | ||
924 | missing packet_init_compression(); from solar | ||
925 | - djm@cvs.openbsd.org 2005/07/30 01:26:16 | ||
926 | [ssh.c] | ||
927 | fix -D listen_host initialisation, so it picks up gateway_ports setting | ||
928 | correctly | ||
929 | - djm@cvs.openbsd.org 2005/07/30 02:03:47 | ||
930 | [readconf.c] | ||
931 | listen_hosts initialisation here too; spotted greg AT y2005.nest.cx | ||
932 | - dtucker@cvs.openbsd.org 2005/08/06 10:03:12 | ||
933 | [servconf.c] | ||
934 | Unbreak sshd ListenAddress for bare IPv6 addresses. | ||
935 | Report from Janusz Mucka; ok djm@ | ||
936 | - jaredy@cvs.openbsd.org 2005/08/08 13:22:48 | ||
937 | [sftp.c] | ||
938 | sftp prompt enhancements: | ||
939 | - in non-interactive mode, do not print an empty prompt at the end | ||
940 | before finishing | ||
941 | - print newline after EOF in editline mode | ||
942 | - call el_end() in editline mode | ||
943 | ok dtucker djm | ||
944 | |||
945 | 20050810 | ||
946 | - (dtucker) [configure.ac] Test libedit library and headers for compatibility. | ||
947 | Report from skeleten AT shillest.net, ok djm@ | ||
948 | - (dtucker) [LICENCE configure.ac defines.h openbsd-compat/realpath.c] | ||
949 | Sync current (thread-safe) version of realpath.c from OpenBSD (which is | ||
950 | in turn based on FreeBSD's). ok djm@ | ||
951 | |||
952 | 20050809 | ||
953 | - (tim) [configure.ac] Allow --with-audit=no. OK dtucker@ | ||
954 | Report by skeleten AT shillest.net | ||
955 | |||
956 | 20050803 | ||
957 | - (dtucker) [openbsd-compat/fake-rfc2553.h] Check for EAI_* defines | ||
958 | individually and use a value less likely to collide with real values from | ||
959 | netdb.h. Fixes compile warnings on FreeBSD 5.3. ok djm@ | ||
960 | - (dtucker) [openbsd-compat/fake-rfc2553.h] MAX_INT -> INT_MAX since the | ||
961 | latter is specified in the standard. | ||
962 | |||
963 | 20050802 | ||
964 | - (dtucker) OpenBSD CVS Sync | ||
965 | - dtucker@cvs.openbsd.org 2005/07/27 10:39:03 | ||
966 | [scp.c hostfile.c sftp-client.c] | ||
967 | Silence bogus -Wuninitialized warnings; ok djm@ | ||
968 | - (dtucker) [configure.ac] Enable -Wuninitialized by default when compiling | ||
969 | with gcc. ok djm@ | ||
970 | - (dtucker) [configure.ac] Add a --with-Werror option to configure for | ||
971 | adding -Werror to CFLAGS when all of the configure tests are done. ok djm@ | ||
972 | |||
973 | 20050726 | ||
974 | - (dtucker) [configure.ac] Update zlib warning message too, pointed out by | ||
975 | tim@. | ||
976 | - (djm) OpenBSD CVS Sync | ||
977 | - otto@cvs.openbsd.org 2005/07/19 15:32:26 | ||
978 | [auth-passwd.c] | ||
979 | auth_usercheck(3) can return NULL, so check for that. Report from | ||
980 | mpech@. ok markus@ | ||
981 | - markus@cvs.openbsd.org 2005/07/25 11:59:40 | ||
982 | [kex.c kex.h myproposal.h packet.c packet.h servconf.c session.c] | ||
983 | [sshconnect2.c sshd.c sshd_config sshd_config.5] | ||
984 | add a new compression method that delays compression until the user | ||
985 | has been authenticated successfully and set compression to 'delayed' | ||
986 | for sshd. | ||
987 | this breaks older openssh clients (< 3.5) if they insist on | ||
988 | compression, so you have to re-enable compression in sshd_config. | ||
989 | ok djm@ | ||
990 | |||
991 | 20050725 | ||
992 | - (dtucker) [configure.ac] Update zlib version check for CAN-2005-2096. | ||
993 | |||
994 | 20050717 | ||
995 | - OpenBSD CVS Sync | ||
996 | - djm@cvs.openbsd.org 2005/07/16 01:35:24 | ||
997 | [auth1.c channels.c cipher.c clientloop.c kex.c session.c ssh.c] | ||
998 | [sshconnect.c] | ||
999 | spacing | ||
1000 | - (djm) [acss.c auth-pam.c auth-shadow.c auth-skey.c auth1.c canohost.c] | ||
1001 | [cipher-acss.c loginrec.c ssh-rand-helper.c sshd.c] Fix whitespace at EOL | ||
1002 | in portable too ("perl -p -i -e 's/\s+$/\n/' *.[ch]") | ||
1003 | - (djm) [auth-pam.c sftp.c] spaces vs. tabs at start of line | ||
1004 | - djm@cvs.openbsd.org 2005/07/17 06:49:04 | ||
1005 | [channels.c channels.h session.c session.h] | ||
1006 | Fix a number of X11 forwarding channel leaks: | ||
1007 | 1. Refuse multiple X11 forwarding requests on the same session | ||
1008 | 2. Clean up all listeners after a single_connection X11 forward, not just | ||
1009 | the one that made the single connection | ||
1010 | 3. Destroy X11 listeners when the session owning them goes away | ||
1011 | testing and ok dtucker@ | ||
1012 | - djm@cvs.openbsd.org 2005/07/17 07:17:55 | ||
1013 | [auth-rh-rsa.c auth-rhosts.c auth2-chall.c auth2-gss.c channels.c] | ||
1014 | [cipher-ctr.c gss-genr.c gss-serv.c kex.c moduli.c readconf.c] | ||
1015 | [serverloop.c session.c sftp-client.c sftp.c ssh-add.c ssh-keygen.c] | ||
1016 | [sshconnect.c sshconnect2.c] | ||
1017 | knf says that a 2nd level indent is four (not three or five) spaces | ||
1018 | -(djm) [audit.c auth1.c auth2.c entropy.c loginrec.c serverloop.c] | ||
1019 | [ssh-rand-helper.c] fix portable 2nd level indents at 4 spaces too | ||
1020 | - (djm) [monitor.c monitor_wrap.c] -Wsign-compare for PAM monitor calls | ||
1021 | |||
1022 | 20050716 | ||
1023 | - (dtucker) [auth-pam.c] Ensure that only one side of the authentication | ||
1024 | socketpair stays open on in both the monitor and PAM process. Patch from | ||
1025 | Joerg Sonnenberger. | ||
1026 | |||
1027 | 20050714 | ||
1028 | - (dtucker) OpenBSD CVS Sync | ||
1029 | - dtucker@cvs.openbsd.org 2005/07/06 09:33:05 | ||
1030 | [ssh.1] | ||
1031 | clarify meaning of ssh -b ; with & ok jmc@ | ||
1032 | - dtucker@cvs.openbsd.org 2005/07/08 09:26:18 | ||
1033 | [misc.c] | ||
1034 | Make comment match code; ok djm@ | ||
1035 | - markus@cvs.openbsd.org 2005/07/08 09:41:33 | ||
1036 | [channels.h] | ||
1037 | race when efd gets closed while there is still buffered data: | ||
1038 | change CHANNEL_EFD_OUTPUT_ACTIVE() | ||
1039 | 1) c->efd must always be valid AND | ||
1040 | 2a) no EOF has been seen OR | ||
1041 | 2b) there is buffered data | ||
1042 | report, initial fix and testing Chuck Cranor | ||
1043 | - dtucker@cvs.openbsd.org 2005/07/08 10:20:41 | ||
1044 | [ssh_config.5] | ||
1045 | change BindAddress to match recent ssh -b change; prompted by markus@ | ||
1046 | - jmc@cvs.openbsd.org 2005/07/08 12:53:10 | ||
1047 | [ssh_config.5] | ||
1048 | new sentence, new line; | ||
1049 | - dtucker@cvs.openbsd.org 2005/07/14 04:00:43 | ||
1050 | [misc.h] | ||
1051 | use __sentinel__ attribute; ok deraadt@ djm@ markus@ | ||
1052 | - (dtucker) [configure.ac defines.h] Define __sentinel__ to nothing if the | ||
1053 | compiler doesn't understand it to prevent warnings. If any mainstream | ||
1054 | compiler versions acquire it we can test for those versions. Based on | ||
1055 | discussion with djm@. | ||
1056 | |||
1057 | 20050707 | ||
1058 | - dtucker [auth-krb5.c auth.h gss-serv-krb5.c] Move KRB5CCNAME generation for | ||
1059 | the MIT Kerberos code path into a common function and expand mkstemp | ||
1060 | template to be consistent with the rest of OpenSSH. From sxw at | ||
1061 | inf.ed.ac.uk, ok djm@ | ||
1062 | - (dtucker) [auth-krb5.c] There's no guarantee that snprintf will set errno | ||
1063 | in the case where the buffer is insufficient, so always return ENOMEM. | ||
1064 | Also pointed out by sxw at inf.ed.ac.uk. | ||
1065 | - (dtucker) [acconfig.h auth-krb5.c configure.ac gss-serv-krb5.c] Remove | ||
1066 | calls to krb5_init_ets, which has not been required since krb-1.1.x and | ||
1067 | most Kerberos versions no longer export in their public API. From sxw | ||
1068 | at inf.ed.ac.uk, ok djm@ | ||
1069 | |||
1070 | 20050706 | ||
1071 | - (djm) OpenBSD CVS Sync | ||
1072 | - markus@cvs.openbsd.org 2005/07/01 13:19:47 | ||
1073 | [channels.c] | ||
1074 | don't free() if getaddrinfo() fails; report mpech@ | ||
1075 | - djm@cvs.openbsd.org 2005/07/04 00:58:43 | ||
1076 | [channels.c clientloop.c clientloop.h misc.c misc.h ssh.c ssh_config.5] | ||
1077 | implement support for X11 and agent forwarding over multiplex slave | ||
1078 | connections. Because of protocol limitations, the slave connections inherit | ||
1079 | the master's DISPLAY and SSH_AUTH_SOCK rather than distinctly forwarding | ||
1080 | their own. | ||
1081 | ok dtucker@ "put it in" deraadt@ | ||
1082 | - jmc@cvs.openbsd.org 2005/07/04 11:29:51 | ||
1083 | [ssh_config.5] | ||
1084 | fix Xr and a little grammar; | ||
1085 | - markus@cvs.openbsd.org 2005/07/04 14:04:11 | ||
1086 | [channels.c] | ||
1087 | don't forget to set x11_saved_display | ||
1088 | |||
1089 | 20050626 | ||
1090 | - (djm) OpenBSD CVS Sync | ||
1091 | - djm@cvs.openbsd.org 2005/06/17 22:53:47 | ||
1092 | [ssh.c sshconnect.c] | ||
1093 | Fix ControlPath's %p expanding to "0" for a default port, | ||
1094 | spotted dwmw2 AT infradead.org; ok markus@ | ||
1095 | - djm@cvs.openbsd.org 2005/06/18 04:30:36 | ||
1096 | [ssh.c ssh_config.5] | ||
1097 | allow ControlPath=none, patch from dwmw2 AT infradead.org; ok dtucker@ | ||
1098 | - djm@cvs.openbsd.org 2005/06/25 22:47:49 | ||
1099 | [ssh.c] | ||
1100 | do the default port filling code a few lines earlier, so it really | ||
1101 | does fix %p | ||
1102 | |||
1103 | 20050618 | ||
1104 | - (djm) OpenBSD CVS Sync | ||
1105 | - djm@cvs.openbsd.org 2005/05/20 12:57:01; | ||
1106 | [auth1.c] split protocol 1 auth methods into separate functions, makes | ||
1107 | authloop much more readable; fixes and ok markus@ (portable ok & | ||
1108 | polish dtucker@) | ||
1109 | - djm@cvs.openbsd.org 2005/06/17 02:44:33 | ||
1110 | [auth1.c] make this -Wsign-compare clean; ok avsm@ markus@ | ||
1111 | - (djm) [loginrec.c ssh-rand-helper.c] Fix -Wsign-compare for portable, | ||
1112 | tested and fixes tim@ | ||
1113 | |||
1114 | 20050617 | ||
1115 | - (djm) OpenBSD CVS Sync | ||
1116 | - djm@cvs.openbsd.org 2005/06/16 03:38:36 | ||
1117 | [channels.c channels.h clientloop.c clientloop.h ssh.c] | ||
1118 | move x11_get_proto from ssh.c to clientloop.c, to make muliplexed xfwd | ||
1119 | easier later; ok deraadt@ | ||
1120 | - markus@cvs.openbsd.org 2005/06/16 08:00:00 | ||
1121 | [canohost.c channels.c sshd.c] | ||
1122 | don't exit if getpeername fails for forwarded ports; bugzilla #1054; | ||
1123 | ok djm | ||
1124 | - djm@cvs.openbsd.org 2005/06/17 02:44:33 | ||
1125 | [auth-rsa.c auth.c auth1.c auth2-chall.c auth2-gss.c authfd.c authfile.c] | ||
1126 | [bufaux.c canohost.c channels.c cipher.c clientloop.c dns.c gss-serv.c] | ||
1127 | [kex.c kex.h key.c mac.c match.c misc.c packet.c packet.h scp.c] | ||
1128 | [servconf.c session.c session.h sftp-client.c sftp-server.c sftp.c] | ||
1129 | [ssh-keyscan.c ssh-rsa.c sshconnect.c sshconnect1.c sshconnect2.c sshd.c] | ||
1130 | make this -Wsign-compare clean; ok avsm@ markus@ | ||
1131 | NB. auth1.c changes not committed yet (conflicts with uncommitted sync) | ||
1132 | NB2. more work may be needed to make portable Wsign-compare clean | ||
1133 | - (dtucker) [cipher.c openbsd-compat/openbsd-compat.h | ||
1134 | openbsd-compat/openssl-compat.c] only include openssl compat stuff where | ||
1135 | it's needed as it can cause conflicts elsewhere (eg xcrypt.c). Found by | ||
1136 | and ok tim@ | ||
1137 | |||
1138 | 20050616 | ||
1139 | - (djm) OpenBSD CVS Sync | ||
1140 | - jaredy@cvs.openbsd.org 2005/06/07 13:25:23 | ||
1141 | [progressmeter.c] | ||
1142 | catch SIGWINCH and resize progress meter accordingly; ok markus dtucker | ||
1143 | - djm@cvs.openbsd.org 2005/06/06 11:20:36 | ||
1144 | [auth.c auth.h misc.c misc.h ssh.c ssh_config.5 sshconnect.c] | ||
1145 | introduce a generic %foo expansion function. replace existing % expansion | ||
1146 | and add expansion to ControlPath; ok markus@ | ||
1147 | - djm@cvs.openbsd.org 2005/06/08 03:50:00 | ||
1148 | [ssh-keygen.1 ssh-keygen.c sshd.8] | ||
1149 | increase default rsa/dsa key length from 1024 to 2048 bits; | ||
1150 | ok markus@ deraadt@ | ||
1151 | - djm@cvs.openbsd.org 2005/06/08 11:25:09 | ||
1152 | [clientloop.c readconf.c readconf.h ssh.c ssh_config.5] | ||
1153 | add ControlMaster=auto/autoask options to support opportunistic | ||
1154 | multiplexing; tested avsm@ and jakob@, ok markus@ | ||
1155 | - dtucker@cvs.openbsd.org 2005/06/09 13:43:49 | ||
1156 | [cipher.c] | ||
1157 | Correctly initialize end of array sentinel; ok djm@ | ||
1158 | (Id sync only, change already in portable) | ||
1159 | |||
1160 | 20050609 | ||
1161 | - (dtucker) [cipher.c openbsd-compat/Makefile.in | ||
1162 | openbsd-compat/openbsd-compat.h openbsd-compat/openssl-compat.{c,h}] | ||
1163 | Move compatibility code for supporting older OpenSSL versions to the | ||
1164 | compat layer. Suggested by and "no objection" djm@ | ||
1165 | |||
1166 | 20050607 | ||
1167 | - (dtucker) [configure.ac] Continue the hunt for LLONG_MIN and LLONG_MAX: | ||
1168 | in today's episode we attempt to coax it from limits.h where it may be | ||
1169 | hiding, failing that we take the DIY approach. Tested by tim@ | ||
1170 | |||
1171 | 20050603 | ||
1172 | - (dtucker) [configure.ac] Only try gcc -std=gnu99 if LLONG_MAX isn't | ||
1173 | defined, and check that it helps before keeping it in CFLAGS. Some old | ||
1174 | gcc's don't set an error code when encountering an unknown value in -std. | ||
1175 | Found and tested by tim@. | ||
1176 | - (dtucker) [configure.ac] Point configure's reporting address at the | ||
1177 | openssh-unix-dev list. ok tim@ djm@ | ||
1178 | |||
1179 | 20050602 | ||
1180 | - (tim) [configure.ac] Some platforms need sys/types.h for arpa/nameser.h. | ||
1181 | Take AC_CHECK_HEADERS test out of ultrix section. It caused other platforms | ||
1182 | to skip builtin standard includes tests. (first AC_CHECK_HEADERS test | ||
1183 | must be run on all platforms) Add missing ;; to case statement. OK dtucker@ | ||
1184 | |||
1185 | 20050601 | ||
1186 | - (dtucker) [configure.ac] Look for _getshort and _getlong in | ||
1187 | arpa/nameser.h. | ||
1188 | - (dtucker) [configure.ac openbsd-compat/Makefile.in openbsd-compat/strtoll.c] | ||
1189 | Add strtoll to the compat library, from OpenBSD. | ||
1190 | - (dtucker) OpenBSD CVS Sync | ||
1191 | - avsm@cvs.openbsd.org 2005/05/26 02:08:05 | ||
1192 | [scp.c] | ||
1193 | If copying multiple files to a target file (which normally fails, as it | ||
1194 | must be a target directory), kill the spawned ssh child before exiting. | ||
1195 | This stops it trying to authenticate and spewing lots of output. | ||
1196 | deraadt@ ok | ||
1197 | - dtucker@cvs.openbsd.org 2005/05/26 09:08:12 | ||
1198 | [ssh-keygen.c] | ||
1199 | uint32_t -> u_int32_t for consistency; ok djm@ | ||
1200 | - djm@cvs.openbsd.org 2005/05/27 08:30:37 | ||
1201 | [ssh.c] | ||
1202 | fix -O for cases where no ControlPath has been specified or socket at | ||
1203 | ControlPath is not contactable; spotted by and ok avsm@ | ||
1204 | - (tim) [config.guess config.sub] Update to '2005-05-27' version. | ||
1205 | - (tim) [configure.ac] set TEST_SHELL for OpenServer 6 | ||
1206 | |||
1207 | 20050531 | ||
1208 | - (dtucker) [contrib/aix/pam.conf] Correct comments. From davidl at | ||
1209 | vintela.com. | ||
1210 | - (dtucker) [mdoc2man.awk] Teach it to understand .Ox. | ||
1211 | |||
1212 | 20050530 | ||
1213 | - (dtucker) [README] Link to new release notes. Beter late than never... | ||
1214 | |||
1215 | 20050529 | ||
1216 | - (dtucker) [openbsd-compat/port-aix.c] Bug #1046: AIX 5.3 expects the | ||
1217 | argument to passwdexpired to be initialized to NULL. Suggested by tim@ | ||
1218 | While at it, initialize the other arguments to auth functions in case they | ||
1219 | ever acquire this behaviour. | ||
1220 | - (dtucker) [openbsd-compat/port-aix.c] Whitespace cleanups while there. | ||
1221 | - (dtucker) [openbsd-compat/port-aix.c] Minor correction to debug message, | ||
1222 | spotted by tim@. | ||
1223 | |||
1224 | 20050528 | ||
1225 | - (dtucker) [configure.ac] For AC_CHECK_HEADERS() and AC_CHECK_FUNCS() have | ||
1226 | one entry per line to make it easier to merge changes. ok djm@ | ||
1227 | - (dtucker) [configure.ac] strsep() may be defined in string.h, so check | ||
1228 | for its presence and include it in the strsep check. | ||
1229 | - (dtucker) [configure.ac] getpgrp may be defined in unistd.h, so check for | ||
1230 | its presence before doing AC_FUNC_GETPGRP. | ||
1231 | - (dtucker) [configure.ac] Merge HP-UX blocks into a common block with minor | ||
1232 | version-specific variations as required. | ||
1233 | - (dtucker) [openbsd-compat/port-aix.h] Use the HAVE_DECL_* definitions as | ||
1234 | per the autoconf man page. Configure should always define them but it | ||
1235 | doesn't hurt to check. | ||
1236 | |||
1237 | 20050527 | ||
1238 | - (djm) [defines.h] Use our realpath if we have to define PATH_MAX, spotted by | ||
1239 | David Leach; ok dtucker@ | ||
1240 | - (dtucker) [acconfig.h configure.ac defines.h includes.h sshpty.c | ||
1241 | openbsd-compat/bsd-misc.c] Add support for Ultrix. No, that's not a typo. | ||
1242 | Required changes from Bernhard Simon, integrated by me. ok djm@ | ||
1243 | |||
1244 | 20050525 | ||
1245 | - (djm) [mpaux.c mpaux.h Makefile.in] Remove old mpaux.[ch] code, it has not | ||
1246 | been used for a while | ||
1247 | - (djm) OpenBSD CVS Sync | ||
1248 | - otto@cvs.openbsd.org 2005/04/05 13:45:31 | ||
1249 | [ssh-keygen.c] | ||
1250 | - djm@cvs.openbsd.org 2005/04/06 09:43:59 | ||
1251 | [sshd.c] | ||
1252 | avoid harmless logspam by not performing setsockopt() on non-socket; | ||
1253 | ok markus@ | ||
1254 | - dtucker@cvs.openbsd.org 2005/04/06 12:26:06 | ||
1255 | [ssh.c] | ||
1256 | Fix debug call for port forwards; patch from pete at seebeyond.com, | ||
1257 | ok djm@ (ID sync only - change already in portable) | ||
1258 | - djm@cvs.openbsd.org 2005/04/09 04:32:54 | ||
1259 | [misc.c misc.h tildexpand.c Makefile.in] | ||
1260 | replace tilde_expand_filename with a simpler implementation, ahead of | ||
1261 | more whacking; ok deraadt@ | ||
1262 | - jmc@cvs.openbsd.org 2005/04/14 12:30:30 | ||
1263 | [ssh.1] | ||
1264 | arg to -b is an address, not if_name; | ||
1265 | ok markus@ | ||
1266 | - jakob@cvs.openbsd.org 2005/04/20 10:05:45 | ||
1267 | [dns.c] | ||
1268 | do not try to look up SSHFP for numerical hostname. ok djm@ | ||
1269 | - djm@cvs.openbsd.org 2005/04/21 06:17:50 | ||
1270 | [ssh-add.1 ssh-agent.1 ssh-keygen.1 ssh.1 ssh_config.5 sshd.8] | ||
1271 | [sshd_config.5] OpenSSH doesn't ever look at the $HOME environment | ||
1272 | variable, so don't say that we do (bz #623); ok deraadt@ | ||
1273 | - djm@cvs.openbsd.org 2005/04/21 11:47:19 | ||
1274 | [ssh.c] | ||
1275 | don't allocate a pty when -n flag (/dev/null stdin) is set, patch from | ||
1276 | ignasi.roca AT fujitsu-siemens.com (bz #829); ok dtucker@ | ||
1277 | - dtucker@cvs.openbsd.org 2005/04/23 23:43:47 | ||
1278 | [readpass.c] | ||
1279 | Add debug message if read_passphrase can't open /dev/tty; bz #471; | ||
1280 | ok djm@ | ||
1281 | - jmc@cvs.openbsd.org 2005/04/26 12:59:02 | ||
1282 | [sftp-client.h] | ||
1283 | spelling correction in comment from wiz@netbsd; | ||
1284 | - jakob@cvs.openbsd.org 2005/04/26 13:08:37 | ||
1285 | [ssh.c ssh_config.5] | ||
1286 | fallback gracefully if client cannot connect to ControlPath. ok djm@ | ||
1287 | - moritz@cvs.openbsd.org 2005/04/28 10:17:56 | ||
1288 | [progressmeter.c ssh-keyscan.c] | ||
1289 | add snprintf checks. ok djm@ markus@ | ||
1290 | - markus@cvs.openbsd.org 2005/05/02 21:13:22 | ||
1291 | [readpass.c] | ||
1292 | missing {} | ||
1293 | - djm@cvs.openbsd.org 2005/05/10 10:28:11 | ||
1294 | [ssh.c] | ||
1295 | print nice error message for EADDRINUSE as well (ID sync only) | ||
1296 | - djm@cvs.openbsd.org 2005/05/10 10:30:43 | ||
1297 | [ssh.c] | ||
1298 | report real errors on fallback from ControlMaster=no to normal connect | ||
1299 | - markus@cvs.openbsd.org 2005/05/16 15:30:51 | ||
1300 | [readconf.c servconf.c] | ||
1301 | check return value from strdelim() for NULL (AddressFamily); mpech | ||
1302 | - djm@cvs.openbsd.org 2005/05/19 02:39:55 | ||
1303 | [sshd_config.5] | ||
1304 | sort config options, from grunk AT pestilenz.org; ok jmc@ | ||
1305 | - djm@cvs.openbsd.org 2005/05/19 02:40:52 | ||
1306 | [sshd_config] | ||
1307 | whitespace nit, from grunk AT pestilenz.org | ||
1308 | - djm@cvs.openbsd.org 2005/05/19 02:42:26 | ||
1309 | [includes.h] | ||
1310 | fix cast, from grunk AT pestilenz.org | ||
1311 | - djm@cvs.openbsd.org 2005/05/20 10:50:55 | ||
1312 | [ssh_config.5] | ||
1313 | give a ProxyCommand example using nc(1), with and ok jmc@ | ||
1314 | - jmc@cvs.openbsd.org 2005/05/20 11:23:32 | ||
1315 | [ssh_config.5] | ||
1316 | oops - article and spacing; | ||
1317 | - avsm@cvs.openbsd.org 2005/05/23 22:44:01 | ||
1318 | [moduli.c ssh-keygen.c] | ||
1319 | - removes signed/unsigned comparisons in moduli generation | ||
1320 | - use strtonum instead of atoi where its easier | ||
1321 | - check some strlcpy overflow and fatal instead of truncate | ||
1322 | - djm@cvs.openbsd.org 2005/05/23 23:32:46 | ||
1323 | [cipher.c myproposal.h ssh.1 ssh_config.5 sshd_config.5] | ||
1324 | add support for draft-harris-ssh-arcfour-fixes-02 improved arcfour modes; | ||
1325 | ok markus@ | ||
1326 | - avsm@cvs.openbsd.org 2005/05/24 02:05:09 | ||
1327 | [ssh-keygen.c] | ||
1328 | some style nits from dmiller@, and use a fatal() instead of a printf()/exit | ||
1329 | - avsm@cvs.openbsd.org 2005/05/24 17:32:44 | ||
1330 | [atomicio.c atomicio.h authfd.c monitor_wrap.c msg.c scp.c sftp-client.c] | ||
1331 | [ssh-keyscan.c sshconnect.c] | ||
1332 | Switch atomicio to use a simpler interface; it now returns a size_t | ||
1333 | (containing number of bytes read/written), and indicates error by | ||
1334 | returning 0. EOF is signalled by errno==EPIPE. | ||
1335 | Typical use now becomes: | ||
1336 | |||
1337 | if (atomicio(read, ..., len) != len) | ||
1338 | err(1,"read"); | ||
1339 | |||
1340 | ok deraadt@, cloder@, djm@ | ||
1341 | - (dtucker) [regress/reexec.sh] Add ${EXEEXT} so this test also works on | ||
1342 | Cygwin. | ||
1343 | - (dtucker) [auth-pam.c] Bug #1033: Fix warnings building with PAM on Linux: | ||
1344 | warning: dereferencing type-punned pointer will break strict-aliasing rules | ||
1345 | warning: passing arg 3 of `pam_get_item' from incompatible pointer type | ||
1346 | The type-punned pointer fix is based on a patch from SuSE's rpm. ok djm@ | ||
1347 | - (dtucker) [configure.ac openbsd-compat/getrrsetbyname.c] Bug #1033: Provide | ||
1348 | templates for _getshort and _getlong if missing to prevent compiler warnings | ||
1349 | on Linux. | ||
1350 | - (djm) [configure.ac openbsd-compat/Makefile.in] | ||
1351 | [openbsd-compat/openbsd-compat.h openbsd-compat/strtonum.c] | ||
1352 | Add strtonum(3) from OpenBSD libc, new code needs it. | ||
1353 | Unfortunately Linux forces us to do a bizarre dance with compiler | ||
1354 | options to get LLONG_MIN/MAX; Spotted by and ok dtucker@ | ||
1355 | |||
1356 | 20050524 | ||
1357 | - (djm) [contrib/caldera/openssh.spec contrib/redhat/openssh.spec] | ||
1358 | [contrib/suse/openssh.spec] Update spec file versions to 4.1p1 | ||
1359 | - (dtucker) [auth-pam.c] Since people don't seem to be getting the message | ||
1360 | that USE_POSIX_THREADS is unsupported, not recommended and generally a bad | ||
1361 | idea, it is now known as UNSUPPORTED_POSIX_THREADS_HACK. Attempting to use | ||
1362 | USE_POSIX_THREADS will now generate an error so we don't silently change | ||
1363 | behaviour. ok djm@ | ||
1364 | - (dtucker) [openbsd-compat/bsd-cygwin_util.c] Ensure sufficient memory | ||
1365 | allocation when retrieving core Windows environment. Add CYGWIN variable | ||
1366 | to propagated variables. Patch from vinschen at redhat.com, ok djm@ | ||
1367 | - Release 4.1p1 | ||
1368 | |||
1369 | 20050524 | ||
1370 | - (djm) [openbsd-compat/readpassphrase.c] bz #950: Retry tcsetattr to ensure | ||
1371 | terminal modes are reset correctly. Fix from peak AT argo.troja.mff.cuni.cz; | ||
1372 | "looks ok" dtucker@ | ||
1373 | |||
1374 | 20050510 | ||
1375 | - (srivasta) [selinux.c] if selinux is enabled, then provide funtions to | ||
1376 | initialize the pty and execution context for ssh. | ||
1377 | - (srivasta) [selinux.h] if SELinux is defined, add function prototypes for | ||
1378 | functions, or make them null ops. | ||
1379 | - (srivasta) [sshpty.c] include selinuh.h | ||
1380 | pty_setowner: set up the selinux pty correcty. | ||
1381 | - (srivasta) [session.c] include selinuh.h | ||
1382 | do_setusercontext: set up proper execution context for SELinux. | ||
1383 | - (srivasta) [monitor_wrap.h] Add function prototype for new function to | ||
1384 | inform the privileged process about role. | ||
1385 | - (srivasta) [monitor_wrap.c] (mm_inform_authrole) Inform the privileged | ||
1386 | process about role. | ||
1387 | - (srivasta) [monitor.h] Add a new monitor request type for auth roles. | ||
1388 | - (srivasta) [monitor.c] (mm_answer_authrole) Add nre function to deal withe | ||
1389 | the new authorization role, and add a new monitor request type. | ||
1390 | - (srivasta) [contrib/redhat/sshd.init] (PID_FILE)restore the proper security | ||
1391 | file context of the generated public keys. | ||
1392 | - (srivasta) [configure.ac] (HAVE_HEADER_AD)Add an SELinux option | ||
1393 | - (srivasta) [auth2.c] (input_userauth_request)Handle the new role member | ||
1394 | - (srivasta) [auth1.c] (do_authentication)Handle the new role member | ||
1395 | - (srivasta) [auth.h] Added a role member in struct Authctxt | ||
1396 | - (srivasta) [Makefile.in (SSHDOBJS)] Add selinux.o | ||
1397 | |||
1398 | 20050512 | ||
1399 | - (tim) [buildpkg.sh.in] missing ${PKG_INSTALL_ROOT} in init script | ||
1400 | hard link section. Bug 1038. | ||
1401 | |||
1402 | 20050509 | ||
1403 | - (dtucker) [contrib/cygwin/ssh-host-config] Add a test and warning for a | ||
1404 | user-mode mounts in Cygwin installation. Patch from vinschen at redhat.com. | ||
1405 | |||
1406 | 20050504 | ||
1407 | - (djm) [ssh.c] some systems return EADDRINUSE on a bind to an already-used | ||
1408 | unix domain socket, so catch that too; from jakob@ ok dtucker@ | ||
1409 | |||
1410 | 20050503 | ||
1411 | - (dtucker) [canohost.c] normalise socket addresses returned by | ||
1412 | get_remote_hostname(). This means that IPv4 addresses in log messages | ||
1413 | on IPv6 enabled machines will no longer be prefixed by "::ffff:" and | ||
1414 | AllowUsers, DenyUsers, AllowGroups, DenyGroups will match IPv4-style | ||
1415 | addresses only for 4-in-6 mapped connections, regardless of whether | ||
1416 | or not the machine is IPv6 enabled. ok djm@ | ||
1417 | |||
1418 | 20050425 | ||
1419 | - (dtucker) [regress/multiplex.sh] Use "kill -0 $pid" to check for the | ||
1420 | existence of a process since it's more portable. Found by jbasney at | ||
1421 | ncsa.uiuc.edu; ok tim@ | ||
1422 | - (dtucker) [regress/multiplex.sh] Remove cleanup call since test-exec.sh | ||
1423 | will clean up anyway. From tim@ | ||
1424 | - (dtucker) [regress/multiplex.sh] Put control socket in /tmp so running | ||
1425 | "make tests" works even if you're building on a filesystem that doesn't | ||
1426 | support sockets. From deengert at anl.gov, ok djm@ | ||
1427 | |||
1428 | 20050424 | ||
1429 | - (dtucker) [INSTALL configure.ac] Make zlib version check test for 1.1.4 or | ||
1430 | 1.2.1.2 or higher. With tim@, ok djm@ | ||
1431 | |||
1432 | 20050423 | ||
1433 | - (tim) [config.guess] Add support for OpenServer 6. | ||
1434 | |||
1435 | 20050421 | ||
1436 | - (dtucker) [session.c] Bug #1024: Don't check pam_session_is_open if | ||
1437 | UseLogin is set as PAM is not used to establish credentials in that | ||
1438 | case. Found by Michael Selvesteen, ok djm@ | ||
1439 | |||
1440 | 20050419 | ||
1441 | - (dtucker) [INSTALL] Reference README.privsep for the privilege separation | ||
1442 | requirements. Pointed out by Bengt Svensson. | ||
1443 | - (dtucker) [INSTALL] Put the s/key text and URL back together. | ||
1444 | - (dtucker) [INSTALL] Fix s/key text too. | ||
1445 | |||
1446 | 20050411 | ||
1447 | - (tim) [configure.ac] UnixWare needs PASSWD_NEEDS_USERNAME | ||
1448 | |||
1449 | 20050405 | ||
1450 | - (dtucker) [configure.ac] Define HAVE_SO_PEERCRED if we have it. ok djm@ | ||
1451 | - (dtucker) [auth-sia.c] Constify sys_auth_passwd, fixes build error on | ||
1452 | Tru64. Patch from cmadams at hiwaay.net. | ||
1453 | - (dtucker) [auth-passwd.c auth-sia.h] Remove duplicate definitions of | ||
1454 | sys_auth_passwd, pointed out by cmadams at hiwaay.net. | ||
1455 | |||
1456 | 20050403 | ||
1457 | - (djm) OpenBSD CVS Sync | ||
1458 | - deraadt@cvs.openbsd.org 2005/03/31 18:39:21 | ||
1459 | [scp.c] | ||
1460 | copy argv[] element instead of smashing the one that ps will see; ok otto | ||
1461 | - djm@cvs.openbsd.org 2005/04/02 12:41:16 | ||
1462 | [scp.c] | ||
1463 | since ssh has xstrdup, use it instead of strdup+test. unbreaks -Werror | ||
1464 | build | ||
1465 | - (dtucker) [monitor.c] Don't free buffers in audit functions, monitor_read | ||
1466 | will free as needed. ok tim@ djm@ | ||
1467 | |||
1468 | 20050331 | ||
1469 | - (dtucker) OpenBSD CVS Sync | ||
1470 | - jmc@cvs.openbsd.org 2005/03/16 11:10:38 | ||
1471 | [ssh_config.5] | ||
1472 | get the syntax right for {Local,Remote}Forward; | ||
1473 | based on a diff from markus; | ||
1474 | problem report from ponraj; | ||
1475 | ok dtucker@ markus@ deraadt@ | ||
1476 | - markus@cvs.openbsd.org 2005/03/16 21:17:39 | ||
1477 | [version.h] | ||
1478 | 4.1 | ||
1479 | - jmc@cvs.openbsd.org 2005/03/18 17:05:00 | ||
1480 | [sshd_config.5] | ||
1481 | typo; | ||
1482 | - (dtucker) [auth.h sshd.c openbsd-compat/port-aix.c] Bug #1006: fix bug in | ||
1483 | handling of password expiry messages returned by AIX's authentication | ||
1484 | routines, originally reported by robvdwal at sara.nl. | ||
1485 | - (dtucker) [ssh.c] Prevent null pointer deref in port forwarding debug | ||
1486 | message on some platforms. Patch from pete at seebeyond.com via djm. | ||
1487 | - (dtucker) [monitor.c] Remaining part of fix for bug #1006. | ||
1488 | |||
1489 | 20050329 | ||
1490 | - (dtucker) [contrib/aix/buildbff.sh] Bug #1005: Look up only the user we're | ||
1491 | interested in which is much faster in large (eg LDAP or NIS) environments. | ||
1492 | Patch from dleonard at vintela.com. | ||
1493 | |||
1494 | 20050321 | ||
1495 | - (dtucker) [configure.ac] Prevent configure --with-zlib from adding -Iyes | ||
1496 | and -Lyes to CFLAGS and LIBS. Pointed out by peter at slagheap.net, | ||
1497 | with & ok tim@ | ||
1498 | - (dtucker) [configure.ac] Make configure error out if the user specifies | ||
1499 | --with-libedit but the required libs can't be found, rather than silently | ||
1500 | ignoring and continuing. ok tim@ | ||
1501 | - (dtucker) [configure.ac openbsd-compat/port-aix.h] Prevent redefinitions | ||
1502 | of setauthdb on AIX 5.3, reported by anders.liljegren at its.uu.se. | ||
1503 | |||
1504 | 20050317 | ||
1505 | - (tim) [configure.ac] Bug 998. Make path for --with-opensc optional. | ||
1506 | Make --without-opensc work. | ||
1507 | - (tim) [configure.ac] portability changes on test statements. Some shells | ||
1508 | have problems with -a operator. | ||
1509 | - (tim) [configure.ac] make some configure options a little more error proof. | ||
1510 | - (tim) [configure.ac] remove trailing white space. | ||
1511 | |||
1512 | 20050314 | ||
1513 | - (dtucker) OpenBSD CVS Sync | ||
1514 | - dtucker@cvs.openbsd.org 2005/03/10 10:15:02 | ||
1515 | [readconf.c] | ||
1516 | Check listen addresses for null, prevents xfree from dying during | ||
1517 | ClearAllForwardings (bz #996). From Craig Leres, ok markus@ | ||
1518 | - deraadt@cvs.openbsd.org 2005/03/10 22:01:05 | ||
1519 | [misc.c ssh-keygen.c servconf.c clientloop.c auth-options.c ssh-add.c | ||
1520 | monitor.c sftp-client.c bufaux.h hostfile.c ssh.c sshconnect.c channels.c | ||
1521 | readconf.c bufaux.c sftp.c] | ||
1522 | spacing | ||
1523 | - deraadt@cvs.openbsd.org 2005/03/10 22:40:38 | ||
1524 | [auth-options.c] | ||
1525 | spacing | ||
1526 | - markus@cvs.openbsd.org 2005/03/11 14:59:06 | ||
1527 | [ssh-keygen.c] | ||
1528 | typo, missing \n; mpech | ||
1529 | - jmc@cvs.openbsd.org 2005/03/12 11:55:03 | ||
1530 | [ssh_config.5] | ||
1531 | escape `.' at eol to avoid double spacing issues; | ||
1532 | - dtucker@cvs.openbsd.org 2005/03/14 10:09:03 | ||
1533 | [ssh-keygen.1] | ||
1534 | Correct description of -H (bz #997); ok markus@, punctuation jmc@ | ||
1535 | - dtucker@cvs.openbsd.org 2005/03/14 11:44:42 | ||
1536 | [auth.c] | ||
1537 | Populate host for log message for logins denied by AllowUsers and | ||
1538 | DenyUsers (bz #999); ok markus@ (patch by tryponraj at gmail.com) | ||
1539 | - markus@cvs.openbsd.org 2005/03/14 11:46:56 | ||
1540 | [buffer.c buffer.h channels.c] | ||
1541 | limit input buffer size for channels; bugzilla #896; with and ok dtucker@ | ||
1542 | - (tim) [contrib/caldera/openssh.spec] links in rc?.d were getting trashed | ||
1543 | with a rpm -F | ||
1544 | |||
1545 | 20050313 | ||
1546 | - (dtucker) [contrib/cygwin/ssh-host-config] Makes the query for the | ||
1547 | localized name of the local administrators group more reliable. From | ||
1548 | vinschen at redhat.com. | ||
1549 | |||
1550 | 20050312 | ||
1551 | - (dtucker) [regress/test-exec.sh] DEBUG can cause problems where debug | ||
1552 | output ends up in the client's output, causing regress failures. Found | ||
1553 | by Corinna Vinschen. | ||
1554 | |||
1555 | 20050309 | ||
1556 | - (dtucker) [regress/test-exec.sh] Set BIN_SH=xpg4 on OSF1/Digital Unix/Tru64 | ||
1557 | so that regress tests behave. From Chris Adams. | ||
1558 | - (djm) OpenBSD CVS Sync | ||
1559 | - jmc@cvs.openbsd.org 2005/03/07 23:41:54 | ||
1560 | [ssh.1 ssh_config.5] | ||
1561 | more macro simplification; | ||
1562 | - djm@cvs.openbsd.org 2005/03/08 23:49:48 | ||
1563 | [version.h] | ||
1564 | OpenSSH 4.0 | ||
1565 | - (djm) [contrib/caldera/openssh.spec contrib/redhat/openssh.spec] | ||
1566 | [contrib/suse/openssh.spec] Update spec file versions | ||
1567 | - (djm) [log.c] Fix dumb syntax error; ok dtucker@ | ||
1568 | - (djm) Release OpenSSH 4.0p1 | ||
1569 | |||
1570 | 20050307 | ||
1571 | - (dtucker) [configure.ac] Disable gettext search when configuring with | ||
1572 | BSM audit support for the time being. ok djm@ | ||
1573 | - (dtucker) OpenBSD CVS Sync (regress/) | ||
1574 | - fgsch@cvs.openbsd.org 2004/12/10 01:31:30 | ||
1575 | [Makefile sftp-glob.sh] | ||
1576 | some globbing regress; prompted and ok djm@ | ||
1577 | - david@cvs.openbsd.org 2005/01/14 04:21:18 | ||
1578 | [Makefile test-exec.sh] | ||
1579 | pass the SUDO make variable to the individual sh tests; ok dtucker@ markus@ | ||
1580 | - dtucker@cvs.openbsd.org 2005/02/27 11:33:30 | ||
1581 | [multiplex.sh test-exec.sh sshd-log-wrapper.sh] | ||
1582 | Add optional capability to log output from regress commands; ok markus@ | ||
1583 | Use with: make TEST_SSH_LOGFILE=/tmp/regress.log | ||
1584 | - djm@cvs.openbsd.org 2005/02/27 23:13:36 | ||
1585 | [login-timeout.sh] | ||
1586 | avoid nameservice lookups in regress test; ok dtucker@ | ||
1587 | - djm@cvs.openbsd.org 2005/03/04 08:48:46 | ||
1588 | [Makefile envpass.sh] | ||
1589 | regress test for SendEnv config parsing bug; ok dtucker@ | ||
1590 | - (dtucker) [regress/test-exec.sh] Put SUDO in the right place. | ||
1591 | - (tim) [configure.ac] SCO 3.2v4.2 no longer supported. | ||
1592 | |||
1593 | 20050306 | ||
1594 | - (dtucker) [monitor.c] Bug #125 comment #47: fix errors returned by monitor | ||
1595 | when attempting to audit disconnect events. Reported by Phil Dibowitz. | ||
1596 | - (dtucker) [session.c sshd.c] Bug #125 comment #49: Send disconnect audit | ||
1597 | events earlier, prevents mm_request_send errors reported by Matt Goebel. | ||
1598 | |||
1599 | 20050305 | ||
1600 | - (djm) [contrib/cygwin/README] Improve Cygwin build documentation. Patch | ||
1601 | from vinschen at redhat.com | ||
1602 | - (djm) OpenBSD CVS Sync | ||
1603 | - jmc@cvs.openbsd.org 2005/03/02 11:45:01 | ||
1604 | [ssh.1] | ||
1605 | missing word; | ||
1606 | - djm@cvs.openbsd.org 2005/03/04 08:48:06 | ||
1607 | [readconf.c] | ||
1608 | fix SendEnv config parsing bug found by Roumen Petrov; ok dtucker@ | ||
1609 | |||
1610 | 20050302 | ||
1611 | - (djm) OpenBSD CVS sync: | ||
1612 | - jmc@cvs.openbsd.org 2005/03/01 14:47:58 | ||
1613 | [ssh.1] | ||
1614 | remove some unneccesary macros; | ||
1615 | do not mark up punctuation; | ||
1616 | - jmc@cvs.openbsd.org 2005/03/01 14:55:23 | ||
1617 | [ssh_config.5] | ||
1618 | do not mark up punctuation; | ||
1619 | whitespace; | ||
1620 | - jmc@cvs.openbsd.org 2005/03/01 14:59:49 | ||
1621 | [sshd.8] | ||
1622 | new sentence, new line; | ||
1623 | whitespace; | ||
1624 | - jmc@cvs.openbsd.org 2005/03/01 15:05:00 | ||
1625 | [ssh-keygen.1] | ||
1626 | whitespace; | ||
1627 | - jmc@cvs.openbsd.org 2005/03/01 15:47:14 | ||
1628 | [ssh-keyscan.1 ssh-keyscan.c] | ||
1629 | sort options and sync usage(); | ||
1630 | - jmc@cvs.openbsd.org 2005/03/01 17:19:35 | ||
1631 | [scp.1 sftp.1] | ||
1632 | add HashKnownHosts to -o list; | ||
1633 | ok markus@ | ||
1634 | - jmc@cvs.openbsd.org 2005/03/01 17:22:06 | ||
1635 | [ssh.c] | ||
1636 | sync usage() w/ man SYNOPSIS; | ||
1637 | ok markus@ | ||
1638 | - jmc@cvs.openbsd.org 2005/03/01 17:32:19 | ||
1639 | [ssh-add.1] | ||
1640 | sort options; | ||
1641 | - jmc@cvs.openbsd.org 2005/03/01 18:15:56 | ||
1642 | [ssh-keygen.1] | ||
1643 | sort options (no attempt made at synopsis clean up though); | ||
1644 | spelling (occurance -> occurrence); | ||
1645 | use prompt before examples; | ||
1646 | grammar; | ||
1647 | - djm@cvs.openbsd.org 2005/03/02 01:00:06 | ||
1648 | [sshconnect.c] | ||
1649 | fix addition of new hashed hostnames when CheckHostIP=yes; | ||
1650 | found and ok dtucker@ | ||
1651 | - djm@cvs.openbsd.org 2005/03/02 01:27:41 | ||
1652 | [ssh-keygen.c] | ||
1653 | ignore hostnames with metachars when hashing; ok deraadt@ | ||
1654 | - djm@cvs.openbsd.org 2005/03/02 02:21:07 | ||
1655 | [ssh.1] | ||
1656 | bz#987: mention ForwardX11Trusted in ssh.1, | ||
1657 | reported by andrew.benham AT thus.net; ok deraadt@ | ||
1658 | - (tim) [regress/agent-ptrace.sh] add another possible gdb error. | ||
1659 | |||
1660 | 20050301 | ||
1661 | - (djm) OpenBSD CVS sync: | ||
1662 | - otto@cvs.openbsd.org 2005/02/16 09:56:44 | ||
1663 | [ssh.c] | ||
1664 | Better diagnostic if an identity file is not accesible. ok markus@ djm@ | ||
1665 | - djm@cvs.openbsd.org 2005/02/18 03:05:53 | ||
1666 | [canohost.c] | ||
1667 | better error messages for getnameinfo failures; ok dtucker@ | ||
1668 | - djm@cvs.openbsd.org 2005/02/20 22:59:06 | ||
1669 | [sftp.c] | ||
1670 | turn on ssh batch mode when in sftp batch mode, patch from | ||
1671 | jdmossh AT nand.net; | ||
1672 | ok markus@ | ||
1673 | - jmc@cvs.openbsd.org 2005/02/25 10:55:13 | ||
1674 | [sshd.8] | ||
1675 | add /etc/motd and $HOME/.hushlogin to FILES; | ||
1676 | from michael knudsen; | ||
1677 | - djm@cvs.openbsd.org 2005/02/28 00:54:10 | ||
1678 | [ssh_config.5] | ||
1679 | bz#849: document timeout on untrusted x11 forwarding sessions. Reported by | ||
1680 | orion AT cora.nwra.com; ok markus@ | ||
1681 | - djm@cvs.openbsd.org 2005/03/01 10:09:52 | ||
1682 | [auth-options.c channels.c channels.h clientloop.c compat.c compat.h] | ||
1683 | [misc.c misc.h readconf.c readconf.h servconf.c ssh.1 ssh.c ssh_config.5] | ||
1684 | [sshd_config.5] | ||
1685 | bz#413: allow optional specification of bind address for port forwardings. | ||
1686 | Patch originally by Dan Astorian, but worked on by several people | ||
1687 | Adds GatewayPorts=clientspecified option on server to allow remote | ||
1688 | forwards to bind to client-specified ports. | ||
1689 | - djm@cvs.openbsd.org 2005/03/01 10:40:27 | ||
1690 | [hostfile.c hostfile.h readconf.c readconf.h ssh.1 ssh_config.5] | ||
1691 | [sshconnect.c sshd.8] | ||
1692 | add support for hashing host names and addresses added to known_hosts | ||
1693 | files, to improve privacy of which hosts user have been visiting; ok | ||
1694 | markus@ deraadt@ | ||
1695 | - djm@cvs.openbsd.org 2005/03/01 10:41:28 | ||
1696 | [ssh-keyscan.1 ssh-keyscan.c] | ||
1697 | option to hash hostnames output by ssh-keyscan; ok markus@ deraadt@ | ||
1698 | - djm@cvs.openbsd.org 2005/03/01 10:42:49 | ||
1699 | [ssh-keygen.1 ssh-keygen.c ssh_config.5] | ||
1700 | add tools for managing known_hosts files with hashed hostnames, including | ||
1701 | hashing existing files and deleting hosts by name; ok markus@ deraadt@ | ||
1702 | |||
1703 | 20050226 | ||
1704 | - (dtucker) [openbsd-compat/bsd-openpty.c openbsd-compat/inet_ntop.c] | ||
1705 | Remove two obsolete Cygwin #ifdefs. Patch from vinschen at redhat.com. | ||
1706 | - (dtucker) [acconfig.h configure.ac openbsd-compat/bsd-misc.{c,h}] | ||
1707 | Remove SETGROUPS_NOOP, was only used by Cygwin, which doesn't need it any | ||
1708 | more. Patch from vinschen at redhat.com. | ||
1709 | - (dtucker) [Makefile.in] Add a install-nosysconf target for installing the | ||
1710 | binaries without the config files. Primarily useful for packaging. | ||
1711 | Patch from phil at usc.edu. ok djm@ | ||
1712 | |||
1713 | 20050224 | ||
1714 | - (djm) [configure.ac] in_addr_t test needs sys/types.h too | ||
1715 | |||
1716 | 20050222 | ||
1717 | - (dtucker) [uidswap.c] Skip uid restore test on Cygwin. Patch from | ||
1718 | vinschen at redhat.com. | ||
1719 | |||
1720 | 20050220 | ||
1721 | - (dtucker) [LICENCE Makefile.in README.platform audit-bsm.c configure.ac | ||
1722 | defines.h] Bug #125: Add *EXPERIMENTAL* BSM audit support. Configure | ||
1723 | --with-audit=bsm to enable. Patch originally from Sun Microsystems, | ||
1724 | parts by John R. Jackson. ok djm@ | ||
1725 | - (dtucker) [configure.ac] Missing comma in AIX section, somehow causes | ||
1726 | unrelated platforms to be configured incorrectly. | ||
1727 | |||
1728 | 20050216 | ||
1729 | - (djm) write seed to temporary file and atomically rename into place; | ||
1730 | ok dtucker@ | ||
1731 | - (dtucker) [ssh-rand-helper.c] Provide seed_rng since it may be called | ||
1732 | via mkstemp in some configurations. ok djm@ | ||
1733 | - (dtucker) [auth-shadow.c] Prevent compiler warnings if "DAY" is defined | ||
1734 | by the system headers. | ||
1735 | - (dtucker) [configure.ac] Bug #893: check for libresolv early on Reliant | ||
1736 | Unix; prevents problems relating to the location of -lresolv in the | ||
1737 | link order. | ||
1738 | - (dtucker) [session.c] Bug #918: store credentials from gssapi-with-mic | ||
1739 | authentication early enough to be available to PAM session modules when | ||
1740 | privsep=yes. Patch from deengert at anl.gov, ok'ed in principle by Sam | ||
1741 | Hartman and similar to Debian's ssh-krb5 package. | ||
1742 | - (dtucker) [configure.ac openbsd-compat/port-aix.{c,h}] Silence some more | ||
1743 | compiler warnings on AIX. | ||
1744 | |||
1745 | 20050215 | ||
1746 | - (dtucker) [config.sh.in] Collect oslevel -r too. | ||
1747 | - (dtucker) [README.platform auth.c configure.ac loginrec.c | ||
1748 | openbsd-compat/port-aix.c openbsd-compat/port-aix.h] Bug #835: enable IPv6 | ||
1749 | on AIX where possible (see README.platform for details) and work around | ||
1750 | a misfeature of AIX's getnameinfo. ok djm@ | ||
1751 | - (dtucker) [loginrec.c] Add missing #include. | ||
1752 | |||
1753 | 20050211 | ||
1754 | - (dtucker) [configure.ac] Tidy up configure --help output. | ||
1755 | - (dtucker) [openbsd-compat/fake-rfc2553.h] We now need EAI_SYSTEM too. | ||
1756 | |||
1757 | 20050210 | ||
1758 | - (dtucker) [configure.ac] Bug #919: Provide visible feedback for the | ||
1759 | --disable-etc-default-login configure option. | ||
1760 | |||
1761 | 20050209 | ||
1762 | - (dtucker) OpenBSD CVS Sync | ||
1763 | - dtucker@cvs.openbsd.org 2005/01/28 09:45:53 | ||
1764 | [ssh_config] | ||
1765 | Make it clear that the example entries in ssh_config are only some of the | ||
1766 | commonly-used options and refer the user to ssh_config(5) for more | ||
1767 | details; ok djm@ | ||
1768 | - jmc@cvs.openbsd.org 2005/01/28 15:05:43 | ||
1769 | [ssh_config.5] | ||
1770 | grammar; | ||
1771 | - jmc@cvs.openbsd.org 2005/01/28 18:14:09 | ||
1772 | [ssh_config.5] | ||
1773 | wording; | ||
1774 | ok markus@ | ||
1775 | - dtucker@cvs.openbsd.org 2005/01/30 11:18:08 | ||
1776 | [monitor.c] | ||
1777 | Make code match intent; ok djm@ | ||
1778 | - dtucker@cvs.openbsd.org 2005/02/08 22:24:57 | ||
1779 | [sshd.c] | ||
1780 | Provide reason in error message if getnameinfo fails; ok markus@ | ||
1781 | - (dtucker) [auth-passwd.c openbsd-compat/port-aix.c] Don't call | ||
1782 | disable_forwarding() from compat library. Prevent linker errrors trying | ||
1783 | to resolve it for binaries other than sshd. ok djm@ | ||
1784 | - (dtucker) [configure.ac] Bug #854: prepend pwd to relative --with-ssl-dir | ||
1785 | paths. ok djm@ | ||
1786 | - (dtucker) [configure.ac session.c] Some platforms (eg some SCO) require | ||
1787 | the username to be passed to the passwd command when changing expired | ||
1788 | passwords. ok djm@ | ||
1789 | |||
1790 | 20050208 | ||
1791 | - (dtucker) [regress/test-exec.sh] Bug #912: Set _POSIX2_VERSION for the | ||
1792 | regress tests so newer versions of GNU head(1) behave themselves. Patch | ||
1793 | by djm, so ok me. | ||
1794 | - (dtucker) [openbsd-compat/port-aix.c] Silence compiler warnings. | ||
1795 | - (dtucker) [audit.c audit.h auth.c auth1.c auth2.c loginrec.c monitor.c | ||
1796 | monitor_wrap.c monitor_wrap.h session.c sshd.c]: Prepend all of the audit | ||
1797 | defines and enums with SSH_ to prevent namespace collisions on some | ||
1798 | platforms (eg AIX). | ||
1799 | |||
1800 | 20050204 | ||
1801 | - (dtucker) [monitor.c] Permit INVALID_USER audit events from slave too. | ||
1802 | - (dtucker) [auth.c] Fix parens in audit log check. | ||
1803 | |||
1804 | 20050202 | ||
1805 | - (dtucker) [configure.ac openbsd-compat/realpath.c] Sync up with realpath | ||
1806 | rev 1.11 from OpenBSD and make it use fchdir if available. ok djm@ | ||
1807 | - (dtucker) [auth.c loginrec.h openbsd-compat/{bsd-cray,port-aix}.{c,h}] | ||
1808 | Make record_failed_login() call provide hostname rather than having the | ||
1809 | implementations having to do lookups themselves. Only affects AIX and | ||
1810 | UNICOS (the latter only uses the "user" parameter anyway). ok djm@ | ||
1811 | - (dtucker) [session.c sshd.c] Bug #445: Propogate KRB5CCNAME if set to child | ||
1812 | the process. Since we also unset KRB5CCNAME at startup, if it's set after | ||
1813 | authentication it must have been set by the platform's native auth system. | ||
1814 | This was already done for AIX; this enables it for the general case. | ||
1815 | - (dtucker) [auth.c canohost.c canohost.h configure.ac defines.h loginrec.c] | ||
1816 | Bug #974: Teach sshd to write failed login records to btmp for failed auth | ||
1817 | attempts (currently only for password, kbdint and C/R, only on Linux and | ||
1818 | HP-UX), based on code from login.c from util-linux. With ashok_kovai at | ||
1819 | hotmail.com, ok djm@ | ||
1820 | - (dtucker) [Makefile.in auth.c auth.h auth1.c auth2.c loginrec.c monitor.c | ||
1821 | monitor.h monitor_wrap.c monitor_wrap.h session.c sshd.c] Bug #125: | ||
1822 | (first stage) Add audit instrumentation to sshd, currently disabled by | ||
1823 | default. with suggestions from and ok djm@ | ||
1824 | |||
1825 | 20050201 | ||
1826 | - (dtucker) [log.c] Bug #973: force log_init() to open syslog, since on some | ||
1827 | platforms syslog will revert to its default values. This may result in | ||
1828 | messages from external libraries (eg libwrap) being sent to a different | ||
1829 | facility. | ||
1830 | - (dtucker) [sshd_config.5] Bug #701: remove warning about | ||
1831 | keyboard-interactive since this is no longer the case. | ||
1832 | |||
1833 | 20050124 | ||
1834 | - (dtucker) OpenBSD CVS Sync | ||
1835 | - otto@cvs.openbsd.org 2005/01/21 08:32:02 | ||
1836 | [auth-passwd.c sshd.c] | ||
1837 | Warn in advance for password and account expiry; initialize loginmsg | ||
1838 | buffer earlier and clear it after privsep fork. ok and help dtucker@ | ||
1839 | markus@ | ||
1840 | - dtucker@cvs.openbsd.org 2005/01/22 08:17:59 | ||
1841 | [auth.c] | ||
1842 | Log source of connections denied by AllowUsers, DenyUsers, AllowGroups and | ||
1843 | DenyGroups. bz #909, ok djm@ | ||
1844 | - djm@cvs.openbsd.org 2005/01/23 10:18:12 | ||
1845 | [cipher.c] | ||
1846 | config option "Ciphers" should be case-sensitive; ok dtucker@ | ||
1847 | - dtucker@cvs.openbsd.org 2005/01/24 10:22:06 | ||
1848 | [scp.c sftp.c] | ||
1849 | Have scp and sftp wait for the spawned ssh to exit before they exit | ||
1850 | themselves. This prevents ssh from being unable to restore terminal | ||
1851 | modes (not normally a problem on OpenBSD but common with -Portable | ||
1852 | on POSIX platforms). From peak at argo.troja.mff.cuni.cz (bz#950); | ||
1853 | ok djm@ markus@ | ||
1854 | - dtucker@cvs.openbsd.org 2005/01/24 10:29:06 | ||
1855 | [moduli] | ||
1856 | Import new moduli; requested by deraadt@ a week ago | ||
1857 | - dtucker@cvs.openbsd.org 2005/01/24 11:47:13 | ||
1858 | [auth-passwd.c] | ||
1859 | #if -> #ifdef so builds without HAVE_LOGIN_CAP work too; ok djm@ otto@ | ||
1860 | |||
1861 | 20050120 | ||
1862 | - (dtucker) OpenBSD CVS Sync | ||
1863 | - markus@cvs.openbsd.org 2004/12/23 17:35:48 | ||
1864 | [session.c] | ||
1865 | check for NULL; from mpech | ||
1866 | - markus@cvs.openbsd.org 2004/12/23 17:38:07 | ||
1867 | [ssh-keygen.c] | ||
1868 | leak; from mpech | ||
1869 | - djm@cvs.openbsd.org 2004/12/23 23:11:00 | ||
1870 | [servconf.c servconf.h sshd.c sshd_config sshd_config.5] | ||
1871 | bz #898: support AddressFamily in sshd_config. from | ||
1872 | peak@argo.troja.mff.cuni.cz; ok deraadt@ | ||
1873 | - markus@cvs.openbsd.org 2005/01/05 08:51:32 | ||
1874 | [sshconnect.c] | ||
1875 | remove dead code, log connect() failures with level error, ok djm@ | ||
1876 | - jmc@cvs.openbsd.org 2005/01/08 00:41:19 | ||
1877 | [sshd_config.5] | ||
1878 | `login'(n) -> `log in'(v); | ||
1879 | - dtucker@cvs.openbsd.org 2005/01/17 03:25:46 | ||
1880 | [moduli.c] | ||
1881 | Correct spelling: SCHNOOR->SCHNORR; ok djm@ | ||
1882 | - dtucker@cvs.openbsd.org 2005/01/17 22:48:39 | ||
1883 | [sshd.c] | ||
1884 | Make debugging output continue after reexec; ok djm@ | ||
1885 | - dtucker@cvs.openbsd.org 2005/01/19 13:11:47 | ||
1886 | [auth-bsdauth.c auth2-chall.c] | ||
1887 | Have keyboard-interactive code call the drivers even for responses for | ||
1888 | invalid logins. This allows the drivers themselves to decide how to | ||
1889 | handle them and prevent leaking information where possible. Existing | ||
1890 | behaviour for bsdauth is maintained by checking authctxt->valid in the | ||
1891 | bsdauth driver. Note that any third-party kbdint drivers will now need | ||
1892 | to be able to handle responses for invalid logins. ok markus@ | ||
1893 | - djm@cvs.openbsd.org 2004/12/22 02:13:19 | ||
1894 | [cipher-ctr.c cipher.c] | ||
1895 | remove fallback AES support for old OpenSSL, as OpenBSD has had it for | ||
1896 | many years now; ok deraadt@ | ||
1897 | (Id sync only: Portable will continue to support older OpenSSLs) | ||
1898 | - (dtucker) [auth-pam.c] Bug #971: Prevent leaking information about user | ||
1899 | existence via keyboard-interactive/pam, in conjunction with previous | ||
1900 | auth2-chall.c change; with Colin Watson and djm. | ||
1901 | - (dtucker) [loginrec.h] Bug #952: Increase size of username field to 128 | ||
1902 | bytes to prevent errors from login_init_entry() when the username is | ||
1903 | exactly 64 bytes(!) long. From brhamon at cisco.com, ok djm@ | ||
1904 | - (dtucker) [auth-chall.c auth.h auth2-chall.c] Bug #936: Remove pam from | ||
1905 | the list of available kbdint devices if UsePAM=no. ok djm@ | ||
1906 | |||
1907 | 20050118 | ||
1908 | - (dtucker) [INSTALL Makefile.in configure.ac survey.sh.in] Implement | ||
1909 | "make survey" and "make send-survey". This will provide data on the | ||
1910 | configure parameters, platform and platform features to the development | ||
1911 | team, which will allow (among other things) better targetting of testing. | ||
1912 | It's entirely voluntary and is off be default. ok djm@ | ||
1913 | - (dtucker) [survey.sh.in] Remove any blank lines from the output of | ||
1914 | ccver-v and ccver-V. | ||
1915 | |||
1916 | 20041220 | ||
1917 | - (dtucker) [ssh-rand-helper.c] Fall back to command-based seeding if reading | ||
1918 | from prngd is enabled at compile time but fails at run time, eg because | ||
1919 | prngd is not running. Note that if you have prngd running when OpenSSH is | ||
1920 | built, OpenSSL will consider itself internally seeded and rand-helper won't | ||
1921 | be built at all unless explicitly enabled via --with-rand-helper. ok djm@ | ||
1922 | - (dtucker) [regress/rekey.sh] Touch datafile before filling with dd, since | ||
1923 | on some wacky platforms (eg old AIXes), dd will refuse to create an output | ||
1924 | file if it doesn't exist. | ||
1925 | |||
1926 | 20041213 | ||
1927 | - (dtucker) [contrib/findssh.sh] Clean up on interrupt; from | ||
1928 | amarendra.godbole at ge com. | ||
1929 | |||
1930 | 20041211 | ||
1931 | - (dtucker) OpenBSD CVS Sync | ||
1932 | - markus@cvs.openbsd.org 2004/12/06 16:00:43 | ||
1933 | [bufaux.c] | ||
1934 | use 0x00 not \0 since buf[] is a bignum | ||
1935 | - fgsch@cvs.openbsd.org 2004/12/10 03:10:42 | ||
1936 | [sftp.c] | ||
1937 | - fix globbed ls for paths the same lenght as the globbed path when | ||
1938 | we have a unique matching. | ||
1939 | - fix globbed ls in case of a directory when we have a unique matching. | ||
1940 | - as a side effect, if the path does not exist error (used to silently | ||
1941 | ignore). | ||
1942 | - don't do extra do_lstat() if we only have one matching file. | ||
1943 | djm@ ok | ||
1944 | - dtucker@cvs.openbsd.org 2004/12/11 01:48:56 | ||
1945 | [auth-rsa.c auth2-pubkey.c authfile.c misc.c misc.h] | ||
1946 | Fix debug call in error path of authorized_keys processing and fix related | ||
1947 | warnings; ok djm@ | ||
1948 | |||
1949 | 20041208 | ||
1950 | - (tim) [configure.ac] Comment some non obvious platforms in the | ||
1951 | target-specific case statement. Suggested and OK by dtucker@ | ||
1952 | |||
1953 | 20041207 | ||
1954 | - (dtucker) [regress/scp.sh] Use portable-friendly $DIFFOPTs in new test. | ||
1955 | |||
1956 | 20041206 | ||
1957 | - (dtucker) [TODO WARNING.RNG] Update to reflect current reality. ok djm@ | ||
1958 | - (dtucker) OpenBSD CVS Sync | ||
1959 | - markus@cvs.openbsd.org 2004/11/25 22:22:14 | ||
1960 | [sftp-client.c sftp.c] | ||
1961 | leak; from mpech | ||
1962 | - jmc@cvs.openbsd.org 2004/11/29 00:05:17 | ||
1963 | [sftp.1] | ||
1964 | missing full stop; | ||
1965 | - djm@cvs.openbsd.org 2004/11/29 07:41:24 | ||
1966 | [sftp-client.h sftp.c] | ||
1967 | Some small fixes from moritz@jodeit.org. ok deraadt@ | ||
1968 | - jaredy@cvs.openbsd.org 2004/12/05 23:55:07 | ||
1969 | [sftp.1] | ||
1970 | - explain that patterns can be used as arguments in get/put/ls/etc | ||
1971 | commands (prodded by Michael Knudsen) | ||
1972 | - describe ls flags as a list | ||
1973 | - other minor improvements | ||
1974 | ok jmc, djm | ||
1975 | - dtucker@cvs.openbsd.org 2004/12/06 11:41:03 | ||
1976 | [auth-rsa.c auth2-pubkey.c authfile.c misc.c misc.h ssh.h sshd.8] | ||
1977 | Discard over-length authorized_keys entries rather than complaining when | ||
1978 | they don't decode. bz #884, with & ok djm@ | ||
1979 | - (dtucker) OpenBSD CVS Sync (regress/) | ||
1980 | - djm@cvs.openbsd.org 2004/06/26 06:16:07 | ||
1981 | [reexec.sh] | ||
1982 | don't change the name of the copied sshd for the reexec fallback test, | ||
1983 | makes life simpler for portable | ||
1984 | - dtucker@cvs.openbsd.org 2004/07/08 12:59:35 | ||
1985 | [scp.sh] | ||
1986 | Regress test for bz #863 (scp double-error), requires $SUDO. ok markus@ | ||
1987 | - david@cvs.openbsd.org 2004/07/09 19:45:43 | ||
1988 | [Makefile] | ||
1989 | add a missing CLEANFILES used in the re-exec test | ||
1990 | - djm@cvs.openbsd.org 2004/10/08 02:01:50 | ||
1991 | [reexec.sh] | ||
1992 | shrink and tidy; ok dtucker@ | ||
1993 | - djm@cvs.openbsd.org 2004/10/29 23:59:22 | ||
1994 | [Makefile added brokenkeys.sh] | ||
1995 | regression test for handling of corrupt keys in authorized_keys file | ||
1996 | - djm@cvs.openbsd.org 2004/11/07 00:32:41 | ||
1997 | [multiplex.sh] | ||
1998 | regression tests for new multiplex commands | ||
1999 | - dtucker@cvs.openbsd.org 2004/11/25 09:39:27 | ||
2000 | [test-exec.sh] | ||
2001 | Remove obsolete RhostsAuthentication from test config; ok markus@ | ||
2002 | - dtucker@cvs.openbsd.org 2004/12/06 10:49:56 | ||
2003 | [test-exec.sh] | ||
2004 | Check if TEST_SSH_SSHD is a full path to sshd before searching; ok markus@ | ||
2005 | |||
2006 | 20041203 | ||
2007 | - (dtucker) OpenBSD CVS Sync | ||
2008 | - jmc@cvs.openbsd.org 2004/11/07 17:42:36 | ||
2009 | [ssh.1] | ||
2010 | options sort, and whitespace; | ||
2011 | - jmc@cvs.openbsd.org 2004/11/07 17:57:30 | ||
2012 | [ssh.c] | ||
2013 | usage(): | ||
2014 | - add -O | ||
2015 | - sync -S w/ manpage | ||
2016 | - remove -h | ||
2017 | - (dtucker) [auth1.c auth2.c] If the user successfully authenticates but is | ||
2018 | subsequently denied by the PAM auth stack, send the PAM message to the | ||
2019 | user via packet_disconnect (Protocol 1) or userauth_banner (Protocol 2). | ||
2020 | ok djm@ | ||
2021 | |||
2022 | 20041107 | ||
2023 | - (dtucker) OpenBSD CVS Sync | ||
2024 | - djm@cvs.openbsd.org 2004/11/05 12:19:56 | ||
2025 | [sftp.c] | ||
2026 | command editing and history support via libedit; ok markus@ | ||
2027 | thanks to hshoexer@ and many testers on tech@ too | ||
2028 | - djm@cvs.openbsd.org 2004/11/07 00:01:46 | ||
2029 | [clientloop.c clientloop.h ssh.1 ssh.c] | ||
2030 | add basic control of a running multiplex master connection; including the | ||
2031 | ability to check its status and request it to exit; ok markus@ | ||
2032 | - (dtucker) [INSTALL Makefile.in configure.ac] Add --with-libedit configure | ||
2033 | option and supporting makefile bits and documentation. | ||
2034 | |||
2035 | 20041105 | ||
2036 | - (dtucker) OpenBSD CVS Sync | ||
2037 | - markus@cvs.openbsd.org 2004/08/30 09:18:08 | ||
2038 | [LICENCE] | ||
2039 | s/keygen/keyscan/ | ||
2040 | - jmc@cvs.openbsd.org 2004/08/30 21:22:49 | ||
2041 | [ssh-add.1 ssh.1] | ||
2042 | .Xsession -> .xsession; | ||
2043 | originally from a pr from f at obiit dot org, but missed by myself; | ||
2044 | ok markus@ matthieu@ | ||
2045 | - djm@cvs.openbsd.org 2004/09/07 23:41:30 | ||
2046 | [clientloop.c ssh.c] | ||
2047 | cleanup multiplex control socket on SIGHUP too, spotted by sturm@ | ||
2048 | ok markus@ deraadt@ | ||
2049 | - deraadt@cvs.openbsd.org 2004/09/15 00:46:01 | ||
2050 | [ssh.c] | ||
2051 | /* fallthrough */ is something a programmer understands. But | ||
2052 | /* FALLTHROUGH */ is also understood by lint, so that is better. | ||
2053 | - jaredy@cvs.openbsd.org 2004/09/15 03:25:41 | ||
2054 | [sshd_config.5] | ||
2055 | mention PrintLastLog only prints last login time for interactive | ||
2056 | sessions, like PrintMotd mentions. | ||
2057 | From Michael Knudsen, with wording changed slightly to match the | ||
2058 | PrintMotd description. | ||
2059 | ok djm | ||
2060 | - mickey@cvs.openbsd.org 2004/09/15 18:42:27 | ||
2061 | [sshd.c] | ||
2062 | use less doubles in daemons; markus@ ok | ||
2063 | - deraadt@cvs.openbsd.org 2004/09/15 18:46:04 | ||
2064 | [scp.c] | ||
2065 | scratch that do { } while (0) wrapper in this case | ||
2066 | - djm@cvs.openbsd.org 2004/09/23 13:00:04 | ||
2067 | [ssh.c] | ||
2068 | correctly honour -n in multiplex client mode; spotted by sturm@ ok markus@ | ||
2069 | - djm@cvs.openbsd.org 2004/09/25 03:45:14 | ||
2070 | [sshd.c] | ||
2071 | these printf args are no longer double; ok deraadt@ markus@ | ||
2072 | - djm@cvs.openbsd.org 2004/10/07 10:10:24 | ||
2073 | [scp.1 sftp.1 ssh.1 ssh_config.5] | ||
2074 | document KbdInteractiveDevices; ok markus@ | ||
2075 | - djm@cvs.openbsd.org 2004/10/07 10:12:36 | ||
2076 | [ssh-agent.c] | ||
2077 | don't unlink agent socket when bind() fails, spotted by rich AT | ||
2078 | rich-paul.net, ok markus@ | ||
2079 | - markus@cvs.openbsd.org 2004/10/20 11:48:53 | ||
2080 | [packet.c ssh1.h] | ||
2081 | disconnect for invalid (out of range) message types. | ||
2082 | - djm@cvs.openbsd.org 2004/10/29 21:47:15 | ||
2083 | [channels.c channels.h clientloop.c] | ||
2084 | fix some window size change bugs for multiplexed connections: windows sizes | ||
2085 | were not being updated if they had changed after ~^Z suspends and SIGWINCH | ||
2086 | was not being processed unless the first connection had requested a tty; | ||
2087 | ok markus | ||
2088 | - djm@cvs.openbsd.org 2004/10/29 22:53:56 | ||
2089 | [clientloop.c misc.h readpass.c ssh-agent.c] | ||
2090 | factor out common permission-asking code to separate function; ok markus@ | ||
2091 | - djm@cvs.openbsd.org 2004/10/29 23:56:17 | ||
2092 | [bufaux.c bufaux.h buffer.c buffer.h] | ||
2093 | introduce a new buffer API that returns an error rather than fatal()ing | ||
2094 | when presented with bad data; ok markus@ | ||
2095 | - djm@cvs.openbsd.org 2004/10/29 23:57:05 | ||
2096 | [key.c] | ||
2097 | use new buffer API to avoid fatal errors on corrupt keys in authorized_keys | ||
2098 | files; ok markus@ | ||
2099 | |||
2100 | 20041102 | ||
2101 | - (dtucker) [configure.ac includes.h] Bug #947: Fix compile error on HP-UX | ||
2102 | 10.x by testing for conflicts in shadow.h and undef'ing _INCLUDE__STDC__ | ||
2103 | only if a conflict is detected. | ||
2104 | |||
2105 | 20041019 | ||
2106 | - (dtucker) [uidswap.c] Don't test dropping of gids for the root user or | ||
2107 | on Cygwin. Cygwin parts from vinschen at redhat com; ok djm@ | ||
2108 | |||
2109 | 20041016 | ||
2110 | - (djm) [auth-pam.c] snprintf->strl*, fix server message length calculations; | ||
2111 | ok dtucker@ | ||
2112 | |||
2113 | 20041006 | ||
2114 | - (dtucker) [README.privsep] Bug #939: update info about HP-UX Trusted Mode | ||
2115 | and other PAM platforms. | ||
2116 | - (dtucker) [monitor_mm.c openbsd-compat/xmmap.c] Bug #940: cast constants | ||
2117 | to void * to appease picky compilers (eg Tru64's "cc -std1"). | ||
2118 | |||
2119 | 20040930 | ||
2120 | - (dtucker) [configure.ac] Set AC_PACKAGE_NAME. ok djm@ | ||
2121 | |||
2122 | 20040923 | ||
2123 | - (dtucker) [openbsd-compat/bsd-snprintf.c] Previous change was off by one, | ||
2124 | which could have caused the justification to be wrong. ok djm@ | ||
2125 | |||
2126 | 20040921 | ||
2127 | - (dtucker) [openbsd-compat/bsd-snprintf.c] Check for max length too. | ||
2128 | ok djm@ | ||
2129 | - (dtucker) [contrib/cygwin/ssh-host-config] Update to match current Cygwin | ||
2130 | install process. Patch from vinschen at redhat.com. | ||
2131 | |||
2132 | 20040912 | ||
2133 | - (djm) [loginrec.c] Start KNF and tidy up of this long-neglected file. | ||
2134 | No change in resultant binary | ||
2135 | - (djm) [loginrec.c] __func__ifiy | ||
2136 | - (djm) [loginrec.c] xmalloc | ||
2137 | - (djm) [ssh.c sshd.c version.h] Don't divulge portable version in protocol | ||
2138 | banner. Suggested by deraadt@, ok mouring@, dtucker@ | ||
2139 | - (dtucker) [configure.ac] Fix incorrect quoting and tests for cross-compile. | ||
2140 | Partly by & ok djm@. | ||
2141 | |||
2142 | 20040911 | ||
2143 | - (djm) [ssh-agent.c] unifdef some cygwin code; ok dtucker@ | ||
2144 | - (dtucker) [auth-pam.c auth-pam.h session.c] Bug #890: Send output from | ||
2145 | failing PAM session modules to user then exit, similar to the way | ||
2146 | /etc/nologin is handled. ok djm@ | ||
2147 | - (dtucker) [auth-pam.c] Relocate sshpam_store_conv(), no code change. | ||
2148 | - (djm) [auth2-kbdint.c auth2-none.c auth2-passwd.c auth2-pubkey.c] | ||
2149 | Make cygwin code more consistent with that which surrounds it | ||
2150 | - (dtucker) [auth-pam.c auth.h auth2-none.c auth2.c monitor.c monitor_wrap.c] | ||
2151 | Bug #892: Send messages from failing PAM account modules to the client via | ||
2152 | SSH2_MSG_USERAUTH_BANNER messages. Note that this will not happen with | ||
2153 | SSH2 kbdint authentication, which need to be dealt with separately. ok djm@ | ||
2154 | - (dtucker) [session.c] Bug #927: make .hushlogin silent again. ok djm@ | ||
2155 | - (dtucker) [configure.ac] Bug #321: Add cross-compile support to configure. | ||
2156 | Parts by chua at ayrnetworks.com, astrand at lysator.liu.se and me. ok djm@ | ||
2157 | - (dtucker) [auth-krb5.c] Bug #922: Pass KRB5CCNAME to PAM. From deengert | ||
2158 | at anl.gov, ok djm@ | ||
2159 | |||
2160 | 20040830 | ||
2161 | - (dtucker) [session.c openbsd-compat/bsd-cygwin_util.{c,h}] Bug #915: only | ||
2162 | copy required environment variables on Cygwin. Patch from vinschen at | ||
2163 | redhat.com, ok djm@ | ||
2164 | - (dtucker) [regress/Makefile] Clean scp-ssh-wrapper.scp too. Patch from | ||
2165 | vinschen at redhat.com. | ||
2166 | - (dtucker) [Makefile.in contrib/ssh-copy-id] Bug #894: Improve portability | ||
2167 | of shell constructs. Patch from cjwatson at debian.org. | ||
2168 | |||
2169 | 20040829 | ||
2170 | - (dtucker) [openbsd-compat/getrrsetbyname.c] Prevent getrrsetbyname from | ||
2171 | failing with NOMEMORY if no sigs are returned and malloc(0) returns NULL. | ||
2172 | From Martin.Kraemer at Fujitsu-Siemens.com; ok djm@ | ||
2173 | - (dtucker) OpenBSD CVS Sync | ||
2174 | - djm@cvs.openbsd.org 2004/08/23 11:48:09 | ||
2175 | [authfile.c] | ||
2176 | fix error path, spotted by Martin.Kraemer AT Fujitsu-Siemens.com; ok markus | ||
2177 | - djm@cvs.openbsd.org 2004/08/23 11:48:47 | ||
2178 | [channels.c] | ||
2179 | typo, spotted by Martin.Kraemer AT Fujitsu-Siemens.com; ok markus | ||
2180 | - dtucker@cvs.openbsd.org 2004/08/23 14:26:38 | ||
2181 | [ssh-keysign.c ssh.c] | ||
2182 | Use permanently_set_uid() in ssh and ssh-keysign for consistency, matches | ||
2183 | change in Portable; ok markus@ (CVS ID sync only) | ||
2184 | - dtucker@cvs.openbsd.org 2004/08/23 14:29:23 | ||
2185 | [ssh-keysign.c] | ||
2186 | Remove duplicate getuid(), suggested by & ok markus@ | ||
2187 | - markus@cvs.openbsd.org 2004/08/26 16:00:55 | ||
2188 | [ssh.1 sshd.8] | ||
2189 | get rid of references to rhosts authentication; with jmc@ | ||
2190 | - djm@cvs.openbsd.org 2004/08/28 01:01:48 | ||
2191 | [sshd.c] | ||
2192 | don't erroneously close stdin for !reexec case, from Dave Johnson; | ||
2193 | ok markus@ | ||
2194 | - (dtucker) [configure.ac] Include sys/stream.h in sys/ptms.h header check, | ||
2195 | fixes configure warning on Solaris reported by wknox at mitre.org. | ||
2196 | - (dtucker) [regress/multiplex.sh] Skip test on platforms that do not | ||
2197 | support FD passing since multiplex requires it. Noted by tim@ | ||
2198 | - (dtucker) [regress/dynamic-forward.sh] Allow time for connections to be torn | ||
2199 | down, needed on some platforms, should be harmless on others. Patch from | ||
2200 | jason at devrandom.org. | ||
2201 | - (dtucker) [regress/scp.sh] Make this work on Cygwin too, which doesn't like | ||
2202 | files ending in .exe that aren't binaries; patch from vinschen at redhat.com. | ||
2203 | - (dtucker) [Makefile.in] Get regress/Makefile symlink right for out-of-tree | ||
2204 | builds too, from vinschen at redhat.com. | ||
2205 | - (dtucker) [regress/agent-ptrace.sh] Skip ptrace test on OSF1/DUnix/Tru64 | ||
2206 | too; patch from cmadams at hiwaay.net. | ||
2207 | - (dtucker) [configure.ac] Replace non-portable echo \n with extra echo. | ||
2208 | - (dtucker) [openbsd-compat/port-aix.c] Bug #712: Explicitly check for | ||
2209 | accounts with authentication configs that sshd can't support (ie | ||
2210 | SYSTEM=NONE and AUTH1=something). | ||
2211 | |||
2212 | 20040828 | ||
2213 | - (dtucker) [openbsd-compat/mktemp.c] Remove superfluous Cygwin #ifdef; from | ||
2214 | vinschen at redhat.com. | ||
2215 | |||
2216 | 20040823 | ||
2217 | - (djm) [ssh-rand-helper.c] Typo. Found by | ||
2218 | Martin.Kraemer AT Fujitsu-Siemens.com | ||
2219 | - (djm) [loginrec.c] Typo and bad args in error messages; Spotted by | ||
2220 | Martin.Kraemer AT Fujitsu-Siemens.com | ||
2221 | |||
2222 | 20040817 | ||
2223 | - (dtucker) [regress/README.regress] Note compatibility issues with GNU head. | ||
2224 | - (djm) OpenBSD CVS Sync | ||
2225 | - markus@cvs.openbsd.org 2004/08/16 08:17:01 | ||
2226 | [version.h] | ||
2227 | 3.9 | ||
2228 | - (djm) Crank RPM spec version numbers | ||
2229 | - (djm) Release 3.9p1 | ||
2230 | |||
2231 | 20040816 | ||
2232 | - (dtucker) [acconfig.h auth-pam.c configure.ac] Set real uid to non-root | ||
2233 | to convince Solaris PAM to honour password complexity rules. ok djm@ | ||
2234 | |||
2235 | 20040815 | ||
2236 | - (dtucker) [Makefile.in ssh-keysign.c ssh.c] Use permanently_set_uid() since | ||
2237 | it does the right thing on all platforms. ok djm@ | ||
2238 | - (djm) [acconfig.h configure.ac openbsd-compat/Makefile.in | ||
2239 | openbsd-compat/bsd-closefrom.c openbsd-compat/bsd-misc.c | ||
2240 | openbsd-compat/bsd-misc.h openbsd-compat/openbsd-compat.h] Use smarter | ||
2241 | closefrom() replacement from sudo; ok dtucker@ | ||
2242 | - (djm) [loginrec.c] Check that seek succeeded here too; ok dtucker | ||
2243 | - (dtucker) [Makefile.in] Fix typo. | ||
2244 | |||
2245 | 20040814 | ||
2246 | - (dtucker) [auth-krb5.c gss-serv-krb5.c openbsd-compat/xmmap.c] | ||
2247 | Explicitly set umask for mkstemp; ok djm@ | ||
2248 | - (dtucker) [includes.h] Undef _INCLUDE__STDC__ on HP-UX, otherwise | ||
2249 | prot.h and shadow.h provide conflicting declarations of getspnam. ok djm@ | ||
2250 | - (dtucker) [loginrec.c openbsd-compat/port-aix.c openbsd-compat/port-aix.h] | ||
2251 | Plug AIX login recording into login_write so logins will be recorded for | ||
2252 | all auth types. | ||
2253 | |||
2254 | 20040813 | ||
2255 | - (dtucker) [openbsd-compat/bsd-misc.c] Typo in #ifdef; from vinschen at | ||
2256 | redhat.com | ||
2257 | - (dtucker) OpenBSD CVS Sync | ||
2258 | - avsm@cvs.openbsd.org 2004/08/11 21:43:05 | ||
2259 | [channels.c channels.h clientloop.c misc.c misc.h serverloop.c ssh-agent.c] | ||
2260 | some signed/unsigned int comparison cleanups; markus@ ok | ||
2261 | - avsm@cvs.openbsd.org 2004/08/11 21:44:32 | ||
2262 | [authfd.c scp.c ssh-keyscan.c] | ||
2263 | use atomicio instead of homegrown equivalents or read/write. | ||
2264 | markus@ ok | ||
2265 | - djm@cvs.openbsd.org 2004/08/12 09:18:24 | ||
2266 | [sshlogin.c] | ||
2267 | typo in error message, spotted by moritz AT jodeit.org (Id sync only) | ||
2268 | - jakob@cvs.openbsd.org 2004/08/12 21:41:13 | ||
2269 | [ssh-keygen.1 ssh.1] | ||
2270 | improve SSHFP documentation; ok deraadt@ | ||
2271 | - jmc@cvs.openbsd.org 2004/08/13 00:01:43 | ||
2272 | [ssh-keygen.1] | ||
2273 | kill whitespace at eol; | ||
2274 | - djm@cvs.openbsd.org 2004/08/13 02:51:48 | ||
2275 | [monitor_fdpass.c] | ||
2276 | extra check for no message case; ok markus, deraadt, hshoexer, henning | ||
2277 | - dtucker@cvs.openbsd.org 2004/08/13 11:09:24 | ||
2278 | [servconf.c] | ||
2279 | Fix line numbers off-by-one in error messages, from tortay at cc.in2p3.fr | ||
2280 | ok markus@, djm@ | ||
2281 | |||
2282 | 20040812 | ||
2283 | - (dtucker) [sshd.c] Remove duplicate variable imported during sync. | ||
2284 | - (dtucker) OpenBSD CVS Sync | ||
2285 | - markus@cvs.openbsd.org 2004/07/28 08:56:22 | ||
2286 | [sshd.c] | ||
2287 | call setsid() _before_ re-exec | ||
2288 | - markus@cvs.openbsd.org 2004/07/28 09:40:29 | ||
2289 | [auth.c auth1.c auth2.c cipher.c cipher.h key.c session.c ssh.c | ||
2290 | sshconnect1.c] | ||
2291 | more s/illegal/invalid/ | ||
2292 | - djm@cvs.openbsd.org 2004/08/04 10:37:52 | ||
2293 | [dh.c] | ||
2294 | return group14 when no primes found - fixes hang on empty /etc/moduli; | ||
2295 | ok markus@ | ||
2296 | - dtucker@cvs.openbsd.org 2004/08/11 11:09:54 | ||
2297 | [servconf.c] | ||
2298 | Fix minor leak; "looks right" deraadt@ | ||
2299 | - dtucker@cvs.openbsd.org 2004/08/11 11:50:09 | ||
2300 | [sshd.c] | ||
2301 | Don't try to close startup_pipe if it's not open; ok djm@ | ||
2302 | - djm@cvs.openbsd.org 2004/08/11 11:59:22 | ||
2303 | [sshlogin.c] | ||
2304 | check that lseek went were we told it to; ok markus@ | ||
2305 | (Id sync only, but similar changes are needed in loginrec.c) | ||
2306 | - djm@cvs.openbsd.org 2004/08/11 12:01:16 | ||
2307 | [sshlogin.c] | ||
2308 | make store_lastlog_message() static to appease -Wall; ok markus | ||
2309 | - (dtucker) [sshd.c] Clear loginmsg in postauth monitor, prevents doubling | ||
2310 | messages generated before the postauth privsep split. | ||
2311 | |||
2312 | 20040720 | ||
2313 | - (djm) OpenBSD CVS Sync | ||
2314 | - markus@cvs.openbsd.org 2004/07/21 08:56:12 | ||
2315 | [auth.c] | ||
2316 | s/Illegal user/Invalid user/; many requests; ok djm, millert, niklas, | ||
2317 | miod, ... | ||
2318 | - djm@cvs.openbsd.org 2004/07/21 10:33:31 | ||
2319 | [auth1.c auth2.c] | ||
2320 | bz#899: Don't display invalid usernames in setproctitle | ||
2321 | from peak AT argo.troja.mff.cuni.cz; ok markus@ | ||
2322 | - djm@cvs.openbsd.org 2004/07/21 10:36:23 | ||
2323 | [gss-serv-krb5.c] | ||
2324 | fix function declaration | ||
2325 | - djm@cvs.openbsd.org 2004/07/21 11:51:29 | ||
2326 | [canohost.c] | ||
2327 | bz#902: cache remote port so we don't fatal() in auth_log when remote | ||
2328 | connection goes away quickly. from peak AT argo.troja.mff.cuni.cz; | ||
2329 | ok markus@ | ||
2330 | - (djm) [auth-pam.c] Portable parts of bz#899: Don't display invalid | ||
2331 | usernames in setproctitle from peak AT argo.troja.mff.cuni.cz; | ||
2332 | |||
2333 | 20040720 | ||
2334 | - (djm) [log.c] bz #111: Escape more control characters when sending data | ||
2335 | to syslog; from peak AT argo.troja.mff.cuni.cz | ||
2336 | - (djm) [contrib/redhat/sshd.pam] bz #903: Remove redundant entries; from | ||
2337 | peak AT argo.troja.mff.cuni.cz | ||
2338 | - (djm) [regress/README.regress] Remove caveat regarding TCP wrappers, now | ||
2339 | that sshd is fixed to behave better; suggested by tim | ||
2340 | |||
2341 | 20040719 | ||
2342 | - (djm) [openbsd-compat/bsd-arc4random.c] Discard early keystream, like OpenBSD | ||
2343 | ok dtucker@ | ||
2344 | - (djm) [auth-pam.c] Avoid use of xstrdup and friends in conversation function, | ||
2345 | instead return PAM_CONV_ERR, avoiding another path to fatal(); ok dtucker@ | ||
2346 | - (tim) [configure.ac] updwtmpx() on OpenServer seems to add duplicate entry. | ||
2347 | Report by rac AT tenzing.org | ||
2348 | |||
2349 | 20040717 | ||
2350 | - (dtucker) [logintest.c scp.c sftp-server.c sftp.c ssh-add.c ssh-agent.c | ||
2351 | ssh-keygen.c ssh-keyscan.c ssh-keysign.c ssh-rand-helper.c ssh.c sshd.c | ||
2352 | openbsd-compat/bsd-misc.c] Move "char *__progname" to bsd-misc.c. Reduces | ||
2353 | diff vs OpenBSD; ok mouring@, tested by tim@ too. | ||
2354 | - (dtucker) OpenBSD CVS Sync | ||
2355 | - deraadt@cvs.openbsd.org 2004/07/11 17:48:47 | ||
2356 | [channels.c cipher.c clientloop.c clientloop.h compat.h moduli.c | ||
2357 | readconf.c nchan.c pathnames.h progressmeter.c readconf.h servconf.c | ||
2358 | session.c sftp-client.c sftp.c ssh-agent.1 ssh-keygen.c ssh.c ssh1.h | ||
2359 | sshd.c ttymodes.h] | ||
2360 | spaces | ||
2361 | - brad@cvs.openbsd.org 2004/07/12 23:34:25 | ||
2362 | [ssh-keyscan.1] | ||
2363 | Fix incorrect macro, .I -> .Em | ||
2364 | From: Eric S. Raymond <esr at thyrsus dot com> | ||
2365 | ok jmc@ | ||
2366 | - dtucker@cvs.openbsd.org 2004/07/17 05:31:41 | ||
2367 | [monitor.c monitor_wrap.c session.c session.h sshd.c sshlogin.c] | ||
2368 | Move "Last logged in at.." message generation to the monitor, right | ||
2369 | before recording the new login. Fixes missing lastlog message when | ||
2370 | /var/log/lastlog is not world-readable and incorrect datestamp when | ||
2371 | multiple sessions are used (bz #463); much assistance & ok markus@ | ||
2372 | |||
2373 | 20040711 | ||
2374 | - (dtucker) [auth-pam.c] Check for zero from waitpid() too, which allows | ||
2375 | the monitor to properly clean up the PAM thread (Debian bug #252676). | ||
2376 | |||
2377 | 20040709 | ||
2378 | - (tim) [contrib/cygwin/README] add minires-devel requirement. Patch from | ||
2379 | vinschen AT redhat.com | ||
2380 | |||
2381 | 20040708 | ||
2382 | - (dtucker) OpenBSD CVS Sync | ||
2383 | - dtucker@cvs.openbsd.org 2004/07/03 05:11:33 | ||
2384 | [sshlogin.c] (RCSID sync only, the corresponding code is not in Portable) | ||
2385 | Use '\0' not 0 for string; ok djm@, deraadt@ | ||
2386 | - dtucker@cvs.openbsd.org 2004/07/03 11:02:25 | ||
2387 | [monitor_wrap.c] | ||
2388 | Put s/key functions inside #ifdef SKEY same as monitor.c, | ||
2389 | from des@freebsd via bz #330, ok markus@ | ||
2390 | - dtucker@cvs.openbsd.org 2004/07/08 12:47:21 | ||
2391 | [scp.c] | ||
2392 | Prevent scp from skipping the file following a double-error. | ||
2393 | bz #863, ok markus@ | ||
2394 | |||
2395 | 20040702 | ||
2396 | - (dtucker) [mdoc2man.awk] Teach it to ignore .Bk -words, reported by | ||
2397 | strube at physik3.gwdg.de a long time ago. | ||
2398 | |||
2399 | 20040701 | ||
2400 | - (dtucker) [session.c] Call display_loginmsg again after do_pam_session. | ||
2401 | Ensures messages from PAM modules are displayed when privsep=no. | ||
2402 | - (dtucker) [auth-pam.c] Bug #705: Make arguments match PAM specs, fixes | ||
2403 | warnings on compliant platforms. From paul.a.bolton at bt.com. ok djm@ | ||
2404 | - (dtucker) [auth-pam.c] Bug #559 (last piece): Pass DISALLOW_NULL_AUTHTOK | ||
2405 | to pam_authenticate for challenge-response auth too. Originally from | ||
2406 | fcusack at fcusack.com, ok djm@ | ||
2407 | - (tim) [buildpkg.sh.in] Add $REV to bump the package revision within | ||
2408 | the same version. Handle the case where someone uses --with-privsep-user= | ||
2409 | and the user name does not match the group name. ok dtucker@ | ||
2410 | |||
2411 | 20040630 | ||
2412 | - (dtucker) [auth-pam.c] Check for buggy PAM modules that return a NULL | ||
2413 | appdata_ptr to the conversation function. ok djm@ | ||
2414 | - (djm) OpenBSD CVS Sync | ||
2415 | - jmc@cvs.openbsd.org 2004/06/26 09:03:21 | ||
2416 | [ssh.1] | ||
2417 | - remove double word | ||
2418 | - rearrange .Bk to keep SYNOPSIS nice | ||
2419 | - -M before -m in options description | ||
2420 | - jmc@cvs.openbsd.org 2004/06/26 09:11:14 | ||
2421 | [ssh_config.5] | ||
2422 | punctuation and grammar fixes. also, keep the options in order. | ||
2423 | - jmc@cvs.openbsd.org 2004/06/26 09:14:40 | ||
2424 | [sshd_config.5] | ||
2425 | new sentence, new line; | ||
2426 | - avsm@cvs.openbsd.org 2004/06/26 20:07:16 | ||
2427 | [sshd.c] | ||
2428 | initialise some fd variables to -1, djm@ ok | ||
2429 | - djm@cvs.openbsd.org 2004/06/30 08:36:59 | ||
2430 | [session.c] | ||
2431 | unbreak TTY break, diagnosed by darren AT dazwin.com; ok markus@ | ||
2432 | |||
2433 | 20040627 | ||
2434 | - (tim) update README files. | ||
2435 | - (dtucker) [mdoc2man.awk] Bug #883: correctly recognise .Pa and .Ev macros. | ||
2436 | - (dtucker) [regress/README.regress] Document new variables. | ||
2437 | - (dtucker) [acconfig.h configure.ac sftp-server.c] Bug #823: add sftp | ||
2438 | rename handling for Linux which returns EPERM for link() on (at least some) | ||
2439 | filesystems that do not support hard links. sftp-server will fall back to | ||
2440 | stat+rename() in such cases. | ||
2441 | - (dtucker) [openbsd-compat/port-aix.c] Missing __func__. | ||
2442 | |||
2443 | 20040626 | ||
2444 | - (djm) OpenBSD CVS Sync | ||
2445 | - djm@cvs.openbsd.org 2004/06/25 18:43:36 | ||
2446 | [sshd.c] | ||
2447 | fix broken fd handling in the re-exec fallback path, particularly when | ||
2448 | /dev/crypto is in use; ok deraadt@ markus@ | ||
2449 | - djm@cvs.openbsd.org 2004/06/25 23:21:38 | ||
2450 | [sftp.c] | ||
2451 | bz #875: fix bad escape char error message; reported by f_mohr AT yahoo.de | ||
2452 | |||
2453 | 20040625 | ||
2454 | - (dtucker) OpenBSD CVS Sync | ||
2455 | - djm@cvs.openbsd.org 2004/06/24 19:30:54 | ||
2456 | [servconf.c servconf.h sshd.c] | ||
2457 | re-exec sshd on accept(); initial work, final debugging and ok markus@ | ||
2458 | - djm@cvs.openbsd.org 2004/06/25 01:16:09 | ||
2459 | [sshd.c] | ||
2460 | only perform tcp wrappers checks when the incoming connection is on a | ||
2461 | socket. silences useless warnings from regress tests that use | ||
2462 | proxycommand="sshd -i". prompted by david@ ok markus@ | ||
2463 | - djm@cvs.openbsd.org 2004/06/24 19:32:00 | ||
2464 | [regress/Makefile regress/test-exec.sh, added regress/reexec.sh] | ||
2465 | regress test for re-exec corner cases | ||
2466 | - djm@cvs.openbsd.org 2004/06/25 01:25:12 | ||
2467 | [regress/test-exec.sh] | ||
2468 | clean reexec-specific junk out of text-exec.sh and simplify; idea markus@ | ||
2469 | - dtucker@cvs.openbsd.org 2004/06/25 05:38:48 | ||
2470 | [sftp-server.c] | ||
2471 | Fall back to stat+rename if filesystem doesn't doesn't support hard | ||
2472 | links. bz#823, ok djm@ | ||
2473 | - (dtucker) [configure.ac openbsd-compat/misc.c [openbsd-compat/misc.h] | ||
2474 | Add closefrom() for platforms that don't have it. | ||
2475 | - (dtucker) [sshd.c] add line missing from reexec sync. | ||
2476 | |||
2477 | 20040623 | ||
2478 | - (dtucker) [auth1.c] Ensure do_pam_account is called for Protocol 1 | ||
2479 | connections with empty passwords. Patch from davidwu at nbttech.com, | ||
2480 | ok djm@ | ||
2481 | - (dtucker) OpenBSD CVS Sync | ||
2482 | - dtucker@cvs.openbsd.org 2004/06/22 22:42:02 | ||
2483 | [regress/envpass.sh] | ||
2484 | Add quoting for test -z; ok markus@ | ||
2485 | - dtucker@cvs.openbsd.org 2004/06/22 22:45:52 | ||
2486 | [regress/test-exec.sh] | ||
2487 | Add TEST_SSH_SSHD_CONFOPTS and TEST_SSH_SSH_CONFOPTS to allow adding | ||
2488 | arbitary options to sshd_config and ssh_config during tests. ok markus@ | ||
2489 | - dtucker@cvs.openbsd.org 2004/06/22 22:55:56 | ||
2490 | [regress/dynamic-forward.sh regress/test-exec.sh] | ||
2491 | Allow setting of port for regress from TEST_SSH_PORT variable; ok markus@ | ||
2492 | - mouring@cvs.openbsd.org 2004/06/23 00:39:38 | ||
2493 | [rijndael.c] | ||
2494 | -Wshadow fix up s/encrypt/do_encrypt/. OK djm@, markus@ | ||
2495 | - dtucker@cvs.openbsd.org 2004/06/23 14:31:01 | ||
2496 | [ssh.c] | ||
2497 | Fix counting in master/slave when passing environment variables; ok djm@ | ||
2498 | - (dtucker) [cipher.c] encrypt->do_encrypt inside SSH_OLD_EVP to match | ||
2499 | -Wshadow change. | ||
2500 | - (bal) [Makefile.in] Remove opensshd.init on 'make distclean' | ||
2501 | - (dtucker) [auth.c openbsd-compat/port-aix.c openbsd-compat/port-aix.h] | ||
2502 | Move loginrestrictions test to port-aix.c, replace with a generic hook. | ||
2503 | - (tim) [regress/try-ciphers.sh] "if ! some_command" is not portable. | ||
2504 | - (bal) [contrib/README] Removed "mdoc2man.pl" reference and added | ||
2505 | reference to "findssl.sh" | ||
2506 | |||
2507 | 20040622 | ||
2508 | - (dtucker) OpenBSD CVS Sync | ||
2509 | - djm@cvs.openbsd.org 2004/06/20 17:36:59 | ||
2510 | [ssh.c] | ||
2511 | filter passed env vars at slave in connection sharing case; ok markus@ | ||
2512 | - djm@cvs.openbsd.org 2004/06/20 18:53:39 | ||
2513 | [sftp.c] | ||
2514 | make "ls -l" listings print user/group names, add "ls -n" to show uid/gid | ||
2515 | (like /bin/ls); idea & ok markus@ | ||
2516 | - djm@cvs.openbsd.org 2004/06/20 19:28:12 | ||
2517 | [sftp.1] | ||
2518 | mention new -n flag | ||
2519 | - avsm@cvs.openbsd.org 2004/06/21 17:36:31 | ||
2520 | [auth-rsa.c auth2-gss.c auth2-pubkey.c authfile.c canohost.c channels.c | ||
2521 | cipher.c dns.c kex.c monitor.c monitor_fdpass.c monitor_wrap.c | ||
2522 | monitor_wrap.h nchan.c packet.c progressmeter.c scp.c sftp-server.c sftp.c | ||
2523 | ssh-gss.h ssh-keygen.c ssh.c sshconnect.c sshconnect1.c sshlogin.c | ||
2524 | sshpty.c] | ||
2525 | make ssh -Wshadow clean, no functional changes | ||
2526 | markus@ ok | ||
2527 | - djm@cvs.openbsd.org 2004/06/21 17:53:03 | ||
2528 | [session.c] | ||
2529 | fix fd leak for multiple subsystem connections; with markus@ | ||
2530 | - djm@cvs.openbsd.org 2004/06/21 22:02:58 | ||
2531 | [log.h] | ||
2532 | mark fatal and cleanup exit as __dead; ok markus@ | ||
2533 | - djm@cvs.openbsd.org 2004/06/21 22:04:50 | ||
2534 | [sftp.c] | ||
2535 | introduce sorting for ls, same options as /bin/ls; ok markus@ | ||
2536 | - djm@cvs.openbsd.org 2004/06/21 22:30:45 | ||
2537 | [sftp.c] | ||
2538 | prefix ls option flags with LS_ | ||
2539 | - djm@cvs.openbsd.org 2004/06/21 22:41:31 | ||
2540 | [sftp.1] | ||
2541 | document sort options | ||
2542 | - djm@cvs.openbsd.org 2004/06/22 01:16:39 | ||
2543 | [sftp.c] | ||
2544 | don't show .files by default in ls, add -a option to turn them back on; | ||
2545 | ok markus | ||
2546 | - markus@cvs.openbsd.org 2004/06/22 03:12:13 | ||
2547 | [regress/envpass.sh regress/multiplex.sh] | ||
2548 | more portable env passing tests | ||
2549 | - dtucker@cvs.openbsd.org 2004/06/22 05:05:45 | ||
2550 | [monitor.c monitor_wrap.c] | ||
2551 | Change login->username, will prevent -Wshadow errors in Portable; | ||
2552 | ok markus@ | ||
2553 | - (dtucker) [monitor.c] Fix Portable-specific -Wshadow warnings on "socket". | ||
2554 | - (dtucker) [defines.h] Define __dead if not already defined. | ||
2555 | - (bal) [auth-passwd.c auth1.c] Clean up unused variables. | ||
2556 | |||
2557 | 20040620 | ||
2558 | - (tim) [configure.ac Makefile.in] Only change TEST_SHELL on broken platforms. | ||
2559 | |||
2560 | 20040619 | ||
2561 | - (dtucker) [auth-pam.c] Don't use PAM namespace for | ||
2562 | pam_password_change_required either. | ||
2563 | - (tim) [configure.ac buildpkg.sh.in contrib/solaris/README] move opensshd | ||
2564 | init script to top level directory. Add opensshd.init.in. | ||
2565 | Remove contrib/solaris/buildpkg.sh, contrib/solaris/opensshd.in | ||
2566 | |||
2567 | 20040618 | ||
2568 | - (djm) OpenBSD CVS Sync | ||
2569 | - djm@cvs.openbsd.org 2004/06/17 14:52:48 | ||
2570 | [clientloop.c clientloop.h ssh.c] | ||
2571 | support environment passing over shared connections; ok markus@ | ||
2572 | - djm@cvs.openbsd.org 2004/06/17 15:10:14 | ||
2573 | [clientloop.c misc.h readconf.c readpass.c ssh.c ssh_config.5] | ||
2574 | Add option for confirmation (ControlMaster=ask) via ssh-askpass before | ||
2575 | opening shared connections; ok markus@ | ||
2576 | - djm@cvs.openbsd.org 2004/06/17 14:53:27 | ||
2577 | [regress/multiplex.sh] | ||
2578 | shared connection env passing regress test | ||
2579 | - (dtucker) [regress/README.regress] Add detail on how to run a single | ||
2580 | test from the top-level Makefile. | ||
2581 | - (dtucker) OpenBSD CVS Sync | ||
2582 | - djm@cvs.openbsd.org 2004/06/17 23:56:57 | ||
2583 | [ssh.1 ssh.c] | ||
2584 | sync usage() and SYNPOSIS with connection sharing changes | ||
2585 | - dtucker@cvs.openbsd.org 2004/06/18 06:13:25 | ||
2586 | [sftp.c] | ||
2587 | Use execvp instead of execv so sftp -S ssh works. "makes sense" markus@ | ||
2588 | - dtucker@cvs.openbsd.org 2004/06/18 06:15:51 | ||
2589 | [multiplex.sh] | ||
2590 | Use -S for scp/sftp to force the use of the ssh being tested. | ||
2591 | ok djm@,markus@ | ||
2592 | - (djm) OpenBSD CVS Sync | ||
2593 | - djm@cvs.openbsd.org 2004/06/18 10:40:19 | ||
2594 | [ssh.c] | ||
2595 | delay signal handler setup until we have finished talking to the master. | ||
2596 | allow interrupting of setup (e.g. if master is stuck); ok markus@ | ||
2597 | - markus@cvs.openbsd.org 2004/06/18 10:55:43 | ||
2598 | [ssh.1 ssh.c] | ||
2599 | trim synopsis for -S, allow -S and -oControlMaster, -MM means 'ask'; | ||
2600 | ok djm | ||
2601 | - djm@cvs.openbsd.org 2004/06/18 11:11:54 | ||
2602 | [channels.c clientloop.c] | ||
2603 | Don't explode in clientloop when we receive a bogus channel id, but | ||
2604 | also don't generate them to begin with; ok markus@ | ||
2605 | |||
2606 | 20040617 | ||
2607 | - (dtucker) [regress/scp.sh] diff -N is not portable (but needed for some | ||
2608 | platforms), so test if diff understands it. Pointed out by tim@, ok djm@ | ||
2609 | - (dtucker) OpenBSD CVS Sync regress/ | ||
2610 | - dtucker@cvs.openbsd.org 2004/06/17 05:51:59 | ||
2611 | [regress/multiplex.sh] | ||
2612 | Remove datafile between and after tests, kill sshd rather than wait; | ||
2613 | ok djm@ | ||
2614 | - dtucker@cvs.openbsd.org 2004/06/17 06:00:05 | ||
2615 | [regress/multiplex.sh] | ||
2616 | Use DATA and COPY for test data rather than hard-coded paths; ok djm@ | ||
2617 | - dtucker@cvs.openbsd.org 2004/06/17 06:19:06 | ||
2618 | [regress/multiplex.sh] | ||
2619 | Add small description of failing test to failure message; ok djm@ | ||
2620 | - (dtucker) [regress/multiplex.sh] add EXEEXT for those platforms that need | ||
2621 | it. | ||
2622 | - (dtucker) [regress/multiplex.sh] Increase sleep time to 120 sec (60 is not | ||
2623 | enough for slow systems, especially if they don't have a kernel RNG). | ||
2624 | |||
2625 | 20040616 | ||
2626 | - (dtucker) [openbsd-compat/port-aix.c] Expand whitespace -> tabs. No | ||
2627 | code changes. | ||
2628 | - (dtucker) OpenBSD CVS Sync regress/ | ||
2629 | - djm@cvs.openbsd.org 2004/04/27 09:47:30 | ||
2630 | [regress/Makefile regress/test-exec.sh, added regress/envpass.sh] | ||
2631 | regress test for environment passing, SendEnv & AcceptEnv options; | ||
2632 | ok markus@ | ||
2633 | - dtucker@cvs.openbsd.org 2004/06/13 13:51:02 | ||
2634 | [regress/Makefile regress/test-exec.sh, added regress/scp-ssh-wrapper.sh | ||
2635 | regress/scp.sh] | ||
2636 | Add scp regression test; with & ok markus@ | ||
2637 | - djm@cvs.openbsd.org 2004/06/13 15:04:08 | ||
2638 | [regress/Makefile regress/test-exec.sh, added regress/envpass.sh] | ||
2639 | regress test for client multiplexing; ok markus@ | ||
2640 | - djm@cvs.openbsd.org 2004/06/13 15:16:54 | ||
2641 | [regress/test-exec.sh] | ||
2642 | remove duplicate setting of $SCP; spotted by markus@ | ||
2643 | - dtucker@cvs.openbsd.org 2004/06/16 13:15:09 | ||
2644 | [regress/scp.sh] | ||
2645 | Make scp -r tests use diff -rN not cmp (which won't do dirs. ok markus@ | ||
2646 | - dtucker@cvs.openbsd.org 2004/06/16 13:16:40 | ||
2647 | [regress/multiplex.sh] | ||
2648 | Silence multiplex sftp and scp tests. ok markus@ | ||
2649 | - (dtucker) [regress/test-exec.sh] | ||
2650 | Move Portable-only StrictModes to top of list to make syncs easier. | ||
2651 | - (dtucker) [regress/README.regress] | ||
2652 | Add $TEST_SHELL to readme. | ||
2653 | |||
2654 | 20040615 | ||
2655 | - (djm) OpenBSD CVS Sync | ||
2656 | - djm@cvs.openbsd.org 2004/05/26 08:59:57 | ||
2657 | [sftp.c] | ||
2658 | exit -> _exit in forked child on error; from andrushock AT korovino.net | ||
2659 | - markus@cvs.openbsd.org 2004/05/26 23:02:39 | ||
2660 | [channels.c] | ||
2661 | missing freeaddrinfo; Andrey Matveev | ||
2662 | - dtucker@cvs.openbsd.org 2004/05/27 00:50:13 | ||
2663 | [readconf.c] | ||
2664 | Kill dead code after fatal(); ok djm@ | ||
2665 | - dtucker@cvs.openbsd.org 2004/06/01 14:20:45 | ||
2666 | [auth2-chall.c] | ||
2667 | Remove redundant #include; ok markus@ | ||
2668 | - pedro@cvs.openbsd.org 2004/06/03 12:22:20 | ||
2669 | [sftp-client.c sftp.c] | ||
2670 | initialize pointers, ok markus@ | ||
2671 | - djm@cvs.openbsd.org 2004/06/13 12:53:24 | ||
2672 | [dh.c dh.h kex.c kex.h kexdhc.c kexdhs.c monitor.c myproposal.h] | ||
2673 | [ssh-keyscan.c sshconnect2.c sshd.c] | ||
2674 | implement diffie-hellman-group14-sha1 kex method (trivial extension to | ||
2675 | existing diffie-hellman-group1-sha1); ok markus@ | ||
2676 | - dtucker@cvs.openbsd.org 2004/06/13 14:01:42 | ||
2677 | [ssh.1 ssh_config.5 sshd_config.5] | ||
2678 | List supported ciphers in man pages, tidy up ssh -c; | ||
2679 | "looks fine" jmc@, ok markus@ | ||
2680 | - djm@cvs.openbsd.org 2004/06/13 15:03:02 | ||
2681 | [channels.c channels.h clientloop.c clientloop.h includes.h readconf.c] | ||
2682 | [readconf.h scp.1 sftp.1 ssh.1 ssh.c ssh_config.5] | ||
2683 | implement session multiplexing in the client (the server has supported | ||
2684 | this since 2.0); ok markus@ | ||
2685 | - djm@cvs.openbsd.org 2004/06/14 01:44:39 | ||
2686 | [channels.c clientloop.c misc.c misc.h packet.c ssh-agent.c ssh-keyscan.c] | ||
2687 | [sshd.c] | ||
2688 | set_nonblock() instead of fnctl(...,O_NONBLOCK); "looks sane" deraadt@ | ||
2689 | - djm@cvs.openbsd.org 2004/06/15 05:45:04 | ||
2690 | [clientloop.c] | ||
2691 | missed one unset_nonblock; spotted by Tim Rice | ||
2692 | - (djm) Fix Makefile.in for connection sharing changes | ||
2693 | - (djm) [ssh.c] Use separate var for address length | ||
2694 | |||
2695 | 20040603 | ||
2696 | - (dtucker) [auth-pam.c] Don't use pam_* namespace for sshd's PAM functions. | ||
2697 | ok djm@ | ||
2698 | |||
2699 | 20040601 | ||
2700 | - (djm) [auth-pam.c] Add copyright for local changes | ||
2701 | |||
2702 | 20040530 | ||
2703 | - (dtucker) [auth-pam.c auth-pam.h auth-passwd.c] Bug #874: Re-add PAM | ||
2704 | support for PasswordAuthentication=yes. ok djm@ | ||
2705 | - (dtucker) [auth-pam.c] Use an invalid password for root if | ||
2706 | PermitRootLogin != yes or the login is invalid, to prevent leaking | ||
2707 | information. Based on Openwall's owl-always-auth patch. ok djm@ | ||
2708 | - (tim) [configure.ac Makefile.in] Add support for "make package" ok djm@ | ||
2709 | - (tim) [buildpkg.sh.in] New file. A more flexible version of | ||
2710 | contrib/solaris/buildpkg.sh used for "make package". | ||
2711 | - (tim) [buildpkg.sh.in] Last minute fix didn't make it in the .in file. | ||
2712 | |||
2713 | 20040527 | ||
2714 | - (dtucker) [contrib/caldera/openssh.spec contrib/redhat/openssh.spec | ||
2715 | contrib/README CREDITS INSTALL] Bug #873: Correct URLs for x11-ssh-askpass | ||
2716 | and Jim Knoble's email address , from Jim himself. | ||
2717 | |||
2718 | 20040524 | ||
2719 | - (dtucker) OpenBSD CVS Sync | ||
2720 | - djm@cvs.openbsd.org 2004/05/19 12:17:33 | ||
2721 | [sftp-client.c sftp.c] | ||
2722 | gracefully abort transfers on receipt of SIGINT, also ignore SIGINT while | ||
2723 | waiting for a command; ok markus@ | ||
2724 | - dtucker@cvs.openbsd.org 2004/05/20 10:58:05 | ||
2725 | [clientloop.c] | ||
2726 | Trivial type fix 0 -> '\0'; ok markus@ | ||
2727 | - markus@cvs.openbsd.org 2004/05/21 08:43:03 | ||
2728 | [kex.h moduli.c tildexpand.c] | ||
2729 | add prototypes for -Wall; ok djm | ||
2730 | - djm@cvs.openbsd.org 2004/05/21 11:33:11 | ||
2731 | [channels.c channels.h clientloop.c serverloop.c ssh.1] | ||
2732 | bz #756: add support for the cancel-tcpip-forward request for the server | ||
2733 | and the client (through the ~C commandline). reported by z3p AT | ||
2734 | twistedmatrix.com; ok markus@ | ||
2735 | - djm@cvs.openbsd.org 2004/05/22 06:32:12 | ||
2736 | [clientloop.c ssh.1] | ||
2737 | use '-h' for help in ~C commandline instead of '-?'; inspired by jmc@ | ||
2738 | - jmc@cvs.openbsd.org 2004/05/22 16:01:05 | ||
2739 | [ssh.1] | ||
2740 | kill whitespace at eol; | ||
2741 | - dtucker@cvs.openbsd.org 2004/05/23 23:59:53 | ||
2742 | [auth.c auth.h auth1.c auth2.c servconf.c servconf.h sshd_config | ||
2743 | sshd_config.5] | ||
2744 | Add MaxAuthTries sshd config option; ok markus@ | ||
2745 | - (dtucker) [auth-pam.c] Bug #839: Ensure that pam authentication "thread" | ||
2746 | is terminated if the privsep slave exits during keyboard-interactive | ||
2747 | authentication. ok djm@ | ||
2748 | - (dtucker) [sshd.c] Fix typo in comment. | ||
2749 | |||
2750 | 20040523 | ||
2751 | - (djm) [sshd_config] Explain consequences of UsePAM=yes a little better in | ||
2752 | sshd_config; ok dtucker@ | ||
2753 | - (djm) [configure.ac] Warn if the system has no known way of figuring out | ||
2754 | which user is on the other end of a Unix domain socket; ok dtucker@ | ||
2755 | - (bal) [openbsd-compat/sys-queue.h] Reintroduce machinary to handle | ||
2756 | old/broken/incomplete <sys/queue.h>. | ||
2757 | |||
2758 | 20040513 | ||
2759 | - (dtucker) [configure.ac] Bug #867: Additional tests for res_query in | ||
2760 | libresolv, fixes problems detecting it on some platforms | ||
2761 | (eg Linux/x86-64). From Kurt Roeckx via Debian, ok mouring@ | ||
2762 | - (dtucker) OpenBSD CVS Sync | ||
2763 | - jmc@cvs.openbsd.org 2004/05/04 18:36:07 | ||
2764 | [scp.1] | ||
2765 | SendEnv here too; | ||
2766 | - jmc@cvs.openbsd.org 2004/05/06 11:24:23 | ||
2767 | [ssh_config.5] | ||
2768 | typo from John Cosimano (PR 3770); | ||
2769 | - deraadt@cvs.openbsd.org 2004/05/08 00:01:37 | ||
2770 | [auth.c clientloop.c misc.h servconf.c ssh.c sshpty.h sshtty.c | ||
2771 | tildexpand.c], removed: sshtty.h tildexpand.h | ||
2772 | make two tiny header files go away; djm ok | ||
2773 | - djm@cvs.openbsd.org 2004/05/08 00:21:31 | ||
2774 | [clientloop.c misc.h readpass.c scard.c ssh-add.c ssh-agent.c ssh-keygen.c | ||
2775 | sshconnect.c sshconnect1.c sshconnect2.c] removed: readpass.h | ||
2776 | kill a tiny header; ok deraadt@ | ||
2777 | - djm@cvs.openbsd.org 2004/05/09 00:06:47 | ||
2778 | [moduli.c ssh-keygen.c] removed: moduli.h | ||
2779 | zap another tiny header; ok deraadt@ | ||
2780 | - djm@cvs.openbsd.org 2004/05/09 01:19:28 | ||
2781 | [OVERVIEW auth-rsa.c auth1.c kex.c monitor.c session.c sshconnect1.c | ||
2782 | sshd.c] removed: mpaux.c mpaux.h | ||
2783 | kill some more tiny files; ok deraadt@ | ||
2784 | - djm@cvs.openbsd.org 2004/05/09 01:26:48 | ||
2785 | [kex.c] | ||
2786 | don't overwrite what we are trying to compute | ||
2787 | - deraadt@cvs.openbsd.org 2004/05/11 19:01:43 | ||
2788 | [auth.c auth2-none.c authfile.c channels.c monitor.c monitor_mm.c | ||
2789 | packet.c packet.h progressmeter.c session.c openbsd-compat/xmmap.c] | ||
2790 | improve some code lint did not like; djm millert ok | ||
2791 | - dtucker@cvs.openbsd.org 2004/05/13 02:47:50 | ||
2792 | [ssh-agent.1] | ||
2793 | Add examples to ssh-agent.1, bz#481 from Ralf Hauser; ok deraadt@ | ||
2794 | - (dtucker) [sshd.8] Bug #843: Add warning about PasswordAuthentication to | ||
2795 | UsePAM section. Parts from djm@ and jmc@. | ||
2796 | - (dtucker) [auth-pam.c scard-opensc.c] Tinderbox says auth-pam.c uses | ||
2797 | readpass.h, grep says scard-opensc.c does too. Replace with misc.h. | ||
2798 | - (dtucker) [openbsd-compat/getrrsetbyname.c] Check that HAVE_DECL_H_ERROR | ||
2799 | is defined before using. | ||
2800 | - (dtucker) [openbsd-compat/getrrsetbyname.c] Fix typo too: HAVE_DECL_H_ERROR | ||
2801 | -> HAVE_DECL_H_ERRNO. | ||
2802 | |||
2803 | 20040502 | ||
2804 | - (dtucker) OpenBSD CVS Sync | ||
2805 | - djm@cvs.openbsd.org 2004/04/22 11:56:57 | ||
2806 | [moduli.c] | ||
2807 | Bugzilla #850: Sophie Germain is the correct name of the French | ||
2808 | mathematician, "Sophie Germaine" isn't; from Luc.Maisonobe@c-s.fr | ||
2809 | - djm@cvs.openbsd.org 2004/04/27 09:46:37 | ||
2810 | [readconf.c readconf.h servconf.c servconf.h session.c session.h ssh.c | ||
2811 | ssh_config.5 sshd_config.5] | ||
2812 | bz #815: implement ability to pass specified environment variables from | ||
2813 | the client to the server; ok markus@ | ||
2814 | - djm@cvs.openbsd.org 2004/04/28 05:17:10 | ||
2815 | [ssh_config.5 sshd_config.5] | ||
2816 | manpage fixes in envpass stuff from Brian Poole (raj AT cerias.purdue.edu) | ||
2817 | - jmc@cvs.openbsd.org 2004/04/28 07:02:56 | ||
2818 | [sshd_config.5] | ||
2819 | remove unnecessary .Pp; | ||
2820 | - jmc@cvs.openbsd.org 2004/04/28 07:13:42 | ||
2821 | [sftp.1 ssh.1] | ||
2822 | add SendEnv to -o list; | ||
2823 | - dtucker@cvs.openbsd.org 2004/05/02 11:54:31 | ||
2824 | [sshd.8] | ||
2825 | Man page grammar fix (bz #858), from damerell at chiark.greenend.org.uk | ||
2826 | via Debian; ok djm@ | ||
2827 | - dtucker@cvs.openbsd.org 2004/05/02 11:57:52 | ||
2828 | [ssh.1] | ||
2829 | ConnectionTimeout -> ConnectTimeout, from m.a.ellis at ncl.ac.uk via | ||
2830 | Debian. ok djm@ | ||
2831 | - dtucker@cvs.openbsd.org 2004/05/02 23:02:17 | ||
2832 | [sftp.1] | ||
2833 | ConnectionTimeout -> ConnectTimeout here too, pointed out by jmc@ | ||
2834 | - dtucker@cvs.openbsd.org 2004/05/02 23:17:51 | ||
2835 | [scp.1] | ||
2836 | ConnectionTimeout -> ConnectTimeout for scp.1 too. | ||
2837 | |||
2838 | 20040423 | ||
2839 | - (dtucker) [configure.ac openbsd-compat/getrrsetbyname.c] Declare h_errno | ||
2840 | as extern int if not already declared. Fixes compile errors on old SCO | ||
2841 | platforms. ok tim@ | ||
2842 | - (dtucker) [README.platform] List prereqs for building on Cygwin. | ||
2843 | |||
2844 | 20040421 | ||
2845 | - (djm) Update config.guess and config.sub to autoconf-2.59 versions; ok tim@ | ||
2846 | |||
2847 | 20040420 | ||
2848 | - (djm) OpenBSD CVS Sync | ||
2849 | - henning@cvs.openbsd.org 2004/04/08 16:08:21 | ||
2850 | [sshconnect2.c] | ||
2851 | swap the last two parameters to TAILQ_FOREACH_REVERSE. matches what | ||
2852 | FreeBSD and NetBSD do. | ||
2853 | ok millert@ mcbride@ markus@ ho@, checked to not affect ports by naddy@ | ||
2854 | - djm@cvs.openbsd.org 2004/04/18 23:10:26 | ||
2855 | [readconf.c readconf.h ssh-keysign.c ssh.c] | ||
2856 | perform strict ownership and modes checks for ~/.ssh/config files, | ||
2857 | as these can be used to execute arbitrary programs; ok markus@ | ||
2858 | NB. ssh will now exit when it detects a config with poor permissions | ||
2859 | - djm@cvs.openbsd.org 2004/04/19 13:02:40 | ||
2860 | [ssh.1 ssh_config.5] | ||
2861 | document strict permission checks on ~/.ssh/config; prompted by, | ||
2862 | with & ok jmc@ | ||
2863 | - jmc@cvs.openbsd.org 2004/04/19 16:12:14 | ||
2864 | [ssh_config.5] | ||
2865 | kill whitespace at eol; | ||
2866 | - djm@cvs.openbsd.org 2004/04/19 21:51:49 | ||
2867 | [ssh.c] | ||
2868 | fix idiot typo that i introduced in my last commit; | ||
2869 | spotted by cschneid AT cschneid.com | ||
2870 | - (djm) [openbsd-compat/sys-queue.h] Sync with OpenBSD, needed for | ||
2871 | above change | ||
2872 | - (djm) [configure.ac] Check whether libroken is required when building | ||
2873 | with Heimdal | ||
2874 | |||
2875 | 20040419 | ||
2876 | - (dtucker) OpenBSD CVS Sync | ||
2877 | - dtucker@cvs.openbsd.org 2004/02/29 22:04:45 | ||
2878 | [regress/login-timeout.sh] | ||
2879 | Use sudo when restarting daemon during test. ok markus@ | ||
2880 | - dtucker@cvs.openbsd.org 2004/03/08 10:17:12 | ||
2881 | [regress/login-timeout.sh] | ||
2882 | Missing OBJ, from tim@. ok markus@ (Already fixed, ID sync only) | ||
2883 | - djm@cvs.openbsd.org 2004/03/30 12:41:56 | ||
2884 | [sftp-client.c] | ||
2885 | sync comment with reality | ||
2886 | - djm@cvs.openbsd.org 2004/03/31 21:58:47 | ||
2887 | [canohost.c] | ||
2888 | don't skip ip options check when UseDNS=no; ok markus@ (ID sync only) | ||
2889 | - markus@cvs.openbsd.org 2004/04/01 12:19:57 | ||
2890 | [scp.c] | ||
2891 | limit trust between local and remote rcp/scp process, | ||
2892 | noticed by lcamtuf; ok deraadt@, djm@ | ||
2893 | |||
2894 | 20040418 | ||
2895 | - (dtucker) [auth-pam.c] Log username and source host for failed PAM | ||
2896 | authentication attempts. With & ok djm@ | ||
2897 | - (djm) [openbsd-compat/bsd-cygwin_util.c] Recent versions of Cygwin allow | ||
2898 | change of user context without a password, so relax auth method | ||
2899 | restrictions; from vinschen AT redhat.com; ok dtucker@ | ||
2900 | |||
2901 | 20040416 | ||
2902 | - (dtucker) [regress/sftp-cmds.sh] Skip quoting test on Cygwin, since | ||
2903 | FAT/NTFS does not permit quotes in filenames. From vinschen at redhat.com | ||
2904 | - (djm) [auth-krb5.c auth.h session.c] Explicitly refer to Kerberos ccache | ||
2905 | file using FILE: method, fixes problems on Mac OSX. | ||
2906 | Patch from simon@sxw.org.uk; ok dtucker@ | ||
2907 | - (tim) [configure.ac] Set SETEUID_BREAKS_SETUID, BROKEN_SETREUID and | ||
2908 | BROKEN_SETREGID for SCO OpenServer 3 | ||
2909 | |||
2910 | 20040412 | ||
2911 | - (dtucker) [sshd_config.5] Add PermitRootLogin without-password warning | ||
2912 | from bug #701 (text from jfh at cise.ufl.edu). | ||
2913 | - (dtucker) [acconfig.h configure.ac defines.h] Bug #673: check for 4-arg | ||
2914 | skeychallenge(), eg on NetBSD. ok mouring@ | ||
2915 | - (dtucker) [auth-skey.c defines.h monitor.c] Make skeychallenge explicitly | ||
2916 | 4-arg, with compatibility for 3-arg versions. From djm@, ok me. | ||
2917 | - (djm) [configure.ac] Fix detection of libwrap on OpenBSD; ok dtucker@ | ||
2918 | |||
2919 | 20040408 | ||
2920 | - (dtucker) [loginrec.c] Use UT_LINESIZE if available, prevents truncating | ||
2921 | pty name on Linux 2.6.x systems. Patch from jpe at eisenmenger.org. | ||
2922 | - (bal) [monitor.c monitor_wrap.c] Second try. Put the zlib.h headers | ||
2923 | back and #undef TARGET_OS_MAC instead. (Bug report pending with Apple) | ||
2924 | - (dtucker) [defines.h loginrec.c] Define UT_LINESIZE if not defined and | ||
2925 | simplify loginrec.c. ok tim@ | ||
2926 | - (bal) [monitor.c monitor_wrap.c] Ok.. Last time. Promise. Tim suggested | ||
2927 | limiting scope and dtucker@ agreed. | ||
2928 | |||
2929 | 20040407 | ||
2930 | - (dtucker) [session.c] Flush stdout after displaying loginmsg. From | ||
2931 | f_mohr at yahoo.de. | ||
2932 | - (bal) [acconfig.h auth-krb5.c configure.ac gss-serv-krb5.c] Check to see | ||
2933 | if Krb5 library exports krb5_init_etc() since some OSes (like MacOS/X) | ||
2934 | are starting to restrict it as internal since it is not needed by | ||
2935 | developers any more. (Patch based on Apple tree) | ||
2936 | - (bal) [monitor.c monitor_wrap.c] monitor_wrap.c] moved zlib.h higher since | ||
2937 | krb5 on MacOS/X conflicts. There may be a better solution, but this will | ||
2938 | work for now. | ||
2939 | |||
2940 | 20040406 | ||
2941 | - (dtucker) [acconfig.h configure.ac defines.h] Bug #820: don't use | ||
2942 | updwtmpx() on IRIX since it seems to clobber utmp. ok djm@ | ||
2943 | - (dtucker) [configure.ac] Bug #816, #748 (again): Attempt to detect | ||
2944 | broken getaddrinfo and friends on HP-UX. ok djm@ | ||
2945 | |||
2946 | 20040330 | ||
2947 | - (dtucker) [configure.ac] Bug #811: Use "!" for LOCKED_PASSWD_PREFIX on | ||
2948 | Linuxes, since that's what many use. ok djm@ | ||
2949 | - (dtucker) [auth-pam.c] rename the_authctxt to sshpam_authctxt in auth-pam.c | ||
2950 | to reduce potential confusion with the one in sshd.c. ok djm@ | ||
2951 | - (djm) Bug #825: Fix ip_options_check() for mapped IPv4/IPv6 connection; | ||
2952 | with & ok dtucker@ | ||
2953 | |||
2954 | 20040327 | ||
2955 | - (dtucker) [session.c] Bug #817: Clear loginmsg after fork to prevent | ||
2956 | duplicate login messages for mutli-session logins. ok djm@ | ||
2957 | |||
2958 | 20040322 | ||
2959 | - (djm) [sshd.c] Drop supplemental groups if started as root | ||
2960 | - (djm) OpenBSD CVS Sync | ||
2961 | - markus@cvs.openbsd.org 2004/03/09 22:11:05 | ||
2962 | [ssh.c] | ||
2963 | increase x11 cookie lifetime to 20 minutes; ok djm | ||
2964 | - markus@cvs.openbsd.org 2004/03/10 09:45:06 | ||
2965 | [ssh.c] | ||
2966 | trim usage to match ssh(1) and look more like unix. ok djm@ | ||
2967 | - markus@cvs.openbsd.org 2004/03/11 08:36:26 | ||
2968 | [sshd.c] | ||
2969 | trim usage; ok deraadt | ||
2970 | - markus@cvs.openbsd.org 2004/03/11 10:21:17 | ||
2971 | [ssh.c sshd.c] | ||
2972 | ssh, sshd: sync version output, ok djm | ||
2973 | - markus@cvs.openbsd.org 2004/03/20 10:40:59 | ||
2974 | [version.h] | ||
2975 | 3.8.1 | ||
2976 | - (djm) Crank RPM spec versions | ||
2977 | |||
2978 | 20040311 | ||
2979 | - (djm) [configure.ac] Add standard license to configure.ac; ok ben, dtucker | ||
2980 | |||
2981 | 20040310 | ||
2982 | - (dtucker) [openbsd-compat/fake-rfc2553.h] Bug #812: #undef getaddrinfo | ||
2983 | before redefining it, silences warnings on Tru64. | ||
2984 | |||
2985 | 20040308 | ||
2986 | - (dtucker) [sshd.c] Back out rev 1.270 as it caused problems on some | ||
2987 | platforms (eg SCO, HP-UX) with logging in the wrong TZ. ok djm@ | ||
2988 | - (dtucker) [configure.ac sshd.c openbsd-compat/bsd-misc.h | ||
2989 | openbsd-compat/setenv.c] Unset KRB5CCNAME on AIX to prevent it from being | ||
2990 | inherited by the child. ok djm@ | ||
2991 | - (dtucker) [auth-pam.c auth-pam.h auth1.c auth2.c monitor.c monitor_wrap.c | ||
2992 | monitor_wrap.h] Bug #808: Ensure force_pwchange is correctly initialized | ||
2993 | even if keyboard-interactive is not used by the client. Prevents | ||
2994 | segfaults in some cases where the user's password is expired (note this | ||
2995 | is not considered a security exposure). ok djm@ | ||
2996 | - (djm) OpenBSD CVS Sync | ||
2997 | - markus@cvs.openbsd.org 2004/03/03 06:47:52 | ||
2998 | [sshd.c] | ||
2999 | change proctiltle after accept(2); ok henning, deraadt, djm | ||
3000 | - djm@cvs.openbsd.org 2004/03/03 09:30:42 | ||
3001 | [sftp-client.c] | ||
3002 | Don't print duplicate messages when progressmeter is off | ||
3003 | Spotted by job317 AT mailvault.com; ok markus@ | ||
3004 | - djm@cvs.openbsd.org 2004/03/03 09:31:20 | ||
3005 | [sftp.c] | ||
3006 | Fix initialisation of progress meter; ok markus@ | ||
3007 | - markus@cvs.openbsd.org 2004/03/05 10:53:58 | ||
3008 | [readconf.c readconf.h scp.1 sftp.1 ssh.1 ssh_config.5 sshconnect2.c] | ||
3009 | add IdentitiesOnly; ok djm@, pb@ | ||
3010 | - djm@cvs.openbsd.org 2004/03/08 09:38:05 | ||
3011 | [ssh-keyscan.c] | ||
3012 | explicitly initialise remote_major and remote_minor. | ||
3013 | from cjwatson AT debian.org; ok markus@ | ||
3014 | - dtucker@cvs.openbsd.org 2004/03/08 10:18:57 | ||
3015 | [sshd_config.5] | ||
3016 | Document KerberosGetAFSToken; ok markus@ | ||
3017 | - (tim) [regress/README.regress] Document ssh-rand-helper issue. ok bal | ||
3018 | |||
3019 | 20040307 | ||
3020 | - (tim) [regress/login-timeout.sh] fix building outside of source tree. | ||
3021 | |||
3022 | 20040304 | ||
3023 | - (dtucker) [auth-pam.c] Don't try to export PAM when compiled with | ||
3024 | -DUSE_POSIX_THREADS. From antoine.verheijen at ualbert ca. ok djm@ | ||
3025 | - (dtucker) [auth-pam.c] Reset signal status when starting pam auth thread, | ||
3026 | prevent hanging during PAM keyboard-interactive authentications. ok djm@ | ||
3027 | - (dtucker) [auth-passwd.c auth-sia.c auth-sia.h defines.h | ||
3028 | openbsd-compat/xcrypt.c] Bug #802: Fix build error on Tru64 when | ||
3029 | configured --with-osfsia. ok djm@ | ||
3030 | |||
3031 | 20040303 | ||
3032 | - (djm) [configure.ac ssh-agent.c] Use prctl to prevent ptrace on ssh-agent | ||
3033 | ok dtucker | ||
3034 | |||
3035 | 20040229 | ||
3036 | - (tim) [configure.ac] Put back bits mistakenly removed from Rev 1.188 | ||
3037 | |||
3038 | 20040229 | ||
3039 | - (dtucker) OpenBSD CVS Sync | ||
3040 | - djm@cvs.openbsd.org 2004/02/25 00:22:45 | ||
3041 | [sshd.c] | ||
3042 | typo in comment | ||
3043 | - dtucker@cvs.openbsd.org 2004/02/27 22:42:47 | ||
3044 | [dh.c] | ||
3045 | Prevent sshd from sending DH groups with a primitive generator of zero or | ||
3046 | one, even if they are listed in /etc/moduli. ok markus@ | ||
3047 | - dtucker@cvs.openbsd.org 2004/02/27 22:44:56 | ||
3048 | [dh.c] | ||
3049 | Make /etc/moduli line buffer big enough for 8kbit primes, in case anyone | ||
3050 | ever uses one. ok markus@ | ||
3051 | - dtucker@cvs.openbsd.org 2004/02/27 22:49:27 | ||
3052 | [dh.c] | ||
3053 | Reset bit counter at the right time, fixes debug output in the case where | ||
3054 | the DH group is rejected. ok markus@ | ||
3055 | - dtucker@cvs.openbsd.org 2004/02/17 08:23:20 | ||
3056 | [regress/Makefile regress/login-timeout.sh] | ||
3057 | Add regression test for LoginGraceTime; ok markus@ | ||
3058 | - markus@cvs.openbsd.org 2004/02/24 16:56:30 | ||
3059 | [regress/test-exec.sh] | ||
3060 | allow arguments in ${TEST_SSH_XXX} | ||
3061 | - markus@cvs.openbsd.org 2004/02/24 17:06:52 | ||
3062 | [regress/ssh-com-client.sh regress/ssh-com-keygen.sh | ||
3063 | regress/ssh-com-sftp.sh regress/ssh-com.sh] | ||
3064 | test against recent ssh.com releases | ||
3065 | - dtucker@cvs.openbsd.org 2004/02/28 12:16:57 | ||
3066 | [regress/dynamic-forward.sh] | ||
3067 | Make dynamic-forward understand nc's new output. ok markus@ | ||
3068 | - dtucker@cvs.openbsd.org 2004/02/28 13:44:45 | ||
3069 | [regress/try-ciphers.sh] | ||
3070 | Test acss too; ok markus@ | ||
3071 | - (dtucker) [regress/try-ciphers.sh] Skip acss if not compiled in (eg if we | ||
3072 | built with openssl < 0.9.7) | ||
3073 | |||
3074 | 20040226 | ||
3075 | - (bal) KNF our sshlogin.c even if the code looks nothing like upstream | ||
3076 | code due to diversity issues. | ||
3077 | |||
3078 | 20040225 | ||
3079 | - (djm) Trim ChangeLog | ||
3080 | - (djm) Don't specify path to PAM modules in Redhat sshd.pam; from Fedora | ||
3081 | |||
3082 | 20040224 | ||
3083 | - (dtucker) OpenBSD CVS Sync | ||
3084 | - markus@cvs.openbsd.org 2004/02/19 21:15:04 | ||
3085 | [sftp-server.c] | ||
3086 | switch to new license.template | ||
3087 | - markus@cvs.openbsd.org 2004/02/23 12:02:33 | ||
3088 | [sshd.c] | ||
3089 | backout revision 1.279; set listen socket to non-block; ok henning. | ||
3090 | - markus@cvs.openbsd.org 2004/02/23 15:12:46 | ||
3091 | [bufaux.c] | ||
3092 | encode 0 correctly in buffer_put_bignum2; noted by Mikulas Patocka | ||
3093 | and drop support for negative BNs; ok otto@ | ||
3094 | - markus@cvs.openbsd.org 2004/02/23 15:16:46 | ||
3095 | [version.h] | ||
3096 | enter 3.8 | ||
3097 | - (dtucker) [configure.ac gss-serv-krb5.c ssh-gss.h] Define GSSAPI when found | ||
3098 | with krb5-config, hunt down gssapi.h and friends. Based partially on patch | ||
3099 | from deengert at anl.gov. ok djm@ | ||
3100 | - (djm) [groupaccess.c uidswap.c] Bug #787: Size group arrays at runtime | ||
3101 | using sysconf() if available Based on patches from | ||
3102 | holger AT van-lengerich.de and openssh_bugzilla AT hockin.org | ||
3103 | - (dtucker) [uidswap.c] Minor KNF. ok djm@ | ||
3104 | - (tim) [openbsd-compat/getrrsetbyname.c] Make gcc 2.7.2.3 happy. ok djm@ | ||
3105 | - (djm) Crank RPM spec versions | ||
3106 | - (dtucker) [README] Add pointer to release notes. ok djm@ | ||
3107 | - (dtucker) {README.platform] Add platform-specific notes. | ||
3108 | - (tim) [configure.ac] SCO3 needs -lcrypt_i for -lprot | ||
3109 | - (djm) Release 3.8p1 | ||
3110 | |||
3111 | 20040223 | ||
3112 | - (dtucker) [session.c] Bug #789: Only make setcred call for !privsep in the | ||
3113 | non-interactive path. ok djm@ | ||
3114 | |||
3115 | 20040222 | ||
3116 | - (dtucker) [auth-shadow.c auth.c auth.h] Move shadow account expiry test | ||
3117 | to auth-shadow.c, no functional change. ok djm@ | ||
3118 | - (dtucker) [auth-shadow.c auth.h] Provide warnings of impending account or | ||
3119 | password expiry. ok djm@ | ||
3120 | - (dtucker) [auth-passwd.c] Only check password expiry once. Prevents | ||
3121 | multiple warnings if a wrong password is entered. | ||
3122 | - (dtucker) [configure.ac] Apply krb5-config --libs fix to non-gssapi path | ||
3123 | too. | ||
3124 | |||
3125 | 20040220 | ||
3126 | - (djm) [openbsd-compat/setproctitle.c] fix comments; from grange@ | ||
3127 | |||
3128 | 20040218 | ||
3129 | - (dtucker) [configure.ac] Handle case where krb5-config --libs returns a | ||
3130 | path with a "-" in it. From Sergio.Gelato at astro.su.se. | ||
3131 | - (djm) OpenBSD CVS Sync | ||
3132 | - djm@cvs.openbsd.org 2004/02/17 07:17:29 | ||
3133 | [sftp-glob.c sftp.c] | ||
3134 | Remove useless headers; ok deraadt@ | ||
3135 | - djm@cvs.openbsd.org 2004/02/17 11:03:08 | ||
3136 | [sftp.c] | ||
3137 | sftp.c and sftp-int.c, together at last; ok markus@ | ||
3138 | - jmc@cvs.openbsd.org 2004/02/17 19:35:21 | ||
3139 | [sshd_config.5] | ||
3140 | remove cruft left over from RhostsAuthentication removal; | ||
3141 | ok markus@ | ||
3142 | - (djm) [log.c] Correct use of HAVE_OPENLOG_R | ||
3143 | - (djm) [log.c] Tighten openlog_r tests | ||
3144 | |||
3145 | 20040217 | ||
3146 | - (djm) Simplify the license on code I have written. No code changes. | ||
3147 | - (djm) OpenBSD CVS Sync | ||
3148 | - djm@cvs.openbsd.org 2004/02/17 05:39:51 | ||
3149 | [sftp-client.c sftp-client.h sftp-glob.c sftp-glob.h sftp-int.c] | ||
3150 | [sftp-int.h sftp.c] | ||
3151 | switch to license.template for code written by me (belated, I know...) | ||
3152 | - (djm) Bug #698: Specify FILE: for KRB5CCNAME; patch from | ||
3153 | stadal@suse.cz and simon@sxw.org.uk | ||
3154 | - (dtucker) [auth-pam.c] Tidy up PAM debugging. ok djm@ | ||
3155 | - (dtucker) [auth-pam.c] Store output from pam_session and pam_setcred for | ||
3156 | display after login. Should fix problems like pam_motd not displaying | ||
3157 | anything, noticed by cjwatson at debian.org. ok djm@ | ||
3158 | |||
3159 | 20040212 | ||
3160 | - (tim) [Makefile.in regress/sftp-badcmds.sh regress/test-exec.sh] | ||
3161 | Portablity fixes. Data sftp transfers needs to be world readable. Some | ||
3162 | older shells hang on while loops when doing sh -n some_script. OK dtucker@ | ||
3163 | - (tim) [configure.ac] Make sure -lcrypto is before -lsocket for sco3. | ||
3164 | ok mouring@ | ||
3165 | |||
3166 | 20040211 | ||
3167 | - (dtucker) [auth-passwd.c auth-shadow.c] Only enable shadow expiry check | ||
3168 | if HAS_SHADOW_EXPIRY is set. | ||
3169 | - (tim) [configure.ac] Fix comment to match code changes in ver 1.117 | ||
3170 | |||
3171 | 20040210 | ||
3172 | - (dtucker) [auth-passwd.c auth.h openbsd-compat/port-aix.c | ||
3173 | openbsd-compat/port-aix.h] Bug #14: Use do_pwchange to support AIX's | ||
3174 | native password expiry. | ||
3175 | - (dtucker) [LICENCE Makefile.in auth-passwd.c auth-shadow.c auth.c auth.h | ||
3176 | defines.h] Bug #14: Use do_pwchange to support password expiry and force | ||
3177 | change for platforms using /etc/shadow. ok djm@ | ||
3178 | - (dtucker) [openbsd-compat/fake-rfc2553.h] Bug #563: Prepend ssh_ to compat | ||
3179 | functions to avoid conflicts with Heimdal's libroken. ok djm@ | ||
3180 | - (dtucker) [auth-pam.c auth-pam.h session.c] Bug #14: Use do_pwchange to | ||
3181 | change expired PAM passwords for SSHv1 connections without privsep. | ||
3182 | pam_chauthtok is still used when privsep is disabled. ok djm@ | ||
3183 | - (dtucker) [openbsd-compat/port-aix.c openbsd-compat/port-aix.h] Move | ||
3184 | include from port-aix.h to port-aix.c and remove unnecessary function | ||
3185 | definition. Fixes build errors on AIX. | ||
3186 | - (dtucker) [configure.ac loginrec.c] Bug #464: Use updwtmpx on platforms | ||
3187 | that support it. from & ok mouring@ | ||
3188 | - (dtucker) [configure.ac] Bug #345: Do not disable utmp on HP-UX 10.x. | ||
3189 | ok djm@ | ||
3190 | |||
3191 | 20040207 | ||
3192 | - (dtucker) OpenBSD CVS Sync | ||
3193 | - dtucker@cvs.openbsd.org 2004/02/06 23:41:13 | ||
3194 | [cipher-ctr.c] | ||
3195 | Use EVP_CIPHER_CTX_key_length for key length. ok markus@ | ||
3196 | (This will fix builds with OpenSSL 0.9.5) | ||
3197 | - (dtucker) [cipher.c] enable AES counter modes with OpenSSL 0.9.5. | ||
3198 | ok djm@, markus@ | ||
3199 | |||
3200 | 20040206 | ||
3201 | - (dtucker) [acss.c acss.h] Fix $Id tags. | ||
3202 | - (dtucker) [cipher-acss.c cipher.c] Enable acss only if building with | ||
3203 | OpenSSL >= 0.9.7. ok djm@ | ||
3204 | - (dtucker) [session.c] Bug #789: Do not call do_pam_setcred as a non-root | ||
3205 | user, since some modules might fail due to lack of privilege. ok djm@ | ||
3206 | - (dtucker) [configure.ac] Bug #748: Always define BROKEN_GETADDRINFO | ||
3207 | for HP-UX 11.11. If there are known-good configs where this is not | ||
3208 | required, please report them. ok djm@ | ||
3209 | - (dtucker) [sshd.c] Bug #757: Clear child's environment to prevent | ||
3210 | accidentally inheriting from root's environment. ok djm@ | ||
3211 | - (dtucker) [openbsd-compat/port-aix.c openbsd-compat/port-aix.h] Bug #796: | ||
3212 | Restore previous authdb setting after auth calls. Fixes problems with | ||
3213 | setpcred failing on accounts that use AFS or NIS password registries. | ||
3214 | - (dtucker) [configure.ac includes.h] Include <sys/stream.h> if present, | ||
3215 | required on Solaris 2.5.1 for queue_t, which is used by <sys/ptms.h>. | ||
3216 | - (dtucker) OpenBSD CVS Sync | ||
3217 | - markus@cvs.openbsd.org 2004/01/30 09:48:57 | ||
3218 | [auth-passwd.c auth.h pathnames.h session.c] | ||
3219 | support for password change; ok dtucker@ | ||
3220 | (set password-dead=1w in login.conf to use this). | ||
3221 | In -Portable, this is currently only platforms using bsdauth. | ||
3222 | - dtucker@cvs.openbsd.org 2004/02/05 05:37:17 | ||
3223 | [monitor.c sshd.c] | ||
3224 | Pass SIGALRM through to privsep child if LoginGraceTime expires. ok markus@ | ||
3225 | - markus@cvs.openbsd.org 2004/02/05 15:33:33 | ||
3226 | [progressmeter.c] | ||
3227 | fix ETA for > 4GB; bugzilla #791; ok henning@ deraadt@ | ||
3228 | |||
3229 | 20040129 | ||
3230 | - (dtucker) OpenBSD CVS Sync regress/ | ||
3231 | - dtucker@cvs.openbsd.org 2003/10/11 11:49:49 | ||
3232 | [Makefile banner.sh] | ||
3233 | Test missing banner file, suppression of banner with ssh -q, check return | ||
3234 | code from ssh. ok markus@ | ||
3235 | - jmc@cvs.openbsd.org 2003/11/07 10:16:44 | ||
3236 | [ssh-com.sh] | ||
3237 | adress -> address, and a few more; all from Jonathon Gray; | ||
3238 | - djm@cvs.openbsd.org 2004/01/13 09:49:06 | ||
3239 | [sftp-batch.sh] | ||
3240 | - (dtucker) [configure.ac] Add --without-zlib-version-check. Feedback from | ||
3241 | tim@, ok several | ||
3242 | - (dtucker) [configure.ac openbsd-compat/bsd-cray.c openbsd-compat/bsd-cray.h] | ||
3243 | Bug #775: Cray fixes from wendy at cray.com | ||
3244 | |||
3245 | 20040128 | ||
3246 | - (dtucker) [regress/README.regress] Add tcpwrappers issue, noted by tim@ | ||
3247 | - (dtucker) [moduli] Import new moduli file from OpenBSD. | ||
3248 | |||
3249 | 20040127 | ||
3250 | - (djm) OpenBSD CVS Sync | ||
3251 | - hshoexer@cvs.openbsd.org 2004/01/23 17:06:03 | ||
3252 | [cipher.c] | ||
3253 | enable acss for ssh | ||
3254 | ok deraadt@ markus@ | ||
3255 | - mouring@cvs.openbsd.org 2004/01/23 17:57:48 | ||
3256 | [sftp-int.c] | ||
3257 | Fix issue pointed out with ls not handling large directories | ||
3258 | with embeded paths correctly. OK damien@ | ||
3259 | - hshoexer@cvs.openbsd.org 2004/01/23 19:26:33 | ||
3260 | [cipher.c] | ||
3261 | rename acss@opebsd.org to acss@openssh.org | ||
3262 | ok deraadt@ | ||
3263 | - djm@cvs.openbsd.org 2004/01/25 03:49:09 | ||
3264 | [sshconnect.c] | ||
3265 | reset nonblocking flag after ConnectTimeout > 0 connect; (bugzilla #785) | ||
3266 | from jclonguet AT free.fr; ok millert@ | ||
3267 | - djm@cvs.openbsd.org 2004/01/27 10:08:10 | ||
3268 | [sftp.c] | ||
3269 | reorder parsing so user:skey@host:file works (bugzilla #777) | ||
3270 | patch from admorten AT umich.edu; ok markus@ | ||
3271 | - (djm) [acss.c acss.h cipher-acss.c] Portable support for ACSS | ||
3272 | if libcrypto lacks it | ||
3273 | |||
3274 | 20040126 | ||
3275 | - (tim) Typo in regress/README.regress | ||
3276 | - (tim) [regress/test-exec.sh] RhostsAuthentication is deprecated. | ||
3277 | - (tim) [defines.h] Add defines for HFIXEDSZ and T_SIG | ||
3278 | - (tim) [configure.ac includes.h] add <sys/ptms.h> for grantpt() and friends. | ||
3279 | - (tim) [defines.h openbsd-compat/getrrsetbyname.h] Move defines for HFIXEDSZ | ||
3280 | and T_SIG to getrrsetbyname.h | ||
3281 | |||
3282 | 20040124 | ||
3283 | - (djm) Typo in openbsd-compat/bsd-openpty.c; from wendyp AT cray.com | ||
3284 | |||
3285 | 20040123 | ||
3286 | - (djm) Do pam_session processing for systems with HAVE_LOGIN_CAP; from | ||
3287 | ralf.hack AT pipex.net; ok dtucker@ | ||
3288 | - (djm) Bug #776: Update contrib/redhat/openssh.spec to dynamically detect | ||
3289 | Kerberos location (and thus work with Fedora Core 1); | ||
3290 | from jason AT devrandom.org | ||
3291 | - (dtucker) [configure.ac] Bug #788: Test for zlib.h presence and for | ||
3292 | zlib >= 1.1.4. Partly from jbasney at ncsa.uiuc.edu. ok djm@ | ||
3293 | - (dtucker) [contrib/cygwin/README] Document new ssh-host-config options. | ||
3294 | Patch from vinschen at redhat.com. | ||
3295 | - (dtucker) [acconfig.h configure.ac includes.h servconf.c session.c] | ||
3296 | Change AFS symbol to USE_AFS to prevent namespace collisions, do not | ||
3297 | include kafs.h unless necessary. From deengert at anl.gov. | ||
3298 | - (tim) [configure.ac] Remove hard coded -L/usr/local/lib and | ||
3299 | -I/usr/local/include. Users can do LDFLAGS="-L/usr/local/lib" \ | ||
3300 | CPPFLAGS="-I/usr/local/include" ./configure if needed. | ||
3301 | |||
3302 | 20040122 | ||
3303 | - (dtucker) [configure.ac] Use krb5-config where available for Kerberos/ | ||
3304 | GSSAPI detection, libs and includes. ok djm@ | ||
3305 | - (dtucker) [session.c] Enable AFS support in conjunction with KRB5 not | ||
3306 | just HEIMDAL. | ||
3307 | - (tim) [contrib/solaris/buildpkg.sh] Allow for the possibility of | ||
3308 | /usr/local being a symbolic link. Fixes problem reported by Henry Grebler. | ||
3309 | |||
3310 | 20040121 | ||
3311 | - (djm) OpenBSD CVS Sync | ||
3312 | - djm@cvs.openbsd.org 2004/01/13 09:25:05 | ||
3313 | [sftp-int.c sftp.1 sftp.c] | ||
3314 | Tidy sftp batchmode handling, eliminate junk to stderr (bugzilla #754) and | ||
3315 | enable use of "-b -" to accept batchfile from stdin; ok markus@ | ||
3316 | - jmc@cvs.openbsd.org 2004/01/13 12:17:33 | ||
3317 | [sftp.1] | ||
3318 | remove unnecessary Ic's; | ||
3319 | kill whitespace at EOL; | ||
3320 | ok djm@ | ||
3321 | - markus@cvs.openbsd.org 2004/01/13 19:23:15 | ||
3322 | [compress.c session.c] | ||
3323 | -Wall; ok henning | ||
3324 | - markus@cvs.openbsd.org 2004/01/13 19:45:15 | ||
3325 | [compress.c] | ||
3326 | cast for portability; millert@ | ||
3327 | - markus@cvs.openbsd.org 2004/01/19 09:24:21 | ||
3328 | [channels.c] | ||
3329 | fake consumption for half closed channels since the peer is waiting for | ||
3330 | window adjust messages; bugzilla #790 Matthew Dillon; test + ok dtucker@ | ||
3331 | reproduce with sh -c 'ulimit -f 10; ssh host -n od /bsd | cat > foo' | ||
3332 | - markus@cvs.openbsd.org 2004/01/19 21:25:15 | ||
3333 | [auth2-hostbased.c auth2-pubkey.c serverloop.c ssh-keysign.c sshconnect2.c] | ||
3334 | fix mem leaks; some fixes from Pete Flugstad; tested dtucker@ | ||
3335 | - djm@cvs.openbsd.org 2004/01/21 03:07:59 | ||
3336 | [sftp.c] | ||
3337 | initialise infile in main, rather than statically - from portable | ||
3338 | - deraadt@cvs.openbsd.org 2004/01/11 21:55:06 | ||
3339 | [sshpty.c] | ||
3340 | for pty opening, only use the openpty() path. the other stuff only needs | ||
3341 | to be in openssh-p; markus ok | ||
3342 | - (djm) [openbsd-compat/bsd-openpty.c] Rework old sshpty.c code into an | ||
3343 | openpty() replacement | ||
3344 | |||
3345 | 20040114 | ||
3346 | - (dtucker) [auth-pam.c] Have monitor die if PAM authentication thread exits | ||
3347 | unexpectedly. with & ok djm@ | ||
3348 | - (dtucker) [auth-pam.c] Reset signal handler in pthread_cancel too, add | ||
3349 | test for case where cleanup has already run. | ||
3350 | - (dtucker) [auth-pam.c] Add minor debugging. | ||
3351 | |||
3352 | 20040113 | ||
3353 | - (dtucker) [auth-pam.c] Relocate struct pam_ctxt and prototypes. No | ||
3354 | functional changes. | ||
3355 | |||
3356 | 20040108 | ||
3357 | - (dtucker) [auth-pam.c defines.h] Bug #783: move __unused to defines.h and | ||
3358 | only define if not already. From des at freebsd.org. | ||
3359 | - (dtucker) [configure.ac] Remove extra (typo) comma. | ||
3360 | |||
3361 | 20040105 | ||
3362 | - (dtucker) [contrib/ssh-copy-id] Bug #781: exit if ssh fails. Patch from | ||
3363 | cjwatson at debian.org. | ||
3364 | - (dtucker) [acconfig.h configure.ac includes.h servconf.c session.c] | ||
3365 | Only enable KerberosGetAFSToken if Heimdal's libkafs is found. with jakob@ | ||
3366 | |||
3367 | 20040102 | ||
3368 | - (djm) OSX/Darwin needs BIND_8_COMPAT to build getrrsetbyname. Report from | ||
3369 | jakob@ | ||
3370 | - (djm) Remove useless DNS support configure summary message. from jakob@ | ||
3371 | - (djm) OSX/Darwin put the PAM headers in a different place, detect this. | ||
3372 | Report from jakob@ | ||
3373 | |||
3374 | 20031231 | ||
3375 | - (dtucker) OpenBSD CVS Sync | ||
3376 | - djm@cvs.openbsd.org 2003/12/22 09:16:58 | ||
3377 | [moduli.c ssh-keygen.1 ssh-keygen.c] | ||
3378 | tidy up moduli generation debugging, add -v (verbose/debug) option to | ||
3379 | ssh-keygen; ok markus@ | ||
3380 | - markus@cvs.openbsd.org 2003/12/22 20:29:55 | ||
3381 | [cipher-3des1.c] | ||
3382 | EVP_CIPHER_CTX_cleanup() for the des contexts; pruiksma@freesurf.fr | ||
3383 | - jakob@cvs.openbsd.org 2003/12/23 16:12:10 | ||
3384 | [servconf.c servconf.h session.c sshd_config] | ||
3385 | implement KerberosGetAFSToken server option. ok markus@, beck@ | ||
3386 | - millert@cvs.openbsd.org 2003/12/29 16:39:50 | ||
3387 | [sshd_config] | ||
3388 | KeepAlive has been obsoleted, use TCPKeepAlive instead; markus@ OK | ||
3389 | - dtucker@cvs.openbsd.org 2003/12/31 00:24:50 | ||
3390 | [auth2-passwd.c] | ||
3391 | Ignore password change request during password auth (which we currently | ||
3392 | don't support) and discard proposed new password. corrections/ok markus@ | ||
3393 | - (dtucker) [configure.ac] Only test setresuid and setresgid if they exist. | ||
3394 | |||
3395 | 20031219 | ||
3396 | - (dtucker) [defines.h] Bug #458: Define SIZE_T_MAX as UINT_MAX if we | ||
3397 | typedef size_t ourselves. | ||
3398 | |||
3399 | 20031218 | ||
3400 | - (dtucker) [configure.ac] Don't use setre[ug]id on DG-UX, from Tom Orban. | ||
3401 | - (dtucker) [auth-pam.c] Do PAM chauthtok during SSH2 keyboard-interactive | ||
3402 | authentication. Partially fixes bug #423. Feedback & ok djm@ | ||
3403 | |||
3404 | 20031217 | ||
3405 | - (djm) OpenBSD CVS Sync | ||
3406 | - markus@cvs.openbsd.org 2003/12/09 15:28:43 | ||
3407 | [serverloop.c] | ||
3408 | make ClientKeepAlive work for ssh -N, too (no login shell requested). | ||
3409 | 1) send a bogus channel request if we find a channel | ||
3410 | 2) send a bogus global request if we don't have a channel | ||
3411 | ok + test beck@ | ||
3412 | - markus@cvs.openbsd.org 2003/12/09 17:29:04 | ||
3413 | [sshd.c] | ||
3414 | fix -o and HUP; ok henning@ | ||
3415 | - markus@cvs.openbsd.org 2003/12/09 17:30:05 | ||
3416 | [ssh.c] | ||
3417 | don't modify argv for ssh -o; similar to sshd.c 1.283 | ||
3418 | - markus@cvs.openbsd.org 2003/12/09 21:53:37 | ||
3419 | [readconf.c readconf.h scp.1 servconf.c servconf.h sftp.1 ssh.1] | ||
3420 | [ssh_config.5 sshconnect.c sshd.c sshd_config.5] | ||
3421 | rename keepalive to tcpkeepalive; the old name causes too much | ||
3422 | confusion; ok djm, dtucker; with help from jmc@ | ||
3423 | - dtucker@cvs.openbsd.org 2003/12/09 23:45:32 | ||
3424 | [clientloop.c] | ||
3425 | Clear exit code when ssh -N is terminated with a SIGTERM. ok markus@ | ||
3426 | - markus@cvs.openbsd.org 2003/12/14 12:37:21 | ||
3427 | [ssh_config.5] | ||
3428 | we don't support GSS KEX; from Simon Wilkinson | ||
3429 | - markus@cvs.openbsd.org 2003/12/16 15:49:51 | ||
3430 | [clientloop.c clientloop.h readconf.c readconf.h scp.1 sftp.1 ssh.1] | ||
3431 | [ssh.c ssh_config.5] | ||
3432 | application layer keep alive (ServerAliveInterval ServerAliveCountMax) | ||
3433 | for ssh(1), similar to the sshd(8) option; ok beck@; with help from | ||
3434 | jmc and dtucker@ | ||
3435 | - markus@cvs.openbsd.org 2003/12/16 15:51:54 | ||
3436 | [dh.c] | ||
3437 | use <= instead of < in dh_estimate; ok provos/hshoexer; | ||
3438 | do not return < DH_GRP_MIN | ||
3439 | - (dtucker) [acconfig.h configure.ac uidswap.c] Bug #645: Check for | ||
3440 | setres[ug]id() present but not implemented (eg some Linux/glibc | ||
3441 | combinations). | ||
3442 | - (bal) [openbsd-compat/bsd-misc.c] unset 'signal' defined if we are | ||
3443 | using a real 'signal()' (Noticed by a NeXT Compile) | ||
3444 | |||
3445 | 20031209 | ||
3446 | - (dtucker) OpenBSD CVS Sync | ||
3447 | - matthieu@cvs.openbsd.org 2003/11/25 23:10:08 | ||
3448 | [ssh-add.1] | ||
3449 | ssh-add doesn't need to be a descendant of ssh-agent. Ok markus@, jmc@. | ||
3450 | - djm@cvs.openbsd.org 2003/11/26 21:44:29 | ||
3451 | [cipher-aes.c] | ||
3452 | fix #ifdef before #define; ok markus@ | ||
3453 | (RCS ID sync only, Portable already had this) | ||
3454 | - markus@cvs.openbsd.org 2003/12/02 12:15:10 | ||
3455 | [progressmeter.c] | ||
3456 | improvments from andreas@: | ||
3457 | * saner speed estimate for transfers that takes less than a second by | ||
3458 | rounding the time to 1 second. | ||
3459 | * when the transfer is finished calculate the actual total speed | ||
3460 | rather than the current speed which is given during the transfer | ||
3461 | - markus@cvs.openbsd.org 2003/12/02 17:01:15 | ||
3462 | [channels.c session.c ssh-agent.c ssh.h sshd.c] | ||
3463 | use SSH_LISTEN_BACKLOG (=128) in listen(2). | ||
3464 | - djm@cvs.openbsd.org 2003/12/07 06:34:18 | ||
3465 | [moduli.c] | ||
3466 | remove unused debugging #define templates | ||
3467 | - markus@cvs.openbsd.org 2003/12/08 11:00:47 | ||
3468 | [kexgexc.c] | ||
3469 | print requested group size in debug; ok djm | ||
3470 | - dtucker@cvs.openbsd.org 2003/12/09 13:52:55 | ||
3471 | [moduli.c] | ||
3472 | Prevent ssh-keygen -T from outputting moduli with a generator of 0, since | ||
3473 | they can't be used for Diffie-Hellman. Assistance and ok djm@ | ||
3474 | - (dtucker) [ssh-keyscan.c] Sync RCSIDs, missed in SSH_SSFDMAX change below. | ||
3475 | |||
3476 | 20031208 | ||
3477 | - (tim) [configure.ac] Bug 770. Fix --without-rpath. | ||
3478 | |||
3479 | 20031123 | ||
3480 | - (djm) [canohost.c] Move IPv4inV6 mapped address normalisation to its own | ||
3481 | function and call it unconditionally | ||
3482 | - (djm) OpenBSD CVS Sync | ||
3483 | - djm@cvs.openbsd.org 2003/11/23 23:17:34 | ||
3484 | [ssh-keyscan.c] | ||
3485 | from portable - use sysconf to detect fd limit; ok markus@ | ||
3486 | (tidy diff by adding SSH_SSFDMAX macro to defines.h) | ||
3487 | - djm@cvs.openbsd.org 2003/11/23 23:18:45 | ||
3488 | [ssh-keygen.c] | ||
3489 | consistency PATH_MAX -> MAXPATHLEN; ok markus@ | ||
3490 | (RCS ID sync only) | ||
3491 | - djm@cvs.openbsd.org 2003/11/23 23:21:21 | ||
3492 | [scp.c] | ||
3493 | from portable: rename clashing variable limit-> limit_rate; ok markus@ | ||
3494 | (RCS ID sync only) | ||
3495 | - dtucker@cvs.openbsd.org 2003/11/24 00:16:35 | ||
3496 | [ssh.1 ssh.c] | ||
3497 | Make ssh -k mean GSSAPIDelegateCredentials=no. Suggestion & ok markus@ | ||
3498 | - (djm) Annotate OpenBSD-derived files in openbsd-compat/ with original | ||
3499 | source file path (in OpenBSD tree). | ||
3500 | |||
3501 | 20031122 | ||
3502 | - (dtucker) [channels.c] Make AIX write limit code clearer. Suggested by djm@ | ||
3503 | - (dtucker) [auth-passwd.c openbsd-compat/port-aix.c openbsd-compat/port-aix.h] | ||
3504 | Move AIX specific password authentication code to port-aix.c, call | ||
3505 | authenticate() until reenter flag is clear. | ||
3506 | - (dtucker) [auth-sia.c configure.ac] Tru64 update from cmadams at hiwaay.net. | ||
3507 | Use permanently_set_uid for SIA, only define DISABLE_FD_PASSING when SIA | ||
3508 | is enabled, rely on SIA to check for locked accounts if enabled. ok djm@ | ||
3509 | - (djm) [scp.c] Rename limitbw -> limit_rate to match upstreamed patch | ||
3510 | - (djm) [sftp-int.c] Remove duplicated code from bogus sync | ||
3511 | - (djm) [packet.c] Shuffle #ifdef to reduce conditionally compiled code | ||
3512 | |||
3513 | 20031121 | ||
3514 | - (djm) OpenBSD CVS Sync | ||
3515 | - markus@cvs.openbsd.org 2003/11/20 11:39:28 | ||
3516 | [progressmeter.c] | ||
3517 | fix rounding errors; from andreas@ | ||
3518 | - djm@cvs.openbsd.org 2003/11/21 11:57:03 | ||
3519 | [everything] | ||
3520 | unexpand and delete whitespace at EOL; ok markus@ | ||
3521 | (done locally and RCS IDs synced) | ||
3522 | |||
3523 | 20031118 | ||
3524 | - (djm) Fix early exit for root auth success when UsePAM=yes and | ||
3525 | PermitRootLogin=no | ||
3526 | - (dtucker) [auth-pam.c] Convert chauthtok_conv into a generic tty_conv, | ||
3527 | and use it for do_pam_session. Fixes problems like pam_motd not | ||
3528 | displaying anything. ok djm@ | ||
3529 | - (dtucker) [auth-pam.c] Only use pam_putenv if our platform has it. ok djm@ | ||
3530 | - (djm) OpenBSD CVS Sync | ||
3531 | - dtucker@cvs.openbsd.org 2003/11/18 00:40:05 | ||
3532 | [serverloop.c] | ||
3533 | Correct check for authctxt->valid. ok djm@ | ||
3534 | - djm@cvs.openbsd.org 2003/11/18 10:53:07 | ||
3535 | [monitor.c] | ||
3536 | unbreak fake authloop for non-existent users (my screwup). Spotted and | ||
3537 | tested by dtucker@; ok markus@ | ||
3538 | |||
3539 | 20031117 | ||
3540 | - (djm) OpenBSD CVS Sync | ||
3541 | - djm@cvs.openbsd.org 2003/11/03 09:03:37 | ||
3542 | [auth-chall.c] | ||
3543 | make this a little more idiot-proof; ok markus@ | ||
3544 | (includes portable-specific changes) | ||
3545 | - jakob@cvs.openbsd.org 2003/11/03 09:09:41 | ||
3546 | [sshconnect.c] | ||
3547 | move changed key warning into warn_changed_key(). ok markus@ | ||
3548 | - jakob@cvs.openbsd.org 2003/11/03 09:37:32 | ||
3549 | [sshconnect.c] | ||
3550 | do not free static type pointer in warn_changed_key() | ||
3551 | - djm@cvs.openbsd.org 2003/11/04 08:54:09 | ||
3552 | [auth1.c auth2.c auth2-pubkey.c auth.h auth-krb5.c auth-passwd.c] | ||
3553 | [auth-rhosts.c auth-rh-rsa.c auth-rsa.c monitor.c serverloop.c] | ||
3554 | [session.c] | ||
3555 | standardise arguments to auth methods - they should all take authctxt. | ||
3556 | check authctxt->valid rather then pw != NULL; ok markus@ | ||
3557 | - jakob@cvs.openbsd.org 2003/11/08 16:02:40 | ||
3558 | [auth1.c] | ||
3559 | remove unused variable (pw). ok djm@ | ||
3560 | (id sync only - still used in portable) | ||
3561 | - jmc@cvs.openbsd.org 2003/11/08 19:17:29 | ||
3562 | [sftp-int.c] | ||
3563 | typos from Jonathon Gray; | ||
3564 | - jakob@cvs.openbsd.org 2003/11/10 16:23:41 | ||
3565 | [bufaux.c bufaux.h cipher.c cipher.h hostfile.c hostfile.h key.c] | ||
3566 | [key.h sftp-common.c sftp-common.h sftp-server.c sshconnect.c sshd.c] | ||
3567 | [ssh-dss.c ssh-rsa.c uuencode.c uuencode.h] | ||
3568 | constify. ok markus@ & djm@ | ||
3569 | - dtucker@cvs.openbsd.org 2003/11/12 10:12:15 | ||
3570 | [scp.c] | ||
3571 | When called with -q, pass -q to ssh; suppresses SSH2 banner. ok markus@ | ||
3572 | - jakob@cvs.openbsd.org 2003/11/12 16:39:58 | ||
3573 | [dns.c dns.h readconf.c ssh_config.5 sshconnect.c] | ||
3574 | update SSHFP validation. ok markus@ | ||
3575 | - jmc@cvs.openbsd.org 2003/11/12 20:14:51 | ||
3576 | [ssh_config.5] | ||
3577 | make verb agree with subject, and kill some whitespace; | ||
3578 | - markus@cvs.openbsd.org 2003/11/14 13:19:09 | ||
3579 | [sshconnect2.c] | ||
3580 | cleanup and minor fixes for the client code; from Simon Wilkinson | ||
3581 | - djm@cvs.openbsd.org 2003/11/17 09:45:39 | ||
3582 | [msg.c msg.h sshconnect2.c ssh-keysign.c] | ||
3583 | return error on msg send/receive failure (rather than fatal); ok markus@ | ||
3584 | - markus@cvs.openbsd.org 2003/11/17 11:06:07 | ||
3585 | [auth2-gss.c gss-genr.c gss-serv.c monitor.c monitor.h monitor_wrap.c] | ||
3586 | [monitor_wrap.h sshconnect2.c ssh-gss.h] | ||
3587 | replace "gssapi" with "gssapi-with-mic"; from Simon Wilkinson; | ||
3588 | test + ok jakob. | ||
3589 | - (djm) Bug #632: Don't call pam_end indirectly from within kbd-int | ||
3590 | conversation function | ||
3591 | - (djm) Export environment variables from authentication subprocess to | ||
3592 | parent. Part of Bug #717 | ||
3593 | |||
3594 | 20031115 | ||
3595 | - (dtucker) [regress/agent-ptrace.sh] Test for GDB output from Solaris and | ||
3596 | HP-UX, skip test on AIX. | ||
3597 | |||
3598 | 20031113 | ||
3599 | - (dtucker) [auth-pam.c] Append newlines to lines output by the | ||
3600 | pam_chauthtok_conv(). | ||
3601 | - (dtucker) [README ssh-host-config ssh-user-config Makefile] (All | ||
3602 | contrib/cygwin). Major update from vinschen at redhat.com. | ||
3603 | - Makefile provides a `cygwin-postinstall' target to run right after | ||
3604 | `make install'. | ||
3605 | - Better support for Windows 2003 Server. | ||
3606 | - Try to get permissions as correct as possible. | ||
3607 | - New command line options to allow full automated host configuration. | ||
3608 | - Create configs from skeletons in /etc/defaults/etc. | ||
3609 | - Use /bin/bash, allows reading user input with readline support. | ||
3610 | - Remove really old configs from /usr/local. | ||
3611 | - (dtucker) [auth-pam.c] Add newline to accumulated PAM_TEXT_INFO and | ||
3612 | PAM_ERROR_MSG messages. | ||
3613 | |||
3614 | 20031106 | ||
3615 | - (djm) Clarify UsePAM consequences a little more | ||
3616 | |||
3617 | 20031103 | ||
3618 | - (dtucker) [contrib/cygwin/ssh-host-config] Ensure entries in /etc/services | ||
3619 | are created correctly with CRLF line terminations. Patch from vinschen at | ||
3620 | redhat.com. | ||
3621 | - (dtucker) OpenBSD CVS Sync | ||
3622 | - markus@cvs.openbsd.org 2003/10/15 09:48:45 | ||
3623 | [monitor_wrap.c] | ||
3624 | check pmonitor != NULL | ||
3625 | - markus@cvs.openbsd.org 2003/10/21 09:50:06 | ||
3626 | [auth2-gss.c] | ||
3627 | make sure the doid is larger than 2 | ||
3628 | - avsm@cvs.openbsd.org 2003/10/26 16:57:43 | ||
3629 | [sshconnect2.c] | ||
3630 | rename 'supported' static var in userauth_gssapi() to 'gss_supported' | ||
3631 | to avoid shadowing the global version. markus@ ok | ||
3632 | - markus@cvs.openbsd.org 2003/10/28 09:08:06 | ||
3633 | [misc.c] | ||
3634 | error->debug for getsockopt+TCP_NODELAY; several requests | ||
3635 | - markus@cvs.openbsd.org 2003/11/02 11:01:03 | ||
3636 | [auth2-gss.c compat.c compat.h sshconnect2.c] | ||
3637 | remove support for SSH_BUG_GSSAPI_BER; simon@sxw.org.uk | ||
3638 | - (dtucker) [regress/agent-ptrace.sh] Use numeric uid and gid. | ||
3639 | |||
3640 | 20031021 | ||
3641 | - (dtucker) [INSTALL] Some system crypt() functions support MD5 passwords | ||
3642 | directly. Noted by Darren.Moffat at sun.com. | ||
3643 | - (dtucker) [regress/agent-ptrace.sh] Skip agent-test unless SUDO is set, | ||
3644 | make agent setgid during test. | ||
3645 | |||
3646 | 20031017 | ||
3647 | - (dtucker) [INSTALL] Note that --with-md5 is now required on platforms with | ||
3648 | MD5 passwords even if PAM support is enabled. From steev at detritus.net. | ||
3649 | |||
3650 | 20031015 | ||
3651 | - (dtucker) OpenBSD CVS Sync | ||
3652 | - jmc@cvs.openbsd.org 2003/10/08 08:27:36 | ||
3653 | [scp.1 scp.c sftp-server.8 sftp.1 sftp.c ssh.1 sshd.8] | ||
3654 | scp and sftp: add options list and sort options. options list requested | ||
3655 | by deraadt@ | ||
3656 | sshd: use same format as ssh | ||
3657 | ssh: remove wrong option from list | ||
3658 | sftp-server: Subsystem is documented in ssh_config(5), not sshd(8) | ||
3659 | ok deraadt@ markus@ | ||
3660 | - markus@cvs.openbsd.org 2003/10/08 15:21:24 | ||
3661 | [readconf.c ssh_config.5] | ||
3662 | default GSS API to no in client, too; ok jakob, deraadt@ | ||
3663 | - markus@cvs.openbsd.org 2003/10/11 08:24:08 | ||
3664 | [readconf.c readconf.h ssh.1 ssh.c ssh_config.5] | ||
3665 | remote x11 clients are now untrusted by default, uses xauth(8) to generate | ||
3666 | untrusted cookies; ForwardX11Trusted=yes restores old behaviour. | ||
3667 | ok deraadt; feedback and ok djm/fries | ||
3668 | - markus@cvs.openbsd.org 2003/10/11 08:26:43 | ||
3669 | [sshconnect2.c] | ||
3670 | search keys in reverse order; fixes #684 | ||
3671 | - markus@cvs.openbsd.org 2003/10/11 11:36:23 | ||
3672 | [monitor_wrap.c] | ||
3673 | return NULL for missing banner; ok djm@ | ||
3674 | - jmc@cvs.openbsd.org 2003/10/12 13:12:13 | ||
3675 | [ssh_config.5] | ||
3676 | note that EnableSSHKeySign should be in the non-hostspecific section; | ||
3677 | remove unnecessary .Pp; | ||
3678 | ok markus@ | ||
3679 | - markus@cvs.openbsd.org 2003/10/13 08:22:25 | ||
3680 | [scp.1 sftp.1] | ||
3681 | don't refer to options related to forwarding; ok jmc@ | ||
3682 | - jakob@cvs.openbsd.org 2003/10/14 19:42:10 | ||
3683 | [dns.c dns.h readconf.c ssh-keygen.c sshconnect.c] | ||
3684 | include SSHFP lookup code (not enabled by default). ok markus@ | ||
3685 | - jakob@cvs.openbsd.org 2003/10/14 19:43:23 | ||
3686 | [README.dns] | ||
3687 | update | ||
3688 | - markus@cvs.openbsd.org 2003/10/14 19:54:39 | ||
3689 | [session.c ssh-agent.c] | ||
3690 | 10X for mkdtemp; djm@ | ||
3691 | - (dtucker) [acconfig.h configure.ac dns.c openbsd-compat/getrrsetbyname.c | ||
3692 | openbsd-compat/getrrsetbyname.h] DNS fingerprint support is now always | ||
3693 | compiled in but disabled in config. | ||
3694 | - (dtucker) [auth.c] Check for disabled password expiry on HP-UX Trusted Mode. | ||
3695 | - (tim) [regress/banner.sh] portability fix. | ||
3696 | |||
3697 | 20031009 | ||
3698 | - (dtucker) [sshd_config.5] UsePAM defaults to "no". ok djm@ | ||
3699 | |||
3700 | 20031008 | ||
3701 | - (dtucker) OpenBSD CVS Sync | ||
3702 | - dtucker@cvs.openbsd.org 2003/10/07 01:47:27 | ||
3703 | [sshconnect2.c] | ||
3704 | Don't use logit for banner, since it truncates to MSGBUFSIZ; bz #668 & | ||
3705 | #707. ok markus@ | ||
3706 | - djm@cvs.openbsd.org 2003/10/07 07:04:16 | ||
3707 | [sftp-int.c] | ||
3708 | sftp quoting fix from admorten AT umich.edu; ok markus@ | ||
3709 | - deraadt@cvs.openbsd.org 2003/10/07 21:58:28 | ||
3710 | [sshconnect2.c] | ||
3711 | set ptr to NULL after free | ||
3712 | - dtucker@cvs.openbsd.org 2003/10/07 01:52:13 | ||
3713 | [regress/Makefile regress/banner.sh] | ||
3714 | Test SSH2 banner. ok markus@ | ||
3715 | - djm@cvs.openbsd.org 2003/10/07 07:04:52 | ||
3716 | [regress/sftp-cmds.sh] | ||
3717 | more sftp quoting regress tests; ok markus | ||
3718 | |||
3719 | 20031007 | ||
3720 | - (djm) Delete autom4te.cache after autoreconf | ||
3721 | - (dtucker) [auth-pam.c auth-pam.h session.c] Make PAM use the new static | ||
3722 | cleanup functions. With & ok djm@ | ||
3723 | - (dtucker) [contrib/redhat/openssh.spec] Bug #714: Now that UsePAM is a | ||
3724 | run-time switch, always build --with-md5-passwords. | ||
3725 | - (dtucker) [configure.ac openbsd-compat/Makefile.in openbsd-compat/strtoul.c] | ||
3726 | Bug #670: add strtoul() to openbsd-compat for platforms lacking it. ok djm@ | ||
3727 | - (dtucker) [configure.ac] Bug #715: Set BROKEN_SETREUID and BROKEN_SETREGID | ||
3728 | on Reliant Unix. Patch from Robert.Dahlem at siemens.com. | ||
3729 | - (dtucker) [configure.ac] Bug #710: Check for dlsym() in libdl on | ||
3730 | Reliant Unix. Based on patch from Robert.Dahlem at siemens.com. | ||
3731 | |||
3732 | 20031003 | ||
3733 | - (dtucker) OpenBSD CVS Sync | ||
3734 | - markus@cvs.openbsd.org 2003/10/02 10:41:59 | ||
3735 | [sshd.c] | ||
3736 | print openssl version, too, several requests; ok henning/djm. | ||
3737 | - markus@cvs.openbsd.org 2003/10/02 08:26:53 | ||
3738 | [ssh-gss.h] | ||
3739 | missing $OpenBSD:; dtucker | ||
3740 | - (tim) [contrib/caldera/openssh.spec] Remove obsolete --with-ipv4-default | ||
3741 | option. | ||
3742 | |||
3743 | 20031002 | ||
3744 | - (dtucker) OpenBSD CVS Sync | ||
3745 | - markus@cvs.openbsd.org 2003/09/23 20:17:11 | ||
3746 | [Makefile.in auth1.c auth2.c auth.c auth.h auth-krb5.c canohost.c | ||
3747 | cleanup.c clientloop.c fatal.c gss-serv.c log.c log.h monitor.c monitor.h | ||
3748 | monitor_wrap.c monitor_wrap.h packet.c serverloop.c session.c session.h | ||
3749 | ssh-agent.c sshd.c] | ||
3750 | replace fatal_cleanup() and linked list of fatal callbacks with static | ||
3751 | cleanup_exit() function. re-refine cleanup_exit() where appropriate, | ||
3752 | allocate sshd's authctxt eary to allow simpler cleanup in sshd. | ||
3753 | tested by many, ok deraadt@ | ||
3754 | - markus@cvs.openbsd.org 2003/09/23 20:18:52 | ||
3755 | [progressmeter.c] | ||
3756 | don't print trailing \0; bug #709; Robert.Dahlem@siemens.com | ||
3757 | ok millert/deraadt@ | ||
3758 | - markus@cvs.openbsd.org 2003/09/23 20:41:11 | ||
3759 | [channels.c channels.h clientloop.c] | ||
3760 | move client only agent code to clientloop.c | ||
3761 | - markus@cvs.openbsd.org 2003/09/26 08:19:29 | ||
3762 | [sshd.c] | ||
3763 | no need to set the listen sockets to non-block; ok deraadt@ | ||
3764 | - jmc@cvs.openbsd.org 2003/09/29 11:40:51 | ||
3765 | [ssh.1] | ||
3766 | - add list of options to -o and .Xr ssh_config(5) | ||
3767 | - some other cleanup | ||
3768 | requested by deraadt@; | ||
3769 | ok deraadt@ markus@ | ||
3770 | - markus@cvs.openbsd.org 2003/09/29 20:19:57 | ||
3771 | [servconf.c sshd_config] | ||
3772 | GSSAPICleanupCreds -> GSSAPICleanupCredentials | ||
3773 | - (dtucker) [configure.ac] Don't set DISABLE_SHADOW when configuring | ||
3774 | --with-pam. ok djm@ | ||
3775 | - (dtucker) [ssh-gss.h] Prototype change missed in sync. | ||
3776 | - (dtucker) [session.c] Fix bus errors on some 64-bit Solaris configurations. | ||
3777 | Based on patches by Matthias Koeppe and Thomas Baden. ok djm@ | ||
3778 | |||
3779 | 20030930 | ||
3780 | - (bal) Fix issues in openbsd-compat/realpath.c | ||
3781 | |||
3782 | 20030925 | ||
3783 | - (dtucker) [configure.ac openbsd-compat/xcrypt.c] Bug #633: Remove | ||
3784 | DISABLE_SHADOW for HP-UX, use getspnam instead of getprpwnam. Patch from | ||
3785 | michael_steffens at hp.com, ok djm@ | ||
3786 | - (tim) [sshd_config] UsePAM defaults to no. | ||
3787 | |||
3788 | 20030924 | ||
3789 | - (djm) Update version.h and spec files for HEAD | ||
3790 | - (dtucker) [configure.ac] IRIX5 needs the same setre[ug]id defines as IRIX6. | ||
3791 | |||
3792 | 20030923 | ||
3793 | - (dtucker) [Makefile.in] Bug #644: Fix "make clean" for out-of-tree | ||
3794 | builds. Portability corrections from tim@. | ||
3795 | - (dtucker) [configure.ac] Bug #665: uid swapping issues on Mac OS X. | ||
3796 | Patch from max at quendi.de. | ||
3797 | - (dtucker) [configure.ac] Bug #657: uid swapping issues on BSDi. | ||
3798 | - (dtucker) [configure.ac] Bug #653: uid swapping issues on Tru64. | ||
3799 | - (dtucker) [configure.ac] Bug #693: uid swapping issues on NCR MP-RAS. | ||
3800 | Patch from david.haughton at ncr.com | ||
3801 | - (dtucker) [configure.ac] Bug #659: uid swapping issues on IRIX 6. | ||
3802 | Part of patch supplied by bugzilla-openssh at thewrittenword.com | ||
3803 | - (dtucker) [configure.ac openbsd-compat/fake-rfc2553.c | ||
3804 | openbsd-compat/fake-rfc2553.h] Bug #659: Test for and handle systems with | ||
3805 | where gai_strerror is defined as "const char *". Part of patch supplied | ||
3806 | by bugzilla-openssh at thewrittenword.com | ||
3807 | - (dtucker) [contrib/cygwin/README contrib/cygwin/ssh-host-config] Update | ||
3808 | ssh-host-config to match current defaults, bump README version. Patch from | ||
3809 | vinschen at redhat.com. | ||
3810 | - (dtucker) [uidswap.c] Don't test restoration of uid on Cygwin since the | ||
3811 | OS does not support permanently dropping privileges. Patch from | ||
3812 | vinschen at redhat.com. | ||
3813 | - (dtucker) [openbsd-compat/port-aix.c] Use correct include for xmalloc.h, | ||
3814 | add canohost.h to stop warning. Based on patch from openssh-unix-dev at | ||
3815 | thewrittenword.com | ||
3816 | - (dtucker) [INSTALL] Bug #686: Document requirement for zlib 1.1.4 or | ||
3817 | higher. | ||
3818 | - (tim) Fix typo. s/SETEIUD_BREAKS_SETUID/SETEUID_BREAKS_SETUID/ | ||
3819 | - (tim) [configure.ac] Bug 665: move 3 new AC_DEFINES outside of AC_TRY_RUN. | ||
3820 | Report by distler AT golem ph utexas edu. | ||
3821 | - (dtucker) [contrib/aix/pam.conf] Include example pam.conf for AIX from | ||
3822 | article by genty at austin.ibm.com, included with the author's permission. | ||
3823 | - (dtucker) OpenBSD CVS Sync | ||
3824 | - markus@cvs.openbsd.org 2003/09/18 07:52:54 | ||
3825 | [sshconnect.c] | ||
3826 | missing {}; bug #656; jclonguet at free.fr | ||
3827 | - markus@cvs.openbsd.org 2003/09/18 07:54:48 | ||
3828 | [buffer.c] | ||
3829 | protect against double free; #660; zardoz at users.sf.net | ||
3830 | - markus@cvs.openbsd.org 2003/09/18 07:56:05 | ||
3831 | [authfile.c] | ||
3832 | missing buffer_free(&encrypted); #662; zardoz at users.sf.net | ||
3833 | - markus@cvs.openbsd.org 2003/09/18 08:49:45 | ||
3834 | [deattack.c misc.c session.c ssh-agent.c] | ||
3835 | more buffer allocation fixes; from Solar Designer; CAN-2003-0682; | ||
3836 | ok millert@ | ||
3837 | - miod@cvs.openbsd.org 2003/09/18 13:02:21 | ||
3838 | [authfd.c bufaux.c dh.c mac.c ssh-keygen.c] | ||
3839 | A few signedness fixes for harmless situations; markus@ ok | ||
3840 | - markus@cvs.openbsd.org 2003/09/19 09:02:02 | ||
3841 | [packet.c] | ||
3842 | buffer_dump only if PACKET_DEBUG is defined; Jedi/Sector One; pr 3471 | ||
3843 | - markus@cvs.openbsd.org 2003/09/19 09:03:00 | ||
3844 | [buffer.c] | ||
3845 | sign fix in buffer_dump; Jedi/Sector One; pr 3473 | ||
3846 | - markus@cvs.openbsd.org 2003/09/19 11:29:40 | ||
3847 | [ssh-agent.c] | ||
3848 | provide a ssh-agent specific fatal() function; ok deraadt | ||
3849 | - markus@cvs.openbsd.org 2003/09/19 11:30:39 | ||
3850 | [ssh-keyscan.c] | ||
3851 | avoid fatal_cleanup, just call exit(); ok deraadt | ||
3852 | - markus@cvs.openbsd.org 2003/09/19 11:31:33 | ||
3853 | [channels.c] | ||
3854 | do not call channel_free_all on fatal; ok deraadt | ||
3855 | - markus@cvs.openbsd.org 2003/09/19 11:33:09 | ||
3856 | [packet.c sshd.c] | ||
3857 | do not call packet_close on fatal; ok deraadt | ||
3858 | - markus@cvs.openbsd.org 2003/09/19 17:40:20 | ||
3859 | [scp.c] | ||
3860 | error handling for remote-remote copy; #638; report Harald Koenig; | ||
3861 | ok millert, fgs, henning, deraadt | ||
3862 | - markus@cvs.openbsd.org 2003/09/19 17:43:35 | ||
3863 | [clientloop.c sshtty.c sshtty.h] | ||
3864 | remove fatal callbacks from client code; ok deraadt | ||
3865 | - (bal) "extration" -> "extraction" in ssh-rand-helper.c; repoted by john | ||
3866 | on #unixhelp@efnet | ||
3867 | - (tim) [configure.ac] add --disable-etc-default-login option. ok djm | ||
3868 | - (djm) Sync with V_3_7 branch: | ||
3869 | - (djm) Fix SSH1 challenge kludge | ||
3870 | - (djm) Bug #671: Fix builds on OpenBSD | ||
3871 | - (djm) Bug #676: Fix PAM stack corruption | ||
3872 | - (djm) Fix bad free() in PAM code | ||
3873 | - (djm) Don't call pam_end before pam_init | ||
3874 | - (djm) Enable build with old OpenSSL again | ||
3875 | - (djm) Trim deprecated options from INSTALL. Mention UsePAM | ||
3876 | - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu | ||
3877 | |||
3878 | $Id: ChangeLog,v 1.4117.2.10 2006/02/11 00:00:44 djm Exp $ | ||
diff --git a/ChangeLog.gssapi b/ChangeLog.gssapi new file mode 100644 index 000000000..010612c4c --- /dev/null +++ b/ChangeLog.gssapi | |||
@@ -0,0 +1,69 @@ | |||
1 | 20070317 | ||
2 | - [ gss-serv-krb5.c ] | ||
3 | Remove C99ism, where new_ccname was being declared in the middle of a | ||
4 | function | ||
5 | |||
6 | 20061220 | ||
7 | - [ servconf.c ] | ||
8 | Make default for GSSAPIStrictAcceptorCheck be Yes, to match previous, and | ||
9 | documented, behaviour. Reported by Dan Watson. | ||
10 | |||
11 | 20060910 | ||
12 | - [ gss-genr.c kexgssc.c kexgsss.c kex.h monitor.c sshconnect2.c sshd.c | ||
13 | ssh-gss.h ] | ||
14 | add support for gss-group14-sha1 key exchange mechanisms | ||
15 | - [ gss-serv.c servconf.c servconf.h sshd_config sshd_config.5 ] | ||
16 | Add GSSAPIStrictAcceptorCheck option to allow the disabling of | ||
17 | acceptor principal checking on multi-homed machines. | ||
18 | <Bugzilla #928> | ||
19 | - [ sshd_config ssh_config ] | ||
20 | Add settings for GSSAPIKeyExchange and GSSAPITrustDNS to the sample | ||
21 | configuration files | ||
22 | - [ kexgss.c kegsss.c sshconnect2.c sshd.c ] | ||
23 | Code cleanup. Replace strlen/xmalloc/snprintf sequences with xasprintf() | ||
24 | Limit length of error messages displayed by client | ||
25 | |||
26 | 20060909 | ||
27 | - [ gss-genr.c gss-serv.c ] | ||
28 | move ssh_gssapi_acquire_cred() and ssh_gssapi_server_ctx to be server | ||
29 | only, where they belong | ||
30 | <Bugzilla #1225> | ||
31 | |||
32 | 20060829 | ||
33 | - [ gss-serv-krb5.c ] | ||
34 | Fix CCAPI credentials cache name when creating KRB5CCNAME environment | ||
35 | variable | ||
36 | |||
37 | 20060828 | ||
38 | - [ gss-genr.c ] | ||
39 | Avoid Heimdal context freeing problem | ||
40 | <Fixed upstream 20060829> | ||
41 | |||
42 | 20060818 | ||
43 | - [ gss-genr.c ssh-gss.h sshconnect2.c ] | ||
44 | Make sure that SPENGO is disabled | ||
45 | <Bugzilla #1218 - Fixed upstream 20060818> | ||
46 | |||
47 | 20060421 | ||
48 | - [ gssgenr.c, sshconnect2.c ] | ||
49 | a few type changes (signed versus unsigned, int versus size_t) to | ||
50 | fix compiler errors/warnings | ||
51 | (from jbasney AT ncsa.uiuc.edu) | ||
52 | - [ kexgssc.c, sshconnect2.c ] | ||
53 | fix uninitialized variable warnings | ||
54 | (from jbasney AT ncsa.uiuc.edu) | ||
55 | - [ gssgenr.c ] | ||
56 | pass oid to gss_display_status (helpful when using GSSAPI mechglue) | ||
57 | (from jbasney AT ncsa.uiuc.edu) | ||
58 | <Bugzilla #1220 > | ||
59 | - [ gss-serv-krb5.c ] | ||
60 | #ifdef HAVE_GSSAPI_KRB5 should be #ifdef HAVE_GSSAPI_KRB5_H | ||
61 | (from jbasney AT ncsa.uiuc.edu) | ||
62 | <Fixed upstream 20060304> | ||
63 | - [ readconf.c, readconf.h, ssh_config.5, sshconnect2.c | ||
64 | add client-side GssapiKeyExchange option | ||
65 | (from jbasney AT ncsa.uiuc.edu) | ||
66 | - [ sshconnect2.c ] | ||
67 | add support for GssapiTrustDns option for gssapi-with-mic | ||
68 | (from jbasney AT ncsa.uiuc.edu) | ||
69 | <gssapi-with-mic support is Bugzilla #1008> | ||
@@ -12,6 +12,8 @@ http://www.openssl.org/ | |||
12 | (OpenSSL 0.9.5a is partially supported, but some ciphers (SSH protocol 1 | 12 | (OpenSSL 0.9.5a is partially supported, but some ciphers (SSH protocol 1 |
13 | Blowfish) do not work correctly.) | 13 | Blowfish) do not work correctly.) |
14 | 14 | ||
15 | The remaining items are optional. | ||
16 | |||
15 | OpenSSH can utilise Pluggable Authentication Modules (PAM) if your system | 17 | OpenSSH can utilise Pluggable Authentication Modules (PAM) if your system |
16 | supports it. PAM is standard on Redhat and Debian Linux, Solaris and | 18 | supports it. PAM is standard on Redhat and Debian Linux, Solaris and |
17 | HP-UX 11. | 19 | HP-UX 11. |
@@ -57,13 +59,30 @@ installed. No other S/Key library is currently known to be supported. | |||
57 | http://www.sparc.spb.su/solaris/skey/ | 59 | http://www.sparc.spb.su/solaris/skey/ |
58 | 60 | ||
59 | LibEdit: | 61 | LibEdit: |
60 | sftp now supports command-line editing via NetBSD's libedit. If your | 62 | |
61 | platform has it available natively you can use that, alternatively | 63 | sftp supports command-line editing via NetBSD's libedit. If your platform |
62 | you might try these multi-platform ports: | 64 | has it available natively you can use that, alternatively you might try |
65 | these multi-platform ports: | ||
63 | 66 | ||
64 | http://www.thrysoee.dk/editline/ | 67 | http://www.thrysoee.dk/editline/ |
65 | http://sourceforge.net/projects/libedit/ | 68 | http://sourceforge.net/projects/libedit/ |
66 | 69 | ||
70 | Autoconf: | ||
71 | |||
72 | If you modify configure.ac or configure doesn't exist (eg if you checked | ||
73 | the code out of CVS yourself) then you will need autoconf-2.61 to rebuild | ||
74 | the automatically generated files by running "autoreconf". Earlier | ||
75 | version may also work but this is not guaranteed. | ||
76 | |||
77 | http://www.gnu.org/software/autoconf/ | ||
78 | |||
79 | Basic Security Module (BSM): | ||
80 | |||
81 | Native BSM support is know to exist in Solaris from at least 2.5.1, | ||
82 | FreeBSD 6.1 and OS X. Alternatively, you may use the OpenBSM | ||
83 | implementation (http://www.openbsm.org). | ||
84 | |||
85 | |||
67 | 2. Building / Installation | 86 | 2. Building / Installation |
68 | -------------------------- | 87 | -------------------------- |
69 | 88 | ||
@@ -113,6 +132,10 @@ name). | |||
113 | 132 | ||
114 | There are a few other options to the configure script: | 133 | There are a few other options to the configure script: |
115 | 134 | ||
135 | --with-audit=[module] enable additional auditing via the specified module. | ||
136 | Currently, drivers for "debug" (additional info via syslog) and "bsm" | ||
137 | (Sun's Basic Security Module) are supported. | ||
138 | |||
116 | --with-pam enables PAM support. If PAM support is compiled in, it must | 139 | --with-pam enables PAM support. If PAM support is compiled in, it must |
117 | also be enabled in sshd_config (refer to the UsePAM directive). | 140 | also be enabled in sshd_config (refer to the UsePAM directive). |
118 | 141 | ||
@@ -165,6 +188,8 @@ created. | |||
165 | --with-ssl-dir=DIR allows you to specify where your OpenSSL libraries | 188 | --with-ssl-dir=DIR allows you to specify where your OpenSSL libraries |
166 | are installed. | 189 | are installed. |
167 | 190 | ||
191 | --with-ssl-engine enables OpenSSL's (hardware) ENGINE support | ||
192 | |||
168 | --with-4in6 Check for IPv4 in IPv6 mapped addresses and convert them to | 193 | --with-4in6 Check for IPv4 in IPv6 mapped addresses and convert them to |
169 | real (AF_INET) IPv4 addresses. Works around some quirks on Linux. | 194 | real (AF_INET) IPv4 addresses. Works around some quirks on Linux. |
170 | 195 | ||
@@ -208,7 +233,8 @@ for sshd, ssh and ssh-agent. | |||
208 | ------------------------- | 233 | ------------------------- |
209 | 234 | ||
210 | $ make survey | 235 | $ make survey |
211 | [check the contents and make sure there's no sensitive information] | 236 | [check the contents of the file "survey" to ensure there's no information |
237 | that you consider sensitive] | ||
212 | $ make send-survey | 238 | $ make send-survey |
213 | 239 | ||
214 | This will send configuration information for the currently configured | 240 | This will send configuration information for the currently configured |
@@ -225,4 +251,4 @@ Please refer to the "reporting bugs" section of the webpage at | |||
225 | http://www.openssh.com/ | 251 | http://www.openssh.com/ |
226 | 252 | ||
227 | 253 | ||
228 | $Id: INSTALL,v 1.70 2005/04/24 07:52:23 dtucker Exp $ | 254 | $Id: INSTALL,v 1.77 2007/03/02 06:53:41 dtucker Exp $ |
@@ -287,6 +287,8 @@ OpenSSH contains no GPL code. | |||
287 | 287 | ||
288 | Internet Software Consortium. | 288 | Internet Software Consortium. |
289 | Todd C. Miller | 289 | Todd C. Miller |
290 | Reyk Floeter | ||
291 | Chad Mynhier | ||
290 | 292 | ||
291 | * Permission to use, copy, modify, and distribute this software for any | 293 | * Permission to use, copy, modify, and distribute this software for any |
292 | * purpose with or without fee is hereby granted, provided that the above | 294 | * purpose with or without fee is hereby granted, provided that the above |
diff --git a/Makefile.in b/Makefile.in index ea738aac1..1e79ab913 100644 --- a/Makefile.in +++ b/Makefile.in | |||
@@ -1,4 +1,4 @@ | |||
1 | # $Id: Makefile.in,v 1.274 2006/01/01 08:47:05 djm Exp $ | 1 | # $Id: Makefile.in,v 1.283 2006/10/23 21:44:47 tim Exp $ |
2 | 2 | ||
3 | # uncomment if you run a non bourne compatable shell. Ie. csh | 3 | # uncomment if you run a non bourne compatable shell. Ie. csh |
4 | #SHELL = @SH@ | 4 | #SHELL = @SH@ |
@@ -11,6 +11,7 @@ bindir=@bindir@ | |||
11 | sbindir=@sbindir@ | 11 | sbindir=@sbindir@ |
12 | libexecdir=@libexecdir@ | 12 | libexecdir=@libexecdir@ |
13 | datadir=@datadir@ | 13 | datadir=@datadir@ |
14 | datarootdir=@datarootdir@ | ||
14 | mandir=@mandir@ | 15 | mandir=@mandir@ |
15 | mansubdir=@mansubdir@ | 16 | mansubdir=@mansubdir@ |
16 | sysconfdir=@sysconfdir@ | 17 | sysconfdir=@sysconfdir@ |
@@ -44,6 +45,7 @@ CFLAGS=@CFLAGS@ | |||
44 | CPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ $(PATHS) @DEFS@ | 45 | CPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ $(PATHS) @DEFS@ |
45 | LIBS=@LIBS@ | 46 | LIBS=@LIBS@ |
46 | LIBSELINUX=@LIBSELINUX@ | 47 | LIBSELINUX=@LIBSELINUX@ |
48 | SSHDLIBS=@SSHDLIBS@ | ||
47 | LIBEDIT=@LIBEDIT@ | 49 | LIBEDIT=@LIBEDIT@ |
48 | LIBPAM=@LIBPAM@ | 50 | LIBPAM=@LIBPAM@ |
49 | LIBWRAP=@LIBWRAP@ | 51 | LIBWRAP=@LIBWRAP@ |
@@ -63,11 +65,11 @@ INSTALL_SSH_RAND_HELPER=@INSTALL_SSH_RAND_HELPER@ | |||
63 | 65 | ||
64 | TARGETS=ssh$(EXEEXT) sshd$(EXEEXT) ssh-add$(EXEEXT) ssh-keygen$(EXEEXT) ssh-keyscan${EXEEXT} ssh-keysign${EXEEXT} ssh-agent$(EXEEXT) scp$(EXEEXT) ssh-rand-helper${EXEEXT} sftp-server$(EXEEXT) sftp$(EXEEXT) | 66 | TARGETS=ssh$(EXEEXT) sshd$(EXEEXT) ssh-add$(EXEEXT) ssh-keygen$(EXEEXT) ssh-keyscan${EXEEXT} ssh-keysign${EXEEXT} ssh-agent$(EXEEXT) scp$(EXEEXT) ssh-rand-helper${EXEEXT} sftp-server$(EXEEXT) sftp$(EXEEXT) |
65 | 67 | ||
66 | LIBSSH_OBJS=acss.o authfd.o authfile.o bufaux.o buffer.o \ | 68 | LIBSSH_OBJS=acss.o authfd.o authfile.o bufaux.o bufbn.o buffer.o \ |
67 | canohost.o channels.o cipher.o cipher-acss.o cipher-aes.o \ | 69 | canohost.o channels.o cipher.o cipher-acss.o cipher-aes.o \ |
68 | cipher-bf1.o cipher-ctr.o cipher-3des1.o cleanup.o \ | 70 | cipher-bf1.o cipher-ctr.o cipher-3des1.o cleanup.o \ |
69 | compat.o compress.o crc32.o deattack.o fatal.o hostfile.o \ | 71 | compat.o compress.o crc32.o deattack.o fatal.o hostfile.o \ |
70 | log.o match.o moduli.o nchan.o packet.o \ | 72 | log.o match.o md-sha256.o moduli.o nchan.o packet.o \ |
71 | readpass.o rsa.o ttymodes.o xmalloc.o \ | 73 | readpass.o rsa.o ttymodes.o xmalloc.o \ |
72 | atomicio.o key.o dispatch.o kex.o mac.o uidswap.o uuencode.o misc.o \ | 74 | atomicio.o key.o dispatch.o kex.o mac.o uidswap.o uuencode.o misc.o \ |
73 | monitor_fdpass.o rijndael.o ssh-dss.o ssh-rsa.o dh.o kexdh.o \ | 75 | monitor_fdpass.o rijndael.o ssh-dss.o ssh-rsa.o dh.o kexdh.o \ |
@@ -78,7 +80,7 @@ SSHOBJS= ssh.o readconf.o clientloop.o sshtty.o \ | |||
78 | sshconnect.o sshconnect1.o sshconnect2.o | 80 | sshconnect.o sshconnect1.o sshconnect2.o |
79 | 81 | ||
80 | SSHDOBJS=sshd.o auth-rhosts.o auth-passwd.o auth-rsa.o auth-rh-rsa.o \ | 82 | SSHDOBJS=sshd.o auth-rhosts.o auth-passwd.o auth-rsa.o auth-rh-rsa.o \ |
81 | sshpty.o sshlogin.o servconf.o serverloop.o selinux.o \ | 83 | sshpty.o sshlogin.o servconf.o serverloop.o \ |
82 | auth.o auth1.o auth2.o auth-options.o session.o \ | 84 | auth.o auth1.o auth2.o auth-options.o session.o \ |
83 | auth-chall.o auth2-chall.o groupaccess.o \ | 85 | auth-chall.o auth2-chall.o groupaccess.o \ |
84 | auth-skey.o auth-bsdauth.o auth2-hostbased.o auth2-kbdint.o \ | 86 | auth-skey.o auth-bsdauth.o auth2-hostbased.o auth2-kbdint.o \ |
@@ -87,7 +89,7 @@ SSHDOBJS=sshd.o auth-rhosts.o auth-passwd.o auth-rsa.o auth-rh-rsa.o \ | |||
87 | auth-krb5.o \ | 89 | auth-krb5.o \ |
88 | auth2-gss.o gss-serv.o gss-serv-krb5.o kexgsss.o\ | 90 | auth2-gss.o gss-serv.o gss-serv-krb5.o kexgsss.o\ |
89 | loginrec.o auth-pam.o auth-shadow.o auth-sia.o md5crypt.o \ | 91 | loginrec.o auth-pam.o auth-shadow.o auth-sia.o md5crypt.o \ |
90 | audit.o audit-bsm.o | 92 | audit.o audit-bsm.o platform.o |
91 | 93 | ||
92 | MANPAGES = scp.1.out ssh-add.1.out ssh-agent.1.out ssh-keygen.1.out ssh-keyscan.1.out ssh.1.out sshd.8.out sftp-server.8.out sftp.1.out ssh-rand-helper.8.out ssh-keysign.8.out sshd_config.5.out ssh_config.5.out | 94 | MANPAGES = scp.1.out ssh-add.1.out ssh-agent.1.out ssh-keygen.1.out ssh-keyscan.1.out ssh.1.out sshd.8.out sftp-server.8.out sftp.1.out ssh-rand-helper.8.out ssh-keysign.8.out sshd_config.5.out ssh_config.5.out |
93 | MANPAGES_IN = scp.1 ssh-add.1 ssh-agent.1 ssh-keygen.1 ssh-keyscan.1 ssh.1 sshd.8 sftp-server.8 sftp.1 ssh-rand-helper.8 ssh-keysign.8 sshd_config.5 ssh_config.5 | 95 | MANPAGES_IN = scp.1 ssh-add.1 ssh-agent.1 ssh-keygen.1 ssh-keyscan.1 ssh.1 sshd.8 sftp-server.8 sftp.1 ssh-rand-helper.8 ssh-keysign.8 sshd_config.5 ssh_config.5 |
@@ -108,7 +110,7 @@ PATHSUBS = \ | |||
108 | -e 's|/etc/ssh/ssh_host_rsa_key|$(sysconfdir)/ssh_host_rsa_key|g' \ | 110 | -e 's|/etc/ssh/ssh_host_rsa_key|$(sysconfdir)/ssh_host_rsa_key|g' \ |
109 | -e 's|/var/run/sshd.pid|$(piddir)/sshd.pid|g' \ | 111 | -e 's|/var/run/sshd.pid|$(piddir)/sshd.pid|g' \ |
110 | -e 's|/etc/ssh/moduli|$(sysconfdir)/moduli|g' \ | 112 | -e 's|/etc/ssh/moduli|$(sysconfdir)/moduli|g' \ |
111 | -e 's|/etc/sshrc|$(sysconfdir)/sshrc|g' \ | 113 | -e 's|/etc/ssh/sshrc|$(sysconfdir)/sshrc|g' \ |
112 | -e 's|/usr/X11R6/bin/xauth|$(XAUTH_PATH)|g' \ | 114 | -e 's|/usr/X11R6/bin/xauth|$(XAUTH_PATH)|g' \ |
113 | -e 's|/var/empty|$(PRIVSEP_PATH)|g' \ | 115 | -e 's|/var/empty|$(PRIVSEP_PATH)|g' \ |
114 | -e 's|/usr/bin:/bin:/usr/sbin:/sbin|@user_path@|g' | 116 | -e 's|/usr/bin:/bin:/usr/sbin:/sbin|@user_path@|g' |
@@ -137,7 +139,7 @@ ssh$(EXEEXT): $(LIBCOMPAT) libssh.a $(SSHOBJS) | |||
137 | $(LD) -o $@ $(SSHOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) | 139 | $(LD) -o $@ $(SSHOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) |
138 | 140 | ||
139 | sshd$(EXEEXT): libssh.a $(LIBCOMPAT) $(SSHDOBJS) | 141 | sshd$(EXEEXT): libssh.a $(LIBCOMPAT) $(SSHDOBJS) |
140 | $(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(LIBWRAP) $(LIBPAM) $(LIBSELINUX) $(LIBS) | 142 | $(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(LIBWRAP) $(LIBPAM) $(LIBSELINUX) $(SSHDLIBS) $(LIBS) |
141 | 143 | ||
142 | scp$(EXEEXT): $(LIBCOMPAT) libssh.a scp.o progressmeter.o | 144 | scp$(EXEEXT): $(LIBCOMPAT) libssh.a scp.o progressmeter.o |
143 | $(LD) -o $@ scp.o progressmeter.o bufaux.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) | 145 | $(LD) -o $@ scp.o progressmeter.o bufaux.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) |
@@ -202,8 +204,9 @@ clean: regressclean | |||
202 | 204 | ||
203 | distclean: regressclean | 205 | distclean: regressclean |
204 | rm -f *.o *.a $(TARGETS) logintest config.cache config.log | 206 | rm -f *.o *.a $(TARGETS) logintest config.cache config.log |
205 | rm -f *.out core opensshd.init | 207 | rm -f *.out core opensshd.init openssh.xml |
206 | rm -f Makefile buildpkg.sh config.h config.status ssh_prng_cmds survey.sh *~ | 208 | rm -f Makefile buildpkg.sh config.h config.status ssh_prng_cmds |
209 | rm -f survey.sh openbsd-compat/regress/Makefile *~ | ||
207 | rm -rf autom4te.cache | 210 | rm -rf autom4te.cache |
208 | (cd openbsd-compat && $(MAKE) distclean) | 211 | (cd openbsd-compat && $(MAKE) distclean) |
209 | (cd scard && $(MAKE) distclean) | 212 | (cd scard && $(MAKE) distclean) |
@@ -411,6 +414,9 @@ tests: $(TARGETS) | |||
411 | EXEEXT="$(EXEEXT)" \ | 414 | EXEEXT="$(EXEEXT)" \ |
412 | $@ | 415 | $@ |
413 | 416 | ||
417 | compat-tests: $(LIBCOMPAT) | ||
418 | (cd openbsd-compat/regress && $(MAKE)) | ||
419 | |||
414 | regressclean: | 420 | regressclean: |
415 | if [ -f regress/Makefile ] && [ -r regress/Makefile ]; then \ | 421 | if [ -f regress/Makefile ] && [ -r regress/Makefile ]; then \ |
416 | (cd regress && $(MAKE) clean) \ | 422 | (cd regress && $(MAKE) clean) \ |
@@ -162,8 +162,7 @@ these programs. | |||
162 | - There are several other files in the distribution that contain | 162 | - There are several other files in the distribution that contain |
163 | various auxiliary routines: | 163 | various auxiliary routines: |
164 | ssh.h the main header file for ssh (various definitions) | 164 | ssh.h the main header file for ssh (various definitions) |
165 | getput.h byte-order independent storage of integers | ||
166 | includes.h includes most system headers. Lots of #ifdefs. | ||
167 | tildexpand.c expand tilde in file names | ||
168 | uidswap.c uid-swapping | 165 | uidswap.c uid-swapping |
169 | xmalloc.c "safe" malloc routines | 166 | xmalloc.c "safe" malloc routines |
167 | |||
168 | $OpenBSD: OVERVIEW,v 1.11 2006/08/03 03:34:41 deraadt Exp $ | ||
@@ -1,4 +1,4 @@ | |||
1 | See http://www.openssh.com/txt/release-4.3p2 for the release notes. | 1 | See http://www.openssh.com/txt/release-4.6 for the release notes. |
2 | 2 | ||
3 | - A Japanese translation of this document and of the OpenSSH FAQ is | 3 | - A Japanese translation of this document and of the OpenSSH FAQ is |
4 | - available at http://www.unixuser.org/~haruyama/security/openssh/index.html | 4 | - available at http://www.unixuser.org/~haruyama/security/openssh/index.html |
@@ -62,4 +62,4 @@ References - | |||
62 | [6] http://www.openbsd.org/cgi-bin/man.cgi?query=style&sektion=9 | 62 | [6] http://www.openbsd.org/cgi-bin/man.cgi?query=style&sektion=9 |
63 | [7] http://www.openssh.com/faq.html | 63 | [7] http://www.openssh.com/faq.html |
64 | 64 | ||
65 | $Id: README,v 1.61.2.1 2006/02/10 23:43:34 dtucker Exp $ | 65 | $Id: README,v 1.64.4.1 2007/03/06 10:27:56 djm Exp $ |
diff --git a/README.platform b/README.platform index 4c18a3278..b7dc3f91c 100644 --- a/README.platform +++ b/README.platform | |||
@@ -30,6 +30,18 @@ gcc, gcc-mingw-core, mingw-runtime, binutils, make, openssl, | |||
30 | openssl-devel, zlib, minres, minires-devel. | 30 | openssl-devel, zlib, minres, minires-devel. |
31 | 31 | ||
32 | 32 | ||
33 | Darwin and MacOS X | ||
34 | ------------------ | ||
35 | Darwin does not provide a tun(4) driver required for OpenSSH-based | ||
36 | virtual private networks. The BSD manpage still exists, but the driver | ||
37 | has been removed in recent releases of Darwin and MacOS X. | ||
38 | |||
39 | Nevertheless, tunnel support is known to work with Darwin 8 and | ||
40 | MacOS X 10.4 in Point-to-Point (Layer 3) and Ethernet (Layer 2) mode | ||
41 | using a third party driver. More information is available at: | ||
42 | http://www-user.rhrk.uni-kl.de/~nissler/tuntap/ | ||
43 | |||
44 | |||
33 | Solaris | 45 | Solaris |
34 | ------- | 46 | ------- |
35 | If you enable BSM auditing on Solaris, you need to update audit_event(4) | 47 | If you enable BSM auditing on Solaris, you need to update audit_event(4) |
@@ -55,4 +67,4 @@ account stacks which will prevent authentication entirely, but will still | |||
55 | return the output from pam_nologin to the client. | 67 | return the output from pam_nologin to the client. |
56 | 68 | ||
57 | 69 | ||
58 | $Id: README.platform,v 1.6 2005/11/05 05:28:35 dtucker Exp $ | 70 | $Id: README.platform,v 1.7 2006/06/23 11:05:13 dtucker Exp $ |
diff --git a/README.tun b/README.tun index d814f396d..5e1cb074c 100644 --- a/README.tun +++ b/README.tun | |||
@@ -87,12 +87,12 @@ combination with layer 2 tunneling and Ethernet bridging. | |||
87 | | Client |------( Internet )-----| access.somewhere.net | | 87 | | Client |------( Internet )-----| access.somewhere.net | |
88 | +--------+ ( ) +----------------------+ | 88 | +--------+ ( ) +----------------------+ |
89 | : 192.168.1.78 | | 89 | : 192.168.1.78 | |
90 | :............................. +-------+ | 90 | :............................. +-------+ |
91 | Forwarded ssh connection : | dmzgw | | 91 | Forwarded ssh connection : | dmzgw | |
92 | Layer 2 tunnel : +-------+ | 92 | Layer 2 tunnel : +-------+ |
93 | : | | 93 | : | |
94 | : | | 94 | : | |
95 | : +------------+ | 95 | : +------------+ |
96 | :......| sshgateway | | 96 | :......| sshgateway | |
97 | | +------------+ | 97 | | +------------+ |
98 | --- real connection Bridge -> | +----------+ | 98 | --- real connection Bridge -> | +----------+ |
@@ -104,7 +104,7 @@ combination with layer 2 tunneling and Ethernet bridging. | |||
104 | 104 | ||
105 | Finally connect to the OpenSSH server to establish the tunnel by using | 105 | Finally connect to the OpenSSH server to establish the tunnel by using |
106 | the following command: | 106 | the following command: |
107 | 107 | ||
108 | ssh sshgateway | 108 | ssh sshgateway |
109 | 109 | ||
110 | It is also possible to tell the client to fork into the background after | 110 | It is also possible to tell the client to fork into the background after |
@@ -129,4 +129,4 @@ interconnect corporate networks. | |||
129 | 129 | ||
130 | Reyk Floeter | 130 | Reyk Floeter |
131 | 131 | ||
132 | $OpenBSD: README.tun,v 1.3 2005/12/08 18:34:10 reyk Exp $ | 132 | $OpenBSD: README.tun,v 1.4 2006/03/28 00:12:31 deraadt Exp $ |
@@ -1,4 +1,4 @@ | |||
1 | /* $Id: acss.c,v 1.3 2005/07/17 07:04:47 djm Exp $ */ | 1 | /* $Id: acss.c,v 1.4 2006/07/24 04:51:01 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2004 The OpenBSD project | 3 | * Copyright (c) 2004 The OpenBSD project |
4 | * | 4 | * |
@@ -16,6 +16,9 @@ | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include "includes.h" | 18 | #include "includes.h" |
19 | |||
20 | #include <string.h> | ||
21 | |||
19 | #include <openssl/evp.h> | 22 | #include <openssl/evp.h> |
20 | 23 | ||
21 | #if !defined(EVP_CTRL_SET_ACSS_MODE) && (OPENSSL_VERSION_NUMBER >= 0x00906000L) | 24 | #if !defined(EVP_CTRL_SET_ACSS_MODE) && (OPENSSL_VERSION_NUMBER >= 0x00906000L) |
diff --git a/atomicio.c b/atomicio.c index 12abbda16..f651a292c 100644 --- a/atomicio.c +++ b/atomicio.c | |||
@@ -1,4 +1,6 @@ | |||
1 | /* $OpenBSD: atomicio.c,v 1.23 2006/08/03 03:34:41 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
3 | * Copyright (c) 2006 Damien Miller. All rights reserved. | ||
2 | * Copyright (c) 2005 Anil Madhavapeddy. All rights reserved. | 4 | * Copyright (c) 2005 Anil Madhavapeddy. All rights reserved. |
3 | * Copyright (c) 1995,1999 Theo de Raadt. All rights reserved. | 5 | * Copyright (c) 1995,1999 Theo de Raadt. All rights reserved. |
4 | * All rights reserved. | 6 | * All rights reserved. |
@@ -25,7 +27,12 @@ | |||
25 | */ | 27 | */ |
26 | 28 | ||
27 | #include "includes.h" | 29 | #include "includes.h" |
28 | RCSID("$OpenBSD: atomicio.c,v 1.13 2005/05/24 17:32:43 avsm Exp $"); | 30 | |
31 | #include <sys/param.h> | ||
32 | #include <sys/uio.h> | ||
33 | |||
34 | #include <errno.h> | ||
35 | #include <string.h> | ||
29 | 36 | ||
30 | #include "atomicio.h" | 37 | #include "atomicio.h" |
31 | 38 | ||
@@ -33,11 +40,7 @@ RCSID("$OpenBSD: atomicio.c,v 1.13 2005/05/24 17:32:43 avsm Exp $"); | |||
33 | * ensure all of data on socket comes through. f==read || f==vwrite | 40 | * ensure all of data on socket comes through. f==read || f==vwrite |
34 | */ | 41 | */ |
35 | size_t | 42 | size_t |
36 | atomicio(f, fd, _s, n) | 43 | atomicio(ssize_t (*f) (int, void *, size_t), int fd, void *_s, size_t n) |
37 | ssize_t (*f) (int, void *, size_t); | ||
38 | int fd; | ||
39 | void *_s; | ||
40 | size_t n; | ||
41 | { | 44 | { |
42 | char *s = _s; | 45 | char *s = _s; |
43 | size_t pos = 0; | 46 | size_t pos = 0; |
@@ -58,8 +61,60 @@ atomicio(f, fd, _s, n) | |||
58 | errno = EPIPE; | 61 | errno = EPIPE; |
59 | return pos; | 62 | return pos; |
60 | default: | 63 | default: |
61 | pos += (u_int)res; | 64 | pos += (size_t)res; |
62 | } | 65 | } |
63 | } | 66 | } |
64 | return (pos); | 67 | return (pos); |
65 | } | 68 | } |
69 | |||
70 | /* | ||
71 | * ensure all of data on socket comes through. f==readv || f==writev | ||
72 | */ | ||
73 | size_t | ||
74 | atomiciov(ssize_t (*f) (int, const struct iovec *, int), int fd, | ||
75 | const struct iovec *_iov, int iovcnt) | ||
76 | { | ||
77 | size_t pos = 0, rem; | ||
78 | ssize_t res; | ||
79 | struct iovec iov_array[IOV_MAX], *iov = iov_array; | ||
80 | |||
81 | if (iovcnt > IOV_MAX) { | ||
82 | errno = EINVAL; | ||
83 | return 0; | ||
84 | } | ||
85 | /* Make a copy of the iov array because we may modify it below */ | ||
86 | memcpy(iov, _iov, iovcnt * sizeof(*_iov)); | ||
87 | |||
88 | for (; iovcnt > 0 && iov[0].iov_len > 0;) { | ||
89 | res = (f) (fd, iov, iovcnt); | ||
90 | switch (res) { | ||
91 | case -1: | ||
92 | if (errno == EINTR || errno == EAGAIN) | ||
93 | continue; | ||
94 | return 0; | ||
95 | case 0: | ||
96 | errno = EPIPE; | ||
97 | return pos; | ||
98 | default: | ||
99 | rem = (size_t)res; | ||
100 | pos += rem; | ||
101 | /* skip completed iov entries */ | ||
102 | while (iovcnt > 0 && rem >= iov[0].iov_len) { | ||
103 | rem -= iov[0].iov_len; | ||
104 | iov++; | ||
105 | iovcnt--; | ||
106 | } | ||
107 | /* This shouldn't happen... */ | ||
108 | if (rem > 0 && (iovcnt <= 0 || rem > iov[0].iov_len)) { | ||
109 | errno = EFAULT; | ||
110 | return 0; | ||
111 | } | ||
112 | if (iovcnt == 0) | ||
113 | break; | ||
114 | /* update pointer in partially complete iov */ | ||
115 | iov[0].iov_base = ((char *)iov[0].iov_base) + rem; | ||
116 | iov[0].iov_len -= rem; | ||
117 | } | ||
118 | } | ||
119 | return pos; | ||
120 | } | ||
diff --git a/atomicio.h b/atomicio.h index 7eccf206b..2fcd25d43 100644 --- a/atomicio.h +++ b/atomicio.h | |||
@@ -1,6 +1,7 @@ | |||
1 | /* $OpenBSD: atomicio.h,v 1.6 2005/05/24 17:32:43 avsm Exp $ */ | 1 | /* $OpenBSD: atomicio.h,v 1.10 2006/08/03 03:34:41 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2006 Damien Miller. All rights reserved. | ||
4 | * Copyright (c) 1995,1999 Theo de Raadt. All rights reserved. | 5 | * Copyright (c) 1995,1999 Theo de Raadt. All rights reserved. |
5 | * All rights reserved. | 6 | * All rights reserved. |
6 | * | 7 | * |
@@ -25,9 +26,20 @@ | |||
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 27 | */ |
27 | 28 | ||
29 | #ifndef _ATOMICIO_H | ||
30 | #define _ATOMICIO_H | ||
31 | |||
28 | /* | 32 | /* |
29 | * Ensure all of data on socket comes through. f==read || f==vwrite | 33 | * Ensure all of data on socket comes through. f==read || f==vwrite |
30 | */ | 34 | */ |
31 | size_t atomicio(ssize_t (*)(int, void *, size_t), int, void *, size_t); | 35 | size_t atomicio(ssize_t (*)(int, void *, size_t), int, void *, size_t); |
32 | 36 | ||
33 | #define vwrite (ssize_t (*)(int, void *, size_t))write | 37 | #define vwrite (ssize_t (*)(int, void *, size_t))write |
38 | |||
39 | /* | ||
40 | * ensure all of data on socket comes through. f==readv || f==writev | ||
41 | */ | ||
42 | size_t atomiciov(ssize_t (*)(int, const struct iovec *, int), | ||
43 | int, const struct iovec *, int); | ||
44 | |||
45 | #endif /* _ATOMICIO_H */ | ||
diff --git a/audit-bsm.c b/audit-bsm.c index c2679d3da..c26b4caed 100644 --- a/audit-bsm.c +++ b/audit-bsm.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $Id: audit-bsm.c,v 1.1 2005/02/20 10:08:00 dtucker Exp $ */ | 1 | /* $Id: audit-bsm.c,v 1.5 2006/09/30 22:09:50 dtucker Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * TODO | 4 | * TODO |
@@ -37,8 +37,16 @@ | |||
37 | #include "includes.h" | 37 | #include "includes.h" |
38 | #if defined(USE_BSM_AUDIT) | 38 | #if defined(USE_BSM_AUDIT) |
39 | 39 | ||
40 | #include <sys/types.h> | ||
41 | |||
42 | #include <errno.h> | ||
43 | #include <stdarg.h> | ||
44 | #include <unistd.h> | ||
45 | |||
40 | #include "ssh.h" | 46 | #include "ssh.h" |
41 | #include "log.h" | 47 | #include "log.h" |
48 | #include "key.h" | ||
49 | #include "hostfile.h" | ||
42 | #include "auth.h" | 50 | #include "auth.h" |
43 | #include "xmalloc.h" | 51 | #include "xmalloc.h" |
44 | 52 | ||
@@ -1,4 +1,4 @@ | |||
1 | /* $Id: audit.c,v 1.3 2005/07/17 07:26:44 djm Exp $ */ | 1 | /* $Id: audit.c,v 1.5 2006/09/01 05:38:36 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2004, 2005 Darren Tucker. All rights reserved. | 4 | * Copyright (c) 2004, 2005 Darren Tucker. All rights reserved. |
@@ -26,10 +26,15 @@ | |||
26 | 26 | ||
27 | #include "includes.h" | 27 | #include "includes.h" |
28 | 28 | ||
29 | #include <stdarg.h> | ||
30 | #include <string.h> | ||
31 | |||
29 | #ifdef SSH_AUDIT_EVENTS | 32 | #ifdef SSH_AUDIT_EVENTS |
30 | 33 | ||
31 | #include "audit.h" | 34 | #include "audit.h" |
32 | #include "log.h" | 35 | #include "log.h" |
36 | #include "key.h" | ||
37 | #include "hostfile.h" | ||
33 | #include "auth.h" | 38 | #include "auth.h" |
34 | 39 | ||
35 | /* | 40 | /* |
@@ -1,4 +1,4 @@ | |||
1 | /* $Id: audit.h,v 1.2 2005/02/08 10:52:48 dtucker Exp $ */ | 1 | /* $Id: audit.h,v 1.3 2006/08/05 14:05:10 dtucker Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2004, 2005 Darren Tucker. All rights reserved. | 4 | * Copyright (c) 2004, 2005 Darren Tucker. All rights reserved. |
@@ -24,8 +24,6 @@ | |||
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include "auth.h" | ||
28 | |||
29 | #ifndef _SSH_AUDIT_H | 27 | #ifndef _SSH_AUDIT_H |
30 | # define _SSH_AUDIT_H | 28 | # define _SSH_AUDIT_H |
31 | enum ssh_audit_event_type { | 29 | enum ssh_audit_event_type { |
diff --git a/auth-bsdauth.c b/auth-bsdauth.c index 920c977d8..37d527d11 100644 --- a/auth-bsdauth.c +++ b/auth-bsdauth.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: auth-bsdauth.c,v 1.10 2006/08/03 03:34:41 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
3 | * | 4 | * |
@@ -21,13 +22,23 @@ | |||
21 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
22 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 24 | */ |
25 | |||
24 | #include "includes.h" | 26 | #include "includes.h" |
25 | RCSID("$OpenBSD: auth-bsdauth.c,v 1.6 2005/01/19 13:11:47 dtucker Exp $"); | 27 | |
28 | #include <sys/types.h> | ||
29 | |||
30 | #include <stdarg.h> | ||
26 | 31 | ||
27 | #ifdef BSD_AUTH | 32 | #ifdef BSD_AUTH |
28 | #include "xmalloc.h" | 33 | #include "xmalloc.h" |
34 | #include "key.h" | ||
35 | #include "hostfile.h" | ||
29 | #include "auth.h" | 36 | #include "auth.h" |
30 | #include "log.h" | 37 | #include "log.h" |
38 | #include "buffer.h" | ||
39 | #ifdef GSSAPI | ||
40 | #include "ssh-gss.h" | ||
41 | #endif | ||
31 | #include "monitor_wrap.h" | 42 | #include "monitor_wrap.h" |
32 | 43 | ||
33 | static void * | 44 | static void * |
@@ -69,9 +80,8 @@ bsdauth_query(void *ctx, char **name, char **infotxt, | |||
69 | *name = xstrdup(""); | 80 | *name = xstrdup(""); |
70 | *infotxt = xstrdup(""); | 81 | *infotxt = xstrdup(""); |
71 | *numprompts = 1; | 82 | *numprompts = 1; |
72 | *prompts = xmalloc(*numprompts * sizeof(char *)); | 83 | *prompts = xcalloc(*numprompts, sizeof(char *)); |
73 | *echo_on = xmalloc(*numprompts * sizeof(u_int)); | 84 | *echo_on = xcalloc(*numprompts, sizeof(u_int)); |
74 | (*echo_on)[0] = 0; | ||
75 | (*prompts)[0] = xstrdup(challenge); | 85 | (*prompts)[0] = xstrdup(challenge); |
76 | 86 | ||
77 | return 0; | 87 | return 0; |
diff --git a/auth-chall.c b/auth-chall.c index e4f783096..919b1eaa4 100644 --- a/auth-chall.c +++ b/auth-chall.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: auth-chall.c,v 1.12 2006/08/03 03:34:41 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
3 | * | 4 | * |
@@ -23,11 +24,16 @@ | |||
23 | */ | 24 | */ |
24 | 25 | ||
25 | #include "includes.h" | 26 | #include "includes.h" |
26 | RCSID("$OpenBSD: auth-chall.c,v 1.9 2003/11/03 09:03:37 djm Exp $"); | ||
27 | 27 | ||
28 | #include <sys/types.h> | ||
29 | |||
30 | #include <stdarg.h> | ||
31 | |||
32 | #include "xmalloc.h" | ||
33 | #include "key.h" | ||
34 | #include "hostfile.h" | ||
28 | #include "auth.h" | 35 | #include "auth.h" |
29 | #include "log.h" | 36 | #include "log.h" |
30 | #include "xmalloc.h" | ||
31 | #include "servconf.h" | 37 | #include "servconf.h" |
32 | 38 | ||
33 | /* limited protocol v1 interface to kbd-interactive authentication */ | 39 | /* limited protocol v1 interface to kbd-interactive authentication */ |
diff --git a/auth-krb5.c b/auth-krb5.c index bc37675a2..38164fda8 100644 --- a/auth-krb5.c +++ b/auth-krb5.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: auth-krb5.c,v 1.19 2006/08/03 03:34:41 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Kerberos v5 authentication and ticket-passing routines. | 3 | * Kerberos v5 authentication and ticket-passing routines. |
3 | * | 4 | * |
@@ -28,18 +29,27 @@ | |||
28 | */ | 29 | */ |
29 | 30 | ||
30 | #include "includes.h" | 31 | #include "includes.h" |
31 | RCSID("$OpenBSD: auth-krb5.c,v 1.16 2005/11/21 09:42:10 dtucker Exp $"); | ||
32 | 32 | ||
33 | #include <sys/types.h> | ||
34 | #include <pwd.h> | ||
35 | #include <stdarg.h> | ||
36 | |||
37 | #include "xmalloc.h" | ||
33 | #include "ssh.h" | 38 | #include "ssh.h" |
34 | #include "ssh1.h" | 39 | #include "ssh1.h" |
35 | #include "packet.h" | 40 | #include "packet.h" |
36 | #include "xmalloc.h" | ||
37 | #include "log.h" | 41 | #include "log.h" |
42 | #include "buffer.h" | ||
38 | #include "servconf.h" | 43 | #include "servconf.h" |
39 | #include "uidswap.h" | 44 | #include "uidswap.h" |
45 | #include "key.h" | ||
46 | #include "hostfile.h" | ||
40 | #include "auth.h" | 47 | #include "auth.h" |
41 | 48 | ||
42 | #ifdef KRB5 | 49 | #ifdef KRB5 |
50 | #include <errno.h> | ||
51 | #include <unistd.h> | ||
52 | #include <string.h> | ||
43 | #include <krb5.h> | 53 | #include <krb5.h> |
44 | 54 | ||
45 | extern ServerOptions options; | 55 | extern ServerOptions options; |
diff --git a/auth-options.c b/auth-options.c index ad97e6129..ca5e1c931 100644 --- a/auth-options.c +++ b/auth-options.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: auth-options.c,v 1.40 2006/08/03 03:34:41 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -10,18 +11,31 @@ | |||
10 | */ | 11 | */ |
11 | 12 | ||
12 | #include "includes.h" | 13 | #include "includes.h" |
13 | RCSID("$OpenBSD: auth-options.c,v 1.33 2005/12/08 18:34:11 reyk Exp $"); | 14 | |
15 | #include <sys/types.h> | ||
16 | |||
17 | #include <netdb.h> | ||
18 | #include <pwd.h> | ||
19 | #include <string.h> | ||
20 | #include <stdio.h> | ||
21 | #include <stdarg.h> | ||
14 | 22 | ||
15 | #include "xmalloc.h" | 23 | #include "xmalloc.h" |
16 | #include "match.h" | 24 | #include "match.h" |
17 | #include "log.h" | 25 | #include "log.h" |
18 | #include "canohost.h" | 26 | #include "canohost.h" |
27 | #include "buffer.h" | ||
19 | #include "channels.h" | 28 | #include "channels.h" |
20 | #include "auth-options.h" | 29 | #include "auth-options.h" |
21 | #include "servconf.h" | 30 | #include "servconf.h" |
22 | #include "misc.h" | 31 | #include "misc.h" |
23 | #include "monitor_wrap.h" | 32 | #include "key.h" |
33 | #include "hostfile.h" | ||
24 | #include "auth.h" | 34 | #include "auth.h" |
35 | #ifdef GSSAPI | ||
36 | #include "ssh-gss.h" | ||
37 | #endif | ||
38 | #include "monitor_wrap.h" | ||
25 | 39 | ||
26 | /* Flags set authorized_keys flags */ | 40 | /* Flags set authorized_keys flags */ |
27 | int no_port_forwarding_flag = 0; | 41 | int no_port_forwarding_flag = 0; |
@@ -131,7 +145,7 @@ auth_parse_options(struct passwd *pw, char *opts, char *file, u_long linenum) | |||
131 | forced_command = NULL; | 145 | forced_command = NULL; |
132 | goto bad_option; | 146 | goto bad_option; |
133 | } | 147 | } |
134 | forced_command[i] = 0; | 148 | forced_command[i] = '\0'; |
135 | auth_debug_add("Forced command: %.900s", forced_command); | 149 | auth_debug_add("Forced command: %.900s", forced_command); |
136 | opts++; | 150 | opts++; |
137 | goto next_option; | 151 | goto next_option; |
@@ -163,7 +177,7 @@ auth_parse_options(struct passwd *pw, char *opts, char *file, u_long linenum) | |||
163 | xfree(s); | 177 | xfree(s); |
164 | goto bad_option; | 178 | goto bad_option; |
165 | } | 179 | } |
166 | s[i] = 0; | 180 | s[i] = '\0'; |
167 | auth_debug_add("Adding to environment: %.900s", s); | 181 | auth_debug_add("Adding to environment: %.900s", s); |
168 | debug("Adding to environment: %.900s", s); | 182 | debug("Adding to environment: %.900s", s); |
169 | opts++; | 183 | opts++; |
@@ -200,7 +214,7 @@ auth_parse_options(struct passwd *pw, char *opts, char *file, u_long linenum) | |||
200 | xfree(patterns); | 214 | xfree(patterns); |
201 | goto bad_option; | 215 | goto bad_option; |
202 | } | 216 | } |
203 | patterns[i] = 0; | 217 | patterns[i] = '\0'; |
204 | opts++; | 218 | opts++; |
205 | if (match_host_and_ip(remote_host, remote_ip, | 219 | if (match_host_and_ip(remote_host, remote_ip, |
206 | patterns) != 1) { | 220 | patterns) != 1) { |
@@ -245,7 +259,7 @@ auth_parse_options(struct passwd *pw, char *opts, char *file, u_long linenum) | |||
245 | xfree(patterns); | 259 | xfree(patterns); |
246 | goto bad_option; | 260 | goto bad_option; |
247 | } | 261 | } |
248 | patterns[i] = 0; | 262 | patterns[i] = '\0'; |
249 | opts++; | 263 | opts++; |
250 | p = patterns; | 264 | p = patterns; |
251 | host = hpdelim(&p); | 265 | host = hpdelim(&p); |
@@ -293,7 +307,7 @@ auth_parse_options(struct passwd *pw, char *opts, char *file, u_long linenum) | |||
293 | forced_tun_device = -1; | 307 | forced_tun_device = -1; |
294 | goto bad_option; | 308 | goto bad_option; |
295 | } | 309 | } |
296 | tun[i] = 0; | 310 | tun[i] = '\0'; |
297 | forced_tun_device = a2tun(tun, NULL); | 311 | forced_tun_device = a2tun(tun, NULL); |
298 | xfree(tun); | 312 | xfree(tun); |
299 | if (forced_tun_device == SSH_TUNID_ERR) { | 313 | if (forced_tun_device == SSH_TUNID_ERR) { |
diff --git a/auth-options.h b/auth-options.h index 3cd02a71f..853f8b517 100644 --- a/auth-options.h +++ b/auth-options.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: auth-options.h,v 1.13 2005/12/06 22:38:27 reyk Exp $ */ | 1 | /* $OpenBSD: auth-options.h,v 1.16 2006/08/03 03:34:41 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
diff --git a/auth-pam.c b/auth-pam.c index fb9ae954a..c08d47229 100644 --- a/auth-pam.c +++ b/auth-pam.c | |||
@@ -47,7 +47,16 @@ | |||
47 | 47 | ||
48 | /* Based on $FreeBSD: src/crypto/openssh/auth2-pam-freebsd.c,v 1.11 2003/03/31 13:48:18 des Exp $ */ | 48 | /* Based on $FreeBSD: src/crypto/openssh/auth2-pam-freebsd.c,v 1.11 2003/03/31 13:48:18 des Exp $ */ |
49 | #include "includes.h" | 49 | #include "includes.h" |
50 | RCSID("$Id: auth-pam.c,v 1.128 2006/01/29 05:46:13 dtucker Exp $"); | 50 | |
51 | #include <sys/types.h> | ||
52 | #include <sys/stat.h> | ||
53 | #include <sys/wait.h> | ||
54 | |||
55 | #include <errno.h> | ||
56 | #include <signal.h> | ||
57 | #include <stdarg.h> | ||
58 | #include <string.h> | ||
59 | #include <unistd.h> | ||
51 | 60 | ||
52 | #ifdef USE_PAM | 61 | #ifdef USE_PAM |
53 | #if defined(HAVE_SECURITY_PAM_APPL_H) | 62 | #if defined(HAVE_SECURITY_PAM_APPL_H) |
@@ -63,20 +72,31 @@ RCSID("$Id: auth-pam.c,v 1.128 2006/01/29 05:46:13 dtucker Exp $"); | |||
63 | # define sshpam_const const /* LinuxPAM, OpenPAM */ | 72 | # define sshpam_const const /* LinuxPAM, OpenPAM */ |
64 | #endif | 73 | #endif |
65 | 74 | ||
75 | /* Ambiguity in spec: is it an array of pointers or a pointer to an array? */ | ||
76 | #ifdef PAM_SUN_CODEBASE | ||
77 | # define PAM_MSG_MEMBER(msg, n, member) ((*(msg))[(n)].member) | ||
78 | #else | ||
79 | # define PAM_MSG_MEMBER(msg, n, member) ((msg)[(n)]->member) | ||
80 | #endif | ||
81 | |||
82 | #include "xmalloc.h" | ||
83 | #include "buffer.h" | ||
84 | #include "key.h" | ||
85 | #include "hostfile.h" | ||
66 | #include "auth.h" | 86 | #include "auth.h" |
67 | #include "auth-pam.h" | 87 | #include "auth-pam.h" |
68 | #include "buffer.h" | ||
69 | #include "bufaux.h" | ||
70 | #include "canohost.h" | 88 | #include "canohost.h" |
71 | #include "log.h" | 89 | #include "log.h" |
72 | #include "monitor_wrap.h" | ||
73 | #include "msg.h" | 90 | #include "msg.h" |
74 | #include "packet.h" | 91 | #include "packet.h" |
75 | #include "misc.h" | 92 | #include "misc.h" |
76 | #include "servconf.h" | 93 | #include "servconf.h" |
77 | #include "ssh2.h" | 94 | #include "ssh2.h" |
78 | #include "xmalloc.h" | ||
79 | #include "auth-options.h" | 95 | #include "auth-options.h" |
96 | #ifdef GSSAPI | ||
97 | #include "ssh-gss.h" | ||
98 | #endif | ||
99 | #include "monitor_wrap.h" | ||
80 | 100 | ||
81 | extern ServerOptions options; | 101 | extern ServerOptions options; |
82 | extern Buffer loginmsg; | 102 | extern Buffer loginmsg; |
@@ -146,14 +166,16 @@ sshpam_sigchld_handler(int sig) | |||
146 | fatal("PAM: authentication thread exited uncleanly"); | 166 | fatal("PAM: authentication thread exited uncleanly"); |
147 | } | 167 | } |
148 | 168 | ||
169 | /* ARGSUSED */ | ||
149 | static void | 170 | static void |
150 | pthread_exit(void *value __unused) | 171 | pthread_exit(void *value) |
151 | { | 172 | { |
152 | _exit(0); | 173 | _exit(0); |
153 | } | 174 | } |
154 | 175 | ||
176 | /* ARGSUSED */ | ||
155 | static int | 177 | static int |
156 | pthread_create(sp_pthread_t *thread, const void *attr __unused, | 178 | pthread_create(sp_pthread_t *thread, const void *attr, |
157 | void *(*thread_start)(void *), void *arg) | 179 | void *(*thread_start)(void *), void *arg) |
158 | { | 180 | { |
159 | pid_t pid; | 181 | pid_t pid; |
@@ -185,8 +207,9 @@ pthread_cancel(sp_pthread_t thread) | |||
185 | return (kill(thread, SIGTERM)); | 207 | return (kill(thread, SIGTERM)); |
186 | } | 208 | } |
187 | 209 | ||
210 | /* ARGSUSED */ | ||
188 | static int | 211 | static int |
189 | pthread_join(sp_pthread_t thread, void **value __unused) | 212 | pthread_join(sp_pthread_t thread, void **value) |
190 | { | 213 | { |
191 | int status; | 214 | int status; |
192 | 215 | ||
@@ -284,7 +307,10 @@ import_environments(Buffer *b) | |||
284 | 307 | ||
285 | /* Import environment from subprocess */ | 308 | /* Import environment from subprocess */ |
286 | num_env = buffer_get_int(b); | 309 | num_env = buffer_get_int(b); |
287 | sshpam_env = xmalloc((num_env + 1) * sizeof(*sshpam_env)); | 310 | if (num_env > 1024) |
311 | fatal("%s: received %u environment variables, expected <= 1024", | ||
312 | __func__, num_env); | ||
313 | sshpam_env = xcalloc(num_env + 1, sizeof(*sshpam_env)); | ||
288 | debug3("PAM: num env strings %d", num_env); | 314 | debug3("PAM: num env strings %d", num_env); |
289 | for(i = 0; i < num_env; i++) | 315 | for(i = 0; i < num_env; i++) |
290 | sshpam_env[i] = buffer_get_string(b, NULL); | 316 | sshpam_env[i] = buffer_get_string(b, NULL); |
@@ -331,9 +357,8 @@ sshpam_thread_conv(int n, sshpam_const struct pam_message **msg, | |||
331 | if (n <= 0 || n > PAM_MAX_NUM_MSG) | 357 | if (n <= 0 || n > PAM_MAX_NUM_MSG) |
332 | return (PAM_CONV_ERR); | 358 | return (PAM_CONV_ERR); |
333 | 359 | ||
334 | if ((reply = malloc(n * sizeof(*reply))) == NULL) | 360 | if ((reply = calloc(n, sizeof(*reply))) == NULL) |
335 | return (PAM_CONV_ERR); | 361 | return (PAM_CONV_ERR); |
336 | memset(reply, 0, n * sizeof(*reply)); | ||
337 | 362 | ||
338 | buffer_init(&buffer); | 363 | buffer_init(&buffer); |
339 | for (i = 0; i < n; ++i) { | 364 | for (i = 0; i < n; ++i) { |
@@ -412,10 +437,16 @@ sshpam_thread(void *ctxtp) | |||
412 | u_int i; | 437 | u_int i; |
413 | const char *pam_user; | 438 | const char *pam_user; |
414 | const char **ptr_pam_user = &pam_user; | 439 | const char **ptr_pam_user = &pam_user; |
440 | char *tz = getenv("TZ"); | ||
415 | 441 | ||
416 | pam_get_item(sshpam_handle, PAM_USER, | 442 | pam_get_item(sshpam_handle, PAM_USER, |
417 | (sshpam_const void **)ptr_pam_user); | 443 | (sshpam_const void **)ptr_pam_user); |
444 | |||
418 | environ[0] = NULL; | 445 | environ[0] = NULL; |
446 | if (tz != NULL) | ||
447 | if (setenv("TZ", tz, 1) == -1) | ||
448 | error("PAM: could not set TZ environment: %s", | ||
449 | strerror(errno)); | ||
419 | 450 | ||
420 | if (sshpam_authctxt != NULL) { | 451 | if (sshpam_authctxt != NULL) { |
421 | setproctitle("%s [pam]", | 452 | setproctitle("%s [pam]", |
@@ -439,8 +470,10 @@ sshpam_thread(void *ctxtp) | |||
439 | goto auth_fail; | 470 | goto auth_fail; |
440 | 471 | ||
441 | if (compat20) { | 472 | if (compat20) { |
442 | if (!do_pam_account()) | 473 | if (!do_pam_account()) { |
474 | sshpam_err = PAM_ACCT_EXPIRED; | ||
443 | goto auth_fail; | 475 | goto auth_fail; |
476 | } | ||
444 | if (sshpam_authctxt->force_pwchange) { | 477 | if (sshpam_authctxt->force_pwchange) { |
445 | sshpam_err = pam_chauthtok(sshpam_handle, | 478 | sshpam_err = pam_chauthtok(sshpam_handle, |
446 | PAM_CHANGE_EXPIRED_AUTHTOK); | 479 | PAM_CHANGE_EXPIRED_AUTHTOK); |
@@ -482,7 +515,10 @@ sshpam_thread(void *ctxtp) | |||
482 | buffer_put_cstring(&buffer, | 515 | buffer_put_cstring(&buffer, |
483 | pam_strerror(sshpam_handle, sshpam_err)); | 516 | pam_strerror(sshpam_handle, sshpam_err)); |
484 | /* XXX - can't do much about an error here */ | 517 | /* XXX - can't do much about an error here */ |
485 | ssh_msg_send(ctxt->pam_csock, PAM_AUTH_ERR, &buffer); | 518 | if (sshpam_err == PAM_ACCT_EXPIRED) |
519 | ssh_msg_send(ctxt->pam_csock, PAM_ACCT_EXPIRED, &buffer); | ||
520 | else | ||
521 | ssh_msg_send(ctxt->pam_csock, PAM_AUTH_ERR, &buffer); | ||
486 | buffer_free(&buffer); | 522 | buffer_free(&buffer); |
487 | pthread_exit(NULL); | 523 | pthread_exit(NULL); |
488 | 524 | ||
@@ -529,9 +565,8 @@ sshpam_store_conv(int n, sshpam_const struct pam_message **msg, | |||
529 | if (n <= 0 || n > PAM_MAX_NUM_MSG) | 565 | if (n <= 0 || n > PAM_MAX_NUM_MSG) |
530 | return (PAM_CONV_ERR); | 566 | return (PAM_CONV_ERR); |
531 | 567 | ||
532 | if ((reply = malloc(n * sizeof(*reply))) == NULL) | 568 | if ((reply = calloc(n, sizeof(*reply))) == NULL) |
533 | return (PAM_CONV_ERR); | 569 | return (PAM_CONV_ERR); |
534 | memset(reply, 0, n * sizeof(*reply)); | ||
535 | 570 | ||
536 | for (i = 0; i < n; ++i) { | 571 | for (i = 0; i < n; ++i) { |
537 | switch (PAM_MSG_MEMBER(msg, i, msg_style)) { | 572 | switch (PAM_MSG_MEMBER(msg, i, msg_style)) { |
@@ -638,8 +673,11 @@ sshpam_init_ctx(Authctxt *authctxt) | |||
638 | int socks[2]; | 673 | int socks[2]; |
639 | 674 | ||
640 | debug3("PAM: %s entering", __func__); | 675 | debug3("PAM: %s entering", __func__); |
641 | /* Refuse to start if we don't have PAM enabled */ | 676 | /* |
642 | if (!options.use_pam) | 677 | * Refuse to start if we don't have PAM enabled or do_pam_account |
678 | * has previously failed. | ||
679 | */ | ||
680 | if (!options.use_pam || sshpam_account_status == 0) | ||
643 | return NULL; | 681 | return NULL; |
644 | 682 | ||
645 | /* Initialize PAM */ | 683 | /* Initialize PAM */ |
@@ -699,7 +737,7 @@ sshpam_query(void *ctx, char **name, char **info, | |||
699 | case PAM_PROMPT_ECHO_OFF: | 737 | case PAM_PROMPT_ECHO_OFF: |
700 | *num = 1; | 738 | *num = 1; |
701 | len = plen + mlen + 1; | 739 | len = plen + mlen + 1; |
702 | **prompts = xrealloc(**prompts, len); | 740 | **prompts = xrealloc(**prompts, 1, len); |
703 | strlcpy(**prompts + plen, msg, len - plen); | 741 | strlcpy(**prompts + plen, msg, len - plen); |
704 | plen += mlen; | 742 | plen += mlen; |
705 | **echo_on = (type == PAM_PROMPT_ECHO_ON); | 743 | **echo_on = (type == PAM_PROMPT_ECHO_ON); |
@@ -709,21 +747,25 @@ sshpam_query(void *ctx, char **name, char **info, | |||
709 | case PAM_TEXT_INFO: | 747 | case PAM_TEXT_INFO: |
710 | /* accumulate messages */ | 748 | /* accumulate messages */ |
711 | len = plen + mlen + 2; | 749 | len = plen + mlen + 2; |
712 | **prompts = xrealloc(**prompts, len); | 750 | **prompts = xrealloc(**prompts, 1, len); |
713 | strlcpy(**prompts + plen, msg, len - plen); | 751 | strlcpy(**prompts + plen, msg, len - plen); |
714 | plen += mlen; | 752 | plen += mlen; |
715 | strlcat(**prompts + plen, "\n", len - plen); | 753 | strlcat(**prompts + plen, "\n", len - plen); |
716 | plen++; | 754 | plen++; |
717 | xfree(msg); | 755 | xfree(msg); |
718 | break; | 756 | break; |
757 | case PAM_ACCT_EXPIRED: | ||
758 | sshpam_account_status = 0; | ||
759 | /* FALLTHROUGH */ | ||
719 | case PAM_AUTH_ERR: | 760 | case PAM_AUTH_ERR: |
720 | debug3("PAM: PAM_AUTH_ERR"); | 761 | debug3("PAM: %s", pam_strerror(sshpam_handle, type)); |
721 | if (**prompts != NULL && strlen(**prompts) != 0) { | 762 | if (**prompts != NULL && strlen(**prompts) != 0) { |
722 | *info = **prompts; | 763 | *info = **prompts; |
723 | **prompts = NULL; | 764 | **prompts = NULL; |
724 | *num = 0; | 765 | *num = 0; |
725 | **echo_on = 0; | 766 | **echo_on = 0; |
726 | ctxt->pam_done = -1; | 767 | ctxt->pam_done = -1; |
768 | xfree(msg); | ||
727 | return 0; | 769 | return 0; |
728 | } | 770 | } |
729 | /* FALLTHROUGH */ | 771 | /* FALLTHROUGH */ |
@@ -930,9 +972,8 @@ sshpam_tty_conv(int n, sshpam_const struct pam_message **msg, | |||
930 | if (n <= 0 || n > PAM_MAX_NUM_MSG || !isatty(STDIN_FILENO)) | 972 | if (n <= 0 || n > PAM_MAX_NUM_MSG || !isatty(STDIN_FILENO)) |
931 | return (PAM_CONV_ERR); | 973 | return (PAM_CONV_ERR); |
932 | 974 | ||
933 | if ((reply = malloc(n * sizeof(*reply))) == NULL) | 975 | if ((reply = calloc(n, sizeof(*reply))) == NULL) |
934 | return (PAM_CONV_ERR); | 976 | return (PAM_CONV_ERR); |
935 | memset(reply, 0, n * sizeof(*reply)); | ||
936 | 977 | ||
937 | for (i = 0; i < n; ++i) { | 978 | for (i = 0; i < n; ++i) { |
938 | switch (PAM_MSG_MEMBER(msg, i, msg_style)) { | 979 | switch (PAM_MSG_MEMBER(msg, i, msg_style)) { |
diff --git a/auth-passwd.c b/auth-passwd.c index 6e6d0d76a..be6283796 100644 --- a/auth-passwd.c +++ b/auth-passwd.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: auth-passwd.c,v 1.40 2006/08/03 03:34:41 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -36,12 +37,20 @@ | |||
36 | */ | 37 | */ |
37 | 38 | ||
38 | #include "includes.h" | 39 | #include "includes.h" |
39 | RCSID("$OpenBSD: auth-passwd.c,v 1.34 2005/07/19 15:32:26 otto Exp $"); | 40 | |
41 | #include <sys/types.h> | ||
42 | |||
43 | #include <pwd.h> | ||
44 | #include <stdio.h> | ||
45 | #include <string.h> | ||
46 | #include <stdarg.h> | ||
40 | 47 | ||
41 | #include "packet.h" | 48 | #include "packet.h" |
42 | #include "buffer.h" | 49 | #include "buffer.h" |
43 | #include "log.h" | 50 | #include "log.h" |
44 | #include "servconf.h" | 51 | #include "servconf.h" |
52 | #include "key.h" | ||
53 | #include "hostfile.h" | ||
45 | #include "auth.h" | 54 | #include "auth.h" |
46 | #include "auth-options.h" | 55 | #include "auth-options.h" |
47 | 56 | ||
diff --git a/auth-rh-rsa.c b/auth-rh-rsa.c index c31f2b97b..eca750275 100644 --- a/auth-rh-rsa.c +++ b/auth-rh-rsa.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: auth-rh-rsa.c,v 1.42 2006/08/03 03:34:41 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -13,18 +14,25 @@ | |||
13 | */ | 14 | */ |
14 | 15 | ||
15 | #include "includes.h" | 16 | #include "includes.h" |
16 | RCSID("$OpenBSD: auth-rh-rsa.c,v 1.38 2005/07/17 07:17:54 djm Exp $"); | 17 | |
18 | #include <sys/types.h> | ||
19 | |||
20 | #include <pwd.h> | ||
21 | #include <stdarg.h> | ||
17 | 22 | ||
18 | #include "packet.h" | 23 | #include "packet.h" |
19 | #include "uidswap.h" | 24 | #include "uidswap.h" |
20 | #include "log.h" | 25 | #include "log.h" |
26 | #include "buffer.h" | ||
21 | #include "servconf.h" | 27 | #include "servconf.h" |
22 | #include "key.h" | 28 | #include "key.h" |
23 | #include "hostfile.h" | 29 | #include "hostfile.h" |
24 | #include "pathnames.h" | 30 | #include "pathnames.h" |
25 | #include "auth.h" | 31 | #include "auth.h" |
26 | #include "canohost.h" | 32 | #include "canohost.h" |
27 | 33 | #ifdef GSSAPI | |
34 | #include "ssh-gss.h" | ||
35 | #endif | ||
28 | #include "monitor_wrap.h" | 36 | #include "monitor_wrap.h" |
29 | 37 | ||
30 | /* import */ | 38 | /* import */ |
diff --git a/auth-rhosts.c b/auth-rhosts.c index aaba8557e..cd0a7967a 100644 --- a/auth-rhosts.c +++ b/auth-rhosts.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: auth-rhosts.c,v 1.41 2006/08/03 03:34:41 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -14,14 +15,27 @@ | |||
14 | */ | 15 | */ |
15 | 16 | ||
16 | #include "includes.h" | 17 | #include "includes.h" |
17 | RCSID("$OpenBSD: auth-rhosts.c,v 1.33 2005/07/17 07:17:54 djm Exp $"); | 18 | |
19 | #include <sys/types.h> | ||
20 | #include <sys/stat.h> | ||
21 | |||
22 | #ifdef HAVE_NETGROUP_H | ||
23 | # include <netgroup.h> | ||
24 | #endif | ||
25 | #include <pwd.h> | ||
26 | #include <stdio.h> | ||
27 | #include <string.h> | ||
28 | #include <stdarg.h> | ||
18 | 29 | ||
19 | #include "packet.h" | 30 | #include "packet.h" |
31 | #include "buffer.h" | ||
20 | #include "uidswap.h" | 32 | #include "uidswap.h" |
21 | #include "pathnames.h" | 33 | #include "pathnames.h" |
22 | #include "log.h" | 34 | #include "log.h" |
23 | #include "servconf.h" | 35 | #include "servconf.h" |
24 | #include "canohost.h" | 36 | #include "canohost.h" |
37 | #include "key.h" | ||
38 | #include "hostfile.h" | ||
25 | #include "auth.h" | 39 | #include "auth.h" |
26 | 40 | ||
27 | /* import */ | 41 | /* import */ |
diff --git a/auth-rsa.c b/auth-rsa.c index d9c9652dc..69f9a5896 100644 --- a/auth-rsa.c +++ b/auth-rsa.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: auth-rsa.c,v 1.72 2006/11/06 21:25:27 markus Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -14,23 +15,35 @@ | |||
14 | */ | 15 | */ |
15 | 16 | ||
16 | #include "includes.h" | 17 | #include "includes.h" |
17 | RCSID("$OpenBSD: auth-rsa.c,v 1.63 2005/06/17 02:44:32 djm Exp $"); | 18 | |
19 | #include <sys/types.h> | ||
20 | #include <sys/stat.h> | ||
18 | 21 | ||
19 | #include <openssl/rsa.h> | 22 | #include <openssl/rsa.h> |
20 | #include <openssl/md5.h> | 23 | #include <openssl/md5.h> |
21 | 24 | ||
25 | #include <pwd.h> | ||
26 | #include <stdio.h> | ||
27 | #include <stdarg.h> | ||
28 | #include <string.h> | ||
29 | |||
30 | #include "xmalloc.h" | ||
22 | #include "rsa.h" | 31 | #include "rsa.h" |
23 | #include "packet.h" | 32 | #include "packet.h" |
24 | #include "xmalloc.h" | ||
25 | #include "ssh1.h" | 33 | #include "ssh1.h" |
26 | #include "uidswap.h" | 34 | #include "uidswap.h" |
27 | #include "match.h" | 35 | #include "match.h" |
36 | #include "buffer.h" | ||
28 | #include "auth-options.h" | 37 | #include "auth-options.h" |
29 | #include "pathnames.h" | 38 | #include "pathnames.h" |
30 | #include "log.h" | 39 | #include "log.h" |
31 | #include "servconf.h" | 40 | #include "servconf.h" |
32 | #include "auth.h" | 41 | #include "key.h" |
33 | #include "hostfile.h" | 42 | #include "hostfile.h" |
43 | #include "auth.h" | ||
44 | #ifdef GSSAPI | ||
45 | #include "ssh-gss.h" | ||
46 | #endif | ||
34 | #include "monitor_wrap.h" | 47 | #include "monitor_wrap.h" |
35 | #include "ssh.h" | 48 | #include "ssh.h" |
36 | #include "misc.h" | 49 | #include "misc.h" |
@@ -63,10 +76,12 @@ auth_rsa_generate_challenge(Key *key) | |||
63 | if ((challenge = BN_new()) == NULL) | 76 | if ((challenge = BN_new()) == NULL) |
64 | fatal("auth_rsa_generate_challenge: BN_new() failed"); | 77 | fatal("auth_rsa_generate_challenge: BN_new() failed"); |
65 | /* Generate a random challenge. */ | 78 | /* Generate a random challenge. */ |
66 | BN_rand(challenge, 256, 0, 0); | 79 | if (BN_rand(challenge, 256, 0, 0) == 0) |
80 | fatal("auth_rsa_generate_challenge: BN_rand failed"); | ||
67 | if ((ctx = BN_CTX_new()) == NULL) | 81 | if ((ctx = BN_CTX_new()) == NULL) |
68 | fatal("auth_rsa_generate_challenge: BN_CTX_new() failed"); | 82 | fatal("auth_rsa_generate_challenge: BN_CTX_new failed"); |
69 | BN_mod(challenge, challenge, key->rsa->n, ctx); | 83 | if (BN_mod(challenge, challenge, key->rsa->n, ctx) == 0) |
84 | fatal("auth_rsa_generate_challenge: BN_mod failed"); | ||
70 | BN_CTX_free(ctx); | 85 | BN_CTX_free(ctx); |
71 | 86 | ||
72 | return challenge; | 87 | return challenge; |
@@ -137,7 +152,7 @@ auth_rsa_challenge_dialog(Key *key) | |||
137 | /* Wait for a response. */ | 152 | /* Wait for a response. */ |
138 | packet_read_expect(SSH_CMSG_AUTH_RSA_RESPONSE); | 153 | packet_read_expect(SSH_CMSG_AUTH_RSA_RESPONSE); |
139 | for (i = 0; i < 16; i++) | 154 | for (i = 0; i < 16; i++) |
140 | response[i] = packet_get_char(); | 155 | response[i] = (u_char)packet_get_char(); |
141 | packet_check_eom(); | 156 | packet_check_eom(); |
142 | 157 | ||
143 | success = PRIVSEP(auth_rsa_verify_response(key, challenge, response)); | 158 | success = PRIVSEP(auth_rsa_verify_response(key, challenge, response)); |
diff --git a/auth-shadow.c b/auth-shadow.c index 59737b93c..8b3160aee 100644 --- a/auth-shadow.c +++ b/auth-shadow.c | |||
@@ -23,11 +23,14 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | RCSID("$Id: auth-shadow.c,v 1.7 2005/07/17 07:04:47 djm Exp $"); | ||
27 | 26 | ||
28 | #if defined(USE_SHADOW) && defined(HAS_SHADOW_EXPIRE) | 27 | #if defined(USE_SHADOW) && defined(HAS_SHADOW_EXPIRE) |
29 | #include <shadow.h> | 28 | #include <shadow.h> |
29 | #include <stdarg.h> | ||
30 | #include <string.h> | ||
30 | 31 | ||
32 | #include "key.h" | ||
33 | #include "hostfile.h" | ||
31 | #include "auth.h" | 34 | #include "auth.h" |
32 | #include "buffer.h" | 35 | #include "buffer.h" |
33 | #include "log.h" | 36 | #include "log.h" |
diff --git a/auth-sia.c b/auth-sia.c index af7182b48..a9e1c258c 100644 --- a/auth-sia.c +++ b/auth-sia.c | |||
@@ -25,14 +25,6 @@ | |||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | 26 | ||
27 | #ifdef HAVE_OSF_SIA | 27 | #ifdef HAVE_OSF_SIA |
28 | #include "ssh.h" | ||
29 | #include "auth.h" | ||
30 | #include "auth-sia.h" | ||
31 | #include "log.h" | ||
32 | #include "servconf.h" | ||
33 | #include "canohost.h" | ||
34 | #include "uidswap.h" | ||
35 | |||
36 | #include <sia.h> | 28 | #include <sia.h> |
37 | #include <siad.h> | 29 | #include <siad.h> |
38 | #include <pwd.h> | 30 | #include <pwd.h> |
@@ -40,8 +32,19 @@ | |||
40 | #include <setjmp.h> | 32 | #include <setjmp.h> |
41 | #include <sys/resource.h> | 33 | #include <sys/resource.h> |
42 | #include <unistd.h> | 34 | #include <unistd.h> |
35 | #include <stdarg.h> | ||
43 | #include <string.h> | 36 | #include <string.h> |
44 | 37 | ||
38 | #include "ssh.h" | ||
39 | #include "key.h" | ||
40 | #include "hostfile.h" | ||
41 | #include "auth.h" | ||
42 | #include "auth-sia.h" | ||
43 | #include "log.h" | ||
44 | #include "servconf.h" | ||
45 | #include "canohost.h" | ||
46 | #include "uidswap.h" | ||
47 | |||
45 | extern ServerOptions options; | 48 | extern ServerOptions options; |
46 | extern int saved_argc; | 49 | extern int saved_argc; |
47 | extern char **saved_argv; | 50 | extern char **saved_argv; |
diff --git a/auth-skey.c b/auth-skey.c index f676dbec9..cb43dba48 100644 --- a/auth-skey.c +++ b/auth-skey.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: auth-skey.c,v 1.27 2007/01/21 01:41:54 stevesk Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
3 | * | 4 | * |
@@ -21,15 +22,23 @@ | |||
21 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
22 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 24 | */ |
25 | |||
24 | #include "includes.h" | 26 | #include "includes.h" |
25 | RCSID("$OpenBSD: auth-skey.c,v 1.20 2002/06/30 21:59:45 deraadt Exp $"); | ||
26 | 27 | ||
27 | #ifdef SKEY | 28 | #ifdef SKEY |
28 | 29 | ||
30 | #include <sys/types.h> | ||
31 | |||
32 | #include <pwd.h> | ||
33 | #include <stdio.h> | ||
34 | |||
29 | #include <skey.h> | 35 | #include <skey.h> |
30 | 36 | ||
31 | #include "xmalloc.h" | 37 | #include "xmalloc.h" |
38 | #include "key.h" | ||
39 | #include "hostfile.h" | ||
32 | #include "auth.h" | 40 | #include "auth.h" |
41 | #include "ssh-gss.h" | ||
33 | #include "monitor_wrap.h" | 42 | #include "monitor_wrap.h" |
34 | 43 | ||
35 | static void * | 44 | static void * |
@@ -43,26 +52,20 @@ skey_query(void *ctx, char **name, char **infotxt, | |||
43 | u_int* numprompts, char ***prompts, u_int **echo_on) | 52 | u_int* numprompts, char ***prompts, u_int **echo_on) |
44 | { | 53 | { |
45 | Authctxt *authctxt = ctx; | 54 | Authctxt *authctxt = ctx; |
46 | char challenge[1024], *p; | 55 | char challenge[1024]; |
47 | int len; | ||
48 | struct skey skey; | 56 | struct skey skey; |
49 | 57 | ||
50 | if (_compat_skeychallenge(&skey, authctxt->user, challenge, | 58 | if (_compat_skeychallenge(&skey, authctxt->user, challenge, |
51 | sizeof(challenge)) == -1) | 59 | sizeof(challenge)) == -1) |
52 | return -1; | 60 | return -1; |
53 | 61 | ||
54 | *name = xstrdup(""); | 62 | *name = xstrdup(""); |
55 | *infotxt = xstrdup(""); | 63 | *infotxt = xstrdup(""); |
56 | *numprompts = 1; | 64 | *numprompts = 1; |
57 | *prompts = xmalloc(*numprompts * sizeof(char *)); | 65 | *prompts = xcalloc(*numprompts, sizeof(char *)); |
58 | *echo_on = xmalloc(*numprompts * sizeof(u_int)); | 66 | *echo_on = xcalloc(*numprompts, sizeof(u_int)); |
59 | (*echo_on)[0] = 0; | 67 | |
60 | 68 | xasprintf(*prompts, "%s%s", challenge, SKEY_PROMPT); | |
61 | len = strlen(challenge) + strlen(SKEY_PROMPT) + 1; | ||
62 | p = xmalloc(len); | ||
63 | strlcpy(p, challenge, len); | ||
64 | strlcat(p, SKEY_PROMPT, len); | ||
65 | (*prompts)[0] = p; | ||
66 | 69 | ||
67 | return 0; | 70 | return 0; |
68 | } | 71 | } |
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: auth.c,v 1.75 2006/08/03 03:34:41 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
3 | * | 4 | * |
@@ -23,39 +24,56 @@ | |||
23 | */ | 24 | */ |
24 | 25 | ||
25 | #include "includes.h" | 26 | #include "includes.h" |
26 | RCSID("$OpenBSD: auth.c,v 1.60 2005/06/17 02:44:32 djm Exp $"); | ||
27 | 27 | ||
28 | #include <sys/types.h> | ||
29 | #include <sys/stat.h> | ||
30 | #include <sys/param.h> | ||
31 | |||
32 | #include <netinet/in.h> | ||
33 | |||
34 | #include <errno.h> | ||
35 | #ifdef HAVE_PATHS_H | ||
36 | # include <paths.h> | ||
37 | #endif | ||
38 | #include <pwd.h> | ||
28 | #ifdef HAVE_LOGIN_H | 39 | #ifdef HAVE_LOGIN_H |
29 | #include <login.h> | 40 | #include <login.h> |
30 | #endif | 41 | #endif |
31 | #ifdef USE_SHADOW | 42 | #ifdef USE_SHADOW |
32 | #include <shadow.h> | 43 | #include <shadow.h> |
33 | #endif | 44 | #endif |
34 | |||
35 | #ifdef HAVE_LIBGEN_H | 45 | #ifdef HAVE_LIBGEN_H |
36 | #include <libgen.h> | 46 | #include <libgen.h> |
37 | #endif | 47 | #endif |
48 | #include <stdarg.h> | ||
49 | #include <stdio.h> | ||
50 | #include <string.h> | ||
38 | 51 | ||
39 | #include "xmalloc.h" | 52 | #include "xmalloc.h" |
40 | #include "match.h" | 53 | #include "match.h" |
41 | #include "groupaccess.h" | 54 | #include "groupaccess.h" |
42 | #include "log.h" | 55 | #include "log.h" |
56 | #include "buffer.h" | ||
43 | #include "servconf.h" | 57 | #include "servconf.h" |
58 | #include "key.h" | ||
59 | #include "hostfile.h" | ||
44 | #include "auth.h" | 60 | #include "auth.h" |
45 | #include "auth-options.h" | 61 | #include "auth-options.h" |
46 | #include "canohost.h" | 62 | #include "canohost.h" |
47 | #include "buffer.h" | ||
48 | #include "bufaux.h" | ||
49 | #include "uidswap.h" | 63 | #include "uidswap.h" |
50 | #include "misc.h" | 64 | #include "misc.h" |
51 | #include "bufaux.h" | ||
52 | #include "packet.h" | 65 | #include "packet.h" |
53 | #include "loginrec.h" | 66 | #include "loginrec.h" |
67 | #ifdef GSSAPI | ||
68 | #include "ssh-gss.h" | ||
69 | #endif | ||
54 | #include "monitor_wrap.h" | 70 | #include "monitor_wrap.h" |
55 | 71 | ||
56 | /* import */ | 72 | /* import */ |
57 | extern ServerOptions options; | 73 | extern ServerOptions options; |
74 | extern int use_privsep; | ||
58 | extern Buffer loginmsg; | 75 | extern Buffer loginmsg; |
76 | extern struct passwd *privsep_pw; | ||
59 | 77 | ||
60 | /* Debugging messages */ | 78 | /* Debugging messages */ |
61 | Buffer auth_debug; | 79 | Buffer auth_debug; |
@@ -231,6 +249,9 @@ auth_log(Authctxt *authctxt, int authenticated, char *method, char *info) | |||
231 | void (*authlog) (const char *fmt,...) = verbose; | 249 | void (*authlog) (const char *fmt,...) = verbose; |
232 | char *authmsg; | 250 | char *authmsg; |
233 | 251 | ||
252 | if (use_privsep && !mm_is_monitor() && !authctxt->postponed) | ||
253 | return; | ||
254 | |||
234 | /* Raise logging level */ | 255 | /* Raise logging level */ |
235 | if (authenticated == 1 || | 256 | if (authenticated == 1 || |
236 | !authctxt->valid || | 257 | !authctxt->valid || |
@@ -259,44 +280,15 @@ auth_log(Authctxt *authctxt, int authenticated, char *method, char *info) | |||
259 | strcmp(method, "challenge-response") == 0)) | 280 | strcmp(method, "challenge-response") == 0)) |
260 | record_failed_login(authctxt->user, | 281 | record_failed_login(authctxt->user, |
261 | get_canonical_hostname(options.use_dns), "ssh"); | 282 | get_canonical_hostname(options.use_dns), "ssh"); |
283 | # ifdef WITH_AIXAUTHENTICATE | ||
284 | if (authenticated) | ||
285 | sys_auth_record_login(authctxt->user, | ||
286 | get_canonical_hostname(options.use_dns), "ssh", &loginmsg); | ||
287 | # endif | ||
262 | #endif | 288 | #endif |
263 | #ifdef SSH_AUDIT_EVENTS | 289 | #ifdef SSH_AUDIT_EVENTS |
264 | if (authenticated == 0 && !authctxt->postponed) { | 290 | if (authenticated == 0 && !authctxt->postponed) |
265 | ssh_audit_event_t event; | 291 | audit_event(audit_classify_auth(method)); |
266 | |||
267 | debug3("audit failed auth attempt, method %s euid %d", | ||
268 | method, (int)geteuid()); | ||
269 | /* | ||
270 | * Because the auth loop is used in both monitor and slave, | ||
271 | * we must be careful to send each event only once and with | ||
272 | * enough privs to write the event. | ||
273 | */ | ||
274 | event = audit_classify_auth(method); | ||
275 | switch(event) { | ||
276 | case SSH_AUTH_FAIL_NONE: | ||
277 | case SSH_AUTH_FAIL_PASSWD: | ||
278 | case SSH_AUTH_FAIL_KBDINT: | ||
279 | if (geteuid() == 0) | ||
280 | audit_event(event); | ||
281 | break; | ||
282 | case SSH_AUTH_FAIL_PUBKEY: | ||
283 | case SSH_AUTH_FAIL_HOSTBASED: | ||
284 | case SSH_AUTH_FAIL_GSSAPI: | ||
285 | /* | ||
286 | * This is required to handle the case where privsep | ||
287 | * is enabled but it's root logging in, since | ||
288 | * use_privsep won't be cleared until after a | ||
289 | * successful login. | ||
290 | */ | ||
291 | if (geteuid() == 0) | ||
292 | audit_event(event); | ||
293 | else | ||
294 | PRIVSEP(audit_event(event)); | ||
295 | break; | ||
296 | default: | ||
297 | error("unknown authentication audit event %d", event); | ||
298 | } | ||
299 | } | ||
300 | #endif | 292 | #endif |
301 | } | 293 | } |
302 | 294 | ||
@@ -309,7 +301,6 @@ auth_root_allowed(char *method) | |||
309 | switch (options.permit_root_login) { | 301 | switch (options.permit_root_login) { |
310 | case PERMIT_YES: | 302 | case PERMIT_YES: |
311 | return 1; | 303 | return 1; |
312 | break; | ||
313 | case PERMIT_NO_PASSWD: | 304 | case PERMIT_NO_PASSWD: |
314 | if (strcmp(method, "password") != 0) | 305 | if (strcmp(method, "password") != 0) |
315 | return 1; | 306 | return 1; |
@@ -336,7 +327,8 @@ auth_root_allowed(char *method) | |||
336 | static char * | 327 | static char * |
337 | expand_authorized_keys(const char *filename, struct passwd *pw) | 328 | expand_authorized_keys(const char *filename, struct passwd *pw) |
338 | { | 329 | { |
339 | char *file, *ret; | 330 | char *file, ret[MAXPATHLEN]; |
331 | int i; | ||
340 | 332 | ||
341 | file = percent_expand(filename, "h", pw->pw_dir, | 333 | file = percent_expand(filename, "h", pw->pw_dir, |
342 | "u", pw->pw_name, (char *)NULL); | 334 | "u", pw->pw_name, (char *)NULL); |
@@ -348,14 +340,11 @@ expand_authorized_keys(const char *filename, struct passwd *pw) | |||
348 | if (*file == '/') | 340 | if (*file == '/') |
349 | return (file); | 341 | return (file); |
350 | 342 | ||
351 | ret = xmalloc(MAXPATHLEN); | 343 | i = snprintf(ret, sizeof(ret), "%s/%s", pw->pw_dir, file); |
352 | if (strlcpy(ret, pw->pw_dir, MAXPATHLEN) >= MAXPATHLEN || | 344 | if (i < 0 || (size_t)i >= sizeof(ret)) |
353 | strlcat(ret, "/", MAXPATHLEN) >= MAXPATHLEN || | ||
354 | strlcat(ret, file, MAXPATHLEN) >= MAXPATHLEN) | ||
355 | fatal("expand_authorized_keys: path too long"); | 345 | fatal("expand_authorized_keys: path too long"); |
356 | |||
357 | xfree(file); | 346 | xfree(file); |
358 | return (ret); | 347 | return (xstrdup(ret)); |
359 | } | 348 | } |
360 | 349 | ||
361 | char * | 350 | char * |
@@ -492,6 +481,9 @@ getpwnamallow(const char *user) | |||
492 | #endif | 481 | #endif |
493 | struct passwd *pw; | 482 | struct passwd *pw; |
494 | 483 | ||
484 | parse_server_match_config(&options, user, | ||
485 | get_canonical_hostname(options.use_dns), get_remote_ipaddr()); | ||
486 | |||
495 | pw = getpwnam(user); | 487 | pw = getpwnam(user); |
496 | if (pw == NULL) { | 488 | if (pw == NULL) { |
497 | logit("Invalid user %.100s from %.100s", | 489 | logit("Invalid user %.100s from %.100s", |
@@ -577,8 +569,8 @@ fakepw(void) | |||
577 | fake.pw_passwd = | 569 | fake.pw_passwd = |
578 | "$2a$06$r3.juUaHZDlIbQaO2dS9FuYxL1W9M81R1Tc92PoSNmzvpEqLkLGrK"; | 570 | "$2a$06$r3.juUaHZDlIbQaO2dS9FuYxL1W9M81R1Tc92PoSNmzvpEqLkLGrK"; |
579 | fake.pw_gecos = "NOUSER"; | 571 | fake.pw_gecos = "NOUSER"; |
580 | fake.pw_uid = (uid_t)-1; | 572 | fake.pw_uid = privsep_pw == NULL ? (uid_t)-1 : privsep_pw->pw_uid; |
581 | fake.pw_gid = (gid_t)-1; | 573 | fake.pw_gid = privsep_pw == NULL ? (gid_t)-1 : privsep_pw->pw_gid; |
582 | #ifdef HAVE_PW_CLASS_IN_PASSWD | 574 | #ifdef HAVE_PW_CLASS_IN_PASSWD |
583 | fake.pw_class = ""; | 575 | fake.pw_class = ""; |
584 | #endif | 576 | #endif |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: auth.h,v 1.51 2005/06/06 11:20:36 djm Exp $ */ | 1 | /* $OpenBSD: auth.h,v 1.58 2006/08/18 09:15:20 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
@@ -28,9 +28,8 @@ | |||
28 | #ifndef AUTH_H | 28 | #ifndef AUTH_H |
29 | #define AUTH_H | 29 | #define AUTH_H |
30 | 30 | ||
31 | #include "key.h" | 31 | #include <signal.h> |
32 | #include "hostfile.h" | 32 | |
33 | #include "buffer.h" | ||
34 | #include <openssl/rsa.h> | 33 | #include <openssl/rsa.h> |
35 | 34 | ||
36 | #ifdef HAVE_LOGIN_CAP | 35 | #ifdef HAVE_LOGIN_CAP |
@@ -48,7 +47,7 @@ typedef struct Authmethod Authmethod; | |||
48 | typedef struct KbdintDevice KbdintDevice; | 47 | typedef struct KbdintDevice KbdintDevice; |
49 | 48 | ||
50 | struct Authctxt { | 49 | struct Authctxt { |
51 | int success; | 50 | sig_atomic_t success; |
52 | int authenticated; /* authenticated and alarms cancelled */ | 51 | int authenticated; /* authenticated and alarms cancelled */ |
53 | int postponed; /* authentication needs another step */ | 52 | int postponed; /* authentication needs another step */ |
54 | int valid; /* user exists and is allowed to login */ | 53 | int valid; /* user exists and is allowed to login */ |
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: auth1.c,v 1.70 2006/08/03 03:34:41 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
3 | * All rights reserved | 4 | * All rights reserved |
@@ -10,7 +11,14 @@ | |||
10 | */ | 11 | */ |
11 | 12 | ||
12 | #include "includes.h" | 13 | #include "includes.h" |
13 | RCSID("$OpenBSD: auth1.c,v 1.62 2005/07/16 01:35:24 djm Exp $"); | 14 | |
15 | #include <sys/types.h> | ||
16 | |||
17 | #include <stdarg.h> | ||
18 | #include <stdio.h> | ||
19 | #include <string.h> | ||
20 | #include <unistd.h> | ||
21 | #include <pwd.h> | ||
14 | 22 | ||
15 | #include "xmalloc.h" | 23 | #include "xmalloc.h" |
16 | #include "rsa.h" | 24 | #include "rsa.h" |
@@ -20,10 +28,15 @@ RCSID("$OpenBSD: auth1.c,v 1.62 2005/07/16 01:35:24 djm Exp $"); | |||
20 | #include "log.h" | 28 | #include "log.h" |
21 | #include "servconf.h" | 29 | #include "servconf.h" |
22 | #include "compat.h" | 30 | #include "compat.h" |
31 | #include "key.h" | ||
32 | #include "hostfile.h" | ||
23 | #include "auth.h" | 33 | #include "auth.h" |
24 | #include "channels.h" | 34 | #include "channels.h" |
25 | #include "session.h" | 35 | #include "session.h" |
26 | #include "uidswap.h" | 36 | #include "uidswap.h" |
37 | #ifdef GSSAPI | ||
38 | #include "ssh-gss.h" | ||
39 | #endif | ||
27 | #include "monitor_wrap.h" | 40 | #include "monitor_wrap.h" |
28 | #include "buffer.h" | 41 | #include "buffer.h" |
29 | 42 | ||
@@ -77,7 +90,7 @@ static const struct AuthMethod1 | |||
77 | { | 90 | { |
78 | int i; | 91 | int i; |
79 | 92 | ||
80 | for(i = 0; auth1_methods[i].name != NULL; i++) | 93 | for (i = 0; auth1_methods[i].name != NULL; i++) |
81 | if (auth1_methods[i].type == type) | 94 | if (auth1_methods[i].type == type) |
82 | return (&(auth1_methods[i])); | 95 | return (&(auth1_methods[i])); |
83 | 96 | ||
@@ -96,6 +109,7 @@ get_authname(int type) | |||
96 | return (buf); | 109 | return (buf); |
97 | } | 110 | } |
98 | 111 | ||
112 | /*ARGSUSED*/ | ||
99 | static int | 113 | static int |
100 | auth1_process_password(Authctxt *authctxt, char *info, size_t infolen) | 114 | auth1_process_password(Authctxt *authctxt, char *info, size_t infolen) |
101 | { | 115 | { |
@@ -120,6 +134,7 @@ auth1_process_password(Authctxt *authctxt, char *info, size_t infolen) | |||
120 | return (authenticated); | 134 | return (authenticated); |
121 | } | 135 | } |
122 | 136 | ||
137 | /*ARGSUSED*/ | ||
123 | static int | 138 | static int |
124 | auth1_process_rsa(Authctxt *authctxt, char *info, size_t infolen) | 139 | auth1_process_rsa(Authctxt *authctxt, char *info, size_t infolen) |
125 | { | 140 | { |
@@ -137,6 +152,7 @@ auth1_process_rsa(Authctxt *authctxt, char *info, size_t infolen) | |||
137 | return (authenticated); | 152 | return (authenticated); |
138 | } | 153 | } |
139 | 154 | ||
155 | /*ARGSUSED*/ | ||
140 | static int | 156 | static int |
141 | auth1_process_rhosts_rsa(Authctxt *authctxt, char *info, size_t infolen) | 157 | auth1_process_rhosts_rsa(Authctxt *authctxt, char *info, size_t infolen) |
142 | { | 158 | { |
@@ -175,6 +191,7 @@ auth1_process_rhosts_rsa(Authctxt *authctxt, char *info, size_t infolen) | |||
175 | return (authenticated); | 191 | return (authenticated); |
176 | } | 192 | } |
177 | 193 | ||
194 | /*ARGSUSED*/ | ||
178 | static int | 195 | static int |
179 | auth1_process_tis_challenge(Authctxt *authctxt, char *info, size_t infolen) | 196 | auth1_process_tis_challenge(Authctxt *authctxt, char *info, size_t infolen) |
180 | { | 197 | { |
@@ -193,6 +210,7 @@ auth1_process_tis_challenge(Authctxt *authctxt, char *info, size_t infolen) | |||
193 | return (-1); | 210 | return (-1); |
194 | } | 211 | } |
195 | 212 | ||
213 | /*ARGSUSED*/ | ||
196 | static int | 214 | static int |
197 | auth1_process_tis_response(Authctxt *authctxt, char *info, size_t infolen) | 215 | auth1_process_tis_response(Authctxt *authctxt, char *info, size_t infolen) |
198 | { | 216 | { |
diff --git a/auth2-chall.c b/auth2-chall.c index b147cadf3..51059c2bd 100644 --- a/auth2-chall.c +++ b/auth2-chall.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: auth2-chall.c,v 1.32 2007/01/03 03:01:40 stevesk Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
3 | * Copyright (c) 2001 Per Allansson. All rights reserved. | 4 | * Copyright (c) 2001 Per Allansson. All rights reserved. |
@@ -22,14 +23,22 @@ | |||
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 | */ | 25 | */ |
26 | |||
25 | #include "includes.h" | 27 | #include "includes.h" |
26 | RCSID("$OpenBSD: auth2-chall.c,v 1.24 2005/07/17 07:17:54 djm Exp $"); | ||
27 | 28 | ||
29 | #include <sys/types.h> | ||
30 | |||
31 | #include <stdarg.h> | ||
32 | #include <stdio.h> | ||
33 | #include <string.h> | ||
34 | |||
35 | #include "xmalloc.h" | ||
28 | #include "ssh2.h" | 36 | #include "ssh2.h" |
37 | #include "key.h" | ||
38 | #include "hostfile.h" | ||
29 | #include "auth.h" | 39 | #include "auth.h" |
30 | #include "buffer.h" | 40 | #include "buffer.h" |
31 | #include "packet.h" | 41 | #include "packet.h" |
32 | #include "xmalloc.h" | ||
33 | #include "dispatch.h" | 42 | #include "dispatch.h" |
34 | #include "log.h" | 43 | #include "log.h" |
35 | #include "servconf.h" | 44 | #include "servconf.h" |
@@ -197,7 +206,7 @@ auth2_challenge_stop(Authctxt *authctxt) | |||
197 | { | 206 | { |
198 | /* unregister callback */ | 207 | /* unregister callback */ |
199 | dispatch_set(SSH2_MSG_USERAUTH_INFO_RESPONSE, NULL); | 208 | dispatch_set(SSH2_MSG_USERAUTH_INFO_RESPONSE, NULL); |
200 | if (authctxt->kbdintctxt != NULL) { | 209 | if (authctxt->kbdintctxt != NULL) { |
201 | kbdint_free(authctxt->kbdintctxt); | 210 | kbdint_free(authctxt->kbdintctxt); |
202 | authctxt->kbdintctxt = NULL; | 211 | authctxt->kbdintctxt = NULL; |
203 | } | 212 | } |
@@ -291,7 +300,7 @@ input_userauth_info_response(int type, u_int32_t seq, void *ctxt) | |||
291 | if (nresp > 100) | 300 | if (nresp > 100) |
292 | fatal("input_userauth_info_response: too many replies"); | 301 | fatal("input_userauth_info_response: too many replies"); |
293 | if (nresp > 0) { | 302 | if (nresp > 0) { |
294 | response = xmalloc(nresp * sizeof(char *)); | 303 | response = xcalloc(nresp, sizeof(char *)); |
295 | for (i = 0; i < nresp; i++) | 304 | for (i = 0; i < nresp; i++) |
296 | response[i] = packet_get_string(NULL); | 305 | response[i] = packet_get_string(NULL); |
297 | } | 306 | } |
diff --git a/auth2-gss.c b/auth2-gss.c index 539654ee0..50bdc6452 100644 --- a/auth2-gss.c +++ b/auth2-gss.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: auth2-gss.c,v 1.12 2005/10/13 22:24:31 stevesk Exp $ */ | 1 | /* $OpenBSD: auth2-gss.c,v 1.15 2006/08/03 03:34:41 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. | 4 | * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. |
@@ -28,16 +28,22 @@ | |||
28 | 28 | ||
29 | #ifdef GSSAPI | 29 | #ifdef GSSAPI |
30 | 30 | ||
31 | #include <sys/types.h> | ||
32 | |||
33 | #include <stdarg.h> | ||
34 | |||
35 | #include "xmalloc.h" | ||
36 | #include "key.h" | ||
37 | #include "hostfile.h" | ||
31 | #include "auth.h" | 38 | #include "auth.h" |
32 | #include "ssh2.h" | 39 | #include "ssh2.h" |
33 | #include "xmalloc.h" | ||
34 | #include "log.h" | 40 | #include "log.h" |
35 | #include "dispatch.h" | 41 | #include "dispatch.h" |
42 | #include "buffer.h" | ||
36 | #include "servconf.h" | 43 | #include "servconf.h" |
37 | #include "packet.h" | 44 | #include "packet.h" |
38 | #include "monitor_wrap.h" | ||
39 | |||
40 | #include "ssh-gss.h" | 45 | #include "ssh-gss.h" |
46 | #include "monitor_wrap.h" | ||
41 | 47 | ||
42 | extern ServerOptions options; | 48 | extern ServerOptions options; |
43 | 49 | ||
@@ -134,6 +140,8 @@ userauth_gssapi(Authctxt *authctxt) | |||
134 | } | 140 | } |
135 | 141 | ||
136 | if (GSS_ERROR(PRIVSEP(ssh_gssapi_server_ctx(&ctxt, &goid)))) { | 142 | if (GSS_ERROR(PRIVSEP(ssh_gssapi_server_ctx(&ctxt, &goid)))) { |
143 | if (ctxt != NULL) | ||
144 | ssh_gssapi_delete_ctx(&ctxt); | ||
137 | xfree(doid); | 145 | xfree(doid); |
138 | authctxt->server_caused_failure = 1; | 146 | authctxt->server_caused_failure = 1; |
139 | return (0); | 147 | return (0); |
diff --git a/auth2-hostbased.c b/auth2-hostbased.c index 1111ed67a..663dec5d9 100644 --- a/auth2-hostbased.c +++ b/auth2-hostbased.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: auth2-hostbased.c,v 1.11 2006/08/03 03:34:41 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
3 | * | 4 | * |
@@ -23,19 +24,27 @@ | |||
23 | */ | 24 | */ |
24 | 25 | ||
25 | #include "includes.h" | 26 | #include "includes.h" |
26 | RCSID("$OpenBSD: auth2-hostbased.c,v 1.6 2004/01/19 21:25:15 markus Exp $"); | ||
27 | 27 | ||
28 | #include "ssh2.h" | 28 | #include <sys/types.h> |
29 | |||
30 | #include <pwd.h> | ||
31 | #include <string.h> | ||
32 | #include <stdarg.h> | ||
33 | |||
29 | #include "xmalloc.h" | 34 | #include "xmalloc.h" |
35 | #include "ssh2.h" | ||
30 | #include "packet.h" | 36 | #include "packet.h" |
31 | #include "buffer.h" | 37 | #include "buffer.h" |
32 | #include "log.h" | 38 | #include "log.h" |
33 | #include "servconf.h" | 39 | #include "servconf.h" |
34 | #include "compat.h" | 40 | #include "compat.h" |
35 | #include "bufaux.h" | ||
36 | #include "auth.h" | ||
37 | #include "key.h" | 41 | #include "key.h" |
42 | #include "hostfile.h" | ||
43 | #include "auth.h" | ||
38 | #include "canohost.h" | 44 | #include "canohost.h" |
45 | #ifdef GSSAPI | ||
46 | #include "ssh-gss.h" | ||
47 | #endif | ||
39 | #include "monitor_wrap.h" | 48 | #include "monitor_wrap.h" |
40 | #include "pathnames.h" | 49 | #include "pathnames.h" |
41 | 50 | ||
diff --git a/auth2-kbdint.c b/auth2-kbdint.c index fa8364975..a4fc9e6f7 100644 --- a/auth2-kbdint.c +++ b/auth2-kbdint.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: auth2-kbdint.c,v 1.5 2006/08/03 03:34:41 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
3 | * | 4 | * |
@@ -23,13 +24,19 @@ | |||
23 | */ | 24 | */ |
24 | 25 | ||
25 | #include "includes.h" | 26 | #include "includes.h" |
26 | RCSID("$OpenBSD: auth2-kbdint.c,v 1.2 2002/05/31 11:35:15 markus Exp $"); | ||
27 | 27 | ||
28 | #include <sys/types.h> | ||
29 | |||
30 | #include <stdarg.h> | ||
31 | |||
32 | #include "xmalloc.h" | ||
28 | #include "packet.h" | 33 | #include "packet.h" |
34 | #include "key.h" | ||
35 | #include "hostfile.h" | ||
29 | #include "auth.h" | 36 | #include "auth.h" |
30 | #include "log.h" | 37 | #include "log.h" |
38 | #include "buffer.h" | ||
31 | #include "servconf.h" | 39 | #include "servconf.h" |
32 | #include "xmalloc.h" | ||
33 | 40 | ||
34 | /* import */ | 41 | /* import */ |
35 | extern ServerOptions options; | 42 | extern ServerOptions options; |
diff --git a/auth2-none.c b/auth2-none.c index 1c30a3203..952b44824 100644 --- a/auth2-none.c +++ b/auth2-none.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: auth2-none.c,v 1.13 2006/08/05 07:52:52 dtucker Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
3 | * | 4 | * |
@@ -23,16 +24,29 @@ | |||
23 | */ | 24 | */ |
24 | 25 | ||
25 | #include "includes.h" | 26 | #include "includes.h" |
26 | RCSID("$OpenBSD: auth2-none.c,v 1.7 2004/05/11 19:01:43 deraadt Exp $"); | ||
27 | 27 | ||
28 | #include "auth.h" | 28 | #include <sys/types.h> |
29 | #include <sys/stat.h> | ||
30 | #include <sys/uio.h> | ||
31 | |||
32 | #include <fcntl.h> | ||
33 | #include <stdarg.h> | ||
34 | #include <unistd.h> | ||
35 | |||
29 | #include "xmalloc.h" | 36 | #include "xmalloc.h" |
37 | #include "key.h" | ||
38 | #include "hostfile.h" | ||
39 | #include "auth.h" | ||
30 | #include "packet.h" | 40 | #include "packet.h" |
31 | #include "log.h" | 41 | #include "log.h" |
42 | #include "buffer.h" | ||
32 | #include "servconf.h" | 43 | #include "servconf.h" |
33 | #include "atomicio.h" | 44 | #include "atomicio.h" |
34 | #include "compat.h" | 45 | #include "compat.h" |
35 | #include "ssh2.h" | 46 | #include "ssh2.h" |
47 | #ifdef GSSAPI | ||
48 | #include "ssh-gss.h" | ||
49 | #endif | ||
36 | #include "monitor_wrap.h" | 50 | #include "monitor_wrap.h" |
37 | 51 | ||
38 | /* import */ | 52 | /* import */ |
diff --git a/auth2-passwd.c b/auth2-passwd.c index 2321ef47b..421c5c25d 100644 --- a/auth2-passwd.c +++ b/auth2-passwd.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: auth2-passwd.c,v 1.9 2006/08/03 03:34:41 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
3 | * | 4 | * |
@@ -23,12 +24,22 @@ | |||
23 | */ | 24 | */ |
24 | 25 | ||
25 | #include "includes.h" | 26 | #include "includes.h" |
26 | RCSID("$OpenBSD: auth2-passwd.c,v 1.5 2003/12/31 00:24:50 dtucker Exp $"); | 27 | |
28 | #include <sys/types.h> | ||
29 | |||
30 | #include <string.h> | ||
31 | #include <stdarg.h> | ||
27 | 32 | ||
28 | #include "xmalloc.h" | 33 | #include "xmalloc.h" |
29 | #include "packet.h" | 34 | #include "packet.h" |
30 | #include "log.h" | 35 | #include "log.h" |
36 | #include "key.h" | ||
37 | #include "hostfile.h" | ||
31 | #include "auth.h" | 38 | #include "auth.h" |
39 | #include "buffer.h" | ||
40 | #ifdef GSSAPI | ||
41 | #include "ssh-gss.h" | ||
42 | #endif | ||
32 | #include "monitor_wrap.h" | 43 | #include "monitor_wrap.h" |
33 | #include "servconf.h" | 44 | #include "servconf.h" |
34 | 45 | ||
diff --git a/auth2-pubkey.c b/auth2-pubkey.c index a97d0f430..9863cd9e6 100644 --- a/auth2-pubkey.c +++ b/auth2-pubkey.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: auth2-pubkey.c,v 1.15 2006/08/03 03:34:41 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
3 | * | 4 | * |
@@ -23,23 +24,32 @@ | |||
23 | */ | 24 | */ |
24 | 25 | ||
25 | #include "includes.h" | 26 | #include "includes.h" |
26 | RCSID("$OpenBSD: auth2-pubkey.c,v 1.9 2004/12/11 01:48:56 dtucker Exp $"); | ||
27 | 27 | ||
28 | #include <sys/types.h> | ||
29 | #include <sys/stat.h> | ||
30 | |||
31 | #include <pwd.h> | ||
32 | #include <stdio.h> | ||
33 | #include <stdarg.h> | ||
34 | |||
35 | #include "xmalloc.h" | ||
28 | #include "ssh.h" | 36 | #include "ssh.h" |
29 | #include "ssh2.h" | 37 | #include "ssh2.h" |
30 | #include "xmalloc.h" | ||
31 | #include "packet.h" | 38 | #include "packet.h" |
32 | #include "buffer.h" | 39 | #include "buffer.h" |
33 | #include "log.h" | 40 | #include "log.h" |
34 | #include "servconf.h" | 41 | #include "servconf.h" |
35 | #include "compat.h" | 42 | #include "compat.h" |
36 | #include "bufaux.h" | ||
37 | #include "auth.h" | ||
38 | #include "key.h" | 43 | #include "key.h" |
44 | #include "hostfile.h" | ||
45 | #include "auth.h" | ||
39 | #include "pathnames.h" | 46 | #include "pathnames.h" |
40 | #include "uidswap.h" | 47 | #include "uidswap.h" |
41 | #include "auth-options.h" | 48 | #include "auth-options.h" |
42 | #include "canohost.h" | 49 | #include "canohost.h" |
50 | #ifdef GSSAPI | ||
51 | #include "ssh-gss.h" | ||
52 | #endif | ||
43 | #include "monitor_wrap.h" | 53 | #include "monitor_wrap.h" |
44 | #include "misc.h" | 54 | #include "misc.h" |
45 | 55 | ||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: auth2.c,v 1.114 2007/03/01 10:28:02 dtucker Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
3 | * | 4 | * |
@@ -23,23 +24,31 @@ | |||
23 | */ | 24 | */ |
24 | 25 | ||
25 | #include "includes.h" | 26 | #include "includes.h" |
26 | RCSID("$OpenBSD: auth2.c,v 1.107 2004/07/28 09:40:29 markus Exp $"); | ||
27 | 27 | ||
28 | #include "ssh2.h" | 28 | #include <sys/types.h> |
29 | |||
30 | #include <pwd.h> | ||
31 | #include <stdarg.h> | ||
32 | #include <string.h> | ||
33 | |||
29 | #include "xmalloc.h" | 34 | #include "xmalloc.h" |
35 | #include "ssh2.h" | ||
30 | #include "packet.h" | 36 | #include "packet.h" |
31 | #include "log.h" | 37 | #include "log.h" |
38 | #include "buffer.h" | ||
32 | #include "servconf.h" | 39 | #include "servconf.h" |
33 | #include "compat.h" | 40 | #include "compat.h" |
41 | #include "key.h" | ||
42 | #include "hostfile.h" | ||
34 | #include "auth.h" | 43 | #include "auth.h" |
35 | #include "dispatch.h" | 44 | #include "dispatch.h" |
36 | #include "pathnames.h" | 45 | #include "pathnames.h" |
37 | #include "monitor_wrap.h" | ||
38 | #include "buffer.h" | 46 | #include "buffer.h" |
39 | 47 | ||
40 | #ifdef GSSAPI | 48 | #ifdef GSSAPI |
41 | #include "ssh-gss.h" | 49 | #include "ssh-gss.h" |
42 | #endif | 50 | #endif |
51 | #include "monitor_wrap.h" | ||
43 | 52 | ||
44 | /* import */ | 53 | /* import */ |
45 | extern ServerOptions options; | 54 | extern ServerOptions options; |
@@ -89,15 +98,12 @@ int user_key_allowed(struct passwd *, Key *); | |||
89 | void | 98 | void |
90 | do_authentication2(Authctxt *authctxt) | 99 | do_authentication2(Authctxt *authctxt) |
91 | { | 100 | { |
92 | /* challenge-response is implemented via keyboard interactive */ | ||
93 | if (options.challenge_response_authentication) | ||
94 | options.kbd_interactive_authentication = 1; | ||
95 | |||
96 | dispatch_init(&dispatch_protocol_error); | 101 | dispatch_init(&dispatch_protocol_error); |
97 | dispatch_set(SSH2_MSG_SERVICE_REQUEST, &input_service_request); | 102 | dispatch_set(SSH2_MSG_SERVICE_REQUEST, &input_service_request); |
98 | dispatch_run(DISPATCH_BLOCK, &authctxt->success, authctxt); | 103 | dispatch_run(DISPATCH_BLOCK, &authctxt->success, authctxt); |
99 | } | 104 | } |
100 | 105 | ||
106 | /*ARGSUSED*/ | ||
101 | static void | 107 | static void |
102 | input_service_request(int type, u_int32_t seq, void *ctxt) | 108 | input_service_request(int type, u_int32_t seq, void *ctxt) |
103 | { | 109 | { |
@@ -131,6 +137,7 @@ input_service_request(int type, u_int32_t seq, void *ctxt) | |||
131 | xfree(service); | 137 | xfree(service); |
132 | } | 138 | } |
133 | 139 | ||
140 | /*ARGSUSED*/ | ||
134 | static void | 141 | static void |
135 | input_userauth_request(int type, u_int32_t seq, void *ctxt) | 142 | input_userauth_request(int type, u_int32_t seq, void *ctxt) |
136 | { | 143 | { |
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: authfd.c,v 1.80 2006/08/03 03:34:41 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -35,16 +36,25 @@ | |||
35 | */ | 36 | */ |
36 | 37 | ||
37 | #include "includes.h" | 38 | #include "includes.h" |
38 | RCSID("$OpenBSD: authfd.c,v 1.66 2005/06/17 02:44:32 djm Exp $"); | 39 | |
40 | #include <sys/types.h> | ||
41 | #include <sys/un.h> | ||
42 | #include <sys/socket.h> | ||
39 | 43 | ||
40 | #include <openssl/evp.h> | 44 | #include <openssl/evp.h> |
41 | 45 | ||
46 | #include <openssl/crypto.h> | ||
47 | #include <fcntl.h> | ||
48 | #include <stdlib.h> | ||
49 | #include <signal.h> | ||
50 | #include <stdarg.h> | ||
51 | #include <string.h> | ||
52 | #include <unistd.h> | ||
53 | |||
54 | #include "xmalloc.h" | ||
42 | #include "ssh.h" | 55 | #include "ssh.h" |
43 | #include "rsa.h" | 56 | #include "rsa.h" |
44 | #include "buffer.h" | 57 | #include "buffer.h" |
45 | #include "bufaux.h" | ||
46 | #include "xmalloc.h" | ||
47 | #include "getput.h" | ||
48 | #include "key.h" | 58 | #include "key.h" |
49 | #include "authfd.h" | 59 | #include "authfd.h" |
50 | #include "cipher.h" | 60 | #include "cipher.h" |
@@ -52,6 +62,7 @@ RCSID("$OpenBSD: authfd.c,v 1.66 2005/06/17 02:44:32 djm Exp $"); | |||
52 | #include "compat.h" | 62 | #include "compat.h" |
53 | #include "log.h" | 63 | #include "log.h" |
54 | #include "atomicio.h" | 64 | #include "atomicio.h" |
65 | #include "misc.h" | ||
55 | 66 | ||
56 | static int agent_present = 0; | 67 | static int agent_present = 0; |
57 | 68 | ||
@@ -103,7 +114,7 @@ ssh_get_authentication_socket(void) | |||
103 | close(sock); | 114 | close(sock); |
104 | return -1; | 115 | return -1; |
105 | } | 116 | } |
106 | if (connect(sock, (struct sockaddr *) &sunaddr, sizeof sunaddr) < 0) { | 117 | if (connect(sock, (struct sockaddr *)&sunaddr, sizeof sunaddr) < 0) { |
107 | close(sock); | 118 | close(sock); |
108 | return -1; | 119 | return -1; |
109 | } | 120 | } |
@@ -119,7 +130,7 @@ ssh_request_reply(AuthenticationConnection *auth, Buffer *request, Buffer *reply | |||
119 | 130 | ||
120 | /* Get the length of the message, and format it in the buffer. */ | 131 | /* Get the length of the message, and format it in the buffer. */ |
121 | len = buffer_len(request); | 132 | len = buffer_len(request); |
122 | PUT_32BIT(buf, len); | 133 | put_u32(buf, len); |
123 | 134 | ||
124 | /* Send the length and then the packet to the agent. */ | 135 | /* Send the length and then the packet to the agent. */ |
125 | if (atomicio(vwrite, auth->fd, buf, 4) != 4 || | 136 | if (atomicio(vwrite, auth->fd, buf, 4) != 4 || |
@@ -138,7 +149,7 @@ ssh_request_reply(AuthenticationConnection *auth, Buffer *request, Buffer *reply | |||
138 | } | 149 | } |
139 | 150 | ||
140 | /* Extract the length, and check it for sanity. */ | 151 | /* Extract the length, and check it for sanity. */ |
141 | len = GET_32BIT(buf); | 152 | len = get_u32(buf); |
142 | if (len > 256 * 1024) | 153 | if (len > 256 * 1024) |
143 | fatal("Authentication response too long: %u", len); | 154 | fatal("Authentication response too long: %u", len); |
144 | 155 | ||
@@ -335,7 +346,6 @@ ssh_get_next_identity(AuthenticationConnection *auth, char **comment, int versio | |||
335 | break; | 346 | break; |
336 | default: | 347 | default: |
337 | return NULL; | 348 | return NULL; |
338 | break; | ||
339 | } | 349 | } |
340 | /* Decrement the number of remaining entries. */ | 350 | /* Decrement the number of remaining entries. */ |
341 | auth->howmany--; | 351 | auth->howmany--; |
@@ -394,7 +404,7 @@ ssh_decrypt_challenge(AuthenticationConnection *auth, | |||
394 | * fatal error if the packet is corrupt. | 404 | * fatal error if the packet is corrupt. |
395 | */ | 405 | */ |
396 | for (i = 0; i < 16; i++) | 406 | for (i = 0; i < 16; i++) |
397 | response[i] = buffer_get_char(&buffer); | 407 | response[i] = (u_char)buffer_get_char(&buffer); |
398 | } | 408 | } |
399 | buffer_free(&buffer); | 409 | buffer_free(&buffer); |
400 | return success; | 410 | return success; |
@@ -517,7 +527,6 @@ ssh_add_identity_constrained(AuthenticationConnection *auth, Key *key, | |||
517 | default: | 527 | default: |
518 | buffer_free(&msg); | 528 | buffer_free(&msg); |
519 | return 0; | 529 | return 0; |
520 | break; | ||
521 | } | 530 | } |
522 | if (constrained) { | 531 | if (constrained) { |
523 | if (life != 0) { | 532 | if (life != 0) { |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: authfd.h,v 1.34 2003/11/21 11:57:03 djm Exp $ */ | 1 | /* $OpenBSD: authfd.h,v 1.36 2006/08/03 03:34:41 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -16,8 +16,6 @@ | |||
16 | #ifndef AUTHFD_H | 16 | #ifndef AUTHFD_H |
17 | #define AUTHFD_H | 17 | #define AUTHFD_H |
18 | 18 | ||
19 | #include "buffer.h" | ||
20 | |||
21 | /* Messages for the authentication agent connection. */ | 19 | /* Messages for the authentication agent connection. */ |
22 | #define SSH_AGENTC_REQUEST_RSA_IDENTITIES 1 | 20 | #define SSH_AGENTC_REQUEST_RSA_IDENTITIES 1 |
23 | #define SSH_AGENT_RSA_IDENTITIES_ANSWER 2 | 21 | #define SSH_AGENT_RSA_IDENTITIES_ANSWER 2 |
diff --git a/authfile.c b/authfile.c index 420813f37..735c64780 100644 --- a/authfile.c +++ b/authfile.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: authfile.c,v 1.76 2006/08/03 03:34:41 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -36,16 +37,27 @@ | |||
36 | */ | 37 | */ |
37 | 38 | ||
38 | #include "includes.h" | 39 | #include "includes.h" |
39 | RCSID("$OpenBSD: authfile.c,v 1.61 2005/06/17 02:44:32 djm Exp $"); | 40 | |
41 | #include <sys/types.h> | ||
42 | #include <sys/stat.h> | ||
43 | #include <sys/param.h> | ||
44 | #include <sys/uio.h> | ||
40 | 45 | ||
41 | #include <openssl/err.h> | 46 | #include <openssl/err.h> |
42 | #include <openssl/evp.h> | 47 | #include <openssl/evp.h> |
43 | #include <openssl/pem.h> | 48 | #include <openssl/pem.h> |
44 | 49 | ||
45 | #include "cipher.h" | 50 | #include <errno.h> |
51 | #include <fcntl.h> | ||
52 | #include <stdarg.h> | ||
53 | #include <stdio.h> | ||
54 | #include <stdlib.h> | ||
55 | #include <string.h> | ||
56 | #include <unistd.h> | ||
57 | |||
46 | #include "xmalloc.h" | 58 | #include "xmalloc.h" |
59 | #include "cipher.h" | ||
47 | #include "buffer.h" | 60 | #include "buffer.h" |
48 | #include "bufaux.h" | ||
49 | #include "key.h" | 61 | #include "key.h" |
50 | #include "ssh.h" | 62 | #include "ssh.h" |
51 | #include "log.h" | 63 | #include "log.h" |
@@ -184,7 +196,7 @@ key_save_private_pem(Key *key, const char *filename, const char *_passphrase, | |||
184 | return 0; | 196 | return 0; |
185 | } | 197 | } |
186 | fp = fdopen(fd, "w"); | 198 | fp = fdopen(fd, "w"); |
187 | if (fp == NULL ) { | 199 | if (fp == NULL) { |
188 | error("fdopen %s failed: %s.", filename, strerror(errno)); | 200 | error("fdopen %s failed: %s.", filename, strerror(errno)); |
189 | close(fd); | 201 | close(fd); |
190 | return 0; | 202 | return 0; |
@@ -211,12 +223,10 @@ key_save_private(Key *key, const char *filename, const char *passphrase, | |||
211 | case KEY_RSA1: | 223 | case KEY_RSA1: |
212 | return key_save_private_rsa1(key, filename, passphrase, | 224 | return key_save_private_rsa1(key, filename, passphrase, |
213 | comment); | 225 | comment); |
214 | break; | ||
215 | case KEY_DSA: | 226 | case KEY_DSA: |
216 | case KEY_RSA: | 227 | case KEY_RSA: |
217 | return key_save_private_pem(key, filename, passphrase, | 228 | return key_save_private_pem(key, filename, passphrase, |
218 | comment); | 229 | comment); |
219 | break; | ||
220 | default: | 230 | default: |
221 | break; | 231 | break; |
222 | } | 232 | } |
@@ -507,7 +517,7 @@ key_load_private_pem(int fd, int type, const char *passphrase, | |||
507 | return prv; | 517 | return prv; |
508 | } | 518 | } |
509 | 519 | ||
510 | static int | 520 | int |
511 | key_perm_ok(int fd, const char *filename) | 521 | key_perm_ok(int fd, const char *filename) |
512 | { | 522 | { |
513 | struct stat st; | 523 | struct stat st; |
@@ -537,7 +547,7 @@ key_perm_ok(int fd, const char *filename) | |||
537 | 547 | ||
538 | Key * | 548 | Key * |
539 | key_load_private_type(int type, const char *filename, const char *passphrase, | 549 | key_load_private_type(int type, const char *filename, const char *passphrase, |
540 | char **commentp) | 550 | char **commentp, int *perm_ok) |
541 | { | 551 | { |
542 | int fd; | 552 | int fd; |
543 | 553 | ||
@@ -545,22 +555,24 @@ key_load_private_type(int type, const char *filename, const char *passphrase, | |||
545 | if (fd < 0) | 555 | if (fd < 0) |
546 | return NULL; | 556 | return NULL; |
547 | if (!key_perm_ok(fd, filename)) { | 557 | if (!key_perm_ok(fd, filename)) { |
558 | if (perm_ok != NULL) | ||
559 | *perm_ok = 0; | ||
548 | error("bad permissions: ignore key: %s", filename); | 560 | error("bad permissions: ignore key: %s", filename); |
549 | close(fd); | 561 | close(fd); |
550 | return NULL; | 562 | return NULL; |
551 | } | 563 | } |
564 | if (perm_ok != NULL) | ||
565 | *perm_ok = 1; | ||
552 | switch (type) { | 566 | switch (type) { |
553 | case KEY_RSA1: | 567 | case KEY_RSA1: |
554 | return key_load_private_rsa1(fd, filename, passphrase, | 568 | return key_load_private_rsa1(fd, filename, passphrase, |
555 | commentp); | 569 | commentp); |
556 | /* closes fd */ | 570 | /* closes fd */ |
557 | break; | ||
558 | case KEY_DSA: | 571 | case KEY_DSA: |
559 | case KEY_RSA: | 572 | case KEY_RSA: |
560 | case KEY_UNSPEC: | 573 | case KEY_UNSPEC: |
561 | return key_load_private_pem(fd, type, passphrase, commentp); | 574 | return key_load_private_pem(fd, type, passphrase, commentp); |
562 | /* closes fd */ | 575 | /* closes fd */ |
563 | break; | ||
564 | default: | 576 | default: |
565 | close(fd); | 577 | close(fd); |
566 | break; | 578 | break; |
diff --git a/authfile.h b/authfile.h index 7f92701ec..a6c74934d 100644 --- a/authfile.h +++ b/authfile.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: authfile.h,v 1.10 2002/05/23 19:24:30 markus Exp $ */ | 1 | /* $OpenBSD: authfile.h,v 1.13 2006/04/25 08:02:27 dtucker Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -19,7 +19,8 @@ int key_save_private(Key *, const char *, const char *, const char *); | |||
19 | Key *key_load_public(const char *, char **); | 19 | Key *key_load_public(const char *, char **); |
20 | Key *key_load_public_type(int, const char *, char **); | 20 | Key *key_load_public_type(int, const char *, char **); |
21 | Key *key_load_private(const char *, const char *, char **); | 21 | Key *key_load_private(const char *, const char *, char **); |
22 | Key *key_load_private_type(int, const char *, const char *, char **); | 22 | Key *key_load_private_type(int, const char *, const char *, char **, int *); |
23 | Key *key_load_private_pem(int, int, const char *, char **); | 23 | Key *key_load_private_pem(int, int, const char *, char **); |
24 | int key_perm_ok(int, const char *); | ||
24 | 25 | ||
25 | #endif | 26 | #endif |
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: bufaux.c,v 1.44 2006/08/03 03:34:41 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -37,176 +38,18 @@ | |||
37 | */ | 38 | */ |
38 | 39 | ||
39 | #include "includes.h" | 40 | #include "includes.h" |
40 | RCSID("$OpenBSD: bufaux.c,v 1.37 2005/11/05 05:01:15 djm Exp $"); | ||
41 | 41 | ||
42 | #include <openssl/bn.h> | 42 | #include <sys/types.h> |
43 | #include "bufaux.h" | ||
44 | #include "xmalloc.h" | ||
45 | #include "getput.h" | ||
46 | #include "log.h" | ||
47 | |||
48 | /* | ||
49 | * Stores an BIGNUM in the buffer with a 2-byte msb first bit count, followed | ||
50 | * by (bits+7)/8 bytes of binary data, msb first. | ||
51 | */ | ||
52 | int | ||
53 | buffer_put_bignum_ret(Buffer *buffer, const BIGNUM *value) | ||
54 | { | ||
55 | int bits = BN_num_bits(value); | ||
56 | int bin_size = (bits + 7) / 8; | ||
57 | u_char *buf = xmalloc(bin_size); | ||
58 | int oi; | ||
59 | char msg[2]; | ||
60 | |||
61 | /* Get the value of in binary */ | ||
62 | oi = BN_bn2bin(value, buf); | ||
63 | if (oi != bin_size) { | ||
64 | error("buffer_put_bignum_ret: BN_bn2bin() failed: oi %d != bin_size %d", | ||
65 | oi, bin_size); | ||
66 | xfree(buf); | ||
67 | return (-1); | ||
68 | } | ||
69 | |||
70 | /* Store the number of bits in the buffer in two bytes, msb first. */ | ||
71 | PUT_16BIT(msg, bits); | ||
72 | buffer_append(buffer, msg, 2); | ||
73 | /* Store the binary data. */ | ||
74 | buffer_append(buffer, (char *)buf, oi); | ||
75 | |||
76 | memset(buf, 0, bin_size); | ||
77 | xfree(buf); | ||
78 | |||
79 | return (0); | ||
80 | } | ||
81 | |||
82 | void | ||
83 | buffer_put_bignum(Buffer *buffer, const BIGNUM *value) | ||
84 | { | ||
85 | if (buffer_put_bignum_ret(buffer, value) == -1) | ||
86 | fatal("buffer_put_bignum: buffer error"); | ||
87 | } | ||
88 | 43 | ||
89 | /* | 44 | #include <openssl/bn.h> |
90 | * Retrieves an BIGNUM from the buffer. | ||
91 | */ | ||
92 | int | ||
93 | buffer_get_bignum_ret(Buffer *buffer, BIGNUM *value) | ||
94 | { | ||
95 | u_int bits, bytes; | ||
96 | u_char buf[2], *bin; | ||
97 | |||
98 | /* Get the number for bits. */ | ||
99 | if (buffer_get_ret(buffer, (char *) buf, 2) == -1) { | ||
100 | error("buffer_get_bignum_ret: invalid length"); | ||
101 | return (-1); | ||
102 | } | ||
103 | bits = GET_16BIT(buf); | ||
104 | /* Compute the number of binary bytes that follow. */ | ||
105 | bytes = (bits + 7) / 8; | ||
106 | if (bytes > 8 * 1024) { | ||
107 | error("buffer_get_bignum_ret: cannot handle BN of size %d", bytes); | ||
108 | return (-1); | ||
109 | } | ||
110 | if (buffer_len(buffer) < bytes) { | ||
111 | error("buffer_get_bignum_ret: input buffer too small"); | ||
112 | return (-1); | ||
113 | } | ||
114 | bin = buffer_ptr(buffer); | ||
115 | BN_bin2bn(bin, bytes, value); | ||
116 | if (buffer_consume_ret(buffer, bytes) == -1) { | ||
117 | error("buffer_get_bignum_ret: buffer_consume failed"); | ||
118 | return (-1); | ||
119 | } | ||
120 | return (0); | ||
121 | } | ||
122 | |||
123 | void | ||
124 | buffer_get_bignum(Buffer *buffer, BIGNUM *value) | ||
125 | { | ||
126 | if (buffer_get_bignum_ret(buffer, value) == -1) | ||
127 | fatal("buffer_get_bignum: buffer error"); | ||
128 | } | ||
129 | |||
130 | /* | ||
131 | * Stores an BIGNUM in the buffer in SSH2 format. | ||
132 | */ | ||
133 | int | ||
134 | buffer_put_bignum2_ret(Buffer *buffer, const BIGNUM *value) | ||
135 | { | ||
136 | u_int bytes; | ||
137 | u_char *buf; | ||
138 | int oi; | ||
139 | u_int hasnohigh = 0; | ||
140 | |||
141 | if (BN_is_zero(value)) { | ||
142 | buffer_put_int(buffer, 0); | ||
143 | return 0; | ||
144 | } | ||
145 | if (value->neg) { | ||
146 | error("buffer_put_bignum2_ret: negative numbers not supported"); | ||
147 | return (-1); | ||
148 | } | ||
149 | bytes = BN_num_bytes(value) + 1; /* extra padding byte */ | ||
150 | if (bytes < 2) { | ||
151 | error("buffer_put_bignum2_ret: BN too small"); | ||
152 | return (-1); | ||
153 | } | ||
154 | buf = xmalloc(bytes); | ||
155 | buf[0] = 0x00; | ||
156 | /* Get the value of in binary */ | ||
157 | oi = BN_bn2bin(value, buf+1); | ||
158 | if (oi < 0 || (u_int)oi != bytes - 1) { | ||
159 | error("buffer_put_bignum2_ret: BN_bn2bin() failed: " | ||
160 | "oi %d != bin_size %d", oi, bytes); | ||
161 | xfree(buf); | ||
162 | return (-1); | ||
163 | } | ||
164 | hasnohigh = (buf[1] & 0x80) ? 0 : 1; | ||
165 | buffer_put_string(buffer, buf+hasnohigh, bytes-hasnohigh); | ||
166 | memset(buf, 0, bytes); | ||
167 | xfree(buf); | ||
168 | return (0); | ||
169 | } | ||
170 | |||
171 | void | ||
172 | buffer_put_bignum2(Buffer *buffer, const BIGNUM *value) | ||
173 | { | ||
174 | if (buffer_put_bignum2_ret(buffer, value) == -1) | ||
175 | fatal("buffer_put_bignum2: buffer error"); | ||
176 | } | ||
177 | |||
178 | int | ||
179 | buffer_get_bignum2_ret(Buffer *buffer, BIGNUM *value) | ||
180 | { | ||
181 | u_int len; | ||
182 | u_char *bin; | ||
183 | |||
184 | if ((bin = buffer_get_string_ret(buffer, &len)) == NULL) { | ||
185 | error("buffer_get_bignum2_ret: invalid bignum"); | ||
186 | return (-1); | ||
187 | } | ||
188 | 45 | ||
189 | if (len > 0 && (bin[0] & 0x80)) { | 46 | #include <string.h> |
190 | error("buffer_get_bignum2_ret: negative numbers not supported"); | 47 | #include <stdarg.h> |
191 | xfree(bin); | ||
192 | return (-1); | ||
193 | } | ||
194 | if (len > 8 * 1024) { | ||
195 | error("buffer_get_bignum2_ret: cannot handle BN of size %d", len); | ||
196 | xfree(bin); | ||
197 | return (-1); | ||
198 | } | ||
199 | BN_bin2bn(bin, len, value); | ||
200 | xfree(bin); | ||
201 | return (0); | ||
202 | } | ||
203 | 48 | ||
204 | void | 49 | #include "xmalloc.h" |
205 | buffer_get_bignum2(Buffer *buffer, BIGNUM *value) | 50 | #include "buffer.h" |
206 | { | 51 | #include "log.h" |
207 | if (buffer_get_bignum2_ret(buffer, value) == -1) | 52 | #include "misc.h" |
208 | fatal("buffer_get_bignum2: buffer error"); | ||
209 | } | ||
210 | 53 | ||
211 | /* | 54 | /* |
212 | * Returns integers from the buffer (msb first). | 55 | * Returns integers from the buffer (msb first). |
@@ -219,7 +62,7 @@ buffer_get_short_ret(u_short *ret, Buffer *buffer) | |||
219 | 62 | ||
220 | if (buffer_get_ret(buffer, (char *) buf, 2) == -1) | 63 | if (buffer_get_ret(buffer, (char *) buf, 2) == -1) |
221 | return (-1); | 64 | return (-1); |
222 | *ret = GET_16BIT(buf); | 65 | *ret = get_u16(buf); |
223 | return (0); | 66 | return (0); |
224 | } | 67 | } |
225 | 68 | ||
@@ -241,7 +84,7 @@ buffer_get_int_ret(u_int *ret, Buffer *buffer) | |||
241 | 84 | ||
242 | if (buffer_get_ret(buffer, (char *) buf, 4) == -1) | 85 | if (buffer_get_ret(buffer, (char *) buf, 4) == -1) |
243 | return (-1); | 86 | return (-1); |
244 | *ret = GET_32BIT(buf); | 87 | *ret = get_u32(buf); |
245 | return (0); | 88 | return (0); |
246 | } | 89 | } |
247 | 90 | ||
@@ -263,7 +106,7 @@ buffer_get_int64_ret(u_int64_t *ret, Buffer *buffer) | |||
263 | 106 | ||
264 | if (buffer_get_ret(buffer, (char *) buf, 8) == -1) | 107 | if (buffer_get_ret(buffer, (char *) buf, 8) == -1) |
265 | return (-1); | 108 | return (-1); |
266 | *ret = GET_64BIT(buf); | 109 | *ret = get_u64(buf); |
267 | return (0); | 110 | return (0); |
268 | } | 111 | } |
269 | 112 | ||
@@ -286,7 +129,7 @@ buffer_put_short(Buffer *buffer, u_short value) | |||
286 | { | 129 | { |
287 | char buf[2]; | 130 | char buf[2]; |
288 | 131 | ||
289 | PUT_16BIT(buf, value); | 132 | put_u16(buf, value); |
290 | buffer_append(buffer, buf, 2); | 133 | buffer_append(buffer, buf, 2); |
291 | } | 134 | } |
292 | 135 | ||
@@ -295,7 +138,7 @@ buffer_put_int(Buffer *buffer, u_int value) | |||
295 | { | 138 | { |
296 | char buf[4]; | 139 | char buf[4]; |
297 | 140 | ||
298 | PUT_32BIT(buf, value); | 141 | put_u32(buf, value); |
299 | buffer_append(buffer, buf, 4); | 142 | buffer_append(buffer, buf, 4); |
300 | } | 143 | } |
301 | 144 | ||
@@ -304,7 +147,7 @@ buffer_put_int64(Buffer *buffer, u_int64_t value) | |||
304 | { | 147 | { |
305 | char buf[8]; | 148 | char buf[8]; |
306 | 149 | ||
307 | PUT_64BIT(buf, value); | 150 | put_u64(buf, value); |
308 | buffer_append(buffer, buf, 8); | 151 | buffer_append(buffer, buf, 8); |
309 | } | 152 | } |
310 | 153 | ||
diff --git a/bufaux.h b/bufaux.h deleted file mode 100644 index f5efaed3e..000000000 --- a/bufaux.h +++ /dev/null | |||
@@ -1,55 +0,0 @@ | |||
1 | /* $OpenBSD: bufaux.h,v 1.21 2005/03/10 22:01:05 deraadt Exp $ */ | ||
2 | |||
3 | /* | ||
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | ||
5 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | ||
6 | * All rights reserved | ||
7 | * | ||
8 | * As far as I am concerned, the code I have written for this software | ||
9 | * can be used freely for any purpose. Any derived versions of this | ||
10 | * software must be clearly marked as such, and if the derived work is | ||
11 | * incompatible with the protocol description in the RFC file, it must be | ||
12 | * called by a name other than "ssh" or "Secure Shell". | ||
13 | */ | ||
14 | |||
15 | #ifndef BUFAUX_H | ||
16 | #define BUFAUX_H | ||
17 | |||
18 | #include "buffer.h" | ||
19 | #include <openssl/bn.h> | ||
20 | |||
21 | void buffer_put_bignum(Buffer *, const BIGNUM *); | ||
22 | void buffer_put_bignum2(Buffer *, const BIGNUM *); | ||
23 | void buffer_get_bignum(Buffer *, BIGNUM *); | ||
24 | void buffer_get_bignum2(Buffer *, BIGNUM *); | ||
25 | |||
26 | u_short buffer_get_short(Buffer *); | ||
27 | void buffer_put_short(Buffer *, u_short); | ||
28 | |||
29 | u_int buffer_get_int(Buffer *); | ||
30 | void buffer_put_int(Buffer *, u_int); | ||
31 | |||
32 | u_int64_t buffer_get_int64(Buffer *); | ||
33 | void buffer_put_int64(Buffer *, u_int64_t); | ||
34 | |||
35 | int buffer_get_char(Buffer *); | ||
36 | void buffer_put_char(Buffer *, int); | ||
37 | |||
38 | void *buffer_get_string(Buffer *, u_int *); | ||
39 | void buffer_put_string(Buffer *, const void *, u_int); | ||
40 | void buffer_put_cstring(Buffer *, const char *); | ||
41 | |||
42 | #define buffer_skip_string(b) \ | ||
43 | do { u_int l = buffer_get_int(b); buffer_consume(b, l); } while (0) | ||
44 | |||
45 | int buffer_put_bignum_ret(Buffer *, const BIGNUM *); | ||
46 | int buffer_get_bignum_ret(Buffer *, BIGNUM *); | ||
47 | int buffer_put_bignum2_ret(Buffer *, const BIGNUM *); | ||
48 | int buffer_get_bignum2_ret(Buffer *, BIGNUM *); | ||
49 | int buffer_get_short_ret(u_short *, Buffer *); | ||
50 | int buffer_get_int_ret(u_int *, Buffer *); | ||
51 | int buffer_get_int64_ret(u_int64_t *, Buffer *); | ||
52 | void *buffer_get_string_ret(Buffer *, u_int *); | ||
53 | int buffer_get_char_ret(char *, Buffer *); | ||
54 | |||
55 | #endif /* BUFAUX_H */ | ||
diff --git a/bufbn.c b/bufbn.c new file mode 100644 index 000000000..ce8fba515 --- /dev/null +++ b/bufbn.c | |||
@@ -0,0 +1,221 @@ | |||
1 | /* $OpenBSD: bufbn.c,v 1.5 2007/02/14 14:32:00 stevesk Exp $*/ | ||
2 | /* | ||
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | ||
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | ||
5 | * All rights reserved | ||
6 | * Auxiliary functions for storing and retrieving various data types to/from | ||
7 | * Buffers. | ||
8 | * | ||
9 | * As far as I am concerned, the code I have written for this software | ||
10 | * can be used freely for any purpose. Any derived versions of this | ||
11 | * software must be clearly marked as such, and if the derived work is | ||
12 | * incompatible with the protocol description in the RFC file, it must be | ||
13 | * called by a name other than "ssh" or "Secure Shell". | ||
14 | * | ||
15 | * | ||
16 | * SSH2 packet format added by Markus Friedl | ||
17 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | ||
18 | * | ||
19 | * Redistribution and use in source and binary forms, with or without | ||
20 | * modification, are permitted provided that the following conditions | ||
21 | * are met: | ||
22 | * 1. Redistributions of source code must retain the above copyright | ||
23 | * notice, this list of conditions and the following disclaimer. | ||
24 | * 2. Redistributions in binary form must reproduce the above copyright | ||
25 | * notice, this list of conditions and the following disclaimer in the | ||
26 | * documentation and/or other materials provided with the distribution. | ||
27 | * | ||
28 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
29 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
30 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
31 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
33 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
34 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
35 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
36 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
37 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
38 | */ | ||
39 | |||
40 | #include "includes.h" | ||
41 | |||
42 | #include <sys/types.h> | ||
43 | |||
44 | #include <openssl/bn.h> | ||
45 | |||
46 | #include <string.h> | ||
47 | #include <stdarg.h> | ||
48 | |||
49 | #include "xmalloc.h" | ||
50 | #include "buffer.h" | ||
51 | #include "log.h" | ||
52 | #include "misc.h" | ||
53 | |||
54 | /* | ||
55 | * Stores an BIGNUM in the buffer with a 2-byte msb first bit count, followed | ||
56 | * by (bits+7)/8 bytes of binary data, msb first. | ||
57 | */ | ||
58 | int | ||
59 | buffer_put_bignum_ret(Buffer *buffer, const BIGNUM *value) | ||
60 | { | ||
61 | int bits = BN_num_bits(value); | ||
62 | int bin_size = (bits + 7) / 8; | ||
63 | u_char *buf = xmalloc(bin_size); | ||
64 | int oi; | ||
65 | char msg[2]; | ||
66 | |||
67 | /* Get the value of in binary */ | ||
68 | oi = BN_bn2bin(value, buf); | ||
69 | if (oi != bin_size) { | ||
70 | error("buffer_put_bignum_ret: BN_bn2bin() failed: oi %d != bin_size %d", | ||
71 | oi, bin_size); | ||
72 | xfree(buf); | ||
73 | return (-1); | ||
74 | } | ||
75 | |||
76 | /* Store the number of bits in the buffer in two bytes, msb first. */ | ||
77 | put_u16(msg, bits); | ||
78 | buffer_append(buffer, msg, 2); | ||
79 | /* Store the binary data. */ | ||
80 | buffer_append(buffer, buf, oi); | ||
81 | |||
82 | memset(buf, 0, bin_size); | ||
83 | xfree(buf); | ||
84 | |||
85 | return (0); | ||
86 | } | ||
87 | |||
88 | void | ||
89 | buffer_put_bignum(Buffer *buffer, const BIGNUM *value) | ||
90 | { | ||
91 | if (buffer_put_bignum_ret(buffer, value) == -1) | ||
92 | fatal("buffer_put_bignum: buffer error"); | ||
93 | } | ||
94 | |||
95 | /* | ||
96 | * Retrieves a BIGNUM from the buffer. | ||
97 | */ | ||
98 | int | ||
99 | buffer_get_bignum_ret(Buffer *buffer, BIGNUM *value) | ||
100 | { | ||
101 | u_int bits, bytes; | ||
102 | u_char buf[2], *bin; | ||
103 | |||
104 | /* Get the number of bits. */ | ||
105 | if (buffer_get_ret(buffer, (char *) buf, 2) == -1) { | ||
106 | error("buffer_get_bignum_ret: invalid length"); | ||
107 | return (-1); | ||
108 | } | ||
109 | bits = get_u16(buf); | ||
110 | /* Compute the number of binary bytes that follow. */ | ||
111 | bytes = (bits + 7) / 8; | ||
112 | if (bytes > 8 * 1024) { | ||
113 | error("buffer_get_bignum_ret: cannot handle BN of size %d", bytes); | ||
114 | return (-1); | ||
115 | } | ||
116 | if (buffer_len(buffer) < bytes) { | ||
117 | error("buffer_get_bignum_ret: input buffer too small"); | ||
118 | return (-1); | ||
119 | } | ||
120 | bin = buffer_ptr(buffer); | ||
121 | if (BN_bin2bn(bin, bytes, value) == NULL) { | ||
122 | error("buffer_get_bignum_ret: BN_bin2bn failed"); | ||
123 | return (-1); | ||
124 | } | ||
125 | if (buffer_consume_ret(buffer, bytes) == -1) { | ||
126 | error("buffer_get_bignum_ret: buffer_consume failed"); | ||
127 | return (-1); | ||
128 | } | ||
129 | return (0); | ||
130 | } | ||
131 | |||
132 | void | ||
133 | buffer_get_bignum(Buffer *buffer, BIGNUM *value) | ||
134 | { | ||
135 | if (buffer_get_bignum_ret(buffer, value) == -1) | ||
136 | fatal("buffer_get_bignum: buffer error"); | ||
137 | } | ||
138 | |||
139 | /* | ||
140 | * Stores a BIGNUM in the buffer in SSH2 format. | ||
141 | */ | ||
142 | int | ||
143 | buffer_put_bignum2_ret(Buffer *buffer, const BIGNUM *value) | ||
144 | { | ||
145 | u_int bytes; | ||
146 | u_char *buf; | ||
147 | int oi; | ||
148 | u_int hasnohigh = 0; | ||
149 | |||
150 | if (BN_is_zero(value)) { | ||
151 | buffer_put_int(buffer, 0); | ||
152 | return 0; | ||
153 | } | ||
154 | if (value->neg) { | ||
155 | error("buffer_put_bignum2_ret: negative numbers not supported"); | ||
156 | return (-1); | ||
157 | } | ||
158 | bytes = BN_num_bytes(value) + 1; /* extra padding byte */ | ||
159 | if (bytes < 2) { | ||
160 | error("buffer_put_bignum2_ret: BN too small"); | ||
161 | return (-1); | ||
162 | } | ||
163 | buf = xmalloc(bytes); | ||
164 | buf[0] = 0x00; | ||
165 | /* Get the value of in binary */ | ||
166 | oi = BN_bn2bin(value, buf+1); | ||
167 | if (oi < 0 || (u_int)oi != bytes - 1) { | ||
168 | error("buffer_put_bignum2_ret: BN_bn2bin() failed: " | ||
169 | "oi %d != bin_size %d", oi, bytes); | ||
170 | xfree(buf); | ||
171 | return (-1); | ||
172 | } | ||
173 | hasnohigh = (buf[1] & 0x80) ? 0 : 1; | ||
174 | buffer_put_string(buffer, buf+hasnohigh, bytes-hasnohigh); | ||
175 | memset(buf, 0, bytes); | ||
176 | xfree(buf); | ||
177 | return (0); | ||
178 | } | ||
179 | |||
180 | void | ||
181 | buffer_put_bignum2(Buffer *buffer, const BIGNUM *value) | ||
182 | { | ||
183 | if (buffer_put_bignum2_ret(buffer, value) == -1) | ||
184 | fatal("buffer_put_bignum2: buffer error"); | ||
185 | } | ||
186 | |||
187 | int | ||
188 | buffer_get_bignum2_ret(Buffer *buffer, BIGNUM *value) | ||
189 | { | ||
190 | u_int len; | ||
191 | u_char *bin; | ||
192 | |||
193 | if ((bin = buffer_get_string_ret(buffer, &len)) == NULL) { | ||
194 | error("buffer_get_bignum2_ret: invalid bignum"); | ||
195 | return (-1); | ||
196 | } | ||
197 | |||
198 | if (len > 0 && (bin[0] & 0x80)) { | ||
199 | error("buffer_get_bignum2_ret: negative numbers not supported"); | ||
200 | xfree(bin); | ||
201 | return (-1); | ||
202 | } | ||
203 | if (len > 8 * 1024) { | ||
204 | error("buffer_get_bignum2_ret: cannot handle BN of size %d", len); | ||
205 | xfree(bin); | ||
206 | return (-1); | ||
207 | } | ||
208 | if (BN_bin2bn(bin, len, value) == NULL) { | ||
209 | error("buffer_get_bignum2_ret: BN_bin2bn failed"); | ||
210 | return (-1); | ||
211 | } | ||
212 | xfree(bin); | ||
213 | return (0); | ||
214 | } | ||
215 | |||
216 | void | ||
217 | buffer_get_bignum2(Buffer *buffer, BIGNUM *value) | ||
218 | { | ||
219 | if (buffer_get_bignum2_ret(buffer, value) == -1) | ||
220 | fatal("buffer_get_bignum2: buffer error"); | ||
221 | } | ||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: buffer.c,v 1.31 2006/08/03 03:34:41 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -12,12 +13,21 @@ | |||
12 | */ | 13 | */ |
13 | 14 | ||
14 | #include "includes.h" | 15 | #include "includes.h" |
15 | RCSID("$OpenBSD: buffer.c,v 1.23 2005/03/14 11:46:56 markus Exp $"); | 16 | |
17 | #include <sys/param.h> | ||
18 | |||
19 | #include <stdio.h> | ||
20 | #include <string.h> | ||
21 | #include <stdarg.h> | ||
16 | 22 | ||
17 | #include "xmalloc.h" | 23 | #include "xmalloc.h" |
18 | #include "buffer.h" | 24 | #include "buffer.h" |
19 | #include "log.h" | 25 | #include "log.h" |
20 | 26 | ||
27 | #define BUFFER_MAX_CHUNK 0x100000 | ||
28 | #define BUFFER_MAX_LEN 0xa00000 | ||
29 | #define BUFFER_ALLOCSZ 0x008000 | ||
30 | |||
21 | /* Initializes the buffer structure. */ | 31 | /* Initializes the buffer structure. */ |
22 | 32 | ||
23 | void | 33 | void |
@@ -66,6 +76,23 @@ buffer_append(Buffer *buffer, const void *data, u_int len) | |||
66 | memcpy(p, data, len); | 76 | memcpy(p, data, len); |
67 | } | 77 | } |
68 | 78 | ||
79 | static int | ||
80 | buffer_compact(Buffer *buffer) | ||
81 | { | ||
82 | /* | ||
83 | * If the buffer is quite empty, but all data is at the end, move the | ||
84 | * data to the beginning. | ||
85 | */ | ||
86 | if (buffer->offset > MIN(buffer->alloc, BUFFER_MAX_CHUNK)) { | ||
87 | memmove(buffer->buf, buffer->buf + buffer->offset, | ||
88 | buffer->end - buffer->offset); | ||
89 | buffer->end -= buffer->offset; | ||
90 | buffer->offset = 0; | ||
91 | return (1); | ||
92 | } | ||
93 | return (0); | ||
94 | } | ||
95 | |||
69 | /* | 96 | /* |
70 | * Appends space to the buffer, expanding the buffer if necessary. This does | 97 | * Appends space to the buffer, expanding the buffer if necessary. This does |
71 | * not actually copy the data into the buffer, but instead returns a pointer | 98 | * not actually copy the data into the buffer, but instead returns a pointer |
@@ -93,29 +120,43 @@ restart: | |||
93 | buffer->end += len; | 120 | buffer->end += len; |
94 | return p; | 121 | return p; |
95 | } | 122 | } |
96 | /* | 123 | |
97 | * If the buffer is quite empty, but all data is at the end, move the | 124 | /* Compact data back to the start of the buffer if necessary */ |
98 | * data to the beginning and retry. | 125 | if (buffer_compact(buffer)) |
99 | */ | ||
100 | if (buffer->offset > MIN(buffer->alloc, BUFFER_MAX_CHUNK)) { | ||
101 | memmove(buffer->buf, buffer->buf + buffer->offset, | ||
102 | buffer->end - buffer->offset); | ||
103 | buffer->end -= buffer->offset; | ||
104 | buffer->offset = 0; | ||
105 | goto restart; | 126 | goto restart; |
106 | } | ||
107 | /* Increase the size of the buffer and retry. */ | ||
108 | 127 | ||
109 | newlen = buffer->alloc + len + 32768; | 128 | /* Increase the size of the buffer and retry. */ |
129 | newlen = roundup(buffer->alloc + len, BUFFER_ALLOCSZ); | ||
110 | if (newlen > BUFFER_MAX_LEN) | 130 | if (newlen > BUFFER_MAX_LEN) |
111 | fatal("buffer_append_space: alloc %u not supported", | 131 | fatal("buffer_append_space: alloc %u not supported", |
112 | newlen); | 132 | newlen); |
113 | buffer->buf = xrealloc(buffer->buf, newlen); | 133 | buffer->buf = xrealloc(buffer->buf, 1, newlen); |
114 | buffer->alloc = newlen; | 134 | buffer->alloc = newlen; |
115 | goto restart; | 135 | goto restart; |
116 | /* NOTREACHED */ | 136 | /* NOTREACHED */ |
117 | } | 137 | } |
118 | 138 | ||
139 | /* | ||
140 | * Check whether an allocation of 'len' will fit in the buffer | ||
141 | * This must follow the same math as buffer_append_space | ||
142 | */ | ||
143 | int | ||
144 | buffer_check_alloc(Buffer *buffer, u_int len) | ||
145 | { | ||
146 | if (buffer->offset == buffer->end) { | ||
147 | buffer->offset = 0; | ||
148 | buffer->end = 0; | ||
149 | } | ||
150 | restart: | ||
151 | if (buffer->end + len < buffer->alloc) | ||
152 | return (1); | ||
153 | if (buffer_compact(buffer)) | ||
154 | goto restart; | ||
155 | if (roundup(buffer->alloc + len, BUFFER_ALLOCSZ) <= BUFFER_MAX_LEN) | ||
156 | return (1); | ||
157 | return (0); | ||
158 | } | ||
159 | |||
119 | /* Returns the number of bytes of data in the buffer. */ | 160 | /* Returns the number of bytes of data in the buffer. */ |
120 | 161 | ||
121 | u_int | 162 | u_int |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: buffer.h,v 1.13 2005/03/14 11:46:56 markus Exp $ */ | 1 | /* $OpenBSD: buffer.h,v 1.16 2006/08/03 03:34:41 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -23,9 +23,6 @@ typedef struct { | |||
23 | u_int end; /* Offset of last byte containing data. */ | 23 | u_int end; /* Offset of last byte containing data. */ |
24 | } Buffer; | 24 | } Buffer; |
25 | 25 | ||
26 | #define BUFFER_MAX_CHUNK 0x100000 | ||
27 | #define BUFFER_MAX_LEN 0xa00000 | ||
28 | |||
29 | void buffer_init(Buffer *); | 26 | void buffer_init(Buffer *); |
30 | void buffer_clear(Buffer *); | 27 | void buffer_clear(Buffer *); |
31 | void buffer_free(Buffer *); | 28 | void buffer_free(Buffer *); |
@@ -36,6 +33,8 @@ void *buffer_ptr(Buffer *); | |||
36 | void buffer_append(Buffer *, const void *, u_int); | 33 | void buffer_append(Buffer *, const void *, u_int); |
37 | void *buffer_append_space(Buffer *, u_int); | 34 | void *buffer_append_space(Buffer *, u_int); |
38 | 35 | ||
36 | int buffer_check_alloc(Buffer *, u_int); | ||
37 | |||
39 | void buffer_get(Buffer *, void *, u_int); | 38 | void buffer_get(Buffer *, void *, u_int); |
40 | 39 | ||
41 | void buffer_consume(Buffer *, u_int); | 40 | void buffer_consume(Buffer *, u_int); |
@@ -47,4 +46,40 @@ int buffer_get_ret(Buffer *, void *, u_int); | |||
47 | int buffer_consume_ret(Buffer *, u_int); | 46 | int buffer_consume_ret(Buffer *, u_int); |
48 | int buffer_consume_end_ret(Buffer *, u_int); | 47 | int buffer_consume_end_ret(Buffer *, u_int); |
49 | 48 | ||
49 | #include <openssl/bn.h> | ||
50 | |||
51 | void buffer_put_bignum(Buffer *, const BIGNUM *); | ||
52 | void buffer_put_bignum2(Buffer *, const BIGNUM *); | ||
53 | void buffer_get_bignum(Buffer *, BIGNUM *); | ||
54 | void buffer_get_bignum2(Buffer *, BIGNUM *); | ||
55 | |||
56 | u_short buffer_get_short(Buffer *); | ||
57 | void buffer_put_short(Buffer *, u_short); | ||
58 | |||
59 | u_int buffer_get_int(Buffer *); | ||
60 | void buffer_put_int(Buffer *, u_int); | ||
61 | |||
62 | u_int64_t buffer_get_int64(Buffer *); | ||
63 | void buffer_put_int64(Buffer *, u_int64_t); | ||
64 | |||
65 | int buffer_get_char(Buffer *); | ||
66 | void buffer_put_char(Buffer *, int); | ||
67 | |||
68 | void *buffer_get_string(Buffer *, u_int *); | ||
69 | void buffer_put_string(Buffer *, const void *, u_int); | ||
70 | void buffer_put_cstring(Buffer *, const char *); | ||
71 | |||
72 | #define buffer_skip_string(b) \ | ||
73 | do { u_int l = buffer_get_int(b); buffer_consume(b, l); } while (0) | ||
74 | |||
75 | int buffer_put_bignum_ret(Buffer *, const BIGNUM *); | ||
76 | int buffer_get_bignum_ret(Buffer *, BIGNUM *); | ||
77 | int buffer_put_bignum2_ret(Buffer *, const BIGNUM *); | ||
78 | int buffer_get_bignum2_ret(Buffer *, BIGNUM *); | ||
79 | int buffer_get_short_ret(u_short *, Buffer *); | ||
80 | int buffer_get_int_ret(u_int *, Buffer *); | ||
81 | int buffer_get_int64_ret(u_int64_t *, Buffer *); | ||
82 | void *buffer_get_string_ret(Buffer *, u_int *); | ||
83 | int buffer_get_char_ret(char *, Buffer *); | ||
84 | |||
50 | #endif /* BUFFER_H */ | 85 | #endif /* BUFFER_H */ |
diff --git a/buildpkg.sh.in b/buildpkg.sh.in index cb9eb3048..8a96b9050 100644 --- a/buildpkg.sh.in +++ b/buildpkg.sh.in | |||
@@ -24,6 +24,7 @@ PKGNAME=OpenSSH | |||
24 | # revisions within the same version (REV=a) | 24 | # revisions within the same version (REV=a) |
25 | #REV= | 25 | #REV= |
26 | SYSVINIT_NAME=opensshd | 26 | SYSVINIT_NAME=opensshd |
27 | AWK=${AWK:="nawk"} | ||
27 | MAKE=${MAKE:="make"} | 28 | MAKE=${MAKE:="make"} |
28 | SSHDUID=67 # Default privsep uid | 29 | SSHDUID=67 # Default privsep uid |
29 | SSHDGID=67 # Default privsep gid | 30 | SSHDGID=67 # Default privsep gid |
@@ -35,7 +36,7 @@ SSHDGID=67 # Default privsep gid | |||
35 | SYSVINITSTART=S98 | 36 | SYSVINITSTART=S98 |
36 | SYSVINITSTOPT=K30 | 37 | SYSVINITSTOPT=K30 |
37 | # We will source these if they exist | 38 | # We will source these if they exist |
38 | POST_MAKE_INSTALL_FIXES=./pkg_post_make_install_fixes.sh | 39 | POST_MAKE_INSTALL_FIXES=./pkg-post-make-install-fixes.sh |
39 | POST_PROTOTYPE_EDITS=./pkg-post-prototype-edit.sh | 40 | POST_PROTOTYPE_EDITS=./pkg-post-prototype-edit.sh |
40 | # We'll be one level deeper looking for these | 41 | # We'll be one level deeper looking for these |
41 | PKG_PREINSTALL_LOCAL=../pkg-preinstall.local | 42 | PKG_PREINSTALL_LOCAL=../pkg-preinstall.local |
@@ -46,6 +47,8 @@ PKG_REQUEST_LOCAL=../pkg-request.local | |||
46 | # end of sourced files | 47 | # end of sourced files |
47 | # | 48 | # |
48 | OPENSSHD=opensshd.init | 49 | OPENSSHD=opensshd.init |
50 | OPENSSH_MANIFEST=openssh.xml | ||
51 | OPENSSH_FMRI=svc:/site/${SYSVINIT_NAME}:default | ||
49 | 52 | ||
50 | PATH_GROUPADD_PROG=@PATH_GROUPADD_PROG@ | 53 | PATH_GROUPADD_PROG=@PATH_GROUPADD_PROG@ |
51 | PATH_USERADD_PROG=@PATH_USERADD_PROG@ | 54 | PATH_USERADD_PROG=@PATH_USERADD_PROG@ |
@@ -60,6 +63,10 @@ SYSTEM_DIR="/etc \ | |||
60 | /etc/rc1.d \ | 63 | /etc/rc1.d \ |
61 | /etc/rc2.d \ | 64 | /etc/rc2.d \ |
62 | /etc/opt \ | 65 | /etc/opt \ |
66 | /lib \ | ||
67 | /lib/svc \ | ||
68 | /lib/svc/method \ | ||
69 | /lib/svc/method/site \ | ||
63 | /opt \ | 70 | /opt \ |
64 | /opt/bin \ | 71 | /opt/bin \ |
65 | /usr \ | 72 | /usr \ |
@@ -82,6 +89,9 @@ SYSTEM_DIR="/etc \ | |||
82 | /var \ | 89 | /var \ |
83 | /var/opt \ | 90 | /var/opt \ |
84 | /var/run \ | 91 | /var/run \ |
92 | /var/svc \ | ||
93 | /var/svc/manifest \ | ||
94 | /var/svc/manifest/site \ | ||
85 | /var/tmp \ | 95 | /var/tmp \ |
86 | /tmp" | 96 | /tmp" |
87 | 97 | ||
@@ -119,6 +129,12 @@ do | |||
119 | eval $confvar=`grep "^$confvar=" Makefile | cut -d = -f 2` | 129 | eval $confvar=`grep "^$confvar=" Makefile | cut -d = -f 2` |
120 | done | 130 | done |
121 | 131 | ||
132 | ## Are we using Solaris' SMF? | ||
133 | DO_SMF=0 | ||
134 | if egrep "^#define USE_SOLARIS_PROCESS_CONTRACTS" config.h > /dev/null 2>&1 | ||
135 | then | ||
136 | DO_SMF=1 | ||
137 | fi | ||
122 | 138 | ||
123 | ## Collect value of privsep user | 139 | ## Collect value of privsep user |
124 | for confvar in SSH_PRIVSEP_USER | 140 | for confvar in SSH_PRIVSEP_USER |
@@ -139,15 +155,22 @@ ARCH=`uname -m` | |||
139 | DEF_MSG="\n" | 155 | DEF_MSG="\n" |
140 | OS_VER=`uname -v` | 156 | OS_VER=`uname -v` |
141 | SCRIPT_SHELL=/sbin/sh | 157 | SCRIPT_SHELL=/sbin/sh |
158 | UNAME_R=`uname -r` | ||
142 | UNAME_S=`uname -s` | 159 | UNAME_S=`uname -s` |
143 | case ${UNAME_S} in | 160 | case ${UNAME_S} in |
144 | SunOS) UNAME_S=Solaris | 161 | SunOS) UNAME_S=Solaris |
162 | OS_VER=${UNAME_R} | ||
145 | ARCH=`uname -p` | 163 | ARCH=`uname -p` |
146 | RCS_D=yes | 164 | RCS_D=yes |
147 | DEF_MSG="(default: n)" | 165 | DEF_MSG="(default: n)" |
148 | ;; | 166 | ;; |
149 | SCO_SV) UNAME_S=OpenServer | 167 | SCO_SV) case ${UNAME_R} in |
168 | 3.2) UNAME_S=OpenServer5 | ||
150 | OS_VER=`uname -X | grep Release | sed -e 's/^Rel.*3.2v//'` | 169 | OS_VER=`uname -X | grep Release | sed -e 's/^Rel.*3.2v//'` |
170 | ;; | ||
171 | 5) UNAME_S=OpenServer6 | ||
172 | ;; | ||
173 | esac | ||
151 | SCRIPT_SHELL=/bin/sh | 174 | SCRIPT_SHELL=/bin/sh |
152 | RC1_D=no | 175 | RC1_D=no |
153 | DEF_MSG="(default: n)" | 176 | DEF_MSG="(default: n)" |
@@ -168,10 +191,26 @@ then | |||
168 | fi | 191 | fi |
169 | 192 | ||
170 | ## Setup our run level stuff while we are at it. | 193 | ## Setup our run level stuff while we are at it. |
171 | mkdir -p $FAKE_ROOT${TEST_DIR}/etc/init.d | 194 | if [ $DO_SMF -eq 1 ] |
195 | then | ||
196 | # For Solaris' SMF, /lib/svc/method/site is the preferred place | ||
197 | # for start/stop scripts that aren't supplied with the OS, and | ||
198 | # similarly /var/svc/manifest/site for manifests. | ||
199 | mkdir -p $FAKE_ROOT${TEST_DIR}/lib/svc/method/site | ||
200 | mkdir -p $FAKE_ROOT${TEST_DIR}/var/svc/manifest/site | ||
201 | |||
202 | cp ${OPENSSHD} $FAKE_ROOT${TEST_DIR}/lib/svc/method/site/${SYSVINIT_NAME} | ||
203 | chmod 744 $FAKE_ROOT${TEST_DIR}/lib/svc/method/site/${SYSVINIT_NAME} | ||
204 | |||
205 | cat ${OPENSSH_MANIFEST} | sed "s|__SYSVINIT_NAME__|${SYSVINIT_NAME}|" \ | ||
206 | > $FAKE_ROOT${TEST_DIR}/var/svc/manifest/site/${SYSVINIT_NAME}.xml | ||
207 | chmod 644 $FAKE_ROOT${TEST_DIR}/var/svc/manifest/site/${SYSVINIT_NAME}.xml | ||
208 | else | ||
209 | mkdir -p $FAKE_ROOT${TEST_DIR}/etc/init.d | ||
172 | 210 | ||
173 | cp ${OPENSSHD} $FAKE_ROOT${TEST_DIR}/etc/init.d/${SYSVINIT_NAME} | 211 | cp ${OPENSSHD} $FAKE_ROOT${TEST_DIR}/etc/init.d/${SYSVINIT_NAME} |
174 | chmod 744 $FAKE_ROOT${TEST_DIR}/etc/init.d/${SYSVINIT_NAME} | 212 | chmod 744 $FAKE_ROOT${TEST_DIR}/etc/init.d/${SYSVINIT_NAME} |
213 | fi | ||
175 | 214 | ||
176 | [ "${PERMIT_ROOT_LOGIN}" = no ] && \ | 215 | [ "${PERMIT_ROOT_LOGIN}" = no ] && \ |
177 | perl -p -i -e "s/#PermitRootLogin yes/PermitRootLogin no/" \ | 216 | perl -p -i -e "s/#PermitRootLogin yes/PermitRootLogin no/" \ |
@@ -221,15 +260,22 @@ touch depend | |||
221 | 260 | ||
222 | ## Build space file | 261 | ## Build space file |
223 | echo "Building space file..." | 262 | echo "Building space file..." |
224 | cat > space << _EOF | 263 | if [ $DO_SMF -eq 1 ] |
225 | # extra space required by start/stop links added by installf in postinstall | 264 | then |
265 | # XXX Is this necessary? If not, remove space line from mk-proto.awk. | ||
266 | touch space | ||
267 | else | ||
268 | cat > space << _EOF | ||
269 | # extra space required by start/stop links added by installf | ||
270 | # in postinstall | ||
226 | $TEST_DIR/etc/rc0.d/${SYSVINITSTOPT}${SYSVINIT_NAME} 0 1 | 271 | $TEST_DIR/etc/rc0.d/${SYSVINITSTOPT}${SYSVINIT_NAME} 0 1 |
227 | $TEST_DIR/etc/rc2.d/${SYSVINITSTART}${SYSVINIT_NAME} 0 1 | 272 | $TEST_DIR/etc/rc2.d/${SYSVINITSTART}${SYSVINIT_NAME} 0 1 |
228 | _EOF | 273 | _EOF |
229 | [ "$RC1_D" = no ] || \ | 274 | [ "$RC1_D" = no ] || \ |
230 | echo "$TEST_DIR/etc/rc1.d/${SYSVINITSTOPT}${SYSVINIT_NAME} 0 1" >> space | 275 | echo "$TEST_DIR/etc/rc1.d/${SYSVINITSTOPT}${SYSVINIT_NAME} 0 1" >> space |
231 | [ "$RCS_D" = yes ] && \ | 276 | [ "$RCS_D" = yes ] && \ |
232 | echo "$TEST_DIR/etc/rcS.d/${SYSVINITSTOPT}${SYSVINIT_NAME} 0 1" >> space | 277 | echo "$TEST_DIR/etc/rcS.d/${SYSVINITSTOPT}${SYSVINIT_NAME} 0 1" >> space |
278 | fi | ||
233 | 279 | ||
234 | ## Build preinstall file | 280 | ## Build preinstall file |
235 | echo "Building preinstall file..." | 281 | echo "Building preinstall file..." |
@@ -243,7 +289,16 @@ _EOF | |||
243 | 289 | ||
244 | cat >> preinstall << _EOF | 290 | cat >> preinstall << _EOF |
245 | # | 291 | # |
246 | [ "\${PRE_INS_STOP}" = "yes" ] && ${TEST_DIR}/etc/init.d/${SYSVINIT_NAME} stop | 292 | if [ "\${PRE_INS_STOP}" = "yes" ] |
293 | then | ||
294 | if [ $DO_SMF -eq 1 ] | ||
295 | then | ||
296 | svcadm disable $OPENSSH_FMRI | ||
297 | else | ||
298 | ${TEST_DIR}/etc/init.d/${SYSVINIT_NAME} stop | ||
299 | fi | ||
300 | fi | ||
301 | |||
247 | exit 0 | 302 | exit 0 |
248 | _EOF | 303 | _EOF |
249 | 304 | ||
@@ -265,28 +320,40 @@ cat > postinstall << _EOF | |||
265 | } | 320 | } |
266 | 321 | ||
267 | # make rc?.d dirs only if we are doing a test install | 322 | # make rc?.d dirs only if we are doing a test install |
268 | [ -n "${TEST_DIR}" ] && { | 323 | [ -n "${TEST_DIR}" ] && [ $DO_SMF -ne 1 ] && { |
269 | [ "$RCS_D" = yes ] && mkdir -p ${TEST_DIR}/etc/rcS.d | 324 | [ "$RCS_D" = yes ] && mkdir -p ${TEST_DIR}/etc/rcS.d |
270 | mkdir -p ${TEST_DIR}/etc/rc0.d | 325 | mkdir -p ${TEST_DIR}/etc/rc0.d |
271 | [ "$RC1_D" = no ] || mkdir -p ${TEST_DIR}/etc/rc1.d | 326 | [ "$RC1_D" = no ] || mkdir -p ${TEST_DIR}/etc/rc1.d |
272 | mkdir -p ${TEST_DIR}/etc/rc2.d | 327 | mkdir -p ${TEST_DIR}/etc/rc2.d |
273 | } | 328 | } |
274 | 329 | ||
275 | if [ "\${USE_SYM_LINKS}" = yes ] | 330 | if [ $DO_SMF -eq 1 ] |
276 | then | 331 | then |
277 | [ "$RCS_D" = yes ] && \ | 332 | # Delete the existing service, if it exists, then import the |
278 | installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rcS.d/${SYSVINITSTOPT}${SYSVINIT_NAME}=../init.d/${SYSVINIT_NAME} s | 333 | # new one. |
279 | installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rc0.d/${SYSVINITSTOPT}${SYSVINIT_NAME}=../init.d/${SYSVINIT_NAME} s | 334 | if svcs $OPENSSH_FMRI > /dev/null 2>&1 |
280 | [ "$RC1_D" = no ] || \ | 335 | then |
281 | installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rc1.d/${SYSVINITSTOPT}${SYSVINIT_NAME}=../init.d/${SYSVINIT_NAME} s | 336 | svccfg delete -f $OPENSSH_FMRI |
282 | installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rc2.d/${SYSVINITSTART}${SYSVINIT_NAME}=../init.d/${SYSVINIT_NAME} s | 337 | fi |
338 | # NOTE, The manifest disables sshd by default. | ||
339 | svccfg import ${TEST_DIR}/var/svc/manifest/site/${SYSVINIT_NAME}.xml | ||
283 | else | 340 | else |
284 | [ "$RCS_D" = yes ] && \ | 341 | if [ "\${USE_SYM_LINKS}" = yes ] |
285 | installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rcS.d/${SYSVINITSTOPT}${SYSVINIT_NAME}=\${PKG_INSTALL_ROOT}$TEST_DIR/etc/init.d/${SYSVINIT_NAME} l | 342 | then |
286 | installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rc0.d/${SYSVINITSTOPT}${SYSVINIT_NAME}=\${PKG_INSTALL_ROOT}$TEST_DIR/etc/init.d/${SYSVINIT_NAME} l | 343 | [ "$RCS_D" = yes ] && \ |
287 | [ "$RC1_D" = no ] || \ | 344 | installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rcS.d/${SYSVINITSTOPT}${SYSVINIT_NAME}=../init.d/${SYSVINIT_NAME} s |
288 | installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rc1.d/${SYSVINITSTOPT}${SYSVINIT_NAME}=\${PKG_INSTALL_ROOT}$TEST_DIR/etc/init.d/${SYSVINIT_NAME} l | 345 | installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rc0.d/${SYSVINITSTOPT}${SYSVINIT_NAME}=../init.d/${SYSVINIT_NAME} s |
289 | installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rc2.d/${SYSVINITSTART}${SYSVINIT_NAME}=\${PKG_INSTALL_ROOT}$TEST_DIR/etc/init.d/${SYSVINIT_NAME} l | 346 | [ "$RC1_D" = no ] || \ |
347 | installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rc1.d/${SYSVINITSTOPT}${SYSVINIT_NAME}=../init.d/${SYSVINIT_NAME} s | ||
348 | installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rc2.d/${SYSVINITSTART}${SYSVINIT_NAME}=../init.d/${SYSVINIT_NAME} s | ||
349 | else | ||
350 | [ "$RCS_D" = yes ] && \ | ||
351 | installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rcS.d/${SYSVINITSTOPT}${SYSVINIT_NAME}=\${PKG_INSTALL_ROOT}$TEST_DIR/etc/init.d/${SYSVINIT_NAME} l | ||
352 | installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rc0.d/${SYSVINITSTOPT}${SYSVINIT_NAME}=\${PKG_INSTALL_ROOT}$TEST_DIR/etc/init.d/${SYSVINIT_NAME} l | ||
353 | [ "$RC1_D" = no ] || \ | ||
354 | installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rc1.d/${SYSVINITSTOPT}${SYSVINIT_NAME}=\${PKG_INSTALL_ROOT}$TEST_DIR/etc/init.d/${SYSVINIT_NAME} l | ||
355 | installf ${PKGNAME} \${PKG_INSTALL_ROOT}$TEST_DIR/etc/rc2.d/${SYSVINITSTART}${SYSVINIT_NAME}=\${PKG_INSTALL_ROOT}$TEST_DIR/etc/init.d/${SYSVINIT_NAME} l | ||
356 | fi | ||
290 | fi | 357 | fi |
291 | 358 | ||
292 | # If piddir doesn't exist we add it. (Ie. --with-pid-dir=/var/opt/ssh) | 359 | # If piddir doesn't exist we add it. (Ie. --with-pid-dir=/var/opt/ssh) |
@@ -311,14 +378,7 @@ then | |||
311 | chroot=echo | 378 | chroot=echo |
312 | fi | 379 | fi |
313 | 380 | ||
314 | if egrep '^[ \t]*UsePrivilegeSeparation[ \t]+no' \${PKG_INSTALL_ROOT}/$sysconfdir/sshd_config >/dev/null | 381 | echo "PrivilegeSeparation user always required." |
315 | then | ||
316 | echo "UsePrivilegeSeparation disabled in config, not creating PrivSep user" | ||
317 | echo "or group." | ||
318 | else | ||
319 | echo "UsePrivilegeSeparation enabled in config (or defaulting to on)." | ||
320 | |||
321 | # user required? | ||
322 | if cut -f1 -d: \${PKG_INSTALL_ROOT}/etc/passwd | egrep '^'$SSH_PRIVSEP_USER'\$' >/dev/null | 382 | if cut -f1 -d: \${PKG_INSTALL_ROOT}/etc/passwd | egrep '^'$SSH_PRIVSEP_USER'\$' >/dev/null |
323 | then | 383 | then |
324 | echo "PrivSep user $SSH_PRIVSEP_USER already exists." | 384 | echo "PrivSep user $SSH_PRIVSEP_USER already exists." |
@@ -363,9 +423,16 @@ else | |||
363 | \$chroot ${PATH_USERADD_PROG} -c 'SSHD PrivSep User' -s /bin/false -g $SSH_PRIVSEP_USER \$sshduid $SSH_PRIVSEP_USER | 423 | \$chroot ${PATH_USERADD_PROG} -c 'SSHD PrivSep User' -s /bin/false -g $SSH_PRIVSEP_USER \$sshduid $SSH_PRIVSEP_USER |
364 | \$chroot ${PATH_PASSWD_PROG} -l $SSH_PRIVSEP_USER | 424 | \$chroot ${PATH_PASSWD_PROG} -l $SSH_PRIVSEP_USER |
365 | } | 425 | } |
366 | fi | ||
367 | 426 | ||
368 | [ "\${POST_INS_START}" = "yes" ] && ${TEST_DIR}/etc/init.d/${SYSVINIT_NAME} start | 427 | if [ "\${POST_INS_START}" = "yes" ] |
428 | then | ||
429 | if [ $DO_SMF -eq 1 ] | ||
430 | then | ||
431 | svcadm enable $OPENSSH_FMRI | ||
432 | else | ||
433 | ${TEST_DIR}/etc/init.d/${SYSVINIT_NAME} start | ||
434 | fi | ||
435 | fi | ||
369 | exit 0 | 436 | exit 0 |
370 | _EOF | 437 | _EOF |
371 | 438 | ||
@@ -374,7 +441,12 @@ echo "Building preremove file..." | |||
374 | cat > preremove << _EOF | 441 | cat > preremove << _EOF |
375 | #! ${SCRIPT_SHELL} | 442 | #! ${SCRIPT_SHELL} |
376 | # | 443 | # |
377 | ${TEST_DIR}/etc/init.d/${SYSVINIT_NAME} stop | 444 | if [ $DO_SMF -eq 1 ] |
445 | then | ||
446 | svcadm disable $OPENSSH_FMRI | ||
447 | else | ||
448 | ${TEST_DIR}/etc/init.d/${SYSVINIT_NAME} stop | ||
449 | fi | ||
378 | _EOF | 450 | _EOF |
379 | 451 | ||
380 | # local preremove changes here | 452 | # local preremove changes here |
@@ -389,6 +461,13 @@ echo "Building postremove file..." | |||
389 | cat > postremove << _EOF | 461 | cat > postremove << _EOF |
390 | #! ${SCRIPT_SHELL} | 462 | #! ${SCRIPT_SHELL} |
391 | # | 463 | # |
464 | if [ $DO_SMF -eq 1 ] | ||
465 | then | ||
466 | if svcs $OPENSSH_FMRI > /dev/null 2>&1 | ||
467 | then | ||
468 | svccfg delete -f $OPENSSH_FMRI | ||
469 | fi | ||
470 | fi | ||
392 | _EOF | 471 | _EOF |
393 | 472 | ||
394 | # local postremove changes here | 473 | # local postremove changes here |
@@ -408,7 +487,7 @@ _EOF | |||
408 | [ -x /usr/bin/ckyorn ] || cat >> request << _EOF | 487 | [ -x /usr/bin/ckyorn ] || cat >> request << _EOF |
409 | 488 | ||
410 | ckyorn() { | 489 | ckyorn() { |
411 | # for some strange reason OpenServer has no ckyorn | 490 | # for some strange reason OpenServer5 has no ckyorn |
412 | # We build a striped down version here | 491 | # We build a striped down version here |
413 | 492 | ||
414 | DEFAULT=n | 493 | DEFAULT=n |
@@ -454,7 +533,45 @@ done | |||
454 | 533 | ||
455 | _EOF | 534 | _EOF |
456 | 535 | ||
457 | cat >> request << _EOF | 536 | if [ $DO_SMF -eq 1 ] |
537 | then | ||
538 | # This could get hairy, as the running sshd may not be under SMF. | ||
539 | # We'll assume an earlier version of OpenSSH started via SMF. | ||
540 | cat >> request << _EOF | ||
541 | PRE_INS_STOP=no | ||
542 | POST_INS_START=no | ||
543 | # determine if should restart the daemon | ||
544 | if [ -s ${piddir}/sshd.pid ] && \ | ||
545 | /usr/bin/svcs -H $OPENSSH_FMRI 2>&1 | egrep "^online" > /dev/null 2>&1 | ||
546 | then | ||
547 | ans=\`ckyorn -d n \ | ||
548 | -p "Should the running sshd daemon be restarted? ${DEF_MSG}"\` || exit \$? | ||
549 | case \$ans in | ||
550 | [y,Y]*) PRE_INS_STOP=yes | ||
551 | POST_INS_START=yes | ||
552 | ;; | ||
553 | esac | ||
554 | |||
555 | else | ||
556 | |||
557 | # determine if we should start sshd | ||
558 | ans=\`ckyorn -d n \ | ||
559 | -p "Start the sshd daemon after installing this package? ${DEF_MSG}"\` || exit \$? | ||
560 | case \$ans in | ||
561 | [y,Y]*) POST_INS_START=yes ;; | ||
562 | esac | ||
563 | fi | ||
564 | |||
565 | # make parameters available to installation service, | ||
566 | # and so to any other packaging scripts | ||
567 | cat >\$1 <<! | ||
568 | PRE_INS_STOP='\$PRE_INS_STOP' | ||
569 | POST_INS_START='\$POST_INS_START' | ||
570 | ! | ||
571 | |||
572 | _EOF | ||
573 | else | ||
574 | cat >> request << _EOF | ||
458 | USE_SYM_LINKS=no | 575 | USE_SYM_LINKS=no |
459 | PRE_INS_STOP=no | 576 | PRE_INS_STOP=no |
460 | POST_INS_START=no | 577 | POST_INS_START=no |
@@ -495,6 +612,7 @@ POST_INS_START='\$POST_INS_START' | |||
495 | ! | 612 | ! |
496 | 613 | ||
497 | _EOF | 614 | _EOF |
615 | fi | ||
498 | 616 | ||
499 | # local request changes here | 617 | # local request changes here |
500 | [ -s "${PKG_REQUEST_LOCAL}" ] && . ${PKG_REQUEST_LOCAL} | 618 | [ -s "${PKG_REQUEST_LOCAL}" ] && . ${PKG_REQUEST_LOCAL} |
@@ -526,7 +644,7 @@ cat >mk-proto.awk << _EOF | |||
526 | _EOF | 644 | _EOF |
527 | 645 | ||
528 | find . | egrep -v "prototype|pkginfo|mk-proto.awk" | sort | \ | 646 | find . | egrep -v "prototype|pkginfo|mk-proto.awk" | sort | \ |
529 | pkgproto $PROTO_ARGS | nawk -f mk-proto.awk > prototype | 647 | pkgproto $PROTO_ARGS | ${AWK} -f mk-proto.awk > prototype |
530 | 648 | ||
531 | # /usr/local is a symlink on some systems | 649 | # /usr/local is a symlink on some systems |
532 | [ "${USR_LOCAL_IS_SYMLINK}" = yes ] && { | 650 | [ "${USR_LOCAL_IS_SYMLINK}" = yes ] && { |
diff --git a/canohost.c b/canohost.c index 6ca60e6b4..2345cc35c 100644 --- a/canohost.c +++ b/canohost.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: canohost.c,v 1.61 2006/08/03 03:34:41 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -12,10 +13,23 @@ | |||
12 | */ | 13 | */ |
13 | 14 | ||
14 | #include "includes.h" | 15 | #include "includes.h" |
15 | RCSID("$OpenBSD: canohost.c,v 1.48 2005/12/28 22:46:06 stevesk Exp $"); | ||
16 | 16 | ||
17 | #include "packet.h" | 17 | #include <sys/types.h> |
18 | #include <sys/socket.h> | ||
19 | |||
20 | #include <netinet/in.h> | ||
21 | #include <arpa/inet.h> | ||
22 | |||
23 | #include <ctype.h> | ||
24 | #include <errno.h> | ||
25 | #include <netdb.h> | ||
26 | #include <stdio.h> | ||
27 | #include <stdlib.h> | ||
28 | #include <string.h> | ||
29 | #include <stdarg.h> | ||
30 | |||
18 | #include "xmalloc.h" | 31 | #include "xmalloc.h" |
32 | #include "packet.h" | ||
19 | #include "log.h" | 33 | #include "log.h" |
20 | #include "canohost.h" | 34 | #include "canohost.h" |
21 | 35 | ||
@@ -43,6 +57,9 @@ get_remote_hostname(int sock, int use_dns) | |||
43 | cleanup_exit(255); | 57 | cleanup_exit(255); |
44 | } | 58 | } |
45 | 59 | ||
60 | if (from.ss_family == AF_INET) | ||
61 | check_ip_options(sock, ntop); | ||
62 | |||
46 | ipv64_normalise_mapped(&from, &fromlen); | 63 | ipv64_normalise_mapped(&from, &fromlen); |
47 | 64 | ||
48 | if (from.ss_family == AF_INET6) | 65 | if (from.ss_family == AF_INET6) |
@@ -52,9 +69,6 @@ get_remote_hostname(int sock, int use_dns) | |||
52 | NULL, 0, NI_NUMERICHOST) != 0) | 69 | NULL, 0, NI_NUMERICHOST) != 0) |
53 | fatal("get_remote_hostname: getnameinfo NI_NUMERICHOST failed"); | 70 | fatal("get_remote_hostname: getnameinfo NI_NUMERICHOST failed"); |
54 | 71 | ||
55 | if (from.ss_family == AF_INET) | ||
56 | check_ip_options(sock, ntop); | ||
57 | |||
58 | if (!use_dns) | 72 | if (!use_dns) |
59 | return xstrdup(ntop); | 73 | return xstrdup(ntop); |
60 | 74 | ||
@@ -87,7 +101,7 @@ get_remote_hostname(int sock, int use_dns) | |||
87 | */ | 101 | */ |
88 | for (i = 0; name[i]; i++) | 102 | for (i = 0; name[i]; i++) |
89 | if (isupper(name[i])) | 103 | if (isupper(name[i])) |
90 | name[i] = tolower(name[i]); | 104 | name[i] = (char)tolower(name[i]); |
91 | /* | 105 | /* |
92 | * Map it back to an IP address and check that the given | 106 | * Map it back to an IP address and check that the given |
93 | * address actually is an address of this host. This is | 107 | * address actually is an address of this host. This is |
@@ -102,7 +116,7 @@ get_remote_hostname(int sock, int use_dns) | |||
102 | hints.ai_socktype = SOCK_STREAM; | 116 | hints.ai_socktype = SOCK_STREAM; |
103 | if (getaddrinfo(name, NULL, &hints, &aitop) != 0) { | 117 | if (getaddrinfo(name, NULL, &hints, &aitop) != 0) { |
104 | logit("reverse mapping checking getaddrinfo for %.700s " | 118 | logit("reverse mapping checking getaddrinfo for %.700s " |
105 | "failed - POSSIBLE BREAK-IN ATTEMPT!", name); | 119 | "[%s] failed - POSSIBLE BREAK-IN ATTEMPT!", name, ntop); |
106 | return xstrdup(ntop); | 120 | return xstrdup(ntop); |
107 | } | 121 | } |
108 | /* Look for the address from the list of addresses. */ | 122 | /* Look for the address from the list of addresses. */ |
diff --git a/canohost.h b/canohost.h index df1f125e5..e33e8941b 100644 --- a/canohost.h +++ b/canohost.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: canohost.h,v 1.8 2001/06/26 17:27:23 markus Exp $ */ | 1 | /* $OpenBSD: canohost.h,v 1.9 2006/03/25 22:22:42 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
diff --git a/channels.c b/channels.c index 92448da77..530c0d460 100644 --- a/channels.c +++ b/channels.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: channels.c,v 1.268 2007/01/03 03:01:40 stevesk Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -39,22 +40,41 @@ | |||
39 | */ | 40 | */ |
40 | 41 | ||
41 | #include "includes.h" | 42 | #include "includes.h" |
42 | RCSID("$OpenBSD: channels.c,v 1.232 2006/01/30 12:22:22 reyk Exp $"); | ||
43 | 43 | ||
44 | #include <sys/types.h> | ||
45 | #include <sys/ioctl.h> | ||
46 | #include <sys/un.h> | ||
47 | #include <sys/socket.h> | ||
48 | #ifdef HAVE_SYS_TIME_H | ||
49 | # include <sys/time.h> | ||
50 | #endif | ||
51 | |||
52 | #include <netinet/in.h> | ||
53 | #include <arpa/inet.h> | ||
54 | |||
55 | #include <errno.h> | ||
56 | #include <netdb.h> | ||
57 | #include <stdio.h> | ||
58 | #include <stdlib.h> | ||
59 | #include <string.h> | ||
60 | #include <termios.h> | ||
61 | #include <unistd.h> | ||
62 | #include <stdarg.h> | ||
63 | |||
64 | #include "xmalloc.h" | ||
44 | #include "ssh.h" | 65 | #include "ssh.h" |
45 | #include "ssh1.h" | 66 | #include "ssh1.h" |
46 | #include "ssh2.h" | 67 | #include "ssh2.h" |
47 | #include "packet.h" | 68 | #include "packet.h" |
48 | #include "xmalloc.h" | ||
49 | #include "log.h" | 69 | #include "log.h" |
50 | #include "misc.h" | 70 | #include "misc.h" |
71 | #include "buffer.h" | ||
51 | #include "channels.h" | 72 | #include "channels.h" |
52 | #include "compat.h" | 73 | #include "compat.h" |
53 | #include "canohost.h" | 74 | #include "canohost.h" |
54 | #include "key.h" | 75 | #include "key.h" |
55 | #include "authfd.h" | 76 | #include "authfd.h" |
56 | #include "pathnames.h" | 77 | #include "pathnames.h" |
57 | #include "bufaux.h" | ||
58 | 78 | ||
59 | /* -- channel core */ | 79 | /* -- channel core */ |
60 | 80 | ||
@@ -91,11 +111,18 @@ typedef struct { | |||
91 | u_short listen_port; /* Remote side should listen port number. */ | 111 | u_short listen_port; /* Remote side should listen port number. */ |
92 | } ForwardPermission; | 112 | } ForwardPermission; |
93 | 113 | ||
94 | /* List of all permitted host/port pairs to connect. */ | 114 | /* List of all permitted host/port pairs to connect by the user. */ |
95 | static ForwardPermission permitted_opens[SSH_MAX_FORWARDS_PER_DIRECTION]; | 115 | static ForwardPermission permitted_opens[SSH_MAX_FORWARDS_PER_DIRECTION]; |
96 | 116 | ||
97 | /* Number of permitted host/port pairs in the array. */ | 117 | /* List of all permitted host/port pairs to connect by the admin. */ |
118 | static ForwardPermission permitted_adm_opens[SSH_MAX_FORWARDS_PER_DIRECTION]; | ||
119 | |||
120 | /* Number of permitted host/port pairs in the array permitted by the user. */ | ||
98 | static int num_permitted_opens = 0; | 121 | static int num_permitted_opens = 0; |
122 | |||
123 | /* Number of permitted host/port pair in the array permitted by the admin. */ | ||
124 | static int num_adm_permitted_opens = 0; | ||
125 | |||
99 | /* | 126 | /* |
100 | * If this is true, all opens are permitted. This is the case on the server | 127 | * If this is true, all opens are permitted. This is the case on the server |
101 | * on which we have to trust the client anyway, and the user could do | 128 | * on which we have to trust the client anyway, and the user could do |
@@ -123,7 +150,7 @@ static u_int x11_saved_data_len = 0; | |||
123 | * Fake X11 authentication data. This is what the server will be sending us; | 150 | * Fake X11 authentication data. This is what the server will be sending us; |
124 | * we should replace any occurrences of this by the real data. | 151 | * we should replace any occurrences of this by the real data. |
125 | */ | 152 | */ |
126 | static char *x11_fake_data = NULL; | 153 | static u_char *x11_fake_data = NULL; |
127 | static u_int x11_fake_data_len; | 154 | static u_int x11_fake_data_len; |
128 | 155 | ||
129 | 156 | ||
@@ -168,7 +195,7 @@ channel_lookup(int id) | |||
168 | if ((c = channel_by_id(id)) == NULL) | 195 | if ((c = channel_by_id(id)) == NULL) |
169 | return (NULL); | 196 | return (NULL); |
170 | 197 | ||
171 | switch(c->type) { | 198 | switch (c->type) { |
172 | case SSH_CHANNEL_X11_OPEN: | 199 | case SSH_CHANNEL_X11_OPEN: |
173 | case SSH_CHANNEL_LARVAL: | 200 | case SSH_CHANNEL_LARVAL: |
174 | case SSH_CHANNEL_CONNECTING: | 201 | case SSH_CHANNEL_CONNECTING: |
@@ -178,7 +205,6 @@ channel_lookup(int id) | |||
178 | case SSH_CHANNEL_INPUT_DRAINING: | 205 | case SSH_CHANNEL_INPUT_DRAINING: |
179 | case SSH_CHANNEL_OUTPUT_DRAINING: | 206 | case SSH_CHANNEL_OUTPUT_DRAINING: |
180 | return (c); | 207 | return (c); |
181 | break; | ||
182 | } | 208 | } |
183 | logit("Non-public channel %d, type %d.", id, c->type); | 209 | logit("Non-public channel %d, type %d.", id, c->type); |
184 | return (NULL); | 210 | return (NULL); |
@@ -188,7 +214,6 @@ channel_lookup(int id) | |||
188 | * Register filedescriptors for a channel, used when allocating a channel or | 214 | * Register filedescriptors for a channel, used when allocating a channel or |
189 | * when the channel consumer/producer is ready, e.g. shell exec'd | 215 | * when the channel consumer/producer is ready, e.g. shell exec'd |
190 | */ | 216 | */ |
191 | |||
192 | static void | 217 | static void |
193 | channel_register_fds(Channel *c, int rfd, int wfd, int efd, | 218 | channel_register_fds(Channel *c, int rfd, int wfd, int efd, |
194 | int extusage, int nonblock) | 219 | int extusage, int nonblock) |
@@ -235,7 +260,6 @@ channel_register_fds(Channel *c, int rfd, int wfd, int efd, | |||
235 | * Allocate a new channel object and set its type and socket. This will cause | 260 | * Allocate a new channel object and set its type and socket. This will cause |
236 | * remote_name to be freed. | 261 | * remote_name to be freed. |
237 | */ | 262 | */ |
238 | |||
239 | Channel * | 263 | Channel * |
240 | channel_new(char *ctype, int type, int rfd, int wfd, int efd, | 264 | channel_new(char *ctype, int type, int rfd, int wfd, int efd, |
241 | u_int window, u_int maxpack, int extusage, char *remote_name, int nonblock) | 265 | u_int window, u_int maxpack, int extusage, char *remote_name, int nonblock) |
@@ -247,7 +271,7 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd, | |||
247 | /* Do initial allocation if this is the first call. */ | 271 | /* Do initial allocation if this is the first call. */ |
248 | if (channels_alloc == 0) { | 272 | if (channels_alloc == 0) { |
249 | channels_alloc = 10; | 273 | channels_alloc = 10; |
250 | channels = xmalloc(channels_alloc * sizeof(Channel *)); | 274 | channels = xcalloc(channels_alloc, sizeof(Channel *)); |
251 | for (i = 0; i < channels_alloc; i++) | 275 | for (i = 0; i < channels_alloc; i++) |
252 | channels[i] = NULL; | 276 | channels[i] = NULL; |
253 | } | 277 | } |
@@ -264,16 +288,15 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd, | |||
264 | if (channels_alloc > 10000) | 288 | if (channels_alloc > 10000) |
265 | fatal("channel_new: internal error: channels_alloc %d " | 289 | fatal("channel_new: internal error: channels_alloc %d " |
266 | "too big.", channels_alloc); | 290 | "too big.", channels_alloc); |
267 | channels = xrealloc(channels, | 291 | channels = xrealloc(channels, channels_alloc + 10, |
268 | (channels_alloc + 10) * sizeof(Channel *)); | 292 | sizeof(Channel *)); |
269 | channels_alloc += 10; | 293 | channels_alloc += 10; |
270 | debug2("channel: expanding %d", channels_alloc); | 294 | debug2("channel: expanding %d", channels_alloc); |
271 | for (i = found; i < channels_alloc; i++) | 295 | for (i = found; i < channels_alloc; i++) |
272 | channels[i] = NULL; | 296 | channels[i] = NULL; |
273 | } | 297 | } |
274 | /* Initialize and return new channel. */ | 298 | /* Initialize and return new channel. */ |
275 | c = channels[found] = xmalloc(sizeof(Channel)); | 299 | c = channels[found] = xcalloc(1, sizeof(Channel)); |
276 | memset(c, 0, sizeof(Channel)); | ||
277 | buffer_init(&c->input); | 300 | buffer_init(&c->input); |
278 | buffer_init(&c->output); | 301 | buffer_init(&c->output); |
279 | buffer_init(&c->extended); | 302 | buffer_init(&c->extended); |
@@ -337,7 +360,6 @@ channel_close_fd(int *fdp) | |||
337 | } | 360 | } |
338 | 361 | ||
339 | /* Close all channel fd/socket. */ | 362 | /* Close all channel fd/socket. */ |
340 | |||
341 | static void | 363 | static void |
342 | channel_close_fds(Channel *c) | 364 | channel_close_fds(Channel *c) |
343 | { | 365 | { |
@@ -352,7 +374,6 @@ channel_close_fds(Channel *c) | |||
352 | } | 374 | } |
353 | 375 | ||
354 | /* Free the channel and close its fd/socket. */ | 376 | /* Free the channel and close its fd/socket. */ |
355 | |||
356 | void | 377 | void |
357 | channel_free(Channel *c) | 378 | channel_free(Channel *c) |
358 | { | 379 | { |
@@ -399,7 +420,6 @@ channel_free_all(void) | |||
399 | * Closes the sockets/fds of all channels. This is used to close extra file | 420 | * Closes the sockets/fds of all channels. This is used to close extra file |
400 | * descriptors after a fork. | 421 | * descriptors after a fork. |
401 | */ | 422 | */ |
402 | |||
403 | void | 423 | void |
404 | channel_close_all(void) | 424 | channel_close_all(void) |
405 | { | 425 | { |
@@ -413,7 +433,6 @@ channel_close_all(void) | |||
413 | /* | 433 | /* |
414 | * Stop listening to channels. | 434 | * Stop listening to channels. |
415 | */ | 435 | */ |
416 | |||
417 | void | 436 | void |
418 | channel_stop_listening(void) | 437 | channel_stop_listening(void) |
419 | { | 438 | { |
@@ -440,7 +459,6 @@ channel_stop_listening(void) | |||
440 | * Returns true if no channel has too much buffered data, and false if one or | 459 | * Returns true if no channel has too much buffered data, and false if one or |
441 | * more channel is overfull. | 460 | * more channel is overfull. |
442 | */ | 461 | */ |
443 | |||
444 | int | 462 | int |
445 | channel_not_very_much_buffered_data(void) | 463 | channel_not_very_much_buffered_data(void) |
446 | { | 464 | { |
@@ -470,7 +488,6 @@ channel_not_very_much_buffered_data(void) | |||
470 | } | 488 | } |
471 | 489 | ||
472 | /* Returns true if any channel is still open. */ | 490 | /* Returns true if any channel is still open. */ |
473 | |||
474 | int | 491 | int |
475 | channel_still_open(void) | 492 | channel_still_open(void) |
476 | { | 493 | { |
@@ -513,7 +530,6 @@ channel_still_open(void) | |||
513 | } | 530 | } |
514 | 531 | ||
515 | /* Returns the id of an open channel suitable for keepaliving */ | 532 | /* Returns the id of an open channel suitable for keepaliving */ |
516 | |||
517 | int | 533 | int |
518 | channel_find_open(void) | 534 | channel_find_open(void) |
519 | { | 535 | { |
@@ -558,7 +574,6 @@ channel_find_open(void) | |||
558 | * suitable for sending to the client. The message contains crlf pairs for | 574 | * suitable for sending to the client. The message contains crlf pairs for |
559 | * newlines. | 575 | * newlines. |
560 | */ | 576 | */ |
561 | |||
562 | char * | 577 | char * |
563 | channel_open_message(void) | 578 | channel_open_message(void) |
564 | { | 579 | { |
@@ -643,6 +658,7 @@ channel_request_start(int id, char *service, int wantconfirm) | |||
643 | packet_put_cstring(service); | 658 | packet_put_cstring(service); |
644 | packet_put_char(wantconfirm); | 659 | packet_put_char(wantconfirm); |
645 | } | 660 | } |
661 | |||
646 | void | 662 | void |
647 | channel_register_confirm(int id, channel_callback_fn *fn, void *ctx) | 663 | channel_register_confirm(int id, channel_callback_fn *fn, void *ctx) |
648 | { | 664 | { |
@@ -655,6 +671,7 @@ channel_register_confirm(int id, channel_callback_fn *fn, void *ctx) | |||
655 | c->confirm = fn; | 671 | c->confirm = fn; |
656 | c->confirm_ctx = ctx; | 672 | c->confirm_ctx = ctx; |
657 | } | 673 | } |
674 | |||
658 | void | 675 | void |
659 | channel_register_cleanup(int id, channel_callback_fn *fn, int do_close) | 676 | channel_register_cleanup(int id, channel_callback_fn *fn, int do_close) |
660 | { | 677 | { |
@@ -667,6 +684,7 @@ channel_register_cleanup(int id, channel_callback_fn *fn, int do_close) | |||
667 | c->detach_user = fn; | 684 | c->detach_user = fn; |
668 | c->detach_close = do_close; | 685 | c->detach_close = do_close; |
669 | } | 686 | } |
687 | |||
670 | void | 688 | void |
671 | channel_cancel_cleanup(int id) | 689 | channel_cancel_cleanup(int id) |
672 | { | 690 | { |
@@ -679,6 +697,7 @@ channel_cancel_cleanup(int id) | |||
679 | c->detach_user = NULL; | 697 | c->detach_user = NULL; |
680 | c->detach_close = 0; | 698 | c->detach_close = 0; |
681 | } | 699 | } |
700 | |||
682 | void | 701 | void |
683 | channel_register_filter(int id, channel_infilter_fn *ifn, | 702 | channel_register_filter(int id, channel_infilter_fn *ifn, |
684 | channel_outfilter_fn *ofn) | 703 | channel_outfilter_fn *ofn) |
@@ -718,25 +737,27 @@ channel_set_fds(int id, int rfd, int wfd, int efd, | |||
718 | * 'channel_post*': perform any appropriate operations for channels which | 737 | * 'channel_post*': perform any appropriate operations for channels which |
719 | * have events pending. | 738 | * have events pending. |
720 | */ | 739 | */ |
721 | typedef void chan_fn(Channel *c, fd_set * readset, fd_set * writeset); | 740 | typedef void chan_fn(Channel *c, fd_set *readset, fd_set *writeset); |
722 | chan_fn *channel_pre[SSH_CHANNEL_MAX_TYPE]; | 741 | chan_fn *channel_pre[SSH_CHANNEL_MAX_TYPE]; |
723 | chan_fn *channel_post[SSH_CHANNEL_MAX_TYPE]; | 742 | chan_fn *channel_post[SSH_CHANNEL_MAX_TYPE]; |
724 | 743 | ||
744 | /* ARGSUSED */ | ||
725 | static void | 745 | static void |
726 | channel_pre_listener(Channel *c, fd_set * readset, fd_set * writeset) | 746 | channel_pre_listener(Channel *c, fd_set *readset, fd_set *writeset) |
727 | { | 747 | { |
728 | FD_SET(c->sock, readset); | 748 | FD_SET(c->sock, readset); |
729 | } | 749 | } |
730 | 750 | ||
751 | /* ARGSUSED */ | ||
731 | static void | 752 | static void |
732 | channel_pre_connecting(Channel *c, fd_set * readset, fd_set * writeset) | 753 | channel_pre_connecting(Channel *c, fd_set *readset, fd_set *writeset) |
733 | { | 754 | { |
734 | debug3("channel %d: waiting for connection", c->self); | 755 | debug3("channel %d: waiting for connection", c->self); |
735 | FD_SET(c->sock, writeset); | 756 | FD_SET(c->sock, writeset); |
736 | } | 757 | } |
737 | 758 | ||
738 | static void | 759 | static void |
739 | channel_pre_open_13(Channel *c, fd_set * readset, fd_set * writeset) | 760 | channel_pre_open_13(Channel *c, fd_set *readset, fd_set *writeset) |
740 | { | 761 | { |
741 | if (buffer_len(&c->input) < packet_get_maxsize()) | 762 | if (buffer_len(&c->input) < packet_get_maxsize()) |
742 | FD_SET(c->sock, readset); | 763 | FD_SET(c->sock, readset); |
@@ -745,16 +766,14 @@ channel_pre_open_13(Channel *c, fd_set * readset, fd_set * writeset) | |||
745 | } | 766 | } |
746 | 767 | ||
747 | static void | 768 | static void |
748 | channel_pre_open(Channel *c, fd_set * readset, fd_set * writeset) | 769 | channel_pre_open(Channel *c, fd_set *readset, fd_set *writeset) |
749 | { | 770 | { |
750 | u_int limit = compat20 ? c->remote_window : packet_get_maxsize(); | 771 | u_int limit = compat20 ? c->remote_window : packet_get_maxsize(); |
751 | 772 | ||
752 | /* check buffer limits */ | ||
753 | limit = MIN(limit, (BUFFER_MAX_LEN - BUFFER_MAX_CHUNK - CHAN_RBUF)); | ||
754 | |||
755 | if (c->istate == CHAN_INPUT_OPEN && | 773 | if (c->istate == CHAN_INPUT_OPEN && |
756 | limit > 0 && | 774 | limit > 0 && |
757 | buffer_len(&c->input) < limit) | 775 | buffer_len(&c->input) < limit && |
776 | buffer_check_alloc(&c->input, CHAN_RBUF)) | ||
758 | FD_SET(c->rfd, readset); | 777 | FD_SET(c->rfd, readset); |
759 | if (c->ostate == CHAN_OUTPUT_OPEN || | 778 | if (c->ostate == CHAN_OUTPUT_OPEN || |
760 | c->ostate == CHAN_OUTPUT_WAIT_DRAIN) { | 779 | c->ostate == CHAN_OUTPUT_WAIT_DRAIN) { |
@@ -784,8 +803,9 @@ channel_pre_open(Channel *c, fd_set * readset, fd_set * writeset) | |||
784 | FD_SET(c->ctl_fd, readset); | 803 | FD_SET(c->ctl_fd, readset); |
785 | } | 804 | } |
786 | 805 | ||
806 | /* ARGSUSED */ | ||
787 | static void | 807 | static void |
788 | channel_pre_input_draining(Channel *c, fd_set * readset, fd_set * writeset) | 808 | channel_pre_input_draining(Channel *c, fd_set *readset, fd_set *writeset) |
789 | { | 809 | { |
790 | if (buffer_len(&c->input) == 0) { | 810 | if (buffer_len(&c->input) == 0) { |
791 | packet_start(SSH_MSG_CHANNEL_CLOSE); | 811 | packet_start(SSH_MSG_CHANNEL_CLOSE); |
@@ -796,8 +816,9 @@ channel_pre_input_draining(Channel *c, fd_set * readset, fd_set * writeset) | |||
796 | } | 816 | } |
797 | } | 817 | } |
798 | 818 | ||
819 | /* ARGSUSED */ | ||
799 | static void | 820 | static void |
800 | channel_pre_output_draining(Channel *c, fd_set * readset, fd_set * writeset) | 821 | channel_pre_output_draining(Channel *c, fd_set *readset, fd_set *writeset) |
801 | { | 822 | { |
802 | if (buffer_len(&c->output) == 0) | 823 | if (buffer_len(&c->output) == 0) |
803 | chan_mark_dead(c); | 824 | chan_mark_dead(c); |
@@ -873,7 +894,7 @@ x11_open_helper(Buffer *b) | |||
873 | } | 894 | } |
874 | 895 | ||
875 | static void | 896 | static void |
876 | channel_pre_x11_open_13(Channel *c, fd_set * readset, fd_set * writeset) | 897 | channel_pre_x11_open_13(Channel *c, fd_set *readset, fd_set *writeset) |
877 | { | 898 | { |
878 | int ret = x11_open_helper(&c->output); | 899 | int ret = x11_open_helper(&c->output); |
879 | 900 | ||
@@ -899,7 +920,7 @@ channel_pre_x11_open_13(Channel *c, fd_set * readset, fd_set * writeset) | |||
899 | } | 920 | } |
900 | 921 | ||
901 | static void | 922 | static void |
902 | channel_pre_x11_open(Channel *c, fd_set * readset, fd_set * writeset) | 923 | channel_pre_x11_open(Channel *c, fd_set *readset, fd_set *writeset) |
903 | { | 924 | { |
904 | int ret = x11_open_helper(&c->output); | 925 | int ret = x11_open_helper(&c->output); |
905 | 926 | ||
@@ -925,8 +946,9 @@ channel_pre_x11_open(Channel *c, fd_set * readset, fd_set * writeset) | |||
925 | } | 946 | } |
926 | 947 | ||
927 | /* try to decode a socks4 header */ | 948 | /* try to decode a socks4 header */ |
949 | /* ARGSUSED */ | ||
928 | static int | 950 | static int |
929 | channel_decode_socks4(Channel *c, fd_set * readset, fd_set * writeset) | 951 | channel_decode_socks4(Channel *c, fd_set *readset, fd_set *writeset) |
930 | { | 952 | { |
931 | char *p, *host; | 953 | char *p, *host; |
932 | u_int len, have, i, found; | 954 | u_int len, have, i, found; |
@@ -990,7 +1012,7 @@ channel_decode_socks4(Channel *c, fd_set * readset, fd_set * writeset) | |||
990 | s4_rsp.command = 90; /* cd: req granted */ | 1012 | s4_rsp.command = 90; /* cd: req granted */ |
991 | s4_rsp.dest_port = 0; /* ignored */ | 1013 | s4_rsp.dest_port = 0; /* ignored */ |
992 | s4_rsp.dest_addr.s_addr = INADDR_ANY; /* ignored */ | 1014 | s4_rsp.dest_addr.s_addr = INADDR_ANY; /* ignored */ |
993 | buffer_append(&c->output, (char *)&s4_rsp, sizeof(s4_rsp)); | 1015 | buffer_append(&c->output, &s4_rsp, sizeof(s4_rsp)); |
994 | return 1; | 1016 | return 1; |
995 | } | 1017 | } |
996 | 1018 | ||
@@ -1003,8 +1025,9 @@ channel_decode_socks4(Channel *c, fd_set * readset, fd_set * writeset) | |||
1003 | #define SSH_SOCKS5_CONNECT 0x01 | 1025 | #define SSH_SOCKS5_CONNECT 0x01 |
1004 | #define SSH_SOCKS5_SUCCESS 0x00 | 1026 | #define SSH_SOCKS5_SUCCESS 0x00 |
1005 | 1027 | ||
1028 | /* ARGSUSED */ | ||
1006 | static int | 1029 | static int |
1007 | channel_decode_socks5(Channel *c, fd_set * readset, fd_set * writeset) | 1030 | channel_decode_socks5(Channel *c, fd_set *readset, fd_set *writeset) |
1008 | { | 1031 | { |
1009 | struct { | 1032 | struct { |
1010 | u_int8_t version; | 1033 | u_int8_t version; |
@@ -1014,7 +1037,7 @@ channel_decode_socks5(Channel *c, fd_set * readset, fd_set * writeset) | |||
1014 | } s5_req, s5_rsp; | 1037 | } s5_req, s5_rsp; |
1015 | u_int16_t dest_port; | 1038 | u_int16_t dest_port; |
1016 | u_char *p, dest_addr[255+1]; | 1039 | u_char *p, dest_addr[255+1]; |
1017 | u_int have, i, found, nmethods, addrlen, af; | 1040 | u_int have, need, i, found, nmethods, addrlen, af; |
1018 | 1041 | ||
1019 | debug2("channel %d: decode socks5", c->self); | 1042 | debug2("channel %d: decode socks5", c->self); |
1020 | p = buffer_ptr(&c->input); | 1043 | p = buffer_ptr(&c->input); |
@@ -1029,8 +1052,8 @@ channel_decode_socks5(Channel *c, fd_set * readset, fd_set * writeset) | |||
1029 | if (have < nmethods + 2) | 1052 | if (have < nmethods + 2) |
1030 | return 0; | 1053 | return 0; |
1031 | /* look for method: "NO AUTHENTICATION REQUIRED" */ | 1054 | /* look for method: "NO AUTHENTICATION REQUIRED" */ |
1032 | for (found = 0, i = 2 ; i < nmethods + 2; i++) { | 1055 | for (found = 0, i = 2; i < nmethods + 2; i++) { |
1033 | if (p[i] == SSH_SOCKS5_NOAUTH ) { | 1056 | if (p[i] == SSH_SOCKS5_NOAUTH) { |
1034 | found = 1; | 1057 | found = 1; |
1035 | break; | 1058 | break; |
1036 | } | 1059 | } |
@@ -1051,7 +1074,7 @@ channel_decode_socks5(Channel *c, fd_set * readset, fd_set * writeset) | |||
1051 | debug2("channel %d: socks5 post auth", c->self); | 1074 | debug2("channel %d: socks5 post auth", c->self); |
1052 | if (have < sizeof(s5_req)+1) | 1075 | if (have < sizeof(s5_req)+1) |
1053 | return 0; /* need more */ | 1076 | return 0; /* need more */ |
1054 | memcpy((char *)&s5_req, p, sizeof(s5_req)); | 1077 | memcpy(&s5_req, p, sizeof(s5_req)); |
1055 | if (s5_req.version != 0x05 || | 1078 | if (s5_req.version != 0x05 || |
1056 | s5_req.command != SSH_SOCKS5_CONNECT || | 1079 | s5_req.command != SSH_SOCKS5_CONNECT || |
1057 | s5_req.reserved != 0x00) { | 1080 | s5_req.reserved != 0x00) { |
@@ -1075,7 +1098,10 @@ channel_decode_socks5(Channel *c, fd_set * readset, fd_set * writeset) | |||
1075 | debug2("channel %d: bad socks5 atyp %d", c->self, s5_req.atyp); | 1098 | debug2("channel %d: bad socks5 atyp %d", c->self, s5_req.atyp); |
1076 | return -1; | 1099 | return -1; |
1077 | } | 1100 | } |
1078 | if (have < 4 + addrlen + 2) | 1101 | need = sizeof(s5_req) + addrlen + 2; |
1102 | if (s5_req.atyp == SSH_SOCKS5_DOMAIN) | ||
1103 | need++; | ||
1104 | if (have < need) | ||
1079 | return 0; | 1105 | return 0; |
1080 | buffer_consume(&c->input, sizeof(s5_req)); | 1106 | buffer_consume(&c->input, sizeof(s5_req)); |
1081 | if (s5_req.atyp == SSH_SOCKS5_DOMAIN) | 1107 | if (s5_req.atyp == SSH_SOCKS5_DOMAIN) |
@@ -1099,15 +1125,15 @@ channel_decode_socks5(Channel *c, fd_set * readset, fd_set * writeset) | |||
1099 | ((struct in_addr *)&dest_addr)->s_addr = INADDR_ANY; | 1125 | ((struct in_addr *)&dest_addr)->s_addr = INADDR_ANY; |
1100 | dest_port = 0; /* ignored */ | 1126 | dest_port = 0; /* ignored */ |
1101 | 1127 | ||
1102 | buffer_append(&c->output, (char *)&s5_rsp, sizeof(s5_rsp)); | 1128 | buffer_append(&c->output, &s5_rsp, sizeof(s5_rsp)); |
1103 | buffer_append(&c->output, (char *)&dest_addr, sizeof(struct in_addr)); | 1129 | buffer_append(&c->output, &dest_addr, sizeof(struct in_addr)); |
1104 | buffer_append(&c->output, (char *)&dest_port, sizeof(dest_port)); | 1130 | buffer_append(&c->output, &dest_port, sizeof(dest_port)); |
1105 | return 1; | 1131 | return 1; |
1106 | } | 1132 | } |
1107 | 1133 | ||
1108 | /* dynamic port forwarding */ | 1134 | /* dynamic port forwarding */ |
1109 | static void | 1135 | static void |
1110 | channel_pre_dynamic(Channel *c, fd_set * readset, fd_set * writeset) | 1136 | channel_pre_dynamic(Channel *c, fd_set *readset, fd_set *writeset) |
1111 | { | 1137 | { |
1112 | u_char *p; | 1138 | u_char *p; |
1113 | u_int have; | 1139 | u_int have; |
@@ -1150,8 +1176,9 @@ channel_pre_dynamic(Channel *c, fd_set * readset, fd_set * writeset) | |||
1150 | } | 1176 | } |
1151 | 1177 | ||
1152 | /* This is our fake X11 server socket. */ | 1178 | /* This is our fake X11 server socket. */ |
1179 | /* ARGSUSED */ | ||
1153 | static void | 1180 | static void |
1154 | channel_post_x11_listener(Channel *c, fd_set * readset, fd_set * writeset) | 1181 | channel_post_x11_listener(Channel *c, fd_set *readset, fd_set *writeset) |
1155 | { | 1182 | { |
1156 | Channel *nc; | 1183 | Channel *nc; |
1157 | struct sockaddr addr; | 1184 | struct sockaddr addr; |
@@ -1275,8 +1302,9 @@ channel_set_reuseaddr(int fd) | |||
1275 | /* | 1302 | /* |
1276 | * This socket is listening for connections to a forwarded TCP/IP port. | 1303 | * This socket is listening for connections to a forwarded TCP/IP port. |
1277 | */ | 1304 | */ |
1305 | /* ARGSUSED */ | ||
1278 | static void | 1306 | static void |
1279 | channel_post_port_listener(Channel *c, fd_set * readset, fd_set * writeset) | 1307 | channel_post_port_listener(Channel *c, fd_set *readset, fd_set *writeset) |
1280 | { | 1308 | { |
1281 | Channel *nc; | 1309 | Channel *nc; |
1282 | struct sockaddr addr; | 1310 | struct sockaddr addr; |
@@ -1332,8 +1360,9 @@ channel_post_port_listener(Channel *c, fd_set * readset, fd_set * writeset) | |||
1332 | * This is the authentication agent socket listening for connections from | 1360 | * This is the authentication agent socket listening for connections from |
1333 | * clients. | 1361 | * clients. |
1334 | */ | 1362 | */ |
1363 | /* ARGSUSED */ | ||
1335 | static void | 1364 | static void |
1336 | channel_post_auth_listener(Channel *c, fd_set * readset, fd_set * writeset) | 1365 | channel_post_auth_listener(Channel *c, fd_set *readset, fd_set *writeset) |
1337 | { | 1366 | { |
1338 | Channel *nc; | 1367 | Channel *nc; |
1339 | int newsock; | 1368 | int newsock; |
@@ -1365,8 +1394,9 @@ channel_post_auth_listener(Channel *c, fd_set * readset, fd_set * writeset) | |||
1365 | } | 1394 | } |
1366 | } | 1395 | } |
1367 | 1396 | ||
1397 | /* ARGSUSED */ | ||
1368 | static void | 1398 | static void |
1369 | channel_post_connecting(Channel *c, fd_set * readset, fd_set * writeset) | 1399 | channel_post_connecting(Channel *c, fd_set *readset, fd_set *writeset) |
1370 | { | 1400 | { |
1371 | int err = 0; | 1401 | int err = 0; |
1372 | socklen_t sz = sizeof(err); | 1402 | socklen_t sz = sizeof(err); |
@@ -1411,18 +1441,26 @@ channel_post_connecting(Channel *c, fd_set * readset, fd_set * writeset) | |||
1411 | } | 1441 | } |
1412 | } | 1442 | } |
1413 | 1443 | ||
1444 | /* ARGSUSED */ | ||
1414 | static int | 1445 | static int |
1415 | channel_handle_rfd(Channel *c, fd_set * readset, fd_set * writeset) | 1446 | channel_handle_rfd(Channel *c, fd_set *readset, fd_set *writeset) |
1416 | { | 1447 | { |
1417 | char buf[CHAN_RBUF]; | 1448 | char buf[CHAN_RBUF]; |
1418 | int len; | 1449 | int len; |
1419 | 1450 | ||
1420 | if (c->rfd != -1 && | 1451 | if (c->rfd != -1 && |
1421 | FD_ISSET(c->rfd, readset)) { | 1452 | (c->detach_close || FD_ISSET(c->rfd, readset))) { |
1453 | errno = 0; | ||
1422 | len = read(c->rfd, buf, sizeof(buf)); | 1454 | len = read(c->rfd, buf, sizeof(buf)); |
1423 | if (len < 0 && (errno == EINTR || errno == EAGAIN)) | 1455 | if (len < 0 && (errno == EINTR || |
1456 | (errno == EAGAIN && !(c->isatty && c->detach_close)))) | ||
1424 | return 1; | 1457 | return 1; |
1458 | #ifndef PTY_ZEROREAD | ||
1425 | if (len <= 0) { | 1459 | if (len <= 0) { |
1460 | #else | ||
1461 | if ((!c->isatty && len <= 0) || | ||
1462 | (c->isatty && (len < 0 || (len == 0 && errno != 0)))) { | ||
1463 | #endif | ||
1426 | debug2("channel %d: read<=0 rfd %d len %d", | 1464 | debug2("channel %d: read<=0 rfd %d len %d", |
1427 | c->self, c->rfd, len); | 1465 | c->self, c->rfd, len); |
1428 | if (c->type != SSH_CHANNEL_OPEN) { | 1466 | if (c->type != SSH_CHANNEL_OPEN) { |
@@ -1451,8 +1489,10 @@ channel_handle_rfd(Channel *c, fd_set * readset, fd_set * writeset) | |||
1451 | } | 1489 | } |
1452 | return 1; | 1490 | return 1; |
1453 | } | 1491 | } |
1492 | |||
1493 | /* ARGSUSED */ | ||
1454 | static int | 1494 | static int |
1455 | channel_handle_wfd(Channel *c, fd_set * readset, fd_set * writeset) | 1495 | channel_handle_wfd(Channel *c, fd_set *readset, fd_set *writeset) |
1456 | { | 1496 | { |
1457 | struct termios tio; | 1497 | struct termios tio; |
1458 | u_char *data = NULL, *buf; | 1498 | u_char *data = NULL, *buf; |
@@ -1538,8 +1578,9 @@ channel_handle_wfd(Channel *c, fd_set * readset, fd_set * writeset) | |||
1538 | } | 1578 | } |
1539 | return 1; | 1579 | return 1; |
1540 | } | 1580 | } |
1581 | |||
1541 | static int | 1582 | static int |
1542 | channel_handle_efd(Channel *c, fd_set * readset, fd_set * writeset) | 1583 | channel_handle_efd(Channel *c, fd_set *readset, fd_set *writeset) |
1543 | { | 1584 | { |
1544 | char buf[CHAN_RBUF]; | 1585 | char buf[CHAN_RBUF]; |
1545 | int len; | 1586 | int len; |
@@ -1564,11 +1605,12 @@ channel_handle_efd(Channel *c, fd_set * readset, fd_set * writeset) | |||
1564 | c->local_consumed += len; | 1605 | c->local_consumed += len; |
1565 | } | 1606 | } |
1566 | } else if (c->extended_usage == CHAN_EXTENDED_READ && | 1607 | } else if (c->extended_usage == CHAN_EXTENDED_READ && |
1567 | FD_ISSET(c->efd, readset)) { | 1608 | (c->detach_close || FD_ISSET(c->efd, readset))) { |
1568 | len = read(c->efd, buf, sizeof(buf)); | 1609 | len = read(c->efd, buf, sizeof(buf)); |
1569 | debug2("channel %d: read %d from efd %d", | 1610 | debug2("channel %d: read %d from efd %d", |
1570 | c->self, len, c->efd); | 1611 | c->self, len, c->efd); |
1571 | if (len < 0 && (errno == EINTR || errno == EAGAIN)) | 1612 | if (len < 0 && (errno == EINTR || |
1613 | (errno == EAGAIN && !c->detach_close))) | ||
1572 | return 1; | 1614 | return 1; |
1573 | if (len <= 0) { | 1615 | if (len <= 0) { |
1574 | debug2("channel %d: closing read-efd %d", | 1616 | debug2("channel %d: closing read-efd %d", |
@@ -1581,8 +1623,10 @@ channel_handle_efd(Channel *c, fd_set * readset, fd_set * writeset) | |||
1581 | } | 1623 | } |
1582 | return 1; | 1624 | return 1; |
1583 | } | 1625 | } |
1626 | |||
1627 | /* ARGSUSED */ | ||
1584 | static int | 1628 | static int |
1585 | channel_handle_ctl(Channel *c, fd_set * readset, fd_set * writeset) | 1629 | channel_handle_ctl(Channel *c, fd_set *readset, fd_set *writeset) |
1586 | { | 1630 | { |
1587 | char buf[16]; | 1631 | char buf[16]; |
1588 | int len; | 1632 | int len; |
@@ -1608,6 +1652,7 @@ channel_handle_ctl(Channel *c, fd_set * readset, fd_set * writeset) | |||
1608 | } | 1652 | } |
1609 | return 1; | 1653 | return 1; |
1610 | } | 1654 | } |
1655 | |||
1611 | static int | 1656 | static int |
1612 | channel_check_window(Channel *c) | 1657 | channel_check_window(Channel *c) |
1613 | { | 1658 | { |
@@ -1629,7 +1674,7 @@ channel_check_window(Channel *c) | |||
1629 | } | 1674 | } |
1630 | 1675 | ||
1631 | static void | 1676 | static void |
1632 | channel_post_open(Channel *c, fd_set * readset, fd_set * writeset) | 1677 | channel_post_open(Channel *c, fd_set *readset, fd_set *writeset) |
1633 | { | 1678 | { |
1634 | if (c->delayed) | 1679 | if (c->delayed) |
1635 | return; | 1680 | return; |
@@ -1642,8 +1687,9 @@ channel_post_open(Channel *c, fd_set * readset, fd_set * writeset) | |||
1642 | channel_check_window(c); | 1687 | channel_check_window(c); |
1643 | } | 1688 | } |
1644 | 1689 | ||
1690 | /* ARGSUSED */ | ||
1645 | static void | 1691 | static void |
1646 | channel_post_output_drain_13(Channel *c, fd_set * readset, fd_set * writeset) | 1692 | channel_post_output_drain_13(Channel *c, fd_set *readset, fd_set *writeset) |
1647 | { | 1693 | { |
1648 | int len; | 1694 | int len; |
1649 | 1695 | ||
@@ -1760,7 +1806,7 @@ channel_garbage_collect(Channel *c) | |||
1760 | } | 1806 | } |
1761 | 1807 | ||
1762 | static void | 1808 | static void |
1763 | channel_handler(chan_fn *ftab[], fd_set * readset, fd_set * writeset) | 1809 | channel_handler(chan_fn *ftab[], fd_set *readset, fd_set *writeset) |
1764 | { | 1810 | { |
1765 | static int did_init = 0; | 1811 | static int did_init = 0; |
1766 | u_int i; | 1812 | u_int i; |
@@ -1788,15 +1834,20 @@ void | |||
1788 | channel_prepare_select(fd_set **readsetp, fd_set **writesetp, int *maxfdp, | 1834 | channel_prepare_select(fd_set **readsetp, fd_set **writesetp, int *maxfdp, |
1789 | u_int *nallocp, int rekeying) | 1835 | u_int *nallocp, int rekeying) |
1790 | { | 1836 | { |
1791 | u_int n, sz; | 1837 | u_int n, sz, nfdset; |
1792 | 1838 | ||
1793 | n = MAX(*maxfdp, channel_max_fd); | 1839 | n = MAX(*maxfdp, channel_max_fd); |
1794 | 1840 | ||
1795 | sz = howmany(n+1, NFDBITS) * sizeof(fd_mask); | 1841 | nfdset = howmany(n+1, NFDBITS); |
1842 | /* Explicitly test here, because xrealloc isn't always called */ | ||
1843 | if (nfdset && SIZE_T_MAX / nfdset < sizeof(fd_mask)) | ||
1844 | fatal("channel_prepare_select: max_fd (%d) is too large", n); | ||
1845 | sz = nfdset * sizeof(fd_mask); | ||
1846 | |||
1796 | /* perhaps check sz < nalloc/2 and shrink? */ | 1847 | /* perhaps check sz < nalloc/2 and shrink? */ |
1797 | if (*readsetp == NULL || sz > *nallocp) { | 1848 | if (*readsetp == NULL || sz > *nallocp) { |
1798 | *readsetp = xrealloc(*readsetp, sz); | 1849 | *readsetp = xrealloc(*readsetp, nfdset, sizeof(fd_mask)); |
1799 | *writesetp = xrealloc(*writesetp, sz); | 1850 | *writesetp = xrealloc(*writesetp, nfdset, sizeof(fd_mask)); |
1800 | *nallocp = sz; | 1851 | *nallocp = sz; |
1801 | } | 1852 | } |
1802 | *maxfdp = n; | 1853 | *maxfdp = n; |
@@ -1812,14 +1863,13 @@ channel_prepare_select(fd_set **readsetp, fd_set **writesetp, int *maxfdp, | |||
1812 | * events pending. | 1863 | * events pending. |
1813 | */ | 1864 | */ |
1814 | void | 1865 | void |
1815 | channel_after_select(fd_set * readset, fd_set * writeset) | 1866 | channel_after_select(fd_set *readset, fd_set *writeset) |
1816 | { | 1867 | { |
1817 | channel_handler(channel_post, readset, writeset); | 1868 | channel_handler(channel_post, readset, writeset); |
1818 | } | 1869 | } |
1819 | 1870 | ||
1820 | 1871 | ||
1821 | /* If there is data to send to the connection, enqueue some of it now. */ | 1872 | /* If there is data to send to the connection, enqueue some of it now. */ |
1822 | |||
1823 | void | 1873 | void |
1824 | channel_output_poll(void) | 1874 | channel_output_poll(void) |
1825 | { | 1875 | { |
@@ -1940,6 +1990,7 @@ channel_output_poll(void) | |||
1940 | 1990 | ||
1941 | /* -- protocol input */ | 1991 | /* -- protocol input */ |
1942 | 1992 | ||
1993 | /* ARGSUSED */ | ||
1943 | void | 1994 | void |
1944 | channel_input_data(int type, u_int32_t seq, void *ctxt) | 1995 | channel_input_data(int type, u_int32_t seq, void *ctxt) |
1945 | { | 1996 | { |
@@ -1999,6 +2050,7 @@ channel_input_data(int type, u_int32_t seq, void *ctxt) | |||
1999 | xfree(data); | 2050 | xfree(data); |
2000 | } | 2051 | } |
2001 | 2052 | ||
2053 | /* ARGSUSED */ | ||
2002 | void | 2054 | void |
2003 | channel_input_extended_data(int type, u_int32_t seq, void *ctxt) | 2055 | channel_input_extended_data(int type, u_int32_t seq, void *ctxt) |
2004 | { | 2056 | { |
@@ -2045,6 +2097,7 @@ channel_input_extended_data(int type, u_int32_t seq, void *ctxt) | |||
2045 | xfree(data); | 2097 | xfree(data); |
2046 | } | 2098 | } |
2047 | 2099 | ||
2100 | /* ARGSUSED */ | ||
2048 | void | 2101 | void |
2049 | channel_input_ieof(int type, u_int32_t seq, void *ctxt) | 2102 | channel_input_ieof(int type, u_int32_t seq, void *ctxt) |
2050 | { | 2103 | { |
@@ -2068,6 +2121,7 @@ channel_input_ieof(int type, u_int32_t seq, void *ctxt) | |||
2068 | 2121 | ||
2069 | } | 2122 | } |
2070 | 2123 | ||
2124 | /* ARGSUSED */ | ||
2071 | void | 2125 | void |
2072 | channel_input_close(int type, u_int32_t seq, void *ctxt) | 2126 | channel_input_close(int type, u_int32_t seq, void *ctxt) |
2073 | { | 2127 | { |
@@ -2106,6 +2160,7 @@ channel_input_close(int type, u_int32_t seq, void *ctxt) | |||
2106 | } | 2160 | } |
2107 | 2161 | ||
2108 | /* proto version 1.5 overloads CLOSE_CONFIRMATION with OCLOSE */ | 2162 | /* proto version 1.5 overloads CLOSE_CONFIRMATION with OCLOSE */ |
2163 | /* ARGSUSED */ | ||
2109 | void | 2164 | void |
2110 | channel_input_oclose(int type, u_int32_t seq, void *ctxt) | 2165 | channel_input_oclose(int type, u_int32_t seq, void *ctxt) |
2111 | { | 2166 | { |
@@ -2118,6 +2173,7 @@ channel_input_oclose(int type, u_int32_t seq, void *ctxt) | |||
2118 | chan_rcvd_oclose(c); | 2173 | chan_rcvd_oclose(c); |
2119 | } | 2174 | } |
2120 | 2175 | ||
2176 | /* ARGSUSED */ | ||
2121 | void | 2177 | void |
2122 | channel_input_close_confirmation(int type, u_int32_t seq, void *ctxt) | 2178 | channel_input_close_confirmation(int type, u_int32_t seq, void *ctxt) |
2123 | { | 2179 | { |
@@ -2134,6 +2190,7 @@ channel_input_close_confirmation(int type, u_int32_t seq, void *ctxt) | |||
2134 | channel_free(c); | 2190 | channel_free(c); |
2135 | } | 2191 | } |
2136 | 2192 | ||
2193 | /* ARGSUSED */ | ||
2137 | void | 2194 | void |
2138 | channel_input_open_confirmation(int type, u_int32_t seq, void *ctxt) | 2195 | channel_input_open_confirmation(int type, u_int32_t seq, void *ctxt) |
2139 | { | 2196 | { |
@@ -2181,6 +2238,7 @@ reason2txt(int reason) | |||
2181 | return "unknown reason"; | 2238 | return "unknown reason"; |
2182 | } | 2239 | } |
2183 | 2240 | ||
2241 | /* ARGSUSED */ | ||
2184 | void | 2242 | void |
2185 | channel_input_open_failure(int type, u_int32_t seq, void *ctxt) | 2243 | channel_input_open_failure(int type, u_int32_t seq, void *ctxt) |
2186 | { | 2244 | { |
@@ -2212,6 +2270,7 @@ channel_input_open_failure(int type, u_int32_t seq, void *ctxt) | |||
2212 | channel_free(c); | 2270 | channel_free(c); |
2213 | } | 2271 | } |
2214 | 2272 | ||
2273 | /* ARGSUSED */ | ||
2215 | void | 2274 | void |
2216 | channel_input_window_adjust(int type, u_int32_t seq, void *ctxt) | 2275 | channel_input_window_adjust(int type, u_int32_t seq, void *ctxt) |
2217 | { | 2276 | { |
@@ -2236,6 +2295,7 @@ channel_input_window_adjust(int type, u_int32_t seq, void *ctxt) | |||
2236 | c->remote_window += adjust; | 2295 | c->remote_window += adjust; |
2237 | } | 2296 | } |
2238 | 2297 | ||
2298 | /* ARGSUSED */ | ||
2239 | void | 2299 | void |
2240 | channel_input_port_open(int type, u_int32_t seq, void *ctxt) | 2300 | channel_input_port_open(int type, u_int32_t seq, void *ctxt) |
2241 | { | 2301 | { |
@@ -2454,7 +2514,7 @@ channel_setup_remote_fwd_listener(const char *listen_address, | |||
2454 | * the secure channel to host:port from local side. | 2514 | * the secure channel to host:port from local side. |
2455 | */ | 2515 | */ |
2456 | 2516 | ||
2457 | void | 2517 | int |
2458 | channel_request_remote_forwarding(const char *listen_host, u_short listen_port, | 2518 | channel_request_remote_forwarding(const char *listen_host, u_short listen_port, |
2459 | const char *host_to_connect, u_short port_to_connect) | 2519 | const char *host_to_connect, u_short port_to_connect) |
2460 | { | 2520 | { |
@@ -2467,11 +2527,18 @@ channel_request_remote_forwarding(const char *listen_host, u_short listen_port, | |||
2467 | /* Send the forward request to the remote side. */ | 2527 | /* Send the forward request to the remote side. */ |
2468 | if (compat20) { | 2528 | if (compat20) { |
2469 | const char *address_to_bind; | 2529 | const char *address_to_bind; |
2470 | if (listen_host == NULL) | 2530 | if (listen_host == NULL) { |
2471 | address_to_bind = "localhost"; | 2531 | if (datafellows & SSH_BUG_RFWD_ADDR) |
2472 | else if (*listen_host == '\0' || strcmp(listen_host, "*") == 0) | 2532 | address_to_bind = "127.0.0.1"; |
2473 | address_to_bind = ""; | 2533 | else |
2474 | else | 2534 | address_to_bind = "localhost"; |
2535 | } else if (*listen_host == '\0' || | ||
2536 | strcmp(listen_host, "*") == 0) { | ||
2537 | if (datafellows & SSH_BUG_RFWD_ADDR) | ||
2538 | address_to_bind = "0.0.0.0"; | ||
2539 | else | ||
2540 | address_to_bind = ""; | ||
2541 | } else | ||
2475 | address_to_bind = listen_host; | 2542 | address_to_bind = listen_host; |
2476 | 2543 | ||
2477 | packet_start(SSH2_MSG_GLOBAL_REQUEST); | 2544 | packet_start(SSH2_MSG_GLOBAL_REQUEST); |
@@ -2498,7 +2565,6 @@ channel_request_remote_forwarding(const char *listen_host, u_short listen_port, | |||
2498 | success = 1; | 2565 | success = 1; |
2499 | break; | 2566 | break; |
2500 | case SSH_SMSG_FAILURE: | 2567 | case SSH_SMSG_FAILURE: |
2501 | logit("Warning: Server denied remote port forwarding."); | ||
2502 | break; | 2568 | break; |
2503 | default: | 2569 | default: |
2504 | /* Unknown packet */ | 2570 | /* Unknown packet */ |
@@ -2512,6 +2578,7 @@ channel_request_remote_forwarding(const char *listen_host, u_short listen_port, | |||
2512 | permitted_opens[num_permitted_opens].listen_port = listen_port; | 2578 | permitted_opens[num_permitted_opens].listen_port = listen_port; |
2513 | num_permitted_opens++; | 2579 | num_permitted_opens++; |
2514 | } | 2580 | } |
2581 | return (success ? 0 : -1); | ||
2515 | } | 2582 | } |
2516 | 2583 | ||
2517 | /* | 2584 | /* |
@@ -2551,13 +2618,13 @@ channel_request_rforward_cancel(const char *host, u_short port) | |||
2551 | /* | 2618 | /* |
2552 | * This is called after receiving CHANNEL_FORWARDING_REQUEST. This initates | 2619 | * This is called after receiving CHANNEL_FORWARDING_REQUEST. This initates |
2553 | * listening for the port, and sends back a success reply (or disconnect | 2620 | * listening for the port, and sends back a success reply (or disconnect |
2554 | * message if there was an error). This never returns if there was an error. | 2621 | * message if there was an error). |
2555 | */ | 2622 | */ |
2556 | 2623 | int | |
2557 | void | ||
2558 | channel_input_port_forward_request(int is_root, int gateway_ports) | 2624 | channel_input_port_forward_request(int is_root, int gateway_ports) |
2559 | { | 2625 | { |
2560 | u_short port, host_port; | 2626 | u_short port, host_port; |
2627 | int success = 0; | ||
2561 | char *hostname; | 2628 | char *hostname; |
2562 | 2629 | ||
2563 | /* Get arguments from the packet. */ | 2630 | /* Get arguments from the packet. */ |
@@ -2579,11 +2646,13 @@ channel_input_port_forward_request(int is_root, int gateway_ports) | |||
2579 | #endif | 2646 | #endif |
2580 | 2647 | ||
2581 | /* Initiate forwarding */ | 2648 | /* Initiate forwarding */ |
2582 | channel_setup_local_fwd_listener(NULL, port, hostname, | 2649 | success = channel_setup_local_fwd_listener(NULL, port, hostname, |
2583 | host_port, gateway_ports); | 2650 | host_port, gateway_ports); |
2584 | 2651 | ||
2585 | /* Free the argument string. */ | 2652 | /* Free the argument string. */ |
2586 | xfree(hostname); | 2653 | xfree(hostname); |
2654 | |||
2655 | return (success ? 0 : -1); | ||
2587 | } | 2656 | } |
2588 | 2657 | ||
2589 | /* | 2658 | /* |
@@ -2602,7 +2671,7 @@ void | |||
2602 | channel_add_permitted_opens(char *host, int port) | 2671 | channel_add_permitted_opens(char *host, int port) |
2603 | { | 2672 | { |
2604 | if (num_permitted_opens >= SSH_MAX_FORWARDS_PER_DIRECTION) | 2673 | if (num_permitted_opens >= SSH_MAX_FORWARDS_PER_DIRECTION) |
2605 | fatal("channel_request_remote_forwarding: too many forwards"); | 2674 | fatal("channel_add_permitted_opens: too many forwards"); |
2606 | debug("allow port forwarding to host %s port %d", host, port); | 2675 | debug("allow port forwarding to host %s port %d", host, port); |
2607 | 2676 | ||
2608 | permitted_opens[num_permitted_opens].host_to_connect = xstrdup(host); | 2677 | permitted_opens[num_permitted_opens].host_to_connect = xstrdup(host); |
@@ -2612,6 +2681,19 @@ channel_add_permitted_opens(char *host, int port) | |||
2612 | all_opens_permitted = 0; | 2681 | all_opens_permitted = 0; |
2613 | } | 2682 | } |
2614 | 2683 | ||
2684 | int | ||
2685 | channel_add_adm_permitted_opens(char *host, int port) | ||
2686 | { | ||
2687 | if (num_adm_permitted_opens >= SSH_MAX_FORWARDS_PER_DIRECTION) | ||
2688 | fatal("channel_add_adm_permitted_opens: too many forwards"); | ||
2689 | debug("config allows port forwarding to host %s port %d", host, port); | ||
2690 | |||
2691 | permitted_adm_opens[num_adm_permitted_opens].host_to_connect | ||
2692 | = xstrdup(host); | ||
2693 | permitted_adm_opens[num_adm_permitted_opens].port_to_connect = port; | ||
2694 | return ++num_adm_permitted_opens; | ||
2695 | } | ||
2696 | |||
2615 | void | 2697 | void |
2616 | channel_clear_permitted_opens(void) | 2698 | channel_clear_permitted_opens(void) |
2617 | { | 2699 | { |
@@ -2621,9 +2703,18 @@ channel_clear_permitted_opens(void) | |||
2621 | if (permitted_opens[i].host_to_connect != NULL) | 2703 | if (permitted_opens[i].host_to_connect != NULL) |
2622 | xfree(permitted_opens[i].host_to_connect); | 2704 | xfree(permitted_opens[i].host_to_connect); |
2623 | num_permitted_opens = 0; | 2705 | num_permitted_opens = 0; |
2624 | |||
2625 | } | 2706 | } |
2626 | 2707 | ||
2708 | void | ||
2709 | channel_clear_adm_permitted_opens(void) | ||
2710 | { | ||
2711 | int i; | ||
2712 | |||
2713 | for (i = 0; i < num_adm_permitted_opens; i++) | ||
2714 | if (permitted_adm_opens[i].host_to_connect != NULL) | ||
2715 | xfree(permitted_adm_opens[i].host_to_connect); | ||
2716 | num_adm_permitted_opens = 0; | ||
2717 | } | ||
2627 | 2718 | ||
2628 | /* return socket to remote host, port */ | 2719 | /* return socket to remote host, port */ |
2629 | static int | 2720 | static int |
@@ -2701,7 +2792,7 @@ channel_connect_by_listen_address(u_short listen_port) | |||
2701 | int | 2792 | int |
2702 | channel_connect_to(const char *host, u_short port) | 2793 | channel_connect_to(const char *host, u_short port) |
2703 | { | 2794 | { |
2704 | int i, permit; | 2795 | int i, permit, permit_adm = 1; |
2705 | 2796 | ||
2706 | permit = all_opens_permitted; | 2797 | permit = all_opens_permitted; |
2707 | if (!permit) { | 2798 | if (!permit) { |
@@ -2710,9 +2801,19 @@ channel_connect_to(const char *host, u_short port) | |||
2710 | permitted_opens[i].port_to_connect == port && | 2801 | permitted_opens[i].port_to_connect == port && |
2711 | strcmp(permitted_opens[i].host_to_connect, host) == 0) | 2802 | strcmp(permitted_opens[i].host_to_connect, host) == 0) |
2712 | permit = 1; | 2803 | permit = 1; |
2804 | } | ||
2713 | 2805 | ||
2806 | if (num_adm_permitted_opens > 0) { | ||
2807 | permit_adm = 0; | ||
2808 | for (i = 0; i < num_adm_permitted_opens; i++) | ||
2809 | if (permitted_adm_opens[i].host_to_connect != NULL && | ||
2810 | permitted_adm_opens[i].port_to_connect == port && | ||
2811 | strcmp(permitted_adm_opens[i].host_to_connect, host) | ||
2812 | == 0) | ||
2813 | permit_adm = 1; | ||
2714 | } | 2814 | } |
2715 | if (!permit) { | 2815 | |
2816 | if (!permit || !permit_adm) { | ||
2716 | logit("Received request to connect to host %.100s port %d, " | 2817 | logit("Received request to connect to host %.100s port %d, " |
2717 | "but the request was denied.", host, port); | 2818 | "but the request was denied.", host, port); |
2718 | return -1; | 2819 | return -1; |
@@ -2733,10 +2834,10 @@ channel_send_window_changes(void) | |||
2733 | if (ioctl(channels[i]->rfd, TIOCGWINSZ, &ws) < 0) | 2834 | if (ioctl(channels[i]->rfd, TIOCGWINSZ, &ws) < 0) |
2734 | continue; | 2835 | continue; |
2735 | channel_request_start(i, "window-change", 0); | 2836 | channel_request_start(i, "window-change", 0); |
2736 | packet_put_int(ws.ws_col); | 2837 | packet_put_int((u_int)ws.ws_col); |
2737 | packet_put_int(ws.ws_row); | 2838 | packet_put_int((u_int)ws.ws_row); |
2738 | packet_put_int(ws.ws_xpixel); | 2839 | packet_put_int((u_int)ws.ws_xpixel); |
2739 | packet_put_int(ws.ws_ypixel); | 2840 | packet_put_int((u_int)ws.ws_ypixel); |
2740 | packet_send(); | 2841 | packet_send(); |
2741 | } | 2842 | } |
2742 | } | 2843 | } |
@@ -2848,7 +2949,7 @@ x11_create_display_inet(int x11_display_offset, int x11_use_localhost, | |||
2848 | } | 2949 | } |
2849 | 2950 | ||
2850 | /* Allocate a channel for each socket. */ | 2951 | /* Allocate a channel for each socket. */ |
2851 | *chanids = xmalloc(sizeof(**chanids) * (num_socks + 1)); | 2952 | *chanids = xcalloc(num_socks + 1, sizeof(**chanids)); |
2852 | for (n = 0; n < num_socks; n++) { | 2953 | for (n = 0; n < num_socks; n++) { |
2853 | sock = socks[n]; | 2954 | sock = socks[n]; |
2854 | nc = channel_new("x11 listener", | 2955 | nc = channel_new("x11 listener", |
@@ -2877,7 +2978,7 @@ connect_local_xsocket(u_int dnr) | |||
2877 | memset(&addr, 0, sizeof(addr)); | 2978 | memset(&addr, 0, sizeof(addr)); |
2878 | addr.sun_family = AF_UNIX; | 2979 | addr.sun_family = AF_UNIX; |
2879 | snprintf(addr.sun_path, sizeof addr.sun_path, _PATH_UNIX_X, dnr); | 2980 | snprintf(addr.sun_path, sizeof addr.sun_path, _PATH_UNIX_X, dnr); |
2880 | if (connect(sock, (struct sockaddr *) & addr, sizeof(addr)) == 0) | 2981 | if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) == 0) |
2881 | return sock; | 2982 | return sock; |
2882 | close(sock); | 2983 | close(sock); |
2883 | error("connect %.100s: %.100s", addr.sun_path, strerror(errno)); | 2984 | error("connect %.100s: %.100s", addr.sun_path, strerror(errno)); |
@@ -2887,12 +2988,12 @@ connect_local_xsocket(u_int dnr) | |||
2887 | int | 2988 | int |
2888 | x11_connect_display(void) | 2989 | x11_connect_display(void) |
2889 | { | 2990 | { |
2890 | int display_number, sock = 0; | 2991 | u_int display_number; |
2891 | const char *display; | 2992 | const char *display; |
2892 | char buf[1024], *cp; | 2993 | char buf[1024], *cp; |
2893 | struct addrinfo hints, *ai, *aitop; | 2994 | struct addrinfo hints, *ai, *aitop; |
2894 | char strport[NI_MAXSERV]; | 2995 | char strport[NI_MAXSERV]; |
2895 | int gaierr; | 2996 | int gaierr, sock = 0; |
2896 | 2997 | ||
2897 | /* Try to open a socket for the local X server. */ | 2998 | /* Try to open a socket for the local X server. */ |
2898 | display = getenv("DISPLAY"); | 2999 | display = getenv("DISPLAY"); |
@@ -2912,7 +3013,7 @@ x11_connect_display(void) | |||
2912 | if (strncmp(display, "unix:", 5) == 0 || | 3013 | if (strncmp(display, "unix:", 5) == 0 || |
2913 | display[0] == ':') { | 3014 | display[0] == ':') { |
2914 | /* Connect to the unix domain socket. */ | 3015 | /* Connect to the unix domain socket. */ |
2915 | if (sscanf(strrchr(display, ':') + 1, "%d", &display_number) != 1) { | 3016 | if (sscanf(strrchr(display, ':') + 1, "%u", &display_number) != 1) { |
2916 | error("Could not parse display number from DISPLAY: %.100s", | 3017 | error("Could not parse display number from DISPLAY: %.100s", |
2917 | display); | 3018 | display); |
2918 | return -1; | 3019 | return -1; |
@@ -2937,7 +3038,7 @@ x11_connect_display(void) | |||
2937 | } | 3038 | } |
2938 | *cp = 0; | 3039 | *cp = 0; |
2939 | /* buf now contains the host name. But first we parse the display number. */ | 3040 | /* buf now contains the host name. But first we parse the display number. */ |
2940 | if (sscanf(cp + 1, "%d", &display_number) != 1) { | 3041 | if (sscanf(cp + 1, "%u", &display_number) != 1) { |
2941 | error("Could not parse display number from DISPLAY: %.100s", | 3042 | error("Could not parse display number from DISPLAY: %.100s", |
2942 | display); | 3043 | display); |
2943 | return -1; | 3044 | return -1; |
@@ -2947,7 +3048,7 @@ x11_connect_display(void) | |||
2947 | memset(&hints, 0, sizeof(hints)); | 3048 | memset(&hints, 0, sizeof(hints)); |
2948 | hints.ai_family = IPv4or6; | 3049 | hints.ai_family = IPv4or6; |
2949 | hints.ai_socktype = SOCK_STREAM; | 3050 | hints.ai_socktype = SOCK_STREAM; |
2950 | snprintf(strport, sizeof strport, "%d", 6000 + display_number); | 3051 | snprintf(strport, sizeof strport, "%u", 6000 + display_number); |
2951 | if ((gaierr = getaddrinfo(buf, strport, &hints, &aitop)) != 0) { | 3052 | if ((gaierr = getaddrinfo(buf, strport, &hints, &aitop)) != 0) { |
2952 | error("%.100s: unknown host. (%s)", buf, gai_strerror(gaierr)); | 3053 | error("%.100s: unknown host. (%s)", buf, gai_strerror(gaierr)); |
2953 | return -1; | 3054 | return -1; |
@@ -2961,7 +3062,7 @@ x11_connect_display(void) | |||
2961 | } | 3062 | } |
2962 | /* Connect it to the display. */ | 3063 | /* Connect it to the display. */ |
2963 | if (connect(sock, ai->ai_addr, ai->ai_addrlen) < 0) { | 3064 | if (connect(sock, ai->ai_addr, ai->ai_addrlen) < 0) { |
2964 | debug2("connect %.100s port %d: %.100s", buf, | 3065 | debug2("connect %.100s port %u: %.100s", buf, |
2965 | 6000 + display_number, strerror(errno)); | 3066 | 6000 + display_number, strerror(errno)); |
2966 | close(sock); | 3067 | close(sock); |
2967 | continue; | 3068 | continue; |
@@ -2971,7 +3072,7 @@ x11_connect_display(void) | |||
2971 | } | 3072 | } |
2972 | freeaddrinfo(aitop); | 3073 | freeaddrinfo(aitop); |
2973 | if (!ai) { | 3074 | if (!ai) { |
2974 | error("connect %.100s port %d: %.100s", buf, 6000 + display_number, | 3075 | error("connect %.100s port %u: %.100s", buf, 6000 + display_number, |
2975 | strerror(errno)); | 3076 | strerror(errno)); |
2976 | return -1; | 3077 | return -1; |
2977 | } | 3078 | } |
@@ -2985,6 +3086,7 @@ x11_connect_display(void) | |||
2985 | * with either SSH_MSG_OPEN_CONFIRMATION or SSH_MSG_OPEN_FAILURE. | 3086 | * with either SSH_MSG_OPEN_CONFIRMATION or SSH_MSG_OPEN_FAILURE. |
2986 | */ | 3087 | */ |
2987 | 3088 | ||
3089 | /* ARGSUSED */ | ||
2988 | void | 3090 | void |
2989 | x11_input_open(int type, u_int32_t seq, void *ctxt) | 3091 | x11_input_open(int type, u_int32_t seq, void *ctxt) |
2990 | { | 3092 | { |
@@ -3028,6 +3130,7 @@ x11_input_open(int type, u_int32_t seq, void *ctxt) | |||
3028 | } | 3130 | } |
3029 | 3131 | ||
3030 | /* dummy protocol handler that denies SSH-1 requests (agent/x11) */ | 3132 | /* dummy protocol handler that denies SSH-1 requests (agent/x11) */ |
3133 | /* ARGSUSED */ | ||
3031 | void | 3134 | void |
3032 | deny_input_open(int type, u_int32_t seq, void *ctxt) | 3135 | deny_input_open(int type, u_int32_t seq, void *ctxt) |
3033 | { | 3136 | { |
@@ -3074,13 +3177,11 @@ x11_request_forwarding_with_spoofing(int client_session_id, const char *disp, | |||
3074 | return; | 3177 | return; |
3075 | } | 3178 | } |
3076 | 3179 | ||
3077 | cp = disp; | 3180 | cp = strchr(disp, ':'); |
3078 | if (disp) | ||
3079 | cp = strchr(disp, ':'); | ||
3080 | if (cp) | 3181 | if (cp) |
3081 | cp = strchr(cp, '.'); | 3182 | cp = strchr(cp, '.'); |
3082 | if (cp) | 3183 | if (cp) |
3083 | screen_number = atoi(cp + 1); | 3184 | screen_number = (u_int)strtonum(cp + 1, 0, 400, NULL); |
3084 | else | 3185 | else |
3085 | screen_number = 0; | 3186 | screen_number = 0; |
3086 | 3187 | ||
diff --git a/channels.h b/channels.h index a97dd9007..2674f096e 100644 --- a/channels.h +++ b/channels.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: channels.h,v 1.83 2005/12/30 15:56:37 reyk Exp $ */ | 1 | /* $OpenBSD: channels.h,v 1.88 2006/08/03 03:34:42 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -38,8 +38,6 @@ | |||
38 | #ifndef CHANNEL_H | 38 | #ifndef CHANNEL_H |
39 | #define CHANNEL_H | 39 | #define CHANNEL_H |
40 | 40 | ||
41 | #include "buffer.h" | ||
42 | |||
43 | /* Definitions for channel types. */ | 41 | /* Definitions for channel types. */ |
44 | #define SSH_CHANNEL_X11_LISTENER 1 /* Listening for inet X11 conn. */ | 42 | #define SSH_CHANNEL_X11_LISTENER 1 /* Listening for inet X11 conn. */ |
45 | #define SSH_CHANNEL_PORT_LISTENER 2 /* Listening on a port. */ | 43 | #define SSH_CHANNEL_PORT_LISTENER 2 /* Listening on a port. */ |
@@ -207,11 +205,13 @@ int channel_find_open(void); | |||
207 | void channel_set_af(int af); | 205 | void channel_set_af(int af); |
208 | void channel_permit_all_opens(void); | 206 | void channel_permit_all_opens(void); |
209 | void channel_add_permitted_opens(char *, int); | 207 | void channel_add_permitted_opens(char *, int); |
208 | int channel_add_adm_permitted_opens(char *, int); | ||
210 | void channel_clear_permitted_opens(void); | 209 | void channel_clear_permitted_opens(void); |
211 | void channel_input_port_forward_request(int, int); | 210 | void channel_clear_adm_permitted_opens(void); |
211 | int channel_input_port_forward_request(int, int); | ||
212 | int channel_connect_to(const char *, u_short); | 212 | int channel_connect_to(const char *, u_short); |
213 | int channel_connect_by_listen_address(u_short); | 213 | int channel_connect_by_listen_address(u_short); |
214 | void channel_request_remote_forwarding(const char *, u_short, | 214 | int channel_request_remote_forwarding(const char *, u_short, |
215 | const char *, u_short); | 215 | const char *, u_short); |
216 | int channel_setup_local_fwd_listener(const char *, u_short, | 216 | int channel_setup_local_fwd_listener(const char *, u_short, |
217 | const char *, u_short, int); | 217 | const char *, u_short, int); |
diff --git a/cipher-3des1.c b/cipher-3des1.c index f815e8ae5..fc16e20d7 100644 --- a/cipher-3des1.c +++ b/cipher-3des1.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: cipher-3des1.c,v 1.6 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2003 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2003 Markus Friedl. All rights reserved. |
3 | * | 4 | * |
@@ -23,9 +24,14 @@ | |||
23 | */ | 24 | */ |
24 | 25 | ||
25 | #include "includes.h" | 26 | #include "includes.h" |
26 | RCSID("$OpenBSD: cipher-3des1.c,v 1.2 2003/12/22 20:29:55 markus Exp $"); | 27 | |
28 | #include <sys/types.h> | ||
27 | 29 | ||
28 | #include <openssl/evp.h> | 30 | #include <openssl/evp.h> |
31 | |||
32 | #include <stdarg.h> | ||
33 | #include <string.h> | ||
34 | |||
29 | #include "xmalloc.h" | 35 | #include "xmalloc.h" |
30 | #include "log.h" | 36 | #include "log.h" |
31 | 37 | ||
diff --git a/cipher-acss.c b/cipher-acss.c index a95fa6747..cb0bf736c 100644 --- a/cipher-acss.c +++ b/cipher-acss.c | |||
@@ -15,9 +15,10 @@ | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "includes.h" | 17 | #include "includes.h" |
18 | |||
18 | #include <openssl/evp.h> | 19 | #include <openssl/evp.h> |
19 | 20 | ||
20 | RCSID("$Id: cipher-acss.c,v 1.3 2005/07/17 07:04:47 djm Exp $"); | 21 | #include <string.h> |
21 | 22 | ||
22 | #if !defined(EVP_CTRL_SET_ACSS_MODE) && (OPENSSL_VERSION_NUMBER >= 0x00907000L) | 23 | #if !defined(EVP_CTRL_SET_ACSS_MODE) && (OPENSSL_VERSION_NUMBER >= 0x00907000L) |
23 | 24 | ||
diff --git a/cipher-aes.c b/cipher-aes.c index 228ddb104..3ea594969 100644 --- a/cipher-aes.c +++ b/cipher-aes.c | |||
@@ -28,9 +28,13 @@ | |||
28 | #include "openbsd-compat/openssl-compat.h" | 28 | #include "openbsd-compat/openssl-compat.h" |
29 | 29 | ||
30 | #ifdef USE_BUILTIN_RIJNDAEL | 30 | #ifdef USE_BUILTIN_RIJNDAEL |
31 | RCSID("$OpenBSD: cipher-aes.c,v 1.2 2003/11/26 21:44:29 djm Exp $"); | 31 | #include <sys/types.h> |
32 | 32 | ||
33 | #include <openssl/evp.h> | 33 | #include <openssl/evp.h> |
34 | |||
35 | #include <stdarg.h> | ||
36 | #include <string.h> | ||
37 | |||
34 | #include "rijndael.h" | 38 | #include "rijndael.h" |
35 | #include "xmalloc.h" | 39 | #include "xmalloc.h" |
36 | #include "log.h" | 40 | #include "log.h" |
diff --git a/cipher-bf1.c b/cipher-bf1.c index 64578bae8..292488c5c 100644 --- a/cipher-bf1.c +++ b/cipher-bf1.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: cipher-bf1.c,v 1.5 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2003 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2003 Markus Friedl. All rights reserved. |
3 | * | 4 | * |
@@ -23,11 +24,21 @@ | |||
23 | */ | 24 | */ |
24 | 25 | ||
25 | #include "includes.h" | 26 | #include "includes.h" |
26 | RCSID("$OpenBSD: cipher-bf1.c,v 1.1 2003/05/15 03:08:29 markus Exp $"); | 27 | |
28 | #include <sys/types.h> | ||
27 | 29 | ||
28 | #include <openssl/evp.h> | 30 | #include <openssl/evp.h> |
31 | |||
32 | #include <stdarg.h> | ||
33 | #include <string.h> | ||
34 | |||
29 | #include "xmalloc.h" | 35 | #include "xmalloc.h" |
30 | #include "log.h" | 36 | #include "log.h" |
37 | |||
38 | #if OPENSSL_VERSION_NUMBER < 0x00906000L | ||
39 | #define SSH_OLD_EVP | ||
40 | #endif | ||
41 | |||
31 | /* | 42 | /* |
32 | * SSH1 uses a variation on Blowfish, all bytes must be swapped before | 43 | * SSH1 uses a variation on Blowfish, all bytes must be swapped before |
33 | * and after encryption/decryption. Thus the swap_bytes stuff (yuk). | 44 | * and after encryption/decryption. Thus the swap_bytes stuff (yuk). |
diff --git a/cipher-ctr.c b/cipher-ctr.c index 8a98f3c42..b24f3a428 100644 --- a/cipher-ctr.c +++ b/cipher-ctr.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: cipher-ctr.c,v 1.10 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2003 Markus Friedl <markus@openbsd.org> | 3 | * Copyright (c) 2003 Markus Friedl <markus@openbsd.org> |
3 | * | 4 | * |
@@ -14,12 +15,16 @@ | |||
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
15 | */ | 16 | */ |
16 | #include "includes.h" | 17 | #include "includes.h" |
17 | RCSID("$OpenBSD: cipher-ctr.c,v 1.6 2005/07/17 07:17:55 djm Exp $"); | 18 | |
19 | #include <sys/types.h> | ||
20 | |||
21 | #include <stdarg.h> | ||
22 | #include <string.h> | ||
18 | 23 | ||
19 | #include <openssl/evp.h> | 24 | #include <openssl/evp.h> |
20 | 25 | ||
21 | #include "log.h" | ||
22 | #include "xmalloc.h" | 26 | #include "xmalloc.h" |
27 | #include "log.h" | ||
23 | 28 | ||
24 | /* compatibility with old or broken OpenSSL versions */ | 29 | /* compatibility with old or broken OpenSSL versions */ |
25 | #include "openbsd-compat/openssl-compat.h" | 30 | #include "openbsd-compat/openssl-compat.h" |
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: cipher.c,v 1.81 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -35,14 +36,18 @@ | |||
35 | */ | 36 | */ |
36 | 37 | ||
37 | #include "includes.h" | 38 | #include "includes.h" |
38 | RCSID("$OpenBSD: cipher.c,v 1.77 2005/07/16 01:35:24 djm Exp $"); | 39 | |
40 | #include <sys/types.h> | ||
41 | |||
42 | #include <openssl/md5.h> | ||
43 | |||
44 | #include <string.h> | ||
45 | #include <stdarg.h> | ||
39 | 46 | ||
40 | #include "xmalloc.h" | 47 | #include "xmalloc.h" |
41 | #include "log.h" | 48 | #include "log.h" |
42 | #include "cipher.h" | 49 | #include "cipher.h" |
43 | 50 | ||
44 | #include <openssl/md5.h> | ||
45 | |||
46 | /* compatibility with old or broken OpenSSL versions */ | 51 | /* compatibility with old or broken OpenSSL versions */ |
47 | #include "openbsd-compat/openssl-compat.h" | 52 | #include "openbsd-compat/openssl-compat.h" |
48 | 53 | ||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cipher.h,v 1.35 2004/07/28 09:40:29 markus Exp $ */ | 1 | /* $OpenBSD: cipher.h,v 1.36 2006/03/25 22:22:42 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: cleanup.c,v 1.5 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2003 Markus Friedl <markus@openbsd.org> | 3 | * Copyright (c) 2003 Markus Friedl <markus@openbsd.org> |
3 | * | 4 | * |
@@ -13,8 +14,13 @@ | |||
13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
15 | */ | 16 | */ |
17 | |||
16 | #include "includes.h" | 18 | #include "includes.h" |
17 | RCSID("$OpenBSD: cleanup.c,v 1.1 2003/09/23 20:17:11 markus Exp $"); | 19 | |
20 | #include <sys/types.h> | ||
21 | |||
22 | #include <unistd.h> | ||
23 | #include <stdarg.h> | ||
18 | 24 | ||
19 | #include "log.h" | 25 | #include "log.h" |
20 | 26 | ||
diff --git a/clientloop.c b/clientloop.c index 5621768b5..ae93dcdf3 100644 --- a/clientloop.c +++ b/clientloop.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: clientloop.c,v 1.178 2007/02/20 10:25:14 djm Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -59,20 +60,43 @@ | |||
59 | */ | 60 | */ |
60 | 61 | ||
61 | #include "includes.h" | 62 | #include "includes.h" |
62 | RCSID("$OpenBSD: clientloop.c,v 1.149 2005/12/30 15:56:37 reyk Exp $"); | ||
63 | 63 | ||
64 | #include <sys/types.h> | ||
65 | #include <sys/ioctl.h> | ||
66 | #include <sys/param.h> | ||
67 | #ifdef HAVE_SYS_STAT_H | ||
68 | # include <sys/stat.h> | ||
69 | #endif | ||
70 | #ifdef HAVE_SYS_TIME_H | ||
71 | # include <sys/time.h> | ||
72 | #endif | ||
73 | #include <sys/socket.h> | ||
74 | |||
75 | #include <ctype.h> | ||
76 | #include <errno.h> | ||
77 | #ifdef HAVE_PATHS_H | ||
78 | #include <paths.h> | ||
79 | #endif | ||
80 | #include <signal.h> | ||
81 | #include <stdarg.h> | ||
82 | #include <stdio.h> | ||
83 | #include <stdlib.h> | ||
84 | #include <string.h> | ||
85 | #include <termios.h> | ||
86 | #include <pwd.h> | ||
87 | #include <unistd.h> | ||
88 | |||
89 | #include "xmalloc.h" | ||
64 | #include "ssh.h" | 90 | #include "ssh.h" |
65 | #include "ssh1.h" | 91 | #include "ssh1.h" |
66 | #include "ssh2.h" | 92 | #include "ssh2.h" |
67 | #include "xmalloc.h" | ||
68 | #include "packet.h" | 93 | #include "packet.h" |
69 | #include "buffer.h" | 94 | #include "buffer.h" |
70 | #include "compat.h" | 95 | #include "compat.h" |
71 | #include "channels.h" | 96 | #include "channels.h" |
72 | #include "dispatch.h" | 97 | #include "dispatch.h" |
73 | #include "buffer.h" | ||
74 | #include "bufaux.h" | ||
75 | #include "key.h" | 98 | #include "key.h" |
99 | #include "cipher.h" | ||
76 | #include "kex.h" | 100 | #include "kex.h" |
77 | #include "log.h" | 101 | #include "log.h" |
78 | #include "readconf.h" | 102 | #include "readconf.h" |
@@ -118,7 +142,7 @@ static volatile sig_atomic_t received_signal = 0; | |||
118 | static int in_non_blocking_mode = 0; | 142 | static int in_non_blocking_mode = 0; |
119 | 143 | ||
120 | /* Common data for the client loop code. */ | 144 | /* Common data for the client loop code. */ |
121 | static int quit_pending; /* Set to non-zero to quit the client loop. */ | 145 | static volatile sig_atomic_t quit_pending; /* Set non-zero to quit the loop. */ |
122 | static int escape_char; /* Escape character. */ | 146 | static int escape_char; /* Escape character. */ |
123 | static int escape_pending; /* Last character was the escape character */ | 147 | static int escape_pending; /* Last character was the escape character */ |
124 | static int last_was_cr; /* Last character was a newline. */ | 148 | static int last_was_cr; /* Last character was a newline. */ |
@@ -178,7 +202,7 @@ enter_non_blocking(void) | |||
178 | * Signal handler for the window change signal (SIGWINCH). This just sets a | 202 | * Signal handler for the window change signal (SIGWINCH). This just sets a |
179 | * flag indicating that the window has changed. | 203 | * flag indicating that the window has changed. |
180 | */ | 204 | */ |
181 | 205 | /*ARGSUSED */ | |
182 | static void | 206 | static void |
183 | window_change_handler(int sig) | 207 | window_change_handler(int sig) |
184 | { | 208 | { |
@@ -190,7 +214,7 @@ window_change_handler(int sig) | |||
190 | * Signal handler for signals that cause the program to terminate. These | 214 | * Signal handler for signals that cause the program to terminate. These |
191 | * signals must be trapped to restore terminal modes. | 215 | * signals must be trapped to restore terminal modes. |
192 | */ | 216 | */ |
193 | 217 | /*ARGSUSED */ | |
194 | static void | 218 | static void |
195 | signal_handler(int sig) | 219 | signal_handler(int sig) |
196 | { | 220 | { |
@@ -422,10 +446,10 @@ client_check_window_change(void) | |||
422 | if (ioctl(fileno(stdin), TIOCGWINSZ, &ws) < 0) | 446 | if (ioctl(fileno(stdin), TIOCGWINSZ, &ws) < 0) |
423 | return; | 447 | return; |
424 | packet_start(SSH_CMSG_WINDOW_SIZE); | 448 | packet_start(SSH_CMSG_WINDOW_SIZE); |
425 | packet_put_int(ws.ws_row); | 449 | packet_put_int((u_int)ws.ws_row); |
426 | packet_put_int(ws.ws_col); | 450 | packet_put_int((u_int)ws.ws_col); |
427 | packet_put_int(ws.ws_xpixel); | 451 | packet_put_int((u_int)ws.ws_xpixel); |
428 | packet_put_int(ws.ws_ypixel); | 452 | packet_put_int((u_int)ws.ws_ypixel); |
429 | packet_send(); | 453 | packet_send(); |
430 | } | 454 | } |
431 | } | 455 | } |
@@ -441,8 +465,10 @@ static void | |||
441 | server_alive_check(void) | 465 | server_alive_check(void) |
442 | { | 466 | { |
443 | if (compat20) { | 467 | if (compat20) { |
444 | if (++server_alive_timeouts > options.server_alive_count_max) | 468 | if (++server_alive_timeouts > options.server_alive_count_max) { |
445 | packet_disconnect("Timeout, server not responding."); | 469 | logit("Timeout, server not responding."); |
470 | cleanup_exit(255); | ||
471 | } | ||
446 | packet_start(SSH2_MSG_GLOBAL_REQUEST); | 472 | packet_start(SSH2_MSG_GLOBAL_REQUEST); |
447 | packet_put_cstring("keepalive@openssh.com"); | 473 | packet_put_cstring("keepalive@openssh.com"); |
448 | packet_put_char(1); /* boolean: want reply */ | 474 | packet_put_char(1); /* boolean: want reply */ |
@@ -574,7 +600,7 @@ client_suspend_self(Buffer *bin, Buffer *bout, Buffer *berr) | |||
574 | } | 600 | } |
575 | 601 | ||
576 | static void | 602 | static void |
577 | client_process_net_input(fd_set * readset) | 603 | client_process_net_input(fd_set *readset) |
578 | { | 604 | { |
579 | int len; | 605 | int len; |
580 | char buf[8192]; | 606 | char buf[8192]; |
@@ -682,11 +708,11 @@ client_extra_session2_setup(int id, void *arg) | |||
682 | } | 708 | } |
683 | 709 | ||
684 | static void | 710 | static void |
685 | client_process_control(fd_set * readset) | 711 | client_process_control(fd_set *readset) |
686 | { | 712 | { |
687 | Buffer m; | 713 | Buffer m; |
688 | Channel *c; | 714 | Channel *c; |
689 | int client_fd, new_fd[3], ver, allowed; | 715 | int client_fd, new_fd[3], ver, allowed, window, packetmax; |
690 | socklen_t addrlen; | 716 | socklen_t addrlen; |
691 | struct sockaddr_storage addr; | 717 | struct sockaddr_storage addr; |
692 | struct confirm_ctx *cctx; | 718 | struct confirm_ctx *cctx; |
@@ -813,8 +839,7 @@ client_process_control(fd_set * readset) | |||
813 | return; | 839 | return; |
814 | } | 840 | } |
815 | 841 | ||
816 | cctx = xmalloc(sizeof(*cctx)); | 842 | cctx = xcalloc(1, sizeof(*cctx)); |
817 | memset(cctx, 0, sizeof(*cctx)); | ||
818 | cctx->want_tty = (flags & SSHMUX_FLAG_TTY) != 0; | 843 | cctx->want_tty = (flags & SSHMUX_FLAG_TTY) != 0; |
819 | cctx->want_subsys = (flags & SSHMUX_FLAG_SUBSYS) != 0; | 844 | cctx->want_subsys = (flags & SSHMUX_FLAG_SUBSYS) != 0; |
820 | cctx->want_x_fwd = (flags & SSHMUX_FLAG_X11_FWD) != 0; | 845 | cctx->want_x_fwd = (flags & SSHMUX_FLAG_X11_FWD) != 0; |
@@ -829,7 +854,7 @@ client_process_control(fd_set * readset) | |||
829 | env_len = MIN(env_len, 4096); | 854 | env_len = MIN(env_len, 4096); |
830 | debug3("%s: receiving %d env vars", __func__, env_len); | 855 | debug3("%s: receiving %d env vars", __func__, env_len); |
831 | if (env_len != 0) { | 856 | if (env_len != 0) { |
832 | cctx->env = xmalloc(sizeof(*cctx->env) * (env_len + 1)); | 857 | cctx->env = xcalloc(env_len + 1, sizeof(*cctx->env)); |
833 | for (i = 0; i < env_len; i++) | 858 | for (i = 0; i < env_len; i++) |
834 | cctx->env[i] = buffer_get_string(&m, &len); | 859 | cctx->env[i] = buffer_get_string(&m, &len); |
835 | cctx->env[i] = NULL; | 860 | cctx->env[i] = NULL; |
@@ -837,6 +862,7 @@ client_process_control(fd_set * readset) | |||
837 | 862 | ||
838 | debug2("%s: accepted tty %d, subsys %d, cmd %s", __func__, | 863 | debug2("%s: accepted tty %d, subsys %d, cmd %s", __func__, |
839 | cctx->want_tty, cctx->want_subsys, cmd); | 864 | cctx->want_tty, cctx->want_subsys, cmd); |
865 | xfree(cmd); | ||
840 | 866 | ||
841 | /* Gather fds from client */ | 867 | /* Gather fds from client */ |
842 | new_fd[0] = mm_receive_fd(client_fd); | 868 | new_fd[0] = mm_receive_fd(client_fd); |
@@ -879,9 +905,15 @@ client_process_control(fd_set * readset) | |||
879 | 905 | ||
880 | set_nonblock(client_fd); | 906 | set_nonblock(client_fd); |
881 | 907 | ||
908 | window = CHAN_SES_WINDOW_DEFAULT; | ||
909 | packetmax = CHAN_SES_PACKET_DEFAULT; | ||
910 | if (cctx->want_tty) { | ||
911 | window >>= 1; | ||
912 | packetmax >>= 1; | ||
913 | } | ||
914 | |||
882 | c = channel_new("session", SSH_CHANNEL_OPENING, | 915 | c = channel_new("session", SSH_CHANNEL_OPENING, |
883 | new_fd[0], new_fd[1], new_fd[2], | 916 | new_fd[0], new_fd[1], new_fd[2], window, packetmax, |
884 | CHAN_SES_WINDOW_DEFAULT, CHAN_SES_PACKET_DEFAULT, | ||
885 | CHAN_EXTENDED_WRITE, "client-session", /*nonblock*/0); | 917 | CHAN_EXTENDED_WRITE, "client-session", /*nonblock*/0); |
886 | 918 | ||
887 | /* XXX */ | 919 | /* XXX */ |
@@ -917,12 +949,16 @@ process_cmdline(void) | |||
917 | 949 | ||
918 | if (*s == 'h' || *s == 'H' || *s == '?') { | 950 | if (*s == 'h' || *s == 'H' || *s == '?') { |
919 | logit("Commands:"); | 951 | logit("Commands:"); |
920 | logit(" -Lport:host:hostport Request local forward"); | 952 | logit(" -L[bind_address:]port:host:hostport " |
921 | logit(" -Rport:host:hostport Request remote forward"); | 953 | "Request local forward"); |
922 | logit(" -KRhostport Cancel remote forward"); | 954 | logit(" -R[bind_address:]port:host:hostport " |
955 | "Request remote forward"); | ||
956 | logit(" -KR[bind_address:]port " | ||
957 | "Cancel remote forward"); | ||
923 | if (!options.permit_local_command) | 958 | if (!options.permit_local_command) |
924 | goto out; | 959 | goto out; |
925 | logit(" !args Execute local command"); | 960 | logit(" !args " |
961 | "Execute local command"); | ||
926 | goto out; | 962 | goto out; |
927 | } | 963 | } |
928 | 964 | ||
@@ -983,9 +1019,12 @@ process_cmdline(void) | |||
983 | goto out; | 1019 | goto out; |
984 | } | 1020 | } |
985 | } else { | 1021 | } else { |
986 | channel_request_remote_forwarding(fwd.listen_host, | 1022 | if (channel_request_remote_forwarding(fwd.listen_host, |
987 | fwd.listen_port, fwd.connect_host, | 1023 | fwd.listen_port, fwd.connect_host, |
988 | fwd.connect_port); | 1024 | fwd.connect_port) < 0) { |
1025 | logit("Port forwarding failed."); | ||
1026 | goto out; | ||
1027 | } | ||
989 | } | 1028 | } |
990 | 1029 | ||
991 | logit("Forwarding port."); | 1030 | logit("Forwarding port."); |
@@ -1177,7 +1216,7 @@ Supported escape sequences:\r\n\ | |||
1177 | } | 1216 | } |
1178 | 1217 | ||
1179 | static void | 1218 | static void |
1180 | client_process_input(fd_set * readset) | 1219 | client_process_input(fd_set *readset) |
1181 | { | 1220 | { |
1182 | int len; | 1221 | int len; |
1183 | char buf[8192]; | 1222 | char buf[8192]; |
@@ -1230,7 +1269,7 @@ client_process_input(fd_set * readset) | |||
1230 | } | 1269 | } |
1231 | 1270 | ||
1232 | static void | 1271 | static void |
1233 | client_process_output(fd_set * writeset) | 1272 | client_process_output(fd_set *writeset) |
1234 | { | 1273 | { |
1235 | int len; | 1274 | int len; |
1236 | char buf[100]; | 1275 | char buf[100]; |
@@ -1731,7 +1770,7 @@ client_request_agent(const char *request_type, int rchan) | |||
1731 | error("Warning: this is probably a break-in attempt by a malicious server."); | 1770 | error("Warning: this is probably a break-in attempt by a malicious server."); |
1732 | return NULL; | 1771 | return NULL; |
1733 | } | 1772 | } |
1734 | sock = ssh_get_authentication_socket(); | 1773 | sock = ssh_get_authentication_socket(); |
1735 | if (sock < 0) | 1774 | if (sock < 0) |
1736 | return NULL; | 1775 | return NULL; |
1737 | c = channel_new("authentication agent connection", | 1776 | c = channel_new("authentication agent connection", |
@@ -1876,10 +1915,10 @@ client_session2_setup(int id, int want_tty, int want_subsystem, | |||
1876 | 1915 | ||
1877 | channel_request_start(id, "pty-req", 0); | 1916 | channel_request_start(id, "pty-req", 0); |
1878 | packet_put_cstring(term != NULL ? term : ""); | 1917 | packet_put_cstring(term != NULL ? term : ""); |
1879 | packet_put_int(ws.ws_col); | 1918 | packet_put_int((u_int)ws.ws_col); |
1880 | packet_put_int(ws.ws_row); | 1919 | packet_put_int((u_int)ws.ws_row); |
1881 | packet_put_int(ws.ws_xpixel); | 1920 | packet_put_int((u_int)ws.ws_xpixel); |
1882 | packet_put_int(ws.ws_ypixel); | 1921 | packet_put_int((u_int)ws.ws_ypixel); |
1883 | tio = get_saved_tio(); | 1922 | tio = get_saved_tio(); |
1884 | tty_make_modes(-1, tiop != NULL ? tiop : &tio); | 1923 | tty_make_modes(-1, tiop != NULL ? tiop : &tio); |
1885 | packet_send(); | 1924 | packet_send(); |
diff --git a/clientloop.h b/clientloop.h index aed2d918b..beec62f70 100644 --- a/clientloop.h +++ b/clientloop.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: clientloop.h,v 1.14 2005/07/04 00:58:43 djm Exp $ */ | 1 | /* $OpenBSD: clientloop.h,v 1.16 2006/03/25 22:22:42 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -35,6 +35,8 @@ | |||
35 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 35 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
36 | */ | 36 | */ |
37 | 37 | ||
38 | #include <termios.h> | ||
39 | |||
38 | /* Client side main loop for the interactive session. */ | 40 | /* Client side main loop for the interactive session. */ |
39 | int client_loop(int, int, int); | 41 | int client_loop(int, int, int); |
40 | void client_x11_get_proto(const char *, const char *, u_int, | 42 | void client_x11_get_proto(const char *, const char *, u_int, |
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: compat.c,v 1.77 2006/12/12 03:58:42 djm Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 1999, 2000, 2001, 2002 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 1999, 2000, 2001, 2002 Markus Friedl. All rights reserved. |
3 | * | 4 | * |
@@ -23,11 +24,16 @@ | |||
23 | */ | 24 | */ |
24 | 25 | ||
25 | #include "includes.h" | 26 | #include "includes.h" |
26 | RCSID("$OpenBSD: compat.c,v 1.71 2005/03/01 10:09:52 djm Exp $"); | ||
27 | 27 | ||
28 | #include <sys/types.h> | ||
29 | |||
30 | #include <stdlib.h> | ||
31 | #include <string.h> | ||
32 | #include <stdarg.h> | ||
33 | |||
34 | #include "xmalloc.h" | ||
28 | #include "buffer.h" | 35 | #include "buffer.h" |
29 | #include "packet.h" | 36 | #include "packet.h" |
30 | #include "xmalloc.h" | ||
31 | #include "compat.h" | 37 | #include "compat.h" |
32 | #include "log.h" | 38 | #include "log.h" |
33 | #include "match.h" | 39 | #include "match.h" |
@@ -127,7 +133,8 @@ compat_datafellows(const char *version) | |||
127 | { "2.3.*", SSH_BUG_DEBUG|SSH_BUG_RSASIGMD5| | 133 | { "2.3.*", SSH_BUG_DEBUG|SSH_BUG_RSASIGMD5| |
128 | SSH_BUG_FIRSTKEX }, | 134 | SSH_BUG_FIRSTKEX }, |
129 | { "2.4", SSH_OLD_SESSIONID }, /* Van Dyke */ | 135 | { "2.4", SSH_OLD_SESSIONID }, /* Van Dyke */ |
130 | { "2.*", SSH_BUG_DEBUG|SSH_BUG_FIRSTKEX }, | 136 | { "2.*", SSH_BUG_DEBUG|SSH_BUG_FIRSTKEX| |
137 | SSH_BUG_RFWD_ADDR }, | ||
131 | { "3.0.*", SSH_BUG_DEBUG }, | 138 | { "3.0.*", SSH_BUG_DEBUG }, |
132 | { "3.0 SecureCRT*", SSH_OLD_SESSIONID }, | 139 | { "3.0 SecureCRT*", SSH_OLD_SESSIONID }, |
133 | { "1.7 SecureFX*", SSH_OLD_SESSIONID }, | 140 | { "1.7 SecureFX*", SSH_OLD_SESSIONID }, |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: compat.h,v 1.39 2005/03/01 10:09:52 djm Exp $ */ | 1 | /* $OpenBSD: compat.h,v 1.41 2006/12/12 03:58:42 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 1999, 2000, 2001 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 1999, 2000, 2001 Markus Friedl. All rights reserved. |
@@ -56,6 +56,7 @@ | |||
56 | #define SSH_BUG_PROBE 0x00400000 | 56 | #define SSH_BUG_PROBE 0x00400000 |
57 | #define SSH_BUG_FIRSTKEX 0x00800000 | 57 | #define SSH_BUG_FIRSTKEX 0x00800000 |
58 | #define SSH_OLD_FORWARD_ADDR 0x01000000 | 58 | #define SSH_OLD_FORWARD_ADDR 0x01000000 |
59 | #define SSH_BUG_RFWD_ADDR 0x02000000 | ||
59 | 60 | ||
60 | void enable_compat13(void); | 61 | void enable_compat13(void); |
61 | void enable_compat20(void); | 62 | void enable_compat20(void); |
diff --git a/compress.c b/compress.c index 0d1c7e55e..c058d2224 100644 --- a/compress.c +++ b/compress.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: compress.c,v 1.25 2006/08/06 01:13:32 stevesk Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -12,11 +13,14 @@ | |||
12 | */ | 13 | */ |
13 | 14 | ||
14 | #include "includes.h" | 15 | #include "includes.h" |
15 | RCSID("$OpenBSD: compress.c,v 1.21 2004/01/13 19:45:15 markus Exp $"); | 16 | |
17 | #include <sys/types.h> | ||
18 | |||
19 | #include <stdarg.h> | ||
20 | #include <zlib.h> | ||
16 | 21 | ||
17 | #include "log.h" | 22 | #include "log.h" |
18 | #include "buffer.h" | 23 | #include "buffer.h" |
19 | #include "zlib.h" | ||
20 | #include "compress.h" | 24 | #include "compress.h" |
21 | 25 | ||
22 | z_stream incoming_stream; | 26 | z_stream incoming_stream; |
diff --git a/compress.h b/compress.h index e364f4bdc..418d6fd2c 100644 --- a/compress.h +++ b/compress.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: compress.h,v 1.11 2002/03/04 17:27:39 stevesk Exp $ */ | 1 | /* $OpenBSD: compress.h,v 1.12 2006/03/25 22:22:43 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
diff --git a/config.h.in b/config.h.in index b5cfdbb2c..a913487e1 100644 --- a/config.h.in +++ b/config.h.in | |||
@@ -1,5 +1,9 @@ | |||
1 | /* config.h.in. Generated from configure.ac by autoheader. */ | 1 | /* config.h.in. Generated from configure.ac by autoheader. */ |
2 | 2 | ||
3 | /* Define if you have a getaddrinfo that fails for the all-zeros IPv6 address | ||
4 | */ | ||
5 | #undef AIX_GETNAMEINFO_HACK | ||
6 | |||
3 | /* Define if your AIX loginfailed() function takes 4 arguments (AIX >= 5.2) */ | 7 | /* Define if your AIX loginfailed() function takes 4 arguments (AIX >= 5.2) */ |
4 | #undef AIX_LOGINFAILED_4ARG | 8 | #undef AIX_LOGINFAILED_4ARG |
5 | 9 | ||
@@ -190,6 +194,9 @@ | |||
190 | /* Define if your system uses ancillary data style file descriptor passing */ | 194 | /* Define if your system uses ancillary data style file descriptor passing */ |
191 | #undef HAVE_CONTROL_IN_MSGHDR | 195 | #undef HAVE_CONTROL_IN_MSGHDR |
192 | 196 | ||
197 | /* Define to 1 if you have the <crypto/sha2.h> header file. */ | ||
198 | #undef HAVE_CRYPTO_SHA2_H | ||
199 | |||
193 | /* Define to 1 if you have the <crypt.h> header file. */ | 200 | /* Define to 1 if you have the <crypt.h> header file. */ |
194 | #undef HAVE_CRYPT_H | 201 | #undef HAVE_CRYPT_H |
195 | 202 | ||
@@ -203,6 +210,10 @@ | |||
203 | don't. */ | 210 | don't. */ |
204 | #undef HAVE_DECL_AUTHENTICATE | 211 | #undef HAVE_DECL_AUTHENTICATE |
205 | 212 | ||
213 | /* Define to 1 if you have the declaration of `GLOB_NOMATCH', and to 0 if you | ||
214 | don't. */ | ||
215 | #undef HAVE_DECL_GLOB_NOMATCH | ||
216 | |||
206 | /* Define to 1 if you have the declaration of `h_errno', and to 0 if you | 217 | /* Define to 1 if you have the declaration of `h_errno', and to 0 if you |
207 | don't. */ | 218 | don't. */ |
208 | #undef HAVE_DECL_H_ERRNO | 219 | #undef HAVE_DECL_H_ERRNO |
@@ -219,6 +230,10 @@ | |||
219 | don't. */ | 230 | don't. */ |
220 | #undef HAVE_DECL_LOGINSUCCESS | 231 | #undef HAVE_DECL_LOGINSUCCESS |
221 | 232 | ||
233 | /* Define to 1 if you have the declaration of `O_NONBLOCK', and to 0 if you | ||
234 | don't. */ | ||
235 | #undef HAVE_DECL_O_NONBLOCK | ||
236 | |||
222 | /* Define to 1 if you have the declaration of `passwdexpired', and to 0 if you | 237 | /* Define to 1 if you have the declaration of `passwdexpired', and to 0 if you |
223 | don't. */ | 238 | don't. */ |
224 | #undef HAVE_DECL_PASSWDEXPIRED | 239 | #undef HAVE_DECL_PASSWDEXPIRED |
@@ -227,6 +242,14 @@ | |||
227 | don't. */ | 242 | don't. */ |
228 | #undef HAVE_DECL_SETAUTHDB | 243 | #undef HAVE_DECL_SETAUTHDB |
229 | 244 | ||
245 | /* Define to 1 if you have the declaration of `SHUT_RD', and to 0 if you | ||
246 | don't. */ | ||
247 | #undef HAVE_DECL_SHUT_RD | ||
248 | |||
249 | /* Define to 1 if you have the declaration of `writev', and to 0 if you don't. | ||
250 | */ | ||
251 | #undef HAVE_DECL_WRITEV | ||
252 | |||
230 | /* Define to 1 if you have the declaration of `_getlong', and to 0 if you | 253 | /* Define to 1 if you have the declaration of `_getlong', and to 0 if you |
231 | don't. */ | 254 | don't. */ |
232 | #undef HAVE_DECL__GETLONG | 255 | #undef HAVE_DECL__GETLONG |
@@ -262,6 +285,9 @@ | |||
262 | /* Define if your system has /etc/default/login */ | 285 | /* Define if your system has /etc/default/login */ |
263 | #undef HAVE_ETC_DEFAULT_LOGIN | 286 | #undef HAVE_ETC_DEFAULT_LOGIN |
264 | 287 | ||
288 | /* Define to 1 if you have the `EVP_sha256' function. */ | ||
289 | #undef HAVE_EVP_SHA256 | ||
290 | |||
265 | /* Define if you have ut_exit in utmp.h */ | 291 | /* Define if you have ut_exit in utmp.h */ |
266 | #undef HAVE_EXIT_IN_UTMP | 292 | #undef HAVE_EXIT_IN_UTMP |
267 | 293 | ||
@@ -271,6 +297,12 @@ | |||
271 | /* Define to 1 if you have the `fchown' function. */ | 297 | /* Define to 1 if you have the `fchown' function. */ |
272 | #undef HAVE_FCHOWN | 298 | #undef HAVE_FCHOWN |
273 | 299 | ||
300 | /* Use F_CLOSEM fcntl for closefrom */ | ||
301 | #undef HAVE_FCNTL_CLOSEM | ||
302 | |||
303 | /* Define to 1 if you have the <fcntl.h> header file. */ | ||
304 | #undef HAVE_FCNTL_H | ||
305 | |||
274 | /* Define to 1 if you have the <features.h> header file. */ | 306 | /* Define to 1 if you have the <features.h> header file. */ |
275 | #undef HAVE_FEATURES_H | 307 | #undef HAVE_FEATURES_H |
276 | 308 | ||
@@ -334,6 +366,9 @@ | |||
334 | /* Define to 1 if you have the `getrusage' function. */ | 366 | /* Define to 1 if you have the `getrusage' function. */ |
335 | #undef HAVE_GETRUSAGE | 367 | #undef HAVE_GETRUSAGE |
336 | 368 | ||
369 | /* Define to 1 if you have the `getseuserbyname' function. */ | ||
370 | #undef HAVE_GETSEUSERBYNAME | ||
371 | |||
337 | /* Define to 1 if you have the `gettimeofday' function. */ | 372 | /* Define to 1 if you have the `gettimeofday' function. */ |
338 | #undef HAVE_GETTIMEOFDAY | 373 | #undef HAVE_GETTIMEOFDAY |
339 | 374 | ||
@@ -358,6 +393,9 @@ | |||
358 | /* Define to 1 if you have the `getutxline' function. */ | 393 | /* Define to 1 if you have the `getutxline' function. */ |
359 | #undef HAVE_GETUTXLINE | 394 | #undef HAVE_GETUTXLINE |
360 | 395 | ||
396 | /* Define to 1 if you have the `get_default_context_with_level' function. */ | ||
397 | #undef HAVE_GET_DEFAULT_CONTEXT_WITH_LEVEL | ||
398 | |||
361 | /* Define to 1 if you have the `glob' function. */ | 399 | /* Define to 1 if you have the `glob' function. */ |
362 | #undef HAVE_GLOB | 400 | #undef HAVE_GLOB |
363 | 401 | ||
@@ -532,6 +570,9 @@ | |||
532 | /* Define to 1 if you have the <netgroup.h> header file. */ | 570 | /* Define to 1 if you have the <netgroup.h> header file. */ |
533 | #undef HAVE_NETGROUP_H | 571 | #undef HAVE_NETGROUP_H |
534 | 572 | ||
573 | /* Define to 1 if you have the <net/if_tun.h> header file. */ | ||
574 | #undef HAVE_NET_IF_TUN_H | ||
575 | |||
535 | /* Define if you are on NeXT */ | 576 | /* Define if you are on NeXT */ |
536 | #undef HAVE_NEXT | 577 | #undef HAVE_NEXT |
537 | 578 | ||
@@ -635,9 +676,6 @@ | |||
635 | /* Define to 1 if you have the <security/pam_appl.h> header file. */ | 676 | /* Define to 1 if you have the <security/pam_appl.h> header file. */ |
636 | #undef HAVE_SECURITY_PAM_APPL_H | 677 | #undef HAVE_SECURITY_PAM_APPL_H |
637 | 678 | ||
638 | /* Define to 1 if you have the <selinux/selinux.h> header file. */ | ||
639 | #undef HAVE_SELINUX_SELINUX_H | ||
640 | |||
641 | /* Define to 1 if you have the `sendmsg' function. */ | 679 | /* Define to 1 if you have the `sendmsg' function. */ |
642 | #undef HAVE_SENDMSG | 680 | #undef HAVE_SENDMSG |
643 | 681 | ||
@@ -698,6 +736,12 @@ | |||
698 | /* Define to 1 if you have the `setvbuf' function. */ | 736 | /* Define to 1 if you have the `setvbuf' function. */ |
699 | #undef HAVE_SETVBUF | 737 | #undef HAVE_SETVBUF |
700 | 738 | ||
739 | /* Define to 1 if you have the `SHA256_Update' function. */ | ||
740 | #undef HAVE_SHA256_UPDATE | ||
741 | |||
742 | /* Define to 1 if you have the <sha2.h> header file. */ | ||
743 | #undef HAVE_SHA2_H | ||
744 | |||
701 | /* Define to 1 if you have the <shadow.h> header file. */ | 745 | /* Define to 1 if you have the <shadow.h> header file. */ |
702 | #undef HAVE_SHADOW_H | 746 | #undef HAVE_SHADOW_H |
703 | 747 | ||
@@ -1127,6 +1171,9 @@ | |||
1127 | /* Location of PRNGD/EGD random number socket */ | 1171 | /* Location of PRNGD/EGD random number socket */ |
1128 | #undef PRNGD_SOCKET | 1172 | #undef PRNGD_SOCKET |
1129 | 1173 | ||
1174 | /* read(1) can return 0 for a non-closed fd */ | ||
1175 | #undef PTY_ZEROREAD | ||
1176 | |||
1130 | /* Define if your platform breaks doing a seteuid before a setuid */ | 1177 | /* Define if your platform breaks doing a seteuid before a setuid */ |
1131 | #undef SETEUID_BREAKS_SETUID | 1178 | #undef SETEUID_BREAKS_SETUID |
1132 | 1179 | ||
@@ -1197,6 +1244,9 @@ | |||
1197 | /* Define if you want a different $PATH for the superuser */ | 1244 | /* Define if you want a different $PATH for the superuser */ |
1198 | #undef SUPERUSER_PATH | 1245 | #undef SUPERUSER_PATH |
1199 | 1246 | ||
1247 | /* syslog_r function is safe to use in in a signal handler */ | ||
1248 | #undef SYSLOG_R_SAFE_IN_SIGHAND | ||
1249 | |||
1200 | /* Support passwords > 8 chars */ | 1250 | /* Support passwords > 8 chars */ |
1201 | #undef UNIXWARE_LONG_PASSWORDS | 1251 | #undef UNIXWARE_LONG_PASSWORDS |
1202 | 1252 | ||
@@ -1221,6 +1271,9 @@ | |||
1221 | /* Define if you want smartcard support using OpenSC */ | 1271 | /* Define if you want smartcard support using OpenSC */ |
1222 | #undef USE_OPENSC | 1272 | #undef USE_OPENSC |
1223 | 1273 | ||
1274 | /* Enable OpenSSL engine support */ | ||
1275 | #undef USE_OPENSSL_ENGINE | ||
1276 | |||
1224 | /* Define if you want to enable PAM support */ | 1277 | /* Define if you want to enable PAM support */ |
1225 | #undef USE_PAM | 1278 | #undef USE_PAM |
1226 | 1279 | ||
@@ -1233,6 +1286,9 @@ | |||
1233 | /* platform has the Security Authorization Session API */ | 1286 | /* platform has the Security Authorization Session API */ |
1234 | #undef USE_SECURITY_SESSION_API | 1287 | #undef USE_SECURITY_SESSION_API |
1235 | 1288 | ||
1289 | /* Define if you have Solaris process contracts */ | ||
1290 | #undef USE_SOLARIS_PROCESS_CONTRACTS | ||
1291 | |||
1236 | /* Define if you shouldn't strip 'tty' from your ttyname in [uw]tmp */ | 1292 | /* Define if you shouldn't strip 'tty' from your ttyname in [uw]tmp */ |
1237 | #undef WITH_ABBREV_NO_TTY | 1293 | #undef WITH_ABBREV_NO_TTY |
1238 | 1294 | ||
@@ -1,5 +1,5 @@ | |||
1 | #! /bin/sh | 1 | #! /bin/sh |
2 | # From configure.ac Revision: 1.322.2.6 . | 2 | # From configure.ac Revision: 1.372 . |
3 | # Guess values for system-dependent variables and create Makefiles. | 3 | # Guess values for system-dependent variables and create Makefiles. |
4 | # Generated by GNU Autoconf 2.61 for OpenSSH Portable. | 4 | # Generated by GNU Autoconf 2.61 for OpenSSH Portable. |
5 | # | 5 | # |
@@ -692,6 +692,7 @@ STARTUP_SCRIPT_SHELL | |||
692 | LOGIN_PROGRAM_FALLBACK | 692 | LOGIN_PROGRAM_FALLBACK |
693 | PATH_PASSWD_PROG | 693 | PATH_PASSWD_PROG |
694 | LD | 694 | LD |
695 | SSHDLIBS | ||
695 | LIBWRAP | 696 | LIBWRAP |
696 | LIBEDIT | 697 | LIBEDIT |
697 | LIBPAM | 698 | LIBPAM |
@@ -1327,20 +1328,23 @@ Optional Packages: | |||
1327 | --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] | 1328 | --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] |
1328 | --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) | 1329 | --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) |
1329 | --without-rpath Disable auto-added -R linker paths | 1330 | --without-rpath Disable auto-added -R linker paths |
1330 | --with-osfsia Enable Digital Unix SIA | ||
1331 | --with-cflags Specify additional flags to pass to compiler | 1331 | --with-cflags Specify additional flags to pass to compiler |
1332 | --with-cppflags Specify additional flags to pass to preprocessor | 1332 | --with-cppflags Specify additional flags to pass to preprocessor |
1333 | --with-ldflags Specify additional flags to pass to linker | 1333 | --with-ldflags Specify additional flags to pass to linker |
1334 | --with-libs Specify additional libraries to link with | 1334 | --with-libs Specify additional libraries to link with |
1335 | --with-Werror Build main code with -Werror | 1335 | --with-Werror Build main code with -Werror |
1336 | --with-solaris-contracts Enable Solaris process contracts (experimental) | ||
1337 | --with-osfsia Enable Digital Unix SIA | ||
1336 | --with-zlib=PATH Use zlib in PATH | 1338 | --with-zlib=PATH Use zlib in PATH |
1337 | --without-zlib-version-check Disable zlib version check | 1339 | --without-zlib-version-check Disable zlib version check |
1338 | --with-skey[=PATH] Enable S/Key support (optionally in PATH) | 1340 | --with-skey[=PATH] Enable S/Key support (optionally in PATH) |
1339 | --with-tcp-wrappers[=PATH] Enable tcpwrappers support (optionally in PATH) | 1341 | --with-tcp-wrappers[=PATH] Enable tcpwrappers support (optionally in PATH) |
1340 | --with-libedit[=PATH] Enable libedit support for sftp | 1342 | --with-libedit[=PATH] Enable libedit support for sftp |
1341 | --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm) | 1343 | --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm) |
1342 | --with-pam Enable PAM support | ||
1343 | --with-ssl-dir=PATH Specify path to OpenSSL installation | 1344 | --with-ssl-dir=PATH Specify path to OpenSSL installation |
1345 | --without-openssl-header-check Disable OpenSSL version consistency check | ||
1346 | --with-ssl-engine Enable OpenSSL (hardware) ENGINE support | ||
1347 | --with-pam Enable PAM support | ||
1344 | --with-rand-helper Use subprocess to gather strong randomness | 1348 | --with-rand-helper Use subprocess to gather strong randomness |
1345 | --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT | 1349 | --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT |
1346 | --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool) | 1350 | --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool) |
@@ -1348,7 +1352,7 @@ Optional Packages: | |||
1348 | --with-privsep-user=user Specify non-privileged user for privilege separation | 1352 | --with-privsep-user=user Specify non-privileged user for privilege separation |
1349 | --with-sectok Enable smartcard support using libsectok | 1353 | --with-sectok Enable smartcard support using libsectok |
1350 | --with-opensc[=PFX] Enable smartcard support using OpenSC (optionally in PATH) | 1354 | --with-opensc[=PFX] Enable smartcard support using OpenSC (optionally in PATH) |
1351 | --with-selinux[=LIBSELINUX-PATH] Enable SELinux support | 1355 | --with-selinux Enable SELinux support |
1352 | --with-kerberos5=PATH Enable Kerberos 5 support | 1356 | --with-kerberos5=PATH Enable Kerberos 5 support |
1353 | --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty) | 1357 | --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty) |
1354 | --with-xauth=PATH Specify path to xauth program | 1358 | --with-xauth=PATH Specify path to xauth program |
@@ -5477,16 +5481,597 @@ if test "${with_rpath+set}" = set; then | |||
5477 | fi | 5481 | fi |
5478 | 5482 | ||
5479 | 5483 | ||
5484 | # Allow user to specify flags | ||
5485 | |||
5486 | # Check whether --with-cflags was given. | ||
5487 | if test "${with_cflags+set}" = set; then | ||
5488 | withval=$with_cflags; | ||
5489 | if test -n "$withval" && test "x$withval" != "xno" && \ | ||
5490 | test "x${withval}" != "xyes"; then | ||
5491 | CFLAGS="$CFLAGS $withval" | ||
5492 | fi | ||
5493 | |||
5494 | |||
5495 | fi | ||
5496 | |||
5497 | |||
5498 | # Check whether --with-cppflags was given. | ||
5499 | if test "${with_cppflags+set}" = set; then | ||
5500 | withval=$with_cppflags; | ||
5501 | if test -n "$withval" && test "x$withval" != "xno" && \ | ||
5502 | test "x${withval}" != "xyes"; then | ||
5503 | CPPFLAGS="$CPPFLAGS $withval" | ||
5504 | fi | ||
5505 | |||
5506 | |||
5507 | fi | ||
5508 | |||
5509 | |||
5510 | # Check whether --with-ldflags was given. | ||
5511 | if test "${with_ldflags+set}" = set; then | ||
5512 | withval=$with_ldflags; | ||
5513 | if test -n "$withval" && test "x$withval" != "xno" && \ | ||
5514 | test "x${withval}" != "xyes"; then | ||
5515 | LDFLAGS="$LDFLAGS $withval" | ||
5516 | fi | ||
5517 | |||
5518 | |||
5519 | fi | ||
5520 | |||
5521 | |||
5522 | # Check whether --with-libs was given. | ||
5523 | if test "${with_libs+set}" = set; then | ||
5524 | withval=$with_libs; | ||
5525 | if test -n "$withval" && test "x$withval" != "xno" && \ | ||
5526 | test "x${withval}" != "xyes"; then | ||
5527 | LIBS="$LIBS $withval" | ||
5528 | fi | ||
5529 | |||
5530 | |||
5531 | fi | ||
5532 | |||
5533 | |||
5534 | # Check whether --with-Werror was given. | ||
5535 | if test "${with_Werror+set}" = set; then | ||
5536 | withval=$with_Werror; | ||
5537 | if test -n "$withval" && test "x$withval" != "xno"; then | ||
5538 | werror_flags="-Werror" | ||
5539 | if test "x${withval}" != "xyes"; then | ||
5540 | werror_flags="$withval" | ||
5541 | fi | ||
5542 | fi | ||
5543 | |||
5544 | |||
5545 | fi | ||
5546 | |||
5547 | |||
5548 | |||
5549 | |||
5550 | |||
5551 | |||
5552 | |||
5553 | |||
5554 | |||
5555 | |||
5556 | |||
5557 | |||
5558 | |||
5559 | |||
5560 | |||
5561 | |||
5562 | |||
5563 | |||
5564 | |||
5565 | |||
5566 | |||
5567 | |||
5568 | |||
5569 | |||
5570 | |||
5571 | |||
5572 | |||
5573 | |||
5574 | |||
5575 | |||
5576 | |||
5577 | |||
5578 | |||
5579 | |||
5580 | |||
5581 | |||
5582 | |||
5583 | |||
5584 | |||
5585 | |||
5586 | |||
5587 | |||
5588 | |||
5589 | |||
5590 | |||
5591 | |||
5592 | |||
5593 | |||
5594 | |||
5595 | |||
5596 | |||
5597 | |||
5598 | |||
5599 | |||
5600 | |||
5601 | |||
5602 | |||
5603 | |||
5604 | |||
5605 | |||
5606 | |||
5607 | for ac_header in \ | ||
5608 | bstring.h \ | ||
5609 | crypt.h \ | ||
5610 | crypto/sha2.h \ | ||
5611 | dirent.h \ | ||
5612 | endian.h \ | ||
5613 | features.h \ | ||
5614 | fcntl.h \ | ||
5615 | floatingpoint.h \ | ||
5616 | getopt.h \ | ||
5617 | glob.h \ | ||
5618 | ia.h \ | ||
5619 | iaf.h \ | ||
5620 | limits.h \ | ||
5621 | login.h \ | ||
5622 | maillock.h \ | ||
5623 | ndir.h \ | ||
5624 | net/if_tun.h \ | ||
5625 | netdb.h \ | ||
5626 | netgroup.h \ | ||
5627 | pam/pam_appl.h \ | ||
5628 | paths.h \ | ||
5629 | pty.h \ | ||
5630 | readpassphrase.h \ | ||
5631 | rpc/types.h \ | ||
5632 | security/pam_appl.h \ | ||
5633 | sha2.h \ | ||
5634 | shadow.h \ | ||
5635 | stddef.h \ | ||
5636 | stdint.h \ | ||
5637 | string.h \ | ||
5638 | strings.h \ | ||
5639 | sys/audit.h \ | ||
5640 | sys/bitypes.h \ | ||
5641 | sys/bsdtty.h \ | ||
5642 | sys/cdefs.h \ | ||
5643 | sys/dir.h \ | ||
5644 | sys/mman.h \ | ||
5645 | sys/ndir.h \ | ||
5646 | sys/prctl.h \ | ||
5647 | sys/pstat.h \ | ||
5648 | sys/select.h \ | ||
5649 | sys/stat.h \ | ||
5650 | sys/stream.h \ | ||
5651 | sys/stropts.h \ | ||
5652 | sys/strtio.h \ | ||
5653 | sys/sysmacros.h \ | ||
5654 | sys/time.h \ | ||
5655 | sys/timers.h \ | ||
5656 | sys/un.h \ | ||
5657 | time.h \ | ||
5658 | tmpdir.h \ | ||
5659 | ttyent.h \ | ||
5660 | unistd.h \ | ||
5661 | usersec.h \ | ||
5662 | util.h \ | ||
5663 | utime.h \ | ||
5664 | utmp.h \ | ||
5665 | utmpx.h \ | ||
5666 | vis.h \ | ||
5667 | |||
5668 | do | ||
5669 | as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` | ||
5670 | if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then | ||
5671 | { echo "$as_me:$LINENO: checking for $ac_header" >&5 | ||
5672 | echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } | ||
5673 | if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then | ||
5674 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
5675 | fi | ||
5676 | ac_res=`eval echo '${'$as_ac_Header'}'` | ||
5677 | { echo "$as_me:$LINENO: result: $ac_res" >&5 | ||
5678 | echo "${ECHO_T}$ac_res" >&6; } | ||
5679 | else | ||
5680 | # Is the header compilable? | ||
5681 | { echo "$as_me:$LINENO: checking $ac_header usability" >&5 | ||
5682 | echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } | ||
5683 | cat >conftest.$ac_ext <<_ACEOF | ||
5684 | /* confdefs.h. */ | ||
5685 | _ACEOF | ||
5686 | cat confdefs.h >>conftest.$ac_ext | ||
5687 | cat >>conftest.$ac_ext <<_ACEOF | ||
5688 | /* end confdefs.h. */ | ||
5689 | $ac_includes_default | ||
5690 | #include <$ac_header> | ||
5691 | _ACEOF | ||
5692 | rm -f conftest.$ac_objext | ||
5693 | if { (ac_try="$ac_compile" | ||
5694 | case "(($ac_try" in | ||
5695 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
5696 | *) ac_try_echo=$ac_try;; | ||
5697 | esac | ||
5698 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
5699 | (eval "$ac_compile") 2>conftest.er1 | ||
5700 | ac_status=$? | ||
5701 | grep -v '^ *+' conftest.er1 >conftest.err | ||
5702 | rm -f conftest.er1 | ||
5703 | cat conftest.err >&5 | ||
5704 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
5705 | (exit $ac_status); } && { | ||
5706 | test -z "$ac_c_werror_flag" || | ||
5707 | test ! -s conftest.err | ||
5708 | } && test -s conftest.$ac_objext; then | ||
5709 | ac_header_compiler=yes | ||
5710 | else | ||
5711 | echo "$as_me: failed program was:" >&5 | ||
5712 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
5713 | |||
5714 | ac_header_compiler=no | ||
5715 | fi | ||
5716 | |||
5717 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | ||
5718 | { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 | ||
5719 | echo "${ECHO_T}$ac_header_compiler" >&6; } | ||
5720 | |||
5721 | # Is the header present? | ||
5722 | { echo "$as_me:$LINENO: checking $ac_header presence" >&5 | ||
5723 | echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } | ||
5724 | cat >conftest.$ac_ext <<_ACEOF | ||
5725 | /* confdefs.h. */ | ||
5726 | _ACEOF | ||
5727 | cat confdefs.h >>conftest.$ac_ext | ||
5728 | cat >>conftest.$ac_ext <<_ACEOF | ||
5729 | /* end confdefs.h. */ | ||
5730 | #include <$ac_header> | ||
5731 | _ACEOF | ||
5732 | if { (ac_try="$ac_cpp conftest.$ac_ext" | ||
5733 | case "(($ac_try" in | ||
5734 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
5735 | *) ac_try_echo=$ac_try;; | ||
5736 | esac | ||
5737 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
5738 | (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 | ||
5739 | ac_status=$? | ||
5740 | grep -v '^ *+' conftest.er1 >conftest.err | ||
5741 | rm -f conftest.er1 | ||
5742 | cat conftest.err >&5 | ||
5743 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
5744 | (exit $ac_status); } >/dev/null && { | ||
5745 | test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || | ||
5746 | test ! -s conftest.err | ||
5747 | }; then | ||
5748 | ac_header_preproc=yes | ||
5749 | else | ||
5750 | echo "$as_me: failed program was:" >&5 | ||
5751 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
5752 | |||
5753 | ac_header_preproc=no | ||
5754 | fi | ||
5755 | |||
5756 | rm -f conftest.err conftest.$ac_ext | ||
5757 | { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 | ||
5758 | echo "${ECHO_T}$ac_header_preproc" >&6; } | ||
5759 | |||
5760 | # So? What about this header? | ||
5761 | case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in | ||
5762 | yes:no: ) | ||
5763 | { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 | ||
5764 | echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} | ||
5765 | { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 | ||
5766 | echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} | ||
5767 | ac_header_preproc=yes | ||
5768 | ;; | ||
5769 | no:yes:* ) | ||
5770 | { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 | ||
5771 | echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} | ||
5772 | { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 | ||
5773 | echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} | ||
5774 | { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 | ||
5775 | echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} | ||
5776 | { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 | ||
5777 | echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} | ||
5778 | { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 | ||
5779 | echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} | ||
5780 | { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 | ||
5781 | echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} | ||
5782 | ( cat <<\_ASBOX | ||
5783 | ## ------------------------------------------- ## | ||
5784 | ## Report this to openssh-unix-dev@mindrot.org ## | ||
5785 | ## ------------------------------------------- ## | ||
5786 | _ASBOX | ||
5787 | ) | sed "s/^/$as_me: WARNING: /" >&2 | ||
5788 | ;; | ||
5789 | esac | ||
5790 | { echo "$as_me:$LINENO: checking for $ac_header" >&5 | ||
5791 | echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } | ||
5792 | if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then | ||
5793 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
5794 | else | ||
5795 | eval "$as_ac_Header=\$ac_header_preproc" | ||
5796 | fi | ||
5797 | ac_res=`eval echo '${'$as_ac_Header'}'` | ||
5798 | { echo "$as_me:$LINENO: result: $ac_res" >&5 | ||
5799 | echo "${ECHO_T}$ac_res" >&6; } | ||
5800 | |||
5801 | fi | ||
5802 | if test `eval echo '${'$as_ac_Header'}'` = yes; then | ||
5803 | cat >>confdefs.h <<_ACEOF | ||
5804 | #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 | ||
5805 | _ACEOF | ||
5806 | |||
5807 | fi | ||
5808 | |||
5809 | done | ||
5810 | |||
5811 | |||
5812 | # lastlog.h requires sys/time.h to be included first on Solaris | ||
5813 | |||
5814 | for ac_header in lastlog.h | ||
5815 | do | ||
5816 | as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` | ||
5817 | { echo "$as_me:$LINENO: checking for $ac_header" >&5 | ||
5818 | echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } | ||
5819 | if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then | ||
5820 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
5821 | else | ||
5822 | cat >conftest.$ac_ext <<_ACEOF | ||
5823 | /* confdefs.h. */ | ||
5824 | _ACEOF | ||
5825 | cat confdefs.h >>conftest.$ac_ext | ||
5826 | cat >>conftest.$ac_ext <<_ACEOF | ||
5827 | /* end confdefs.h. */ | ||
5828 | |||
5829 | #ifdef HAVE_SYS_TIME_H | ||
5830 | # include <sys/time.h> | ||
5831 | #endif | ||
5832 | |||
5833 | |||
5834 | #include <$ac_header> | ||
5835 | _ACEOF | ||
5836 | rm -f conftest.$ac_objext | ||
5837 | if { (ac_try="$ac_compile" | ||
5838 | case "(($ac_try" in | ||
5839 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
5840 | *) ac_try_echo=$ac_try;; | ||
5841 | esac | ||
5842 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
5843 | (eval "$ac_compile") 2>conftest.er1 | ||
5844 | ac_status=$? | ||
5845 | grep -v '^ *+' conftest.er1 >conftest.err | ||
5846 | rm -f conftest.er1 | ||
5847 | cat conftest.err >&5 | ||
5848 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
5849 | (exit $ac_status); } && { | ||
5850 | test -z "$ac_c_werror_flag" || | ||
5851 | test ! -s conftest.err | ||
5852 | } && test -s conftest.$ac_objext; then | ||
5853 | eval "$as_ac_Header=yes" | ||
5854 | else | ||
5855 | echo "$as_me: failed program was:" >&5 | ||
5856 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
5857 | |||
5858 | eval "$as_ac_Header=no" | ||
5859 | fi | ||
5860 | |||
5861 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | ||
5862 | fi | ||
5863 | ac_res=`eval echo '${'$as_ac_Header'}'` | ||
5864 | { echo "$as_me:$LINENO: result: $ac_res" >&5 | ||
5865 | echo "${ECHO_T}$ac_res" >&6; } | ||
5866 | if test `eval echo '${'$as_ac_Header'}'` = yes; then | ||
5867 | cat >>confdefs.h <<_ACEOF | ||
5868 | #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 | ||
5869 | _ACEOF | ||
5870 | |||
5871 | fi | ||
5872 | |||
5873 | done | ||
5874 | |||
5875 | |||
5876 | # sys/ptms.h requires sys/stream.h to be included first on Solaris | ||
5877 | |||
5878 | for ac_header in sys/ptms.h | ||
5879 | do | ||
5880 | as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` | ||
5881 | { echo "$as_me:$LINENO: checking for $ac_header" >&5 | ||
5882 | echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } | ||
5883 | if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then | ||
5884 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
5885 | else | ||
5886 | cat >conftest.$ac_ext <<_ACEOF | ||
5887 | /* confdefs.h. */ | ||
5888 | _ACEOF | ||
5889 | cat confdefs.h >>conftest.$ac_ext | ||
5890 | cat >>conftest.$ac_ext <<_ACEOF | ||
5891 | /* end confdefs.h. */ | ||
5892 | |||
5893 | #ifdef HAVE_SYS_STREAM_H | ||
5894 | # include <sys/stream.h> | ||
5895 | #endif | ||
5896 | |||
5897 | |||
5898 | #include <$ac_header> | ||
5899 | _ACEOF | ||
5900 | rm -f conftest.$ac_objext | ||
5901 | if { (ac_try="$ac_compile" | ||
5902 | case "(($ac_try" in | ||
5903 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
5904 | *) ac_try_echo=$ac_try;; | ||
5905 | esac | ||
5906 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
5907 | (eval "$ac_compile") 2>conftest.er1 | ||
5908 | ac_status=$? | ||
5909 | grep -v '^ *+' conftest.er1 >conftest.err | ||
5910 | rm -f conftest.er1 | ||
5911 | cat conftest.err >&5 | ||
5912 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
5913 | (exit $ac_status); } && { | ||
5914 | test -z "$ac_c_werror_flag" || | ||
5915 | test ! -s conftest.err | ||
5916 | } && test -s conftest.$ac_objext; then | ||
5917 | eval "$as_ac_Header=yes" | ||
5918 | else | ||
5919 | echo "$as_me: failed program was:" >&5 | ||
5920 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
5921 | |||
5922 | eval "$as_ac_Header=no" | ||
5923 | fi | ||
5924 | |||
5925 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | ||
5926 | fi | ||
5927 | ac_res=`eval echo '${'$as_ac_Header'}'` | ||
5928 | { echo "$as_me:$LINENO: result: $ac_res" >&5 | ||
5929 | echo "${ECHO_T}$ac_res" >&6; } | ||
5930 | if test `eval echo '${'$as_ac_Header'}'` = yes; then | ||
5931 | cat >>confdefs.h <<_ACEOF | ||
5932 | #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 | ||
5933 | _ACEOF | ||
5934 | |||
5935 | fi | ||
5936 | |||
5937 | done | ||
5938 | |||
5939 | |||
5940 | # login_cap.h requires sys/types.h on NetBSD | ||
5941 | |||
5942 | for ac_header in login_cap.h | ||
5943 | do | ||
5944 | as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` | ||
5945 | { echo "$as_me:$LINENO: checking for $ac_header" >&5 | ||
5946 | echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } | ||
5947 | if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then | ||
5948 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
5949 | else | ||
5950 | cat >conftest.$ac_ext <<_ACEOF | ||
5951 | /* confdefs.h. */ | ||
5952 | _ACEOF | ||
5953 | cat confdefs.h >>conftest.$ac_ext | ||
5954 | cat >>conftest.$ac_ext <<_ACEOF | ||
5955 | /* end confdefs.h. */ | ||
5956 | |||
5957 | #include <sys/types.h> | ||
5958 | |||
5959 | |||
5960 | #include <$ac_header> | ||
5961 | _ACEOF | ||
5962 | rm -f conftest.$ac_objext | ||
5963 | if { (ac_try="$ac_compile" | ||
5964 | case "(($ac_try" in | ||
5965 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
5966 | *) ac_try_echo=$ac_try;; | ||
5967 | esac | ||
5968 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
5969 | (eval "$ac_compile") 2>conftest.er1 | ||
5970 | ac_status=$? | ||
5971 | grep -v '^ *+' conftest.er1 >conftest.err | ||
5972 | rm -f conftest.er1 | ||
5973 | cat conftest.err >&5 | ||
5974 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
5975 | (exit $ac_status); } && { | ||
5976 | test -z "$ac_c_werror_flag" || | ||
5977 | test ! -s conftest.err | ||
5978 | } && test -s conftest.$ac_objext; then | ||
5979 | eval "$as_ac_Header=yes" | ||
5980 | else | ||
5981 | echo "$as_me: failed program was:" >&5 | ||
5982 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
5983 | |||
5984 | eval "$as_ac_Header=no" | ||
5985 | fi | ||
5986 | |||
5987 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | ||
5988 | fi | ||
5989 | ac_res=`eval echo '${'$as_ac_Header'}'` | ||
5990 | { echo "$as_me:$LINENO: result: $ac_res" >&5 | ||
5991 | echo "${ECHO_T}$ac_res" >&6; } | ||
5992 | if test `eval echo '${'$as_ac_Header'}'` = yes; then | ||
5993 | cat >>confdefs.h <<_ACEOF | ||
5994 | #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 | ||
5995 | _ACEOF | ||
5996 | |||
5997 | fi | ||
5998 | |||
5999 | done | ||
6000 | |||
6001 | |||
6002 | # Messages for features tested for in target-specific section | ||
6003 | SIA_MSG="no" | ||
6004 | SPC_MSG="no" | ||
6005 | |||
5480 | # Check for some target-specific stuff | 6006 | # Check for some target-specific stuff |
5481 | case "$host" in | 6007 | case "$host" in |
5482 | *-*-aix*) | 6008 | *-*-aix*) |
6009 | # Some versions of VAC won't allow macro redefinitions at | ||
6010 | # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that | ||
6011 | # particularly with older versions of vac or xlc. | ||
6012 | # It also throws errors about null macro argments, but these are | ||
6013 | # not fatal. | ||
6014 | { echo "$as_me:$LINENO: checking if compiler allows macro redefinitions" >&5 | ||
6015 | echo $ECHO_N "checking if compiler allows macro redefinitions... $ECHO_C" >&6; } | ||
6016 | cat >conftest.$ac_ext <<_ACEOF | ||
6017 | /* confdefs.h. */ | ||
6018 | _ACEOF | ||
6019 | cat confdefs.h >>conftest.$ac_ext | ||
6020 | cat >>conftest.$ac_ext <<_ACEOF | ||
6021 | /* end confdefs.h. */ | ||
6022 | |||
6023 | #define testmacro foo | ||
6024 | #define testmacro bar | ||
6025 | int main(void) { exit(0); } | ||
6026 | |||
6027 | _ACEOF | ||
6028 | rm -f conftest.$ac_objext | ||
6029 | if { (ac_try="$ac_compile" | ||
6030 | case "(($ac_try" in | ||
6031 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
6032 | *) ac_try_echo=$ac_try;; | ||
6033 | esac | ||
6034 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
6035 | (eval "$ac_compile") 2>conftest.er1 | ||
6036 | ac_status=$? | ||
6037 | grep -v '^ *+' conftest.er1 >conftest.err | ||
6038 | rm -f conftest.er1 | ||
6039 | cat conftest.err >&5 | ||
6040 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
6041 | (exit $ac_status); } && { | ||
6042 | test -z "$ac_c_werror_flag" || | ||
6043 | test ! -s conftest.err | ||
6044 | } && test -s conftest.$ac_objext; then | ||
6045 | { echo "$as_me:$LINENO: result: yes" >&5 | ||
6046 | echo "${ECHO_T}yes" >&6; } | ||
6047 | else | ||
6048 | echo "$as_me: failed program was:" >&5 | ||
6049 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
6050 | |||
6051 | { echo "$as_me:$LINENO: result: no" >&5 | ||
6052 | echo "${ECHO_T}no" >&6; } | ||
6053 | CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`" | ||
6054 | LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`" | ||
6055 | CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`" | ||
6056 | CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`" | ||
6057 | |||
6058 | |||
6059 | fi | ||
6060 | |||
6061 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | ||
6062 | |||
5483 | { echo "$as_me:$LINENO: checking how to specify blibpath for linker ($LD)" >&5 | 6063 | { echo "$as_me:$LINENO: checking how to specify blibpath for linker ($LD)" >&5 |
5484 | echo $ECHO_N "checking how to specify blibpath for linker ($LD)... $ECHO_C" >&6; } | 6064 | echo $ECHO_N "checking how to specify blibpath for linker ($LD)... $ECHO_C" >&6; } |
5485 | if (test -z "$blibpath"); then | 6065 | if (test -z "$blibpath"); then |
5486 | blibpath="/usr/lib:/lib" | 6066 | blibpath="/usr/lib:/lib" |
5487 | fi | 6067 | fi |
5488 | saved_LDFLAGS="$LDFLAGS" | 6068 | saved_LDFLAGS="$LDFLAGS" |
5489 | for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do | 6069 | if test "$GCC" = "yes"; then |
6070 | flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:" | ||
6071 | else | ||
6072 | flags="-blibpath: -Wl,-blibpath: -Wl,-rpath," | ||
6073 | fi | ||
6074 | for tryflags in $flags ;do | ||
5490 | if (test -z "$blibflags"); then | 6075 | if (test -z "$blibflags"); then |
5491 | LDFLAGS="$saved_LDFLAGS $tryflags$blibpath" | 6076 | LDFLAGS="$saved_LDFLAGS $tryflags$blibpath" |
5492 | cat >conftest.$ac_ext <<_ACEOF | 6077 | cat >conftest.$ac_ext <<_ACEOF |
@@ -6257,6 +6842,69 @@ _ACEOF | |||
6257 | fi | 6842 | fi |
6258 | done | 6843 | done |
6259 | 6844 | ||
6845 | { echo "$as_me:$LINENO: checking whether F_CLOSEM is declared" >&5 | ||
6846 | echo $ECHO_N "checking whether F_CLOSEM is declared... $ECHO_C" >&6; } | ||
6847 | if test "${ac_cv_have_decl_F_CLOSEM+set}" = set; then | ||
6848 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
6849 | else | ||
6850 | cat >conftest.$ac_ext <<_ACEOF | ||
6851 | /* confdefs.h. */ | ||
6852 | _ACEOF | ||
6853 | cat confdefs.h >>conftest.$ac_ext | ||
6854 | cat >>conftest.$ac_ext <<_ACEOF | ||
6855 | /* end confdefs.h. */ | ||
6856 | #include <limits.h> | ||
6857 | #include <fcntl.h> | ||
6858 | |||
6859 | |||
6860 | int | ||
6861 | main () | ||
6862 | { | ||
6863 | #ifndef F_CLOSEM | ||
6864 | (void) F_CLOSEM; | ||
6865 | #endif | ||
6866 | |||
6867 | ; | ||
6868 | return 0; | ||
6869 | } | ||
6870 | _ACEOF | ||
6871 | rm -f conftest.$ac_objext | ||
6872 | if { (ac_try="$ac_compile" | ||
6873 | case "(($ac_try" in | ||
6874 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
6875 | *) ac_try_echo=$ac_try;; | ||
6876 | esac | ||
6877 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
6878 | (eval "$ac_compile") 2>conftest.er1 | ||
6879 | ac_status=$? | ||
6880 | grep -v '^ *+' conftest.er1 >conftest.err | ||
6881 | rm -f conftest.er1 | ||
6882 | cat conftest.err >&5 | ||
6883 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
6884 | (exit $ac_status); } && { | ||
6885 | test -z "$ac_c_werror_flag" || | ||
6886 | test ! -s conftest.err | ||
6887 | } && test -s conftest.$ac_objext; then | ||
6888 | ac_cv_have_decl_F_CLOSEM=yes | ||
6889 | else | ||
6890 | echo "$as_me: failed program was:" >&5 | ||
6891 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
6892 | |||
6893 | ac_cv_have_decl_F_CLOSEM=no | ||
6894 | fi | ||
6895 | |||
6896 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | ||
6897 | fi | ||
6898 | { echo "$as_me:$LINENO: result: $ac_cv_have_decl_F_CLOSEM" >&5 | ||
6899 | echo "${ECHO_T}$ac_cv_have_decl_F_CLOSEM" >&6; } | ||
6900 | if test $ac_cv_have_decl_F_CLOSEM = yes; then | ||
6901 | |||
6902 | cat >>confdefs.h <<\_ACEOF | ||
6903 | #define HAVE_FCNTL_CLOSEM 1 | ||
6904 | _ACEOF | ||
6905 | |||
6906 | fi | ||
6907 | |||
6260 | check_for_aix_broken_getaddrinfo=1 | 6908 | check_for_aix_broken_getaddrinfo=1 |
6261 | 6909 | ||
6262 | cat >>confdefs.h <<\_ACEOF | 6910 | cat >>confdefs.h <<\_ACEOF |
@@ -6298,10 +6946,15 @@ cat >>confdefs.h <<\_ACEOF | |||
6298 | #define SSHPAM_CHAUTHTOK_NEEDS_RUID 1 | 6946 | #define SSHPAM_CHAUTHTOK_NEEDS_RUID 1 |
6299 | _ACEOF | 6947 | _ACEOF |
6300 | 6948 | ||
6949 | |||
6950 | cat >>confdefs.h <<\_ACEOF | ||
6951 | #define PTY_ZEROREAD 1 | ||
6952 | _ACEOF | ||
6953 | |||
6301 | ;; | 6954 | ;; |
6302 | *-*-cygwin*) | 6955 | *-*-cygwin*) |
6303 | check_for_libcrypt_later=1 | 6956 | check_for_libcrypt_later=1 |
6304 | LIBS="$LIBS /usr/lib/textmode.o" | 6957 | LIBS="$LIBS /usr/lib/textreadmode.o" |
6305 | 6958 | ||
6306 | cat >>confdefs.h <<\_ACEOF | 6959 | cat >>confdefs.h <<\_ACEOF |
6307 | #define HAVE_CYGWIN 1 | 6960 | #define HAVE_CYGWIN 1 |
@@ -6433,9 +7086,24 @@ cat >>confdefs.h <<_ACEOF | |||
6433 | #define BIND_8_COMPAT 1 | 7086 | #define BIND_8_COMPAT 1 |
6434 | _ACEOF | 7087 | _ACEOF |
6435 | 7088 | ||
6436 | { echo "$as_me:$LINENO: checking if we have the Security Authorization Session API" >&5 | 7089 | |
7090 | cat >>confdefs.h <<\_ACEOF | ||
7091 | #define SSH_TUN_FREEBSD 1 | ||
7092 | _ACEOF | ||
7093 | |||
7094 | |||
7095 | cat >>confdefs.h <<\_ACEOF | ||
7096 | #define SSH_TUN_COMPAT_AF 1 | ||
7097 | _ACEOF | ||
7098 | |||
7099 | |||
7100 | cat >>confdefs.h <<\_ACEOF | ||
7101 | #define SSH_TUN_PREPEND_AF 1 | ||
7102 | _ACEOF | ||
7103 | |||
7104 | { echo "$as_me:$LINENO: checking if we have the Security Authorization Session API" >&5 | ||
6437 | echo $ECHO_N "checking if we have the Security Authorization Session API... $ECHO_C" >&6; } | 7105 | echo $ECHO_N "checking if we have the Security Authorization Session API... $ECHO_C" >&6; } |
6438 | cat >conftest.$ac_ext <<_ACEOF | 7106 | cat >conftest.$ac_ext <<_ACEOF |
6439 | /* confdefs.h. */ | 7107 | /* confdefs.h. */ |
6440 | _ACEOF | 7108 | _ACEOF |
6441 | cat confdefs.h >>conftest.$ac_ext | 7109 | cat confdefs.h >>conftest.$ac_ext |
@@ -6473,22 +7141,22 @@ cat >>confdefs.h <<\_ACEOF | |||
6473 | #define USE_SECURITY_SESSION_API 1 | 7141 | #define USE_SECURITY_SESSION_API 1 |
6474 | _ACEOF | 7142 | _ACEOF |
6475 | 7143 | ||
6476 | LIBS="$LIBS -framework Security" | 7144 | LIBS="$LIBS -framework Security" |
6477 | { echo "$as_me:$LINENO: result: yes" >&5 | 7145 | { echo "$as_me:$LINENO: result: yes" >&5 |
6478 | echo "${ECHO_T}yes" >&6; } | 7146 | echo "${ECHO_T}yes" >&6; } |
6479 | else | 7147 | else |
6480 | echo "$as_me: failed program was:" >&5 | 7148 | echo "$as_me: failed program was:" >&5 |
6481 | sed 's/^/| /' conftest.$ac_ext >&5 | 7149 | sed 's/^/| /' conftest.$ac_ext >&5 |
6482 | 7150 | ||
6483 | ac_cv_use_security_session_api="no" | 7151 | ac_cv_use_security_session_api="no" |
6484 | { echo "$as_me:$LINENO: result: no" >&5 | 7152 | { echo "$as_me:$LINENO: result: no" >&5 |
6485 | echo "${ECHO_T}no" >&6; } | 7153 | echo "${ECHO_T}no" >&6; } |
6486 | fi | 7154 | fi |
6487 | 7155 | ||
6488 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | 7156 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext |
6489 | { echo "$as_me:$LINENO: checking if we have an in-memory credentials cache" >&5 | 7157 | { echo "$as_me:$LINENO: checking if we have an in-memory credentials cache" >&5 |
6490 | echo $ECHO_N "checking if we have an in-memory credentials cache... $ECHO_C" >&6; } | 7158 | echo $ECHO_N "checking if we have an in-memory credentials cache... $ECHO_C" >&6; } |
6491 | cat >conftest.$ac_ext <<_ACEOF | 7159 | cat >conftest.$ac_ext <<_ACEOF |
6492 | /* confdefs.h. */ | 7160 | /* confdefs.h. */ |
6493 | _ACEOF | 7161 | _ACEOF |
6494 | cat confdefs.h >>conftest.$ac_ext | 7162 | cat confdefs.h >>conftest.$ac_ext |
@@ -6499,7 +7167,7 @@ int | |||
6499 | main () | 7167 | main () |
6500 | { | 7168 | { |
6501 | cc_context_t c; | 7169 | cc_context_t c; |
6502 | (void) cc_initialize (&c, 0, NULL, NULL); | 7170 | (void) cc_initialize (&c, 0, NULL, NULL); |
6503 | ; | 7171 | ; |
6504 | return 0; | 7172 | return 0; |
6505 | } | 7173 | } |
@@ -6526,14 +7194,14 @@ cat >>confdefs.h <<\_ACEOF | |||
6526 | #define USE_CCAPI 1 | 7194 | #define USE_CCAPI 1 |
6527 | _ACEOF | 7195 | _ACEOF |
6528 | 7196 | ||
6529 | LIBS="$LIBS -framework Security" | 7197 | LIBS="$LIBS -framework Security" |
6530 | { echo "$as_me:$LINENO: result: yes" >&5 | 7198 | { echo "$as_me:$LINENO: result: yes" >&5 |
6531 | echo "${ECHO_T}yes" >&6; } | 7199 | echo "${ECHO_T}yes" >&6; } |
6532 | if test "x$ac_cv_use_security_session_api" = "xno"; then | 7200 | if test "x$ac_cv_use_security_session_api" = "xno"; then |
6533 | { { echo "$as_me:$LINENO: error: *** Need a security framework to use the credentials cache API ***" >&5 | 7201 | { { echo "$as_me:$LINENO: error: *** Need a security framework to use the credentials cache API ***" >&5 |
6534 | echo "$as_me: error: *** Need a security framework to use the credentials cache API ***" >&2;} | 7202 | echo "$as_me: error: *** Need a security framework to use the credentials cache API ***" >&2;} |
6535 | { (exit 1); exit 1; }; } | 7203 | { (exit 1); exit 1; }; } |
6536 | fi | 7204 | fi |
6537 | else | 7205 | else |
6538 | echo "$as_me: failed program was:" >&5 | 7206 | echo "$as_me: failed program was:" >&5 |
6539 | sed 's/^/| /' conftest.$ac_ext >&5 | 7207 | sed 's/^/| /' conftest.$ac_ext >&5 |
@@ -6544,6 +7212,9 @@ echo "${ECHO_T}no" >&6; } | |||
6544 | fi | 7212 | fi |
6545 | 7213 | ||
6546 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | 7214 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext |
7215 | ;; | ||
7216 | *-*-dragonfly*) | ||
7217 | SSHDLIBS="$SSHDLIBS -lcrypt" | ||
6547 | ;; | 7218 | ;; |
6548 | *-*-hpux*) | 7219 | *-*-hpux*) |
6549 | # first we define all of the options common to all HP-UX releases | 7220 | # first we define all of the options common to all HP-UX releases |
@@ -7464,6 +8135,11 @@ cat >>confdefs.h <<\_ACEOF | |||
7464 | #define SSH_TUN_OPENBSD 1 | 8135 | #define SSH_TUN_OPENBSD 1 |
7465 | _ACEOF | 8136 | _ACEOF |
7466 | 8137 | ||
8138 | |||
8139 | cat >>confdefs.h <<\_ACEOF | ||
8140 | #define SYSLOG_R_SAFE_IN_SIGHAND 1 | ||
8141 | _ACEOF | ||
8142 | |||
7467 | ;; | 8143 | ;; |
7468 | *-*-solaris*) | 8144 | *-*-solaris*) |
7469 | if test "x$withval" != "xno" ; then | 8145 | if test "x$withval" != "xno" ; then |
@@ -7501,6 +8177,11 @@ cat >>confdefs.h <<\_ACEOF | |||
7501 | #define SSHD_ACQUIRES_CTTY 1 | 8177 | #define SSHD_ACQUIRES_CTTY 1 |
7502 | _ACEOF | 8178 | _ACEOF |
7503 | 8179 | ||
8180 | |||
8181 | cat >>confdefs.h <<\_ACEOF | ||
8182 | #define PASSWD_NEEDS_USERNAME 1 | ||
8183 | _ACEOF | ||
8184 | |||
7504 | external_path_file=/etc/default/login | 8185 | external_path_file=/etc/default/login |
7505 | # hardwire lastlog location (can't detect it on some versions) | 8186 | # hardwire lastlog location (can't detect it on some versions) |
7506 | conf_lastlog_location="/var/adm/lastlog" | 8187 | conf_lastlog_location="/var/adm/lastlog" |
@@ -7523,6 +8204,85 @@ _ACEOF | |||
7523 | { echo "$as_me:$LINENO: result: no" >&5 | 8204 | { echo "$as_me:$LINENO: result: no" >&5 |
7524 | echo "${ECHO_T}no" >&6; } | 8205 | echo "${ECHO_T}no" >&6; } |
7525 | fi | 8206 | fi |
8207 | |||
8208 | # Check whether --with-solaris-contracts was given. | ||
8209 | if test "${with_solaris_contracts+set}" = set; then | ||
8210 | withval=$with_solaris_contracts; | ||
8211 | { echo "$as_me:$LINENO: checking for ct_tmpl_activate in -lcontract" >&5 | ||
8212 | echo $ECHO_N "checking for ct_tmpl_activate in -lcontract... $ECHO_C" >&6; } | ||
8213 | if test "${ac_cv_lib_contract_ct_tmpl_activate+set}" = set; then | ||
8214 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
8215 | else | ||
8216 | ac_check_lib_save_LIBS=$LIBS | ||
8217 | LIBS="-lcontract $LIBS" | ||
8218 | cat >conftest.$ac_ext <<_ACEOF | ||
8219 | /* confdefs.h. */ | ||
8220 | _ACEOF | ||
8221 | cat confdefs.h >>conftest.$ac_ext | ||
8222 | cat >>conftest.$ac_ext <<_ACEOF | ||
8223 | /* end confdefs.h. */ | ||
8224 | |||
8225 | /* Override any GCC internal prototype to avoid an error. | ||
8226 | Use char because int might match the return type of a GCC | ||
8227 | builtin and then its argument prototype would still apply. */ | ||
8228 | #ifdef __cplusplus | ||
8229 | extern "C" | ||
8230 | #endif | ||
8231 | char ct_tmpl_activate (); | ||
8232 | int | ||
8233 | main () | ||
8234 | { | ||
8235 | return ct_tmpl_activate (); | ||
8236 | ; | ||
8237 | return 0; | ||
8238 | } | ||
8239 | _ACEOF | ||
8240 | rm -f conftest.$ac_objext conftest$ac_exeext | ||
8241 | if { (ac_try="$ac_link" | ||
8242 | case "(($ac_try" in | ||
8243 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
8244 | *) ac_try_echo=$ac_try;; | ||
8245 | esac | ||
8246 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
8247 | (eval "$ac_link") 2>conftest.er1 | ||
8248 | ac_status=$? | ||
8249 | grep -v '^ *+' conftest.er1 >conftest.err | ||
8250 | rm -f conftest.er1 | ||
8251 | cat conftest.err >&5 | ||
8252 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
8253 | (exit $ac_status); } && { | ||
8254 | test -z "$ac_c_werror_flag" || | ||
8255 | test ! -s conftest.err | ||
8256 | } && test -s conftest$ac_exeext && | ||
8257 | $as_test_x conftest$ac_exeext; then | ||
8258 | ac_cv_lib_contract_ct_tmpl_activate=yes | ||
8259 | else | ||
8260 | echo "$as_me: failed program was:" >&5 | ||
8261 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
8262 | |||
8263 | ac_cv_lib_contract_ct_tmpl_activate=no | ||
8264 | fi | ||
8265 | |||
8266 | rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ | ||
8267 | conftest$ac_exeext conftest.$ac_ext | ||
8268 | LIBS=$ac_check_lib_save_LIBS | ||
8269 | fi | ||
8270 | { echo "$as_me:$LINENO: result: $ac_cv_lib_contract_ct_tmpl_activate" >&5 | ||
8271 | echo "${ECHO_T}$ac_cv_lib_contract_ct_tmpl_activate" >&6; } | ||
8272 | if test $ac_cv_lib_contract_ct_tmpl_activate = yes; then | ||
8273 | |||
8274 | cat >>confdefs.h <<\_ACEOF | ||
8275 | #define USE_SOLARIS_PROCESS_CONTRACTS 1 | ||
8276 | _ACEOF | ||
8277 | |||
8278 | SSHDLIBS="$SSHDLIBS -lcontract" | ||
8279 | |||
8280 | SPC_MSG="yes" | ||
8281 | fi | ||
8282 | |||
8283 | |||
8284 | fi | ||
8285 | |||
7526 | ;; | 8286 | ;; |
7527 | *-*-sunos4*) | 8287 | *-*-sunos4*) |
7528 | CPPFLAGS="$CPPFLAGS -DSUNOS4" | 8288 | CPPFLAGS="$CPPFLAGS -DSUNOS4" |
@@ -7826,7 +8586,6 @@ _ACEOF | |||
7826 | ;; | 8586 | ;; |
7827 | # UnixWare 1.x, UnixWare 2.x, and others based on code from Univel. | 8587 | # UnixWare 1.x, UnixWare 2.x, and others based on code from Univel. |
7828 | *-*-sysv4.2*) | 8588 | *-*-sysv4.2*) |
7829 | CFLAGS="$CFLAGS -Dva_list=_VA_LIST" | ||
7830 | cat >>confdefs.h <<\_ACEOF | 8589 | cat >>confdefs.h <<\_ACEOF |
7831 | #define USE_PIPES 1 | 8590 | #define USE_PIPES 1 |
7832 | _ACEOF | 8591 | _ACEOF |
@@ -7889,6 +8648,10 @@ cat >>confdefs.h <<\_ACEOF | |||
7889 | #define BROKEN_LIBIAF 1 | 8648 | #define BROKEN_LIBIAF 1 |
7890 | _ACEOF | 8649 | _ACEOF |
7891 | 8650 | ||
8651 | cat >>confdefs.h <<\_ACEOF | ||
8652 | #define BROKEN_UPDWTMPX 1 | ||
8653 | _ACEOF | ||
8654 | |||
7892 | ;; | 8655 | ;; |
7893 | *) cat >>confdefs.h <<\_ACEOF | 8656 | *) cat >>confdefs.h <<\_ACEOF |
7894 | #define LOCKED_PASSWD_STRING "*LK*" | 8657 | #define LOCKED_PASSWD_STRING "*LK*" |
@@ -8173,6 +8936,7 @@ _ACEOF | |||
8173 | _ACEOF | 8936 | _ACEOF |
8174 | 8937 | ||
8175 | LIBS="$LIBS -lsecurity -ldb -lm -laud" | 8938 | LIBS="$LIBS -lsecurity -ldb -lm -laud" |
8939 | SIA_MSG="yes" | ||
8176 | else | 8940 | else |
8177 | { echo "$as_me:$LINENO: result: no" >&5 | 8941 | { echo "$as_me:$LINENO: result: no" >&5 |
8178 | echo "${ECHO_T}no" >&6; } | 8942 | echo "${ECHO_T}no" >&6; } |
@@ -8229,6 +8993,11 @@ _ACEOF | |||
8229 | #define DISABLE_LASTLOG 1 | 8993 | #define DISABLE_LASTLOG 1 |
8230 | _ACEOF | 8994 | _ACEOF |
8231 | 8995 | ||
8996 | cat >>confdefs.h <<\_ACEOF | ||
8997 | #define SSHD_ACQUIRES_CTTY 1 | ||
8998 | _ACEOF | ||
8999 | |||
9000 | enable_etc_default_login=no # has incompatible /etc/default/login | ||
8232 | ;; | 9001 | ;; |
8233 | 9002 | ||
8234 | *-*-ultrix*) | 9003 | *-*-ultrix*) |
@@ -8267,70 +9036,6 @@ _ACEOF | |||
8267 | ;; | 9036 | ;; |
8268 | esac | 9037 | esac |
8269 | 9038 | ||
8270 | # Allow user to specify flags | ||
8271 | |||
8272 | # Check whether --with-cflags was given. | ||
8273 | if test "${with_cflags+set}" = set; then | ||
8274 | withval=$with_cflags; | ||
8275 | if test -n "$withval" && test "x$withval" != "xno" && \ | ||
8276 | test "x${withval}" != "xyes"; then | ||
8277 | CFLAGS="$CFLAGS $withval" | ||
8278 | fi | ||
8279 | |||
8280 | |||
8281 | fi | ||
8282 | |||
8283 | |||
8284 | # Check whether --with-cppflags was given. | ||
8285 | if test "${with_cppflags+set}" = set; then | ||
8286 | withval=$with_cppflags; | ||
8287 | if test -n "$withval" && test "x$withval" != "xno" && \ | ||
8288 | test "x${withval}" != "xyes"; then | ||
8289 | CPPFLAGS="$CPPFLAGS $withval" | ||
8290 | fi | ||
8291 | |||
8292 | |||
8293 | fi | ||
8294 | |||
8295 | |||
8296 | # Check whether --with-ldflags was given. | ||
8297 | if test "${with_ldflags+set}" = set; then | ||
8298 | withval=$with_ldflags; | ||
8299 | if test -n "$withval" && test "x$withval" != "xno" && \ | ||
8300 | test "x${withval}" != "xyes"; then | ||
8301 | LDFLAGS="$LDFLAGS $withval" | ||
8302 | fi | ||
8303 | |||
8304 | |||
8305 | fi | ||
8306 | |||
8307 | |||
8308 | # Check whether --with-libs was given. | ||
8309 | if test "${with_libs+set}" = set; then | ||
8310 | withval=$with_libs; | ||
8311 | if test -n "$withval" && test "x$withval" != "xno" && \ | ||
8312 | test "x${withval}" != "xyes"; then | ||
8313 | LIBS="$LIBS $withval" | ||
8314 | fi | ||
8315 | |||
8316 | |||
8317 | fi | ||
8318 | |||
8319 | |||
8320 | # Check whether --with-Werror was given. | ||
8321 | if test "${with_Werror+set}" = set; then | ||
8322 | withval=$with_Werror; | ||
8323 | if test -n "$withval" && test "x$withval" != "xno"; then | ||
8324 | werror_flags="-Werror" | ||
8325 | if test "x${withval}" != "xyes"; then | ||
8326 | werror_flags="$withval" | ||
8327 | fi | ||
8328 | fi | ||
8329 | |||
8330 | |||
8331 | fi | ||
8332 | |||
8333 | |||
8334 | { echo "$as_me:$LINENO: checking compiler and flags for sanity" >&5 | 9039 | { echo "$as_me:$LINENO: checking compiler and flags for sanity" >&5 |
8335 | echo $ECHO_N "checking compiler and flags for sanity... $ECHO_C" >&6; } | 9040 | echo $ECHO_N "checking compiler and flags for sanity... $ECHO_C" >&6; } |
8336 | if test "$cross_compiling" = yes; then | 9041 | if test "$cross_compiling" = yes; then |
@@ -8390,392 +9095,6 @@ fi | |||
8390 | 9095 | ||
8391 | 9096 | ||
8392 | 9097 | ||
8393 | |||
8394 | |||
8395 | |||
8396 | |||
8397 | |||
8398 | |||
8399 | |||
8400 | |||
8401 | |||
8402 | |||
8403 | |||
8404 | |||
8405 | |||
8406 | |||
8407 | |||
8408 | |||
8409 | |||
8410 | |||
8411 | |||
8412 | |||
8413 | |||
8414 | |||
8415 | |||
8416 | |||
8417 | |||
8418 | |||
8419 | |||
8420 | |||
8421 | |||
8422 | |||
8423 | |||
8424 | |||
8425 | |||
8426 | |||
8427 | |||
8428 | |||
8429 | |||
8430 | |||
8431 | |||
8432 | |||
8433 | |||
8434 | |||
8435 | |||
8436 | |||
8437 | |||
8438 | |||
8439 | |||
8440 | |||
8441 | |||
8442 | |||
8443 | |||
8444 | |||
8445 | |||
8446 | |||
8447 | |||
8448 | |||
8449 | for ac_header in \ | ||
8450 | bstring.h \ | ||
8451 | crypt.h \ | ||
8452 | dirent.h \ | ||
8453 | endian.h \ | ||
8454 | features.h \ | ||
8455 | floatingpoint.h \ | ||
8456 | getopt.h \ | ||
8457 | glob.h \ | ||
8458 | ia.h \ | ||
8459 | iaf.h \ | ||
8460 | limits.h \ | ||
8461 | login.h \ | ||
8462 | login_cap.h \ | ||
8463 | maillock.h \ | ||
8464 | ndir.h \ | ||
8465 | netdb.h \ | ||
8466 | netgroup.h \ | ||
8467 | pam/pam_appl.h \ | ||
8468 | paths.h \ | ||
8469 | pty.h \ | ||
8470 | readpassphrase.h \ | ||
8471 | rpc/types.h \ | ||
8472 | security/pam_appl.h \ | ||
8473 | shadow.h \ | ||
8474 | stddef.h \ | ||
8475 | stdint.h \ | ||
8476 | string.h \ | ||
8477 | strings.h \ | ||
8478 | sys/audit.h \ | ||
8479 | sys/bitypes.h \ | ||
8480 | sys/bsdtty.h \ | ||
8481 | sys/cdefs.h \ | ||
8482 | sys/dir.h \ | ||
8483 | sys/mman.h \ | ||
8484 | sys/ndir.h \ | ||
8485 | sys/prctl.h \ | ||
8486 | sys/pstat.h \ | ||
8487 | sys/select.h \ | ||
8488 | sys/stat.h \ | ||
8489 | sys/stream.h \ | ||
8490 | sys/stropts.h \ | ||
8491 | sys/strtio.h \ | ||
8492 | sys/sysmacros.h \ | ||
8493 | sys/time.h \ | ||
8494 | sys/timers.h \ | ||
8495 | sys/un.h \ | ||
8496 | time.h \ | ||
8497 | tmpdir.h \ | ||
8498 | ttyent.h \ | ||
8499 | unistd.h \ | ||
8500 | usersec.h \ | ||
8501 | util.h \ | ||
8502 | utime.h \ | ||
8503 | utmp.h \ | ||
8504 | utmpx.h \ | ||
8505 | vis.h \ | ||
8506 | |||
8507 | do | ||
8508 | as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` | ||
8509 | if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then | ||
8510 | { echo "$as_me:$LINENO: checking for $ac_header" >&5 | ||
8511 | echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } | ||
8512 | if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then | ||
8513 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
8514 | fi | ||
8515 | ac_res=`eval echo '${'$as_ac_Header'}'` | ||
8516 | { echo "$as_me:$LINENO: result: $ac_res" >&5 | ||
8517 | echo "${ECHO_T}$ac_res" >&6; } | ||
8518 | else | ||
8519 | # Is the header compilable? | ||
8520 | { echo "$as_me:$LINENO: checking $ac_header usability" >&5 | ||
8521 | echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } | ||
8522 | cat >conftest.$ac_ext <<_ACEOF | ||
8523 | /* confdefs.h. */ | ||
8524 | _ACEOF | ||
8525 | cat confdefs.h >>conftest.$ac_ext | ||
8526 | cat >>conftest.$ac_ext <<_ACEOF | ||
8527 | /* end confdefs.h. */ | ||
8528 | $ac_includes_default | ||
8529 | #include <$ac_header> | ||
8530 | _ACEOF | ||
8531 | rm -f conftest.$ac_objext | ||
8532 | if { (ac_try="$ac_compile" | ||
8533 | case "(($ac_try" in | ||
8534 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
8535 | *) ac_try_echo=$ac_try;; | ||
8536 | esac | ||
8537 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
8538 | (eval "$ac_compile") 2>conftest.er1 | ||
8539 | ac_status=$? | ||
8540 | grep -v '^ *+' conftest.er1 >conftest.err | ||
8541 | rm -f conftest.er1 | ||
8542 | cat conftest.err >&5 | ||
8543 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
8544 | (exit $ac_status); } && { | ||
8545 | test -z "$ac_c_werror_flag" || | ||
8546 | test ! -s conftest.err | ||
8547 | } && test -s conftest.$ac_objext; then | ||
8548 | ac_header_compiler=yes | ||
8549 | else | ||
8550 | echo "$as_me: failed program was:" >&5 | ||
8551 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
8552 | |||
8553 | ac_header_compiler=no | ||
8554 | fi | ||
8555 | |||
8556 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | ||
8557 | { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 | ||
8558 | echo "${ECHO_T}$ac_header_compiler" >&6; } | ||
8559 | |||
8560 | # Is the header present? | ||
8561 | { echo "$as_me:$LINENO: checking $ac_header presence" >&5 | ||
8562 | echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } | ||
8563 | cat >conftest.$ac_ext <<_ACEOF | ||
8564 | /* confdefs.h. */ | ||
8565 | _ACEOF | ||
8566 | cat confdefs.h >>conftest.$ac_ext | ||
8567 | cat >>conftest.$ac_ext <<_ACEOF | ||
8568 | /* end confdefs.h. */ | ||
8569 | #include <$ac_header> | ||
8570 | _ACEOF | ||
8571 | if { (ac_try="$ac_cpp conftest.$ac_ext" | ||
8572 | case "(($ac_try" in | ||
8573 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
8574 | *) ac_try_echo=$ac_try;; | ||
8575 | esac | ||
8576 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
8577 | (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 | ||
8578 | ac_status=$? | ||
8579 | grep -v '^ *+' conftest.er1 >conftest.err | ||
8580 | rm -f conftest.er1 | ||
8581 | cat conftest.err >&5 | ||
8582 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
8583 | (exit $ac_status); } >/dev/null && { | ||
8584 | test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || | ||
8585 | test ! -s conftest.err | ||
8586 | }; then | ||
8587 | ac_header_preproc=yes | ||
8588 | else | ||
8589 | echo "$as_me: failed program was:" >&5 | ||
8590 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
8591 | |||
8592 | ac_header_preproc=no | ||
8593 | fi | ||
8594 | |||
8595 | rm -f conftest.err conftest.$ac_ext | ||
8596 | { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 | ||
8597 | echo "${ECHO_T}$ac_header_preproc" >&6; } | ||
8598 | |||
8599 | # So? What about this header? | ||
8600 | case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in | ||
8601 | yes:no: ) | ||
8602 | { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 | ||
8603 | echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} | ||
8604 | { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 | ||
8605 | echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} | ||
8606 | ac_header_preproc=yes | ||
8607 | ;; | ||
8608 | no:yes:* ) | ||
8609 | { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 | ||
8610 | echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} | ||
8611 | { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 | ||
8612 | echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} | ||
8613 | { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 | ||
8614 | echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} | ||
8615 | { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 | ||
8616 | echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} | ||
8617 | { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 | ||
8618 | echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} | ||
8619 | { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 | ||
8620 | echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} | ||
8621 | ( cat <<\_ASBOX | ||
8622 | ## ------------------------------------------- ## | ||
8623 | ## Report this to openssh-unix-dev@mindrot.org ## | ||
8624 | ## ------------------------------------------- ## | ||
8625 | _ASBOX | ||
8626 | ) | sed "s/^/$as_me: WARNING: /" >&2 | ||
8627 | ;; | ||
8628 | esac | ||
8629 | { echo "$as_me:$LINENO: checking for $ac_header" >&5 | ||
8630 | echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } | ||
8631 | if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then | ||
8632 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
8633 | else | ||
8634 | eval "$as_ac_Header=\$ac_header_preproc" | ||
8635 | fi | ||
8636 | ac_res=`eval echo '${'$as_ac_Header'}'` | ||
8637 | { echo "$as_me:$LINENO: result: $ac_res" >&5 | ||
8638 | echo "${ECHO_T}$ac_res" >&6; } | ||
8639 | |||
8640 | fi | ||
8641 | if test `eval echo '${'$as_ac_Header'}'` = yes; then | ||
8642 | cat >>confdefs.h <<_ACEOF | ||
8643 | #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 | ||
8644 | _ACEOF | ||
8645 | |||
8646 | fi | ||
8647 | |||
8648 | done | ||
8649 | |||
8650 | |||
8651 | # lastlog.h requires sys/time.h to be included first on Solaris | ||
8652 | |||
8653 | for ac_header in lastlog.h | ||
8654 | do | ||
8655 | as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` | ||
8656 | { echo "$as_me:$LINENO: checking for $ac_header" >&5 | ||
8657 | echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } | ||
8658 | if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then | ||
8659 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
8660 | else | ||
8661 | cat >conftest.$ac_ext <<_ACEOF | ||
8662 | /* confdefs.h. */ | ||
8663 | _ACEOF | ||
8664 | cat confdefs.h >>conftest.$ac_ext | ||
8665 | cat >>conftest.$ac_ext <<_ACEOF | ||
8666 | /* end confdefs.h. */ | ||
8667 | |||
8668 | #ifdef HAVE_SYS_TIME_H | ||
8669 | # include <sys/time.h> | ||
8670 | #endif | ||
8671 | |||
8672 | |||
8673 | #include <$ac_header> | ||
8674 | _ACEOF | ||
8675 | rm -f conftest.$ac_objext | ||
8676 | if { (ac_try="$ac_compile" | ||
8677 | case "(($ac_try" in | ||
8678 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
8679 | *) ac_try_echo=$ac_try;; | ||
8680 | esac | ||
8681 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
8682 | (eval "$ac_compile") 2>conftest.er1 | ||
8683 | ac_status=$? | ||
8684 | grep -v '^ *+' conftest.er1 >conftest.err | ||
8685 | rm -f conftest.er1 | ||
8686 | cat conftest.err >&5 | ||
8687 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
8688 | (exit $ac_status); } && { | ||
8689 | test -z "$ac_c_werror_flag" || | ||
8690 | test ! -s conftest.err | ||
8691 | } && test -s conftest.$ac_objext; then | ||
8692 | eval "$as_ac_Header=yes" | ||
8693 | else | ||
8694 | echo "$as_me: failed program was:" >&5 | ||
8695 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
8696 | |||
8697 | eval "$as_ac_Header=no" | ||
8698 | fi | ||
8699 | |||
8700 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | ||
8701 | fi | ||
8702 | ac_res=`eval echo '${'$as_ac_Header'}'` | ||
8703 | { echo "$as_me:$LINENO: result: $ac_res" >&5 | ||
8704 | echo "${ECHO_T}$ac_res" >&6; } | ||
8705 | if test `eval echo '${'$as_ac_Header'}'` = yes; then | ||
8706 | cat >>confdefs.h <<_ACEOF | ||
8707 | #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 | ||
8708 | _ACEOF | ||
8709 | |||
8710 | fi | ||
8711 | |||
8712 | done | ||
8713 | |||
8714 | |||
8715 | # sys/ptms.h requires sys/stream.h to be included first on Solaris | ||
8716 | |||
8717 | for ac_header in sys/ptms.h | ||
8718 | do | ||
8719 | as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` | ||
8720 | { echo "$as_me:$LINENO: checking for $ac_header" >&5 | ||
8721 | echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } | ||
8722 | if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then | ||
8723 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
8724 | else | ||
8725 | cat >conftest.$ac_ext <<_ACEOF | ||
8726 | /* confdefs.h. */ | ||
8727 | _ACEOF | ||
8728 | cat confdefs.h >>conftest.$ac_ext | ||
8729 | cat >>conftest.$ac_ext <<_ACEOF | ||
8730 | /* end confdefs.h. */ | ||
8731 | |||
8732 | #ifdef HAVE_SYS_STREAM_H | ||
8733 | # include <sys/stream.h> | ||
8734 | #endif | ||
8735 | |||
8736 | |||
8737 | #include <$ac_header> | ||
8738 | _ACEOF | ||
8739 | rm -f conftest.$ac_objext | ||
8740 | if { (ac_try="$ac_compile" | ||
8741 | case "(($ac_try" in | ||
8742 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
8743 | *) ac_try_echo=$ac_try;; | ||
8744 | esac | ||
8745 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
8746 | (eval "$ac_compile") 2>conftest.er1 | ||
8747 | ac_status=$? | ||
8748 | grep -v '^ *+' conftest.er1 >conftest.err | ||
8749 | rm -f conftest.er1 | ||
8750 | cat conftest.err >&5 | ||
8751 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
8752 | (exit $ac_status); } && { | ||
8753 | test -z "$ac_c_werror_flag" || | ||
8754 | test ! -s conftest.err | ||
8755 | } && test -s conftest.$ac_objext; then | ||
8756 | eval "$as_ac_Header=yes" | ||
8757 | else | ||
8758 | echo "$as_me: failed program was:" >&5 | ||
8759 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
8760 | |||
8761 | eval "$as_ac_Header=no" | ||
8762 | fi | ||
8763 | |||
8764 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | ||
8765 | fi | ||
8766 | ac_res=`eval echo '${'$as_ac_Header'}'` | ||
8767 | { echo "$as_me:$LINENO: result: $ac_res" >&5 | ||
8768 | echo "${ECHO_T}$ac_res" >&6; } | ||
8769 | if test `eval echo '${'$as_ac_Header'}'` = yes; then | ||
8770 | cat >>confdefs.h <<_ACEOF | ||
8771 | #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 | ||
8772 | _ACEOF | ||
8773 | |||
8774 | fi | ||
8775 | |||
8776 | done | ||
8777 | |||
8778 | |||
8779 | # Checks for libraries. | 9098 | # Checks for libraries. |
8780 | { echo "$as_me:$LINENO: checking for yp_match" >&5 | 9099 | { echo "$as_me:$LINENO: checking for yp_match" >&5 |
8781 | echo $ECHO_N "checking for yp_match... $ECHO_C" >&6; } | 9100 | echo $ECHO_N "checking for yp_match... $ECHO_C" >&6; } |
@@ -11141,13 +11460,32 @@ _ACEOF | |||
11141 | cat confdefs.h >>conftest.$ac_ext | 11460 | cat confdefs.h >>conftest.$ac_ext |
11142 | cat >>conftest.$ac_ext <<_ACEOF | 11461 | cat >>conftest.$ac_ext <<_ACEOF |
11143 | /* end confdefs.h. */ | 11462 | /* end confdefs.h. */ |
11144 | 11463 | #include <glob.h> | |
11145 | #include <glob.h> | 11464 | int |
11146 | int main(void){glob_t g; g.gl_matchc = 1;} | 11465 | main () |
11147 | 11466 | { | |
11467 | glob_t g; g.gl_matchc = 1; | ||
11468 | ; | ||
11469 | return 0; | ||
11470 | } | ||
11148 | _ACEOF | 11471 | _ACEOF |
11149 | if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | | 11472 | rm -f conftest.$ac_objext |
11150 | $EGREP "FOUNDIT" >/dev/null 2>&1; then | 11473 | if { (ac_try="$ac_compile" |
11474 | case "(($ac_try" in | ||
11475 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
11476 | *) ac_try_echo=$ac_try;; | ||
11477 | esac | ||
11478 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
11479 | (eval "$ac_compile") 2>conftest.er1 | ||
11480 | ac_status=$? | ||
11481 | grep -v '^ *+' conftest.er1 >conftest.err | ||
11482 | rm -f conftest.er1 | ||
11483 | cat conftest.err >&5 | ||
11484 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
11485 | (exit $ac_status); } && { | ||
11486 | test -z "$ac_c_werror_flag" || | ||
11487 | test ! -s conftest.err | ||
11488 | } && test -s conftest.$ac_objext; then | ||
11151 | 11489 | ||
11152 | 11490 | ||
11153 | cat >>confdefs.h <<\_ACEOF | 11491 | cat >>confdefs.h <<\_ACEOF |
@@ -11158,13 +11496,86 @@ _ACEOF | |||
11158 | echo "${ECHO_T}yes" >&6; } | 11496 | echo "${ECHO_T}yes" >&6; } |
11159 | 11497 | ||
11160 | else | 11498 | else |
11499 | echo "$as_me: failed program was:" >&5 | ||
11500 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
11501 | |||
11161 | 11502 | ||
11162 | { echo "$as_me:$LINENO: result: no" >&5 | 11503 | { echo "$as_me:$LINENO: result: no" >&5 |
11163 | echo "${ECHO_T}no" >&6; } | 11504 | echo "${ECHO_T}no" >&6; } |
11164 | 11505 | ||
11165 | 11506 | ||
11166 | fi | 11507 | fi |
11167 | rm -f conftest* | 11508 | |
11509 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | ||
11510 | |||
11511 | { echo "$as_me:$LINENO: checking whether GLOB_NOMATCH is declared" >&5 | ||
11512 | echo $ECHO_N "checking whether GLOB_NOMATCH is declared... $ECHO_C" >&6; } | ||
11513 | if test "${ac_cv_have_decl_GLOB_NOMATCH+set}" = set; then | ||
11514 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
11515 | else | ||
11516 | cat >conftest.$ac_ext <<_ACEOF | ||
11517 | /* confdefs.h. */ | ||
11518 | _ACEOF | ||
11519 | cat confdefs.h >>conftest.$ac_ext | ||
11520 | cat >>conftest.$ac_ext <<_ACEOF | ||
11521 | /* end confdefs.h. */ | ||
11522 | #include <glob.h> | ||
11523 | |||
11524 | int | ||
11525 | main () | ||
11526 | { | ||
11527 | #ifndef GLOB_NOMATCH | ||
11528 | (void) GLOB_NOMATCH; | ||
11529 | #endif | ||
11530 | |||
11531 | ; | ||
11532 | return 0; | ||
11533 | } | ||
11534 | _ACEOF | ||
11535 | rm -f conftest.$ac_objext | ||
11536 | if { (ac_try="$ac_compile" | ||
11537 | case "(($ac_try" in | ||
11538 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
11539 | *) ac_try_echo=$ac_try;; | ||
11540 | esac | ||
11541 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
11542 | (eval "$ac_compile") 2>conftest.er1 | ||
11543 | ac_status=$? | ||
11544 | grep -v '^ *+' conftest.er1 >conftest.err | ||
11545 | rm -f conftest.er1 | ||
11546 | cat conftest.err >&5 | ||
11547 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
11548 | (exit $ac_status); } && { | ||
11549 | test -z "$ac_c_werror_flag" || | ||
11550 | test ! -s conftest.err | ||
11551 | } && test -s conftest.$ac_objext; then | ||
11552 | ac_cv_have_decl_GLOB_NOMATCH=yes | ||
11553 | else | ||
11554 | echo "$as_me: failed program was:" >&5 | ||
11555 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
11556 | |||
11557 | ac_cv_have_decl_GLOB_NOMATCH=no | ||
11558 | fi | ||
11559 | |||
11560 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | ||
11561 | fi | ||
11562 | { echo "$as_me:$LINENO: result: $ac_cv_have_decl_GLOB_NOMATCH" >&5 | ||
11563 | echo "${ECHO_T}$ac_cv_have_decl_GLOB_NOMATCH" >&6; } | ||
11564 | if test $ac_cv_have_decl_GLOB_NOMATCH = yes; then | ||
11565 | |||
11566 | cat >>confdefs.h <<_ACEOF | ||
11567 | #define HAVE_DECL_GLOB_NOMATCH 1 | ||
11568 | _ACEOF | ||
11569 | |||
11570 | |||
11571 | else | ||
11572 | cat >>confdefs.h <<_ACEOF | ||
11573 | #define HAVE_DECL_GLOB_NOMATCH 0 | ||
11574 | _ACEOF | ||
11575 | |||
11576 | |||
11577 | fi | ||
11578 | |||
11168 | 11579 | ||
11169 | 11580 | ||
11170 | { echo "$as_me:$LINENO: checking whether struct dirent allocates space for d_name" >&5 | 11581 | { echo "$as_me:$LINENO: checking whether struct dirent allocates space for d_name" >&5 |
@@ -11647,26 +12058,24 @@ echo "${ECHO_T}bsm" >&6; } | |||
11647 | for ac_header in bsm/audit.h | 12058 | for ac_header in bsm/audit.h |
11648 | do | 12059 | do |
11649 | as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` | 12060 | as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` |
11650 | if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then | 12061 | { echo "$as_me:$LINENO: checking for $ac_header" >&5 |
11651 | { echo "$as_me:$LINENO: checking for $ac_header" >&5 | ||
11652 | echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } | 12062 | echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } |
11653 | if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then | 12063 | if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then |
11654 | echo $ECHO_N "(cached) $ECHO_C" >&6 | 12064 | echo $ECHO_N "(cached) $ECHO_C" >&6 |
11655 | fi | ||
11656 | ac_res=`eval echo '${'$as_ac_Header'}'` | ||
11657 | { echo "$as_me:$LINENO: result: $ac_res" >&5 | ||
11658 | echo "${ECHO_T}$ac_res" >&6; } | ||
11659 | else | 12065 | else |
11660 | # Is the header compilable? | 12066 | cat >conftest.$ac_ext <<_ACEOF |
11661 | { echo "$as_me:$LINENO: checking $ac_header usability" >&5 | ||
11662 | echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } | ||
11663 | cat >conftest.$ac_ext <<_ACEOF | ||
11664 | /* confdefs.h. */ | 12067 | /* confdefs.h. */ |
11665 | _ACEOF | 12068 | _ACEOF |
11666 | cat confdefs.h >>conftest.$ac_ext | 12069 | cat confdefs.h >>conftest.$ac_ext |
11667 | cat >>conftest.$ac_ext <<_ACEOF | 12070 | cat >>conftest.$ac_ext <<_ACEOF |
11668 | /* end confdefs.h. */ | 12071 | /* end confdefs.h. */ |
11669 | $ac_includes_default | 12072 | |
12073 | #ifdef HAVE_TIME_H | ||
12074 | # include <time.h> | ||
12075 | #endif | ||
12076 | |||
12077 | |||
12078 | |||
11670 | #include <$ac_header> | 12079 | #include <$ac_header> |
11671 | _ACEOF | 12080 | _ACEOF |
11672 | rm -f conftest.$ac_objext | 12081 | rm -f conftest.$ac_objext |
@@ -11686,99 +12095,19 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | |||
11686 | test -z "$ac_c_werror_flag" || | 12095 | test -z "$ac_c_werror_flag" || |
11687 | test ! -s conftest.err | 12096 | test ! -s conftest.err |
11688 | } && test -s conftest.$ac_objext; then | 12097 | } && test -s conftest.$ac_objext; then |
11689 | ac_header_compiler=yes | 12098 | eval "$as_ac_Header=yes" |
11690 | else | 12099 | else |
11691 | echo "$as_me: failed program was:" >&5 | 12100 | echo "$as_me: failed program was:" >&5 |
11692 | sed 's/^/| /' conftest.$ac_ext >&5 | 12101 | sed 's/^/| /' conftest.$ac_ext >&5 |
11693 | 12102 | ||
11694 | ac_header_compiler=no | 12103 | eval "$as_ac_Header=no" |
11695 | fi | 12104 | fi |
11696 | 12105 | ||
11697 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | 12106 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext |
11698 | { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 | ||
11699 | echo "${ECHO_T}$ac_header_compiler" >&6; } | ||
11700 | |||
11701 | # Is the header present? | ||
11702 | { echo "$as_me:$LINENO: checking $ac_header presence" >&5 | ||
11703 | echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } | ||
11704 | cat >conftest.$ac_ext <<_ACEOF | ||
11705 | /* confdefs.h. */ | ||
11706 | _ACEOF | ||
11707 | cat confdefs.h >>conftest.$ac_ext | ||
11708 | cat >>conftest.$ac_ext <<_ACEOF | ||
11709 | /* end confdefs.h. */ | ||
11710 | #include <$ac_header> | ||
11711 | _ACEOF | ||
11712 | if { (ac_try="$ac_cpp conftest.$ac_ext" | ||
11713 | case "(($ac_try" in | ||
11714 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
11715 | *) ac_try_echo=$ac_try;; | ||
11716 | esac | ||
11717 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
11718 | (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 | ||
11719 | ac_status=$? | ||
11720 | grep -v '^ *+' conftest.er1 >conftest.err | ||
11721 | rm -f conftest.er1 | ||
11722 | cat conftest.err >&5 | ||
11723 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
11724 | (exit $ac_status); } >/dev/null && { | ||
11725 | test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || | ||
11726 | test ! -s conftest.err | ||
11727 | }; then | ||
11728 | ac_header_preproc=yes | ||
11729 | else | ||
11730 | echo "$as_me: failed program was:" >&5 | ||
11731 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
11732 | |||
11733 | ac_header_preproc=no | ||
11734 | fi | ||
11735 | |||
11736 | rm -f conftest.err conftest.$ac_ext | ||
11737 | { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 | ||
11738 | echo "${ECHO_T}$ac_header_preproc" >&6; } | ||
11739 | |||
11740 | # So? What about this header? | ||
11741 | case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in | ||
11742 | yes:no: ) | ||
11743 | { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 | ||
11744 | echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} | ||
11745 | { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 | ||
11746 | echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} | ||
11747 | ac_header_preproc=yes | ||
11748 | ;; | ||
11749 | no:yes:* ) | ||
11750 | { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 | ||
11751 | echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} | ||
11752 | { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 | ||
11753 | echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} | ||
11754 | { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 | ||
11755 | echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} | ||
11756 | { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 | ||
11757 | echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} | ||
11758 | { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 | ||
11759 | echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} | ||
11760 | { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 | ||
11761 | echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} | ||
11762 | ( cat <<\_ASBOX | ||
11763 | ## ------------------------------------------- ## | ||
11764 | ## Report this to openssh-unix-dev@mindrot.org ## | ||
11765 | ## ------------------------------------------- ## | ||
11766 | _ASBOX | ||
11767 | ) | sed "s/^/$as_me: WARNING: /" >&2 | ||
11768 | ;; | ||
11769 | esac | ||
11770 | { echo "$as_me:$LINENO: checking for $ac_header" >&5 | ||
11771 | echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } | ||
11772 | if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then | ||
11773 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
11774 | else | ||
11775 | eval "$as_ac_Header=\$ac_header_preproc" | ||
11776 | fi | 12107 | fi |
11777 | ac_res=`eval echo '${'$as_ac_Header'}'` | 12108 | ac_res=`eval echo '${'$as_ac_Header'}'` |
11778 | { echo "$as_me:$LINENO: result: $ac_res" >&5 | 12109 | { echo "$as_me:$LINENO: result: $ac_res" >&5 |
11779 | echo "${ECHO_T}$ac_res" >&6; } | 12110 | echo "${ECHO_T}$ac_res" >&6; } |
11780 | |||
11781 | fi | ||
11782 | if test `eval echo '${'$as_ac_Header'}'` = yes; then | 12111 | if test `eval echo '${'$as_ac_Header'}'` = yes; then |
11783 | cat >>confdefs.h <<_ACEOF | 12112 | cat >>confdefs.h <<_ACEOF |
11784 | #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 | 12113 | #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 |
@@ -13120,6 +13449,231 @@ fi | |||
13120 | 13449 | ||
13121 | 13450 | ||
13122 | 13451 | ||
13452 | { echo "$as_me:$LINENO: checking whether SHUT_RD is declared" >&5 | ||
13453 | echo $ECHO_N "checking whether SHUT_RD is declared... $ECHO_C" >&6; } | ||
13454 | if test "${ac_cv_have_decl_SHUT_RD+set}" = set; then | ||
13455 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
13456 | else | ||
13457 | cat >conftest.$ac_ext <<_ACEOF | ||
13458 | /* confdefs.h. */ | ||
13459 | _ACEOF | ||
13460 | cat confdefs.h >>conftest.$ac_ext | ||
13461 | cat >>conftest.$ac_ext <<_ACEOF | ||
13462 | /* end confdefs.h. */ | ||
13463 | |||
13464 | #include <sys/types.h> | ||
13465 | #include <sys/socket.h> | ||
13466 | |||
13467 | |||
13468 | int | ||
13469 | main () | ||
13470 | { | ||
13471 | #ifndef SHUT_RD | ||
13472 | (void) SHUT_RD; | ||
13473 | #endif | ||
13474 | |||
13475 | ; | ||
13476 | return 0; | ||
13477 | } | ||
13478 | _ACEOF | ||
13479 | rm -f conftest.$ac_objext | ||
13480 | if { (ac_try="$ac_compile" | ||
13481 | case "(($ac_try" in | ||
13482 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
13483 | *) ac_try_echo=$ac_try;; | ||
13484 | esac | ||
13485 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
13486 | (eval "$ac_compile") 2>conftest.er1 | ||
13487 | ac_status=$? | ||
13488 | grep -v '^ *+' conftest.er1 >conftest.err | ||
13489 | rm -f conftest.er1 | ||
13490 | cat conftest.err >&5 | ||
13491 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
13492 | (exit $ac_status); } && { | ||
13493 | test -z "$ac_c_werror_flag" || | ||
13494 | test ! -s conftest.err | ||
13495 | } && test -s conftest.$ac_objext; then | ||
13496 | ac_cv_have_decl_SHUT_RD=yes | ||
13497 | else | ||
13498 | echo "$as_me: failed program was:" >&5 | ||
13499 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
13500 | |||
13501 | ac_cv_have_decl_SHUT_RD=no | ||
13502 | fi | ||
13503 | |||
13504 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | ||
13505 | fi | ||
13506 | { echo "$as_me:$LINENO: result: $ac_cv_have_decl_SHUT_RD" >&5 | ||
13507 | echo "${ECHO_T}$ac_cv_have_decl_SHUT_RD" >&6; } | ||
13508 | if test $ac_cv_have_decl_SHUT_RD = yes; then | ||
13509 | |||
13510 | cat >>confdefs.h <<_ACEOF | ||
13511 | #define HAVE_DECL_SHUT_RD 1 | ||
13512 | _ACEOF | ||
13513 | |||
13514 | |||
13515 | else | ||
13516 | cat >>confdefs.h <<_ACEOF | ||
13517 | #define HAVE_DECL_SHUT_RD 0 | ||
13518 | _ACEOF | ||
13519 | |||
13520 | |||
13521 | fi | ||
13522 | |||
13523 | |||
13524 | |||
13525 | { echo "$as_me:$LINENO: checking whether O_NONBLOCK is declared" >&5 | ||
13526 | echo $ECHO_N "checking whether O_NONBLOCK is declared... $ECHO_C" >&6; } | ||
13527 | if test "${ac_cv_have_decl_O_NONBLOCK+set}" = set; then | ||
13528 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
13529 | else | ||
13530 | cat >conftest.$ac_ext <<_ACEOF | ||
13531 | /* confdefs.h. */ | ||
13532 | _ACEOF | ||
13533 | cat confdefs.h >>conftest.$ac_ext | ||
13534 | cat >>conftest.$ac_ext <<_ACEOF | ||
13535 | /* end confdefs.h. */ | ||
13536 | |||
13537 | #include <sys/types.h> | ||
13538 | #ifdef HAVE_SYS_STAT_H | ||
13539 | # include <sys/stat.h> | ||
13540 | #endif | ||
13541 | #ifdef HAVE_FCNTL_H | ||
13542 | # include <fcntl.h> | ||
13543 | #endif | ||
13544 | |||
13545 | |||
13546 | int | ||
13547 | main () | ||
13548 | { | ||
13549 | #ifndef O_NONBLOCK | ||
13550 | (void) O_NONBLOCK; | ||
13551 | #endif | ||
13552 | |||
13553 | ; | ||
13554 | return 0; | ||
13555 | } | ||
13556 | _ACEOF | ||
13557 | rm -f conftest.$ac_objext | ||
13558 | if { (ac_try="$ac_compile" | ||
13559 | case "(($ac_try" in | ||
13560 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
13561 | *) ac_try_echo=$ac_try;; | ||
13562 | esac | ||
13563 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
13564 | (eval "$ac_compile") 2>conftest.er1 | ||
13565 | ac_status=$? | ||
13566 | grep -v '^ *+' conftest.er1 >conftest.err | ||
13567 | rm -f conftest.er1 | ||
13568 | cat conftest.err >&5 | ||
13569 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
13570 | (exit $ac_status); } && { | ||
13571 | test -z "$ac_c_werror_flag" || | ||
13572 | test ! -s conftest.err | ||
13573 | } && test -s conftest.$ac_objext; then | ||
13574 | ac_cv_have_decl_O_NONBLOCK=yes | ||
13575 | else | ||
13576 | echo "$as_me: failed program was:" >&5 | ||
13577 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
13578 | |||
13579 | ac_cv_have_decl_O_NONBLOCK=no | ||
13580 | fi | ||
13581 | |||
13582 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | ||
13583 | fi | ||
13584 | { echo "$as_me:$LINENO: result: $ac_cv_have_decl_O_NONBLOCK" >&5 | ||
13585 | echo "${ECHO_T}$ac_cv_have_decl_O_NONBLOCK" >&6; } | ||
13586 | if test $ac_cv_have_decl_O_NONBLOCK = yes; then | ||
13587 | |||
13588 | cat >>confdefs.h <<_ACEOF | ||
13589 | #define HAVE_DECL_O_NONBLOCK 1 | ||
13590 | _ACEOF | ||
13591 | |||
13592 | |||
13593 | else | ||
13594 | cat >>confdefs.h <<_ACEOF | ||
13595 | #define HAVE_DECL_O_NONBLOCK 0 | ||
13596 | _ACEOF | ||
13597 | |||
13598 | |||
13599 | fi | ||
13600 | |||
13601 | |||
13602 | |||
13603 | { echo "$as_me:$LINENO: checking whether writev is declared" >&5 | ||
13604 | echo $ECHO_N "checking whether writev is declared... $ECHO_C" >&6; } | ||
13605 | if test "${ac_cv_have_decl_writev+set}" = set; then | ||
13606 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
13607 | else | ||
13608 | cat >conftest.$ac_ext <<_ACEOF | ||
13609 | /* confdefs.h. */ | ||
13610 | _ACEOF | ||
13611 | cat confdefs.h >>conftest.$ac_ext | ||
13612 | cat >>conftest.$ac_ext <<_ACEOF | ||
13613 | /* end confdefs.h. */ | ||
13614 | |||
13615 | #include <sys/types.h> | ||
13616 | #include <sys/uio.h> | ||
13617 | #include <unistd.h> | ||
13618 | |||
13619 | |||
13620 | int | ||
13621 | main () | ||
13622 | { | ||
13623 | #ifndef writev | ||
13624 | (void) writev; | ||
13625 | #endif | ||
13626 | |||
13627 | ; | ||
13628 | return 0; | ||
13629 | } | ||
13630 | _ACEOF | ||
13631 | rm -f conftest.$ac_objext | ||
13632 | if { (ac_try="$ac_compile" | ||
13633 | case "(($ac_try" in | ||
13634 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
13635 | *) ac_try_echo=$ac_try;; | ||
13636 | esac | ||
13637 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
13638 | (eval "$ac_compile") 2>conftest.er1 | ||
13639 | ac_status=$? | ||
13640 | grep -v '^ *+' conftest.er1 >conftest.err | ||
13641 | rm -f conftest.er1 | ||
13642 | cat conftest.err >&5 | ||
13643 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
13644 | (exit $ac_status); } && { | ||
13645 | test -z "$ac_c_werror_flag" || | ||
13646 | test ! -s conftest.err | ||
13647 | } && test -s conftest.$ac_objext; then | ||
13648 | ac_cv_have_decl_writev=yes | ||
13649 | else | ||
13650 | echo "$as_me: failed program was:" >&5 | ||
13651 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
13652 | |||
13653 | ac_cv_have_decl_writev=no | ||
13654 | fi | ||
13655 | |||
13656 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | ||
13657 | fi | ||
13658 | { echo "$as_me:$LINENO: result: $ac_cv_have_decl_writev" >&5 | ||
13659 | echo "${ECHO_T}$ac_cv_have_decl_writev" >&6; } | ||
13660 | if test $ac_cv_have_decl_writev = yes; then | ||
13661 | |||
13662 | cat >>confdefs.h <<_ACEOF | ||
13663 | #define HAVE_DECL_WRITEV 1 | ||
13664 | _ACEOF | ||
13665 | |||
13666 | |||
13667 | else | ||
13668 | cat >>confdefs.h <<_ACEOF | ||
13669 | #define HAVE_DECL_WRITEV 0 | ||
13670 | _ACEOF | ||
13671 | |||
13672 | |||
13673 | fi | ||
13674 | |||
13675 | |||
13676 | |||
13123 | 13677 | ||
13124 | for ac_func in setresuid | 13678 | for ac_func in setresuid |
13125 | do | 13679 | do |
@@ -15000,440 +15554,6 @@ _ACEOF | |||
15000 | fi | 15554 | fi |
15001 | 15555 | ||
15002 | 15556 | ||
15003 | # Check for PAM libs | ||
15004 | PAM_MSG="no" | ||
15005 | |||
15006 | # Check whether --with-pam was given. | ||
15007 | if test "${with_pam+set}" = set; then | ||
15008 | withval=$with_pam; | ||
15009 | if test "x$withval" != "xno" ; then | ||
15010 | if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \ | ||
15011 | test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then | ||
15012 | { { echo "$as_me:$LINENO: error: PAM headers not found" >&5 | ||
15013 | echo "$as_me: error: PAM headers not found" >&2;} | ||
15014 | { (exit 1); exit 1; }; } | ||
15015 | fi | ||
15016 | |||
15017 | |||
15018 | { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 | ||
15019 | echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; } | ||
15020 | if test "${ac_cv_lib_dl_dlopen+set}" = set; then | ||
15021 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
15022 | else | ||
15023 | ac_check_lib_save_LIBS=$LIBS | ||
15024 | LIBS="-ldl $LIBS" | ||
15025 | cat >conftest.$ac_ext <<_ACEOF | ||
15026 | /* confdefs.h. */ | ||
15027 | _ACEOF | ||
15028 | cat confdefs.h >>conftest.$ac_ext | ||
15029 | cat >>conftest.$ac_ext <<_ACEOF | ||
15030 | /* end confdefs.h. */ | ||
15031 | |||
15032 | /* Override any GCC internal prototype to avoid an error. | ||
15033 | Use char because int might match the return type of a GCC | ||
15034 | builtin and then its argument prototype would still apply. */ | ||
15035 | #ifdef __cplusplus | ||
15036 | extern "C" | ||
15037 | #endif | ||
15038 | char dlopen (); | ||
15039 | int | ||
15040 | main () | ||
15041 | { | ||
15042 | return dlopen (); | ||
15043 | ; | ||
15044 | return 0; | ||
15045 | } | ||
15046 | _ACEOF | ||
15047 | rm -f conftest.$ac_objext conftest$ac_exeext | ||
15048 | if { (ac_try="$ac_link" | ||
15049 | case "(($ac_try" in | ||
15050 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
15051 | *) ac_try_echo=$ac_try;; | ||
15052 | esac | ||
15053 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
15054 | (eval "$ac_link") 2>conftest.er1 | ||
15055 | ac_status=$? | ||
15056 | grep -v '^ *+' conftest.er1 >conftest.err | ||
15057 | rm -f conftest.er1 | ||
15058 | cat conftest.err >&5 | ||
15059 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
15060 | (exit $ac_status); } && { | ||
15061 | test -z "$ac_c_werror_flag" || | ||
15062 | test ! -s conftest.err | ||
15063 | } && test -s conftest$ac_exeext && | ||
15064 | $as_test_x conftest$ac_exeext; then | ||
15065 | ac_cv_lib_dl_dlopen=yes | ||
15066 | else | ||
15067 | echo "$as_me: failed program was:" >&5 | ||
15068 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
15069 | |||
15070 | ac_cv_lib_dl_dlopen=no | ||
15071 | fi | ||
15072 | |||
15073 | rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ | ||
15074 | conftest$ac_exeext conftest.$ac_ext | ||
15075 | LIBS=$ac_check_lib_save_LIBS | ||
15076 | fi | ||
15077 | { echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 | ||
15078 | echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; } | ||
15079 | if test $ac_cv_lib_dl_dlopen = yes; then | ||
15080 | cat >>confdefs.h <<_ACEOF | ||
15081 | #define HAVE_LIBDL 1 | ||
15082 | _ACEOF | ||
15083 | |||
15084 | LIBS="-ldl $LIBS" | ||
15085 | |||
15086 | fi | ||
15087 | |||
15088 | |||
15089 | { echo "$as_me:$LINENO: checking for pam_set_item in -lpam" >&5 | ||
15090 | echo $ECHO_N "checking for pam_set_item in -lpam... $ECHO_C" >&6; } | ||
15091 | if test "${ac_cv_lib_pam_pam_set_item+set}" = set; then | ||
15092 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
15093 | else | ||
15094 | ac_check_lib_save_LIBS=$LIBS | ||
15095 | LIBS="-lpam $LIBS" | ||
15096 | cat >conftest.$ac_ext <<_ACEOF | ||
15097 | /* confdefs.h. */ | ||
15098 | _ACEOF | ||
15099 | cat confdefs.h >>conftest.$ac_ext | ||
15100 | cat >>conftest.$ac_ext <<_ACEOF | ||
15101 | /* end confdefs.h. */ | ||
15102 | |||
15103 | /* Override any GCC internal prototype to avoid an error. | ||
15104 | Use char because int might match the return type of a GCC | ||
15105 | builtin and then its argument prototype would still apply. */ | ||
15106 | #ifdef __cplusplus | ||
15107 | extern "C" | ||
15108 | #endif | ||
15109 | char pam_set_item (); | ||
15110 | int | ||
15111 | main () | ||
15112 | { | ||
15113 | return pam_set_item (); | ||
15114 | ; | ||
15115 | return 0; | ||
15116 | } | ||
15117 | _ACEOF | ||
15118 | rm -f conftest.$ac_objext conftest$ac_exeext | ||
15119 | if { (ac_try="$ac_link" | ||
15120 | case "(($ac_try" in | ||
15121 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
15122 | *) ac_try_echo=$ac_try;; | ||
15123 | esac | ||
15124 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
15125 | (eval "$ac_link") 2>conftest.er1 | ||
15126 | ac_status=$? | ||
15127 | grep -v '^ *+' conftest.er1 >conftest.err | ||
15128 | rm -f conftest.er1 | ||
15129 | cat conftest.err >&5 | ||
15130 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
15131 | (exit $ac_status); } && { | ||
15132 | test -z "$ac_c_werror_flag" || | ||
15133 | test ! -s conftest.err | ||
15134 | } && test -s conftest$ac_exeext && | ||
15135 | $as_test_x conftest$ac_exeext; then | ||
15136 | ac_cv_lib_pam_pam_set_item=yes | ||
15137 | else | ||
15138 | echo "$as_me: failed program was:" >&5 | ||
15139 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
15140 | |||
15141 | ac_cv_lib_pam_pam_set_item=no | ||
15142 | fi | ||
15143 | |||
15144 | rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ | ||
15145 | conftest$ac_exeext conftest.$ac_ext | ||
15146 | LIBS=$ac_check_lib_save_LIBS | ||
15147 | fi | ||
15148 | { echo "$as_me:$LINENO: result: $ac_cv_lib_pam_pam_set_item" >&5 | ||
15149 | echo "${ECHO_T}$ac_cv_lib_pam_pam_set_item" >&6; } | ||
15150 | if test $ac_cv_lib_pam_pam_set_item = yes; then | ||
15151 | cat >>confdefs.h <<_ACEOF | ||
15152 | #define HAVE_LIBPAM 1 | ||
15153 | _ACEOF | ||
15154 | |||
15155 | LIBS="-lpam $LIBS" | ||
15156 | |||
15157 | else | ||
15158 | { { echo "$as_me:$LINENO: error: *** libpam missing" >&5 | ||
15159 | echo "$as_me: error: *** libpam missing" >&2;} | ||
15160 | { (exit 1); exit 1; }; } | ||
15161 | fi | ||
15162 | |||
15163 | |||
15164 | for ac_func in pam_getenvlist | ||
15165 | do | ||
15166 | as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` | ||
15167 | { echo "$as_me:$LINENO: checking for $ac_func" >&5 | ||
15168 | echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } | ||
15169 | if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then | ||
15170 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
15171 | else | ||
15172 | cat >conftest.$ac_ext <<_ACEOF | ||
15173 | /* confdefs.h. */ | ||
15174 | _ACEOF | ||
15175 | cat confdefs.h >>conftest.$ac_ext | ||
15176 | cat >>conftest.$ac_ext <<_ACEOF | ||
15177 | /* end confdefs.h. */ | ||
15178 | /* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. | ||
15179 | For example, HP-UX 11i <limits.h> declares gettimeofday. */ | ||
15180 | #define $ac_func innocuous_$ac_func | ||
15181 | |||
15182 | /* System header to define __stub macros and hopefully few prototypes, | ||
15183 | which can conflict with char $ac_func (); below. | ||
15184 | Prefer <limits.h> to <assert.h> if __STDC__ is defined, since | ||
15185 | <limits.h> exists even on freestanding compilers. */ | ||
15186 | |||
15187 | #ifdef __STDC__ | ||
15188 | # include <limits.h> | ||
15189 | #else | ||
15190 | # include <assert.h> | ||
15191 | #endif | ||
15192 | |||
15193 | #undef $ac_func | ||
15194 | |||
15195 | /* Override any GCC internal prototype to avoid an error. | ||
15196 | Use char because int might match the return type of a GCC | ||
15197 | builtin and then its argument prototype would still apply. */ | ||
15198 | #ifdef __cplusplus | ||
15199 | extern "C" | ||
15200 | #endif | ||
15201 | char $ac_func (); | ||
15202 | /* The GNU C library defines this for functions which it implements | ||
15203 | to always fail with ENOSYS. Some functions are actually named | ||
15204 | something starting with __ and the normal name is an alias. */ | ||
15205 | #if defined __stub_$ac_func || defined __stub___$ac_func | ||
15206 | choke me | ||
15207 | #endif | ||
15208 | |||
15209 | int | ||
15210 | main () | ||
15211 | { | ||
15212 | return $ac_func (); | ||
15213 | ; | ||
15214 | return 0; | ||
15215 | } | ||
15216 | _ACEOF | ||
15217 | rm -f conftest.$ac_objext conftest$ac_exeext | ||
15218 | if { (ac_try="$ac_link" | ||
15219 | case "(($ac_try" in | ||
15220 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
15221 | *) ac_try_echo=$ac_try;; | ||
15222 | esac | ||
15223 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
15224 | (eval "$ac_link") 2>conftest.er1 | ||
15225 | ac_status=$? | ||
15226 | grep -v '^ *+' conftest.er1 >conftest.err | ||
15227 | rm -f conftest.er1 | ||
15228 | cat conftest.err >&5 | ||
15229 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
15230 | (exit $ac_status); } && { | ||
15231 | test -z "$ac_c_werror_flag" || | ||
15232 | test ! -s conftest.err | ||
15233 | } && test -s conftest$ac_exeext && | ||
15234 | $as_test_x conftest$ac_exeext; then | ||
15235 | eval "$as_ac_var=yes" | ||
15236 | else | ||
15237 | echo "$as_me: failed program was:" >&5 | ||
15238 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
15239 | |||
15240 | eval "$as_ac_var=no" | ||
15241 | fi | ||
15242 | |||
15243 | rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ | ||
15244 | conftest$ac_exeext conftest.$ac_ext | ||
15245 | fi | ||
15246 | ac_res=`eval echo '${'$as_ac_var'}'` | ||
15247 | { echo "$as_me:$LINENO: result: $ac_res" >&5 | ||
15248 | echo "${ECHO_T}$ac_res" >&6; } | ||
15249 | if test `eval echo '${'$as_ac_var'}'` = yes; then | ||
15250 | cat >>confdefs.h <<_ACEOF | ||
15251 | #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 | ||
15252 | _ACEOF | ||
15253 | |||
15254 | fi | ||
15255 | done | ||
15256 | |||
15257 | |||
15258 | for ac_func in pam_putenv | ||
15259 | do | ||
15260 | as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` | ||
15261 | { echo "$as_me:$LINENO: checking for $ac_func" >&5 | ||
15262 | echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } | ||
15263 | if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then | ||
15264 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
15265 | else | ||
15266 | cat >conftest.$ac_ext <<_ACEOF | ||
15267 | /* confdefs.h. */ | ||
15268 | _ACEOF | ||
15269 | cat confdefs.h >>conftest.$ac_ext | ||
15270 | cat >>conftest.$ac_ext <<_ACEOF | ||
15271 | /* end confdefs.h. */ | ||
15272 | /* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. | ||
15273 | For example, HP-UX 11i <limits.h> declares gettimeofday. */ | ||
15274 | #define $ac_func innocuous_$ac_func | ||
15275 | |||
15276 | /* System header to define __stub macros and hopefully few prototypes, | ||
15277 | which can conflict with char $ac_func (); below. | ||
15278 | Prefer <limits.h> to <assert.h> if __STDC__ is defined, since | ||
15279 | <limits.h> exists even on freestanding compilers. */ | ||
15280 | |||
15281 | #ifdef __STDC__ | ||
15282 | # include <limits.h> | ||
15283 | #else | ||
15284 | # include <assert.h> | ||
15285 | #endif | ||
15286 | |||
15287 | #undef $ac_func | ||
15288 | |||
15289 | /* Override any GCC internal prototype to avoid an error. | ||
15290 | Use char because int might match the return type of a GCC | ||
15291 | builtin and then its argument prototype would still apply. */ | ||
15292 | #ifdef __cplusplus | ||
15293 | extern "C" | ||
15294 | #endif | ||
15295 | char $ac_func (); | ||
15296 | /* The GNU C library defines this for functions which it implements | ||
15297 | to always fail with ENOSYS. Some functions are actually named | ||
15298 | something starting with __ and the normal name is an alias. */ | ||
15299 | #if defined __stub_$ac_func || defined __stub___$ac_func | ||
15300 | choke me | ||
15301 | #endif | ||
15302 | |||
15303 | int | ||
15304 | main () | ||
15305 | { | ||
15306 | return $ac_func (); | ||
15307 | ; | ||
15308 | return 0; | ||
15309 | } | ||
15310 | _ACEOF | ||
15311 | rm -f conftest.$ac_objext conftest$ac_exeext | ||
15312 | if { (ac_try="$ac_link" | ||
15313 | case "(($ac_try" in | ||
15314 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
15315 | *) ac_try_echo=$ac_try;; | ||
15316 | esac | ||
15317 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
15318 | (eval "$ac_link") 2>conftest.er1 | ||
15319 | ac_status=$? | ||
15320 | grep -v '^ *+' conftest.er1 >conftest.err | ||
15321 | rm -f conftest.er1 | ||
15322 | cat conftest.err >&5 | ||
15323 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
15324 | (exit $ac_status); } && { | ||
15325 | test -z "$ac_c_werror_flag" || | ||
15326 | test ! -s conftest.err | ||
15327 | } && test -s conftest$ac_exeext && | ||
15328 | $as_test_x conftest$ac_exeext; then | ||
15329 | eval "$as_ac_var=yes" | ||
15330 | else | ||
15331 | echo "$as_me: failed program was:" >&5 | ||
15332 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
15333 | |||
15334 | eval "$as_ac_var=no" | ||
15335 | fi | ||
15336 | |||
15337 | rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ | ||
15338 | conftest$ac_exeext conftest.$ac_ext | ||
15339 | fi | ||
15340 | ac_res=`eval echo '${'$as_ac_var'}'` | ||
15341 | { echo "$as_me:$LINENO: result: $ac_res" >&5 | ||
15342 | echo "${ECHO_T}$ac_res" >&6; } | ||
15343 | if test `eval echo '${'$as_ac_var'}'` = yes; then | ||
15344 | cat >>confdefs.h <<_ACEOF | ||
15345 | #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 | ||
15346 | _ACEOF | ||
15347 | |||
15348 | fi | ||
15349 | done | ||
15350 | |||
15351 | |||
15352 | PAM_MSG="yes" | ||
15353 | |||
15354 | |||
15355 | cat >>confdefs.h <<\_ACEOF | ||
15356 | #define USE_PAM 1 | ||
15357 | _ACEOF | ||
15358 | |||
15359 | if test $ac_cv_lib_dl_dlopen = yes; then | ||
15360 | LIBPAM="-lpam -ldl" | ||
15361 | else | ||
15362 | LIBPAM="-lpam" | ||
15363 | fi | ||
15364 | |||
15365 | fi | ||
15366 | |||
15367 | |||
15368 | fi | ||
15369 | |||
15370 | |||
15371 | # Check for older PAM | ||
15372 | if test "x$PAM_MSG" = "xyes" ; then | ||
15373 | # Check PAM strerror arguments (old PAM) | ||
15374 | { echo "$as_me:$LINENO: checking whether pam_strerror takes only one argument" >&5 | ||
15375 | echo $ECHO_N "checking whether pam_strerror takes only one argument... $ECHO_C" >&6; } | ||
15376 | cat >conftest.$ac_ext <<_ACEOF | ||
15377 | /* confdefs.h. */ | ||
15378 | _ACEOF | ||
15379 | cat confdefs.h >>conftest.$ac_ext | ||
15380 | cat >>conftest.$ac_ext <<_ACEOF | ||
15381 | /* end confdefs.h. */ | ||
15382 | |||
15383 | #include <stdlib.h> | ||
15384 | #if defined(HAVE_SECURITY_PAM_APPL_H) | ||
15385 | #include <security/pam_appl.h> | ||
15386 | #elif defined (HAVE_PAM_PAM_APPL_H) | ||
15387 | #include <pam/pam_appl.h> | ||
15388 | #endif | ||
15389 | |||
15390 | int | ||
15391 | main () | ||
15392 | { | ||
15393 | (void)pam_strerror((pam_handle_t *)NULL, -1); | ||
15394 | ; | ||
15395 | return 0; | ||
15396 | } | ||
15397 | _ACEOF | ||
15398 | rm -f conftest.$ac_objext | ||
15399 | if { (ac_try="$ac_compile" | ||
15400 | case "(($ac_try" in | ||
15401 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
15402 | *) ac_try_echo=$ac_try;; | ||
15403 | esac | ||
15404 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
15405 | (eval "$ac_compile") 2>conftest.er1 | ||
15406 | ac_status=$? | ||
15407 | grep -v '^ *+' conftest.er1 >conftest.err | ||
15408 | rm -f conftest.er1 | ||
15409 | cat conftest.err >&5 | ||
15410 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
15411 | (exit $ac_status); } && { | ||
15412 | test -z "$ac_c_werror_flag" || | ||
15413 | test ! -s conftest.err | ||
15414 | } && test -s conftest.$ac_objext; then | ||
15415 | { echo "$as_me:$LINENO: result: no" >&5 | ||
15416 | echo "${ECHO_T}no" >&6; } | ||
15417 | else | ||
15418 | echo "$as_me: failed program was:" >&5 | ||
15419 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
15420 | |||
15421 | |||
15422 | |||
15423 | cat >>confdefs.h <<\_ACEOF | ||
15424 | #define HAVE_OLD_PAM 1 | ||
15425 | _ACEOF | ||
15426 | |||
15427 | { echo "$as_me:$LINENO: result: yes" >&5 | ||
15428 | echo "${ECHO_T}yes" >&6; } | ||
15429 | PAM_MSG="yes (old library)" | ||
15430 | |||
15431 | |||
15432 | fi | ||
15433 | |||
15434 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | ||
15435 | fi | ||
15436 | |||
15437 | # Search for OpenSSL | 15557 | # Search for OpenSSL |
15438 | saved_CPPFLAGS="$CPPFLAGS" | 15558 | saved_CPPFLAGS="$CPPFLAGS" |
15439 | saved_LDFLAGS="$LDFLAGS" | 15559 | saved_LDFLAGS="$LDFLAGS" |
@@ -15752,6 +15872,17 @@ fi | |||
15752 | 15872 | ||
15753 | 15873 | ||
15754 | 15874 | ||
15875 | |||
15876 | # Check whether --with-openssl-header-check was given. | ||
15877 | if test "${with_openssl_header_check+set}" = set; then | ||
15878 | withval=$with_openssl_header_check; if test "x$withval" = "xno" ; then | ||
15879 | openssl_check_nonfatal=1 | ||
15880 | fi | ||
15881 | |||
15882 | |||
15883 | fi | ||
15884 | |||
15885 | |||
15755 | # Sanity check OpenSSL headers | 15886 | # Sanity check OpenSSL headers |
15756 | { echo "$as_me:$LINENO: checking whether OpenSSL's headers match the library" >&5 | 15887 | { echo "$as_me:$LINENO: checking whether OpenSSL's headers match the library" >&5 |
15757 | echo $ECHO_N "checking whether OpenSSL's headers match the library... $ECHO_C" >&6; } | 15888 | echo $ECHO_N "checking whether OpenSSL's headers match the library... $ECHO_C" >&6; } |
@@ -15807,13 +15938,28 @@ sed 's/^/| /' conftest.$ac_ext >&5 | |||
15807 | 15938 | ||
15808 | { echo "$as_me:$LINENO: result: no" >&5 | 15939 | { echo "$as_me:$LINENO: result: no" >&5 |
15809 | echo "${ECHO_T}no" >&6; } | 15940 | echo "${ECHO_T}no" >&6; } |
15810 | { { echo "$as_me:$LINENO: error: Your OpenSSL headers do not match your library. | 15941 | if test "x$openssl_check_nonfatal" = "x"; then |
15811 | Check config.log for details. | 15942 | { { echo "$as_me:$LINENO: error: Your OpenSSL headers do not match your |
15943 | library. Check config.log for details. | ||
15944 | If you are sure your installation is consistent, you can disable the check | ||
15945 | by running \"./configure --without-openssl-header-check\". | ||
15946 | Also see contrib/findssl.sh for help identifying header/library mismatches. | ||
15947 | " >&5 | ||
15948 | echo "$as_me: error: Your OpenSSL headers do not match your | ||
15949 | library. Check config.log for details. | ||
15950 | If you are sure your installation is consistent, you can disable the check | ||
15951 | by running \"./configure --without-openssl-header-check\". | ||
15952 | Also see contrib/findssl.sh for help identifying header/library mismatches. | ||
15953 | " >&2;} | ||
15954 | { (exit 1); exit 1; }; } | ||
15955 | else | ||
15956 | { echo "$as_me:$LINENO: WARNING: Your OpenSSL headers do not match your | ||
15957 | library. Check config.log for details. | ||
15812 | Also see contrib/findssl.sh for help identifying header/library mismatches." >&5 | 15958 | Also see contrib/findssl.sh for help identifying header/library mismatches." >&5 |
15813 | echo "$as_me: error: Your OpenSSL headers do not match your library. | 15959 | echo "$as_me: WARNING: Your OpenSSL headers do not match your |
15814 | Check config.log for details. | 15960 | library. Check config.log for details. |
15815 | Also see contrib/findssl.sh for help identifying header/library mismatches." >&2;} | 15961 | Also see contrib/findssl.sh for help identifying header/library mismatches." >&2;} |
15816 | { (exit 1); exit 1; }; } | 15962 | fi |
15817 | 15963 | ||
15818 | fi | 15964 | fi |
15819 | rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext | 15965 | rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext |
@@ -15821,6 +15967,170 @@ fi | |||
15821 | 15967 | ||
15822 | 15968 | ||
15823 | 15969 | ||
15970 | { echo "$as_me:$LINENO: checking if programs using OpenSSL functions will link" >&5 | ||
15971 | echo $ECHO_N "checking if programs using OpenSSL functions will link... $ECHO_C" >&6; } | ||
15972 | cat >conftest.$ac_ext <<_ACEOF | ||
15973 | /* confdefs.h. */ | ||
15974 | _ACEOF | ||
15975 | cat confdefs.h >>conftest.$ac_ext | ||
15976 | cat >>conftest.$ac_ext <<_ACEOF | ||
15977 | /* end confdefs.h. */ | ||
15978 | |||
15979 | #include <openssl/evp.h> | ||
15980 | int main(void) { SSLeay_add_all_algorithms(); } | ||
15981 | |||
15982 | _ACEOF | ||
15983 | rm -f conftest.$ac_objext conftest$ac_exeext | ||
15984 | if { (ac_try="$ac_link" | ||
15985 | case "(($ac_try" in | ||
15986 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
15987 | *) ac_try_echo=$ac_try;; | ||
15988 | esac | ||
15989 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
15990 | (eval "$ac_link") 2>conftest.er1 | ||
15991 | ac_status=$? | ||
15992 | grep -v '^ *+' conftest.er1 >conftest.err | ||
15993 | rm -f conftest.er1 | ||
15994 | cat conftest.err >&5 | ||
15995 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
15996 | (exit $ac_status); } && { | ||
15997 | test -z "$ac_c_werror_flag" || | ||
15998 | test ! -s conftest.err | ||
15999 | } && test -s conftest$ac_exeext && | ||
16000 | $as_test_x conftest$ac_exeext; then | ||
16001 | |||
16002 | { echo "$as_me:$LINENO: result: yes" >&5 | ||
16003 | echo "${ECHO_T}yes" >&6; } | ||
16004 | |||
16005 | else | ||
16006 | echo "$as_me: failed program was:" >&5 | ||
16007 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
16008 | |||
16009 | |||
16010 | { echo "$as_me:$LINENO: result: no" >&5 | ||
16011 | echo "${ECHO_T}no" >&6; } | ||
16012 | saved_LIBS="$LIBS" | ||
16013 | LIBS="$LIBS -ldl" | ||
16014 | { echo "$as_me:$LINENO: checking if programs using OpenSSL need -ldl" >&5 | ||
16015 | echo $ECHO_N "checking if programs using OpenSSL need -ldl... $ECHO_C" >&6; } | ||
16016 | cat >conftest.$ac_ext <<_ACEOF | ||
16017 | /* confdefs.h. */ | ||
16018 | _ACEOF | ||
16019 | cat confdefs.h >>conftest.$ac_ext | ||
16020 | cat >>conftest.$ac_ext <<_ACEOF | ||
16021 | /* end confdefs.h. */ | ||
16022 | |||
16023 | #include <openssl/evp.h> | ||
16024 | int main(void) { SSLeay_add_all_algorithms(); } | ||
16025 | |||
16026 | _ACEOF | ||
16027 | rm -f conftest.$ac_objext conftest$ac_exeext | ||
16028 | if { (ac_try="$ac_link" | ||
16029 | case "(($ac_try" in | ||
16030 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
16031 | *) ac_try_echo=$ac_try;; | ||
16032 | esac | ||
16033 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
16034 | (eval "$ac_link") 2>conftest.er1 | ||
16035 | ac_status=$? | ||
16036 | grep -v '^ *+' conftest.er1 >conftest.err | ||
16037 | rm -f conftest.er1 | ||
16038 | cat conftest.err >&5 | ||
16039 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
16040 | (exit $ac_status); } && { | ||
16041 | test -z "$ac_c_werror_flag" || | ||
16042 | test ! -s conftest.err | ||
16043 | } && test -s conftest$ac_exeext && | ||
16044 | $as_test_x conftest$ac_exeext; then | ||
16045 | |||
16046 | { echo "$as_me:$LINENO: result: yes" >&5 | ||
16047 | echo "${ECHO_T}yes" >&6; } | ||
16048 | |||
16049 | else | ||
16050 | echo "$as_me: failed program was:" >&5 | ||
16051 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
16052 | |||
16053 | |||
16054 | { echo "$as_me:$LINENO: result: no" >&5 | ||
16055 | echo "${ECHO_T}no" >&6; } | ||
16056 | LIBS="$saved_LIBS" | ||
16057 | |||
16058 | |||
16059 | fi | ||
16060 | |||
16061 | rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ | ||
16062 | conftest$ac_exeext conftest.$ac_ext | ||
16063 | |||
16064 | |||
16065 | fi | ||
16066 | |||
16067 | rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ | ||
16068 | conftest$ac_exeext conftest.$ac_ext | ||
16069 | |||
16070 | |||
16071 | # Check whether --with-ssl-engine was given. | ||
16072 | if test "${with_ssl_engine+set}" = set; then | ||
16073 | withval=$with_ssl_engine; if test "x$withval" != "xno" ; then | ||
16074 | { echo "$as_me:$LINENO: checking for OpenSSL ENGINE support" >&5 | ||
16075 | echo $ECHO_N "checking for OpenSSL ENGINE support... $ECHO_C" >&6; } | ||
16076 | cat >conftest.$ac_ext <<_ACEOF | ||
16077 | /* confdefs.h. */ | ||
16078 | _ACEOF | ||
16079 | cat confdefs.h >>conftest.$ac_ext | ||
16080 | cat >>conftest.$ac_ext <<_ACEOF | ||
16081 | /* end confdefs.h. */ | ||
16082 | #include <openssl/engine.h> | ||
16083 | int | ||
16084 | main () | ||
16085 | { | ||
16086 | |||
16087 | ENGINE_load_builtin_engines();ENGINE_register_all_complete(); | ||
16088 | |||
16089 | ; | ||
16090 | return 0; | ||
16091 | } | ||
16092 | _ACEOF | ||
16093 | rm -f conftest.$ac_objext | ||
16094 | if { (ac_try="$ac_compile" | ||
16095 | case "(($ac_try" in | ||
16096 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
16097 | *) ac_try_echo=$ac_try;; | ||
16098 | esac | ||
16099 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
16100 | (eval "$ac_compile") 2>conftest.er1 | ||
16101 | ac_status=$? | ||
16102 | grep -v '^ *+' conftest.er1 >conftest.err | ||
16103 | rm -f conftest.er1 | ||
16104 | cat conftest.err >&5 | ||
16105 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
16106 | (exit $ac_status); } && { | ||
16107 | test -z "$ac_c_werror_flag" || | ||
16108 | test ! -s conftest.err | ||
16109 | } && test -s conftest.$ac_objext; then | ||
16110 | { echo "$as_me:$LINENO: result: yes" >&5 | ||
16111 | echo "${ECHO_T}yes" >&6; } | ||
16112 | |||
16113 | cat >>confdefs.h <<\_ACEOF | ||
16114 | #define USE_OPENSSL_ENGINE 1 | ||
16115 | _ACEOF | ||
16116 | |||
16117 | |||
16118 | else | ||
16119 | echo "$as_me: failed program was:" >&5 | ||
16120 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
16121 | |||
16122 | { { echo "$as_me:$LINENO: error: OpenSSL ENGINE support not found" >&5 | ||
16123 | echo "$as_me: error: OpenSSL ENGINE support not found" >&2;} | ||
16124 | { (exit 1); exit 1; }; } | ||
16125 | |||
16126 | fi | ||
16127 | |||
16128 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | ||
16129 | fi | ||
16130 | |||
16131 | fi | ||
16132 | |||
16133 | |||
15824 | # Check for OpenSSL without EVP_aes_{192,256}_cbc | 16134 | # Check for OpenSSL without EVP_aes_{192,256}_cbc |
15825 | { echo "$as_me:$LINENO: checking whether OpenSSL has crippled AES support" >&5 | 16135 | { echo "$as_me:$LINENO: checking whether OpenSSL has crippled AES support" >&5 |
15826 | echo $ECHO_N "checking whether OpenSSL has crippled AES support... $ECHO_C" >&6; } | 16136 | echo $ECHO_N "checking whether OpenSSL has crippled AES support... $ECHO_C" >&6; } |
@@ -15836,14 +16146,14 @@ cat >>conftest.$ac_ext <<_ACEOF | |||
15836 | int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);} | 16146 | int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);} |
15837 | 16147 | ||
15838 | _ACEOF | 16148 | _ACEOF |
15839 | rm -f conftest.$ac_objext | 16149 | rm -f conftest.$ac_objext conftest$ac_exeext |
15840 | if { (ac_try="$ac_compile" | 16150 | if { (ac_try="$ac_link" |
15841 | case "(($ac_try" in | 16151 | case "(($ac_try" in |
15842 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | 16152 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; |
15843 | *) ac_try_echo=$ac_try;; | 16153 | *) ac_try_echo=$ac_try;; |
15844 | esac | 16154 | esac |
15845 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | 16155 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 |
15846 | (eval "$ac_compile") 2>conftest.er1 | 16156 | (eval "$ac_link") 2>conftest.er1 |
15847 | ac_status=$? | 16157 | ac_status=$? |
15848 | grep -v '^ *+' conftest.er1 >conftest.err | 16158 | grep -v '^ *+' conftest.er1 >conftest.err |
15849 | rm -f conftest.er1 | 16159 | rm -f conftest.er1 |
@@ -15852,7 +16162,8 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | |||
15852 | (exit $ac_status); } && { | 16162 | (exit $ac_status); } && { |
15853 | test -z "$ac_c_werror_flag" || | 16163 | test -z "$ac_c_werror_flag" || |
15854 | test ! -s conftest.err | 16164 | test ! -s conftest.err |
15855 | } && test -s conftest.$ac_objext; then | 16165 | } && test -s conftest$ac_exeext && |
16166 | $as_test_x conftest$ac_exeext; then | ||
15856 | 16167 | ||
15857 | { echo "$as_me:$LINENO: result: no" >&5 | 16168 | { echo "$as_me:$LINENO: result: no" >&5 |
15858 | echo "${ECHO_T}no" >&6; } | 16169 | echo "${ECHO_T}no" >&6; } |
@@ -15873,7 +16184,8 @@ _ACEOF | |||
15873 | 16184 | ||
15874 | fi | 16185 | fi |
15875 | 16186 | ||
15876 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | 16187 | rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ |
16188 | conftest$ac_exeext conftest.$ac_ext | ||
15877 | 16189 | ||
15878 | # Some systems want crypt() from libcrypt, *not* the version in OpenSSL, | 16190 | # Some systems want crypt() from libcrypt, *not* the version in OpenSSL, |
15879 | # because the system crypt() is more featureful. | 16191 | # because the system crypt() is more featureful. |
@@ -16021,6 +16333,103 @@ fi | |||
16021 | 16333 | ||
16022 | fi | 16334 | fi |
16023 | 16335 | ||
16336 | # Search for SHA256 support in libc and/or OpenSSL | ||
16337 | |||
16338 | |||
16339 | for ac_func in SHA256_Update EVP_sha256 | ||
16340 | do | ||
16341 | as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` | ||
16342 | { echo "$as_me:$LINENO: checking for $ac_func" >&5 | ||
16343 | echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } | ||
16344 | if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then | ||
16345 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
16346 | else | ||
16347 | cat >conftest.$ac_ext <<_ACEOF | ||
16348 | /* confdefs.h. */ | ||
16349 | _ACEOF | ||
16350 | cat confdefs.h >>conftest.$ac_ext | ||
16351 | cat >>conftest.$ac_ext <<_ACEOF | ||
16352 | /* end confdefs.h. */ | ||
16353 | /* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. | ||
16354 | For example, HP-UX 11i <limits.h> declares gettimeofday. */ | ||
16355 | #define $ac_func innocuous_$ac_func | ||
16356 | |||
16357 | /* System header to define __stub macros and hopefully few prototypes, | ||
16358 | which can conflict with char $ac_func (); below. | ||
16359 | Prefer <limits.h> to <assert.h> if __STDC__ is defined, since | ||
16360 | <limits.h> exists even on freestanding compilers. */ | ||
16361 | |||
16362 | #ifdef __STDC__ | ||
16363 | # include <limits.h> | ||
16364 | #else | ||
16365 | # include <assert.h> | ||
16366 | #endif | ||
16367 | |||
16368 | #undef $ac_func | ||
16369 | |||
16370 | /* Override any GCC internal prototype to avoid an error. | ||
16371 | Use char because int might match the return type of a GCC | ||
16372 | builtin and then its argument prototype would still apply. */ | ||
16373 | #ifdef __cplusplus | ||
16374 | extern "C" | ||
16375 | #endif | ||
16376 | char $ac_func (); | ||
16377 | /* The GNU C library defines this for functions which it implements | ||
16378 | to always fail with ENOSYS. Some functions are actually named | ||
16379 | something starting with __ and the normal name is an alias. */ | ||
16380 | #if defined __stub_$ac_func || defined __stub___$ac_func | ||
16381 | choke me | ||
16382 | #endif | ||
16383 | |||
16384 | int | ||
16385 | main () | ||
16386 | { | ||
16387 | return $ac_func (); | ||
16388 | ; | ||
16389 | return 0; | ||
16390 | } | ||
16391 | _ACEOF | ||
16392 | rm -f conftest.$ac_objext conftest$ac_exeext | ||
16393 | if { (ac_try="$ac_link" | ||
16394 | case "(($ac_try" in | ||
16395 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
16396 | *) ac_try_echo=$ac_try;; | ||
16397 | esac | ||
16398 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
16399 | (eval "$ac_link") 2>conftest.er1 | ||
16400 | ac_status=$? | ||
16401 | grep -v '^ *+' conftest.er1 >conftest.err | ||
16402 | rm -f conftest.er1 | ||
16403 | cat conftest.err >&5 | ||
16404 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
16405 | (exit $ac_status); } && { | ||
16406 | test -z "$ac_c_werror_flag" || | ||
16407 | test ! -s conftest.err | ||
16408 | } && test -s conftest$ac_exeext && | ||
16409 | $as_test_x conftest$ac_exeext; then | ||
16410 | eval "$as_ac_var=yes" | ||
16411 | else | ||
16412 | echo "$as_me: failed program was:" >&5 | ||
16413 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
16414 | |||
16415 | eval "$as_ac_var=no" | ||
16416 | fi | ||
16417 | |||
16418 | rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ | ||
16419 | conftest$ac_exeext conftest.$ac_ext | ||
16420 | fi | ||
16421 | ac_res=`eval echo '${'$as_ac_var'}'` | ||
16422 | { echo "$as_me:$LINENO: result: $ac_res" >&5 | ||
16423 | echo "${ECHO_T}$ac_res" >&6; } | ||
16424 | if test `eval echo '${'$as_ac_var'}'` = yes; then | ||
16425 | cat >>confdefs.h <<_ACEOF | ||
16426 | #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 | ||
16427 | _ACEOF | ||
16428 | |||
16429 | fi | ||
16430 | done | ||
16431 | |||
16432 | |||
16024 | 16433 | ||
16025 | { echo "$as_me:$LINENO: checking for ia_openinfo in -liaf" >&5 | 16434 | { echo "$as_me:$LINENO: checking for ia_openinfo in -liaf" >&5 |
16026 | echo $ECHO_N "checking for ia_openinfo in -liaf... $ECHO_C" >&6; } | 16435 | echo $ECHO_N "checking for ia_openinfo in -liaf... $ECHO_C" >&6; } |
@@ -16164,6 +16573,448 @@ fi | |||
16164 | 16573 | ||
16165 | 16574 | ||
16166 | 16575 | ||
16576 | # Check for PAM libs | ||
16577 | PAM_MSG="no" | ||
16578 | |||
16579 | # Check whether --with-pam was given. | ||
16580 | if test "${with_pam+set}" = set; then | ||
16581 | withval=$with_pam; | ||
16582 | if test "x$withval" != "xno" ; then | ||
16583 | if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \ | ||
16584 | test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then | ||
16585 | { { echo "$as_me:$LINENO: error: PAM headers not found" >&5 | ||
16586 | echo "$as_me: error: PAM headers not found" >&2;} | ||
16587 | { (exit 1); exit 1; }; } | ||
16588 | fi | ||
16589 | |||
16590 | saved_LIBS="$LIBS" | ||
16591 | |||
16592 | { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 | ||
16593 | echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; } | ||
16594 | if test "${ac_cv_lib_dl_dlopen+set}" = set; then | ||
16595 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
16596 | else | ||
16597 | ac_check_lib_save_LIBS=$LIBS | ||
16598 | LIBS="-ldl $LIBS" | ||
16599 | cat >conftest.$ac_ext <<_ACEOF | ||
16600 | /* confdefs.h. */ | ||
16601 | _ACEOF | ||
16602 | cat confdefs.h >>conftest.$ac_ext | ||
16603 | cat >>conftest.$ac_ext <<_ACEOF | ||
16604 | /* end confdefs.h. */ | ||
16605 | |||
16606 | /* Override any GCC internal prototype to avoid an error. | ||
16607 | Use char because int might match the return type of a GCC | ||
16608 | builtin and then its argument prototype would still apply. */ | ||
16609 | #ifdef __cplusplus | ||
16610 | extern "C" | ||
16611 | #endif | ||
16612 | char dlopen (); | ||
16613 | int | ||
16614 | main () | ||
16615 | { | ||
16616 | return dlopen (); | ||
16617 | ; | ||
16618 | return 0; | ||
16619 | } | ||
16620 | _ACEOF | ||
16621 | rm -f conftest.$ac_objext conftest$ac_exeext | ||
16622 | if { (ac_try="$ac_link" | ||
16623 | case "(($ac_try" in | ||
16624 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
16625 | *) ac_try_echo=$ac_try;; | ||
16626 | esac | ||
16627 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
16628 | (eval "$ac_link") 2>conftest.er1 | ||
16629 | ac_status=$? | ||
16630 | grep -v '^ *+' conftest.er1 >conftest.err | ||
16631 | rm -f conftest.er1 | ||
16632 | cat conftest.err >&5 | ||
16633 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
16634 | (exit $ac_status); } && { | ||
16635 | test -z "$ac_c_werror_flag" || | ||
16636 | test ! -s conftest.err | ||
16637 | } && test -s conftest$ac_exeext && | ||
16638 | $as_test_x conftest$ac_exeext; then | ||
16639 | ac_cv_lib_dl_dlopen=yes | ||
16640 | else | ||
16641 | echo "$as_me: failed program was:" >&5 | ||
16642 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
16643 | |||
16644 | ac_cv_lib_dl_dlopen=no | ||
16645 | fi | ||
16646 | |||
16647 | rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ | ||
16648 | conftest$ac_exeext conftest.$ac_ext | ||
16649 | LIBS=$ac_check_lib_save_LIBS | ||
16650 | fi | ||
16651 | { echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 | ||
16652 | echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; } | ||
16653 | if test $ac_cv_lib_dl_dlopen = yes; then | ||
16654 | cat >>confdefs.h <<_ACEOF | ||
16655 | #define HAVE_LIBDL 1 | ||
16656 | _ACEOF | ||
16657 | |||
16658 | LIBS="-ldl $LIBS" | ||
16659 | |||
16660 | fi | ||
16661 | |||
16662 | |||
16663 | { echo "$as_me:$LINENO: checking for pam_set_item in -lpam" >&5 | ||
16664 | echo $ECHO_N "checking for pam_set_item in -lpam... $ECHO_C" >&6; } | ||
16665 | if test "${ac_cv_lib_pam_pam_set_item+set}" = set; then | ||
16666 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
16667 | else | ||
16668 | ac_check_lib_save_LIBS=$LIBS | ||
16669 | LIBS="-lpam $LIBS" | ||
16670 | cat >conftest.$ac_ext <<_ACEOF | ||
16671 | /* confdefs.h. */ | ||
16672 | _ACEOF | ||
16673 | cat confdefs.h >>conftest.$ac_ext | ||
16674 | cat >>conftest.$ac_ext <<_ACEOF | ||
16675 | /* end confdefs.h. */ | ||
16676 | |||
16677 | /* Override any GCC internal prototype to avoid an error. | ||
16678 | Use char because int might match the return type of a GCC | ||
16679 | builtin and then its argument prototype would still apply. */ | ||
16680 | #ifdef __cplusplus | ||
16681 | extern "C" | ||
16682 | #endif | ||
16683 | char pam_set_item (); | ||
16684 | int | ||
16685 | main () | ||
16686 | { | ||
16687 | return pam_set_item (); | ||
16688 | ; | ||
16689 | return 0; | ||
16690 | } | ||
16691 | _ACEOF | ||
16692 | rm -f conftest.$ac_objext conftest$ac_exeext | ||
16693 | if { (ac_try="$ac_link" | ||
16694 | case "(($ac_try" in | ||
16695 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
16696 | *) ac_try_echo=$ac_try;; | ||
16697 | esac | ||
16698 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
16699 | (eval "$ac_link") 2>conftest.er1 | ||
16700 | ac_status=$? | ||
16701 | grep -v '^ *+' conftest.er1 >conftest.err | ||
16702 | rm -f conftest.er1 | ||
16703 | cat conftest.err >&5 | ||
16704 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
16705 | (exit $ac_status); } && { | ||
16706 | test -z "$ac_c_werror_flag" || | ||
16707 | test ! -s conftest.err | ||
16708 | } && test -s conftest$ac_exeext && | ||
16709 | $as_test_x conftest$ac_exeext; then | ||
16710 | ac_cv_lib_pam_pam_set_item=yes | ||
16711 | else | ||
16712 | echo "$as_me: failed program was:" >&5 | ||
16713 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
16714 | |||
16715 | ac_cv_lib_pam_pam_set_item=no | ||
16716 | fi | ||
16717 | |||
16718 | rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ | ||
16719 | conftest$ac_exeext conftest.$ac_ext | ||
16720 | LIBS=$ac_check_lib_save_LIBS | ||
16721 | fi | ||
16722 | { echo "$as_me:$LINENO: result: $ac_cv_lib_pam_pam_set_item" >&5 | ||
16723 | echo "${ECHO_T}$ac_cv_lib_pam_pam_set_item" >&6; } | ||
16724 | if test $ac_cv_lib_pam_pam_set_item = yes; then | ||
16725 | cat >>confdefs.h <<_ACEOF | ||
16726 | #define HAVE_LIBPAM 1 | ||
16727 | _ACEOF | ||
16728 | |||
16729 | LIBS="-lpam $LIBS" | ||
16730 | |||
16731 | else | ||
16732 | { { echo "$as_me:$LINENO: error: *** libpam missing" >&5 | ||
16733 | echo "$as_me: error: *** libpam missing" >&2;} | ||
16734 | { (exit 1); exit 1; }; } | ||
16735 | fi | ||
16736 | |||
16737 | |||
16738 | for ac_func in pam_getenvlist | ||
16739 | do | ||
16740 | as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` | ||
16741 | { echo "$as_me:$LINENO: checking for $ac_func" >&5 | ||
16742 | echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } | ||
16743 | if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then | ||
16744 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
16745 | else | ||
16746 | cat >conftest.$ac_ext <<_ACEOF | ||
16747 | /* confdefs.h. */ | ||
16748 | _ACEOF | ||
16749 | cat confdefs.h >>conftest.$ac_ext | ||
16750 | cat >>conftest.$ac_ext <<_ACEOF | ||
16751 | /* end confdefs.h. */ | ||
16752 | /* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. | ||
16753 | For example, HP-UX 11i <limits.h> declares gettimeofday. */ | ||
16754 | #define $ac_func innocuous_$ac_func | ||
16755 | |||
16756 | /* System header to define __stub macros and hopefully few prototypes, | ||
16757 | which can conflict with char $ac_func (); below. | ||
16758 | Prefer <limits.h> to <assert.h> if __STDC__ is defined, since | ||
16759 | <limits.h> exists even on freestanding compilers. */ | ||
16760 | |||
16761 | #ifdef __STDC__ | ||
16762 | # include <limits.h> | ||
16763 | #else | ||
16764 | # include <assert.h> | ||
16765 | #endif | ||
16766 | |||
16767 | #undef $ac_func | ||
16768 | |||
16769 | /* Override any GCC internal prototype to avoid an error. | ||
16770 | Use char because int might match the return type of a GCC | ||
16771 | builtin and then its argument prototype would still apply. */ | ||
16772 | #ifdef __cplusplus | ||
16773 | extern "C" | ||
16774 | #endif | ||
16775 | char $ac_func (); | ||
16776 | /* The GNU C library defines this for functions which it implements | ||
16777 | to always fail with ENOSYS. Some functions are actually named | ||
16778 | something starting with __ and the normal name is an alias. */ | ||
16779 | #if defined __stub_$ac_func || defined __stub___$ac_func | ||
16780 | choke me | ||
16781 | #endif | ||
16782 | |||
16783 | int | ||
16784 | main () | ||
16785 | { | ||
16786 | return $ac_func (); | ||
16787 | ; | ||
16788 | return 0; | ||
16789 | } | ||
16790 | _ACEOF | ||
16791 | rm -f conftest.$ac_objext conftest$ac_exeext | ||
16792 | if { (ac_try="$ac_link" | ||
16793 | case "(($ac_try" in | ||
16794 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
16795 | *) ac_try_echo=$ac_try;; | ||
16796 | esac | ||
16797 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
16798 | (eval "$ac_link") 2>conftest.er1 | ||
16799 | ac_status=$? | ||
16800 | grep -v '^ *+' conftest.er1 >conftest.err | ||
16801 | rm -f conftest.er1 | ||
16802 | cat conftest.err >&5 | ||
16803 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
16804 | (exit $ac_status); } && { | ||
16805 | test -z "$ac_c_werror_flag" || | ||
16806 | test ! -s conftest.err | ||
16807 | } && test -s conftest$ac_exeext && | ||
16808 | $as_test_x conftest$ac_exeext; then | ||
16809 | eval "$as_ac_var=yes" | ||
16810 | else | ||
16811 | echo "$as_me: failed program was:" >&5 | ||
16812 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
16813 | |||
16814 | eval "$as_ac_var=no" | ||
16815 | fi | ||
16816 | |||
16817 | rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ | ||
16818 | conftest$ac_exeext conftest.$ac_ext | ||
16819 | fi | ||
16820 | ac_res=`eval echo '${'$as_ac_var'}'` | ||
16821 | { echo "$as_me:$LINENO: result: $ac_res" >&5 | ||
16822 | echo "${ECHO_T}$ac_res" >&6; } | ||
16823 | if test `eval echo '${'$as_ac_var'}'` = yes; then | ||
16824 | cat >>confdefs.h <<_ACEOF | ||
16825 | #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 | ||
16826 | _ACEOF | ||
16827 | |||
16828 | fi | ||
16829 | done | ||
16830 | |||
16831 | |||
16832 | for ac_func in pam_putenv | ||
16833 | do | ||
16834 | as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` | ||
16835 | { echo "$as_me:$LINENO: checking for $ac_func" >&5 | ||
16836 | echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } | ||
16837 | if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then | ||
16838 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
16839 | else | ||
16840 | cat >conftest.$ac_ext <<_ACEOF | ||
16841 | /* confdefs.h. */ | ||
16842 | _ACEOF | ||
16843 | cat confdefs.h >>conftest.$ac_ext | ||
16844 | cat >>conftest.$ac_ext <<_ACEOF | ||
16845 | /* end confdefs.h. */ | ||
16846 | /* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. | ||
16847 | For example, HP-UX 11i <limits.h> declares gettimeofday. */ | ||
16848 | #define $ac_func innocuous_$ac_func | ||
16849 | |||
16850 | /* System header to define __stub macros and hopefully few prototypes, | ||
16851 | which can conflict with char $ac_func (); below. | ||
16852 | Prefer <limits.h> to <assert.h> if __STDC__ is defined, since | ||
16853 | <limits.h> exists even on freestanding compilers. */ | ||
16854 | |||
16855 | #ifdef __STDC__ | ||
16856 | # include <limits.h> | ||
16857 | #else | ||
16858 | # include <assert.h> | ||
16859 | #endif | ||
16860 | |||
16861 | #undef $ac_func | ||
16862 | |||
16863 | /* Override any GCC internal prototype to avoid an error. | ||
16864 | Use char because int might match the return type of a GCC | ||
16865 | builtin and then its argument prototype would still apply. */ | ||
16866 | #ifdef __cplusplus | ||
16867 | extern "C" | ||
16868 | #endif | ||
16869 | char $ac_func (); | ||
16870 | /* The GNU C library defines this for functions which it implements | ||
16871 | to always fail with ENOSYS. Some functions are actually named | ||
16872 | something starting with __ and the normal name is an alias. */ | ||
16873 | #if defined __stub_$ac_func || defined __stub___$ac_func | ||
16874 | choke me | ||
16875 | #endif | ||
16876 | |||
16877 | int | ||
16878 | main () | ||
16879 | { | ||
16880 | return $ac_func (); | ||
16881 | ; | ||
16882 | return 0; | ||
16883 | } | ||
16884 | _ACEOF | ||
16885 | rm -f conftest.$ac_objext conftest$ac_exeext | ||
16886 | if { (ac_try="$ac_link" | ||
16887 | case "(($ac_try" in | ||
16888 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
16889 | *) ac_try_echo=$ac_try;; | ||
16890 | esac | ||
16891 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
16892 | (eval "$ac_link") 2>conftest.er1 | ||
16893 | ac_status=$? | ||
16894 | grep -v '^ *+' conftest.er1 >conftest.err | ||
16895 | rm -f conftest.er1 | ||
16896 | cat conftest.err >&5 | ||
16897 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
16898 | (exit $ac_status); } && { | ||
16899 | test -z "$ac_c_werror_flag" || | ||
16900 | test ! -s conftest.err | ||
16901 | } && test -s conftest$ac_exeext && | ||
16902 | $as_test_x conftest$ac_exeext; then | ||
16903 | eval "$as_ac_var=yes" | ||
16904 | else | ||
16905 | echo "$as_me: failed program was:" >&5 | ||
16906 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
16907 | |||
16908 | eval "$as_ac_var=no" | ||
16909 | fi | ||
16910 | |||
16911 | rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ | ||
16912 | conftest$ac_exeext conftest.$ac_ext | ||
16913 | fi | ||
16914 | ac_res=`eval echo '${'$as_ac_var'}'` | ||
16915 | { echo "$as_me:$LINENO: result: $ac_res" >&5 | ||
16916 | echo "${ECHO_T}$ac_res" >&6; } | ||
16917 | if test `eval echo '${'$as_ac_var'}'` = yes; then | ||
16918 | cat >>confdefs.h <<_ACEOF | ||
16919 | #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 | ||
16920 | _ACEOF | ||
16921 | |||
16922 | fi | ||
16923 | done | ||
16924 | |||
16925 | LIBS="$saved_LIBS" | ||
16926 | |||
16927 | PAM_MSG="yes" | ||
16928 | |||
16929 | LIBPAM="-lpam" | ||
16930 | |||
16931 | cat >>confdefs.h <<\_ACEOF | ||
16932 | #define USE_PAM 1 | ||
16933 | _ACEOF | ||
16934 | |||
16935 | |||
16936 | if test $ac_cv_lib_dl_dlopen = yes; then | ||
16937 | case "$LIBS" in | ||
16938 | *-ldl*) | ||
16939 | # libdl already in LIBS | ||
16940 | ;; | ||
16941 | *) | ||
16942 | LIBPAM="$LIBPAM -ldl" | ||
16943 | ;; | ||
16944 | esac | ||
16945 | fi | ||
16946 | |||
16947 | fi | ||
16948 | |||
16949 | |||
16950 | fi | ||
16951 | |||
16952 | |||
16953 | # Check for older PAM | ||
16954 | if test "x$PAM_MSG" = "xyes" ; then | ||
16955 | # Check PAM strerror arguments (old PAM) | ||
16956 | { echo "$as_me:$LINENO: checking whether pam_strerror takes only one argument" >&5 | ||
16957 | echo $ECHO_N "checking whether pam_strerror takes only one argument... $ECHO_C" >&6; } | ||
16958 | cat >conftest.$ac_ext <<_ACEOF | ||
16959 | /* confdefs.h. */ | ||
16960 | _ACEOF | ||
16961 | cat confdefs.h >>conftest.$ac_ext | ||
16962 | cat >>conftest.$ac_ext <<_ACEOF | ||
16963 | /* end confdefs.h. */ | ||
16964 | |||
16965 | #include <stdlib.h> | ||
16966 | #if defined(HAVE_SECURITY_PAM_APPL_H) | ||
16967 | #include <security/pam_appl.h> | ||
16968 | #elif defined (HAVE_PAM_PAM_APPL_H) | ||
16969 | #include <pam/pam_appl.h> | ||
16970 | #endif | ||
16971 | |||
16972 | int | ||
16973 | main () | ||
16974 | { | ||
16975 | (void)pam_strerror((pam_handle_t *)NULL, -1); | ||
16976 | ; | ||
16977 | return 0; | ||
16978 | } | ||
16979 | _ACEOF | ||
16980 | rm -f conftest.$ac_objext | ||
16981 | if { (ac_try="$ac_compile" | ||
16982 | case "(($ac_try" in | ||
16983 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
16984 | *) ac_try_echo=$ac_try;; | ||
16985 | esac | ||
16986 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
16987 | (eval "$ac_compile") 2>conftest.er1 | ||
16988 | ac_status=$? | ||
16989 | grep -v '^ *+' conftest.er1 >conftest.err | ||
16990 | rm -f conftest.er1 | ||
16991 | cat conftest.err >&5 | ||
16992 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
16993 | (exit $ac_status); } && { | ||
16994 | test -z "$ac_c_werror_flag" || | ||
16995 | test ! -s conftest.err | ||
16996 | } && test -s conftest.$ac_objext; then | ||
16997 | { echo "$as_me:$LINENO: result: no" >&5 | ||
16998 | echo "${ECHO_T}no" >&6; } | ||
16999 | else | ||
17000 | echo "$as_me: failed program was:" >&5 | ||
17001 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
17002 | |||
17003 | |||
17004 | |||
17005 | cat >>confdefs.h <<\_ACEOF | ||
17006 | #define HAVE_OLD_PAM 1 | ||
17007 | _ACEOF | ||
17008 | |||
17009 | { echo "$as_me:$LINENO: result: yes" >&5 | ||
17010 | echo "${ECHO_T}yes" >&6; } | ||
17011 | PAM_MSG="yes (old library)" | ||
17012 | |||
17013 | |||
17014 | fi | ||
17015 | |||
17016 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | ||
17017 | fi | ||
16167 | 17018 | ||
16168 | # Do we want to force the use of the rand helper? | 17019 | # Do we want to force the use of the rand helper? |
16169 | 17020 | ||
@@ -19363,6 +20214,34 @@ cat >>conftest.$ac_ext <<_ACEOF | |||
19363 | #define __USE_ISOC99 | 20214 | #define __USE_ISOC99 |
19364 | #include <limits.h> | 20215 | #include <limits.h> |
19365 | #define DATA "conftest.llminmax" | 20216 | #define DATA "conftest.llminmax" |
20217 | #define my_abs(a) ((a) < 0 ? ((a) * -1) : (a)) | ||
20218 | |||
20219 | /* | ||
20220 | * printf in libc on some platforms (eg old Tru64) does not understand %lld so | ||
20221 | * we do this the hard way. | ||
20222 | */ | ||
20223 | static int | ||
20224 | fprint_ll(FILE *f, long long n) | ||
20225 | { | ||
20226 | unsigned int i; | ||
20227 | int l[sizeof(long long) * 8]; | ||
20228 | |||
20229 | if (n < 0) | ||
20230 | if (fprintf(f, "-") < 0) | ||
20231 | return -1; | ||
20232 | for (i = 0; n != 0; i++) { | ||
20233 | l[i] = my_abs(n % 10); | ||
20234 | n /= 10; | ||
20235 | } | ||
20236 | do { | ||
20237 | if (fprintf(f, "%d", l[--i]) < 0) | ||
20238 | return -1; | ||
20239 | } while (i != 0); | ||
20240 | if (fprintf(f, " ") < 0) | ||
20241 | return -1; | ||
20242 | return 0; | ||
20243 | } | ||
20244 | |||
19366 | int main(void) { | 20245 | int main(void) { |
19367 | FILE *f; | 20246 | FILE *f; |
19368 | long long i, llmin, llmax = 0; | 20247 | long long i, llmin, llmax = 0; |
@@ -19384,14 +20263,18 @@ int main(void) { | |||
19384 | 20263 | ||
19385 | /* Sanity check */ | 20264 | /* Sanity check */ |
19386 | if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax | 20265 | if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax |
19387 | || llmax - 1 > llmax) { | 20266 | || llmax - 1 > llmax || llmin == llmax || llmin == 0 |
20267 | || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) { | ||
19388 | fprintf(f, "unknown unknown\n"); | 20268 | fprintf(f, "unknown unknown\n"); |
19389 | exit(2); | 20269 | exit(2); |
19390 | } | 20270 | } |
19391 | 20271 | ||
19392 | if (fprintf(f ,"%lld %lld", llmin, llmax) < 0) | 20272 | if (fprint_ll(f, llmin) < 0) |
19393 | exit(3); | 20273 | exit(3); |
19394 | 20274 | if (fprint_ll(f, llmax) < 0) | |
20275 | exit(4); | ||
20276 | if (fclose(f) < 0) | ||
20277 | exit(5); | ||
19395 | exit(0); | 20278 | exit(0); |
19396 | } | 20279 | } |
19397 | 20280 | ||
@@ -19420,17 +20303,6 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | |||
19420 | llong_min=`$AWK '{print $1}' conftest.llminmax` | 20303 | llong_min=`$AWK '{print $1}' conftest.llminmax` |
19421 | llong_max=`$AWK '{print $2}' conftest.llminmax` | 20304 | llong_max=`$AWK '{print $2}' conftest.llminmax` |
19422 | 20305 | ||
19423 | # snprintf on some Tru64s doesn't understand "%lld" | ||
19424 | case "$host" in | ||
19425 | alpha-dec-osf*) | ||
19426 | if test "x$ac_cv_sizeof_long_long_int" = "x8" && | ||
19427 | test "x$llong_max" = "xld"; then | ||
19428 | llong_min="-9223372036854775808" | ||
19429 | llong_max="9223372036854775807" | ||
19430 | fi | ||
19431 | ;; | ||
19432 | esac | ||
19433 | |||
19434 | { echo "$as_me:$LINENO: result: $llong_max" >&5 | 20306 | { echo "$as_me:$LINENO: result: $llong_max" >&5 |
19435 | echo "${ECHO_T}$llong_max" >&6; } | 20307 | echo "${ECHO_T}$llong_max" >&6; } |
19436 | 20308 | ||
@@ -23593,7 +24465,7 @@ fi | |||
23593 | LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags` | 24465 | LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags` |
23594 | LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs` | 24466 | LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs` |
23595 | CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS" | 24467 | CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS" |
23596 | LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS" | 24468 | LIBS="$LIBS $LIBOPENSC_LIBS" |
23597 | cat >>confdefs.h <<\_ACEOF | 24469 | cat >>confdefs.h <<\_ACEOF |
23598 | #define SMARTCARD 1 | 24470 | #define SMARTCARD 1 |
23599 | _ACEOF | 24471 | _ACEOF |
@@ -24314,37 +25186,24 @@ LIBSELINUX="" | |||
24314 | # Check whether --with-selinux was given. | 25186 | # Check whether --with-selinux was given. |
24315 | if test "${with_selinux+set}" = set; then | 25187 | if test "${with_selinux+set}" = set; then |
24316 | withval=$with_selinux; if test "x$withval" != "xno" ; then | 25188 | withval=$with_selinux; if test "x$withval" != "xno" ; then |
24317 | if test "x$withval" != "xyes"; then | ||
24318 | CPPFLAGS="$CPPFLAGS -I${withval}/include" | ||
24319 | if test -n "${need_dash_r}"; then | ||
24320 | LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}" | ||
24321 | else | ||
24322 | LDFLAGS="-L${withval}/lib ${LDFLAGS}" | ||
24323 | fi | ||
24324 | fi | ||
24325 | 25189 | ||
24326 | cat >>confdefs.h <<\_ACEOF | 25190 | cat >>confdefs.h <<\_ACEOF |
24327 | #define WITH_SELINUX 1 | 25191 | #define WITH_SELINUX 1 |
24328 | _ACEOF | 25192 | _ACEOF |
24329 | 25193 | ||
24330 | SELINUX_MSG="yes" | 25194 | SELINUX_MSG="yes" |
24331 | 25195 | if test "${ac_cv_header_selinux_selinux_h+set}" = set; then | |
24332 | for ac_header in selinux/selinux.h | 25196 | { echo "$as_me:$LINENO: checking for selinux/selinux.h" >&5 |
24333 | do | 25197 | echo $ECHO_N "checking for selinux/selinux.h... $ECHO_C" >&6; } |
24334 | as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` | 25198 | if test "${ac_cv_header_selinux_selinux_h+set}" = set; then |
24335 | if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then | ||
24336 | { echo "$as_me:$LINENO: checking for $ac_header" >&5 | ||
24337 | echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } | ||
24338 | if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then | ||
24339 | echo $ECHO_N "(cached) $ECHO_C" >&6 | 25199 | echo $ECHO_N "(cached) $ECHO_C" >&6 |
24340 | fi | 25200 | fi |
24341 | ac_res=`eval echo '${'$as_ac_Header'}'` | 25201 | { echo "$as_me:$LINENO: result: $ac_cv_header_selinux_selinux_h" >&5 |
24342 | { echo "$as_me:$LINENO: result: $ac_res" >&5 | 25202 | echo "${ECHO_T}$ac_cv_header_selinux_selinux_h" >&6; } |
24343 | echo "${ECHO_T}$ac_res" >&6; } | ||
24344 | else | 25203 | else |
24345 | # Is the header compilable? | 25204 | # Is the header compilable? |
24346 | { echo "$as_me:$LINENO: checking $ac_header usability" >&5 | 25205 | { echo "$as_me:$LINENO: checking selinux/selinux.h usability" >&5 |
24347 | echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } | 25206 | echo $ECHO_N "checking selinux/selinux.h usability... $ECHO_C" >&6; } |
24348 | cat >conftest.$ac_ext <<_ACEOF | 25207 | cat >conftest.$ac_ext <<_ACEOF |
24349 | /* confdefs.h. */ | 25208 | /* confdefs.h. */ |
24350 | _ACEOF | 25209 | _ACEOF |
@@ -24352,7 +25211,7 @@ cat confdefs.h >>conftest.$ac_ext | |||
24352 | cat >>conftest.$ac_ext <<_ACEOF | 25211 | cat >>conftest.$ac_ext <<_ACEOF |
24353 | /* end confdefs.h. */ | 25212 | /* end confdefs.h. */ |
24354 | $ac_includes_default | 25213 | $ac_includes_default |
24355 | #include <$ac_header> | 25214 | #include <selinux/selinux.h> |
24356 | _ACEOF | 25215 | _ACEOF |
24357 | rm -f conftest.$ac_objext | 25216 | rm -f conftest.$ac_objext |
24358 | if { (ac_try="$ac_compile" | 25217 | if { (ac_try="$ac_compile" |
@@ -24384,15 +25243,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | |||
24384 | echo "${ECHO_T}$ac_header_compiler" >&6; } | 25243 | echo "${ECHO_T}$ac_header_compiler" >&6; } |
24385 | 25244 | ||
24386 | # Is the header present? | 25245 | # Is the header present? |
24387 | { echo "$as_me:$LINENO: checking $ac_header presence" >&5 | 25246 | { echo "$as_me:$LINENO: checking selinux/selinux.h presence" >&5 |
24388 | echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } | 25247 | echo $ECHO_N "checking selinux/selinux.h presence... $ECHO_C" >&6; } |
24389 | cat >conftest.$ac_ext <<_ACEOF | 25248 | cat >conftest.$ac_ext <<_ACEOF |
24390 | /* confdefs.h. */ | 25249 | /* confdefs.h. */ |
24391 | _ACEOF | 25250 | _ACEOF |
24392 | cat confdefs.h >>conftest.$ac_ext | 25251 | cat confdefs.h >>conftest.$ac_ext |
24393 | cat >>conftest.$ac_ext <<_ACEOF | 25252 | cat >>conftest.$ac_ext <<_ACEOF |
24394 | /* end confdefs.h. */ | 25253 | /* end confdefs.h. */ |
24395 | #include <$ac_header> | 25254 | #include <selinux/selinux.h> |
24396 | _ACEOF | 25255 | _ACEOF |
24397 | if { (ac_try="$ac_cpp conftest.$ac_ext" | 25256 | if { (ac_try="$ac_cpp conftest.$ac_ext" |
24398 | case "(($ac_try" in | 25257 | case "(($ac_try" in |
@@ -24425,25 +25284,25 @@ echo "${ECHO_T}$ac_header_preproc" >&6; } | |||
24425 | # So? What about this header? | 25284 | # So? What about this header? |
24426 | case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in | 25285 | case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in |
24427 | yes:no: ) | 25286 | yes:no: ) |
24428 | { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 | 25287 | { echo "$as_me:$LINENO: WARNING: selinux/selinux.h: accepted by the compiler, rejected by the preprocessor!" >&5 |
24429 | echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} | 25288 | echo "$as_me: WARNING: selinux/selinux.h: accepted by the compiler, rejected by the preprocessor!" >&2;} |
24430 | { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 | 25289 | { echo "$as_me:$LINENO: WARNING: selinux/selinux.h: proceeding with the compiler's result" >&5 |
24431 | echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} | 25290 | echo "$as_me: WARNING: selinux/selinux.h: proceeding with the compiler's result" >&2;} |
24432 | ac_header_preproc=yes | 25291 | ac_header_preproc=yes |
24433 | ;; | 25292 | ;; |
24434 | no:yes:* ) | 25293 | no:yes:* ) |
24435 | { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 | 25294 | { echo "$as_me:$LINENO: WARNING: selinux/selinux.h: present but cannot be compiled" >&5 |
24436 | echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} | 25295 | echo "$as_me: WARNING: selinux/selinux.h: present but cannot be compiled" >&2;} |
24437 | { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 | 25296 | { echo "$as_me:$LINENO: WARNING: selinux/selinux.h: check for missing prerequisite headers?" >&5 |
24438 | echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} | 25297 | echo "$as_me: WARNING: selinux/selinux.h: check for missing prerequisite headers?" >&2;} |
24439 | { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 | 25298 | { echo "$as_me:$LINENO: WARNING: selinux/selinux.h: see the Autoconf documentation" >&5 |
24440 | echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} | 25299 | echo "$as_me: WARNING: selinux/selinux.h: see the Autoconf documentation" >&2;} |
24441 | { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 | 25300 | { echo "$as_me:$LINENO: WARNING: selinux/selinux.h: section \"Present But Cannot Be Compiled\"" >&5 |
24442 | echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} | 25301 | echo "$as_me: WARNING: selinux/selinux.h: section \"Present But Cannot Be Compiled\"" >&2;} |
24443 | { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 | 25302 | { echo "$as_me:$LINENO: WARNING: selinux/selinux.h: proceeding with the preprocessor's result" >&5 |
24444 | echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} | 25303 | echo "$as_me: WARNING: selinux/selinux.h: proceeding with the preprocessor's result" >&2;} |
24445 | { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 | 25304 | { echo "$as_me:$LINENO: WARNING: selinux/selinux.h: in the future, the compiler will take precedence" >&5 |
24446 | echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} | 25305 | echo "$as_me: WARNING: selinux/selinux.h: in the future, the compiler will take precedence" >&2;} |
24447 | ( cat <<\_ASBOX | 25306 | ( cat <<\_ASBOX |
24448 | ## ------------------------------------------- ## | 25307 | ## ------------------------------------------- ## |
24449 | ## Report this to openssh-unix-dev@mindrot.org ## | 25308 | ## Report this to openssh-unix-dev@mindrot.org ## |
@@ -24452,28 +25311,193 @@ _ASBOX | |||
24452 | ) | sed "s/^/$as_me: WARNING: /" >&2 | 25311 | ) | sed "s/^/$as_me: WARNING: /" >&2 |
24453 | ;; | 25312 | ;; |
24454 | esac | 25313 | esac |
24455 | { echo "$as_me:$LINENO: checking for $ac_header" >&5 | 25314 | { echo "$as_me:$LINENO: checking for selinux/selinux.h" >&5 |
24456 | echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } | 25315 | echo $ECHO_N "checking for selinux/selinux.h... $ECHO_C" >&6; } |
24457 | if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then | 25316 | if test "${ac_cv_header_selinux_selinux_h+set}" = set; then |
24458 | echo $ECHO_N "(cached) $ECHO_C" >&6 | 25317 | echo $ECHO_N "(cached) $ECHO_C" >&6 |
24459 | else | 25318 | else |
24460 | eval "$as_ac_Header=\$ac_header_preproc" | 25319 | ac_cv_header_selinux_selinux_h=$ac_header_preproc |
24461 | fi | 25320 | fi |
24462 | ac_res=`eval echo '${'$as_ac_Header'}'` | 25321 | { echo "$as_me:$LINENO: result: $ac_cv_header_selinux_selinux_h" >&5 |
24463 | { echo "$as_me:$LINENO: result: $ac_res" >&5 | 25322 | echo "${ECHO_T}$ac_cv_header_selinux_selinux_h" >&6; } |
24464 | echo "${ECHO_T}$ac_res" >&6; } | ||
24465 | 25323 | ||
24466 | fi | 25324 | fi |
24467 | if test `eval echo '${'$as_ac_Header'}'` = yes; then | 25325 | if test $ac_cv_header_selinux_selinux_h = yes; then |
24468 | cat >>confdefs.h <<_ACEOF | 25326 | : |
24469 | #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 | 25327 | else |
25328 | { { echo "$as_me:$LINENO: error: SELinux support requires selinux.h header" >&5 | ||
25329 | echo "$as_me: error: SELinux support requires selinux.h header" >&2;} | ||
25330 | { (exit 1); exit 1; }; } | ||
25331 | fi | ||
25332 | |||
25333 | |||
25334 | { echo "$as_me:$LINENO: checking for setexeccon in -lselinux" >&5 | ||
25335 | echo $ECHO_N "checking for setexeccon in -lselinux... $ECHO_C" >&6; } | ||
25336 | if test "${ac_cv_lib_selinux_setexeccon+set}" = set; then | ||
25337 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
25338 | else | ||
25339 | ac_check_lib_save_LIBS=$LIBS | ||
25340 | LIBS="-lselinux $LIBS" | ||
25341 | cat >conftest.$ac_ext <<_ACEOF | ||
25342 | /* confdefs.h. */ | ||
25343 | _ACEOF | ||
25344 | cat confdefs.h >>conftest.$ac_ext | ||
25345 | cat >>conftest.$ac_ext <<_ACEOF | ||
25346 | /* end confdefs.h. */ | ||
25347 | |||
25348 | /* Override any GCC internal prototype to avoid an error. | ||
25349 | Use char because int might match the return type of a GCC | ||
25350 | builtin and then its argument prototype would still apply. */ | ||
25351 | #ifdef __cplusplus | ||
25352 | extern "C" | ||
25353 | #endif | ||
25354 | char setexeccon (); | ||
25355 | int | ||
25356 | main () | ||
25357 | { | ||
25358 | return setexeccon (); | ||
25359 | ; | ||
25360 | return 0; | ||
25361 | } | ||
24470 | _ACEOF | 25362 | _ACEOF |
25363 | rm -f conftest.$ac_objext conftest$ac_exeext | ||
25364 | if { (ac_try="$ac_link" | ||
25365 | case "(($ac_try" in | ||
25366 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
25367 | *) ac_try_echo=$ac_try;; | ||
25368 | esac | ||
25369 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
25370 | (eval "$ac_link") 2>conftest.er1 | ||
25371 | ac_status=$? | ||
25372 | grep -v '^ *+' conftest.er1 >conftest.err | ||
25373 | rm -f conftest.er1 | ||
25374 | cat conftest.err >&5 | ||
25375 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
25376 | (exit $ac_status); } && { | ||
25377 | test -z "$ac_c_werror_flag" || | ||
25378 | test ! -s conftest.err | ||
25379 | } && test -s conftest$ac_exeext && | ||
25380 | $as_test_x conftest$ac_exeext; then | ||
25381 | ac_cv_lib_selinux_setexeccon=yes | ||
25382 | else | ||
25383 | echo "$as_me: failed program was:" >&5 | ||
25384 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
24471 | 25385 | ||
25386 | ac_cv_lib_selinux_setexeccon=no | ||
25387 | fi | ||
25388 | |||
25389 | rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ | ||
25390 | conftest$ac_exeext conftest.$ac_ext | ||
25391 | LIBS=$ac_check_lib_save_LIBS | ||
25392 | fi | ||
25393 | { echo "$as_me:$LINENO: result: $ac_cv_lib_selinux_setexeccon" >&5 | ||
25394 | echo "${ECHO_T}$ac_cv_lib_selinux_setexeccon" >&6; } | ||
25395 | if test $ac_cv_lib_selinux_setexeccon = yes; then | ||
25396 | LIBSELINUX="-lselinux" | ||
25397 | else | ||
25398 | { { echo "$as_me:$LINENO: error: SELinux support requires libselinux library" >&5 | ||
25399 | echo "$as_me: error: SELinux support requires libselinux library" >&2;} | ||
25400 | { (exit 1); exit 1; }; } | ||
24472 | fi | 25401 | fi |
24473 | 25402 | ||
25403 | save_LIBS="$LIBS" | ||
25404 | LIBS="$LIBS $LIBSELINUX" | ||
25405 | |||
25406 | |||
25407 | for ac_func in getseuserbyname get_default_context_with_level | ||
25408 | do | ||
25409 | as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` | ||
25410 | { echo "$as_me:$LINENO: checking for $ac_func" >&5 | ||
25411 | echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } | ||
25412 | if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then | ||
25413 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
25414 | else | ||
25415 | cat >conftest.$ac_ext <<_ACEOF | ||
25416 | /* confdefs.h. */ | ||
25417 | _ACEOF | ||
25418 | cat confdefs.h >>conftest.$ac_ext | ||
25419 | cat >>conftest.$ac_ext <<_ACEOF | ||
25420 | /* end confdefs.h. */ | ||
25421 | /* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. | ||
25422 | For example, HP-UX 11i <limits.h> declares gettimeofday. */ | ||
25423 | #define $ac_func innocuous_$ac_func | ||
25424 | |||
25425 | /* System header to define __stub macros and hopefully few prototypes, | ||
25426 | which can conflict with char $ac_func (); below. | ||
25427 | Prefer <limits.h> to <assert.h> if __STDC__ is defined, since | ||
25428 | <limits.h> exists even on freestanding compilers. */ | ||
25429 | |||
25430 | #ifdef __STDC__ | ||
25431 | # include <limits.h> | ||
25432 | #else | ||
25433 | # include <assert.h> | ||
25434 | #endif | ||
25435 | |||
25436 | #undef $ac_func | ||
25437 | |||
25438 | /* Override any GCC internal prototype to avoid an error. | ||
25439 | Use char because int might match the return type of a GCC | ||
25440 | builtin and then its argument prototype would still apply. */ | ||
25441 | #ifdef __cplusplus | ||
25442 | extern "C" | ||
25443 | #endif | ||
25444 | char $ac_func (); | ||
25445 | /* The GNU C library defines this for functions which it implements | ||
25446 | to always fail with ENOSYS. Some functions are actually named | ||
25447 | something starting with __ and the normal name is an alias. */ | ||
25448 | #if defined __stub_$ac_func || defined __stub___$ac_func | ||
25449 | choke me | ||
25450 | #endif | ||
25451 | |||
25452 | int | ||
25453 | main () | ||
25454 | { | ||
25455 | return $ac_func (); | ||
25456 | ; | ||
25457 | return 0; | ||
25458 | } | ||
25459 | _ACEOF | ||
25460 | rm -f conftest.$ac_objext conftest$ac_exeext | ||
25461 | if { (ac_try="$ac_link" | ||
25462 | case "(($ac_try" in | ||
25463 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
25464 | *) ac_try_echo=$ac_try;; | ||
25465 | esac | ||
25466 | eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 | ||
25467 | (eval "$ac_link") 2>conftest.er1 | ||
25468 | ac_status=$? | ||
25469 | grep -v '^ *+' conftest.er1 >conftest.err | ||
25470 | rm -f conftest.er1 | ||
25471 | cat conftest.err >&5 | ||
25472 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
25473 | (exit $ac_status); } && { | ||
25474 | test -z "$ac_c_werror_flag" || | ||
25475 | test ! -s conftest.err | ||
25476 | } && test -s conftest$ac_exeext && | ||
25477 | $as_test_x conftest$ac_exeext; then | ||
25478 | eval "$as_ac_var=yes" | ||
25479 | else | ||
25480 | echo "$as_me: failed program was:" >&5 | ||
25481 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
25482 | |||
25483 | eval "$as_ac_var=no" | ||
25484 | fi | ||
25485 | |||
25486 | rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ | ||
25487 | conftest$ac_exeext conftest.$ac_ext | ||
25488 | fi | ||
25489 | ac_res=`eval echo '${'$as_ac_var'}'` | ||
25490 | { echo "$as_me:$LINENO: result: $ac_res" >&5 | ||
25491 | echo "${ECHO_T}$ac_res" >&6; } | ||
25492 | if test `eval echo '${'$as_ac_var'}'` = yes; then | ||
25493 | cat >>confdefs.h <<_ACEOF | ||
25494 | #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 | ||
25495 | _ACEOF | ||
25496 | |||
25497 | fi | ||
24474 | done | 25498 | done |
24475 | 25499 | ||
24476 | LIBSELINUX="-lselinux" | 25500 | LIBS="$save_LIBS" |
24477 | fi | 25501 | fi |
24478 | 25502 | ||
24479 | fi | 25503 | fi |
@@ -27187,17 +28211,10 @@ if test ! -z "$blibpath" ; then | |||
27187 | echo "$as_me: WARNING: Please check and edit blibpath in LDFLAGS in Makefile" >&2;} | 28211 | echo "$as_me: WARNING: Please check and edit blibpath in LDFLAGS in Makefile" >&2;} |
27188 | fi | 28212 | fi |
27189 | 28213 | ||
27190 | if test "$PAM_MSG" = yes ; then | ||
27191 | LIBS=`echo $LIBS | sed 's/-lpam //'` | ||
27192 | fi | ||
27193 | if test "$ac_cv_lib_pam_pam_set_item" = yes ; then | ||
27194 | LIBS=`echo $LIBS | sed 's/-ldl //'` | ||
27195 | fi | ||
27196 | |||
27197 | CFLAGS="$CFLAGS $werror_flags" | 28214 | CFLAGS="$CFLAGS $werror_flags" |
27198 | 28215 | ||
27199 | 28216 | ||
27200 | ac_config_files="$ac_config_files Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile scard/Makefile ssh_prng_cmds survey.sh" | 28217 | ac_config_files="$ac_config_files Makefile buildpkg.sh opensshd.init openssh.xml openbsd-compat/Makefile openbsd-compat/regress/Makefile scard/Makefile ssh_prng_cmds survey.sh" |
27201 | 28218 | ||
27202 | cat >confcache <<\_ACEOF | 28219 | cat >confcache <<\_ACEOF |
27203 | # This file is a shell script that caches the results of configure | 28220 | # This file is a shell script that caches the results of configure |
@@ -27756,7 +28773,9 @@ do | |||
27756 | "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; | 28773 | "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; |
27757 | "buildpkg.sh") CONFIG_FILES="$CONFIG_FILES buildpkg.sh" ;; | 28774 | "buildpkg.sh") CONFIG_FILES="$CONFIG_FILES buildpkg.sh" ;; |
27758 | "opensshd.init") CONFIG_FILES="$CONFIG_FILES opensshd.init" ;; | 28775 | "opensshd.init") CONFIG_FILES="$CONFIG_FILES opensshd.init" ;; |
28776 | "openssh.xml") CONFIG_FILES="$CONFIG_FILES openssh.xml" ;; | ||
27759 | "openbsd-compat/Makefile") CONFIG_FILES="$CONFIG_FILES openbsd-compat/Makefile" ;; | 28777 | "openbsd-compat/Makefile") CONFIG_FILES="$CONFIG_FILES openbsd-compat/Makefile" ;; |
28778 | "openbsd-compat/regress/Makefile") CONFIG_FILES="$CONFIG_FILES openbsd-compat/regress/Makefile" ;; | ||
27760 | "scard/Makefile") CONFIG_FILES="$CONFIG_FILES scard/Makefile" ;; | 28779 | "scard/Makefile") CONFIG_FILES="$CONFIG_FILES scard/Makefile" ;; |
27761 | "ssh_prng_cmds") CONFIG_FILES="$CONFIG_FILES ssh_prng_cmds" ;; | 28780 | "ssh_prng_cmds") CONFIG_FILES="$CONFIG_FILES ssh_prng_cmds" ;; |
27762 | "survey.sh") CONFIG_FILES="$CONFIG_FILES survey.sh" ;; | 28781 | "survey.sh") CONFIG_FILES="$CONFIG_FILES survey.sh" ;; |
@@ -27897,6 +28916,7 @@ STARTUP_SCRIPT_SHELL!$STARTUP_SCRIPT_SHELL$ac_delim | |||
27897 | LOGIN_PROGRAM_FALLBACK!$LOGIN_PROGRAM_FALLBACK$ac_delim | 28916 | LOGIN_PROGRAM_FALLBACK!$LOGIN_PROGRAM_FALLBACK$ac_delim |
27898 | PATH_PASSWD_PROG!$PATH_PASSWD_PROG$ac_delim | 28917 | PATH_PASSWD_PROG!$PATH_PASSWD_PROG$ac_delim |
27899 | LD!$LD$ac_delim | 28918 | LD!$LD$ac_delim |
28919 | SSHDLIBS!$SSHDLIBS$ac_delim | ||
27900 | LIBWRAP!$LIBWRAP$ac_delim | 28920 | LIBWRAP!$LIBWRAP$ac_delim |
27901 | LIBEDIT!$LIBEDIT$ac_delim | 28921 | LIBEDIT!$LIBEDIT$ac_delim |
27902 | LIBPAM!$LIBPAM$ac_delim | 28922 | LIBPAM!$LIBPAM$ac_delim |
@@ -27917,7 +28937,6 @@ PROG_DF!$PROG_DF$ac_delim | |||
27917 | PROG_VMSTAT!$PROG_VMSTAT$ac_delim | 28937 | PROG_VMSTAT!$PROG_VMSTAT$ac_delim |
27918 | PROG_UPTIME!$PROG_UPTIME$ac_delim | 28938 | PROG_UPTIME!$PROG_UPTIME$ac_delim |
27919 | PROG_IPCS!$PROG_IPCS$ac_delim | 28939 | PROG_IPCS!$PROG_IPCS$ac_delim |
27920 | PROG_TAIL!$PROG_TAIL$ac_delim | ||
27921 | _ACEOF | 28940 | _ACEOF |
27922 | 28941 | ||
27923 | if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then | 28942 | if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then |
@@ -27959,6 +28978,7 @@ _ACEOF | |||
27959 | ac_delim='%!_!# ' | 28978 | ac_delim='%!_!# ' |
27960 | for ac_last_try in false false false false false :; do | 28979 | for ac_last_try in false false false false false :; do |
27961 | cat >conf$$subs.sed <<_ACEOF | 28980 | cat >conf$$subs.sed <<_ACEOF |
28981 | PROG_TAIL!$PROG_TAIL$ac_delim | ||
27962 | INSTALL_SSH_PRNG_CMDS!$INSTALL_SSH_PRNG_CMDS$ac_delim | 28982 | INSTALL_SSH_PRNG_CMDS!$INSTALL_SSH_PRNG_CMDS$ac_delim |
27963 | OPENSC_CONFIG!$OPENSC_CONFIG$ac_delim | 28983 | OPENSC_CONFIG!$OPENSC_CONFIG$ac_delim |
27964 | LIBSELINUX!$LIBSELINUX$ac_delim | 28984 | LIBSELINUX!$LIBSELINUX$ac_delim |
@@ -27975,7 +28995,7 @@ LIBOBJS!$LIBOBJS$ac_delim | |||
27975 | LTLIBOBJS!$LTLIBOBJS$ac_delim | 28995 | LTLIBOBJS!$LTLIBOBJS$ac_delim |
27976 | _ACEOF | 28996 | _ACEOF |
27977 | 28997 | ||
27978 | if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 14; then | 28998 | if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 15; then |
27979 | break | 28999 | break |
27980 | elif $ac_last_try; then | 29000 | elif $ac_last_try; then |
27981 | { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 | 29001 | { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 |
@@ -28443,6 +29463,7 @@ echo " sshd superuser user PATH: $J" | |||
28443 | fi | 29463 | fi |
28444 | echo " Manpage format: $MANTYPE" | 29464 | echo " Manpage format: $MANTYPE" |
28445 | echo " PAM support: $PAM_MSG" | 29465 | echo " PAM support: $PAM_MSG" |
29466 | echo " OSF SIA support: $SIA_MSG" | ||
28446 | echo " KerberosV support: $KRB5_MSG" | 29467 | echo " KerberosV support: $KRB5_MSG" |
28447 | echo " SELinux support: $SELINUX_MSG" | 29468 | echo " SELinux support: $SELINUX_MSG" |
28448 | echo " Smartcard support: $SCARD_MSG" | 29469 | echo " Smartcard support: $SCARD_MSG" |
@@ -28450,6 +29471,7 @@ echo " S/KEY support: $SKEY_MSG" | |||
28450 | echo " TCP Wrappers support: $TCPW_MSG" | 29471 | echo " TCP Wrappers support: $TCPW_MSG" |
28451 | echo " MD5 password support: $MD5_MSG" | 29472 | echo " MD5 password support: $MD5_MSG" |
28452 | echo " libedit support: $LIBEDIT_MSG" | 29473 | echo " libedit support: $LIBEDIT_MSG" |
29474 | echo " Solaris process contract support: $SPC_MSG" | ||
28453 | echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG" | 29475 | echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG" |
28454 | echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG" | 29476 | echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG" |
28455 | echo " BSD Auth support: $BSD_AUTH_MSG" | 29477 | echo " BSD Auth support: $BSD_AUTH_MSG" |
diff --git a/configure.ac b/configure.ac index 86f0f1c41..05ccc2f7e 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -1,4 +1,4 @@ | |||
1 | # $Id: configure.ac,v 1.322.2.6 2006/02/08 11:11:06 dtucker Exp $ | 1 | # $Id: configure.ac,v 1.372 2007/03/05 00:51:27 djm Exp $ |
2 | # | 2 | # |
3 | # Copyright (c) 1999-2004 Damien Miller | 3 | # Copyright (c) 1999-2004 Damien Miller |
4 | # | 4 | # |
@@ -15,7 +15,7 @@ | |||
15 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
16 | 16 | ||
17 | AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org) | 17 | AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org) |
18 | AC_REVISION($Revision: 1.322.2.6 $) | 18 | AC_REVISION($Revision: 1.372 $) |
19 | AC_CONFIG_SRCDIR([ssh.c]) | 19 | AC_CONFIG_SRCDIR([ssh.c]) |
20 | 20 | ||
21 | AC_CONFIG_HEADER(config.h) | 21 | AC_CONFIG_HEADER(config.h) |
@@ -127,15 +127,175 @@ AC_ARG_WITH(rpath, | |||
127 | ] | 127 | ] |
128 | ) | 128 | ) |
129 | 129 | ||
130 | # Allow user to specify flags | ||
131 | AC_ARG_WITH(cflags, | ||
132 | [ --with-cflags Specify additional flags to pass to compiler], | ||
133 | [ | ||
134 | if test -n "$withval" && test "x$withval" != "xno" && \ | ||
135 | test "x${withval}" != "xyes"; then | ||
136 | CFLAGS="$CFLAGS $withval" | ||
137 | fi | ||
138 | ] | ||
139 | ) | ||
140 | AC_ARG_WITH(cppflags, | ||
141 | [ --with-cppflags Specify additional flags to pass to preprocessor] , | ||
142 | [ | ||
143 | if test -n "$withval" && test "x$withval" != "xno" && \ | ||
144 | test "x${withval}" != "xyes"; then | ||
145 | CPPFLAGS="$CPPFLAGS $withval" | ||
146 | fi | ||
147 | ] | ||
148 | ) | ||
149 | AC_ARG_WITH(ldflags, | ||
150 | [ --with-ldflags Specify additional flags to pass to linker], | ||
151 | [ | ||
152 | if test -n "$withval" && test "x$withval" != "xno" && \ | ||
153 | test "x${withval}" != "xyes"; then | ||
154 | LDFLAGS="$LDFLAGS $withval" | ||
155 | fi | ||
156 | ] | ||
157 | ) | ||
158 | AC_ARG_WITH(libs, | ||
159 | [ --with-libs Specify additional libraries to link with], | ||
160 | [ | ||
161 | if test -n "$withval" && test "x$withval" != "xno" && \ | ||
162 | test "x${withval}" != "xyes"; then | ||
163 | LIBS="$LIBS $withval" | ||
164 | fi | ||
165 | ] | ||
166 | ) | ||
167 | AC_ARG_WITH(Werror, | ||
168 | [ --with-Werror Build main code with -Werror], | ||
169 | [ | ||
170 | if test -n "$withval" && test "x$withval" != "xno"; then | ||
171 | werror_flags="-Werror" | ||
172 | if test "x${withval}" != "xyes"; then | ||
173 | werror_flags="$withval" | ||
174 | fi | ||
175 | fi | ||
176 | ] | ||
177 | ) | ||
178 | |||
179 | AC_CHECK_HEADERS( \ | ||
180 | bstring.h \ | ||
181 | crypt.h \ | ||
182 | crypto/sha2.h \ | ||
183 | dirent.h \ | ||
184 | endian.h \ | ||
185 | features.h \ | ||
186 | fcntl.h \ | ||
187 | floatingpoint.h \ | ||
188 | getopt.h \ | ||
189 | glob.h \ | ||
190 | ia.h \ | ||
191 | iaf.h \ | ||
192 | limits.h \ | ||
193 | login.h \ | ||
194 | maillock.h \ | ||
195 | ndir.h \ | ||
196 | net/if_tun.h \ | ||
197 | netdb.h \ | ||
198 | netgroup.h \ | ||
199 | pam/pam_appl.h \ | ||
200 | paths.h \ | ||
201 | pty.h \ | ||
202 | readpassphrase.h \ | ||
203 | rpc/types.h \ | ||
204 | security/pam_appl.h \ | ||
205 | sha2.h \ | ||
206 | shadow.h \ | ||
207 | stddef.h \ | ||
208 | stdint.h \ | ||
209 | string.h \ | ||
210 | strings.h \ | ||
211 | sys/audit.h \ | ||
212 | sys/bitypes.h \ | ||
213 | sys/bsdtty.h \ | ||
214 | sys/cdefs.h \ | ||
215 | sys/dir.h \ | ||
216 | sys/mman.h \ | ||
217 | sys/ndir.h \ | ||
218 | sys/prctl.h \ | ||
219 | sys/pstat.h \ | ||
220 | sys/select.h \ | ||
221 | sys/stat.h \ | ||
222 | sys/stream.h \ | ||
223 | sys/stropts.h \ | ||
224 | sys/strtio.h \ | ||
225 | sys/sysmacros.h \ | ||
226 | sys/time.h \ | ||
227 | sys/timers.h \ | ||
228 | sys/un.h \ | ||
229 | time.h \ | ||
230 | tmpdir.h \ | ||
231 | ttyent.h \ | ||
232 | unistd.h \ | ||
233 | usersec.h \ | ||
234 | util.h \ | ||
235 | utime.h \ | ||
236 | utmp.h \ | ||
237 | utmpx.h \ | ||
238 | vis.h \ | ||
239 | ) | ||
240 | |||
241 | # lastlog.h requires sys/time.h to be included first on Solaris | ||
242 | AC_CHECK_HEADERS(lastlog.h, [], [], [ | ||
243 | #ifdef HAVE_SYS_TIME_H | ||
244 | # include <sys/time.h> | ||
245 | #endif | ||
246 | ]) | ||
247 | |||
248 | # sys/ptms.h requires sys/stream.h to be included first on Solaris | ||
249 | AC_CHECK_HEADERS(sys/ptms.h, [], [], [ | ||
250 | #ifdef HAVE_SYS_STREAM_H | ||
251 | # include <sys/stream.h> | ||
252 | #endif | ||
253 | ]) | ||
254 | |||
255 | # login_cap.h requires sys/types.h on NetBSD | ||
256 | AC_CHECK_HEADERS(login_cap.h, [], [], [ | ||
257 | #include <sys/types.h> | ||
258 | ]) | ||
259 | |||
260 | # Messages for features tested for in target-specific section | ||
261 | SIA_MSG="no" | ||
262 | SPC_MSG="no" | ||
263 | |||
130 | # Check for some target-specific stuff | 264 | # Check for some target-specific stuff |
131 | case "$host" in | 265 | case "$host" in |
132 | *-*-aix*) | 266 | *-*-aix*) |
267 | # Some versions of VAC won't allow macro redefinitions at | ||
268 | # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that | ||
269 | # particularly with older versions of vac or xlc. | ||
270 | # It also throws errors about null macro argments, but these are | ||
271 | # not fatal. | ||
272 | AC_MSG_CHECKING(if compiler allows macro redefinitions) | ||
273 | AC_COMPILE_IFELSE( | ||
274 | [AC_LANG_SOURCE([[ | ||
275 | #define testmacro foo | ||
276 | #define testmacro bar | ||
277 | int main(void) { exit(0); } | ||
278 | ]])], | ||
279 | [ AC_MSG_RESULT(yes) ], | ||
280 | [ AC_MSG_RESULT(no) | ||
281 | CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`" | ||
282 | LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`" | ||
283 | CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`" | ||
284 | CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`" | ||
285 | ] | ||
286 | ) | ||
287 | |||
133 | AC_MSG_CHECKING([how to specify blibpath for linker ($LD)]) | 288 | AC_MSG_CHECKING([how to specify blibpath for linker ($LD)]) |
134 | if (test -z "$blibpath"); then | 289 | if (test -z "$blibpath"); then |
135 | blibpath="/usr/lib:/lib" | 290 | blibpath="/usr/lib:/lib" |
136 | fi | 291 | fi |
137 | saved_LDFLAGS="$LDFLAGS" | 292 | saved_LDFLAGS="$LDFLAGS" |
138 | for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do | 293 | if test "$GCC" = "yes"; then |
294 | flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:" | ||
295 | else | ||
296 | flags="-blibpath: -Wl,-blibpath: -Wl,-rpath," | ||
297 | fi | ||
298 | for tryflags in $flags ;do | ||
139 | if (test -z "$blibflags"); then | 299 | if (test -z "$blibflags"); then |
140 | LDFLAGS="$saved_LDFLAGS $tryflags$blibpath" | 300 | LDFLAGS="$saved_LDFLAGS $tryflags$blibpath" |
141 | AC_TRY_LINK([], [], [blibflags=$tryflags]) | 301 | AC_TRY_LINK([], [], [blibflags=$tryflags]) |
@@ -175,6 +335,12 @@ case "$host" in | |||
175 | [#include <usersec.h>] | 335 | [#include <usersec.h>] |
176 | ) | 336 | ) |
177 | AC_CHECK_FUNCS(setauthdb) | 337 | AC_CHECK_FUNCS(setauthdb) |
338 | AC_CHECK_DECL(F_CLOSEM, | ||
339 | AC_DEFINE(HAVE_FCNTL_CLOSEM, 1, [Use F_CLOSEM fcntl for closefrom]), | ||
340 | [], | ||
341 | [ #include <limits.h> | ||
342 | #include <fcntl.h> ] | ||
343 | ) | ||
178 | check_for_aix_broken_getaddrinfo=1 | 344 | check_for_aix_broken_getaddrinfo=1 |
179 | AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.]) | 345 | AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.]) |
180 | AC_DEFINE(SETEUID_BREAKS_SETUID, 1, | 346 | AC_DEFINE(SETEUID_BREAKS_SETUID, 1, |
@@ -190,10 +356,11 @@ case "$host" in | |||
190 | supported by bsd-setproctitle.c]) | 356 | supported by bsd-setproctitle.c]) |
191 | AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1, | 357 | AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1, |
192 | [AIX 5.2 and 5.3 (and presumably newer) require this]) | 358 | [AIX 5.2 and 5.3 (and presumably newer) require this]) |
359 | AC_DEFINE(PTY_ZEROREAD, 1, [read(1) can return 0 for a non-closed fd]) | ||
193 | ;; | 360 | ;; |
194 | *-*-cygwin*) | 361 | *-*-cygwin*) |
195 | check_for_libcrypt_later=1 | 362 | check_for_libcrypt_later=1 |
196 | LIBS="$LIBS /usr/lib/textmode.o" | 363 | LIBS="$LIBS /usr/lib/textreadmode.o" |
197 | AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin]) | 364 | AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin]) |
198 | AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()]) | 365 | AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()]) |
199 | AC_DEFINE(DISABLE_SHADOW, 1, | 366 | AC_DEFINE(DISABLE_SHADOW, 1, |
@@ -231,30 +398,38 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16)) | |||
231 | AC_DEFINE(BROKEN_SETREGID) | 398 | AC_DEFINE(BROKEN_SETREGID) |
232 | AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1, | 399 | AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1, |
233 | [Define if your resolver libs need this for getrrsetbyname]) | 400 | [Define if your resolver libs need this for getrrsetbyname]) |
234 | AC_MSG_CHECKING(if we have the Security Authorization Session API) | 401 | AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way]) |
235 | AC_TRY_COMPILE([#include <Security/AuthSession.h>], | 402 | AC_DEFINE(SSH_TUN_COMPAT_AF, 1, |
236 | [SessionCreate(0, 0);], | 403 | [Use tunnel device compatibility to OpenBSD]) |
237 | [ac_cv_use_security_session_api="yes" | 404 | AC_DEFINE(SSH_TUN_PREPEND_AF, 1, |
238 | AC_DEFINE(USE_SECURITY_SESSION_API, 1, | 405 | [Prepend the address family to IP tunnel traffic]) |
406 | AC_MSG_CHECKING(if we have the Security Authorization Session API) | ||
407 | AC_TRY_COMPILE([#include <Security/AuthSession.h>], | ||
408 | [SessionCreate(0, 0);], | ||
409 | [ac_cv_use_security_session_api="yes" | ||
410 | AC_DEFINE(USE_SECURITY_SESSION_API, 1, | ||
239 | [platform has the Security Authorization Session API]) | 411 | [platform has the Security Authorization Session API]) |
240 | LIBS="$LIBS -framework Security" | 412 | LIBS="$LIBS -framework Security" |
241 | AC_MSG_RESULT(yes)], | 413 | AC_MSG_RESULT(yes)], |
242 | [ac_cv_use_security_session_api="no" | 414 | [ac_cv_use_security_session_api="no" |
243 | AC_MSG_RESULT(no)]) | 415 | AC_MSG_RESULT(no)]) |
244 | AC_MSG_CHECKING(if we have an in-memory credentials cache) | 416 | AC_MSG_CHECKING(if we have an in-memory credentials cache) |
245 | AC_TRY_COMPILE( | 417 | AC_TRY_COMPILE( |
246 | [#include <Kerberos/Kerberos.h>], | 418 | [#include <Kerberos/Kerberos.h>], |
247 | [cc_context_t c; | 419 | [cc_context_t c; |
248 | (void) cc_initialize (&c, 0, NULL, NULL);], | 420 | (void) cc_initialize (&c, 0, NULL, NULL);], |
249 | [AC_DEFINE(USE_CCAPI, 1, | 421 | [AC_DEFINE(USE_CCAPI, 1, |
250 | [platform uses an in-memory credentials cache]) | 422 | [platform uses an in-memory credentials cache]) |
251 | LIBS="$LIBS -framework Security" | 423 | LIBS="$LIBS -framework Security" |
252 | AC_MSG_RESULT(yes) | 424 | AC_MSG_RESULT(yes) |
253 | if test "x$ac_cv_use_security_session_api" = "xno"; then | 425 | if test "x$ac_cv_use_security_session_api" = "xno"; then |
254 | AC_MSG_ERROR(*** Need a security framework to use the credentials cache API ***) | 426 | AC_MSG_ERROR(*** Need a security framework to use the credentials cache API ***) |
255 | fi], | 427 | fi], |
256 | [AC_MSG_RESULT(no)] | 428 | [AC_MSG_RESULT(no)] |
257 | ) | 429 | ) |
430 | ;; | ||
431 | *-*-dragonfly*) | ||
432 | SSHDLIBS="$SSHDLIBS -lcrypt" | ||
258 | ;; | 433 | ;; |
259 | *-*-hpux*) | 434 | *-*-hpux*) |
260 | # first we define all of the options common to all HP-UX releases | 435 | # first we define all of the options common to all HP-UX releases |
@@ -417,6 +592,8 @@ mips-sony-bsd|mips-sony-newsos4) | |||
417 | AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel]) | 592 | AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel]) |
418 | AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded]) | 593 | AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded]) |
419 | AC_DEFINE(SSH_TUN_OPENBSD, 1, [Open tunnel devices the OpenBSD way]) | 594 | AC_DEFINE(SSH_TUN_OPENBSD, 1, [Open tunnel devices the OpenBSD way]) |
595 | AC_DEFINE(SYSLOG_R_SAFE_IN_SIGHAND, 1, | ||
596 | [syslog_r function is safe to use in in a signal handler]) | ||
420 | ;; | 597 | ;; |
421 | *-*-solaris*) | 598 | *-*-solaris*) |
422 | if test "x$withval" != "xno" ; then | 599 | if test "x$withval" != "xno" ; then |
@@ -436,6 +613,8 @@ mips-sony-bsd|mips-sony-newsos4) | |||
436 | AC_DEFINE(SSHD_ACQUIRES_CTTY, 1, | 613 | AC_DEFINE(SSHD_ACQUIRES_CTTY, 1, |
437 | [Define if sshd somehow reacquires a controlling TTY | 614 | [Define if sshd somehow reacquires a controlling TTY |
438 | after setsid()]) | 615 | after setsid()]) |
616 | AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd | ||
617 | in case the name is longer than 8 chars]) | ||
439 | external_path_file=/etc/default/login | 618 | external_path_file=/etc/default/login |
440 | # hardwire lastlog location (can't detect it on some versions) | 619 | # hardwire lastlog location (can't detect it on some versions) |
441 | conf_lastlog_location="/var/adm/lastlog" | 620 | conf_lastlog_location="/var/adm/lastlog" |
@@ -449,6 +628,17 @@ mips-sony-bsd|mips-sony-newsos4) | |||
449 | else | 628 | else |
450 | AC_MSG_RESULT(no) | 629 | AC_MSG_RESULT(no) |
451 | fi | 630 | fi |
631 | AC_ARG_WITH(solaris-contracts, | ||
632 | [ --with-solaris-contracts Enable Solaris process contracts (experimental)], | ||
633 | [ | ||
634 | AC_CHECK_LIB(contract, ct_tmpl_activate, | ||
635 | [ AC_DEFINE(USE_SOLARIS_PROCESS_CONTRACTS, 1, | ||
636 | [Define if you have Solaris process contracts]) | ||
637 | SSHDLIBS="$SSHDLIBS -lcontract" | ||
638 | AC_SUBST(SSHDLIBS) | ||
639 | SPC_MSG="yes" ], ) | ||
640 | ], | ||
641 | ) | ||
452 | ;; | 642 | ;; |
453 | *-*-sunos4*) | 643 | *-*-sunos4*) |
454 | CPPFLAGS="$CPPFLAGS -DSUNOS4" | 644 | CPPFLAGS="$CPPFLAGS -DSUNOS4" |
@@ -486,7 +676,6 @@ mips-sony-bsd|mips-sony-newsos4) | |||
486 | ;; | 676 | ;; |
487 | # UnixWare 1.x, UnixWare 2.x, and others based on code from Univel. | 677 | # UnixWare 1.x, UnixWare 2.x, and others based on code from Univel. |
488 | *-*-sysv4.2*) | 678 | *-*-sysv4.2*) |
489 | CFLAGS="$CFLAGS -Dva_list=_VA_LIST" | ||
490 | AC_DEFINE(USE_PIPES) | 679 | AC_DEFINE(USE_PIPES) |
491 | AC_DEFINE(SETEUID_BREAKS_SETUID) | 680 | AC_DEFINE(SETEUID_BREAKS_SETUID) |
492 | AC_DEFINE(BROKEN_SETREUID) | 681 | AC_DEFINE(BROKEN_SETREUID) |
@@ -508,6 +697,7 @@ mips-sony-bsd|mips-sony-newsos4) | |||
508 | TEST_SHELL=/u95/bin/sh | 697 | TEST_SHELL=/u95/bin/sh |
509 | AC_DEFINE(BROKEN_LIBIAF, 1, | 698 | AC_DEFINE(BROKEN_LIBIAF, 1, |
510 | [ia_uinfo routines not supported by OS yet]) | 699 | [ia_uinfo routines not supported by OS yet]) |
700 | AC_DEFINE(BROKEN_UPDWTMPX) | ||
511 | ;; | 701 | ;; |
512 | *) AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*") | 702 | *) AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*") |
513 | ;; | 703 | ;; |
@@ -597,6 +787,7 @@ mips-sony-bsd|mips-sony-newsos4) | |||
597 | system's login() call]) | 787 | system's login() call]) |
598 | AC_DEFINE(DISABLE_FD_PASSING) | 788 | AC_DEFINE(DISABLE_FD_PASSING) |
599 | LIBS="$LIBS -lsecurity -ldb -lm -laud" | 789 | LIBS="$LIBS -lsecurity -ldb -lm -laud" |
790 | SIA_MSG="yes" | ||
600 | else | 791 | else |
601 | AC_MSG_RESULT(no) | 792 | AC_MSG_RESULT(no) |
602 | AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin", | 793 | AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin", |
@@ -616,6 +807,8 @@ mips-sony-bsd|mips-sony-newsos4) | |||
616 | AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems]) | 807 | AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems]) |
617 | AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems]) | 808 | AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems]) |
618 | AC_DEFINE(DISABLE_LASTLOG) | 809 | AC_DEFINE(DISABLE_LASTLOG) |
810 | AC_DEFINE(SSHD_ACQUIRES_CTTY) | ||
811 | enable_etc_default_login=no # has incompatible /etc/default/login | ||
619 | ;; | 812 | ;; |
620 | 813 | ||
621 | *-*-ultrix*) | 814 | *-*-ultrix*) |
@@ -632,55 +825,6 @@ mips-sony-bsd|mips-sony-newsos4) | |||
632 | ;; | 825 | ;; |
633 | esac | 826 | esac |
634 | 827 | ||
635 | # Allow user to specify flags | ||
636 | AC_ARG_WITH(cflags, | ||
637 | [ --with-cflags Specify additional flags to pass to compiler], | ||
638 | [ | ||
639 | if test -n "$withval" && test "x$withval" != "xno" && \ | ||
640 | test "x${withval}" != "xyes"; then | ||
641 | CFLAGS="$CFLAGS $withval" | ||
642 | fi | ||
643 | ] | ||
644 | ) | ||
645 | AC_ARG_WITH(cppflags, | ||
646 | [ --with-cppflags Specify additional flags to pass to preprocessor] , | ||
647 | [ | ||
648 | if test -n "$withval" && test "x$withval" != "xno" && \ | ||
649 | test "x${withval}" != "xyes"; then | ||
650 | CPPFLAGS="$CPPFLAGS $withval" | ||
651 | fi | ||
652 | ] | ||
653 | ) | ||
654 | AC_ARG_WITH(ldflags, | ||
655 | [ --with-ldflags Specify additional flags to pass to linker], | ||
656 | [ | ||
657 | if test -n "$withval" && test "x$withval" != "xno" && \ | ||
658 | test "x${withval}" != "xyes"; then | ||
659 | LDFLAGS="$LDFLAGS $withval" | ||
660 | fi | ||
661 | ] | ||
662 | ) | ||
663 | AC_ARG_WITH(libs, | ||
664 | [ --with-libs Specify additional libraries to link with], | ||
665 | [ | ||
666 | if test -n "$withval" && test "x$withval" != "xno" && \ | ||
667 | test "x${withval}" != "xyes"; then | ||
668 | LIBS="$LIBS $withval" | ||
669 | fi | ||
670 | ] | ||
671 | ) | ||
672 | AC_ARG_WITH(Werror, | ||
673 | [ --with-Werror Build main code with -Werror], | ||
674 | [ | ||
675 | if test -n "$withval" && test "x$withval" != "xno"; then | ||
676 | werror_flags="-Werror" | ||
677 | if test "x${withval}" != "xyes"; then | ||
678 | werror_flags="$withval" | ||
679 | fi | ||
680 | fi | ||
681 | ] | ||
682 | ) | ||
683 | |||
684 | AC_MSG_CHECKING(compiler and flags for sanity) | 828 | AC_MSG_CHECKING(compiler and flags for sanity) |
685 | AC_RUN_IFELSE( | 829 | AC_RUN_IFELSE( |
686 | [AC_LANG_SOURCE([ | 830 | [AC_LANG_SOURCE([ |
@@ -696,79 +840,6 @@ int main(){exit(0);} | |||
696 | ) | 840 | ) |
697 | 841 | ||
698 | dnl Checks for header files. | 842 | dnl Checks for header files. |
699 | AC_CHECK_HEADERS( \ | ||
700 | bstring.h \ | ||
701 | crypt.h \ | ||
702 | dirent.h \ | ||
703 | endian.h \ | ||
704 | features.h \ | ||
705 | floatingpoint.h \ | ||
706 | getopt.h \ | ||
707 | glob.h \ | ||
708 | ia.h \ | ||
709 | iaf.h \ | ||
710 | limits.h \ | ||
711 | login.h \ | ||
712 | login_cap.h \ | ||
713 | maillock.h \ | ||
714 | ndir.h \ | ||
715 | netdb.h \ | ||
716 | netgroup.h \ | ||
717 | pam/pam_appl.h \ | ||
718 | paths.h \ | ||
719 | pty.h \ | ||
720 | readpassphrase.h \ | ||
721 | rpc/types.h \ | ||
722 | security/pam_appl.h \ | ||
723 | shadow.h \ | ||
724 | stddef.h \ | ||
725 | stdint.h \ | ||
726 | string.h \ | ||
727 | strings.h \ | ||
728 | sys/audit.h \ | ||
729 | sys/bitypes.h \ | ||
730 | sys/bsdtty.h \ | ||
731 | sys/cdefs.h \ | ||
732 | sys/dir.h \ | ||
733 | sys/mman.h \ | ||
734 | sys/ndir.h \ | ||
735 | sys/prctl.h \ | ||
736 | sys/pstat.h \ | ||
737 | sys/select.h \ | ||
738 | sys/stat.h \ | ||
739 | sys/stream.h \ | ||
740 | sys/stropts.h \ | ||
741 | sys/strtio.h \ | ||
742 | sys/sysmacros.h \ | ||
743 | sys/time.h \ | ||
744 | sys/timers.h \ | ||
745 | sys/un.h \ | ||
746 | time.h \ | ||
747 | tmpdir.h \ | ||
748 | ttyent.h \ | ||
749 | unistd.h \ | ||
750 | usersec.h \ | ||
751 | util.h \ | ||
752 | utime.h \ | ||
753 | utmp.h \ | ||
754 | utmpx.h \ | ||
755 | vis.h \ | ||
756 | ) | ||
757 | |||
758 | # lastlog.h requires sys/time.h to be included first on Solaris | ||
759 | AC_CHECK_HEADERS(lastlog.h, [], [], [ | ||
760 | #ifdef HAVE_SYS_TIME_H | ||
761 | # include <sys/time.h> | ||
762 | #endif | ||
763 | ]) | ||
764 | |||
765 | # sys/ptms.h requires sys/stream.h to be included first on Solaris | ||
766 | AC_CHECK_HEADERS(sys/ptms.h, [], [], [ | ||
767 | #ifdef HAVE_SYS_STREAM_H | ||
768 | # include <sys/stream.h> | ||
769 | #endif | ||
770 | ]) | ||
771 | |||
772 | # Checks for libraries. | 843 | # Checks for libraries. |
773 | AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match)) | 844 | AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match)) |
774 | AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt)) | 845 | AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt)) |
@@ -953,11 +1024,9 @@ AC_EGREP_CPP(FOUNDIT, | |||
953 | 1024 | ||
954 | # Check for g.gl_matchc glob() extension | 1025 | # Check for g.gl_matchc glob() extension |
955 | AC_MSG_CHECKING(for gl_matchc field in glob_t) | 1026 | AC_MSG_CHECKING(for gl_matchc field in glob_t) |
956 | AC_EGREP_CPP(FOUNDIT, | 1027 | AC_TRY_COMPILE( |
957 | [ | 1028 | [ #include <glob.h> ], |
958 | #include <glob.h> | 1029 | [glob_t g; g.gl_matchc = 1;], |
959 | int main(void){glob_t g; g.gl_matchc = 1;} | ||
960 | ], | ||
961 | [ | 1030 | [ |
962 | AC_DEFINE(GLOB_HAS_GL_MATCHC, 1, | 1031 | AC_DEFINE(GLOB_HAS_GL_MATCHC, 1, |
963 | [Define if your system glob() function has | 1032 | [Define if your system glob() function has |
@@ -969,6 +1038,8 @@ AC_EGREP_CPP(FOUNDIT, | |||
969 | ] | 1038 | ] |
970 | ) | 1039 | ) |
971 | 1040 | ||
1041 | AC_CHECK_DECLS(GLOB_NOMATCH, , , [#include <glob.h>]) | ||
1042 | |||
972 | AC_MSG_CHECKING([whether struct dirent allocates space for d_name]) | 1043 | AC_MSG_CHECKING([whether struct dirent allocates space for d_name]) |
973 | AC_RUN_IFELSE( | 1044 | AC_RUN_IFELSE( |
974 | [AC_LANG_SOURCE([[ | 1045 | [AC_LANG_SOURCE([[ |
@@ -1150,7 +1221,13 @@ AC_ARG_WITH(audit, | |||
1150 | AUDIT_MODULE=bsm | 1221 | AUDIT_MODULE=bsm |
1151 | dnl Checks for headers, libs and functions | 1222 | dnl Checks for headers, libs and functions |
1152 | AC_CHECK_HEADERS(bsm/audit.h, [], | 1223 | AC_CHECK_HEADERS(bsm/audit.h, [], |
1153 | [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)]) | 1224 | [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)], |
1225 | [ | ||
1226 | #ifdef HAVE_TIME_H | ||
1227 | # include <time.h> | ||
1228 | #endif | ||
1229 | ] | ||
1230 | ) | ||
1154 | AC_CHECK_LIB(bsm, getaudit, [], | 1231 | AC_CHECK_LIB(bsm, getaudit, [], |
1155 | [AC_MSG_ERROR(BSM enabled and required library not found)]) | 1232 | [AC_MSG_ERROR(BSM enabled and required library not found)]) |
1156 | AC_CHECK_FUNCS(getaudit, [], | 1233 | AC_CHECK_FUNCS(getaudit, [], |
@@ -1296,6 +1373,29 @@ AC_CHECK_DECL(tcsendbreak, | |||
1296 | 1373 | ||
1297 | AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>]) | 1374 | AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>]) |
1298 | 1375 | ||
1376 | AC_CHECK_DECLS(SHUT_RD, , , | ||
1377 | [ | ||
1378 | #include <sys/types.h> | ||
1379 | #include <sys/socket.h> | ||
1380 | ]) | ||
1381 | |||
1382 | AC_CHECK_DECLS(O_NONBLOCK, , , | ||
1383 | [ | ||
1384 | #include <sys/types.h> | ||
1385 | #ifdef HAVE_SYS_STAT_H | ||
1386 | # include <sys/stat.h> | ||
1387 | #endif | ||
1388 | #ifdef HAVE_FCNTL_H | ||
1389 | # include <fcntl.h> | ||
1390 | #endif | ||
1391 | ]) | ||
1392 | |||
1393 | AC_CHECK_DECLS(writev, , , [ | ||
1394 | #include <sys/types.h> | ||
1395 | #include <sys/uio.h> | ||
1396 | #include <unistd.h> | ||
1397 | ]) | ||
1398 | |||
1299 | AC_CHECK_FUNCS(setresuid, [ | 1399 | AC_CHECK_FUNCS(setresuid, [ |
1300 | dnl Some platorms have setresuid that isn't implemented, test for this | 1400 | dnl Some platorms have setresuid that isn't implemented, test for this |
1301 | AC_MSG_CHECKING(if setresuid seems to work) | 1401 | AC_MSG_CHECKING(if setresuid seems to work) |
@@ -1666,61 +1766,6 @@ fi | |||
1666 | 1766 | ||
1667 | AC_FUNC_GETPGRP | 1767 | AC_FUNC_GETPGRP |
1668 | 1768 | ||
1669 | # Check for PAM libs | ||
1670 | PAM_MSG="no" | ||
1671 | AC_ARG_WITH(pam, | ||
1672 | [ --with-pam Enable PAM support ], | ||
1673 | [ | ||
1674 | if test "x$withval" != "xno" ; then | ||
1675 | if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \ | ||
1676 | test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then | ||
1677 | AC_MSG_ERROR([PAM headers not found]) | ||
1678 | fi | ||
1679 | |||
1680 | AC_CHECK_LIB(dl, dlopen, , ) | ||
1681 | AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing])) | ||
1682 | AC_CHECK_FUNCS(pam_getenvlist) | ||
1683 | AC_CHECK_FUNCS(pam_putenv) | ||
1684 | |||
1685 | PAM_MSG="yes" | ||
1686 | |||
1687 | AC_DEFINE(USE_PAM, 1, | ||
1688 | [Define if you want to enable PAM support]) | ||
1689 | if test $ac_cv_lib_dl_dlopen = yes; then | ||
1690 | LIBPAM="-lpam -ldl" | ||
1691 | else | ||
1692 | LIBPAM="-lpam" | ||
1693 | fi | ||
1694 | AC_SUBST(LIBPAM) | ||
1695 | fi | ||
1696 | ] | ||
1697 | ) | ||
1698 | |||
1699 | # Check for older PAM | ||
1700 | if test "x$PAM_MSG" = "xyes" ; then | ||
1701 | # Check PAM strerror arguments (old PAM) | ||
1702 | AC_MSG_CHECKING([whether pam_strerror takes only one argument]) | ||
1703 | AC_TRY_COMPILE( | ||
1704 | [ | ||
1705 | #include <stdlib.h> | ||
1706 | #if defined(HAVE_SECURITY_PAM_APPL_H) | ||
1707 | #include <security/pam_appl.h> | ||
1708 | #elif defined (HAVE_PAM_PAM_APPL_H) | ||
1709 | #include <pam/pam_appl.h> | ||
1710 | #endif | ||
1711 | ], | ||
1712 | [(void)pam_strerror((pam_handle_t *)NULL, -1);], | ||
1713 | [AC_MSG_RESULT(no)], | ||
1714 | [ | ||
1715 | AC_DEFINE(HAVE_OLD_PAM, 1, | ||
1716 | [Define if you have an old version of PAM | ||
1717 | which takes only one argument to pam_strerror]) | ||
1718 | AC_MSG_RESULT(yes) | ||
1719 | PAM_MSG="yes (old library)" | ||
1720 | ] | ||
1721 | ) | ||
1722 | fi | ||
1723 | |||
1724 | # Search for OpenSSL | 1769 | # Search for OpenSSL |
1725 | saved_CPPFLAGS="$CPPFLAGS" | 1770 | saved_CPPFLAGS="$CPPFLAGS" |
1726 | saved_LDFLAGS="$LDFLAGS" | 1771 | saved_LDFLAGS="$LDFLAGS" |
@@ -1844,6 +1889,14 @@ int main(void) { | |||
1844 | ] | 1889 | ] |
1845 | ) | 1890 | ) |
1846 | 1891 | ||
1892 | AC_ARG_WITH(openssl-header-check, | ||
1893 | [ --without-openssl-header-check Disable OpenSSL version consistency check], | ||
1894 | [ if test "x$withval" = "xno" ; then | ||
1895 | openssl_check_nonfatal=1 | ||
1896 | fi | ||
1897 | ] | ||
1898 | ) | ||
1899 | |||
1847 | # Sanity check OpenSSL headers | 1900 | # Sanity check OpenSSL headers |
1848 | AC_MSG_CHECKING([whether OpenSSL's headers match the library]) | 1901 | AC_MSG_CHECKING([whether OpenSSL's headers match the library]) |
1849 | AC_RUN_IFELSE( | 1902 | AC_RUN_IFELSE( |
@@ -1857,18 +1910,75 @@ int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); } | |||
1857 | ], | 1910 | ], |
1858 | [ | 1911 | [ |
1859 | AC_MSG_RESULT(no) | 1912 | AC_MSG_RESULT(no) |
1860 | AC_MSG_ERROR([Your OpenSSL headers do not match your library. | 1913 | if test "x$openssl_check_nonfatal" = "x"; then |
1861 | Check config.log for details. | 1914 | AC_MSG_ERROR([Your OpenSSL headers do not match your |
1915 | library. Check config.log for details. | ||
1916 | If you are sure your installation is consistent, you can disable the check | ||
1917 | by running "./configure --without-openssl-header-check". | ||
1918 | Also see contrib/findssl.sh for help identifying header/library mismatches. | ||
1919 | ]) | ||
1920 | else | ||
1921 | AC_MSG_WARN([Your OpenSSL headers do not match your | ||
1922 | library. Check config.log for details. | ||
1862 | Also see contrib/findssl.sh for help identifying header/library mismatches.]) | 1923 | Also see contrib/findssl.sh for help identifying header/library mismatches.]) |
1924 | fi | ||
1863 | ], | 1925 | ], |
1864 | [ | 1926 | [ |
1865 | AC_MSG_WARN([cross compiling: not checking]) | 1927 | AC_MSG_WARN([cross compiling: not checking]) |
1866 | ] | 1928 | ] |
1867 | ) | 1929 | ) |
1868 | 1930 | ||
1931 | AC_MSG_CHECKING([if programs using OpenSSL functions will link]) | ||
1932 | AC_LINK_IFELSE( | ||
1933 | [AC_LANG_SOURCE([[ | ||
1934 | #include <openssl/evp.h> | ||
1935 | int main(void) { SSLeay_add_all_algorithms(); } | ||
1936 | ]])], | ||
1937 | [ | ||
1938 | AC_MSG_RESULT(yes) | ||
1939 | ], | ||
1940 | [ | ||
1941 | AC_MSG_RESULT(no) | ||
1942 | saved_LIBS="$LIBS" | ||
1943 | LIBS="$LIBS -ldl" | ||
1944 | AC_MSG_CHECKING([if programs using OpenSSL need -ldl]) | ||
1945 | AC_LINK_IFELSE( | ||
1946 | [AC_LANG_SOURCE([[ | ||
1947 | #include <openssl/evp.h> | ||
1948 | int main(void) { SSLeay_add_all_algorithms(); } | ||
1949 | ]])], | ||
1950 | [ | ||
1951 | AC_MSG_RESULT(yes) | ||
1952 | ], | ||
1953 | [ | ||
1954 | AC_MSG_RESULT(no) | ||
1955 | LIBS="$saved_LIBS" | ||
1956 | ] | ||
1957 | ) | ||
1958 | ] | ||
1959 | ) | ||
1960 | |||
1961 | AC_ARG_WITH(ssl-engine, | ||
1962 | [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ], | ||
1963 | [ if test "x$withval" != "xno" ; then | ||
1964 | AC_MSG_CHECKING(for OpenSSL ENGINE support) | ||
1965 | AC_TRY_COMPILE( | ||
1966 | [ #include <openssl/engine.h>], | ||
1967 | [ | ||
1968 | ENGINE_load_builtin_engines();ENGINE_register_all_complete(); | ||
1969 | ], | ||
1970 | [ AC_MSG_RESULT(yes) | ||
1971 | AC_DEFINE(USE_OPENSSL_ENGINE, 1, | ||
1972 | [Enable OpenSSL engine support]) | ||
1973 | ], | ||
1974 | [ AC_MSG_ERROR(OpenSSL ENGINE support not found)] | ||
1975 | ) | ||
1976 | fi ] | ||
1977 | ) | ||
1978 | |||
1869 | # Check for OpenSSL without EVP_aes_{192,256}_cbc | 1979 | # Check for OpenSSL without EVP_aes_{192,256}_cbc |
1870 | AC_MSG_CHECKING([whether OpenSSL has crippled AES support]) | 1980 | AC_MSG_CHECKING([whether OpenSSL has crippled AES support]) |
1871 | AC_COMPILE_IFELSE( | 1981 | AC_LINK_IFELSE( |
1872 | [AC_LANG_SOURCE([[ | 1982 | [AC_LANG_SOURCE([[ |
1873 | #include <string.h> | 1983 | #include <string.h> |
1874 | #include <openssl/evp.h> | 1984 | #include <openssl/evp.h> |
@@ -1896,6 +2006,9 @@ if test "x$check_for_libcrypt_later" = "x1"; then | |||
1896 | AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt") | 2006 | AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt") |
1897 | fi | 2007 | fi |
1898 | 2008 | ||
2009 | # Search for SHA256 support in libc and/or OpenSSL | ||
2010 | AC_CHECK_FUNCS(SHA256_Update EVP_sha256) | ||
2011 | |||
1899 | AC_CHECK_LIB(iaf, ia_openinfo) | 2012 | AC_CHECK_LIB(iaf, ia_openinfo) |
1900 | 2013 | ||
1901 | ### Configure cryptographic random number support | 2014 | ### Configure cryptographic random number support |
@@ -1926,6 +2039,69 @@ int main(void) { exit(RAND_status() == 1 ? 0 : 1); } | |||
1926 | ] | 2039 | ] |
1927 | ) | 2040 | ) |
1928 | 2041 | ||
2042 | # Check for PAM libs | ||
2043 | PAM_MSG="no" | ||
2044 | AC_ARG_WITH(pam, | ||
2045 | [ --with-pam Enable PAM support ], | ||
2046 | [ | ||
2047 | if test "x$withval" != "xno" ; then | ||
2048 | if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \ | ||
2049 | test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then | ||
2050 | AC_MSG_ERROR([PAM headers not found]) | ||
2051 | fi | ||
2052 | |||
2053 | saved_LIBS="$LIBS" | ||
2054 | AC_CHECK_LIB(dl, dlopen, , ) | ||
2055 | AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing])) | ||
2056 | AC_CHECK_FUNCS(pam_getenvlist) | ||
2057 | AC_CHECK_FUNCS(pam_putenv) | ||
2058 | LIBS="$saved_LIBS" | ||
2059 | |||
2060 | PAM_MSG="yes" | ||
2061 | |||
2062 | LIBPAM="-lpam" | ||
2063 | AC_DEFINE(USE_PAM, 1, | ||
2064 | [Define if you want to enable PAM support]) | ||
2065 | |||
2066 | if test $ac_cv_lib_dl_dlopen = yes; then | ||
2067 | case "$LIBS" in | ||
2068 | *-ldl*) | ||
2069 | # libdl already in LIBS | ||
2070 | ;; | ||
2071 | *) | ||
2072 | LIBPAM="$LIBPAM -ldl" | ||
2073 | ;; | ||
2074 | esac | ||
2075 | fi | ||
2076 | AC_SUBST(LIBPAM) | ||
2077 | fi | ||
2078 | ] | ||
2079 | ) | ||
2080 | |||
2081 | # Check for older PAM | ||
2082 | if test "x$PAM_MSG" = "xyes" ; then | ||
2083 | # Check PAM strerror arguments (old PAM) | ||
2084 | AC_MSG_CHECKING([whether pam_strerror takes only one argument]) | ||
2085 | AC_TRY_COMPILE( | ||
2086 | [ | ||
2087 | #include <stdlib.h> | ||
2088 | #if defined(HAVE_SECURITY_PAM_APPL_H) | ||
2089 | #include <security/pam_appl.h> | ||
2090 | #elif defined (HAVE_PAM_PAM_APPL_H) | ||
2091 | #include <pam/pam_appl.h> | ||
2092 | #endif | ||
2093 | ], | ||
2094 | [(void)pam_strerror((pam_handle_t *)NULL, -1);], | ||
2095 | [AC_MSG_RESULT(no)], | ||
2096 | [ | ||
2097 | AC_DEFINE(HAVE_OLD_PAM, 1, | ||
2098 | [Define if you have an old version of PAM | ||
2099 | which takes only one argument to pam_strerror]) | ||
2100 | AC_MSG_RESULT(yes) | ||
2101 | PAM_MSG="yes (old library)" | ||
2102 | ] | ||
2103 | ) | ||
2104 | fi | ||
1929 | 2105 | ||
1930 | # Do we want to force the use of the rand helper? | 2106 | # Do we want to force the use of the rand helper? |
1931 | AC_ARG_WITH(rand-helper, | 2107 | AC_ARG_WITH(rand-helper, |
@@ -2145,6 +2321,34 @@ if test -z "$have_llong_max"; then | |||
2145 | #define __USE_ISOC99 | 2321 | #define __USE_ISOC99 |
2146 | #include <limits.h> | 2322 | #include <limits.h> |
2147 | #define DATA "conftest.llminmax" | 2323 | #define DATA "conftest.llminmax" |
2324 | #define my_abs(a) ((a) < 0 ? ((a) * -1) : (a)) | ||
2325 | |||
2326 | /* | ||
2327 | * printf in libc on some platforms (eg old Tru64) does not understand %lld so | ||
2328 | * we do this the hard way. | ||
2329 | */ | ||
2330 | static int | ||
2331 | fprint_ll(FILE *f, long long n) | ||
2332 | { | ||
2333 | unsigned int i; | ||
2334 | int l[sizeof(long long) * 8]; | ||
2335 | |||
2336 | if (n < 0) | ||
2337 | if (fprintf(f, "-") < 0) | ||
2338 | return -1; | ||
2339 | for (i = 0; n != 0; i++) { | ||
2340 | l[i] = my_abs(n % 10); | ||
2341 | n /= 10; | ||
2342 | } | ||
2343 | do { | ||
2344 | if (fprintf(f, "%d", l[--i]) < 0) | ||
2345 | return -1; | ||
2346 | } while (i != 0); | ||
2347 | if (fprintf(f, " ") < 0) | ||
2348 | return -1; | ||
2349 | return 0; | ||
2350 | } | ||
2351 | |||
2148 | int main(void) { | 2352 | int main(void) { |
2149 | FILE *f; | 2353 | FILE *f; |
2150 | long long i, llmin, llmax = 0; | 2354 | long long i, llmin, llmax = 0; |
@@ -2166,14 +2370,18 @@ int main(void) { | |||
2166 | 2370 | ||
2167 | /* Sanity check */ | 2371 | /* Sanity check */ |
2168 | if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax | 2372 | if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax |
2169 | || llmax - 1 > llmax) { | 2373 | || llmax - 1 > llmax || llmin == llmax || llmin == 0 |
2374 | || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) { | ||
2170 | fprintf(f, "unknown unknown\n"); | 2375 | fprintf(f, "unknown unknown\n"); |
2171 | exit(2); | 2376 | exit(2); |
2172 | } | 2377 | } |
2173 | 2378 | ||
2174 | if (fprintf(f ,"%lld %lld", llmin, llmax) < 0) | 2379 | if (fprint_ll(f, llmin) < 0) |
2175 | exit(3); | 2380 | exit(3); |
2176 | 2381 | if (fprint_ll(f, llmax) < 0) | |
2382 | exit(4); | ||
2383 | if (fclose(f) < 0) | ||
2384 | exit(5); | ||
2177 | exit(0); | 2385 | exit(0); |
2178 | } | 2386 | } |
2179 | ]])], | 2387 | ]])], |
@@ -2181,17 +2389,6 @@ int main(void) { | |||
2181 | llong_min=`$AWK '{print $1}' conftest.llminmax` | 2389 | llong_min=`$AWK '{print $1}' conftest.llminmax` |
2182 | llong_max=`$AWK '{print $2}' conftest.llminmax` | 2390 | llong_max=`$AWK '{print $2}' conftest.llminmax` |
2183 | 2391 | ||
2184 | # snprintf on some Tru64s doesn't understand "%lld" | ||
2185 | case "$host" in | ||
2186 | alpha-dec-osf*) | ||
2187 | if test "x$ac_cv_sizeof_long_long_int" = "x8" && | ||
2188 | test "x$llong_max" = "xld"; then | ||
2189 | llong_min="-9223372036854775808" | ||
2190 | llong_max="9223372036854775807" | ||
2191 | fi | ||
2192 | ;; | ||
2193 | esac | ||
2194 | |||
2195 | AC_MSG_RESULT($llong_max) | 2392 | AC_MSG_RESULT($llong_max) |
2196 | AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL], | 2393 | AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL], |
2197 | [max value of long long calculated by configure]) | 2394 | [max value of long long calculated by configure]) |
@@ -2937,7 +3134,7 @@ AC_ARG_WITH(opensc, | |||
2937 | LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags` | 3134 | LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags` |
2938 | LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs` | 3135 | LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs` |
2939 | CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS" | 3136 | CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS" |
2940 | LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS" | 3137 | LIBS="$LIBS $LIBOPENSC_LIBS" |
2941 | AC_DEFINE(SMARTCARD) | 3138 | AC_DEFINE(SMARTCARD) |
2942 | AC_DEFINE(USE_OPENSC, 1, | 3139 | AC_DEFINE(USE_OPENSC, 1, |
2943 | [Define if you want smartcard support | 3140 | [Define if you want smartcard support |
@@ -2989,22 +3186,20 @@ int main() | |||
2989 | SELINUX_MSG="no" | 3186 | SELINUX_MSG="no" |
2990 | LIBSELINUX="" | 3187 | LIBSELINUX="" |
2991 | AC_ARG_WITH(selinux, | 3188 | AC_ARG_WITH(selinux, |
2992 | [ --with-selinux[[=LIBSELINUX-PATH]] Enable SELinux support], | 3189 | [ --with-selinux Enable SELinux support], |
2993 | [ if test "x$withval" != "xno" ; then | 3190 | [ if test "x$withval" != "xno" ; then |
2994 | if test "x$withval" != "xyes"; then | ||
2995 | CPPFLAGS="$CPPFLAGS -I${withval}/include" | ||
2996 | if test -n "${need_dash_r}"; then | ||
2997 | LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}" | ||
2998 | else | ||
2999 | LDFLAGS="-L${withval}/lib ${LDFLAGS}" | ||
3000 | fi | ||
3001 | fi | ||
3002 | AC_DEFINE(WITH_SELINUX,1,[Define if you want SELinux support.]) | 3191 | AC_DEFINE(WITH_SELINUX,1,[Define if you want SELinux support.]) |
3003 | SELINUX_MSG="yes" | 3192 | SELINUX_MSG="yes" |
3004 | AC_CHECK_HEADERS(selinux/selinux.h) | 3193 | AC_CHECK_HEADER([selinux/selinux.h], , |
3005 | LIBSELINUX="-lselinux" | 3194 | AC_MSG_ERROR(SELinux support requires selinux.h header)) |
3006 | fi | 3195 | AC_CHECK_LIB(selinux, setexeccon, [ LIBSELINUX="-lselinux" ], |
3007 | ]) | 3196 | AC_MSG_ERROR(SELinux support requires libselinux library)) |
3197 | save_LIBS="$LIBS" | ||
3198 | LIBS="$LIBS $LIBSELINUX" | ||
3199 | AC_CHECK_FUNCS(getseuserbyname get_default_context_with_level) | ||
3200 | LIBS="$save_LIBS" | ||
3201 | fi ] | ||
3202 | ) | ||
3008 | AC_SUBST(LIBSELINUX) | 3203 | AC_SUBST(LIBSELINUX) |
3009 | 3204 | ||
3010 | # Check whether user wants Kerberos 5 support | 3205 | # Check whether user wants Kerberos 5 support |
@@ -3769,20 +3964,13 @@ if test ! -z "$blibpath" ; then | |||
3769 | AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile]) | 3964 | AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile]) |
3770 | fi | 3965 | fi |
3771 | 3966 | ||
3772 | dnl remove pam and dl because they are in $LIBPAM | ||
3773 | if test "$PAM_MSG" = yes ; then | ||
3774 | LIBS=`echo $LIBS | sed 's/-lpam //'` | ||
3775 | fi | ||
3776 | if test "$ac_cv_lib_pam_pam_set_item" = yes ; then | ||
3777 | LIBS=`echo $LIBS | sed 's/-ldl //'` | ||
3778 | fi | ||
3779 | |||
3780 | dnl Adding -Werror to CFLAGS early prevents configure tests from running. | 3967 | dnl Adding -Werror to CFLAGS early prevents configure tests from running. |
3781 | dnl Add now. | 3968 | dnl Add now. |
3782 | CFLAGS="$CFLAGS $werror_flags" | 3969 | CFLAGS="$CFLAGS $werror_flags" |
3783 | 3970 | ||
3784 | AC_EXEEXT | 3971 | AC_EXEEXT |
3785 | AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \ | 3972 | AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \ |
3973 | openbsd-compat/Makefile openbsd-compat/regress/Makefile \ | ||
3786 | scard/Makefile ssh_prng_cmds survey.sh]) | 3974 | scard/Makefile ssh_prng_cmds survey.sh]) |
3787 | AC_OUTPUT | 3975 | AC_OUTPUT |
3788 | 3976 | ||
@@ -3824,6 +4012,7 @@ echo " sshd superuser user PATH: $J" | |||
3824 | fi | 4012 | fi |
3825 | echo " Manpage format: $MANTYPE" | 4013 | echo " Manpage format: $MANTYPE" |
3826 | echo " PAM support: $PAM_MSG" | 4014 | echo " PAM support: $PAM_MSG" |
4015 | echo " OSF SIA support: $SIA_MSG" | ||
3827 | echo " KerberosV support: $KRB5_MSG" | 4016 | echo " KerberosV support: $KRB5_MSG" |
3828 | echo " SELinux support: $SELINUX_MSG" | 4017 | echo " SELinux support: $SELINUX_MSG" |
3829 | echo " Smartcard support: $SCARD_MSG" | 4018 | echo " Smartcard support: $SCARD_MSG" |
@@ -3831,6 +4020,7 @@ echo " S/KEY support: $SKEY_MSG" | |||
3831 | echo " TCP Wrappers support: $TCPW_MSG" | 4020 | echo " TCP Wrappers support: $TCPW_MSG" |
3832 | echo " MD5 password support: $MD5_MSG" | 4021 | echo " MD5 password support: $MD5_MSG" |
3833 | echo " libedit support: $LIBEDIT_MSG" | 4022 | echo " libedit support: $LIBEDIT_MSG" |
4023 | echo " Solaris process contract support: $SPC_MSG" | ||
3834 | echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG" | 4024 | echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG" |
3835 | echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG" | 4025 | echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG" |
3836 | echo " BSD Auth support: $BSD_AUTH_MSG" | 4026 | echo " BSD Auth support: $BSD_AUTH_MSG" |
diff --git a/contrib/aix/buildbff.sh b/contrib/aix/buildbff.sh index 09b9c118c..97a7cbbba 100755 --- a/contrib/aix/buildbff.sh +++ b/contrib/aix/buildbff.sh | |||
@@ -1,7 +1,7 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | # | 2 | # |
3 | # buildbff.sh: Create AIX SMIT-installable OpenSSH packages | 3 | # buildbff.sh: Create AIX SMIT-installable OpenSSH packages |
4 | # $Id: buildbff.sh,v 1.8 2005/03/29 13:24:12 dtucker Exp $ | 4 | # $Id: buildbff.sh,v 1.10 2006/09/10 03:24:19 dtucker Exp $ |
5 | # | 5 | # |
6 | # Author: Darren Tucker (dtucker at zip dot com dot au) | 6 | # Author: Darren Tucker (dtucker at zip dot com dot au) |
7 | # This file is placed in the public domain and comes with absolutely | 7 | # This file is placed in the public domain and comes with absolutely |
@@ -23,6 +23,8 @@ umask 022 | |||
23 | 23 | ||
24 | startdir=`pwd` | 24 | startdir=`pwd` |
25 | 25 | ||
26 | perl -v >/dev/null || (echo perl required; exit 1) | ||
27 | |||
26 | # Path to inventory.sh: same place as buildbff.sh | 28 | # Path to inventory.sh: same place as buildbff.sh |
27 | if echo $0 | egrep '^/' | 29 | if echo $0 | egrep '^/' |
28 | then | 30 | then |
@@ -200,33 +202,29 @@ do | |||
200 | done | 202 | done |
201 | echo | 203 | echo |
202 | 204 | ||
203 | # Create PrivSep user if PrivSep not disabled in config | 205 | # Create PrivilegeSeparation user and group if not present |
204 | echo Creating PrivSep prereqs if required. | 206 | echo Checking for PrivilegeSeparation user and group. |
205 | if egrep '^[ \t]*UsePrivilegeSeparation[ \t]+no' $sysconfdir/sshd_config >/dev/null | 207 | if cut -f1 -d: /etc/group | egrep '^'$SSH_PRIVSEP_USER'\$' >/dev/null |
206 | then | 208 | then |
207 | echo "UsePrivilegeSeparation disabled in config, not creating PrivSep user," | 209 | echo "PrivSep group $SSH_PRIVSEP_USER already exists." |
208 | echo "group or chroot directory." | ||
209 | else | 210 | else |
210 | echo "UsePrivilegeSeparation enabled in config (or defaulting to on)." | 211 | echo "Creating PrivSep group $SSH_PRIVSEP_USER." |
211 | 212 | mkgroup -A $SSH_PRIVSEP_USER | |
212 | # create group if required | 213 | fi |
213 | if cut -f1 -d: /etc/group | egrep '^'$SSH_PRIVSEP_USER'\$' >/dev/null | ||
214 | then | ||
215 | echo "PrivSep group $SSH_PRIVSEP_USER already exists." | ||
216 | else | ||
217 | echo "Creating PrivSep group $SSH_PRIVSEP_USER." | ||
218 | mkgroup -A $SSH_PRIVSEP_USER | ||
219 | fi | ||
220 | 214 | ||
221 | # Create user if required | 215 | # Create user if required |
222 | if lsuser "$SSH_PRIVSEP_USER" >/dev/null | 216 | if lsuser "$SSH_PRIVSEP_USER" >/dev/null |
223 | then | 217 | then |
224 | echo "PrivSep user $SSH_PRIVSEP_USER already exists." | 218 | echo "PrivSep user $SSH_PRIVSEP_USER already exists." |
225 | else | 219 | else |
226 | echo "Creating PrivSep user $SSH_PRIVSEP_USER." | 220 | echo "Creating PrivSep user $SSH_PRIVSEP_USER." |
227 | mkuser gecos='SSHD PrivSep User' login=false rlogin=false account_locked=true pgrp=$SSH_PRIVSEP_USER $SSH_PRIVSEP_USER | 221 | mkuser gecos='SSHD PrivSep User' login=false rlogin=false account_locked=true pgrp=$SSH_PRIVSEP_USER $SSH_PRIVSEP_USER |
228 | fi | 222 | fi |
229 | 223 | ||
224 | if egrep '^[ \t]*UsePrivilegeSeparation[ \t]+no' $sysconfdir/sshd_config >/dev/null | ||
225 | then | ||
226 | echo UsePrivilegeSeparation not enabled, privsep directory not required. | ||
227 | else | ||
230 | # create chroot directory if required | 228 | # create chroot directory if required |
231 | if [ -d $PRIVSEP_PATH ] | 229 | if [ -d $PRIVSEP_PATH ] |
232 | then | 230 | then |
diff --git a/contrib/caldera/openssh.spec b/contrib/caldera/openssh.spec index 09c08f194..3d756eb7f 100644 --- a/contrib/caldera/openssh.spec +++ b/contrib/caldera/openssh.spec | |||
@@ -17,7 +17,7 @@ | |||
17 | #old cvs stuff. please update before use. may be deprecated. | 17 | #old cvs stuff. please update before use. may be deprecated. |
18 | %define use_stable 1 | 18 | %define use_stable 1 |
19 | %if %{use_stable} | 19 | %if %{use_stable} |
20 | %define version 4.3p2 | 20 | %define version 4.6p1 |
21 | %define cvs %{nil} | 21 | %define cvs %{nil} |
22 | %define release 1 | 22 | %define release 1 |
23 | %else | 23 | %else |
@@ -357,4 +357,4 @@ fi | |||
357 | * Mon Jan 01 1998 ... | 357 | * Mon Jan 01 1998 ... |
358 | Template Version: 1.31 | 358 | Template Version: 1.31 |
359 | 359 | ||
360 | $Id: openssh.spec,v 1.56.2.1 2006/02/11 00:00:45 djm Exp $ | 360 | $Id: openssh.spec,v 1.60 2007/03/06 10:23:27 djm Exp $ |
diff --git a/contrib/cygwin/ssh-host-config b/contrib/cygwin/ssh-host-config index 0540890e6..e2ad69f19 100644 --- a/contrib/cygwin/ssh-host-config +++ b/contrib/cygwin/ssh-host-config | |||
@@ -153,22 +153,31 @@ fi | |||
153 | 153 | ||
154 | # Create /var/log and /var/log/lastlog if not already existing | 154 | # Create /var/log and /var/log/lastlog if not already existing |
155 | 155 | ||
156 | if [ -f ${LOCALSTATEDIR}/log ] | 156 | if [ -e ${LOCALSTATEDIR}/log -a ! -d ${LOCALSTATEDIR}/log ] |
157 | then | 157 | then |
158 | echo "Creating ${LOCALSTATEDIR}/log failed!" | 158 | echo |
159 | else | 159 | echo "${LOCALSTATEDIR}/log is existant but not a directory." |
160 | if [ ! -d ${LOCALSTATEDIR}/log ] | 160 | echo "Cannot create ssh host configuration." |
161 | then | 161 | echo |
162 | mkdir -p ${LOCALSTATEDIR}/log | 162 | exit 1 |
163 | fi | 163 | fi |
164 | if [ -d ${LOCALSTATEDIR}/log/lastlog ] | 164 | if [ ! -e ${LOCALSTATEDIR}/log ] |
165 | then | 165 | then |
166 | chmod 777 ${LOCALSTATEDIR}/log/lastlog | 166 | mkdir -p ${LOCALSTATEDIR}/log |
167 | elif [ ! -f ${LOCALSTATEDIR}/log/lastlog ] | 167 | fi |
168 | then | 168 | |
169 | cat /dev/null > ${LOCALSTATEDIR}/log/lastlog | 169 | if [ -e ${LOCALSTATEDIR}/log/lastlog -a ! -f ${LOCALSTATEDIR}/log/lastlog ] |
170 | chmod 666 ${LOCALSTATEDIR}/log/lastlog | 170 | then |
171 | fi | 171 | echo |
172 | echo "${LOCALSTATEDIR}/log/lastlog exists, but is not a file." | ||
173 | echo "Cannot create ssh host configuration." | ||
174 | echo | ||
175 | exit 1 | ||
176 | fi | ||
177 | if [ ! -e ${LOCALSTATEDIR}/log/lastlog ] | ||
178 | then | ||
179 | cat /dev/null > ${LOCALSTATEDIR}/log/lastlog | ||
180 | chmod 644 ${LOCALSTATEDIR}/log/lastlog | ||
172 | fi | 181 | fi |
173 | 182 | ||
174 | # Create /var/empty file used as chroot jail for privilege separation | 183 | # Create /var/empty file used as chroot jail for privilege separation |
@@ -507,6 +516,7 @@ then | |||
507 | fi | 516 | fi |
508 | editrights -a SeAssignPrimaryTokenPrivilege -u sshd_server && | 517 | editrights -a SeAssignPrimaryTokenPrivilege -u sshd_server && |
509 | editrights -a SeCreateTokenPrivilege -u sshd_server && | 518 | editrights -a SeCreateTokenPrivilege -u sshd_server && |
519 | editrights -a SeTcbPrivilege -u sshd_server && | ||
510 | editrights -a SeDenyInteractiveLogonRight -u sshd_server && | 520 | editrights -a SeDenyInteractiveLogonRight -u sshd_server && |
511 | editrights -a SeDenyNetworkLogonRight -u sshd_server && | 521 | editrights -a SeDenyNetworkLogonRight -u sshd_server && |
512 | editrights -a SeDenyRemoteInteractiveLogonRight -u sshd_server && | 522 | editrights -a SeDenyRemoteInteractiveLogonRight -u sshd_server && |
@@ -578,6 +588,7 @@ then | |||
578 | fi | 588 | fi |
579 | chown "${_user}" ${SYSCONFDIR}/ssh* | 589 | chown "${_user}" ${SYSCONFDIR}/ssh* |
580 | chown "${_user}".544 ${LOCALSTATEDIR}/empty | 590 | chown "${_user}".544 ${LOCALSTATEDIR}/empty |
591 | chown "${_user}".544 ${LOCALSTATEDIR}/log/lastlog | ||
581 | if [ -f ${LOCALSTATEDIR}/log/sshd.log ] | 592 | if [ -f ${LOCALSTATEDIR}/log/sshd.log ] |
582 | then | 593 | then |
583 | chown "${_user}".544 ${LOCALSTATEDIR}/log/sshd.log | 594 | chown "${_user}".544 ${LOCALSTATEDIR}/log/sshd.log |
diff --git a/contrib/findssl.sh b/contrib/findssl.sh index 716abced5..263fd2644 100644 --- a/contrib/findssl.sh +++ b/contrib/findssl.sh | |||
@@ -1,6 +1,6 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | # | 2 | # |
3 | # $Id: findssl.sh,v 1.3 2004/12/13 07:08:33 dtucker Exp $ | 3 | # $Id: findssl.sh,v 1.4 2007/02/19 11:44:25 dtucker Exp $ |
4 | # | 4 | # |
5 | # findssl.sh | 5 | # findssl.sh |
6 | # Search for all instances of OpenSSL headers and libraries | 6 | # Search for all instances of OpenSSL headers and libraries |
@@ -89,6 +89,25 @@ LD_LIBRARY_PATH=${LD_LIBRARY_PATH:=$DEFAULT_LIBPATH} | |||
89 | LIBRARY_PATH=${LIBRARY_PATH:=$DEFAULT_LIBPATH} | 89 | LIBRARY_PATH=${LIBRARY_PATH:=$DEFAULT_LIBPATH} |
90 | export LIBPATH LD_LIBRARY_PATH LIBRARY_PATH | 90 | export LIBPATH LD_LIBRARY_PATH LIBRARY_PATH |
91 | 91 | ||
92 | # not all platforms have a 'which' command | ||
93 | if which ls >/dev/null 2>/dev/null; then | ||
94 | : which is defined | ||
95 | else | ||
96 | which () { | ||
97 | saveIFS="$IFS" | ||
98 | IFS=: | ||
99 | for p in $PATH; do | ||
100 | if test -x "$p/$1" -a -f "$p/$1"; then | ||
101 | IFS="$saveIFS" | ||
102 | echo "$p/$1" | ||
103 | return 0 | ||
104 | fi | ||
105 | done | ||
106 | IFS="$saveIFS" | ||
107 | return 1 | ||
108 | } | ||
109 | fi | ||
110 | |||
92 | # | 111 | # |
93 | # Search for OpenSSL headers and print versions | 112 | # Search for OpenSSL headers and print versions |
94 | # | 113 | # |
diff --git a/contrib/redhat/openssh.spec b/contrib/redhat/openssh.spec index cbdf7bbc7..08515d2b0 100644 --- a/contrib/redhat/openssh.spec +++ b/contrib/redhat/openssh.spec | |||
@@ -1,4 +1,4 @@ | |||
1 | %define ver 4.3p2 | 1 | %define ver 4.6p1 |
2 | %define rel 1 | 2 | %define rel 1 |
3 | 3 | ||
4 | # OpenSSH privilege separation requires a user & group ID | 4 | # OpenSSH privilege separation requires a user & group ID |
diff --git a/contrib/redhat/sshd.init b/contrib/redhat/sshd.init index ffa66cd52..e5d837cbc 100755 --- a/contrib/redhat/sshd.init +++ b/contrib/redhat/sshd.init | |||
@@ -35,8 +35,8 @@ do_rsa1_keygen() { | |||
35 | if $KEYGEN -q -t rsa1 -f $RSA1_KEY -C '' -N '' >&/dev/null; then | 35 | if $KEYGEN -q -t rsa1 -f $RSA1_KEY -C '' -N '' >&/dev/null; then |
36 | chmod 600 $RSA1_KEY | 36 | chmod 600 $RSA1_KEY |
37 | chmod 644 $RSA1_KEY.pub | 37 | chmod 644 $RSA1_KEY.pub |
38 | if type restorecon >/dev/null 2>&1; then | 38 | if [ -x /sbin/restorecon ]; then |
39 | restorecon $RSA1_KEY.pub | 39 | /sbin/restorecon $RSA1_KEY.pub |
40 | fi | 40 | fi |
41 | success $"RSA1 key generation" | 41 | success $"RSA1 key generation" |
42 | echo | 42 | echo |
@@ -54,8 +54,8 @@ do_rsa_keygen() { | |||
54 | if $KEYGEN -q -t rsa -f $RSA_KEY -C '' -N '' >&/dev/null; then | 54 | if $KEYGEN -q -t rsa -f $RSA_KEY -C '' -N '' >&/dev/null; then |
55 | chmod 600 $RSA_KEY | 55 | chmod 600 $RSA_KEY |
56 | chmod 644 $RSA_KEY.pub | 56 | chmod 644 $RSA_KEY.pub |
57 | if type restorecon >/dev/null 2>&1; then | 57 | if [ -x /sbin/restorecon ]; then |
58 | restorecon $RSA_KEY.pub | 58 | /sbin/restorecon $RSA_KEY.pub |
59 | fi | 59 | fi |
60 | success $"RSA key generation" | 60 | success $"RSA key generation" |
61 | echo | 61 | echo |
@@ -73,8 +73,8 @@ do_dsa_keygen() { | |||
73 | if $KEYGEN -q -t dsa -f $DSA_KEY -C '' -N '' >&/dev/null; then | 73 | if $KEYGEN -q -t dsa -f $DSA_KEY -C '' -N '' >&/dev/null; then |
74 | chmod 600 $DSA_KEY | 74 | chmod 600 $DSA_KEY |
75 | chmod 644 $DSA_KEY.pub | 75 | chmod 644 $DSA_KEY.pub |
76 | if type restorecon >/dev/null 2>&1; then | 76 | if [ -x /sbin/restorecon ]; then |
77 | restorecon $DSA_KEY.pub | 77 | /sbin/restorecon $DSA_KEY.pub |
78 | fi | 78 | fi |
79 | success $"DSA key generation" | 79 | success $"DSA key generation" |
80 | echo | 80 | echo |
diff --git a/contrib/suse/openssh.spec b/contrib/suse/openssh.spec index b49e78c65..95b394f18 100644 --- a/contrib/suse/openssh.spec +++ b/contrib/suse/openssh.spec | |||
@@ -13,7 +13,7 @@ | |||
13 | 13 | ||
14 | Summary: OpenSSH, a free Secure Shell (SSH) protocol implementation | 14 | Summary: OpenSSH, a free Secure Shell (SSH) protocol implementation |
15 | Name: openssh | 15 | Name: openssh |
16 | Version: 4.3p2 | 16 | Version: 4.6p1 |
17 | URL: http://www.openssh.com/ | 17 | URL: http://www.openssh.com/ |
18 | Release: 1 | 18 | Release: 1 |
19 | Source0: openssh-%{version}.tar.gz | 19 | Source0: openssh-%{version}.tar.gz |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: crc32.c,v 1.9 2003/02/12 21:39:50 markus Exp $ */ | 1 | /* $OpenBSD: crc32.c,v 1.11 2006/04/22 18:29:33 stevesk Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2003 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2003 Markus Friedl. All rights reserved. |
@@ -99,7 +99,7 @@ ssh_crc32(const u_char *buf, u_int32_t size) | |||
99 | u_int32_t i, crc; | 99 | u_int32_t i, crc; |
100 | 100 | ||
101 | crc = 0; | 101 | crc = 0; |
102 | for (i = 0; i < size; i++) | 102 | for (i = 0; i < size; i++) |
103 | crc = crc32tab[(crc ^ buf[i]) & 0xff] ^ (crc >> 8); | 103 | crc = crc32tab[(crc ^ buf[i]) & 0xff] ^ (crc >> 8); |
104 | return crc; | 104 | return crc; |
105 | } | 105 | } |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: crc32.h,v 1.14 2003/02/12 21:39:50 markus Exp $ */ | 1 | /* $OpenBSD: crc32.h,v 1.15 2006/03/25 22:22:43 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2003 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2003 Markus Friedl. All rights reserved. |
diff --git a/deattack.c b/deattack.c index d174abc76..1b37e4dab 100644 --- a/deattack.c +++ b/deattack.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: deattack.c,v 1.30 2006/09/16 19:53:37 djm Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Cryptographic attack detector for ssh - source code | 3 | * Cryptographic attack detector for ssh - source code |
3 | * | 4 | * |
@@ -18,14 +19,18 @@ | |||
18 | */ | 19 | */ |
19 | 20 | ||
20 | #include "includes.h" | 21 | #include "includes.h" |
21 | RCSID("$OpenBSD: deattack.c,v 1.19 2003/09/18 08:49:45 markus Exp $"); | ||
22 | 22 | ||
23 | #include <sys/types.h> | ||
24 | |||
25 | #include <string.h> | ||
26 | #include <stdio.h> | ||
27 | #include <stdarg.h> | ||
28 | |||
29 | #include "xmalloc.h" | ||
23 | #include "deattack.h" | 30 | #include "deattack.h" |
24 | #include "log.h" | 31 | #include "log.h" |
25 | #include "crc32.h" | 32 | #include "crc32.h" |
26 | #include "getput.h" | 33 | #include "misc.h" |
27 | #include "xmalloc.h" | ||
28 | #include "deattack.h" | ||
29 | 34 | ||
30 | /* | 35 | /* |
31 | * CRC attack detection has a worst-case behaviour that is O(N^3) over | 36 | * CRC attack detection has a worst-case behaviour that is O(N^3) over |
@@ -61,7 +66,7 @@ RCSID("$OpenBSD: deattack.c,v 1.19 2003/09/18 08:49:45 markus Exp $"); | |||
61 | 66 | ||
62 | 67 | ||
63 | /* Hash function (Input keys are cipher results) */ | 68 | /* Hash function (Input keys are cipher results) */ |
64 | #define HASH(x) GET_32BIT(x) | 69 | #define HASH(x) get_u32(x) |
65 | 70 | ||
66 | #define CMP(a, b) (memcmp(a, b, SSH_BLOCKSIZE)) | 71 | #define CMP(a, b) (memcmp(a, b, SSH_BLOCKSIZE)) |
67 | 72 | ||
@@ -69,22 +74,17 @@ static void | |||
69 | crc_update(u_int32_t *a, u_int32_t b) | 74 | crc_update(u_int32_t *a, u_int32_t b) |
70 | { | 75 | { |
71 | b ^= *a; | 76 | b ^= *a; |
72 | *a = ssh_crc32((u_char *) &b, sizeof(b)); | 77 | *a = ssh_crc32((u_char *)&b, sizeof(b)); |
73 | } | 78 | } |
74 | 79 | ||
75 | /* detect if a block is used in a particular pattern */ | 80 | /* detect if a block is used in a particular pattern */ |
76 | static int | 81 | static int |
77 | check_crc(u_char *S, u_char *buf, u_int32_t len, | 82 | check_crc(u_char *S, u_char *buf, u_int32_t len) |
78 | u_char *IV) | ||
79 | { | 83 | { |
80 | u_int32_t crc; | 84 | u_int32_t crc; |
81 | u_char *c; | 85 | u_char *c; |
82 | 86 | ||
83 | crc = 0; | 87 | crc = 0; |
84 | if (IV && !CMP(S, IV)) { | ||
85 | crc_update(&crc, 1); | ||
86 | crc_update(&crc, 0); | ||
87 | } | ||
88 | for (c = buf; c < buf + len; c += SSH_BLOCKSIZE) { | 88 | for (c = buf; c < buf + len; c += SSH_BLOCKSIZE) { |
89 | if (!CMP(S, c)) { | 89 | if (!CMP(S, c)) { |
90 | crc_update(&crc, 1); | 90 | crc_update(&crc, 1); |
@@ -100,7 +100,7 @@ check_crc(u_char *S, u_char *buf, u_int32_t len, | |||
100 | 100 | ||
101 | /* Detect a crc32 compensation attack on a packet */ | 101 | /* Detect a crc32 compensation attack on a packet */ |
102 | int | 102 | int |
103 | detect_attack(u_char *buf, u_int32_t len, u_char *IV) | 103 | detect_attack(u_char *buf, u_int32_t len) |
104 | { | 104 | { |
105 | static u_int16_t *h = (u_int16_t *) NULL; | 105 | static u_int16_t *h = (u_int16_t *) NULL; |
106 | static u_int32_t n = HASH_MINSIZE / HASH_ENTRYSIZE; | 106 | static u_int32_t n = HASH_MINSIZE / HASH_ENTRYSIZE; |
@@ -118,26 +118,20 @@ detect_attack(u_char *buf, u_int32_t len, u_char *IV) | |||
118 | 118 | ||
119 | if (h == NULL) { | 119 | if (h == NULL) { |
120 | debug("Installing crc compensation attack detector."); | 120 | debug("Installing crc compensation attack detector."); |
121 | h = (u_int16_t *) xmalloc(l * HASH_ENTRYSIZE); | 121 | h = (u_int16_t *) xcalloc(l, HASH_ENTRYSIZE); |
122 | n = l; | 122 | n = l; |
123 | } else { | 123 | } else { |
124 | if (l > n) { | 124 | if (l > n) { |
125 | h = (u_int16_t *) xrealloc(h, l * HASH_ENTRYSIZE); | 125 | h = (u_int16_t *)xrealloc(h, l, HASH_ENTRYSIZE); |
126 | n = l; | 126 | n = l; |
127 | } | 127 | } |
128 | } | 128 | } |
129 | 129 | ||
130 | if (len <= HASH_MINBLOCKS) { | 130 | if (len <= HASH_MINBLOCKS) { |
131 | for (c = buf; c < buf + len; c += SSH_BLOCKSIZE) { | 131 | for (c = buf; c < buf + len; c += SSH_BLOCKSIZE) { |
132 | if (IV && (!CMP(c, IV))) { | ||
133 | if ((check_crc(c, buf, len, IV))) | ||
134 | return (DEATTACK_DETECTED); | ||
135 | else | ||
136 | break; | ||
137 | } | ||
138 | for (d = buf; d < c; d += SSH_BLOCKSIZE) { | 132 | for (d = buf; d < c; d += SSH_BLOCKSIZE) { |
139 | if (!CMP(c, d)) { | 133 | if (!CMP(c, d)) { |
140 | if ((check_crc(c, buf, len, IV))) | 134 | if ((check_crc(c, buf, len))) |
141 | return (DEATTACK_DETECTED); | 135 | return (DEATTACK_DETECTED); |
142 | else | 136 | else |
143 | break; | 137 | break; |
@@ -148,25 +142,13 @@ detect_attack(u_char *buf, u_int32_t len, u_char *IV) | |||
148 | } | 142 | } |
149 | memset(h, HASH_UNUSEDCHAR, n * HASH_ENTRYSIZE); | 143 | memset(h, HASH_UNUSEDCHAR, n * HASH_ENTRYSIZE); |
150 | 144 | ||
151 | if (IV) | ||
152 | h[HASH(IV) & (n - 1)] = HASH_IV; | ||
153 | |||
154 | for (c = buf, same = j = 0; c < (buf + len); c += SSH_BLOCKSIZE, j++) { | 145 | for (c = buf, same = j = 0; c < (buf + len); c += SSH_BLOCKSIZE, j++) { |
155 | for (i = HASH(c) & (n - 1); h[i] != HASH_UNUSED; | 146 | for (i = HASH(c) & (n - 1); h[i] != HASH_UNUSED; |
156 | i = (i + 1) & (n - 1)) { | 147 | i = (i + 1) & (n - 1)) { |
157 | if (h[i] == HASH_IV) { | 148 | if (!CMP(c, buf + h[i] * SSH_BLOCKSIZE)) { |
158 | if (!CMP(c, IV)) { | ||
159 | if (++same > MAX_IDENTICAL) | ||
160 | return (DEATTACK_DOS_DETECTED); | ||
161 | if (check_crc(c, buf, len, IV)) | ||
162 | return (DEATTACK_DETECTED); | ||
163 | else | ||
164 | break; | ||
165 | } | ||
166 | } else if (!CMP(c, buf + h[i] * SSH_BLOCKSIZE)) { | ||
167 | if (++same > MAX_IDENTICAL) | 149 | if (++same > MAX_IDENTICAL) |
168 | return (DEATTACK_DOS_DETECTED); | 150 | return (DEATTACK_DOS_DETECTED); |
169 | if (check_crc(c, buf, len, IV)) | 151 | if (check_crc(c, buf, len)) |
170 | return (DEATTACK_DETECTED); | 152 | return (DEATTACK_DETECTED); |
171 | else | 153 | else |
172 | break; | 154 | break; |
diff --git a/deattack.h b/deattack.h index cd3d7aa3b..0316fb285 100644 --- a/deattack.h +++ b/deattack.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: deattack.h,v 1.7 2001/06/26 17:27:23 markus Exp $ */ | 1 | /* $OpenBSD: deattack.h,v 1.10 2006/09/16 19:53:37 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Cryptographic attack detector for ssh - Header file | 4 | * Cryptographic attack detector for ssh - Header file |
@@ -27,5 +27,5 @@ | |||
27 | #define DEATTACK_DETECTED 1 | 27 | #define DEATTACK_DETECTED 1 |
28 | #define DEATTACK_DOS_DETECTED 2 | 28 | #define DEATTACK_DOS_DETECTED 2 |
29 | 29 | ||
30 | int detect_attack(u_char *, u_int32_t, u_char[8]); | 30 | int detect_attack(u_char *, u_int32_t); |
31 | #endif | 31 | #endif |
diff --git a/debian/.cvsignore b/debian/.cvsignore index 3604280e2..27afde263 100644 --- a/debian/.cvsignore +++ b/debian/.cvsignore | |||
@@ -1,12 +1,12 @@ | |||
1 | *.debhelper | ||
2 | *.templates | ||
3 | *substvars | ||
1 | files | 4 | files |
2 | tmp | ||
3 | openssh-client | 5 | openssh-client |
4 | openssh-server | ||
5 | ssh | ||
6 | openssh-client-udeb | 6 | openssh-client-udeb |
7 | openssh-server | ||
7 | openssh-server-udeb | 8 | openssh-server-udeb |
9 | ssh | ||
8 | ssh-askpass-gnome | 10 | ssh-askpass-gnome |
9 | ssh-krb5 | 11 | ssh-krb5 |
10 | *.debhelper | 12 | tmp |
11 | *substvars | ||
12 | *.templates | ||
diff --git a/debian/changelog b/debian/changelog index 0c159c1c7..a6eb2d15b 100644 --- a/debian/changelog +++ b/debian/changelog | |||
@@ -1,3 +1,63 @@ | |||
1 | openssh (1:4.6p1-1) UNRELEASED; urgency=low | ||
2 | |||
3 | * New upstream release (closes: #395507, #397961, #420035). Important | ||
4 | changes not previously backported to 4.3p2: | ||
5 | - 4.4/4.4p1 (http://www.openssh.org/txt/release-4.4): | ||
6 | + On portable OpenSSH, fix a GSSAPI authentication abort that could be | ||
7 | used to determine the validity of usernames on some platforms. | ||
8 | + Implemented conditional configuration in sshd_config(5) using the | ||
9 | "Match" directive. This allows some configuration options to be | ||
10 | selectively overridden if specific criteria (based on user, group, | ||
11 | hostname and/or address) are met. So far a useful subset of | ||
12 | post-authentication options are supported and more are expected to | ||
13 | be added in future releases. | ||
14 | + Add support for Diffie-Hellman group exchange key agreement with a | ||
15 | final hash of SHA256. | ||
16 | + Added a "ForceCommand" directive to sshd_config(5). Similar to the | ||
17 | command="..." option accepted in ~/.ssh/authorized_keys, this forces | ||
18 | the execution of the specified command regardless of what the user | ||
19 | requested. This is very useful in conjunction with the new "Match" | ||
20 | option. | ||
21 | + Add a "PermitOpen" directive to sshd_config(5). This mirrors the | ||
22 | permitopen="..." authorized_keys option, allowing fine-grained | ||
23 | control over the port-forwardings that a user is allowed to | ||
24 | establish. | ||
25 | + Add optional logging of transactions to sftp-server(8). | ||
26 | + ssh(1) will now record port numbers for hosts stored in | ||
27 | ~/.ssh/known_hosts when a non-standard port has been requested | ||
28 | (closes: #50612). | ||
29 | + Add an "ExitOnForwardFailure" option to cause ssh(1) to exit (with a | ||
30 | non-zero exit code) when requested port forwardings could not be | ||
31 | established. | ||
32 | + Extend sshd_config(5) "SubSystem" declarations to allow the | ||
33 | specification of command-line arguments. | ||
34 | + Replacement of all integer overflow susceptible invocations of | ||
35 | malloc(3) and realloc(3) with overflow-checking equivalents. | ||
36 | + Many manpage fixes and improvements. | ||
37 | + Add optional support for OpenSSL hardware accelerators (engines), | ||
38 | enabled using the --with-ssl-engine configure option. | ||
39 | + Tokens in configuration files may be double-quoted in order to | ||
40 | contain spaces (closes: #319639). | ||
41 | + Move a debug() call out of a SIGCHLD handler, fixing a hang when the | ||
42 | session exits very quickly (closes: #307890). | ||
43 | + Fix some incorrect buffer allocation calculations (closes: #410599). | ||
44 | + ssh-add doesn't ask for a passphrase if key file permissions are too | ||
45 | liberal (closes: #103677). | ||
46 | + Likewise, ssh doesn't ask either (closes: #99675). | ||
47 | - 4.6/4.6p1 (http://www.openssh.org/txt/release-4.6): | ||
48 | + sshd now allows the enabling and disabling of authentication methods | ||
49 | on a per user, group, host and network basis via the Match directive | ||
50 | in sshd_config. | ||
51 | + Fixed an inconsistent check for a terminal when displaying scp | ||
52 | progress meter (closes: #257524). | ||
53 | + Fix "hang on exit" when background processes are running at the time | ||
54 | of exit on a ttyful/login session (closes: #88337). | ||
55 | * Update to current GSSAPI patch from | ||
56 | http://www.sxw.org.uk/computing/patches/openssh-4.6p1-gsskex-20070312.patch; | ||
57 | install ChangeLog.gssapi. | ||
58 | |||
59 | -- Colin Watson <cjwatson@ubuntu.com> Tue, 12 Jun 2007 14:31:01 +0100 | ||
60 | |||
1 | openssh (1:4.3p2-11) unstable; urgency=low | 61 | openssh (1:4.3p2-11) unstable; urgency=low |
2 | 62 | ||
3 | * It's been four and a half years now since I took over as "temporary" | 63 | * It's been four and a half years now since I took over as "temporary" |
diff --git a/debian/rules b/debian/rules index fdef12dcf..e18c77153 100755 --- a/debian/rules +++ b/debian/rules | |||
@@ -186,7 +186,7 @@ binary-openssh-client: build install | |||
186 | dh_installdebconf | 186 | dh_installdebconf |
187 | dh_installdocs OVERVIEW README README.dns README.tun | 187 | dh_installdocs OVERVIEW README README.dns README.tun |
188 | cat debian/copyright.head LICENCE > debian/openssh-client/usr/share/doc/openssh-client/copyright | 188 | cat debian/copyright.head LICENCE > debian/openssh-client/usr/share/doc/openssh-client/copyright |
189 | dh_installchangelogs ChangeLog | 189 | dh_installchangelogs ChangeLog ChangeLog.gssapi |
190 | install -m644 debian/openssh-client.lintian debian/openssh-client/usr/share/lintian/overrides/openssh-client | 190 | install -m644 debian/openssh-client.lintian debian/openssh-client/usr/share/lintian/overrides/openssh-client |
191 | dh_strip | 191 | dh_strip |
192 | dh_compress | 192 | dh_compress |
@@ -265,7 +265,7 @@ binary-ssh-krb5: build install | |||
265 | dh_testroot | 265 | dh_testroot |
266 | dh_installdocs | 266 | dh_installdocs |
267 | cat debian/copyright.head LICENCE > debian/ssh-krb5/usr/share/doc/ssh-krb5/copyright | 267 | cat debian/copyright.head LICENCE > debian/ssh-krb5/usr/share/doc/ssh-krb5/copyright |
268 | dh_installchangelogs ChangeLog | 268 | dh_installchangelogs ChangeLog ChangeLog.gssapi |
269 | dh_link | 269 | dh_link |
270 | dh_compress | 270 | dh_compress |
271 | dh_fixperms | 271 | dh_fixperms |
@@ -280,7 +280,7 @@ binary-ssh-askpass-gnome: build install | |||
280 | dh_testroot | 280 | dh_testroot |
281 | dh_installdocs | 281 | dh_installdocs |
282 | dh_installexamples debian/ssh-askpass-gnome.desktop | 282 | dh_installexamples debian/ssh-askpass-gnome.desktop |
283 | dh_installchangelogs ChangeLog | 283 | dh_installchangelogs ChangeLog ChangeLog.gssapi |
284 | dh_strip | 284 | dh_strip |
285 | dh_compress | 285 | dh_compress |
286 | dh_fixperms | 286 | dh_fixperms |
@@ -25,12 +25,12 @@ | |||
25 | #ifndef _DEFINES_H | 25 | #ifndef _DEFINES_H |
26 | #define _DEFINES_H | 26 | #define _DEFINES_H |
27 | 27 | ||
28 | /* $Id: defines.h,v 1.130 2005/12/17 11:04:09 dtucker Exp $ */ | 28 | /* $Id: defines.h,v 1.138 2006/09/21 13:13:30 dtucker Exp $ */ |
29 | 29 | ||
30 | 30 | ||
31 | /* Constants */ | 31 | /* Constants */ |
32 | 32 | ||
33 | #ifndef SHUT_RDWR | 33 | #if defined(HAVE_DECL_SHUT_RD) && HAVE_DECL_SHUT_RD == 0 |
34 | enum | 34 | enum |
35 | { | 35 | { |
36 | SHUT_RD = 0, /* No more receptions. */ | 36 | SHUT_RD = 0, /* No more receptions. */ |
@@ -90,8 +90,8 @@ enum | |||
90 | #endif | 90 | #endif |
91 | #endif | 91 | #endif |
92 | 92 | ||
93 | #ifndef O_NONBLOCK /* Non Blocking Open */ | 93 | #if defined(HAVE_DECL_O_NONBLOCK) && HAVE_DECL_O_NONBLOCK == 0 |
94 | # define O_NONBLOCK 00004 | 94 | # define O_NONBLOCK 00004 /* Non Blocking Open */ |
95 | #endif | 95 | #endif |
96 | 96 | ||
97 | #ifndef S_ISDIR | 97 | #ifndef S_ISDIR |
@@ -143,16 +143,11 @@ including rpc/rpc.h breaks Solaris 6 | |||
143 | #define INADDR_LOOPBACK ((u_long)0x7f000001) | 143 | #define INADDR_LOOPBACK ((u_long)0x7f000001) |
144 | #endif | 144 | #endif |
145 | 145 | ||
146 | #ifndef __unused | ||
147 | #define __unused | ||
148 | #endif | ||
149 | |||
150 | /* Types */ | 146 | /* Types */ |
151 | 147 | ||
152 | /* If sys/types.h does not supply intXX_t, supply them ourselves */ | 148 | /* If sys/types.h does not supply intXX_t, supply them ourselves */ |
153 | /* (or die trying) */ | 149 | /* (or die trying) */ |
154 | 150 | ||
155 | |||
156 | #ifndef HAVE_U_INT | 151 | #ifndef HAVE_U_INT |
157 | typedef unsigned int u_int; | 152 | typedef unsigned int u_int; |
158 | #endif | 153 | #endif |
@@ -496,6 +491,22 @@ struct winsize { | |||
496 | # define offsetof(type, member) ((size_t) &((type *)0)->member) | 491 | # define offsetof(type, member) ((size_t) &((type *)0)->member) |
497 | #endif | 492 | #endif |
498 | 493 | ||
494 | /* Set up BSD-style BYTE_ORDER definition if it isn't there already */ | ||
495 | /* XXX: doesn't try to cope with strange byte orders (PDP_ENDIAN) */ | ||
496 | #ifndef BYTE_ORDER | ||
497 | # ifndef LITTLE_ENDIAN | ||
498 | # define LITTLE_ENDIAN 1234 | ||
499 | # endif /* LITTLE_ENDIAN */ | ||
500 | # ifndef BIG_ENDIAN | ||
501 | # define BIG_ENDIAN 4321 | ||
502 | # endif /* BIG_ENDIAN */ | ||
503 | # ifdef WORDS_BIGENDIAN | ||
504 | # define BYTE_ORDER BIG_ENDIAN | ||
505 | # else /* WORDS_BIGENDIAN */ | ||
506 | # define BYTE_ORDER LITTLE_ENDIAN | ||
507 | # endif /* WORDS_BIGENDIAN */ | ||
508 | #endif /* BYTE_ORDER */ | ||
509 | |||
499 | /* Function replacement / compatibility hacks */ | 510 | /* Function replacement / compatibility hacks */ |
500 | 511 | ||
501 | #if !defined(HAVE_GETADDRINFO) && (defined(HAVE_OGETADDRINFO) || defined(HAVE_NGETADDRINFO)) | 512 | #if !defined(HAVE_GETADDRINFO) && (defined(HAVE_OGETADDRINFO) || defined(HAVE_NGETADDRINFO)) |
@@ -517,19 +528,6 @@ struct winsize { | |||
517 | # define optarg BSDoptarg | 528 | # define optarg BSDoptarg |
518 | #endif | 529 | #endif |
519 | 530 | ||
520 | /* In older versions of libpam, pam_strerror takes a single argument */ | ||
521 | #ifdef HAVE_OLD_PAM | ||
522 | # define PAM_STRERROR(a,b) pam_strerror((b)) | ||
523 | #else | ||
524 | # define PAM_STRERROR(a,b) pam_strerror((a),(b)) | ||
525 | #endif | ||
526 | |||
527 | #ifdef PAM_SUN_CODEBASE | ||
528 | # define PAM_MSG_MEMBER(msg, n, member) ((*(msg))[(n)].member) | ||
529 | #else | ||
530 | # define PAM_MSG_MEMBER(msg, n, member) ((msg)[(n)]->member) | ||
531 | #endif | ||
532 | |||
533 | #if defined(BROKEN_GETADDRINFO) && defined(HAVE_GETADDRINFO) | 531 | #if defined(BROKEN_GETADDRINFO) && defined(HAVE_GETADDRINFO) |
534 | # undef HAVE_GETADDRINFO | 532 | # undef HAVE_GETADDRINFO |
535 | #endif | 533 | #endif |
@@ -544,6 +542,11 @@ struct winsize { | |||
544 | # undef HAVE_UPDWTMPX | 542 | # undef HAVE_UPDWTMPX |
545 | #endif | 543 | #endif |
546 | 544 | ||
545 | #if defined(HAVE_OPENLOG_R) && defined(SYSLOG_DATA_INIT) && \ | ||
546 | defined(SYSLOG_R_SAFE_IN_SIGHAND) | ||
547 | # define DO_LOG_SAFE_IN_SIGHAND | ||
548 | #endif | ||
549 | |||
547 | #if !defined(HAVE_MEMMOVE) && defined(HAVE_BCOPY) | 550 | #if !defined(HAVE_MEMMOVE) && defined(HAVE_BCOPY) |
548 | # define memmove(s1, s2, n) bcopy((s2), (s1), (n)) | 551 | # define memmove(s1, s2, n) bcopy((s2), (s1), (n)) |
549 | #endif /* !defined(HAVE_MEMMOVE) && defined(HAVE_BCOPY) */ | 552 | #endif /* !defined(HAVE_MEMMOVE) && defined(HAVE_BCOPY) */ |
@@ -553,6 +556,7 @@ struct winsize { | |||
553 | #endif /* defined(HAVE_VHANGUP) && !defined(HAVE_DEV_PTMX) */ | 556 | #endif /* defined(HAVE_VHANGUP) && !defined(HAVE_DEV_PTMX) */ |
554 | 557 | ||
555 | #ifndef GETPGRP_VOID | 558 | #ifndef GETPGRP_VOID |
559 | # include <unistd.h> | ||
556 | # define getpgrp() getpgrp(0) | 560 | # define getpgrp() getpgrp(0) |
557 | #endif | 561 | #endif |
558 | 562 | ||
@@ -715,12 +719,14 @@ struct winsize { | |||
715 | # undef HAVE_MMAP | 719 | # undef HAVE_MMAP |
716 | #endif | 720 | #endif |
717 | 721 | ||
718 | /* some system headers on HP-UX define YES/NO */ | 722 | #ifndef IOV_MAX |
719 | #ifdef YES | 723 | # if defined(_XOPEN_IOV_MAX) |
720 | # undef YES | 724 | # define IOV_MAX _XOPEN_IOV_MAX |
721 | #endif | 725 | # elif defined(DEF_IOV_MAX) |
722 | #ifdef NO | 726 | # define IOV_MAX DEF_IOV_MAX |
723 | # undef NO | 727 | # else |
728 | # define IOV_MAX 16 | ||
729 | # endif | ||
724 | #endif | 730 | #endif |
725 | 731 | ||
726 | #endif /* _DEFINES_H */ | 732 | #endif /* _DEFINES_H */ |
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: dh.c,v 1.44 2006/11/07 13:02:07 markus Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2000 Niels Provos. All rights reserved. | 3 | * Copyright (c) 2000 Niels Provos. All rights reserved. |
3 | * | 4 | * |
@@ -23,17 +24,17 @@ | |||
23 | */ | 24 | */ |
24 | 25 | ||
25 | #include "includes.h" | 26 | #include "includes.h" |
26 | RCSID("$OpenBSD: dh.c,v 1.31 2004/08/04 10:37:52 djm Exp $"); | ||
27 | 27 | ||
28 | #include "xmalloc.h" | 28 | #include <sys/param.h> |
29 | 29 | ||
30 | #include <openssl/bn.h> | 30 | #include <openssl/bn.h> |
31 | #include <openssl/dh.h> | 31 | #include <openssl/dh.h> |
32 | #include <openssl/evp.h> | ||
33 | 32 | ||
34 | #include "buffer.h" | 33 | #include <stdarg.h> |
35 | #include "cipher.h" | 34 | #include <stdio.h> |
36 | #include "kex.h" | 35 | #include <stdlib.h> |
36 | #include <string.h> | ||
37 | |||
37 | #include "dh.h" | 38 | #include "dh.h" |
38 | #include "pathnames.h" | 39 | #include "pathnames.h" |
39 | #include "log.h" | 40 | #include "log.h" |
@@ -44,9 +45,11 @@ parse_prime(int linenum, char *line, struct dhgroup *dhg) | |||
44 | { | 45 | { |
45 | char *cp, *arg; | 46 | char *cp, *arg; |
46 | char *strsize, *gen, *prime; | 47 | char *strsize, *gen, *prime; |
48 | const char *errstr = NULL; | ||
47 | 49 | ||
48 | cp = line; | 50 | cp = line; |
49 | arg = strdelim(&cp); | 51 | if ((arg = strdelim(&cp)) == NULL) |
52 | return 0; | ||
50 | /* Ignore leading whitespace */ | 53 | /* Ignore leading whitespace */ |
51 | if (*arg == '\0') | 54 | if (*arg == '\0') |
52 | arg = strdelim(&cp); | 55 | arg = strdelim(&cp); |
@@ -67,7 +70,8 @@ parse_prime(int linenum, char *line, struct dhgroup *dhg) | |||
67 | goto fail; | 70 | goto fail; |
68 | strsize = strsep(&cp, " "); /* size */ | 71 | strsize = strsep(&cp, " "); /* size */ |
69 | if (cp == NULL || *strsize == '\0' || | 72 | if (cp == NULL || *strsize == '\0' || |
70 | (dhg->size = atoi(strsize)) == 0) | 73 | (dhg->size = (u_int)strtonum(strsize, 0, 64*1024, &errstr)) == 0 || |
74 | errstr) | ||
71 | goto fail; | 75 | goto fail; |
72 | /* The whole group is one bit larger */ | 76 | /* The whole group is one bit larger */ |
73 | dhg->size++; | 77 | dhg->size++; |
@@ -178,19 +182,36 @@ dh_pub_is_valid(DH *dh, BIGNUM *dh_pub) | |||
178 | int i; | 182 | int i; |
179 | int n = BN_num_bits(dh_pub); | 183 | int n = BN_num_bits(dh_pub); |
180 | int bits_set = 0; | 184 | int bits_set = 0; |
185 | BIGNUM *tmp; | ||
181 | 186 | ||
182 | if (dh_pub->neg) { | 187 | if (dh_pub->neg) { |
183 | logit("invalid public DH value: negativ"); | 188 | logit("invalid public DH value: negativ"); |
184 | return 0; | 189 | return 0; |
185 | } | 190 | } |
191 | if (BN_cmp(dh_pub, BN_value_one()) != 1) { /* pub_exp <= 1 */ | ||
192 | logit("invalid public DH value: <= 1"); | ||
193 | return 0; | ||
194 | } | ||
195 | |||
196 | if ((tmp = BN_new()) == NULL) | ||
197 | return (-1); | ||
198 | if (!BN_sub(tmp, dh->p, BN_value_one()) || | ||
199 | BN_cmp(dh_pub, tmp) != -1) { /* pub_exp > p-2 */ | ||
200 | BN_clear_free(tmp); | ||
201 | logit("invalid public DH value: >= p-1"); | ||
202 | return 0; | ||
203 | } | ||
204 | BN_clear_free(tmp); | ||
205 | |||
186 | for (i = 0; i <= n; i++) | 206 | for (i = 0; i <= n; i++) |
187 | if (BN_is_bit_set(dh_pub, i)) | 207 | if (BN_is_bit_set(dh_pub, i)) |
188 | bits_set++; | 208 | bits_set++; |
189 | debug2("bits set: %d/%d", bits_set, BN_num_bits(dh->p)); | 209 | debug2("bits set: %d/%d", bits_set, BN_num_bits(dh->p)); |
190 | 210 | ||
191 | /* if g==2 and bits_set==1 then computing log_g(dh_pub) is trivial */ | 211 | /* if g==2 and bits_set==1 then computing log_g(dh_pub) is trivial */ |
192 | if (bits_set > 1 && (BN_cmp(dh_pub, dh->p) == -1)) | 212 | if (bits_set > 1) |
193 | return 1; | 213 | return 1; |
214 | |||
194 | logit("invalid public DH value (%d/%d)", bits_set, BN_num_bits(dh->p)); | 215 | logit("invalid public DH value (%d/%d)", bits_set, BN_num_bits(dh->p)); |
195 | return 0; | 216 | return 0; |
196 | } | 217 | } |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dh.h,v 1.8 2004/06/13 12:53:24 djm Exp $ */ | 1 | /* $OpenBSD: dh.h,v 1.9 2006/03/25 22:22:43 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2000 Niels Provos. All rights reserved. | 4 | * Copyright (c) 2000 Niels Provos. All rights reserved. |
diff --git a/dispatch.c b/dispatch.c index c5ff65031..d6b63be4b 100644 --- a/dispatch.c +++ b/dispatch.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: dispatch.c,v 1.21 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
3 | * | 4 | * |
@@ -21,8 +22,13 @@ | |||
21 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
22 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 24 | */ |
25 | |||
24 | #include "includes.h" | 26 | #include "includes.h" |
25 | RCSID("$OpenBSD: dispatch.c,v 1.16 2003/04/08 20:21:28 itojun Exp $"); | 27 | |
28 | #include <sys/types.h> | ||
29 | |||
30 | #include <signal.h> | ||
31 | #include <stdarg.h> | ||
26 | 32 | ||
27 | #include "ssh1.h" | 33 | #include "ssh1.h" |
28 | #include "ssh2.h" | 34 | #include "ssh2.h" |
@@ -76,7 +82,7 @@ dispatch_set(int type, dispatch_fn *fn) | |||
76 | dispatch[type] = fn; | 82 | dispatch[type] = fn; |
77 | } | 83 | } |
78 | void | 84 | void |
79 | dispatch_run(int mode, int *done, void *ctxt) | 85 | dispatch_run(int mode, volatile sig_atomic_t *done, void *ctxt) |
80 | { | 86 | { |
81 | for (;;) { | 87 | for (;;) { |
82 | int type; | 88 | int type; |
diff --git a/dispatch.h b/dispatch.h index a82e2165b..3e3d1a1ad 100644 --- a/dispatch.h +++ b/dispatch.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dispatch.h,v 1.9 2002/01/11 13:39:36 markus Exp $ */ | 1 | /* $OpenBSD: dispatch.h,v 1.11 2006/04/20 09:27:09 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
@@ -23,6 +23,9 @@ | |||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 | */ | 25 | */ |
26 | |||
27 | #include <signal.h> | ||
28 | |||
26 | enum { | 29 | enum { |
27 | DISPATCH_BLOCK, | 30 | DISPATCH_BLOCK, |
28 | DISPATCH_NONBLOCK | 31 | DISPATCH_NONBLOCK |
@@ -33,6 +36,6 @@ typedef void dispatch_fn(int, u_int32_t, void *); | |||
33 | void dispatch_init(dispatch_fn *); | 36 | void dispatch_init(dispatch_fn *); |
34 | void dispatch_set(int, dispatch_fn *); | 37 | void dispatch_set(int, dispatch_fn *); |
35 | void dispatch_range(u_int, u_int, dispatch_fn *); | 38 | void dispatch_range(u_int, u_int, dispatch_fn *); |
36 | void dispatch_run(int, int *, void *); | 39 | void dispatch_run(int, volatile sig_atomic_t *, void *); |
37 | void dispatch_protocol_error(int, u_int32_t, void *); | 40 | void dispatch_protocol_error(int, u_int32_t, void *); |
38 | void dispatch_protocol_ignore(int, u_int32_t, void *); | 41 | void dispatch_protocol_ignore(int, u_int32_t, void *); |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dns.c,v 1.16 2005/10/17 14:13:35 stevesk Exp $ */ | 1 | /* $OpenBSD: dns.c,v 1.24 2007/01/03 03:01:40 stevesk Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2003 Wesley Griffin. All rights reserved. | 4 | * Copyright (c) 2003 Wesley Griffin. All rights reserved. |
@@ -26,9 +26,14 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include "includes.h" | 28 | #include "includes.h" |
29 | RCSID("$OpenBSD: dns.c,v 1.16 2005/10/17 14:13:35 stevesk Exp $"); | 29 | |
30 | #include <sys/types.h> | ||
31 | #include <sys/socket.h> | ||
30 | 32 | ||
31 | #include <netdb.h> | 33 | #include <netdb.h> |
34 | #include <stdarg.h> | ||
35 | #include <stdio.h> | ||
36 | #include <string.h> | ||
32 | 37 | ||
33 | #include "xmalloc.h" | 38 | #include "xmalloc.h" |
34 | #include "key.h" | 39 | #include "key.h" |
@@ -122,7 +127,7 @@ dns_read_rdata(u_int8_t *algorithm, u_int8_t *digest_type, | |||
122 | *digest = (u_char *) xmalloc(*digest_len); | 127 | *digest = (u_char *) xmalloc(*digest_len); |
123 | memcpy(*digest, rdata + 2, *digest_len); | 128 | memcpy(*digest, rdata + 2, *digest_len); |
124 | } else { | 129 | } else { |
125 | *digest = xstrdup(""); | 130 | *digest = (u_char *)xstrdup(""); |
126 | } | 131 | } |
127 | 132 | ||
128 | success = 1; | 133 | success = 1; |
@@ -212,7 +217,7 @@ verify_host_key_dns(const char *hostname, struct sockaddr *address, | |||
212 | if (fingerprints->rri_nrdatas) | 217 | if (fingerprints->rri_nrdatas) |
213 | *flags |= DNS_VERIFY_FOUND; | 218 | *flags |= DNS_VERIFY_FOUND; |
214 | 219 | ||
215 | for (counter = 0; counter < fingerprints->rri_nrdatas; counter++) { | 220 | for (counter = 0; counter < fingerprints->rri_nrdatas; counter++) { |
216 | /* | 221 | /* |
217 | * Extract the key from the answer. Ignore any badly | 222 | * Extract the key from the answer. Ignore any badly |
218 | * formatted fingerprints. | 223 | * formatted fingerprints. |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dns.h,v 1.6 2005/10/17 14:13:35 stevesk Exp $ */ | 1 | /* $OpenBSD: dns.h,v 1.10 2006/08/03 03:34:42 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2003 Wesley Griffin. All rights reserved. | 4 | * Copyright (c) 2003 Wesley Griffin. All rights reserved. |
@@ -25,8 +25,6 @@ | |||
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include "includes.h" | ||
29 | |||
30 | #ifndef DNS_H | 28 | #ifndef DNS_H |
31 | #define DNS_H | 29 | #define DNS_H |
32 | 30 | ||
@@ -24,6 +24,20 @@ | |||
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | 26 | ||
27 | #include <sys/types.h> | ||
28 | #include <sys/wait.h> | ||
29 | |||
30 | #ifdef HAVE_SYS_STAT_H | ||
31 | # include <sys/stat.h> | ||
32 | #endif | ||
33 | |||
34 | #ifdef HAVE_FCNTL_H | ||
35 | # include <fcntl.h> | ||
36 | #endif | ||
37 | #include <stdarg.h> | ||
38 | #include <unistd.h> | ||
39 | #include <signal.h> | ||
40 | |||
27 | #include <openssl/rand.h> | 41 | #include <openssl/rand.h> |
28 | #include <openssl/crypto.h> | 42 | #include <openssl/crypto.h> |
29 | #include <openssl/err.h> | 43 | #include <openssl/err.h> |
@@ -35,7 +49,6 @@ | |||
35 | #include "pathnames.h" | 49 | #include "pathnames.h" |
36 | #include "log.h" | 50 | #include "log.h" |
37 | #include "buffer.h" | 51 | #include "buffer.h" |
38 | #include "bufaux.h" | ||
39 | 52 | ||
40 | /* | 53 | /* |
41 | * Portable OpenSSH PRNG seeding: | 54 | * Portable OpenSSH PRNG seeding: |
@@ -48,8 +61,6 @@ | |||
48 | * XXX: we should tell the child how many bytes we need. | 61 | * XXX: we should tell the child how many bytes we need. |
49 | */ | 62 | */ |
50 | 63 | ||
51 | RCSID("$Id: entropy.c,v 1.52 2005/09/27 22:26:30 dtucker Exp $"); | ||
52 | |||
53 | #ifndef OPENSSL_PRNG_ONLY | 64 | #ifndef OPENSSL_PRNG_ONLY |
54 | #define RANDOM_SEED_SIZE 48 | 65 | #define RANDOM_SEED_SIZE 48 |
55 | static uid_t original_uid, original_euid; | 66 | static uid_t original_uid, original_euid; |
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: fatal.c,v 1.7 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2002 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2002 Markus Friedl. All rights reserved. |
3 | * | 4 | * |
@@ -23,7 +24,10 @@ | |||
23 | */ | 24 | */ |
24 | 25 | ||
25 | #include "includes.h" | 26 | #include "includes.h" |
26 | RCSID("$OpenBSD: fatal.c,v 1.2 2003/09/23 20:17:11 markus Exp $"); | 27 | |
28 | #include <sys/types.h> | ||
29 | |||
30 | #include <stdarg.h> | ||
27 | 31 | ||
28 | #include "log.h" | 32 | #include "log.h" |
29 | 33 | ||
@@ -33,6 +37,7 @@ void | |||
33 | fatal(const char *fmt,...) | 37 | fatal(const char *fmt,...) |
34 | { | 38 | { |
35 | va_list args; | 39 | va_list args; |
40 | |||
36 | va_start(args, fmt); | 41 | va_start(args, fmt); |
37 | do_log(SYSLOG_LEVEL_FATAL, fmt, args); | 42 | do_log(SYSLOG_LEVEL_FATAL, fmt, args); |
38 | va_end(args); | 43 | va_end(args); |
diff --git a/getput.h b/getput.h deleted file mode 100644 index 20cf8f20b..000000000 --- a/getput.h +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
1 | /* $OpenBSD: getput.h,v 1.8 2002/03/04 17:27:39 stevesk Exp $ */ | ||
2 | |||
3 | /* | ||
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | ||
5 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | ||
6 | * All rights reserved | ||
7 | * Macros for storing and retrieving data in msb first and lsb first order. | ||
8 | * | ||
9 | * As far as I am concerned, the code I have written for this software | ||
10 | * can be used freely for any purpose. Any derived versions of this | ||
11 | * software must be clearly marked as such, and if the derived work is | ||
12 | * incompatible with the protocol description in the RFC file, it must be | ||
13 | * called by a name other than "ssh" or "Secure Shell". | ||
14 | */ | ||
15 | |||
16 | #ifndef GETPUT_H | ||
17 | #define GETPUT_H | ||
18 | |||
19 | /*------------ macros for storing/extracting msb first words -------------*/ | ||
20 | |||
21 | #define GET_64BIT(cp) (((u_int64_t)(u_char)(cp)[0] << 56) | \ | ||
22 | ((u_int64_t)(u_char)(cp)[1] << 48) | \ | ||
23 | ((u_int64_t)(u_char)(cp)[2] << 40) | \ | ||
24 | ((u_int64_t)(u_char)(cp)[3] << 32) | \ | ||
25 | ((u_int64_t)(u_char)(cp)[4] << 24) | \ | ||
26 | ((u_int64_t)(u_char)(cp)[5] << 16) | \ | ||
27 | ((u_int64_t)(u_char)(cp)[6] << 8) | \ | ||
28 | ((u_int64_t)(u_char)(cp)[7])) | ||
29 | |||
30 | #define GET_32BIT(cp) (((u_long)(u_char)(cp)[0] << 24) | \ | ||
31 | ((u_long)(u_char)(cp)[1] << 16) | \ | ||
32 | ((u_long)(u_char)(cp)[2] << 8) | \ | ||
33 | ((u_long)(u_char)(cp)[3])) | ||
34 | |||
35 | #define GET_16BIT(cp) (((u_long)(u_char)(cp)[0] << 8) | \ | ||
36 | ((u_long)(u_char)(cp)[1])) | ||
37 | |||
38 | #define PUT_64BIT(cp, value) do { \ | ||
39 | (cp)[0] = (value) >> 56; \ | ||
40 | (cp)[1] = (value) >> 48; \ | ||
41 | (cp)[2] = (value) >> 40; \ | ||
42 | (cp)[3] = (value) >> 32; \ | ||
43 | (cp)[4] = (value) >> 24; \ | ||
44 | (cp)[5] = (value) >> 16; \ | ||
45 | (cp)[6] = (value) >> 8; \ | ||
46 | (cp)[7] = (value); } while (0) | ||
47 | |||
48 | #define PUT_32BIT(cp, value) do { \ | ||
49 | (cp)[0] = (value) >> 24; \ | ||
50 | (cp)[1] = (value) >> 16; \ | ||
51 | (cp)[2] = (value) >> 8; \ | ||
52 | (cp)[3] = (value); } while (0) | ||
53 | |||
54 | #define PUT_16BIT(cp, value) do { \ | ||
55 | (cp)[0] = (value) >> 8; \ | ||
56 | (cp)[1] = (value); } while (0) | ||
57 | |||
58 | #endif /* GETPUT_H */ | ||
diff --git a/groupaccess.c b/groupaccess.c index f50879f83..e73f62b22 100644 --- a/groupaccess.c +++ b/groupaccess.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: groupaccess.c,v 1.12 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2001 Kevin Steves. All rights reserved. | 3 | * Copyright (c) 2001 Kevin Steves. All rights reserved. |
3 | * | 4 | * |
@@ -23,10 +24,16 @@ | |||
23 | */ | 24 | */ |
24 | 25 | ||
25 | #include "includes.h" | 26 | #include "includes.h" |
26 | RCSID("$OpenBSD: groupaccess.c,v 1.6 2003/04/08 20:21:28 itojun Exp $"); | ||
27 | 27 | ||
28 | #include "groupaccess.h" | 28 | #include <sys/types.h> |
29 | #include <sys/param.h> | ||
30 | |||
31 | #include <grp.h> | ||
32 | #include <unistd.h> | ||
33 | #include <stdarg.h> | ||
34 | |||
29 | #include "xmalloc.h" | 35 | #include "xmalloc.h" |
36 | #include "groupaccess.h" | ||
30 | #include "match.h" | 37 | #include "match.h" |
31 | #include "log.h" | 38 | #include "log.h" |
32 | 39 | ||
@@ -52,8 +59,8 @@ ga_init(const char *user, gid_t base) | |||
52 | ngroups = MAX(NGROUPS_MAX, sysconf(_SC_NGROUPS_MAX)); | 59 | ngroups = MAX(NGROUPS_MAX, sysconf(_SC_NGROUPS_MAX)); |
53 | #endif | 60 | #endif |
54 | 61 | ||
55 | groups_bygid = xmalloc(ngroups * sizeof(*groups_bygid)); | 62 | groups_bygid = xcalloc(ngroups, sizeof(*groups_bygid)); |
56 | groups_byname = xmalloc(ngroups * sizeof(*groups_byname)); | 63 | groups_byname = xcalloc(ngroups, sizeof(*groups_byname)); |
57 | 64 | ||
58 | if (getgrouplist(user, base, groups_bygid, &ngroups) == -1) | 65 | if (getgrouplist(user, base, groups_bygid, &ngroups) == -1) |
59 | logit("getgrouplist: groups list too small"); | 66 | logit("getgrouplist: groups list too small"); |
diff --git a/groupaccess.h b/groupaccess.h index ede4805c2..04b449894 100644 --- a/groupaccess.h +++ b/groupaccess.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: groupaccess.h,v 1.4 2001/06/26 17:27:23 markus Exp $ */ | 1 | /* $OpenBSD: groupaccess.h,v 1.7 2006/08/03 03:34:42 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2001 Kevin Steves. All rights reserved. | 4 | * Copyright (c) 2001 Kevin Steves. All rights reserved. |
@@ -27,8 +27,6 @@ | |||
27 | #ifndef GROUPACCESS_H | 27 | #ifndef GROUPACCESS_H |
28 | #define GROUPACCESS_H | 28 | #define GROUPACCESS_H |
29 | 29 | ||
30 | #include <grp.h> | ||
31 | |||
32 | int ga_init(const char *, gid_t); | 30 | int ga_init(const char *, gid_t); |
33 | int ga_match(char * const *, int); | 31 | int ga_match(char * const *, int); |
34 | void ga_free(void); | 32 | void ga_free(void); |
diff --git a/gss-genr.c b/gss-genr.c index dfaa708ea..42f942b58 100644 --- a/gss-genr.c +++ b/gss-genr.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* $OpenBSD: gss-genr.c,v 1.6 2005/10/13 22:24:31 stevesk Exp $ */ | 1 | /* $OpenBSD: gss-genr.c,v 1.17 2006/08/29 12:02:30 dtucker Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2001-2005 Simon Wilkinson. All rights reserved. | 4 | * Copyright (c) 2001-2006 Simon Wilkinson. All rights reserved. |
5 | * | 5 | * |
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without |
7 | * modification, are permitted provided that the following conditions | 7 | * modification, are permitted provided that the following conditions |
@@ -28,10 +28,20 @@ | |||
28 | 28 | ||
29 | #ifdef GSSAPI | 29 | #ifdef GSSAPI |
30 | 30 | ||
31 | #include <sys/types.h> | ||
32 | #include <sys/param.h> | ||
33 | |||
34 | #include <stdarg.h> | ||
35 | #include <string.h> | ||
36 | #include <unistd.h> | ||
37 | |||
31 | #include "xmalloc.h" | 38 | #include "xmalloc.h" |
32 | #include "bufaux.h" | 39 | #include "buffer.h" |
33 | #include "log.h" | 40 | #include "log.h" |
34 | #include "ssh2.h" | 41 | #include "ssh2.h" |
42 | #include "cipher.h" | ||
43 | #include "key.h" | ||
44 | #include "kex.h" | ||
35 | #include <openssl/evp.h> | 45 | #include <openssl/evp.h> |
36 | 46 | ||
37 | #include "ssh-gss.h" | 47 | #include "ssh-gss.h" |
@@ -65,7 +75,6 @@ ssh_gssapi_oid_table_ok() { | |||
65 | * a key exchange with a bad mechanism | 75 | * a key exchange with a bad mechanism |
66 | */ | 76 | */ |
67 | 77 | ||
68 | |||
69 | char * | 78 | char * |
70 | ssh_gssapi_client_mechanisms(const char *host) { | 79 | ssh_gssapi_client_mechanisms(const char *host) { |
71 | gss_OID_set gss_supported; | 80 | gss_OID_set gss_supported; |
@@ -74,35 +83,36 @@ ssh_gssapi_client_mechanisms(const char *host) { | |||
74 | gss_indicate_mechs(&min_status, &gss_supported); | 83 | gss_indicate_mechs(&min_status, &gss_supported); |
75 | 84 | ||
76 | return(ssh_gssapi_kex_mechs(gss_supported, ssh_gssapi_check_mechanism, | 85 | return(ssh_gssapi_kex_mechs(gss_supported, ssh_gssapi_check_mechanism, |
77 | (void *)host)); | 86 | host)); |
78 | } | 87 | } |
79 | 88 | ||
80 | char * | 89 | char * |
81 | ssh_gssapi_kex_mechs(gss_OID_set gss_supported, ssh_gssapi_check_fn *check, | 90 | ssh_gssapi_kex_mechs(gss_OID_set gss_supported, ssh_gssapi_check_fn *check, |
82 | void *data) { | 91 | const char *data) { |
83 | Buffer buf; | 92 | Buffer buf; |
84 | int i, oidpos, enclen; | 93 | size_t i; |
94 | int oidpos, enclen; | ||
85 | char *mechs, *encoded; | 95 | char *mechs, *encoded; |
86 | char digest[EVP_MAX_MD_SIZE]; | 96 | u_char digest[EVP_MAX_MD_SIZE]; |
87 | char deroid[2]; | 97 | char deroid[2]; |
88 | const EVP_MD *evp_md = EVP_md5(); | 98 | const EVP_MD *evp_md = EVP_md5(); |
89 | EVP_MD_CTX md; | 99 | EVP_MD_CTX md; |
90 | 100 | ||
91 | if (gss_enc2oid != NULL) { | 101 | if (gss_enc2oid != NULL) { |
92 | for (i=0;gss_enc2oid[i].encoded!=NULL;i++) | 102 | for (i = 0; gss_enc2oid[i].encoded != NULL; i++) |
93 | xfree(gss_enc2oid[i].encoded); | 103 | xfree(gss_enc2oid[i].encoded); |
94 | xfree(gss_enc2oid); | 104 | xfree(gss_enc2oid); |
95 | } | 105 | } |
96 | 106 | ||
97 | gss_enc2oid = xmalloc(sizeof(ssh_gss_kex_mapping)* | 107 | gss_enc2oid = xmalloc(sizeof(ssh_gss_kex_mapping) * |
98 | (gss_supported->count+1)); | 108 | (gss_supported->count + 1)); |
99 | 109 | ||
100 | buffer_init(&buf); | 110 | buffer_init(&buf); |
101 | 111 | ||
102 | oidpos = 0; | 112 | oidpos = 0; |
103 | for (i = 0;i < gss_supported->count;i++) { | 113 | for (i = 0; i < gss_supported->count; i++) { |
104 | if (gss_supported->elements[i].length < 128 && | 114 | if (gss_supported->elements[i].length < 128 && |
105 | (*check)(&(gss_supported->elements[i]), data)) { | 115 | (*check)(NULL, &(gss_supported->elements[i]), data)) { |
106 | 116 | ||
107 | deroid[0] = SSH_GSS_OIDTYPE; | 117 | deroid[0] = SSH_GSS_OIDTYPE; |
108 | deroid[1] = gss_supported->elements[i].length; | 118 | deroid[1] = gss_supported->elements[i].length; |
@@ -114,19 +124,23 @@ ssh_gssapi_kex_mechs(gss_OID_set gss_supported, ssh_gssapi_check_fn *check, | |||
114 | gss_supported->elements[i].length); | 124 | gss_supported->elements[i].length); |
115 | EVP_DigestFinal(&md, digest, NULL); | 125 | EVP_DigestFinal(&md, digest, NULL); |
116 | 126 | ||
117 | encoded = xmalloc(EVP_MD_size(evp_md)*2); | 127 | encoded = xmalloc(EVP_MD_size(evp_md) * 2); |
118 | enclen = __b64_ntop(digest, EVP_MD_size(evp_md), | 128 | enclen = __b64_ntop(digest, EVP_MD_size(evp_md), |
119 | encoded, EVP_MD_size(evp_md)*2); | 129 | encoded, EVP_MD_size(evp_md) * 2); |
120 | 130 | ||
121 | if (oidpos != 0) | 131 | if (oidpos != 0) |
122 | buffer_put_char(&buf, ','); | 132 | buffer_put_char(&buf, ','); |
123 | 133 | ||
124 | buffer_append(&buf, KEX_GSS_GEX_SHA1_ID, | 134 | buffer_append(&buf, KEX_GSS_GEX_SHA1_ID, |
125 | sizeof(KEX_GSS_GEX_SHA1_ID)-1); | 135 | sizeof(KEX_GSS_GEX_SHA1_ID) - 1); |
126 | buffer_append(&buf, encoded, enclen); | 136 | buffer_append(&buf, encoded, enclen); |
127 | buffer_put_char(&buf,','); | 137 | buffer_put_char(&buf, ','); |
128 | buffer_append(&buf, KEX_GSS_GRP1_SHA1_ID, | 138 | buffer_append(&buf, KEX_GSS_GRP1_SHA1_ID, |
129 | sizeof(KEX_GSS_GRP1_SHA1_ID)-1); | 139 | sizeof(KEX_GSS_GRP1_SHA1_ID) - 1); |
140 | buffer_append(&buf, encoded, enclen); | ||
141 | buffer_put_char(&buf, ','); | ||
142 | buffer_append(&buf, KEX_GSS_GRP14_SHA1_ID, | ||
143 | sizeof(KEX_GSS_GRP14_SHA1_ID) - 1); | ||
130 | buffer_append(&buf, encoded, enclen); | 144 | buffer_append(&buf, encoded, enclen); |
131 | 145 | ||
132 | gss_enc2oid[oidpos].oid = &(gss_supported->elements[i]); | 146 | gss_enc2oid[oidpos].oid = &(gss_supported->elements[i]); |
@@ -152,25 +166,26 @@ ssh_gssapi_kex_mechs(gss_OID_set gss_supported, ssh_gssapi_check_fn *check, | |||
152 | } | 166 | } |
153 | 167 | ||
154 | gss_OID | 168 | gss_OID |
155 | ssh_gssapi_id_kex(Gssctxt *ctx, char *name, int *gex) { | 169 | ssh_gssapi_id_kex(Gssctxt *ctx, char *name, int kex_type) { |
156 | int i = 0; | 170 | int i = 0; |
157 | 171 | ||
158 | if (strncmp(name, KEX_GSS_GRP1_SHA1_ID, | 172 | switch (kex_type) { |
159 | sizeof(KEX_GSS_GRP1_SHA1_ID)-1) == 0) { | 173 | case KEX_GSS_GRP1_SHA1: |
160 | name+=sizeof(KEX_GSS_GRP1_SHA1_ID)-1; | 174 | name += sizeof(KEX_GSS_GRP1_SHA1_ID) - 1; |
161 | *gex = 0; | 175 | break; |
162 | } else if (strncmp(name, KEX_GSS_GEX_SHA1_ID, | 176 | case KEX_GSS_GRP14_SHA1: |
163 | sizeof(KEX_GSS_GEX_SHA1_ID)-1) == 0) { | 177 | name += sizeof(KEX_GSS_GRP14_SHA1_ID) - 1; |
164 | name+=sizeof(KEX_GSS_GEX_SHA1_ID)-1; | 178 | break; |
165 | *gex = 1; | 179 | case KEX_GSS_GEX_SHA1: |
166 | } else { | 180 | name += sizeof(KEX_GSS_GEX_SHA1_ID) - 1; |
167 | return NULL; | 181 | break; |
182 | default: | ||
183 | return GSS_C_NO_OID; | ||
168 | } | 184 | } |
169 | 185 | ||
170 | while (gss_enc2oid[i].encoded != NULL && | 186 | while (gss_enc2oid[i].encoded != NULL && |
171 | strcmp(name, gss_enc2oid[i].encoded) != 0) { | 187 | strcmp(name, gss_enc2oid[i].encoded) != 0) |
172 | i++; | 188 | i++; |
173 | } | ||
174 | 189 | ||
175 | if (gss_enc2oid[i].oid != NULL && ctx != NULL) | 190 | if (gss_enc2oid[i].oid != NULL && ctx != NULL) |
176 | ssh_gssapi_set_oid(ctx, gss_enc2oid[i].oid); | 191 | ssh_gssapi_set_oid(ctx, gss_enc2oid[i].oid); |
@@ -212,7 +227,11 @@ ssh_gssapi_set_oid(Gssctxt *ctx, gss_OID oid) | |||
212 | void | 227 | void |
213 | ssh_gssapi_error(Gssctxt *ctxt) | 228 | ssh_gssapi_error(Gssctxt *ctxt) |
214 | { | 229 | { |
215 | debug("%s", ssh_gssapi_last_error(ctxt, NULL, NULL)); | 230 | char *s; |
231 | |||
232 | s = ssh_gssapi_last_error(ctxt, NULL, NULL); | ||
233 | debug("%s", s); | ||
234 | xfree(s); | ||
216 | } | 235 | } |
217 | 236 | ||
218 | char * | 237 | char * |
@@ -236,7 +255,7 @@ ssh_gssapi_last_error(Gssctxt *ctxt, OM_uint32 *major_status, | |||
236 | /* The GSSAPI error */ | 255 | /* The GSSAPI error */ |
237 | do { | 256 | do { |
238 | gss_display_status(&lmin, ctxt->major, | 257 | gss_display_status(&lmin, ctxt->major, |
239 | GSS_C_GSS_CODE, GSS_C_NULL_OID, &ctx, &msg); | 258 | GSS_C_GSS_CODE, ctxt->oid, &ctx, &msg); |
240 | 259 | ||
241 | buffer_append(&b, msg.value, msg.length); | 260 | buffer_append(&b, msg.value, msg.length); |
242 | buffer_put_char(&b, '\n'); | 261 | buffer_put_char(&b, '\n'); |
@@ -247,7 +266,7 @@ ssh_gssapi_last_error(Gssctxt *ctxt, OM_uint32 *major_status, | |||
247 | /* The mechanism specific error */ | 266 | /* The mechanism specific error */ |
248 | do { | 267 | do { |
249 | gss_display_status(&lmin, ctxt->minor, | 268 | gss_display_status(&lmin, ctxt->minor, |
250 | GSS_C_MECH_CODE, GSS_C_NULL_OID, &ctx, &msg); | 269 | GSS_C_MECH_CODE, ctxt->oid, &ctx, &msg); |
251 | 270 | ||
252 | buffer_append(&b, msg.value, msg.length); | 271 | buffer_append(&b, msg.value, msg.length); |
253 | buffer_put_char(&b, '\n'); | 272 | buffer_put_char(&b, '\n'); |
@@ -271,9 +290,7 @@ ssh_gssapi_last_error(Gssctxt *ctxt, OM_uint32 *major_status, | |||
271 | void | 290 | void |
272 | ssh_gssapi_build_ctx(Gssctxt **ctx) | 291 | ssh_gssapi_build_ctx(Gssctxt **ctx) |
273 | { | 292 | { |
274 | *ctx = xmalloc(sizeof (Gssctxt)); | 293 | *ctx = xcalloc(1, sizeof (Gssctxt)); |
275 | (*ctx)->major = 0; | ||
276 | (*ctx)->minor = 0; | ||
277 | (*ctx)->context = GSS_C_NO_CONTEXT; | 294 | (*ctx)->context = GSS_C_NO_CONTEXT; |
278 | (*ctx)->name = GSS_C_NO_NAME; | 295 | (*ctx)->name = GSS_C_NO_NAME; |
279 | (*ctx)->oid = GSS_C_NO_OID; | 296 | (*ctx)->oid = GSS_C_NO_OID; |
@@ -343,10 +360,11 @@ OM_uint32 | |||
343 | ssh_gssapi_import_name(Gssctxt *ctx, const char *host) | 360 | ssh_gssapi_import_name(Gssctxt *ctx, const char *host) |
344 | { | 361 | { |
345 | gss_buffer_desc gssbuf; | 362 | gss_buffer_desc gssbuf; |
363 | char *val; | ||
346 | 364 | ||
347 | gssbuf.length = sizeof("host@") + strlen(host); | 365 | xasprintf(&val, "host@%s", host); |
348 | gssbuf.value = xmalloc(gssbuf.length); | 366 | gssbuf.value = val; |
349 | snprintf(gssbuf.value, gssbuf.length, "host@%s", host); | 367 | gssbuf.length = strlen(gssbuf.value); |
350 | 368 | ||
351 | if ((ctx->major = gss_import_name(&ctx->minor, | 369 | if ((ctx->major = gss_import_name(&ctx->minor, |
352 | &gssbuf, GSS_C_NT_HOSTBASED_SERVICE, &ctx->name))) | 370 | &gssbuf, GSS_C_NT_HOSTBASED_SERVICE, &ctx->name))) |
@@ -356,35 +374,6 @@ ssh_gssapi_import_name(Gssctxt *ctx, const char *host) | |||
356 | return (ctx->major); | 374 | return (ctx->major); |
357 | } | 375 | } |
358 | 376 | ||
359 | /* Acquire credentials for a server running on the current host. | ||
360 | * Requires that the context structure contains a valid OID | ||
361 | */ | ||
362 | |||
363 | /* Returns a GSSAPI error code */ | ||
364 | OM_uint32 | ||
365 | ssh_gssapi_acquire_cred(Gssctxt *ctx) | ||
366 | { | ||
367 | OM_uint32 status; | ||
368 | char lname[MAXHOSTNAMELEN]; | ||
369 | gss_OID_set oidset; | ||
370 | |||
371 | gss_create_empty_oid_set(&status, &oidset); | ||
372 | gss_add_oid_set_member(&status, ctx->oid, &oidset); | ||
373 | |||
374 | if (gethostname(lname, MAXHOSTNAMELEN)) | ||
375 | return (-1); | ||
376 | |||
377 | if (GSS_ERROR(ssh_gssapi_import_name(ctx, lname))) | ||
378 | return (ctx->major); | ||
379 | |||
380 | if ((ctx->major = gss_acquire_cred(&ctx->minor, | ||
381 | ctx->name, 0, oidset, GSS_C_ACCEPT, &ctx->creds, NULL, NULL))) | ||
382 | ssh_gssapi_error(ctx); | ||
383 | |||
384 | gss_release_oid_set(&status, &oidset); | ||
385 | return (ctx->major); | ||
386 | } | ||
387 | |||
388 | OM_uint32 | 377 | OM_uint32 |
389 | ssh_gssapi_sign(Gssctxt *ctx, gss_buffer_t buffer, gss_buffer_t hash) | 378 | ssh_gssapi_sign(Gssctxt *ctx, gss_buffer_t buffer, gss_buffer_t hash) |
390 | { | 379 | { |
@@ -423,28 +412,37 @@ ssh_gssapi_buildmic(Buffer *b, const char *user, const char *service, | |||
423 | buffer_put_cstring(b, context); | 412 | buffer_put_cstring(b, context); |
424 | } | 413 | } |
425 | 414 | ||
426 | OM_uint32 | 415 | int |
427 | ssh_gssapi_server_ctx(Gssctxt **ctx, gss_OID oid) | 416 | ssh_gssapi_check_mechanism(Gssctxt **ctx, gss_OID oid, const char *host) |
428 | { | 417 | { |
429 | if (*ctx) | 418 | gss_buffer_desc token = GSS_C_EMPTY_BUFFER; |
430 | ssh_gssapi_delete_ctx(ctx); | 419 | OM_uint32 major, minor; |
420 | gss_OID_desc spnego_oid = {6, (void *)"\x2B\x06\x01\x05\x05\x02"}; | ||
421 | Gssctxt *intctx = NULL; | ||
422 | |||
423 | if (ctx == NULL) | ||
424 | ctx = &intctx; | ||
425 | |||
426 | /* RFC 4462 says we MUST NOT do SPNEGO */ | ||
427 | if (oid->length == spnego_oid.length && | ||
428 | (memcmp(oid->elements, spnego_oid.elements, oid->length) == 0)) | ||
429 | return 0; /* false */ | ||
430 | |||
431 | ssh_gssapi_build_ctx(ctx); | 431 | ssh_gssapi_build_ctx(ctx); |
432 | ssh_gssapi_set_oid(*ctx, oid); | 432 | ssh_gssapi_set_oid(*ctx, oid); |
433 | return (ssh_gssapi_acquire_cred(*ctx)); | 433 | major = ssh_gssapi_import_name(*ctx, host); |
434 | } | 434 | if (!GSS_ERROR(major)) { |
435 | major = ssh_gssapi_init_ctx(*ctx, 0, GSS_C_NO_BUFFER, &token, | ||
436 | NULL); | ||
437 | gss_release_buffer(&minor, &token); | ||
438 | if ((*ctx)->context != GSS_C_NO_CONTEXT) | ||
439 | gss_delete_sec_context(&minor, &(*ctx)->context, | ||
440 | GSS_C_NO_BUFFER); | ||
441 | } | ||
442 | |||
443 | if (GSS_ERROR(major) || intctx != NULL) | ||
444 | ssh_gssapi_delete_ctx(ctx); | ||
435 | 445 | ||
436 | int | ||
437 | ssh_gssapi_check_mechanism(gss_OID oid, void *host) { | ||
438 | Gssctxt * ctx = NULL; | ||
439 | gss_buffer_desc token = GSS_C_EMPTY_BUFFER; | ||
440 | OM_uint32 major, minor; | ||
441 | |||
442 | ssh_gssapi_build_ctx(&ctx); | ||
443 | ssh_gssapi_set_oid(ctx, oid); | ||
444 | ssh_gssapi_import_name(ctx, host); | ||
445 | major = ssh_gssapi_init_ctx(ctx, 0, GSS_C_NO_BUFFER, &token, NULL); | ||
446 | gss_release_buffer(&minor, &token); | ||
447 | ssh_gssapi_delete_ctx(&ctx); | ||
448 | return (!GSS_ERROR(major)); | 446 | return (!GSS_ERROR(major)); |
449 | } | 447 | } |
450 | 448 | ||
diff --git a/gss-serv-krb5.c b/gss-serv-krb5.c index 5a9b2cdd3..b400081f6 100644 --- a/gss-serv-krb5.c +++ b/gss-serv-krb5.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: gss-serv-krb5.c,v 1.4 2005/10/13 19:08:08 stevesk Exp $ */ | 1 | /* $OpenBSD: gss-serv-krb5.c,v 1.7 2006/08/03 03:34:42 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. | 4 | * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. |
@@ -29,11 +29,19 @@ | |||
29 | #ifdef GSSAPI | 29 | #ifdef GSSAPI |
30 | #ifdef KRB5 | 30 | #ifdef KRB5 |
31 | 31 | ||
32 | #include "auth.h" | 32 | #include <sys/types.h> |
33 | |||
34 | #include <stdarg.h> | ||
35 | #include <string.h> | ||
36 | |||
33 | #include "xmalloc.h" | 37 | #include "xmalloc.h" |
38 | #include "key.h" | ||
39 | #include "hostfile.h" | ||
40 | #include "auth.h" | ||
34 | #include "log.h" | 41 | #include "log.h" |
35 | #include "servconf.h" | 42 | #include "servconf.h" |
36 | 43 | ||
44 | #include "buffer.h" | ||
37 | #include "ssh-gss.h" | 45 | #include "ssh-gss.h" |
38 | 46 | ||
39 | extern ServerOptions options; | 47 | extern ServerOptions options; |
@@ -112,6 +120,7 @@ ssh_gssapi_krb5_storecreds(ssh_gssapi_client *client) | |||
112 | krb5_principal princ; | 120 | krb5_principal princ; |
113 | OM_uint32 maj_status, min_status; | 121 | OM_uint32 maj_status, min_status; |
114 | int len; | 122 | int len; |
123 | const char *new_ccname; | ||
115 | 124 | ||
116 | if (client->creds == NULL) { | 125 | if (client->creds == NULL) { |
117 | debug("No credentials stored"); | 126 | debug("No credentials stored"); |
@@ -160,11 +169,16 @@ ssh_gssapi_krb5_storecreds(ssh_gssapi_client *client) | |||
160 | return; | 169 | return; |
161 | } | 170 | } |
162 | 171 | ||
163 | client->store.filename = xstrdup(krb5_cc_get_name(krb_context, ccache)); | 172 | new_ccname = krb5_cc_get_name(krb_context, ccache); |
173 | |||
164 | client->store.envvar = "KRB5CCNAME"; | 174 | client->store.envvar = "KRB5CCNAME"; |
165 | len = strlen(client->store.filename) + 6; | 175 | #ifdef USE_CCAPI |
166 | client->store.envval = xmalloc(len); | 176 | xasprintf(&client->store.envval, "API:%s", new_ccname); |
167 | snprintf(client->store.envval, len, "FILE:%s", client->store.filename); | 177 | client->store.filename = NULL; |
178 | #else | ||
179 | xasprintf(&client->store.envval, "FILE:%s", new_ccname); | ||
180 | client->store.filename = xstrdup(new_ccname); | ||
181 | #endif | ||
168 | 182 | ||
169 | #ifdef USE_PAM | 183 | #ifdef USE_PAM |
170 | if (options.use_pam) | 184 | if (options.use_pam) |
diff --git a/gss-serv.c b/gss-serv.c index 190f56fc0..841d8bb2f 100644 --- a/gss-serv.c +++ b/gss-serv.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* $OpenBSD: gss-serv.c,v 1.13 2005/10/13 22:24:31 stevesk Exp $ */ | 1 | /* $OpenBSD: gss-serv.c,v 1.20 2006/08/03 03:34:42 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. | 4 | * Copyright (c) 2001-2006 Simon Wilkinson. All rights reserved. |
5 | * | 5 | * |
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without |
7 | * modification, are permitted provided that the following conditions | 7 | * modification, are permitted provided that the following conditions |
@@ -28,17 +28,27 @@ | |||
28 | 28 | ||
29 | #ifdef GSSAPI | 29 | #ifdef GSSAPI |
30 | 30 | ||
31 | #include "bufaux.h" | 31 | #include <sys/types.h> |
32 | |||
33 | #include <stdarg.h> | ||
34 | #include <string.h> | ||
35 | #include <unistd.h> | ||
36 | |||
37 | #include "xmalloc.h" | ||
38 | #include "buffer.h" | ||
39 | #include "key.h" | ||
40 | #include "hostfile.h" | ||
32 | #include "auth.h" | 41 | #include "auth.h" |
33 | #include "log.h" | 42 | #include "log.h" |
34 | #include "channels.h" | 43 | #include "channels.h" |
35 | #include "session.h" | 44 | #include "session.h" |
45 | #include "misc.h" | ||
36 | #include "servconf.h" | 46 | #include "servconf.h" |
37 | #include "xmalloc.h" | ||
38 | #include "getput.h" | ||
39 | #include "monitor_wrap.h" | ||
40 | 47 | ||
41 | #include "ssh-gss.h" | 48 | #include "ssh-gss.h" |
49 | #include "monitor_wrap.h" | ||
50 | |||
51 | extern ServerOptions options; | ||
42 | 52 | ||
43 | static ssh_gssapi_client gssapi_client = | 53 | static ssh_gssapi_client gssapi_client = |
44 | { GSS_C_EMPTY_BUFFER, GSS_C_EMPTY_BUFFER, | 54 | { GSS_C_EMPTY_BUFFER, GSS_C_EMPTY_BUFFER, |
@@ -70,8 +80,8 @@ ssh_gssapi_server_mechanisms() { | |||
70 | 80 | ||
71 | /* Unprivileged */ | 81 | /* Unprivileged */ |
72 | int | 82 | int |
73 | ssh_gssapi_server_check_mech(gss_OID oid, void *data) { | 83 | ssh_gssapi_server_check_mech(Gssctxt **dum, gss_OID oid, const char *data) { |
74 | Gssctxt * ctx = NULL; | 84 | Gssctxt *ctx = NULL; |
75 | int res; | 85 | int res; |
76 | 86 | ||
77 | res = !GSS_ERROR(PRIVSEP(ssh_gssapi_server_ctx(&ctx, oid))); | 87 | res = !GSS_ERROR(PRIVSEP(ssh_gssapi_server_ctx(&ctx, oid))); |
@@ -101,6 +111,58 @@ ssh_gssapi_supported_oids(gss_OID_set *oidset) | |||
101 | &supported_mechs[i]->oid, oidset); | 111 | &supported_mechs[i]->oid, oidset); |
102 | i++; | 112 | i++; |
103 | } | 113 | } |
114 | |||
115 | gss_release_oid_set(&min_status, &supported); | ||
116 | } | ||
117 | |||
118 | OM_uint32 | ||
119 | ssh_gssapi_server_ctx(Gssctxt **ctx, gss_OID oid) | ||
120 | { | ||
121 | if (*ctx) | ||
122 | ssh_gssapi_delete_ctx(ctx); | ||
123 | ssh_gssapi_build_ctx(ctx); | ||
124 | ssh_gssapi_set_oid(*ctx, oid); | ||
125 | return (ssh_gssapi_acquire_cred(*ctx)); | ||
126 | } | ||
127 | |||
128 | /* Acquire credentials for a server running on the current host. | ||
129 | * Requires that the context structure contains a valid OID | ||
130 | */ | ||
131 | |||
132 | /* Returns a GSSAPI error code */ | ||
133 | OM_uint32 | ||
134 | ssh_gssapi_acquire_cred(Gssctxt *ctx) | ||
135 | { | ||
136 | OM_uint32 status; | ||
137 | char lname[MAXHOSTNAMELEN]; | ||
138 | gss_OID_set oidset; | ||
139 | |||
140 | if (options.gss_strict_acceptor) { | ||
141 | gss_create_empty_oid_set(&status, &oidset); | ||
142 | gss_add_oid_set_member(&status, ctx->oid, &oidset); | ||
143 | |||
144 | if (gethostname(lname, MAXHOSTNAMELEN)) { | ||
145 | gss_release_oid_set(&status, &oidset); | ||
146 | return (-1); | ||
147 | } | ||
148 | |||
149 | if (GSS_ERROR(ssh_gssapi_import_name(ctx, lname))) { | ||
150 | gss_release_oid_set(&status, &oidset); | ||
151 | return (ctx->major); | ||
152 | } | ||
153 | |||
154 | if ((ctx->major = gss_acquire_cred(&ctx->minor, | ||
155 | ctx->name, 0, oidset, GSS_C_ACCEPT, &ctx->creds, | ||
156 | NULL, NULL))) | ||
157 | ssh_gssapi_error(ctx); | ||
158 | |||
159 | gss_release_oid_set(&status, &oidset); | ||
160 | return (ctx->major); | ||
161 | } else { | ||
162 | ctx->name = GSS_C_NO_NAME; | ||
163 | ctx->creds = GSS_C_NO_CREDENTIAL; | ||
164 | } | ||
165 | return GSS_S_COMPLETE; | ||
104 | } | 166 | } |
105 | 167 | ||
106 | 168 | ||
@@ -174,7 +236,7 @@ ssh_gssapi_parse_ename(Gssctxt *ctx, gss_buffer_t ename, gss_buffer_t name) | |||
174 | * second without. | 236 | * second without. |
175 | */ | 237 | */ |
176 | 238 | ||
177 | oidl = GET_16BIT(tok+2); /* length including next two bytes */ | 239 | oidl = get_u16(tok+2); /* length including next two bytes */ |
178 | oidl = oidl-2; /* turn it into the _real_ length of the variable OID */ | 240 | oidl = oidl-2; /* turn it into the _real_ length of the variable OID */ |
179 | 241 | ||
180 | /* | 242 | /* |
@@ -191,14 +253,14 @@ ssh_gssapi_parse_ename(Gssctxt *ctx, gss_buffer_t ename, gss_buffer_t name) | |||
191 | if (ename->length < offset+4) | 253 | if (ename->length < offset+4) |
192 | return GSS_S_FAILURE; | 254 | return GSS_S_FAILURE; |
193 | 255 | ||
194 | name->length = GET_32BIT(tok+offset); | 256 | name->length = get_u32(tok+offset); |
195 | offset += 4; | 257 | offset += 4; |
196 | 258 | ||
197 | if (ename->length < offset+name->length) | 259 | if (ename->length < offset+name->length) |
198 | return GSS_S_FAILURE; | 260 | return GSS_S_FAILURE; |
199 | 261 | ||
200 | name->value = xmalloc(name->length+1); | 262 | name->value = xmalloc(name->length+1); |
201 | memcpy(name->value, tok+offset,name->length); | 263 | memcpy(name->value, tok+offset, name->length); |
202 | ((char *)name->value)[name->length] = 0; | 264 | ((char *)name->value)[name->length] = 0; |
203 | 265 | ||
204 | return GSS_S_COMPLETE; | 266 | return GSS_S_COMPLETE; |
@@ -257,7 +319,8 @@ ssh_gssapi_cleanup_creds(void) | |||
257 | { | 319 | { |
258 | if (gssapi_client.store.filename != NULL) { | 320 | if (gssapi_client.store.filename != NULL) { |
259 | /* Unlink probably isn't sufficient */ | 321 | /* Unlink probably isn't sufficient */ |
260 | debug("removing gssapi cred file\"%s\"", gssapi_client.store.filename); | 322 | debug("removing gssapi cred file\"%s\"", |
323 | gssapi_client.store.filename); | ||
261 | unlink(gssapi_client.store.filename); | 324 | unlink(gssapi_client.store.filename); |
262 | } | 325 | } |
263 | } | 326 | } |
diff --git a/hostfile.c b/hostfile.c index 3ed646247..2cceb352a 100644 --- a/hostfile.c +++ b/hostfile.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: hostfile.c,v 1.45 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -36,18 +37,25 @@ | |||
36 | */ | 37 | */ |
37 | 38 | ||
38 | #include "includes.h" | 39 | #include "includes.h" |
39 | RCSID("$OpenBSD: hostfile.c,v 1.36 2005/11/22 03:36:03 dtucker Exp $"); | ||
40 | 40 | ||
41 | #include <resolv.h> | 41 | #include <sys/types.h> |
42 | |||
43 | #include <netinet/in.h> | ||
44 | |||
42 | #include <openssl/hmac.h> | 45 | #include <openssl/hmac.h> |
43 | #include <openssl/sha.h> | 46 | #include <openssl/sha.h> |
44 | 47 | ||
45 | #include "packet.h" | 48 | #include <resolv.h> |
49 | #include <stdarg.h> | ||
50 | #include <stdio.h> | ||
51 | #include <stdlib.h> | ||
52 | #include <string.h> | ||
53 | |||
54 | #include "xmalloc.h" | ||
46 | #include "match.h" | 55 | #include "match.h" |
47 | #include "key.h" | 56 | #include "key.h" |
48 | #include "hostfile.h" | 57 | #include "hostfile.h" |
49 | #include "log.h" | 58 | #include "log.h" |
50 | #include "xmalloc.h" | ||
51 | 59 | ||
52 | static int | 60 | static int |
53 | extract_salt(const char *s, u_int l, char *salt, size_t salt_len) | 61 | extract_salt(const char *s, u_int l, char *salt, size_t salt_len) |
@@ -254,8 +262,10 @@ check_host_in_hostfile_by_key_or_type(const char *filename, | |||
254 | 262 | ||
255 | if (key == NULL) { | 263 | if (key == NULL) { |
256 | /* we found a key of the requested type */ | 264 | /* we found a key of the requested type */ |
257 | if (found->type == keytype) | 265 | if (found->type == keytype) { |
266 | fclose(f); | ||
258 | return HOST_FOUND; | 267 | return HOST_FOUND; |
268 | } | ||
259 | continue; | 269 | continue; |
260 | } | 270 | } |
261 | 271 | ||
diff --git a/hostfile.h b/hostfile.h index d6330752e..d1983b3e0 100644 --- a/hostfile.h +++ b/hostfile.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: hostfile.h,v 1.15 2005/03/01 10:40:26 djm Exp $ */ | 1 | /* $OpenBSD: hostfile.h,v 1.16 2006/03/25 22:22:43 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
diff --git a/includes.h b/includes.h index 520817400..967fcc26c 100644 --- a/includes.h +++ b/includes.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: includes.h,v 1.22 2006/01/01 08:59:27 stevesk Exp $ */ | 1 | /* $OpenBSD: includes.h,v 1.54 2006/07/22 20:48:23 stevesk Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -16,44 +16,24 @@ | |||
16 | #ifndef INCLUDES_H | 16 | #ifndef INCLUDES_H |
17 | #define INCLUDES_H | 17 | #define INCLUDES_H |
18 | 18 | ||
19 | #define RCSID(msg) \ | ||
20 | static /**/const char *const rcsid[] = { (const char *)rcsid, "\100(#)" msg } | ||
21 | |||
22 | #include "config.h" | 19 | #include "config.h" |
23 | 20 | ||
24 | #define _GNU_SOURCE /* activate extra prototypes for glibc */ | 21 | #define _GNU_SOURCE /* activate extra prototypes for glibc */ |
25 | 22 | ||
26 | #include <stdarg.h> | 23 | #include <sys/types.h> |
27 | #include <stdio.h> | 24 | #include <sys/socket.h> /* For CMSG_* */ |
28 | #include <ctype.h> | ||
29 | #include <errno.h> | ||
30 | #include <fcntl.h> /* For O_NONBLOCK */ | ||
31 | #include <signal.h> | ||
32 | #include <stdlib.h> | ||
33 | #include <string.h> | ||
34 | #include <stdarg.h> | ||
35 | #include <pwd.h> | ||
36 | #include <grp.h> | ||
37 | #include <time.h> | ||
38 | #include <dirent.h> | ||
39 | #include <stddef.h> | ||
40 | 25 | ||
41 | #ifdef HAVE_LIMITS_H | 26 | #ifdef HAVE_LIMITS_H |
42 | # include <limits.h> /* For PATH_MAX */ | 27 | # include <limits.h> /* For PATH_MAX */ |
43 | #endif | 28 | #endif |
44 | #ifdef HAVE_GETOPT_H | ||
45 | # include <getopt.h> | ||
46 | #endif | ||
47 | #ifdef HAVE_BSTRING_H | 29 | #ifdef HAVE_BSTRING_H |
48 | # include <bstring.h> | 30 | # include <bstring.h> |
49 | #endif | 31 | #endif |
50 | #if defined(HAVE_GLOB_H) && defined(GLOB_HAS_ALTDIRFUNC) && \ | 32 | #if defined(HAVE_GLOB_H) && defined(GLOB_HAS_ALTDIRFUNC) && \ |
51 | defined(GLOB_HAS_GL_MATCHC) | 33 | defined(GLOB_HAS_GL_MATCHC) && \ |
34 | defined(HAVE_DECL_GLOB_NOMATCH) && HAVE_DECL_GLOB_NOMATCH != 0 | ||
52 | # include <glob.h> | 35 | # include <glob.h> |
53 | #endif | 36 | #endif |
54 | #ifdef HAVE_NETGROUP_H | ||
55 | # include <netgroup.h> | ||
56 | #endif | ||
57 | #ifdef HAVE_ENDIAN_H | 37 | #ifdef HAVE_ENDIAN_H |
58 | # include <endian.h> | 38 | # include <endian.h> |
59 | #endif | 39 | #endif |
@@ -67,10 +47,11 @@ static /**/const char *const rcsid[] = { (const char *)rcsid, "\100(#)" msg } | |||
67 | # include <maillock.h> /* For _PATH_MAILDIR */ | 47 | # include <maillock.h> /* For _PATH_MAILDIR */ |
68 | #endif | 48 | #endif |
69 | #ifdef HAVE_NEXT | 49 | #ifdef HAVE_NEXT |
70 | # include <libc.h> | 50 | # include <libc.h> |
51 | #endif | ||
52 | #ifdef HAVE_PATHS | ||
53 | # include <paths.h> | ||
71 | #endif | 54 | #endif |
72 | #include <unistd.h> /* For STDIN_FILENO, etc */ | ||
73 | #include <termios.h> /* Struct winsize */ | ||
74 | 55 | ||
75 | /* | 56 | /* |
76 | *-*-nto-qnx needs these headers for strcasecmp and LASTLOG_FILE respectively | 57 | *-*-nto-qnx needs these headers for strcasecmp and LASTLOG_FILE respectively |
@@ -86,39 +67,22 @@ static /**/const char *const rcsid[] = { (const char *)rcsid, "\100(#)" msg } | |||
86 | # include <utmp.h> | 67 | # include <utmp.h> |
87 | #endif | 68 | #endif |
88 | #ifdef HAVE_UTMPX_H | 69 | #ifdef HAVE_UTMPX_H |
89 | # ifdef HAVE_TV_IN_UTMPX | ||
90 | # include <sys/time.h> | ||
91 | # endif | ||
92 | # include <utmpx.h> | 70 | # include <utmpx.h> |
93 | #endif | 71 | #endif |
94 | #ifdef HAVE_LASTLOG_H | 72 | #ifdef HAVE_LASTLOG_H |
95 | # include <lastlog.h> | 73 | # include <lastlog.h> |
96 | #endif | 74 | #endif |
97 | #ifdef HAVE_PATHS_H | ||
98 | # include <paths.h> /* For _PATH_XXX */ | ||
99 | #endif | ||
100 | 75 | ||
101 | #include <sys/types.h> | ||
102 | #include <sys/socket.h> | ||
103 | #include <sys/ioctl.h> | ||
104 | #include <sys/wait.h> | ||
105 | #ifdef HAVE_SYS_TIME_H | ||
106 | # include <sys/time.h> /* For timersub */ | ||
107 | #endif | ||
108 | #include <sys/resource.h> | ||
109 | #ifdef HAVE_SYS_SELECT_H | 76 | #ifdef HAVE_SYS_SELECT_H |
110 | # include <sys/select.h> | 77 | # include <sys/select.h> |
111 | #endif | 78 | #endif |
112 | #ifdef HAVE_SYS_BSDTTY_H | 79 | #ifdef HAVE_SYS_BSDTTY_H |
113 | # include <sys/bsdtty.h> | 80 | # include <sys/bsdtty.h> |
114 | #endif | 81 | #endif |
115 | #include <sys/param.h> /* For MAXPATHLEN and roundup() */ | ||
116 | #ifdef HAVE_SYS_UN_H | ||
117 | # include <sys/un.h> /* For sockaddr_un */ | ||
118 | #endif | ||
119 | #ifdef HAVE_STDINT_H | 82 | #ifdef HAVE_STDINT_H |
120 | # include <stdint.h> | 83 | # include <stdint.h> |
121 | #endif | 84 | #endif |
85 | #include <termios.h> | ||
122 | #ifdef HAVE_SYS_BITYPES_H | 86 | #ifdef HAVE_SYS_BITYPES_H |
123 | # include <sys/bitypes.h> /* For u_intXX_t */ | 87 | # include <sys/bitypes.h> /* For u_intXX_t */ |
124 | #endif | 88 | #endif |
@@ -144,14 +108,8 @@ static /**/const char *const rcsid[] = { (const char *)rcsid, "\100(#)" msg } | |||
144 | #include <sys/ptms.h> /* for grantpt() and friends */ | 108 | #include <sys/ptms.h> /* for grantpt() and friends */ |
145 | #endif | 109 | #endif |
146 | 110 | ||
111 | #include <netinet/in.h> | ||
147 | #include <netinet/in_systm.h> /* For typedefs */ | 112 | #include <netinet/in_systm.h> /* For typedefs */ |
148 | #include <netinet/in.h> /* For IPv6 macros */ | ||
149 | #include <netinet/ip.h> /* For IPTOS macros */ | ||
150 | #include <netinet/tcp.h> | ||
151 | #include <arpa/inet.h> | ||
152 | #if defined(HAVE_NETDB_H) | ||
153 | # include <netdb.h> | ||
154 | #endif | ||
155 | #ifdef HAVE_RPC_TYPES_H | 113 | #ifdef HAVE_RPC_TYPES_H |
156 | # include <rpc/types.h> /* For INADDR_LOOPBACK */ | 114 | # include <rpc/types.h> /* For INADDR_LOOPBACK */ |
157 | #endif | 115 | #endif |
@@ -205,7 +163,7 @@ static /**/const char *const rcsid[] = { (const char *)rcsid, "\100(#)" msg } | |||
205 | 163 | ||
206 | #include "defines.h" | 164 | #include "defines.h" |
207 | 165 | ||
208 | #include "version.h" | 166 | #include "platform.h" |
209 | #include "openbsd-compat/openbsd-compat.h" | 167 | #include "openbsd-compat/openbsd-compat.h" |
210 | #include "openbsd-compat/bsd-nextstep.h" | 168 | #include "openbsd-compat/bsd-nextstep.h" |
211 | 169 | ||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: kex.c,v 1.77 2007/01/21 01:41:54 stevesk Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. |
3 | * | 4 | * |
@@ -23,19 +24,25 @@ | |||
23 | */ | 24 | */ |
24 | 25 | ||
25 | #include "includes.h" | 26 | #include "includes.h" |
26 | RCSID("$OpenBSD: kex.c,v 1.65 2005/11/04 05:15:59 djm Exp $"); | 27 | |
28 | #include <sys/param.h> | ||
29 | |||
30 | #include <signal.h> | ||
31 | #include <stdarg.h> | ||
32 | #include <stdio.h> | ||
33 | #include <stdlib.h> | ||
34 | #include <string.h> | ||
27 | 35 | ||
28 | #include <openssl/crypto.h> | 36 | #include <openssl/crypto.h> |
29 | 37 | ||
30 | #include "ssh2.h" | ||
31 | #include "xmalloc.h" | 38 | #include "xmalloc.h" |
39 | #include "ssh2.h" | ||
32 | #include "buffer.h" | 40 | #include "buffer.h" |
33 | #include "bufaux.h" | ||
34 | #include "packet.h" | 41 | #include "packet.h" |
35 | #include "compat.h" | 42 | #include "compat.h" |
36 | #include "cipher.h" | 43 | #include "cipher.h" |
37 | #include "kex.h" | ||
38 | #include "key.h" | 44 | #include "key.h" |
45 | #include "kex.h" | ||
39 | #include "log.h" | 46 | #include "log.h" |
40 | #include "mac.h" | 47 | #include "mac.h" |
41 | #include "match.h" | 48 | #include "match.h" |
@@ -48,6 +55,14 @@ RCSID("$OpenBSD: kex.c,v 1.65 2005/11/04 05:15:59 djm Exp $"); | |||
48 | 55 | ||
49 | #define KEX_COOKIE_LEN 16 | 56 | #define KEX_COOKIE_LEN 16 |
50 | 57 | ||
58 | #if OPENSSL_VERSION_NUMBER >= 0x00907000L | ||
59 | # if defined(HAVE_EVP_SHA256) | ||
60 | # define evp_ssh_sha256 EVP_sha256 | ||
61 | # else | ||
62 | extern const EVP_MD *evp_ssh_sha256(void); | ||
63 | # endif | ||
64 | #endif | ||
65 | |||
51 | /* prototype */ | 66 | /* prototype */ |
52 | static void kex_kexinit_finish(Kex *); | 67 | static void kex_kexinit_finish(Kex *); |
53 | static void kex_choose_conf(Kex *); | 68 | static void kex_choose_conf(Kex *); |
@@ -79,7 +94,7 @@ kex_buf2prop(Buffer *raw, int *first_kex_follows) | |||
79 | int i; | 94 | int i; |
80 | char **proposal; | 95 | char **proposal; |
81 | 96 | ||
82 | proposal = xmalloc(PROPOSAL_MAX * sizeof(char *)); | 97 | proposal = xcalloc(PROPOSAL_MAX, sizeof(char *)); |
83 | 98 | ||
84 | buffer_init(&b); | 99 | buffer_init(&b); |
85 | buffer_append(&b, buffer_ptr(raw), buffer_len(raw)); | 100 | buffer_append(&b, buffer_ptr(raw), buffer_len(raw)); |
@@ -214,8 +229,7 @@ kex_setup(char *proposal[PROPOSAL_MAX]) | |||
214 | { | 229 | { |
215 | Kex *kex; | 230 | Kex *kex; |
216 | 231 | ||
217 | kex = xmalloc(sizeof(*kex)); | 232 | kex = xcalloc(1, sizeof(*kex)); |
218 | memset(kex, 0, sizeof(*kex)); | ||
219 | buffer_init(&kex->peer); | 233 | buffer_init(&kex->peer); |
220 | buffer_init(&kex->my); | 234 | buffer_init(&kex->my); |
221 | kex_prop2buf(&kex->my, proposal); | 235 | kex_prop2buf(&kex->my, proposal); |
@@ -258,6 +272,7 @@ choose_enc(Enc *enc, char *client, char *server) | |||
258 | enc->key_len = cipher_keylen(enc->cipher); | 272 | enc->key_len = cipher_keylen(enc->cipher); |
259 | enc->block_size = cipher_blocksize(enc->cipher); | 273 | enc->block_size = cipher_blocksize(enc->cipher); |
260 | } | 274 | } |
275 | |||
261 | static void | 276 | static void |
262 | choose_mac(Mac *mac, char *client, char *server) | 277 | choose_mac(Mac *mac, char *client, char *server) |
263 | { | 278 | { |
@@ -273,6 +288,7 @@ choose_mac(Mac *mac, char *client, char *server) | |||
273 | mac->key = NULL; | 288 | mac->key = NULL; |
274 | mac->enabled = 0; | 289 | mac->enabled = 0; |
275 | } | 290 | } |
291 | |||
276 | static void | 292 | static void |
277 | choose_comp(Comp *comp, char *client, char *server) | 293 | choose_comp(Comp *comp, char *client, char *server) |
278 | { | 294 | { |
@@ -290,6 +306,7 @@ choose_comp(Comp *comp, char *client, char *server) | |||
290 | } | 306 | } |
291 | comp->name = name; | 307 | comp->name = name; |
292 | } | 308 | } |
309 | |||
293 | static void | 310 | static void |
294 | choose_kex(Kex *k, char *client, char *server) | 311 | choose_kex(Kex *k, char *client, char *server) |
295 | { | 312 | { |
@@ -305,15 +322,24 @@ choose_kex(Kex *k, char *client, char *server) | |||
305 | } else if (strcmp(k->name, KEX_DHGEX_SHA1) == 0) { | 322 | } else if (strcmp(k->name, KEX_DHGEX_SHA1) == 0) { |
306 | k->kex_type = KEX_DH_GEX_SHA1; | 323 | k->kex_type = KEX_DH_GEX_SHA1; |
307 | k->evp_md = EVP_sha1(); | 324 | k->evp_md = EVP_sha1(); |
325 | #if OPENSSL_VERSION_NUMBER >= 0x00907000L | ||
326 | } else if (strcmp(k->name, KEX_DHGEX_SHA256) == 0) { | ||
327 | k->kex_type = KEX_DH_GEX_SHA256; | ||
328 | k->evp_md = evp_ssh_sha256(); | ||
329 | #endif | ||
308 | #ifdef GSSAPI | 330 | #ifdef GSSAPI |
309 | } else if (strncmp(k->name, KEX_GSS_GEX_SHA1_ID, | 331 | } else if (strncmp(k->name, KEX_GSS_GEX_SHA1_ID, |
310 | sizeof(KEX_GSS_GEX_SHA1_ID)-1) == 0) { | 332 | sizeof(KEX_GSS_GEX_SHA1_ID) - 1) == 0) { |
311 | k->kex_type = KEX_GSS_GEX_SHA1; | 333 | k->kex_type = KEX_GSS_GEX_SHA1; |
312 | k->evp_md = EVP_sha1(); | 334 | k->evp_md = EVP_sha1(); |
313 | } else if (strncmp(k->name, KEX_GSS_GRP1_SHA1_ID, | 335 | } else if (strncmp(k->name, KEX_GSS_GRP1_SHA1_ID, |
314 | sizeof(KEX_GSS_GRP1_SHA1_ID)-1) == 0) { | 336 | sizeof(KEX_GSS_GRP1_SHA1_ID) - 1) == 0) { |
315 | k->kex_type = KEX_GSS_GRP1_SHA1; | 337 | k->kex_type = KEX_GSS_GRP1_SHA1; |
316 | k->evp_md = EVP_sha1(); | 338 | k->evp_md = EVP_sha1(); |
339 | } else if (strncmp(k->name, KEX_GSS_GRP14_SHA1_ID, | ||
340 | sizeof(KEX_GSS_GRP14_SHA1_ID) - 1) == 0) { | ||
341 | k->kex_type = KEX_GSS_GRP14_SHA1; | ||
342 | k->evp_md = EVP_sha1(); | ||
317 | #endif | 343 | #endif |
318 | } else | 344 | } else |
319 | fatal("bad kex alg %s", k->name); | 345 | fatal("bad kex alg %s", k->name); |
@@ -378,8 +404,7 @@ kex_choose_conf(Kex *kex) | |||
378 | 404 | ||
379 | /* Algorithm Negotiation */ | 405 | /* Algorithm Negotiation */ |
380 | for (mode = 0; mode < MODE_MAX; mode++) { | 406 | for (mode = 0; mode < MODE_MAX; mode++) { |
381 | newkeys = xmalloc(sizeof(*newkeys)); | 407 | newkeys = xcalloc(1, sizeof(*newkeys)); |
382 | memset(newkeys, 0, sizeof(*newkeys)); | ||
383 | kex->newkeys[mode] = newkeys; | 408 | kex->newkeys[mode] = newkeys; |
384 | ctos = (!kex->server && mode == MODE_OUT) || (kex->server && mode == MODE_IN); | 409 | ctos = (!kex->server && mode == MODE_OUT) || (kex->server && mode == MODE_IN); |
385 | nenc = ctos ? PROPOSAL_ENC_ALGS_CTOS : PROPOSAL_ENC_ALGS_STOC; | 410 | nenc = ctos ? PROPOSAL_ENC_ALGS_CTOS : PROPOSAL_ENC_ALGS_STOC; |
@@ -434,7 +459,7 @@ derive_key(Kex *kex, int id, u_int need, u_char *hash, u_int hashlen, | |||
434 | 459 | ||
435 | if ((mdsz = EVP_MD_size(kex->evp_md)) <= 0) | 460 | if ((mdsz = EVP_MD_size(kex->evp_md)) <= 0) |
436 | fatal("bad kex md size %d", mdsz); | 461 | fatal("bad kex md size %d", mdsz); |
437 | digest = xmalloc(roundup(need, mdsz)); | 462 | digest = xmalloc(roundup(need, mdsz)); |
438 | 463 | ||
439 | buffer_init(&b); | 464 | buffer_init(&b); |
440 | buffer_put_bignum2(&b, shared_secret); | 465 | buffer_put_bignum2(&b, shared_secret); |
@@ -487,7 +512,8 @@ kex_derive_keys(Kex *kex, u_char *hash, u_int hashlen, BIGNUM *shared_secret) | |||
487 | for (mode = 0; mode < MODE_MAX; mode++) { | 512 | for (mode = 0; mode < MODE_MAX; mode++) { |
488 | current_keys[mode] = kex->newkeys[mode]; | 513 | current_keys[mode] = kex->newkeys[mode]; |
489 | kex->newkeys[mode] = NULL; | 514 | kex->newkeys[mode] = NULL; |
490 | ctos = (!kex->server && mode == MODE_OUT) || (kex->server && mode == MODE_IN); | 515 | ctos = (!kex->server && mode == MODE_OUT) || |
516 | (kex->server && mode == MODE_IN); | ||
491 | current_keys[mode]->enc.iv = keys[ctos ? 0 : 1]; | 517 | current_keys[mode]->enc.iv = keys[ctos ? 0 : 1]; |
492 | current_keys[mode]->enc.key = keys[ctos ? 2 : 3]; | 518 | current_keys[mode]->enc.key = keys[ctos ? 2 : 3]; |
493 | current_keys[mode]->mac.key = keys[ctos ? 4 : 5]; | 519 | current_keys[mode]->mac.key = keys[ctos ? 4 : 5]; |
@@ -544,7 +570,7 @@ dump_digest(char *msg, u_char *digest, int len) | |||
544 | u_int i; | 570 | u_int i; |
545 | 571 | ||
546 | fprintf(stderr, "%s\n", msg); | 572 | fprintf(stderr, "%s\n", msg); |
547 | for (i = 0; i< len; i++) { | 573 | for (i = 0; i < len; i++) { |
548 | fprintf(stderr, "%02x", digest[i]); | 574 | fprintf(stderr, "%02x", digest[i]); |
549 | if (i%32 == 31) | 575 | if (i%32 == 31) |
550 | fprintf(stderr, "\n"); | 576 | fprintf(stderr, "\n"); |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: kex.h,v 1.38 2005/11/04 05:15:59 djm Exp $ */ | 1 | /* $OpenBSD: kex.h,v 1.44 2006/08/03 03:34:42 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. |
@@ -26,14 +26,13 @@ | |||
26 | #ifndef KEX_H | 26 | #ifndef KEX_H |
27 | #define KEX_H | 27 | #define KEX_H |
28 | 28 | ||
29 | #include <signal.h> | ||
29 | #include <openssl/evp.h> | 30 | #include <openssl/evp.h> |
30 | #include "buffer.h" | ||
31 | #include "cipher.h" | ||
32 | #include "key.h" | ||
33 | 31 | ||
34 | #define KEX_DH1 "diffie-hellman-group1-sha1" | 32 | #define KEX_DH1 "diffie-hellman-group1-sha1" |
35 | #define KEX_DH14 "diffie-hellman-group14-sha1" | 33 | #define KEX_DH14 "diffie-hellman-group14-sha1" |
36 | #define KEX_DHGEX_SHA1 "diffie-hellman-group-exchange-sha1" | 34 | #define KEX_DHGEX_SHA1 "diffie-hellman-group-exchange-sha1" |
35 | #define KEX_DHGEX_SHA256 "diffie-hellman-group-exchange-sha256" | ||
37 | 36 | ||
38 | #define COMP_NONE 0 | 37 | #define COMP_NONE 0 |
39 | #define COMP_ZLIB 1 | 38 | #define COMP_ZLIB 1 |
@@ -63,7 +62,9 @@ enum kex_exchange { | |||
63 | KEX_DH_GRP1_SHA1, | 62 | KEX_DH_GRP1_SHA1, |
64 | KEX_DH_GRP14_SHA1, | 63 | KEX_DH_GRP14_SHA1, |
65 | KEX_DH_GEX_SHA1, | 64 | KEX_DH_GEX_SHA1, |
65 | KEX_DH_GEX_SHA256, | ||
66 | KEX_GSS_GRP1_SHA1, | 66 | KEX_GSS_GRP1_SHA1, |
67 | KEX_GSS_GRP14_SHA1, | ||
67 | KEX_GSS_GEX_SHA1, | 68 | KEX_GSS_GEX_SHA1, |
68 | KEX_MAX | 69 | KEX_MAX |
69 | }; | 70 | }; |
@@ -114,7 +115,7 @@ struct Kex { | |||
114 | int kex_type; | 115 | int kex_type; |
115 | Buffer my; | 116 | Buffer my; |
116 | Buffer peer; | 117 | Buffer peer; |
117 | int done; | 118 | sig_atomic_t done; |
118 | int flags; | 119 | int flags; |
119 | const EVP_MD *evp_md; | 120 | const EVP_MD *evp_md; |
120 | #ifdef GSSAPI | 121 | #ifdef GSSAPI |
@@ -154,7 +155,7 @@ kex_dh_hash(char *, char *, char *, int, char *, int, u_char *, int, | |||
154 | BIGNUM *, BIGNUM *, BIGNUM *, u_char **, u_int *); | 155 | BIGNUM *, BIGNUM *, BIGNUM *, u_char **, u_int *); |
155 | void | 156 | void |
156 | kexgex_hash(const EVP_MD *, char *, char *, char *, int, char *, | 157 | kexgex_hash(const EVP_MD *, char *, char *, char *, int, char *, |
157 | int, u_char *, int, int, int, int, BIGNUM *, BIGNUM *, BIGNUM *, | 158 | int, u_char *, int, int, int, int, BIGNUM *, BIGNUM *, BIGNUM *, |
158 | BIGNUM *, BIGNUM *, u_char **, u_int *); | 159 | BIGNUM *, BIGNUM *, u_char **, u_int *); |
159 | 160 | ||
160 | void | 161 | void |
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: kexdh.c,v 1.23 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
3 | * | 4 | * |
@@ -23,13 +24,17 @@ | |||
23 | */ | 24 | */ |
24 | 25 | ||
25 | #include "includes.h" | 26 | #include "includes.h" |
26 | RCSID("$OpenBSD: kexdh.c,v 1.20 2005/11/04 05:15:59 djm Exp $"); | 27 | |
28 | #include <sys/types.h> | ||
29 | |||
30 | #include <signal.h> | ||
27 | 31 | ||
28 | #include <openssl/evp.h> | 32 | #include <openssl/evp.h> |
29 | 33 | ||
30 | #include "buffer.h" | 34 | #include "buffer.h" |
31 | #include "bufaux.h" | ||
32 | #include "ssh2.h" | 35 | #include "ssh2.h" |
36 | #include "key.h" | ||
37 | #include "cipher.h" | ||
33 | #include "kex.h" | 38 | #include "kex.h" |
34 | 39 | ||
35 | void | 40 | void |
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: kexdhc.c,v 1.11 2006/11/06 21:25:28 markus Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
3 | * | 4 | * |
@@ -23,10 +24,18 @@ | |||
23 | */ | 24 | */ |
24 | 25 | ||
25 | #include "includes.h" | 26 | #include "includes.h" |
26 | RCSID("$OpenBSD: kexdhc.c,v 1.3 2005/11/04 05:15:59 djm Exp $"); | 27 | |
28 | #include <sys/types.h> | ||
29 | |||
30 | #include <stdarg.h> | ||
31 | #include <stdio.h> | ||
32 | #include <string.h> | ||
33 | #include <signal.h> | ||
27 | 34 | ||
28 | #include "xmalloc.h" | 35 | #include "xmalloc.h" |
36 | #include "buffer.h" | ||
29 | #include "key.h" | 37 | #include "key.h" |
38 | #include "cipher.h" | ||
30 | #include "kex.h" | 39 | #include "kex.h" |
31 | #include "log.h" | 40 | #include "log.h" |
32 | #include "packet.h" | 41 | #include "packet.h" |
@@ -41,7 +50,8 @@ kexdh_client(Kex *kex) | |||
41 | Key *server_host_key; | 50 | Key *server_host_key; |
42 | u_char *server_host_key_blob = NULL, *signature = NULL; | 51 | u_char *server_host_key_blob = NULL, *signature = NULL; |
43 | u_char *kbuf, *hash; | 52 | u_char *kbuf, *hash; |
44 | u_int klen, kout, slen, sbloblen, hashlen; | 53 | u_int klen, slen, sbloblen, hashlen; |
54 | int kout; | ||
45 | 55 | ||
46 | /* generate and send 'e', client DH public key */ | 56 | /* generate and send 'e', client DH public key */ |
47 | switch (kex->kex_type) { | 57 | switch (kex->kex_type) { |
@@ -82,7 +92,7 @@ kexdh_client(Kex *kex) | |||
82 | if (kex->verify_host_key(server_host_key) == -1) | 92 | if (kex->verify_host_key(server_host_key) == -1) |
83 | fatal("server_host_key verification failed"); | 93 | fatal("server_host_key verification failed"); |
84 | 94 | ||
85 | /* DH paramter f, server public DH key */ | 95 | /* DH parameter f, server public DH key */ |
86 | if ((dh_server_pub = BN_new()) == NULL) | 96 | if ((dh_server_pub = BN_new()) == NULL) |
87 | fatal("dh_server_pub == NULL"); | 97 | fatal("dh_server_pub == NULL"); |
88 | packet_get_bignum2(dh_server_pub); | 98 | packet_get_bignum2(dh_server_pub); |
@@ -103,13 +113,15 @@ kexdh_client(Kex *kex) | |||
103 | 113 | ||
104 | klen = DH_size(dh); | 114 | klen = DH_size(dh); |
105 | kbuf = xmalloc(klen); | 115 | kbuf = xmalloc(klen); |
106 | kout = DH_compute_key(kbuf, dh_server_pub, dh); | 116 | if ((kout = DH_compute_key(kbuf, dh_server_pub, dh)) < 0) |
117 | fatal("DH_compute_key: failed"); | ||
107 | #ifdef DEBUG_KEXDH | 118 | #ifdef DEBUG_KEXDH |
108 | dump_digest("shared secret", kbuf, kout); | 119 | dump_digest("shared secret", kbuf, kout); |
109 | #endif | 120 | #endif |
110 | if ((shared_secret = BN_new()) == NULL) | 121 | if ((shared_secret = BN_new()) == NULL) |
111 | fatal("kexdh_client: BN_new failed"); | 122 | fatal("kexdh_client: BN_new failed"); |
112 | BN_bin2bn(kbuf, kout, shared_secret); | 123 | if (BN_bin2bn(kbuf, kout, shared_secret) == NULL) |
124 | fatal("kexdh_client: BN_bin2bn failed"); | ||
113 | memset(kbuf, 0, klen); | 125 | memset(kbuf, 0, klen); |
114 | xfree(kbuf); | 126 | xfree(kbuf); |
115 | 127 | ||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: kexdhs.c,v 1.9 2006/11/06 21:25:28 markus Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
3 | * | 4 | * |
@@ -23,15 +24,25 @@ | |||
23 | */ | 24 | */ |
24 | 25 | ||
25 | #include "includes.h" | 26 | #include "includes.h" |
26 | RCSID("$OpenBSD: kexdhs.c,v 1.3 2005/11/04 05:15:59 djm Exp $"); | 27 | |
28 | #include <sys/types.h> | ||
29 | |||
30 | #include <stdarg.h> | ||
31 | #include <string.h> | ||
32 | #include <signal.h> | ||
27 | 33 | ||
28 | #include "xmalloc.h" | 34 | #include "xmalloc.h" |
35 | #include "buffer.h" | ||
29 | #include "key.h" | 36 | #include "key.h" |
37 | #include "cipher.h" | ||
30 | #include "kex.h" | 38 | #include "kex.h" |
31 | #include "log.h" | 39 | #include "log.h" |
32 | #include "packet.h" | 40 | #include "packet.h" |
33 | #include "dh.h" | 41 | #include "dh.h" |
34 | #include "ssh2.h" | 42 | #include "ssh2.h" |
43 | #ifdef GSSAPI | ||
44 | #include "ssh-gss.h" | ||
45 | #endif | ||
35 | #include "monitor_wrap.h" | 46 | #include "monitor_wrap.h" |
36 | 47 | ||
37 | void | 48 | void |
@@ -41,8 +52,8 @@ kexdh_server(Kex *kex) | |||
41 | DH *dh; | 52 | DH *dh; |
42 | Key *server_host_key; | 53 | Key *server_host_key; |
43 | u_char *kbuf, *hash, *signature = NULL, *server_host_key_blob = NULL; | 54 | u_char *kbuf, *hash, *signature = NULL, *server_host_key_blob = NULL; |
44 | u_int sbloblen, klen, kout, hashlen; | 55 | u_int sbloblen, klen, hashlen, slen; |
45 | u_int slen; | 56 | int kout; |
46 | 57 | ||
47 | /* generate server DH public key */ | 58 | /* generate server DH public key */ |
48 | switch (kex->kex_type) { | 59 | switch (kex->kex_type) { |
@@ -90,13 +101,15 @@ kexdh_server(Kex *kex) | |||
90 | 101 | ||
91 | klen = DH_size(dh); | 102 | klen = DH_size(dh); |
92 | kbuf = xmalloc(klen); | 103 | kbuf = xmalloc(klen); |
93 | kout = DH_compute_key(kbuf, dh_client_pub, dh); | 104 | if ((kout = DH_compute_key(kbuf, dh_client_pub, dh)) < 0) |
105 | fatal("DH_compute_key: failed"); | ||
94 | #ifdef DEBUG_KEXDH | 106 | #ifdef DEBUG_KEXDH |
95 | dump_digest("shared secret", kbuf, kout); | 107 | dump_digest("shared secret", kbuf, kout); |
96 | #endif | 108 | #endif |
97 | if ((shared_secret = BN_new()) == NULL) | 109 | if ((shared_secret = BN_new()) == NULL) |
98 | fatal("kexdh_server: BN_new failed"); | 110 | fatal("kexdh_server: BN_new failed"); |
99 | BN_bin2bn(kbuf, kout, shared_secret); | 111 | if (BN_bin2bn(kbuf, kout, shared_secret) == NULL) |
112 | fatal("kexdh_server: BN_bin2bn failed"); | ||
100 | memset(kbuf, 0, klen); | 113 | memset(kbuf, 0, klen); |
101 | xfree(kbuf); | 114 | xfree(kbuf); |
102 | 115 | ||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: kexgex.c,v 1.27 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2000 Niels Provos. All rights reserved. | 3 | * Copyright (c) 2000 Niels Provos. All rights reserved. |
3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
@@ -24,12 +25,15 @@ | |||
24 | */ | 25 | */ |
25 | 26 | ||
26 | #include "includes.h" | 27 | #include "includes.h" |
27 | RCSID("$OpenBSD: kexgex.c,v 1.24 2005/11/04 05:15:59 djm Exp $"); | 28 | |
29 | #include <sys/types.h> | ||
28 | 30 | ||
29 | #include <openssl/evp.h> | 31 | #include <openssl/evp.h> |
32 | #include <signal.h> | ||
30 | 33 | ||
31 | #include "buffer.h" | 34 | #include "buffer.h" |
32 | #include "bufaux.h" | 35 | #include "key.h" |
36 | #include "cipher.h" | ||
33 | #include "kex.h" | 37 | #include "kex.h" |
34 | #include "ssh2.h" | 38 | #include "ssh2.h" |
35 | 39 | ||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: kexgexc.c,v 1.11 2006/11/06 21:25:28 markus Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2000 Niels Provos. All rights reserved. | 3 | * Copyright (c) 2000 Niels Provos. All rights reserved. |
3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
@@ -24,10 +25,18 @@ | |||
24 | */ | 25 | */ |
25 | 26 | ||
26 | #include "includes.h" | 27 | #include "includes.h" |
27 | RCSID("$OpenBSD: kexgexc.c,v 1.3 2005/11/04 05:15:59 djm Exp $"); | 28 | |
29 | #include <sys/types.h> | ||
30 | |||
31 | #include <stdarg.h> | ||
32 | #include <stdio.h> | ||
33 | #include <string.h> | ||
34 | #include <signal.h> | ||
28 | 35 | ||
29 | #include "xmalloc.h" | 36 | #include "xmalloc.h" |
37 | #include "buffer.h" | ||
30 | #include "key.h" | 38 | #include "key.h" |
39 | #include "cipher.h" | ||
31 | #include "kex.h" | 40 | #include "kex.h" |
32 | #include "log.h" | 41 | #include "log.h" |
33 | #include "packet.h" | 42 | #include "packet.h" |
@@ -42,7 +51,8 @@ kexgex_client(Kex *kex) | |||
42 | BIGNUM *p = NULL, *g = NULL; | 51 | BIGNUM *p = NULL, *g = NULL; |
43 | Key *server_host_key; | 52 | Key *server_host_key; |
44 | u_char *kbuf, *hash, *signature = NULL, *server_host_key_blob = NULL; | 53 | u_char *kbuf, *hash, *signature = NULL, *server_host_key_blob = NULL; |
45 | u_int klen, kout, slen, sbloblen, hashlen; | 54 | u_int klen, slen, sbloblen, hashlen; |
55 | int kout; | ||
46 | int min, max, nbits; | 56 | int min, max, nbits; |
47 | DH *dh; | 57 | DH *dh; |
48 | 58 | ||
@@ -120,7 +130,7 @@ kexgex_client(Kex *kex) | |||
120 | if (kex->verify_host_key(server_host_key) == -1) | 130 | if (kex->verify_host_key(server_host_key) == -1) |
121 | fatal("server_host_key verification failed"); | 131 | fatal("server_host_key verification failed"); |
122 | 132 | ||
123 | /* DH paramter f, server public DH key */ | 133 | /* DH parameter f, server public DH key */ |
124 | if ((dh_server_pub = BN_new()) == NULL) | 134 | if ((dh_server_pub = BN_new()) == NULL) |
125 | fatal("dh_server_pub == NULL"); | 135 | fatal("dh_server_pub == NULL"); |
126 | packet_get_bignum2(dh_server_pub); | 136 | packet_get_bignum2(dh_server_pub); |
@@ -141,13 +151,15 @@ kexgex_client(Kex *kex) | |||
141 | 151 | ||
142 | klen = DH_size(dh); | 152 | klen = DH_size(dh); |
143 | kbuf = xmalloc(klen); | 153 | kbuf = xmalloc(klen); |
144 | kout = DH_compute_key(kbuf, dh_server_pub, dh); | 154 | if ((kout = DH_compute_key(kbuf, dh_server_pub, dh)) < 0) |
155 | fatal("DH_compute_key: failed"); | ||
145 | #ifdef DEBUG_KEXDH | 156 | #ifdef DEBUG_KEXDH |
146 | dump_digest("shared secret", kbuf, kout); | 157 | dump_digest("shared secret", kbuf, kout); |
147 | #endif | 158 | #endif |
148 | if ((shared_secret = BN_new()) == NULL) | 159 | if ((shared_secret = BN_new()) == NULL) |
149 | fatal("kexgex_client: BN_new failed"); | 160 | fatal("kexgex_client: BN_new failed"); |
150 | BN_bin2bn(kbuf, kout, shared_secret); | 161 | if (BN_bin2bn(kbuf, kout, shared_secret) == NULL) |
162 | fatal("kexgex_client: BN_bin2bn failed"); | ||
151 | memset(kbuf, 0, klen); | 163 | memset(kbuf, 0, klen); |
152 | xfree(kbuf); | 164 | xfree(kbuf); |
153 | 165 | ||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: kexgexs.c,v 1.10 2006/11/06 21:25:28 markus Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2000 Niels Provos. All rights reserved. | 3 | * Copyright (c) 2000 Niels Provos. All rights reserved. |
3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
@@ -24,16 +25,27 @@ | |||
24 | */ | 25 | */ |
25 | 26 | ||
26 | #include "includes.h" | 27 | #include "includes.h" |
27 | RCSID("$OpenBSD: kexgexs.c,v 1.2 2005/11/04 05:15:59 djm Exp $"); | 28 | |
29 | #include <sys/param.h> | ||
30 | |||
31 | #include <stdarg.h> | ||
32 | #include <stdio.h> | ||
33 | #include <string.h> | ||
34 | #include <signal.h> | ||
28 | 35 | ||
29 | #include "xmalloc.h" | 36 | #include "xmalloc.h" |
37 | #include "buffer.h" | ||
30 | #include "key.h" | 38 | #include "key.h" |
39 | #include "cipher.h" | ||
31 | #include "kex.h" | 40 | #include "kex.h" |
32 | #include "log.h" | 41 | #include "log.h" |
33 | #include "packet.h" | 42 | #include "packet.h" |
34 | #include "dh.h" | 43 | #include "dh.h" |
35 | #include "ssh2.h" | 44 | #include "ssh2.h" |
36 | #include "compat.h" | 45 | #include "compat.h" |
46 | #ifdef GSSAPI | ||
47 | #include "ssh-gss.h" | ||
48 | #endif | ||
37 | #include "monitor_wrap.h" | 49 | #include "monitor_wrap.h" |
38 | 50 | ||
39 | void | 51 | void |
@@ -43,8 +55,8 @@ kexgex_server(Kex *kex) | |||
43 | Key *server_host_key; | 55 | Key *server_host_key; |
44 | DH *dh; | 56 | DH *dh; |
45 | u_char *kbuf, *hash, *signature = NULL, *server_host_key_blob = NULL; | 57 | u_char *kbuf, *hash, *signature = NULL, *server_host_key_blob = NULL; |
46 | u_int sbloblen, klen, kout, slen, hashlen; | 58 | u_int sbloblen, klen, slen, hashlen; |
47 | int min = -1, max = -1, nbits = -1, type; | 59 | int min = -1, max = -1, nbits = -1, type, kout; |
48 | 60 | ||
49 | if (kex->load_host_key == NULL) | 61 | if (kex->load_host_key == NULL) |
50 | fatal("Cannot load hostkey"); | 62 | fatal("Cannot load hostkey"); |
@@ -122,13 +134,15 @@ kexgex_server(Kex *kex) | |||
122 | 134 | ||
123 | klen = DH_size(dh); | 135 | klen = DH_size(dh); |
124 | kbuf = xmalloc(klen); | 136 | kbuf = xmalloc(klen); |
125 | kout = DH_compute_key(kbuf, dh_client_pub, dh); | 137 | if ((kout = DH_compute_key(kbuf, dh_client_pub, dh)) < 0) |
138 | fatal("DH_compute_key: failed"); | ||
126 | #ifdef DEBUG_KEXDH | 139 | #ifdef DEBUG_KEXDH |
127 | dump_digest("shared secret", kbuf, kout); | 140 | dump_digest("shared secret", kbuf, kout); |
128 | #endif | 141 | #endif |
129 | if ((shared_secret = BN_new()) == NULL) | 142 | if ((shared_secret = BN_new()) == NULL) |
130 | fatal("kexgex_server: BN_new failed"); | 143 | fatal("kexgex_server: BN_new failed"); |
131 | BN_bin2bn(kbuf, kout, shared_secret); | 144 | if (BN_bin2bn(kbuf, kout, shared_secret) == NULL) |
145 | fatal("kexgex_server: BN_bin2bn failed"); | ||
132 | memset(kbuf, 0, klen); | 146 | memset(kbuf, 0, klen); |
133 | xfree(kbuf); | 147 | xfree(kbuf); |
134 | 148 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2001-2005 Simon Wilkinson. All rights reserved. | 2 | * Copyright (c) 2001-2006 Simon Wilkinson. All rights reserved. |
3 | * | 3 | * |
4 | * Redistribution and use in source and binary forms, with or without | 4 | * Redistribution and use in source and binary forms, with or without |
5 | * modification, are permitted provided that the following conditions | 5 | * modification, are permitted provided that the following conditions |
@@ -26,24 +26,29 @@ | |||
26 | 26 | ||
27 | #ifdef GSSAPI | 27 | #ifdef GSSAPI |
28 | 28 | ||
29 | #include "includes.h" | ||
30 | |||
29 | #include <openssl/crypto.h> | 31 | #include <openssl/crypto.h> |
30 | #include <openssl/bn.h> | 32 | #include <openssl/bn.h> |
31 | 33 | ||
34 | #include <string.h> | ||
35 | |||
32 | #include "xmalloc.h" | 36 | #include "xmalloc.h" |
33 | #include "buffer.h" | 37 | #include "buffer.h" |
34 | #include "bufaux.h" | 38 | #include "ssh2.h" |
39 | #include "key.h" | ||
40 | #include "cipher.h" | ||
35 | #include "kex.h" | 41 | #include "kex.h" |
36 | #include "log.h" | 42 | #include "log.h" |
37 | #include "packet.h" | 43 | #include "packet.h" |
38 | #include "dh.h" | 44 | #include "dh.h" |
39 | #include "canohost.h" | 45 | |
40 | #include "ssh2.h" | ||
41 | #include "ssh-gss.h" | 46 | #include "ssh-gss.h" |
42 | 47 | ||
43 | void | 48 | void |
44 | kexgss_client(Kex *kex) { | 49 | kexgss_client(Kex *kex) { |
45 | gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER; | 50 | gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER; |
46 | gss_buffer_desc recv_tok, gssbuf, msg_tok, *token_ptr; | 51 | gss_buffer_desc recv_tok, gssbuf, msg_tok, *token_ptr; |
47 | Gssctxt *ctxt; | 52 | Gssctxt *ctxt; |
48 | OM_uint32 maj_status, min_status, ret_flags; | 53 | OM_uint32 maj_status, min_status, ret_flags; |
49 | u_int klen, kout, slen = 0, hashlen, strlen; | 54 | u_int klen, kout, slen = 0, hashlen, strlen; |
@@ -58,22 +63,27 @@ kexgss_client(Kex *kex) { | |||
58 | char *lang; | 63 | char *lang; |
59 | int type = 0; | 64 | int type = 0; |
60 | int first = 1; | 65 | int first = 1; |
61 | int gex = 0; | 66 | int nbits = 0, min = DH_GRP_MIN, max = DH_GRP_MAX; |
62 | int nbits, min, max; | ||
63 | 67 | ||
64 | /* Initialise our GSSAPI world */ | 68 | /* Initialise our GSSAPI world */ |
65 | ssh_gssapi_build_ctx(&ctxt); | 69 | ssh_gssapi_build_ctx(&ctxt); |
66 | if (ssh_gssapi_id_kex(ctxt, kex->name, &gex) == NULL) | 70 | if (ssh_gssapi_id_kex(ctxt, kex->name, kex->kex_type) |
71 | == GSS_C_NO_OID) | ||
67 | fatal("Couldn't identify host exchange"); | 72 | fatal("Couldn't identify host exchange"); |
68 | 73 | ||
69 | if (ssh_gssapi_import_name(ctxt, kex->gss_host)) | 74 | if (ssh_gssapi_import_name(ctxt, kex->gss_host)) |
70 | fatal("Couldn't import hostname"); | 75 | fatal("Couldn't import hostname"); |
71 | 76 | ||
72 | if (gex) { | 77 | switch (kex->kex_type) { |
78 | case KEX_GSS_GRP1_SHA1: | ||
79 | dh = dh_new_group1(); | ||
80 | break; | ||
81 | case KEX_GSS_GRP14_SHA1: | ||
82 | dh = dh_new_group14(); | ||
83 | break; | ||
84 | case KEX_GSS_GEX_SHA1: | ||
73 | debug("Doing group exchange\n"); | 85 | debug("Doing group exchange\n"); |
74 | nbits = dh_estimate(kex->we_need * 8); | 86 | nbits = dh_estimate(kex->we_need * 8); |
75 | min = DH_GRP_MIN; | ||
76 | max = DH_GRP_MAX; | ||
77 | packet_start(SSH2_MSG_KEXGSS_GROUPREQ); | 87 | packet_start(SSH2_MSG_KEXGSS_GROUPREQ); |
78 | packet_put_int(min); | 88 | packet_put_int(min); |
79 | packet_put_int(nbits); | 89 | packet_put_int(nbits); |
@@ -96,8 +106,9 @@ kexgss_client(Kex *kex) { | |||
96 | min, BN_num_bits(p), max); | 106 | min, BN_num_bits(p), max); |
97 | 107 | ||
98 | dh = dh_new_group(g, p); | 108 | dh = dh_new_group(g, p); |
99 | } else { | 109 | break; |
100 | dh = dh_new_group1(); | 110 | default: |
111 | fatal("%s: Unexpected KEX type %d", __func__, kex->kex_type); | ||
101 | } | 112 | } |
102 | 113 | ||
103 | /* Step 1 - e is dh->pub_key */ | 114 | /* Step 1 - e is dh->pub_key */ |
@@ -205,7 +216,7 @@ kexgss_client(Kex *kex) { | |||
205 | min_status = packet_get_int(); | 216 | min_status = packet_get_int(); |
206 | msg = packet_get_string(NULL); | 217 | msg = packet_get_string(NULL); |
207 | lang = packet_get_string(NULL); | 218 | lang = packet_get_string(NULL); |
208 | fatal("GSSAPI Error: \n%s",msg); | 219 | fatal("GSSAPI Error: \n%.400s",msg); |
209 | default: | 220 | default: |
210 | packet_disconnect("Protocol error: didn't expect packet type %d", | 221 | packet_disconnect("Protocol error: didn't expect packet type %d", |
211 | type); | 222 | type); |
@@ -240,7 +251,21 @@ kexgss_client(Kex *kex) { | |||
240 | memset(kbuf, 0, klen); | 251 | memset(kbuf, 0, klen); |
241 | xfree(kbuf); | 252 | xfree(kbuf); |
242 | 253 | ||
243 | if (gex) { | 254 | switch (kex->kex_type) { |
255 | case KEX_GSS_GRP1_SHA1: | ||
256 | case KEX_GSS_GRP14_SHA1: | ||
257 | kex_dh_hash( kex->client_version_string, | ||
258 | kex->server_version_string, | ||
259 | buffer_ptr(&kex->my), buffer_len(&kex->my), | ||
260 | buffer_ptr(&kex->peer), buffer_len(&kex->peer), | ||
261 | serverhostkey, slen, /* server host key */ | ||
262 | dh->pub_key, /* e */ | ||
263 | dh_server_pub, /* f */ | ||
264 | shared_secret, /* K */ | ||
265 | &hash, &hashlen | ||
266 | ); | ||
267 | break; | ||
268 | case KEX_GSS_GEX_SHA1: | ||
244 | kexgex_hash( | 269 | kexgex_hash( |
245 | kex->evp_md, | 270 | kex->evp_md, |
246 | kex->client_version_string, | 271 | kex->client_version_string, |
@@ -255,24 +280,15 @@ kexgss_client(Kex *kex) { | |||
255 | shared_secret, | 280 | shared_secret, |
256 | &hash, &hashlen | 281 | &hash, &hashlen |
257 | ); | 282 | ); |
258 | } else { | 283 | break; |
259 | /* The GSS hash is identical to the DH one */ | 284 | default: |
260 | kex_dh_hash( kex->client_version_string, | 285 | fatal("%s: Unexpected KEX type %d", __func__, kex->kex_type); |
261 | kex->server_version_string, | 286 | } |
262 | buffer_ptr(&kex->my), buffer_len(&kex->my), | ||
263 | buffer_ptr(&kex->peer), buffer_len(&kex->peer), | ||
264 | serverhostkey, slen, /* server host key */ | ||
265 | dh->pub_key, /* e */ | ||
266 | dh_server_pub, /* f */ | ||
267 | shared_secret, /* K */ | ||
268 | &hash, &hashlen | ||
269 | ); | ||
270 | } | ||
271 | 287 | ||
272 | gssbuf.value = hash; | 288 | gssbuf.value = hash; |
273 | gssbuf.length = hashlen; | 289 | gssbuf.length = hashlen; |
274 | 290 | ||
275 | /* Verify that the hash matches the MIC we just got. */ | 291 | /* Verify that the hash matches the MIC we just got. */ |
276 | if (GSS_ERROR(ssh_gssapi_checkmic(ctxt, &gssbuf, &msg_tok))) | 292 | if (GSS_ERROR(ssh_gssapi_checkmic(ctxt, &gssbuf, &msg_tok))) |
277 | packet_disconnect("Hash's MIC didn't verify"); | 293 | packet_disconnect("Hash's MIC didn't verify"); |
278 | 294 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2001-2005 Simon Wilkinson. All rights reserved. | 2 | * Copyright (c) 2001-2006 Simon Wilkinson. All rights reserved. |
3 | * | 3 | * |
4 | * Redistribution and use in source and binary forms, with or without | 4 | * Redistribution and use in source and binary forms, with or without |
5 | * modification, are permitted provided that the following conditions | 5 | * modification, are permitted provided that the following conditions |
@@ -26,17 +26,20 @@ | |||
26 | 26 | ||
27 | #ifdef GSSAPI | 27 | #ifdef GSSAPI |
28 | 28 | ||
29 | #include <string.h> | ||
30 | |||
29 | #include <openssl/crypto.h> | 31 | #include <openssl/crypto.h> |
30 | #include <openssl/bn.h> | 32 | #include <openssl/bn.h> |
31 | 33 | ||
32 | #include "xmalloc.h" | 34 | #include "xmalloc.h" |
33 | #include "buffer.h" | 35 | #include "buffer.h" |
34 | #include "bufaux.h" | 36 | #include "ssh2.h" |
37 | #include "key.h" | ||
38 | #include "cipher.h" | ||
35 | #include "kex.h" | 39 | #include "kex.h" |
36 | #include "log.h" | 40 | #include "log.h" |
37 | #include "packet.h" | 41 | #include "packet.h" |
38 | #include "dh.h" | 42 | #include "dh.h" |
39 | #include "ssh2.h" | ||
40 | #include "ssh-gss.h" | 43 | #include "ssh-gss.h" |
41 | #include "monitor_wrap.h" | 44 | #include "monitor_wrap.h" |
42 | 45 | ||
@@ -63,29 +66,35 @@ kexgss_server(Kex *kex) | |||
63 | BIGNUM *shared_secret = NULL; | 66 | BIGNUM *shared_secret = NULL; |
64 | BIGNUM *dh_client_pub = NULL; | 67 | BIGNUM *dh_client_pub = NULL; |
65 | int type = 0; | 68 | int type = 0; |
66 | int gex; | ||
67 | gss_OID oid; | 69 | gss_OID oid; |
68 | 70 | ||
69 | /* Initialise GSSAPI */ | 71 | /* Initialise GSSAPI */ |
70 | 72 | ||
71 | /* If we're rekeying, privsep means that some of the private structures | 73 | /* If we're rekeying, privsep means that some of the private structures |
72 | * in the GSSAPI code are no longer available. This kludges them back | 74 | * in the GSSAPI code are no longer available. This kludges them back |
73 | * into life | 75 | * into life |
74 | */ | 76 | */ |
75 | if (!ssh_gssapi_oid_table_ok()) | 77 | if (!ssh_gssapi_oid_table_ok()) |
76 | ssh_gssapi_server_mechanisms(); | 78 | ssh_gssapi_server_mechanisms(); |
77 | 79 | ||
78 | debug2("%s: Identifying %s", __func__, kex->name); | 80 | debug2("%s: Identifying %s", __func__, kex->name); |
79 | oid = ssh_gssapi_id_kex(NULL, kex->name, &gex); | 81 | oid = ssh_gssapi_id_kex(NULL, kex->name, kex->kex_type); |
80 | if (oid == NULL) | 82 | if (oid == GSS_C_NO_OID) |
81 | fatal("Unknown gssapi mechanism"); | 83 | fatal("Unknown gssapi mechanism"); |
82 | 84 | ||
83 | debug2("%s: Acquiring credentials", __func__); | 85 | debug2("%s: Acquiring credentials", __func__); |
84 | 86 | ||
85 | if (GSS_ERROR(PRIVSEP(ssh_gssapi_server_ctx(&ctxt, oid)))) | 87 | if (GSS_ERROR(PRIVSEP(ssh_gssapi_server_ctx(&ctxt, oid)))) |
86 | fatal("Unable to acquire credentials for the server"); | 88 | fatal("Unable to acquire credentials for the server"); |
87 | 89 | ||
88 | if (gex) { | 90 | switch (kex->kex_type) { |
91 | case KEX_GSS_GRP1_SHA1: | ||
92 | dh = dh_new_group1(); | ||
93 | break; | ||
94 | case KEX_GSS_GRP14_SHA1: | ||
95 | dh = dh_new_group14(); | ||
96 | break; | ||
97 | case KEX_GSS_GEX_SHA1: | ||
89 | debug("Doing group exchange"); | 98 | debug("Doing group exchange"); |
90 | packet_read_expect(SSH2_MSG_KEXGSS_GROUPREQ); | 99 | packet_read_expect(SSH2_MSG_KEXGSS_GROUPREQ); |
91 | min = packet_get_int(); | 100 | min = packet_get_int(); |
@@ -107,10 +116,11 @@ kexgss_server(Kex *kex) | |||
107 | packet_send(); | 116 | packet_send(); |
108 | 117 | ||
109 | packet_write_wait(); | 118 | packet_write_wait(); |
110 | 119 | break; | |
111 | } else { | 120 | default: |
112 | dh = dh_new_group1(); | 121 | fatal("%s: Unexpected KEX type %d", __func__, kex->kex_type); |
113 | } | 122 | } |
123 | |||
114 | dh_gen_key(dh, kex->we_need * 8); | 124 | dh_gen_key(dh, kex->we_need * 8); |
115 | 125 | ||
116 | do { | 126 | do { |
@@ -187,7 +197,19 @@ kexgss_server(Kex *kex) | |||
187 | memset(kbuf, 0, klen); | 197 | memset(kbuf, 0, klen); |
188 | xfree(kbuf); | 198 | xfree(kbuf); |
189 | 199 | ||
190 | if (gex) { | 200 | switch (kex->kex_type) { |
201 | case KEX_GSS_GRP1_SHA1: | ||
202 | case KEX_GSS_GRP14_SHA1: | ||
203 | kex_dh_hash( | ||
204 | kex->client_version_string, kex->server_version_string, | ||
205 | buffer_ptr(&kex->peer), buffer_len(&kex->peer), | ||
206 | buffer_ptr(&kex->my), buffer_len(&kex->my), | ||
207 | NULL, 0, /* Change this if we start sending host keys */ | ||
208 | dh_client_pub, dh->pub_key, shared_secret, | ||
209 | &hash, &hashlen | ||
210 | ); | ||
211 | break; | ||
212 | case KEX_GSS_GEX_SHA1: | ||
191 | kexgex_hash( | 213 | kexgex_hash( |
192 | kex->evp_md, | 214 | kex->evp_md, |
193 | kex->client_version_string, kex->server_version_string, | 215 | kex->client_version_string, kex->server_version_string, |
@@ -201,18 +223,11 @@ kexgss_server(Kex *kex) | |||
201 | shared_secret, | 223 | shared_secret, |
202 | &hash, &hashlen | 224 | &hash, &hashlen |
203 | ); | 225 | ); |
226 | break; | ||
227 | default: | ||
228 | fatal("%s: Unexpected KEX type %d", __func__, kex->kex_type); | ||
204 | } | 229 | } |
205 | else { | 230 | |
206 | /* The GSSAPI hash is identical to the Diffie Helman one */ | ||
207 | kex_dh_hash( | ||
208 | kex->client_version_string, kex->server_version_string, | ||
209 | buffer_ptr(&kex->peer), buffer_len(&kex->peer), | ||
210 | buffer_ptr(&kex->my), buffer_len(&kex->my), | ||
211 | NULL, 0, /* Change this if we start sending host keys */ | ||
212 | dh_client_pub, dh->pub_key, shared_secret, | ||
213 | &hash, &hashlen | ||
214 | ); | ||
215 | } | ||
216 | BN_free(dh_client_pub); | 231 | BN_free(dh_client_pub); |
217 | 232 | ||
218 | if (kex->session_id == NULL) { | 233 | if (kex->session_id == NULL) { |
@@ -229,11 +244,11 @@ kexgss_server(Kex *kex) | |||
229 | 244 | ||
230 | packet_start(SSH2_MSG_KEXGSS_COMPLETE); | 245 | packet_start(SSH2_MSG_KEXGSS_COMPLETE); |
231 | packet_put_bignum2(dh->pub_key); | 246 | packet_put_bignum2(dh->pub_key); |
232 | packet_put_string((char *)msg_tok.value,msg_tok.length); | 247 | packet_put_string(msg_tok.value,msg_tok.length); |
233 | 248 | ||
234 | if (send_tok.length != 0) { | 249 | if (send_tok.length != 0) { |
235 | packet_put_char(1); /* true */ | 250 | packet_put_char(1); /* true */ |
236 | packet_put_string((char *)send_tok.value, send_tok.length); | 251 | packet_put_string(send_tok.value, send_tok.length); |
237 | } else { | 252 | } else { |
238 | packet_put_char(0); /* false */ | 253 | packet_put_char(0); /* false */ |
239 | } | 254 | } |
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: key.c,v 1.68 2006/11/06 21:25:28 markus Exp $ */ | ||
1 | /* | 2 | /* |
2 | * read_bignum(): | 3 | * read_bignum(): |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -31,17 +32,22 @@ | |||
31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 32 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
32 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 33 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
33 | */ | 34 | */ |
35 | |||
34 | #include "includes.h" | 36 | #include "includes.h" |
35 | RCSID("$OpenBSD: key.c,v 1.58 2005/06/17 02:44:32 djm Exp $"); | 37 | |
38 | #include <sys/types.h> | ||
36 | 39 | ||
37 | #include <openssl/evp.h> | 40 | #include <openssl/evp.h> |
38 | 41 | ||
42 | #include <stdarg.h> | ||
43 | #include <stdio.h> | ||
44 | #include <string.h> | ||
45 | |||
39 | #include "xmalloc.h" | 46 | #include "xmalloc.h" |
40 | #include "key.h" | 47 | #include "key.h" |
41 | #include "rsa.h" | 48 | #include "rsa.h" |
42 | #include "uuencode.h" | 49 | #include "uuencode.h" |
43 | #include "buffer.h" | 50 | #include "buffer.h" |
44 | #include "bufaux.h" | ||
45 | #include "log.h" | 51 | #include "log.h" |
46 | 52 | ||
47 | Key * | 53 | Key * |
@@ -50,9 +56,8 @@ key_new(int type) | |||
50 | Key *k; | 56 | Key *k; |
51 | RSA *rsa; | 57 | RSA *rsa; |
52 | DSA *dsa; | 58 | DSA *dsa; |
53 | k = xmalloc(sizeof(*k)); | 59 | k = xcalloc(1, sizeof(*k)); |
54 | k->type = type; | 60 | k->type = type; |
55 | k->flags = 0; | ||
56 | k->dsa = NULL; | 61 | k->dsa = NULL; |
57 | k->rsa = NULL; | 62 | k->rsa = NULL; |
58 | switch (k->type) { | 63 | switch (k->type) { |
@@ -123,6 +128,8 @@ key_new_private(int type) | |||
123 | void | 128 | void |
124 | key_free(Key *k) | 129 | key_free(Key *k) |
125 | { | 130 | { |
131 | if (k == NULL) | ||
132 | fatal("key_free: key is NULL"); | ||
126 | switch (k->type) { | 133 | switch (k->type) { |
127 | case KEY_RSA1: | 134 | case KEY_RSA1: |
128 | case KEY_RSA: | 135 | case KEY_RSA: |
@@ -155,14 +162,12 @@ key_equal(const Key *a, const Key *b) | |||
155 | return a->rsa != NULL && b->rsa != NULL && | 162 | return a->rsa != NULL && b->rsa != NULL && |
156 | BN_cmp(a->rsa->e, b->rsa->e) == 0 && | 163 | BN_cmp(a->rsa->e, b->rsa->e) == 0 && |
157 | BN_cmp(a->rsa->n, b->rsa->n) == 0; | 164 | BN_cmp(a->rsa->n, b->rsa->n) == 0; |
158 | break; | ||
159 | case KEY_DSA: | 165 | case KEY_DSA: |
160 | return a->dsa != NULL && b->dsa != NULL && | 166 | return a->dsa != NULL && b->dsa != NULL && |
161 | BN_cmp(a->dsa->p, b->dsa->p) == 0 && | 167 | BN_cmp(a->dsa->p, b->dsa->p) == 0 && |
162 | BN_cmp(a->dsa->q, b->dsa->q) == 0 && | 168 | BN_cmp(a->dsa->q, b->dsa->q) == 0 && |
163 | BN_cmp(a->dsa->g, b->dsa->g) == 0 && | 169 | BN_cmp(a->dsa->g, b->dsa->g) == 0 && |
164 | BN_cmp(a->dsa->pub_key, b->dsa->pub_key) == 0; | 170 | BN_cmp(a->dsa->pub_key, b->dsa->pub_key) == 0; |
165 | break; | ||
166 | default: | 171 | default: |
167 | fatal("key_equal: bad key type %d", a->type); | 172 | fatal("key_equal: bad key type %d", a->type); |
168 | break; | 173 | break; |
@@ -209,7 +214,6 @@ key_fingerprint_raw(const Key *k, enum fp_type dgst_type, | |||
209 | break; | 214 | break; |
210 | case KEY_UNSPEC: | 215 | case KEY_UNSPEC: |
211 | return retval; | 216 | return retval; |
212 | break; | ||
213 | default: | 217 | default: |
214 | fatal("key_fingerprint_raw: bad key type %d", k->type); | 218 | fatal("key_fingerprint_raw: bad key type %d", k->type); |
215 | break; | 219 | break; |
@@ -233,8 +237,7 @@ key_fingerprint_hex(u_char *dgst_raw, u_int dgst_raw_len) | |||
233 | char *retval; | 237 | char *retval; |
234 | u_int i; | 238 | u_int i; |
235 | 239 | ||
236 | retval = xmalloc(dgst_raw_len * 3 + 1); | 240 | retval = xcalloc(1, dgst_raw_len * 3 + 1); |
237 | retval[0] = '\0'; | ||
238 | for (i = 0; i < dgst_raw_len; i++) { | 241 | for (i = 0; i < dgst_raw_len; i++) { |
239 | char hex[4]; | 242 | char hex[4]; |
240 | snprintf(hex, sizeof(hex), "%02x:", dgst_raw[i]); | 243 | snprintf(hex, sizeof(hex), "%02x:", dgst_raw[i]); |
@@ -256,7 +259,7 @@ key_fingerprint_bubblebabble(u_char *dgst_raw, u_int dgst_raw_len) | |||
256 | char *retval; | 259 | char *retval; |
257 | 260 | ||
258 | rounds = (dgst_raw_len / 2) + 1; | 261 | rounds = (dgst_raw_len / 2) + 1; |
259 | retval = xmalloc(sizeof(char) * (rounds*6)); | 262 | retval = xcalloc((rounds * 6), sizeof(char)); |
260 | retval[j++] = 'x'; | 263 | retval[j++] = 'x'; |
261 | for (i = 0; i < rounds; i++) { | 264 | for (i = 0; i < rounds; i++) { |
262 | u_int idx0, idx1, idx2, idx3, idx4; | 265 | u_int idx0, idx1, idx2, idx3, idx4; |
@@ -530,13 +533,10 @@ key_type(const Key *k) | |||
530 | switch (k->type) { | 533 | switch (k->type) { |
531 | case KEY_RSA1: | 534 | case KEY_RSA1: |
532 | return "RSA1"; | 535 | return "RSA1"; |
533 | break; | ||
534 | case KEY_RSA: | 536 | case KEY_RSA: |
535 | return "RSA"; | 537 | return "RSA"; |
536 | break; | ||
537 | case KEY_DSA: | 538 | case KEY_DSA: |
538 | return "DSA"; | 539 | return "DSA"; |
539 | break; | ||
540 | } | 540 | } |
541 | return "unknown"; | 541 | return "unknown"; |
542 | } | 542 | } |
@@ -547,10 +547,8 @@ key_ssh_name(const Key *k) | |||
547 | switch (k->type) { | 547 | switch (k->type) { |
548 | case KEY_RSA: | 548 | case KEY_RSA: |
549 | return "ssh-rsa"; | 549 | return "ssh-rsa"; |
550 | break; | ||
551 | case KEY_DSA: | 550 | case KEY_DSA: |
552 | return "ssh-dss"; | 551 | return "ssh-dss"; |
553 | break; | ||
554 | } | 552 | } |
555 | return "ssh-unknown"; | 553 | return "ssh-unknown"; |
556 | } | 554 | } |
@@ -562,10 +560,8 @@ key_size(const Key *k) | |||
562 | case KEY_RSA1: | 560 | case KEY_RSA1: |
563 | case KEY_RSA: | 561 | case KEY_RSA: |
564 | return BN_num_bits(k->rsa->n); | 562 | return BN_num_bits(k->rsa->n); |
565 | break; | ||
566 | case KEY_DSA: | 563 | case KEY_DSA: |
567 | return BN_num_bits(k->dsa->p); | 564 | return BN_num_bits(k->dsa->p); |
568 | break; | ||
569 | } | 565 | } |
570 | return 0; | 566 | return 0; |
571 | } | 567 | } |
@@ -574,6 +570,7 @@ static RSA * | |||
574 | rsa_generate_private_key(u_int bits) | 570 | rsa_generate_private_key(u_int bits) |
575 | { | 571 | { |
576 | RSA *private; | 572 | RSA *private; |
573 | |||
577 | private = RSA_generate_key(bits, 35, NULL, NULL); | 574 | private = RSA_generate_key(bits, 35, NULL, NULL); |
578 | if (private == NULL) | 575 | if (private == NULL) |
579 | fatal("rsa_generate_private_key: key generation failed."); | 576 | fatal("rsa_generate_private_key: key generation failed."); |
@@ -584,6 +581,7 @@ static DSA* | |||
584 | dsa_generate_private_key(u_int bits) | 581 | dsa_generate_private_key(u_int bits) |
585 | { | 582 | { |
586 | DSA *private = DSA_generate_parameters(bits, NULL, 0, NULL, NULL, NULL, NULL); | 583 | DSA *private = DSA_generate_parameters(bits, NULL, 0, NULL, NULL, NULL, NULL); |
584 | |||
587 | if (private == NULL) | 585 | if (private == NULL) |
588 | fatal("dsa_generate_private_key: DSA_generate_parameters failed"); | 586 | fatal("dsa_generate_private_key: DSA_generate_parameters failed"); |
589 | if (!DSA_generate_key(private)) | 587 | if (!DSA_generate_key(private)) |
@@ -619,16 +617,18 @@ key_from_private(const Key *k) | |||
619 | switch (k->type) { | 617 | switch (k->type) { |
620 | case KEY_DSA: | 618 | case KEY_DSA: |
621 | n = key_new(k->type); | 619 | n = key_new(k->type); |
622 | BN_copy(n->dsa->p, k->dsa->p); | 620 | if ((BN_copy(n->dsa->p, k->dsa->p) == NULL) || |
623 | BN_copy(n->dsa->q, k->dsa->q); | 621 | (BN_copy(n->dsa->q, k->dsa->q) == NULL) || |
624 | BN_copy(n->dsa->g, k->dsa->g); | 622 | (BN_copy(n->dsa->g, k->dsa->g) == NULL) || |
625 | BN_copy(n->dsa->pub_key, k->dsa->pub_key); | 623 | (BN_copy(n->dsa->pub_key, k->dsa->pub_key) == NULL)) |
624 | fatal("key_from_private: BN_copy failed"); | ||
626 | break; | 625 | break; |
627 | case KEY_RSA: | 626 | case KEY_RSA: |
628 | case KEY_RSA1: | 627 | case KEY_RSA1: |
629 | n = key_new(k->type); | 628 | n = key_new(k->type); |
630 | BN_copy(n->rsa->n, k->rsa->n); | 629 | if ((BN_copy(n->rsa->n, k->rsa->n) == NULL) || |
631 | BN_copy(n->rsa->e, k->rsa->e); | 630 | (BN_copy(n->rsa->e, k->rsa->e) == NULL)) |
631 | fatal("key_from_private: BN_copy failed"); | ||
632 | break; | 632 | break; |
633 | default: | 633 | default: |
634 | fatal("key_from_private: unknown type %d", k->type); | 634 | fatal("key_from_private: unknown type %d", k->type); |
@@ -795,14 +795,11 @@ key_sign( | |||
795 | switch (key->type) { | 795 | switch (key->type) { |
796 | case KEY_DSA: | 796 | case KEY_DSA: |
797 | return ssh_dss_sign(key, sigp, lenp, data, datalen); | 797 | return ssh_dss_sign(key, sigp, lenp, data, datalen); |
798 | break; | ||
799 | case KEY_RSA: | 798 | case KEY_RSA: |
800 | return ssh_rsa_sign(key, sigp, lenp, data, datalen); | 799 | return ssh_rsa_sign(key, sigp, lenp, data, datalen); |
801 | break; | ||
802 | default: | 800 | default: |
803 | error("key_sign: invalid key type %d", key->type); | 801 | error("key_sign: invalid key type %d", key->type); |
804 | return -1; | 802 | return -1; |
805 | break; | ||
806 | } | 803 | } |
807 | } | 804 | } |
808 | 805 | ||
@@ -822,14 +819,11 @@ key_verify( | |||
822 | switch (key->type) { | 819 | switch (key->type) { |
823 | case KEY_DSA: | 820 | case KEY_DSA: |
824 | return ssh_dss_verify(key, signature, signaturelen, data, datalen); | 821 | return ssh_dss_verify(key, signature, signaturelen, data, datalen); |
825 | break; | ||
826 | case KEY_RSA: | 822 | case KEY_RSA: |
827 | return ssh_rsa_verify(key, signature, signaturelen, data, datalen); | 823 | return ssh_rsa_verify(key, signature, signaturelen, data, datalen); |
828 | break; | ||
829 | default: | 824 | default: |
830 | error("key_verify: invalid key type %d", key->type); | 825 | error("key_verify: invalid key type %d", key->type); |
831 | return -1; | 826 | return -1; |
832 | break; | ||
833 | } | 827 | } |
834 | } | 828 | } |
835 | 829 | ||
@@ -839,7 +833,7 @@ key_demote(const Key *k) | |||
839 | { | 833 | { |
840 | Key *pk; | 834 | Key *pk; |
841 | 835 | ||
842 | pk = xmalloc(sizeof(*pk)); | 836 | pk = xcalloc(1, sizeof(*pk)); |
843 | pk->type = k->type; | 837 | pk->type = k->type; |
844 | pk->flags = k->flags; | 838 | pk->flags = k->flags; |
845 | pk->dsa = NULL; | 839 | pk->dsa = NULL; |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: key.h,v 1.23 2003/11/10 16:23:41 jakob Exp $ */ | 1 | /* $OpenBSD: key.h,v 1.26 2006/08/03 03:34:42 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. |
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: log.c,v 1.39 2006/08/18 09:13:25 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -34,16 +35,22 @@ | |||
34 | */ | 35 | */ |
35 | 36 | ||
36 | #include "includes.h" | 37 | #include "includes.h" |
37 | RCSID("$OpenBSD: log.c,v 1.29 2003/09/23 20:17:11 markus Exp $"); | ||
38 | 38 | ||
39 | #include "log.h" | 39 | #include <sys/types.h> |
40 | #include "xmalloc.h" | ||
41 | 40 | ||
41 | #include <stdarg.h> | ||
42 | #include <stdio.h> | ||
43 | #include <stdlib.h> | ||
44 | #include <string.h> | ||
42 | #include <syslog.h> | 45 | #include <syslog.h> |
46 | #include <unistd.h> | ||
43 | #if defined(HAVE_STRNVIS) && defined(HAVE_VIS_H) | 47 | #if defined(HAVE_STRNVIS) && defined(HAVE_VIS_H) |
44 | # include <vis.h> | 48 | # include <vis.h> |
45 | #endif | 49 | #endif |
46 | 50 | ||
51 | #include "xmalloc.h" | ||
52 | #include "log.h" | ||
53 | |||
47 | static LogLevel log_level = SYSLOG_LEVEL_INFO; | 54 | static LogLevel log_level = SYSLOG_LEVEL_INFO; |
48 | static int log_on_stderr = 1; | 55 | static int log_on_stderr = 1; |
49 | static int log_facility = LOG_AUTH; | 56 | static int log_facility = LOG_AUTH; |
@@ -134,11 +141,13 @@ error(const char *fmt,...) | |||
134 | void | 141 | void |
135 | sigdie(const char *fmt,...) | 142 | sigdie(const char *fmt,...) |
136 | { | 143 | { |
144 | #ifdef DO_LOG_SAFE_IN_SIGHAND | ||
137 | va_list args; | 145 | va_list args; |
138 | 146 | ||
139 | va_start(args, fmt); | 147 | va_start(args, fmt); |
140 | do_log(SYSLOG_LEVEL_FATAL, fmt, args); | 148 | do_log(SYSLOG_LEVEL_FATAL, fmt, args); |
141 | va_end(args); | 149 | va_end(args); |
150 | #endif | ||
142 | _exit(1); | 151 | _exit(1); |
143 | } | 152 | } |
144 | 153 | ||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: log.h,v 1.11 2004/06/21 22:02:58 djm Exp $ */ | 1 | /* $OpenBSD: log.h,v 1.15 2006/08/18 09:13:25 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -15,8 +15,6 @@ | |||
15 | #ifndef SSH_LOG_H | 15 | #ifndef SSH_LOG_H |
16 | #define SSH_LOG_H | 16 | #define SSH_LOG_H |
17 | 17 | ||
18 | #include <syslog.h> /* Needed for LOG_AUTHPRIV (if present) */ | ||
19 | |||
20 | /* Supported syslog facilities and levels. */ | 18 | /* Supported syslog facilities and levels. */ |
21 | typedef enum { | 19 | typedef enum { |
22 | SYSLOG_FACILITY_DAEMON, | 20 | SYSLOG_FACILITY_DAEMON, |
diff --git a/loginrec.c b/loginrec.c index d096346ec..e59127747 100644 --- a/loginrec.c +++ b/loginrec.c | |||
@@ -147,8 +147,26 @@ | |||
147 | 147 | ||
148 | #include "includes.h" | 148 | #include "includes.h" |
149 | 149 | ||
150 | #include "ssh.h" | 150 | #include <sys/types.h> |
151 | #include <sys/stat.h> | ||
152 | #include <sys/socket.h> | ||
153 | |||
154 | #include <netinet/in.h> | ||
155 | |||
156 | #include <errno.h> | ||
157 | #include <fcntl.h> | ||
158 | #ifdef HAVE_PATHS_H | ||
159 | # include <paths.h> | ||
160 | #endif | ||
161 | #include <pwd.h> | ||
162 | #include <stdarg.h> | ||
163 | #include <string.h> | ||
164 | #include <unistd.h> | ||
165 | |||
151 | #include "xmalloc.h" | 166 | #include "xmalloc.h" |
167 | #include "key.h" | ||
168 | #include "hostfile.h" | ||
169 | #include "ssh.h" | ||
152 | #include "loginrec.h" | 170 | #include "loginrec.h" |
153 | #include "log.h" | 171 | #include "log.h" |
154 | #include "atomicio.h" | 172 | #include "atomicio.h" |
@@ -165,8 +183,6 @@ | |||
165 | # include <libutil.h> | 183 | # include <libutil.h> |
166 | #endif | 184 | #endif |
167 | 185 | ||
168 | RCSID("$Id: loginrec.c,v 1.71 2005/11/22 08:55:13 dtucker Exp $"); | ||
169 | |||
170 | /** | 186 | /** |
171 | ** prototypes for helper functions in this file | 187 | ** prototypes for helper functions in this file |
172 | **/ | 188 | **/ |
diff --git a/loginrec.h b/loginrec.h index 8e3390178..859e1a630 100644 --- a/loginrec.h +++ b/loginrec.h | |||
@@ -31,12 +31,6 @@ | |||
31 | 31 | ||
32 | #include "includes.h" | 32 | #include "includes.h" |
33 | 33 | ||
34 | #include <sys/types.h> | ||
35 | #include <netinet/in.h> | ||
36 | #include <sys/socket.h> | ||
37 | |||
38 | /* RCSID("$Id: loginrec.h,v 1.10 2005/06/19 00:19:44 djm Exp $"); */ | ||
39 | |||
40 | /** | 34 | /** |
41 | ** you should use the login_* calls to work around platform dependencies | 35 | ** you should use the login_* calls to work around platform dependencies |
42 | **/ | 36 | **/ |
diff --git a/logintest.c b/logintest.c index 95cce5a3a..7e9fbbfbb 100644 --- a/logintest.c +++ b/logintest.c | |||
@@ -31,6 +31,10 @@ | |||
31 | 31 | ||
32 | #include <sys/types.h> | 32 | #include <sys/types.h> |
33 | #include <sys/wait.h> | 33 | #include <sys/wait.h> |
34 | #include <sys/socket.h> | ||
35 | |||
36 | #include <netinet/in.h> | ||
37 | |||
34 | #include <unistd.h> | 38 | #include <unistd.h> |
35 | #include <stdlib.h> | 39 | #include <stdlib.h> |
36 | #include <stdio.h> | 40 | #include <stdio.h> |
@@ -43,8 +47,6 @@ | |||
43 | 47 | ||
44 | #include "loginrec.h" | 48 | #include "loginrec.h" |
45 | 49 | ||
46 | RCSID("$Id: logintest.c,v 1.11 2004/07/17 04:07:42 dtucker Exp $"); | ||
47 | |||
48 | extern char *__progname; | 50 | extern char *__progname; |
49 | 51 | ||
50 | #define PAUSE_BEFORE_LOGOUT 3 | 52 | #define PAUSE_BEFORE_LOGOUT 3 |
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: mac.c,v 1.12 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
3 | * | 4 | * |
@@ -23,16 +24,23 @@ | |||
23 | */ | 24 | */ |
24 | 25 | ||
25 | #include "includes.h" | 26 | #include "includes.h" |
26 | RCSID("$OpenBSD: mac.c,v 1.7 2005/06/17 02:44:32 djm Exp $"); | 27 | |
28 | #include <sys/types.h> | ||
27 | 29 | ||
28 | #include <openssl/hmac.h> | 30 | #include <openssl/hmac.h> |
29 | 31 | ||
32 | #include <stdarg.h> | ||
33 | #include <string.h> | ||
34 | #include <signal.h> | ||
35 | |||
30 | #include "xmalloc.h" | 36 | #include "xmalloc.h" |
31 | #include "getput.h" | ||
32 | #include "log.h" | 37 | #include "log.h" |
33 | #include "cipher.h" | 38 | #include "cipher.h" |
39 | #include "buffer.h" | ||
40 | #include "key.h" | ||
34 | #include "kex.h" | 41 | #include "kex.h" |
35 | #include "mac.h" | 42 | #include "mac.h" |
43 | #include "misc.h" | ||
36 | 44 | ||
37 | struct { | 45 | struct { |
38 | char *name; | 46 | char *name; |
@@ -83,7 +91,7 @@ mac_compute(Mac *mac, u_int32_t seqno, u_char *data, int datalen) | |||
83 | if (mac->mac_len > sizeof(m)) | 91 | if (mac->mac_len > sizeof(m)) |
84 | fatal("mac_compute: mac too long"); | 92 | fatal("mac_compute: mac too long"); |
85 | HMAC_Init(&c, mac->key, mac->key_len, mac->md); | 93 | HMAC_Init(&c, mac->key, mac->key_len, mac->md); |
86 | PUT_32BIT(b, seqno); | 94 | put_u32(b, seqno); |
87 | HMAC_Update(&c, b, sizeof(b)); | 95 | HMAC_Update(&c, b, sizeof(b)); |
88 | HMAC_Update(&c, data, datalen); | 96 | HMAC_Update(&c, data, datalen); |
89 | HMAC_Final(&c, m, NULL); | 97 | HMAC_Final(&c, m, NULL); |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: mac.h,v 1.3 2001/06/26 17:27:24 markus Exp $ */ | 1 | /* $OpenBSD: mac.h,v 1.4 2006/03/25 22:22:43 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
4 | * | 4 | * |
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: match.c,v 1.26 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -35,10 +36,14 @@ | |||
35 | */ | 36 | */ |
36 | 37 | ||
37 | #include "includes.h" | 38 | #include "includes.h" |
38 | RCSID("$OpenBSD: match.c,v 1.20 2005/06/17 02:44:32 djm Exp $"); | ||
39 | 39 | ||
40 | #include "match.h" | 40 | #include <sys/types.h> |
41 | |||
42 | #include <ctype.h> | ||
43 | #include <string.h> | ||
44 | |||
41 | #include "xmalloc.h" | 45 | #include "xmalloc.h" |
46 | #include "match.h" | ||
42 | 47 | ||
43 | /* | 48 | /* |
44 | * Returns true if the given string matches the pattern (which may contain ? | 49 | * Returns true if the given string matches the pattern (which may contain ? |
@@ -136,7 +141,7 @@ match_pattern_list(const char *string, const char *pattern, u_int len, | |||
136 | i < len && subi < sizeof(sub) - 1 && pattern[i] != ','; | 141 | i < len && subi < sizeof(sub) - 1 && pattern[i] != ','; |
137 | subi++, i++) | 142 | subi++, i++) |
138 | sub[subi] = dolower && isupper(pattern[i]) ? | 143 | sub[subi] = dolower && isupper(pattern[i]) ? |
139 | tolower(pattern[i]) : pattern[i]; | 144 | (char)tolower(pattern[i]) : pattern[i]; |
140 | /* If subpattern too long, return failure (no match). */ | 145 | /* If subpattern too long, return failure (no match). */ |
141 | if (subi >= sizeof(sub) - 1) | 146 | if (subi >= sizeof(sub) - 1) |
142 | return 0; | 147 | return 0; |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: match.h,v 1.12 2002/03/01 13:12:10 markus Exp $ */ | 1 | /* $OpenBSD: match.h,v 1.13 2006/03/25 22:22:43 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
diff --git a/md-sha256.c b/md-sha256.c new file mode 100644 index 000000000..8c1b3b92d --- /dev/null +++ b/md-sha256.c | |||
@@ -0,0 +1,86 @@ | |||
1 | /* $OpenBSD: md-sha256.c,v 1.5 2006/08/03 03:34:42 deraadt Exp $ */ | ||
2 | /* | ||
3 | * Copyright (c) 2005 Damien Miller <djm@openbsd.org> | ||
4 | * | ||
5 | * Permission to use, copy, modify, and distribute this software for any | ||
6 | * purpose with or without fee is hereby granted, provided that the above | ||
7 | * copyright notice and this permission notice appear in all copies. | ||
8 | * | ||
9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | */ | ||
17 | |||
18 | /* EVP wrapper for SHA256 */ | ||
19 | |||
20 | #include "includes.h" | ||
21 | |||
22 | #include <sys/types.h> | ||
23 | #include <openssl/opensslv.h> | ||
24 | |||
25 | #if !defined(HAVE_EVP_SHA256) && (OPENSSL_VERSION_NUMBER >= 0x00907000L) | ||
26 | |||
27 | #include <string.h> | ||
28 | #include <openssl/evp.h> | ||
29 | #ifdef HAVE_SHA256_UPDATE | ||
30 | # ifdef HAVE_SHA2_H | ||
31 | # include <sha2.h> | ||
32 | # elif defined(HAVE_CRYPTO_SHA2_H) | ||
33 | # include <crypto/sha2.h> | ||
34 | # endif | ||
35 | #endif | ||
36 | |||
37 | const EVP_MD *evp_ssh_sha256(void); | ||
38 | |||
39 | static int | ||
40 | ssh_sha256_init(EVP_MD_CTX *ctxt) | ||
41 | { | ||
42 | SHA256_Init(ctxt->md_data); | ||
43 | return (1); | ||
44 | } | ||
45 | |||
46 | static int | ||
47 | ssh_sha256_update(EVP_MD_CTX *ctxt, const void *data, unsigned long len) | ||
48 | { | ||
49 | SHA256_Update(ctxt->md_data, data, len); | ||
50 | return (1); | ||
51 | } | ||
52 | |||
53 | static int | ||
54 | ssh_sha256_final(EVP_MD_CTX *ctxt, unsigned char *digest) | ||
55 | { | ||
56 | SHA256_Final(digest, ctxt->md_data); | ||
57 | return (1); | ||
58 | } | ||
59 | |||
60 | static int | ||
61 | ssh_sha256_cleanup(EVP_MD_CTX *ctxt) | ||
62 | { | ||
63 | memset(ctxt->md_data, 0, sizeof(SHA256_CTX)); | ||
64 | return (1); | ||
65 | } | ||
66 | |||
67 | const EVP_MD * | ||
68 | evp_ssh_sha256(void) | ||
69 | { | ||
70 | static EVP_MD ssh_sha256; | ||
71 | |||
72 | memset(&ssh_sha256, 0, sizeof(ssh_sha256)); | ||
73 | ssh_sha256.type = NID_undef; | ||
74 | ssh_sha256.md_size = SHA256_DIGEST_LENGTH; | ||
75 | ssh_sha256.init = ssh_sha256_init; | ||
76 | ssh_sha256.update = ssh_sha256_update; | ||
77 | ssh_sha256.final = ssh_sha256_final; | ||
78 | ssh_sha256.cleanup = ssh_sha256_cleanup; | ||
79 | ssh_sha256.block_size = SHA256_BLOCK_LENGTH; | ||
80 | ssh_sha256.ctx_size = sizeof(SHA256_CTX); | ||
81 | |||
82 | return (&ssh_sha256); | ||
83 | } | ||
84 | |||
85 | #endif /* !defined(HAVE_EVP_SHA256) && (OPENSSL_VERSION_NUMBER >= 0x00907000L) */ | ||
86 | |||
diff --git a/md5crypt.c b/md5crypt.c index 8f2523e62..22ef98933 100644 --- a/md5crypt.c +++ b/md5crypt.c | |||
@@ -11,9 +11,11 @@ | |||
11 | #include "includes.h" | 11 | #include "includes.h" |
12 | 12 | ||
13 | #if defined(HAVE_MD5_PASSWORDS) && !defined(HAVE_MD5_CRYPT) | 13 | #if defined(HAVE_MD5_PASSWORDS) && !defined(HAVE_MD5_CRYPT) |
14 | #include <openssl/md5.h> | 14 | #include <sys/types.h> |
15 | |||
16 | #include <string.h> | ||
15 | 17 | ||
16 | RCSID("$Id: md5crypt.c,v 1.9 2003/11/21 12:56:47 djm Exp $"); | 18 | #include <openssl/md5.h> |
17 | 19 | ||
18 | /* 0 ... 63 => ascii - 64 */ | 20 | /* 0 ... 63 => ascii - 64 */ |
19 | static unsigned char itoa64[] = | 21 | static unsigned char itoa64[] = |
@@ -1,6 +1,7 @@ | |||
1 | /* $OpenBSD: misc.c,v 1.65 2006/11/23 01:35:11 ray Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
3 | * Copyright (c) 2005 Damien Miller. All rights reserved. | 4 | * Copyright (c) 2005,2006 Damien Miller. All rights reserved. |
4 | * | 5 | * |
5 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions | 7 | * modification, are permitted provided that the following conditions |
@@ -24,15 +25,35 @@ | |||
24 | */ | 25 | */ |
25 | 26 | ||
26 | #include "includes.h" | 27 | #include "includes.h" |
27 | RCSID("$OpenBSD: misc.c,v 1.42 2006/01/31 10:19:02 djm Exp $"); | ||
28 | 28 | ||
29 | #include <sys/types.h> | ||
30 | #include <sys/ioctl.h> | ||
31 | #include <sys/socket.h> | ||
32 | #include <sys/param.h> | ||
33 | |||
34 | #include <stdarg.h> | ||
35 | #include <stdio.h> | ||
36 | #include <stdlib.h> | ||
37 | #include <string.h> | ||
38 | #include <unistd.h> | ||
39 | |||
40 | #include <netinet/in.h> | ||
41 | #include <netinet/tcp.h> | ||
42 | |||
43 | #include <errno.h> | ||
44 | #include <fcntl.h> | ||
45 | #ifdef HAVE_PATHS_H | ||
46 | # include <paths.h> | ||
47 | #include <pwd.h> | ||
48 | #endif | ||
29 | #ifdef SSH_TUN_OPENBSD | 49 | #ifdef SSH_TUN_OPENBSD |
30 | #include <net/if.h> | 50 | #include <net/if.h> |
31 | #endif | 51 | #endif |
32 | 52 | ||
53 | #include "xmalloc.h" | ||
33 | #include "misc.h" | 54 | #include "misc.h" |
34 | #include "log.h" | 55 | #include "log.h" |
35 | #include "xmalloc.h" | 56 | #include "ssh.h" |
36 | 57 | ||
37 | /* remove newline at end of string */ | 58 | /* remove newline at end of string */ |
38 | char * | 59 | char * |
@@ -123,6 +144,7 @@ set_nodelay(int fd) | |||
123 | 144 | ||
124 | /* Characters considered whitespace in strsep calls. */ | 145 | /* Characters considered whitespace in strsep calls. */ |
125 | #define WHITESPACE " \t\r\n" | 146 | #define WHITESPACE " \t\r\n" |
147 | #define QUOTE "\"" | ||
126 | 148 | ||
127 | /* return next token in configuration line */ | 149 | /* return next token in configuration line */ |
128 | char * | 150 | char * |
@@ -136,15 +158,27 @@ strdelim(char **s) | |||
136 | 158 | ||
137 | old = *s; | 159 | old = *s; |
138 | 160 | ||
139 | *s = strpbrk(*s, WHITESPACE "="); | 161 | *s = strpbrk(*s, WHITESPACE QUOTE "="); |
140 | if (*s == NULL) | 162 | if (*s == NULL) |
141 | return (old); | 163 | return (old); |
142 | 164 | ||
165 | if (*s[0] == '\"') { | ||
166 | memmove(*s, *s + 1, strlen(*s)); /* move nul too */ | ||
167 | /* Find matching quote */ | ||
168 | if ((*s = strpbrk(*s, QUOTE)) == NULL) { | ||
169 | return (NULL); /* no matching quote */ | ||
170 | } else { | ||
171 | *s[0] = '\0'; | ||
172 | return (old); | ||
173 | } | ||
174 | } | ||
175 | |||
143 | /* Allow only one '=' to be skipped */ | 176 | /* Allow only one '=' to be skipped */ |
144 | if (*s[0] == '=') | 177 | if (*s[0] == '=') |
145 | wspace = 1; | 178 | wspace = 1; |
146 | *s[0] = '\0'; | 179 | *s[0] = '\0'; |
147 | 180 | ||
181 | /* Skip any extra whitespace after first token */ | ||
148 | *s += strspn(*s + 1, WHITESPACE) + 1; | 182 | *s += strspn(*s + 1, WHITESPACE) + 1; |
149 | if (*s[0] == '=' && !wspace) | 183 | if (*s[0] == '=' && !wspace) |
150 | *s += strspn(*s + 1, WHITESPACE) + 1; | 184 | *s += strspn(*s + 1, WHITESPACE) + 1; |
@@ -155,9 +189,8 @@ strdelim(char **s) | |||
155 | struct passwd * | 189 | struct passwd * |
156 | pwcopy(struct passwd *pw) | 190 | pwcopy(struct passwd *pw) |
157 | { | 191 | { |
158 | struct passwd *copy = xmalloc(sizeof(*copy)); | 192 | struct passwd *copy = xcalloc(1, sizeof(*copy)); |
159 | 193 | ||
160 | memset(copy, 0, sizeof(*copy)); | ||
161 | copy->pw_name = xstrdup(pw->pw_name); | 194 | copy->pw_name = xstrdup(pw->pw_name); |
162 | copy->pw_passwd = xstrdup(pw->pw_passwd); | 195 | copy->pw_passwd = xstrdup(pw->pw_passwd); |
163 | copy->pw_gecos = xstrdup(pw->pw_gecos); | 196 | copy->pw_gecos = xstrdup(pw->pw_gecos); |
@@ -280,6 +313,7 @@ convtime(const char *s) | |||
280 | switch (*endp++) { | 313 | switch (*endp++) { |
281 | case '\0': | 314 | case '\0': |
282 | endp--; | 315 | endp--; |
316 | break; | ||
283 | case 's': | 317 | case 's': |
284 | case 'S': | 318 | case 'S': |
285 | break; | 319 | break; |
@@ -312,6 +346,23 @@ convtime(const char *s) | |||
312 | } | 346 | } |
313 | 347 | ||
314 | /* | 348 | /* |
349 | * Returns a standardized host+port identifier string. | ||
350 | * Caller must free returned string. | ||
351 | */ | ||
352 | char * | ||
353 | put_host_port(const char *host, u_short port) | ||
354 | { | ||
355 | char *hoststr; | ||
356 | |||
357 | if (port == 0 || port == SSH_DEFAULT_PORT) | ||
358 | return(xstrdup(host)); | ||
359 | if (asprintf(&hoststr, "[%s]:%d", host, (int)port) < 0) | ||
360 | fatal("put_host_port: asprintf: %s", strerror(errno)); | ||
361 | debug3("put_host_port: %s", hoststr); | ||
362 | return hoststr; | ||
363 | } | ||
364 | |||
365 | /* | ||
315 | * Search for next delimiter between hostnames/addresses and ports. | 366 | * Search for next delimiter between hostnames/addresses and ports. |
316 | * Argument may be modified (for termination). | 367 | * Argument may be modified (for termination). |
317 | * Returns *cp if parsing succeeds. | 368 | * Returns *cp if parsing succeeds. |
@@ -408,7 +459,7 @@ addargs(arglist *args, char *fmt, ...) | |||
408 | } else if (args->num+2 >= nalloc) | 459 | } else if (args->num+2 >= nalloc) |
409 | nalloc *= 2; | 460 | nalloc *= 2; |
410 | 461 | ||
411 | args->list = xrealloc(args->list, nalloc * sizeof(char *)); | 462 | args->list = xrealloc(args->list, nalloc, sizeof(char *)); |
412 | args->nalloc = nalloc; | 463 | args->nalloc = nalloc; |
413 | args->list[args->num++] = cp; | 464 | args->list[args->num++] = cp; |
414 | args->list[args->num] = NULL; | 465 | args->list[args->num] = NULL; |
@@ -565,6 +616,8 @@ read_keyfile_line(FILE *f, const char *filename, char *buf, size_t bufsz, | |||
565 | u_long *lineno) | 616 | u_long *lineno) |
566 | { | 617 | { |
567 | while (fgets(buf, bufsz, f) != NULL) { | 618 | while (fgets(buf, bufsz, f) != NULL) { |
619 | if (buf[0] == '\0') | ||
620 | continue; | ||
568 | (*lineno)++; | 621 | (*lineno)++; |
569 | if (buf[strlen(buf) - 1] == '\n' || feof(f)) { | 622 | if (buf[strlen(buf) - 1] == '\n' || feof(f)) { |
570 | return 0; | 623 | return 0; |
@@ -673,18 +726,100 @@ sanitise_stdfd(void) | |||
673 | } | 726 | } |
674 | 727 | ||
675 | char * | 728 | char * |
676 | tohex(const u_char *d, u_int l) | 729 | tohex(const void *vp, size_t l) |
677 | { | 730 | { |
731 | const u_char *p = (const u_char *)vp; | ||
678 | char b[3], *r; | 732 | char b[3], *r; |
679 | u_int i, hl; | 733 | size_t i, hl; |
734 | |||
735 | if (l > 65536) | ||
736 | return xstrdup("tohex: length > 65536"); | ||
680 | 737 | ||
681 | hl = l * 2 + 1; | 738 | hl = l * 2 + 1; |
682 | r = xmalloc(hl); | 739 | r = xcalloc(1, hl); |
683 | *r = '\0'; | ||
684 | for (i = 0; i < l; i++) { | 740 | for (i = 0; i < l; i++) { |
685 | snprintf(b, sizeof(b), "%02x", d[i]); | 741 | snprintf(b, sizeof(b), "%02x", p[i]); |
686 | strlcat(r, b, hl); | 742 | strlcat(r, b, hl); |
687 | } | 743 | } |
688 | return (r); | 744 | return (r); |
689 | } | 745 | } |
690 | 746 | ||
747 | u_int64_t | ||
748 | get_u64(const void *vp) | ||
749 | { | ||
750 | const u_char *p = (const u_char *)vp; | ||
751 | u_int64_t v; | ||
752 | |||
753 | v = (u_int64_t)p[0] << 56; | ||
754 | v |= (u_int64_t)p[1] << 48; | ||
755 | v |= (u_int64_t)p[2] << 40; | ||
756 | v |= (u_int64_t)p[3] << 32; | ||
757 | v |= (u_int64_t)p[4] << 24; | ||
758 | v |= (u_int64_t)p[5] << 16; | ||
759 | v |= (u_int64_t)p[6] << 8; | ||
760 | v |= (u_int64_t)p[7]; | ||
761 | |||
762 | return (v); | ||
763 | } | ||
764 | |||
765 | u_int32_t | ||
766 | get_u32(const void *vp) | ||
767 | { | ||
768 | const u_char *p = (const u_char *)vp; | ||
769 | u_int32_t v; | ||
770 | |||
771 | v = (u_int32_t)p[0] << 24; | ||
772 | v |= (u_int32_t)p[1] << 16; | ||
773 | v |= (u_int32_t)p[2] << 8; | ||
774 | v |= (u_int32_t)p[3]; | ||
775 | |||
776 | return (v); | ||
777 | } | ||
778 | |||
779 | u_int16_t | ||
780 | get_u16(const void *vp) | ||
781 | { | ||
782 | const u_char *p = (const u_char *)vp; | ||
783 | u_int16_t v; | ||
784 | |||
785 | v = (u_int16_t)p[0] << 8; | ||
786 | v |= (u_int16_t)p[1]; | ||
787 | |||
788 | return (v); | ||
789 | } | ||
790 | |||
791 | void | ||
792 | put_u64(void *vp, u_int64_t v) | ||
793 | { | ||
794 | u_char *p = (u_char *)vp; | ||
795 | |||
796 | p[0] = (u_char)(v >> 56) & 0xff; | ||
797 | p[1] = (u_char)(v >> 48) & 0xff; | ||
798 | p[2] = (u_char)(v >> 40) & 0xff; | ||
799 | p[3] = (u_char)(v >> 32) & 0xff; | ||
800 | p[4] = (u_char)(v >> 24) & 0xff; | ||
801 | p[5] = (u_char)(v >> 16) & 0xff; | ||
802 | p[6] = (u_char)(v >> 8) & 0xff; | ||
803 | p[7] = (u_char)v & 0xff; | ||
804 | } | ||
805 | |||
806 | void | ||
807 | put_u32(void *vp, u_int32_t v) | ||
808 | { | ||
809 | u_char *p = (u_char *)vp; | ||
810 | |||
811 | p[0] = (u_char)(v >> 24) & 0xff; | ||
812 | p[1] = (u_char)(v >> 16) & 0xff; | ||
813 | p[2] = (u_char)(v >> 8) & 0xff; | ||
814 | p[3] = (u_char)v & 0xff; | ||
815 | } | ||
816 | |||
817 | |||
818 | void | ||
819 | put_u16(void *vp, u_int16_t v) | ||
820 | { | ||
821 | u_char *p = (u_char *)vp; | ||
822 | |||
823 | p[0] = (u_char)(v >> 8) & 0xff; | ||
824 | p[1] = (u_char)v & 0xff; | ||
825 | } | ||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: misc.h,v 1.29 2006/01/31 10:19:02 djm Exp $ */ | 1 | /* $OpenBSD: misc.h,v 1.36 2006/08/18 10:27:16 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -12,6 +12,9 @@ | |||
12 | * called by a name other than "ssh" or "Secure Shell". | 12 | * called by a name other than "ssh" or "Secure Shell". |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #ifndef _MISC_H | ||
16 | #define _MISC_H | ||
17 | |||
15 | /* misc.c */ | 18 | /* misc.c */ |
16 | 19 | ||
17 | char *chop(char *); | 20 | char *chop(char *); |
@@ -21,13 +24,14 @@ int unset_nonblock(int); | |||
21 | void set_nodelay(int); | 24 | void set_nodelay(int); |
22 | int a2port(const char *); | 25 | int a2port(const char *); |
23 | int a2tun(const char *, int *); | 26 | int a2tun(const char *, int *); |
27 | char *put_host_port(const char *, u_short); | ||
24 | char *hpdelim(char **); | 28 | char *hpdelim(char **); |
25 | char *cleanhostname(char *); | 29 | char *cleanhostname(char *); |
26 | char *colon(char *); | 30 | char *colon(char *); |
27 | long convtime(const char *); | 31 | long convtime(const char *); |
28 | char *tilde_expand_filename(const char *, uid_t); | 32 | char *tilde_expand_filename(const char *, uid_t); |
29 | char *percent_expand(const char *, ...) __attribute__((__sentinel__)); | 33 | char *percent_expand(const char *, ...) __attribute__((__sentinel__)); |
30 | char *tohex(const u_char *, u_int); | 34 | char *tohex(const void *, size_t); |
31 | void sanitise_stdfd(void); | 35 | void sanitise_stdfd(void); |
32 | 36 | ||
33 | struct passwd *pwcopy(struct passwd *); | 37 | struct passwd *pwcopy(struct passwd *); |
@@ -44,17 +48,6 @@ void replacearg(arglist *, u_int, char *, ...) | |||
44 | __attribute__((format(printf, 3, 4))); | 48 | __attribute__((format(printf, 3, 4))); |
45 | void freeargs(arglist *); | 49 | void freeargs(arglist *); |
46 | 50 | ||
47 | /* readpass.c */ | ||
48 | |||
49 | #define RP_ECHO 0x0001 | ||
50 | #define RP_ALLOW_STDIN 0x0002 | ||
51 | #define RP_ALLOW_EOF 0x0004 | ||
52 | #define RP_USE_ASKPASS 0x0008 | ||
53 | |||
54 | char *read_passphrase(const char *, int); | ||
55 | int ask_permission(const char *, ...) __attribute__((format(printf, 1, 2))); | ||
56 | int read_keyfile_line(FILE *, const char *, char *, size_t, u_long *); | ||
57 | |||
58 | int tun_open(int, int); | 51 | int tun_open(int, int); |
59 | 52 | ||
60 | /* Common definitions for ssh tunnel device forwarding */ | 53 | /* Common definitions for ssh tunnel device forwarding */ |
@@ -67,3 +60,31 @@ int tun_open(int, int); | |||
67 | #define SSH_TUNID_ANY 0x7fffffff | 60 | #define SSH_TUNID_ANY 0x7fffffff |
68 | #define SSH_TUNID_ERR (SSH_TUNID_ANY - 1) | 61 | #define SSH_TUNID_ERR (SSH_TUNID_ANY - 1) |
69 | #define SSH_TUNID_MAX (SSH_TUNID_ANY - 2) | 62 | #define SSH_TUNID_MAX (SSH_TUNID_ANY - 2) |
63 | |||
64 | /* Functions to extract or store big-endian words of various sizes */ | ||
65 | u_int64_t get_u64(const void *) | ||
66 | __attribute__((__bounded__( __minbytes__, 1, 8))); | ||
67 | u_int32_t get_u32(const void *) | ||
68 | __attribute__((__bounded__( __minbytes__, 1, 4))); | ||
69 | u_int16_t get_u16(const void *) | ||
70 | __attribute__((__bounded__( __minbytes__, 1, 2))); | ||
71 | void put_u64(void *, u_int64_t) | ||
72 | __attribute__((__bounded__( __minbytes__, 1, 8))); | ||
73 | void put_u32(void *, u_int32_t) | ||
74 | __attribute__((__bounded__( __minbytes__, 1, 4))); | ||
75 | void put_u16(void *, u_int16_t) | ||
76 | __attribute__((__bounded__( __minbytes__, 1, 2))); | ||
77 | |||
78 | |||
79 | /* readpass.c */ | ||
80 | |||
81 | #define RP_ECHO 0x0001 | ||
82 | #define RP_ALLOW_STDIN 0x0002 | ||
83 | #define RP_ALLOW_EOF 0x0004 | ||
84 | #define RP_USE_ASKPASS 0x0008 | ||
85 | |||
86 | char *read_passphrase(const char *, int); | ||
87 | int ask_permission(const char *, ...) __attribute__((format(printf, 1, 2))); | ||
88 | int read_keyfile_line(FILE *, const char *, char *, size_t, u_long *); | ||
89 | |||
90 | #endif /* _MISC_H */ | ||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: moduli.c,v 1.12 2005/07/17 07:17:55 djm Exp $ */ | 1 | /* $OpenBSD: moduli.c,v 1.20 2007/02/24 03:30:11 ray Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright 1994 Phil Karn <karn@qualcomm.com> | 3 | * Copyright 1994 Phil Karn <karn@qualcomm.com> |
4 | * Copyright 1996-1998, 2003 William Allen Simpson <wsimpson@greendragon.com> | 4 | * Copyright 1996-1998, 2003 William Allen Simpson <wsimpson@greendragon.com> |
@@ -38,11 +38,20 @@ | |||
38 | */ | 38 | */ |
39 | 39 | ||
40 | #include "includes.h" | 40 | #include "includes.h" |
41 | #include "xmalloc.h" | 41 | |
42 | #include "log.h" | 42 | #include <sys/types.h> |
43 | 43 | ||
44 | #include <openssl/bn.h> | 44 | #include <openssl/bn.h> |
45 | 45 | ||
46 | #include <stdio.h> | ||
47 | #include <stdlib.h> | ||
48 | #include <string.h> | ||
49 | #include <stdarg.h> | ||
50 | #include <time.h> | ||
51 | |||
52 | #include "xmalloc.h" | ||
53 | #include "log.h" | ||
54 | |||
46 | /* | 55 | /* |
47 | * File output defines | 56 | * File output defines |
48 | */ | 57 | */ |
@@ -301,21 +310,10 @@ gen_candidates(FILE *out, u_int32_t memory, u_int32_t power, BIGNUM *start) | |||
301 | largewords = (largememory << SHIFT_MEGAWORD); | 310 | largewords = (largememory << SHIFT_MEGAWORD); |
302 | } | 311 | } |
303 | 312 | ||
304 | TinySieve = calloc(tinywords, sizeof(u_int32_t)); | 313 | TinySieve = xcalloc(tinywords, sizeof(u_int32_t)); |
305 | if (TinySieve == NULL) { | ||
306 | error("Insufficient memory for tiny sieve: need %u bytes", | ||
307 | tinywords << SHIFT_BYTE); | ||
308 | exit(1); | ||
309 | } | ||
310 | tinybits = tinywords << SHIFT_WORD; | 314 | tinybits = tinywords << SHIFT_WORD; |
311 | 315 | ||
312 | SmallSieve = calloc(smallwords, sizeof(u_int32_t)); | 316 | SmallSieve = xcalloc(smallwords, sizeof(u_int32_t)); |
313 | if (SmallSieve == NULL) { | ||
314 | error("Insufficient memory for small sieve: need %u bytes", | ||
315 | smallwords << SHIFT_BYTE); | ||
316 | xfree(TinySieve); | ||
317 | exit(1); | ||
318 | } | ||
319 | smallbits = smallwords << SHIFT_WORD; | 317 | smallbits = smallwords << SHIFT_WORD; |
320 | 318 | ||
321 | /* | 319 | /* |
@@ -329,20 +327,26 @@ gen_candidates(FILE *out, u_int32_t memory, u_int32_t power, BIGNUM *start) | |||
329 | 327 | ||
330 | /* validation check: count the number of primes tried */ | 328 | /* validation check: count the number of primes tried */ |
331 | largetries = 0; | 329 | largetries = 0; |
332 | q = BN_new(); | 330 | if ((q = BN_new()) == NULL) |
331 | fatal("BN_new failed"); | ||
333 | 332 | ||
334 | /* | 333 | /* |
335 | * Generate random starting point for subprime search, or use | 334 | * Generate random starting point for subprime search, or use |
336 | * specified parameter. | 335 | * specified parameter. |
337 | */ | 336 | */ |
338 | largebase = BN_new(); | 337 | if ((largebase = BN_new()) == NULL) |
339 | if (start == NULL) | 338 | fatal("BN_new failed"); |
340 | BN_rand(largebase, power, 1, 1); | 339 | if (start == NULL) { |
341 | else | 340 | if (BN_rand(largebase, power, 1, 1) == 0) |
342 | BN_copy(largebase, start); | 341 | fatal("BN_rand failed"); |
342 | } else { | ||
343 | if (BN_copy(largebase, start) == NULL) | ||
344 | fatal("BN_copy: failed"); | ||
345 | } | ||
343 | 346 | ||
344 | /* ensure odd */ | 347 | /* ensure odd */ |
345 | BN_set_bit(largebase, 0); | 348 | if (BN_set_bit(largebase, 0) == 0) |
349 | fatal("BN_set_bit: failed"); | ||
346 | 350 | ||
347 | time(&time_start); | 351 | time(&time_start); |
348 | 352 | ||
@@ -426,8 +430,10 @@ gen_candidates(FILE *out, u_int32_t memory, u_int32_t power, BIGNUM *start) | |||
426 | continue; /* Definitely composite, skip */ | 430 | continue; /* Definitely composite, skip */ |
427 | 431 | ||
428 | debug2("test q = largebase+%u", 2 * j); | 432 | debug2("test q = largebase+%u", 2 * j); |
429 | BN_set_word(q, 2 * j); | 433 | if (BN_set_word(q, 2 * j) == 0) |
430 | BN_add(q, q, largebase); | 434 | fatal("BN_set_word failed"); |
435 | if (BN_add(q, q, largebase) == 0) | ||
436 | fatal("BN_add failed"); | ||
431 | if (qfileout(out, QTYPE_SOPHIE_GERMAIN, QTEST_SIEVE, | 437 | if (qfileout(out, QTYPE_SOPHIE_GERMAIN, QTEST_SIEVE, |
432 | largetries, (power - 1) /* MSB */, (0), q) == -1) { | 438 | largetries, (power - 1) /* MSB */, (0), q) == -1) { |
433 | ret = -1; | 439 | ret = -1; |
@@ -472,20 +478,21 @@ prime_test(FILE *in, FILE *out, u_int32_t trials, u_int32_t generator_wanted) | |||
472 | 478 | ||
473 | time(&time_start); | 479 | time(&time_start); |
474 | 480 | ||
475 | p = BN_new(); | 481 | if ((p = BN_new()) == NULL) |
476 | q = BN_new(); | 482 | fatal("BN_new failed"); |
477 | ctx = BN_CTX_new(); | 483 | if ((q = BN_new()) == NULL) |
484 | fatal("BN_new failed"); | ||
485 | if ((ctx = BN_CTX_new()) == NULL) | ||
486 | fatal("BN_CTX_new failed"); | ||
478 | 487 | ||
479 | debug2("%.24s Final %u Miller-Rabin trials (%x generator)", | 488 | debug2("%.24s Final %u Miller-Rabin trials (%x generator)", |
480 | ctime(&time_start), trials, generator_wanted); | 489 | ctime(&time_start), trials, generator_wanted); |
481 | 490 | ||
482 | res = 0; | 491 | res = 0; |
483 | lp = xmalloc(QLINESIZE + 1); | 492 | lp = xmalloc(QLINESIZE + 1); |
484 | while (fgets(lp, QLINESIZE, in) != NULL) { | 493 | while (fgets(lp, QLINESIZE + 1, in) != NULL) { |
485 | int ll = strlen(lp); | ||
486 | |||
487 | count_in++; | 494 | count_in++; |
488 | if (ll < 14 || *lp == '!' || *lp == '#') { | 495 | if (strlen(lp) < 14 || *lp == '!' || *lp == '#') { |
489 | debug2("%10u: comment or short line", count_in); | 496 | debug2("%10u: comment or short line", count_in); |
490 | continue; | 497 | continue; |
491 | } | 498 | } |
@@ -522,10 +529,13 @@ prime_test(FILE *in, FILE *out, u_int32_t trials, u_int32_t generator_wanted) | |||
522 | case QTYPE_SOPHIE_GERMAIN: | 529 | case QTYPE_SOPHIE_GERMAIN: |
523 | debug2("%10u: (%u) Sophie-Germain", count_in, in_type); | 530 | debug2("%10u: (%u) Sophie-Germain", count_in, in_type); |
524 | a = q; | 531 | a = q; |
525 | BN_hex2bn(&a, cp); | 532 | if (BN_hex2bn(&a, cp) == 0) |
533 | fatal("BN_hex2bn failed"); | ||
526 | /* p = 2*q + 1 */ | 534 | /* p = 2*q + 1 */ |
527 | BN_lshift(p, q, 1); | 535 | if (BN_lshift(p, q, 1) == 0) |
528 | BN_add_word(p, 1); | 536 | fatal("BN_lshift failed"); |
537 | if (BN_add_word(p, 1) == 0) | ||
538 | fatal("BN_add_word failed"); | ||
529 | in_size += 1; | 539 | in_size += 1; |
530 | generator_known = 0; | 540 | generator_known = 0; |
531 | break; | 541 | break; |
@@ -536,9 +546,11 @@ prime_test(FILE *in, FILE *out, u_int32_t trials, u_int32_t generator_wanted) | |||
536 | case QTYPE_UNKNOWN: | 546 | case QTYPE_UNKNOWN: |
537 | debug2("%10u: (%u)", count_in, in_type); | 547 | debug2("%10u: (%u)", count_in, in_type); |
538 | a = p; | 548 | a = p; |
539 | BN_hex2bn(&a, cp); | 549 | if (BN_hex2bn(&a, cp) == 0) |
550 | fatal("BN_hex2bn failed"); | ||
540 | /* q = (p-1) / 2 */ | 551 | /* q = (p-1) / 2 */ |
541 | BN_rshift(q, p, 1); | 552 | if (BN_rshift(q, p, 1) == 0) |
553 | fatal("BN_rshift failed"); | ||
542 | break; | 554 | break; |
543 | default: | 555 | default: |
544 | debug2("Unknown prime type"); | 556 | debug2("Unknown prime type"); |
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: monitor.c,v 1.90 2007/02/19 10:45:58 dtucker Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright 2002 Niels Provos <provos@citi.umich.edu> | 3 | * Copyright 2002 Niels Provos <provos@citi.umich.edu> |
3 | * Copyright 2002 Markus Friedl <markus@openbsd.org> | 4 | * Copyright 2002 Markus Friedl <markus@openbsd.org> |
@@ -25,16 +26,38 @@ | |||
25 | */ | 26 | */ |
26 | 27 | ||
27 | #include "includes.h" | 28 | #include "includes.h" |
28 | RCSID("$OpenBSD: monitor.c,v 1.64 2005/10/13 22:24:31 stevesk Exp $"); | ||
29 | 29 | ||
30 | #include <openssl/dh.h> | 30 | #include <sys/types.h> |
31 | #include <sys/param.h> | ||
32 | #include <sys/socket.h> | ||
33 | #include "openbsd-compat/sys-tree.h" | ||
34 | #include <sys/wait.h> | ||
35 | |||
36 | #include <errno.h> | ||
37 | #include <fcntl.h> | ||
38 | #ifdef HAVE_PATHS_H | ||
39 | #include <paths.h> | ||
40 | #endif | ||
41 | #include <pwd.h> | ||
42 | #include <signal.h> | ||
43 | #include <stdarg.h> | ||
44 | #include <stdlib.h> | ||
45 | #include <string.h> | ||
46 | #include <unistd.h> | ||
31 | 47 | ||
32 | #ifdef SKEY | 48 | #ifdef SKEY |
33 | #include <skey.h> | 49 | #include <skey.h> |
34 | #endif | 50 | #endif |
35 | 51 | ||
52 | #include <openssl/dh.h> | ||
53 | |||
54 | #include "xmalloc.h" | ||
36 | #include "ssh.h" | 55 | #include "ssh.h" |
56 | #include "key.h" | ||
57 | #include "buffer.h" | ||
58 | #include "hostfile.h" | ||
37 | #include "auth.h" | 59 | #include "auth.h" |
60 | #include "cipher.h" | ||
38 | #include "kex.h" | 61 | #include "kex.h" |
39 | #include "dh.h" | 62 | #include "dh.h" |
40 | #ifdef TARGET_OS_MAC /* XXX Broken krb5 headers on Mac */ | 63 | #ifdef TARGET_OS_MAC /* XXX Broken krb5 headers on Mac */ |
@@ -55,17 +78,16 @@ RCSID("$OpenBSD: monitor.c,v 1.64 2005/10/13 22:24:31 stevesk Exp $"); | |||
55 | #include "servconf.h" | 78 | #include "servconf.h" |
56 | #include "monitor.h" | 79 | #include "monitor.h" |
57 | #include "monitor_mm.h" | 80 | #include "monitor_mm.h" |
81 | #ifdef GSSAPI | ||
82 | #include "ssh-gss.h" | ||
83 | #endif | ||
58 | #include "monitor_wrap.h" | 84 | #include "monitor_wrap.h" |
59 | #include "monitor_fdpass.h" | 85 | #include "monitor_fdpass.h" |
60 | #include "xmalloc.h" | ||
61 | #include "misc.h" | 86 | #include "misc.h" |
62 | #include "buffer.h" | ||
63 | #include "bufaux.h" | ||
64 | #include "compat.h" | 87 | #include "compat.h" |
65 | #include "ssh2.h" | 88 | #include "ssh2.h" |
66 | 89 | ||
67 | #ifdef GSSAPI | 90 | #ifdef GSSAPI |
68 | #include "ssh-gss.h" | ||
69 | static Gssctxt *gsscontext = NULL; | 91 | static Gssctxt *gsscontext = NULL; |
70 | #endif | 92 | #endif |
71 | 93 | ||
@@ -173,6 +195,7 @@ struct mon_table { | |||
173 | #define MON_ISAUTH 0x0004 /* Required for Authentication */ | 195 | #define MON_ISAUTH 0x0004 /* Required for Authentication */ |
174 | #define MON_AUTHDECIDE 0x0008 /* Decides Authentication */ | 196 | #define MON_AUTHDECIDE 0x0008 /* Decides Authentication */ |
175 | #define MON_ONCE 0x0010 /* Disable after calling */ | 197 | #define MON_ONCE 0x0010 /* Disable after calling */ |
198 | #define MON_ALOG 0x0020 /* Log auth attempt without authenticating */ | ||
176 | 199 | ||
177 | #define MON_AUTH (MON_ISAUTH|MON_AUTHDECIDE) | 200 | #define MON_AUTH (MON_ISAUTH|MON_AUTHDECIDE) |
178 | 201 | ||
@@ -199,7 +222,7 @@ struct mon_table mon_dispatch_proto20[] = { | |||
199 | #endif | 222 | #endif |
200 | #ifdef BSD_AUTH | 223 | #ifdef BSD_AUTH |
201 | {MONITOR_REQ_BSDAUTHQUERY, MON_ISAUTH, mm_answer_bsdauthquery}, | 224 | {MONITOR_REQ_BSDAUTHQUERY, MON_ISAUTH, mm_answer_bsdauthquery}, |
202 | {MONITOR_REQ_BSDAUTHRESPOND, MON_AUTH,mm_answer_bsdauthrespond}, | 225 | {MONITOR_REQ_BSDAUTHRESPOND, MON_AUTH, mm_answer_bsdauthrespond}, |
203 | #endif | 226 | #endif |
204 | #ifdef SKEY | 227 | #ifdef SKEY |
205 | {MONITOR_REQ_SKEYQUERY, MON_ISAUTH, mm_answer_skeyquery}, | 228 | {MONITOR_REQ_SKEYQUERY, MON_ISAUTH, mm_answer_skeyquery}, |
@@ -240,13 +263,13 @@ struct mon_table mon_dispatch_proto15[] = { | |||
240 | {MONITOR_REQ_SESSKEY, MON_ONCE, mm_answer_sesskey}, | 263 | {MONITOR_REQ_SESSKEY, MON_ONCE, mm_answer_sesskey}, |
241 | {MONITOR_REQ_SESSID, MON_ONCE, mm_answer_sessid}, | 264 | {MONITOR_REQ_SESSID, MON_ONCE, mm_answer_sessid}, |
242 | {MONITOR_REQ_AUTHPASSWORD, MON_AUTH, mm_answer_authpassword}, | 265 | {MONITOR_REQ_AUTHPASSWORD, MON_AUTH, mm_answer_authpassword}, |
243 | {MONITOR_REQ_RSAKEYALLOWED, MON_ISAUTH, mm_answer_rsa_keyallowed}, | 266 | {MONITOR_REQ_RSAKEYALLOWED, MON_ISAUTH|MON_ALOG, mm_answer_rsa_keyallowed}, |
244 | {MONITOR_REQ_KEYALLOWED, MON_ISAUTH, mm_answer_keyallowed}, | 267 | {MONITOR_REQ_KEYALLOWED, MON_ISAUTH|MON_ALOG, mm_answer_keyallowed}, |
245 | {MONITOR_REQ_RSACHALLENGE, MON_ONCE, mm_answer_rsa_challenge}, | 268 | {MONITOR_REQ_RSACHALLENGE, MON_ONCE, mm_answer_rsa_challenge}, |
246 | {MONITOR_REQ_RSARESPONSE, MON_ONCE|MON_AUTHDECIDE, mm_answer_rsa_response}, | 269 | {MONITOR_REQ_RSARESPONSE, MON_ONCE|MON_AUTHDECIDE, mm_answer_rsa_response}, |
247 | #ifdef BSD_AUTH | 270 | #ifdef BSD_AUTH |
248 | {MONITOR_REQ_BSDAUTHQUERY, MON_ISAUTH, mm_answer_bsdauthquery}, | 271 | {MONITOR_REQ_BSDAUTHQUERY, MON_ISAUTH, mm_answer_bsdauthquery}, |
249 | {MONITOR_REQ_BSDAUTHRESPOND, MON_AUTH,mm_answer_bsdauthrespond}, | 272 | {MONITOR_REQ_BSDAUTHRESPOND, MON_AUTH, mm_answer_bsdauthrespond}, |
250 | #endif | 273 | #endif |
251 | #ifdef SKEY | 274 | #ifdef SKEY |
252 | {MONITOR_REQ_SKEYQUERY, MON_ISAUTH, mm_answer_skeyquery}, | 275 | {MONITOR_REQ_SKEYQUERY, MON_ISAUTH, mm_answer_skeyquery}, |
@@ -272,7 +295,7 @@ struct mon_table mon_dispatch_postauth15[] = { | |||
272 | {MONITOR_REQ_TERM, 0, mm_answer_term}, | 295 | {MONITOR_REQ_TERM, 0, mm_answer_term}, |
273 | #ifdef SSH_AUDIT_EVENTS | 296 | #ifdef SSH_AUDIT_EVENTS |
274 | {MONITOR_REQ_AUDIT_EVENT, MON_PERMIT, mm_answer_audit_event}, | 297 | {MONITOR_REQ_AUDIT_EVENT, MON_PERMIT, mm_answer_audit_event}, |
275 | {MONITOR_REQ_AUDIT_COMMAND, MON_ONCE, mm_answer_audit_command}, | 298 | {MONITOR_REQ_AUDIT_COMMAND, MON_PERMIT|MON_ONCE, mm_answer_audit_command}, |
276 | #endif | 299 | #endif |
277 | {0, 0, NULL} | 300 | {0, 0, NULL} |
278 | }; | 301 | }; |
@@ -339,6 +362,7 @@ monitor_child_preauth(Authctxt *_authctxt, struct monitor *pmonitor) | |||
339 | 362 | ||
340 | /* The first few requests do not require asynchronous access */ | 363 | /* The first few requests do not require asynchronous access */ |
341 | while (!authenticated) { | 364 | while (!authenticated) { |
365 | auth_method = "unknown"; | ||
342 | authenticated = (monitor_read(pmonitor, mon_dispatch, &ent) == 1); | 366 | authenticated = (monitor_read(pmonitor, mon_dispatch, &ent) == 1); |
343 | if (authenticated) { | 367 | if (authenticated) { |
344 | if (!(ent->flags & MON_AUTHDECIDE)) | 368 | if (!(ent->flags & MON_AUTHDECIDE)) |
@@ -361,7 +385,7 @@ monitor_child_preauth(Authctxt *_authctxt, struct monitor *pmonitor) | |||
361 | #endif | 385 | #endif |
362 | } | 386 | } |
363 | 387 | ||
364 | if (ent->flags & MON_AUTHDECIDE) { | 388 | if (ent->flags & (MON_AUTHDECIDE|MON_ALOG)) { |
365 | auth_log(authctxt, authenticated, auth_method, | 389 | auth_log(authctxt, authenticated, auth_method, |
366 | compat20 ? " ssh2" : ""); | 390 | compat20 ? " ssh2" : ""); |
367 | if (!authenticated) | 391 | if (!authenticated) |
@@ -371,6 +395,8 @@ monitor_child_preauth(Authctxt *_authctxt, struct monitor *pmonitor) | |||
371 | 395 | ||
372 | if (!authctxt->valid) | 396 | if (!authctxt->valid) |
373 | fatal("%s: authenticated invalid user", __func__); | 397 | fatal("%s: authenticated invalid user", __func__); |
398 | if (strcmp(auth_method, "unknown") == 0) | ||
399 | fatal("%s: authentication method name unknown", __func__); | ||
374 | 400 | ||
375 | debug("%s: %s has been authenticated by privileged process", | 401 | debug("%s: %s has been authenticated by privileged process", |
376 | __func__, authctxt->user); | 402 | __func__, authctxt->user); |
@@ -554,7 +580,11 @@ mm_answer_sign(int sock, Buffer *m) | |||
554 | keyid = buffer_get_int(m); | 580 | keyid = buffer_get_int(m); |
555 | p = buffer_get_string(m, &datlen); | 581 | p = buffer_get_string(m, &datlen); |
556 | 582 | ||
557 | if (datlen != 20) | 583 | /* |
584 | * Supported KEX types will only return SHA1 (20 byte) or | ||
585 | * SHA256 (32 byte) hashes | ||
586 | */ | ||
587 | if (datlen != 20 && datlen != 32) | ||
558 | fatal("%s: data length incorrect: %u", __func__, datlen); | 588 | fatal("%s: data length incorrect: %u", __func__, datlen); |
559 | 589 | ||
560 | /* save session id, it will be passed on the first call */ | 590 | /* save session id, it will be passed on the first call */ |
@@ -629,6 +659,9 @@ mm_answer_pwnamallow(int sock, Buffer *m) | |||
629 | #endif | 659 | #endif |
630 | buffer_put_cstring(m, pwent->pw_dir); | 660 | buffer_put_cstring(m, pwent->pw_dir); |
631 | buffer_put_cstring(m, pwent->pw_shell); | 661 | buffer_put_cstring(m, pwent->pw_shell); |
662 | buffer_put_string(m, &options, sizeof(options)); | ||
663 | if (options.banner != NULL) | ||
664 | buffer_put_cstring(m, options.banner); | ||
632 | 665 | ||
633 | out: | 666 | out: |
634 | debug3("%s: sending MONITOR_ANS_PWNAM: %d", __func__, allowed); | 667 | debug3("%s: sending MONITOR_ANS_PWNAM: %d", __func__, allowed); |
@@ -648,9 +681,6 @@ mm_answer_pwnamallow(int sock, Buffer *m) | |||
648 | if (options.use_pam) | 681 | if (options.use_pam) |
649 | monitor_permit(mon_dispatch, MONITOR_REQ_PAM_START, 1); | 682 | monitor_permit(mon_dispatch, MONITOR_REQ_PAM_START, 1); |
650 | #endif | 683 | #endif |
651 | #ifdef SSH_AUDIT_EVENTS | ||
652 | monitor_permit(mon_dispatch, MONITOR_REQ_AUDIT_COMMAND, 1); | ||
653 | #endif | ||
654 | 684 | ||
655 | return (0); | 685 | return (0); |
656 | } | 686 | } |
@@ -934,6 +964,7 @@ mm_answer_pam_query(int sock, Buffer *m) | |||
934 | xfree(prompts); | 964 | xfree(prompts); |
935 | if (echo_on != NULL) | 965 | if (echo_on != NULL) |
936 | xfree(echo_on); | 966 | xfree(echo_on); |
967 | auth_method = "keyboard-interactive/pam"; | ||
937 | mm_request_send(sock, MONITOR_ANS_PAM_QUERY, m); | 968 | mm_request_send(sock, MONITOR_ANS_PAM_QUERY, m); |
938 | return (0); | 969 | return (0); |
939 | } | 970 | } |
@@ -949,7 +980,7 @@ mm_answer_pam_respond(int sock, Buffer *m) | |||
949 | sshpam_authok = NULL; | 980 | sshpam_authok = NULL; |
950 | num = buffer_get_int(m); | 981 | num = buffer_get_int(m); |
951 | if (num > 0) { | 982 | if (num > 0) { |
952 | resp = xmalloc(num * sizeof(char *)); | 983 | resp = xcalloc(num, sizeof(char *)); |
953 | for (i = 0; i < num; ++i) | 984 | for (i = 0; i < num; ++i) |
954 | resp[i] = buffer_get_string(m, NULL); | 985 | resp[i] = buffer_get_string(m, NULL); |
955 | ret = (sshpam_device.respond)(sshpam_ctxt, num, resp); | 986 | ret = (sshpam_device.respond)(sshpam_ctxt, num, resp); |
@@ -976,6 +1007,7 @@ mm_answer_pam_free_ctx(int sock, Buffer *m) | |||
976 | (sshpam_device.free_ctx)(sshpam_ctxt); | 1007 | (sshpam_device.free_ctx)(sshpam_ctxt); |
977 | buffer_clear(m); | 1008 | buffer_clear(m); |
978 | mm_request_send(sock, MONITOR_ANS_PAM_FREE_CTX, m); | 1009 | mm_request_send(sock, MONITOR_ANS_PAM_FREE_CTX, m); |
1010 | auth_method = "keyboard-interactive/pam"; | ||
979 | return (sshpam_authok == sshpam_ctxt); | 1011 | return (sshpam_authok == sshpam_ctxt); |
980 | } | 1012 | } |
981 | #endif | 1013 | #endif |
@@ -1021,17 +1053,20 @@ mm_answer_keyallowed(int sock, Buffer *m) | |||
1021 | case MM_USERKEY: | 1053 | case MM_USERKEY: |
1022 | allowed = options.pubkey_authentication && | 1054 | allowed = options.pubkey_authentication && |
1023 | user_key_allowed(authctxt->pw, key); | 1055 | user_key_allowed(authctxt->pw, key); |
1056 | auth_method = "publickey"; | ||
1024 | break; | 1057 | break; |
1025 | case MM_HOSTKEY: | 1058 | case MM_HOSTKEY: |
1026 | allowed = options.hostbased_authentication && | 1059 | allowed = options.hostbased_authentication && |
1027 | hostbased_key_allowed(authctxt->pw, | 1060 | hostbased_key_allowed(authctxt->pw, |
1028 | cuser, chost, key); | 1061 | cuser, chost, key); |
1062 | auth_method = "hostbased"; | ||
1029 | break; | 1063 | break; |
1030 | case MM_RSAHOSTKEY: | 1064 | case MM_RSAHOSTKEY: |
1031 | key->type = KEY_RSA1; /* XXX */ | 1065 | key->type = KEY_RSA1; /* XXX */ |
1032 | allowed = options.rhosts_rsa_authentication && | 1066 | allowed = options.rhosts_rsa_authentication && |
1033 | auth_rhosts_rsa_key_allowed(authctxt->pw, | 1067 | auth_rhosts_rsa_key_allowed(authctxt->pw, |
1034 | cuser, chost, key); | 1068 | cuser, chost, key); |
1069 | auth_method = "rsa"; | ||
1035 | break; | 1070 | break; |
1036 | default: | 1071 | default: |
1037 | fatal("%s: unknown key type %d", __func__, type); | 1072 | fatal("%s: unknown key type %d", __func__, type); |
@@ -1051,6 +1086,12 @@ mm_answer_keyallowed(int sock, Buffer *m) | |||
1051 | key_blobtype = type; | 1086 | key_blobtype = type; |
1052 | hostbased_cuser = cuser; | 1087 | hostbased_cuser = cuser; |
1053 | hostbased_chost = chost; | 1088 | hostbased_chost = chost; |
1089 | } else { | ||
1090 | /* Log failed attempt */ | ||
1091 | auth_log(authctxt, 0, auth_method, compat20 ? " ssh2" : ""); | ||
1092 | xfree(blob); | ||
1093 | xfree(cuser); | ||
1094 | xfree(chost); | ||
1054 | } | 1095 | } |
1055 | 1096 | ||
1056 | debug3("%s: key %p is %s", | 1097 | debug3("%s: key %p is %s", |
@@ -1252,7 +1293,7 @@ mm_record_login(Session *s, struct passwd *pw) | |||
1252 | fromlen = sizeof(from); | 1293 | fromlen = sizeof(from); |
1253 | if (packet_connection_is_on_socket()) { | 1294 | if (packet_connection_is_on_socket()) { |
1254 | if (getpeername(packet_get_connection_in(), | 1295 | if (getpeername(packet_get_connection_in(), |
1255 | (struct sockaddr *) & from, &fromlen) < 0) { | 1296 | (struct sockaddr *)&from, &fromlen) < 0) { |
1256 | debug("getpeername: %.100s", strerror(errno)); | 1297 | debug("getpeername: %.100s", strerror(errno)); |
1257 | cleanup_exit(255); | 1298 | cleanup_exit(255); |
1258 | } | 1299 | } |
@@ -1268,7 +1309,7 @@ mm_session_close(Session *s) | |||
1268 | { | 1309 | { |
1269 | debug3("%s: session %d pid %ld", __func__, s->self, (long)s->pid); | 1310 | debug3("%s: session %d pid %ld", __func__, s->self, (long)s->pid); |
1270 | if (s->ttyfd != -1) { | 1311 | if (s->ttyfd != -1) { |
1271 | debug3("%s: tty %s ptyfd %d", __func__, s->tty, s->ptyfd); | 1312 | debug3("%s: tty %s ptyfd %d", __func__, s->tty, s->ptyfd); |
1272 | session_pty_cleanup2(s); | 1313 | session_pty_cleanup2(s); |
1273 | } | 1314 | } |
1274 | s->used = 0; | 1315 | s->used = 0; |
@@ -1328,7 +1369,7 @@ mm_answer_pty(int sock, Buffer *m) | |||
1328 | /* no need to dup() because nobody closes ptyfd */ | 1369 | /* no need to dup() because nobody closes ptyfd */ |
1329 | s->ptymaster = s->ptyfd; | 1370 | s->ptymaster = s->ptyfd; |
1330 | 1371 | ||
1331 | debug3("%s: tty %s ptyfd %d", __func__, s->tty, s->ttyfd); | 1372 | debug3("%s: tty %s ptyfd %d", __func__, s->tty, s->ttyfd); |
1332 | 1373 | ||
1333 | return (0); | 1374 | return (0); |
1334 | 1375 | ||
@@ -1415,6 +1456,7 @@ mm_answer_rsa_keyallowed(int sock, Buffer *m) | |||
1415 | 1456 | ||
1416 | debug3("%s entering", __func__); | 1457 | debug3("%s entering", __func__); |
1417 | 1458 | ||
1459 | auth_method = "rsa"; | ||
1418 | if (options.rsa_authentication && authctxt->valid) { | 1460 | if (options.rsa_authentication && authctxt->valid) { |
1419 | if ((client_n = BN_new()) == NULL) | 1461 | if ((client_n = BN_new()) == NULL) |
1420 | fatal("%s: BN_new", __func__); | 1462 | fatal("%s: BN_new", __func__); |
@@ -1651,8 +1693,7 @@ mm_get_kex(Buffer *m) | |||
1651 | void *blob; | 1693 | void *blob; |
1652 | u_int bloblen; | 1694 | u_int bloblen; |
1653 | 1695 | ||
1654 | kex = xmalloc(sizeof(*kex)); | 1696 | kex = xcalloc(1, sizeof(*kex)); |
1655 | memset(kex, 0, sizeof(*kex)); | ||
1656 | kex->session_id = buffer_get_string(m, &kex->session_id_len); | 1697 | kex->session_id = buffer_get_string(m, &kex->session_id_len); |
1657 | if ((session_id2 == NULL) || | 1698 | if ((session_id2 == NULL) || |
1658 | (kex->session_id_len != session_id2_len) || | 1699 | (kex->session_id_len != session_id2_len) || |
@@ -1662,8 +1703,10 @@ mm_get_kex(Buffer *m) | |||
1662 | kex->kex[KEX_DH_GRP1_SHA1] = kexdh_server; | 1703 | kex->kex[KEX_DH_GRP1_SHA1] = kexdh_server; |
1663 | kex->kex[KEX_DH_GRP14_SHA1] = kexdh_server; | 1704 | kex->kex[KEX_DH_GRP14_SHA1] = kexdh_server; |
1664 | kex->kex[KEX_DH_GEX_SHA1] = kexgex_server; | 1705 | kex->kex[KEX_DH_GEX_SHA1] = kexgex_server; |
1706 | kex->kex[KEX_DH_GEX_SHA256] = kexgex_server; | ||
1665 | #ifdef GSSAPI | 1707 | #ifdef GSSAPI |
1666 | kex->kex[KEX_GSS_GRP1_SHA1] = kexgss_server; | 1708 | kex->kex[KEX_GSS_GRP1_SHA1] = kexgss_server; |
1709 | kex->kex[KEX_GSS_GRP14_SHA1] = kexgss_server; | ||
1667 | kex->kex[KEX_GSS_GEX_SHA1] = kexgss_server; | 1710 | kex->kex[KEX_GSS_GEX_SHA1] = kexgss_server; |
1668 | #endif | 1711 | #endif |
1669 | kex->server = 1; | 1712 | kex->server = 1; |
@@ -1825,9 +1868,8 @@ monitor_init(void) | |||
1825 | struct monitor *mon; | 1868 | struct monitor *mon; |
1826 | int pair[2]; | 1869 | int pair[2]; |
1827 | 1870 | ||
1828 | mon = xmalloc(sizeof(*mon)); | 1871 | mon = xcalloc(1, sizeof(*mon)); |
1829 | 1872 | ||
1830 | mon->m_pid = 0; | ||
1831 | monitor_socketpair(pair); | 1873 | monitor_socketpair(pair); |
1832 | 1874 | ||
1833 | mon->m_recvfd = pair[0]; | 1875 | mon->m_recvfd = pair[0]; |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: monitor.h,v 1.13 2003/11/17 11:06:07 markus Exp $ */ | 1 | /* $OpenBSD: monitor.h,v 1.14 2006/03/25 22:22:43 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright 2002 Niels Provos <provos@citi.umich.edu> | 4 | * Copyright 2002 Niels Provos <provos@citi.umich.edu> |
diff --git a/monitor_fdpass.c b/monitor_fdpass.c index f384c174c..52d133647 100644 --- a/monitor_fdpass.c +++ b/monitor_fdpass.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: monitor_fdpass.c,v 1.12 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright 2001 Niels Provos <provos@citi.umich.edu> | 3 | * Copyright 2001 Niels Provos <provos@citi.umich.edu> |
3 | * All rights reserved. | 4 | * All rights reserved. |
@@ -24,11 +25,19 @@ | |||
24 | */ | 25 | */ |
25 | 26 | ||
26 | #include "includes.h" | 27 | #include "includes.h" |
27 | RCSID("$OpenBSD: monitor_fdpass.c,v 1.6 2004/08/13 02:51:48 djm Exp $"); | ||
28 | 28 | ||
29 | #include <sys/types.h> | ||
30 | #include <sys/socket.h> | ||
29 | #include <sys/uio.h> | 31 | #include <sys/uio.h> |
32 | #ifdef HAVE_SYS_UN_H | ||
33 | #include <sys/un.h> | ||
34 | #endif | ||
30 | #include <sys/utsname.h> | 35 | #include <sys/utsname.h> |
31 | 36 | ||
37 | #include <errno.h> | ||
38 | #include <string.h> | ||
39 | #include <stdarg.h> | ||
40 | |||
32 | #include "log.h" | 41 | #include "log.h" |
33 | #include "monitor_fdpass.h" | 42 | #include "monitor_fdpass.h" |
34 | 43 | ||
diff --git a/monitor_fdpass.h b/monitor_fdpass.h index 31d080e21..12c67ec2d 100644 --- a/monitor_fdpass.h +++ b/monitor_fdpass.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: monitor_fdpass.h,v 1.2 2002/03/26 03:24:01 stevesk Exp $ */ | 1 | /* $OpenBSD: monitor_fdpass.h,v 1.3 2006/03/25 22:22:43 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright 2002 Niels Provos <provos@citi.umich.edu> | 4 | * Copyright 2002 Niels Provos <provos@citi.umich.edu> |
diff --git a/monitor_mm.c b/monitor_mm.c index b0ec37cff..dab747532 100644 --- a/monitor_mm.c +++ b/monitor_mm.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: monitor_mm.c,v 1.15 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright 2002 Niels Provos <provos@citi.umich.edu> | 3 | * Copyright 2002 Niels Provos <provos@citi.umich.edu> |
3 | * All rights reserved. | 4 | * All rights reserved. |
@@ -24,14 +25,20 @@ | |||
24 | */ | 25 | */ |
25 | 26 | ||
26 | #include "includes.h" | 27 | #include "includes.h" |
27 | RCSID("$OpenBSD: monitor_mm.c,v 1.9 2004/05/11 19:01:43 deraadt Exp $"); | ||
28 | 28 | ||
29 | #include <sys/types.h> | ||
29 | #ifdef HAVE_SYS_MMAN_H | 30 | #ifdef HAVE_SYS_MMAN_H |
30 | #include <sys/mman.h> | 31 | #include <sys/mman.h> |
31 | #endif | 32 | #endif |
33 | #include <sys/param.h> | ||
34 | #include "openbsd-compat/sys-tree.h" | ||
35 | |||
36 | #include <errno.h> | ||
37 | #include <stdarg.h> | ||
38 | #include <string.h> | ||
32 | 39 | ||
33 | #include "ssh.h" | ||
34 | #include "xmalloc.h" | 40 | #include "xmalloc.h" |
41 | #include "ssh.h" | ||
35 | #include "log.h" | 42 | #include "log.h" |
36 | #include "monitor_mm.h" | 43 | #include "monitor_mm.h" |
37 | 44 | ||
diff --git a/monitor_mm.h b/monitor_mm.h index a1323b9a8..36a07a06d 100644 --- a/monitor_mm.h +++ b/monitor_mm.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: monitor_mm.h,v 1.2 2002/03/26 03:24:01 stevesk Exp $ */ | 1 | /* $OpenBSD: monitor_mm.h,v 1.4 2006/08/03 03:34:42 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright 2002 Niels Provos <provos@citi.umich.edu> | 4 | * Copyright 2002 Niels Provos <provos@citi.umich.edu> |
@@ -27,7 +27,6 @@ | |||
27 | 27 | ||
28 | #ifndef _MM_H_ | 28 | #ifndef _MM_H_ |
29 | #define _MM_H_ | 29 | #define _MM_H_ |
30 | #include "openbsd-compat/sys-tree.h" | ||
31 | 30 | ||
32 | struct mm_share { | 31 | struct mm_share { |
33 | RB_ENTRY(mm_share) next; | 32 | RB_ENTRY(mm_share) next; |
diff --git a/monitor_wrap.c b/monitor_wrap.c index 29cafc751..448324b81 100644 --- a/monitor_wrap.c +++ b/monitor_wrap.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: monitor_wrap.c,v 1.55 2007/02/19 10:45:58 dtucker Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright 2002 Niels Provos <provos@citi.umich.edu> | 3 | * Copyright 2002 Niels Provos <provos@citi.umich.edu> |
3 | * Copyright 2002 Markus Friedl <markus@openbsd.org> | 4 | * Copyright 2002 Markus Friedl <markus@openbsd.org> |
@@ -25,18 +26,31 @@ | |||
25 | */ | 26 | */ |
26 | 27 | ||
27 | #include "includes.h" | 28 | #include "includes.h" |
28 | RCSID("$OpenBSD: monitor_wrap.c,v 1.40 2005/05/24 17:32:43 avsm Exp $"); | 29 | |
30 | #include <sys/types.h> | ||
31 | #include <sys/uio.h> | ||
32 | |||
33 | #include <errno.h> | ||
34 | #include <pwd.h> | ||
35 | #include <signal.h> | ||
36 | #include <stdarg.h> | ||
37 | #include <stdio.h> | ||
38 | #include <string.h> | ||
39 | #include <unistd.h> | ||
29 | 40 | ||
30 | #include <openssl/bn.h> | 41 | #include <openssl/bn.h> |
31 | #include <openssl/dh.h> | 42 | #include <openssl/dh.h> |
32 | 43 | ||
44 | #include "xmalloc.h" | ||
33 | #include "ssh.h" | 45 | #include "ssh.h" |
34 | #include "dh.h" | 46 | #include "dh.h" |
47 | #include "buffer.h" | ||
48 | #include "key.h" | ||
49 | #include "cipher.h" | ||
35 | #include "kex.h" | 50 | #include "kex.h" |
51 | #include "hostfile.h" | ||
36 | #include "auth.h" | 52 | #include "auth.h" |
37 | #include "auth-options.h" | 53 | #include "auth-options.h" |
38 | #include "buffer.h" | ||
39 | #include "bufaux.h" | ||
40 | #include "packet.h" | 54 | #include "packet.h" |
41 | #include "mac.h" | 55 | #include "mac.h" |
42 | #include "log.h" | 56 | #include "log.h" |
@@ -48,20 +62,18 @@ RCSID("$OpenBSD: monitor_wrap.c,v 1.40 2005/05/24 17:32:43 avsm Exp $"); | |||
48 | #include "zlib.h" | 62 | #include "zlib.h" |
49 | #endif | 63 | #endif |
50 | #include "monitor.h" | 64 | #include "monitor.h" |
65 | #ifdef GSSAPI | ||
66 | #include "ssh-gss.h" | ||
67 | #endif | ||
51 | #include "monitor_wrap.h" | 68 | #include "monitor_wrap.h" |
52 | #include "xmalloc.h" | ||
53 | #include "atomicio.h" | 69 | #include "atomicio.h" |
54 | #include "monitor_fdpass.h" | 70 | #include "monitor_fdpass.h" |
55 | #include "getput.h" | 71 | #include "misc.h" |
56 | #include "servconf.h" | 72 | #include "servconf.h" |
57 | 73 | ||
58 | #include "auth.h" | ||
59 | #include "channels.h" | 74 | #include "channels.h" |
60 | #include "session.h" | 75 | #include "session.h" |
61 | 76 | #include "servconf.h" | |
62 | #ifdef GSSAPI | ||
63 | #include "ssh-gss.h" | ||
64 | #endif | ||
65 | 77 | ||
66 | /* Imports */ | 78 | /* Imports */ |
67 | extern int compat20; | 79 | extern int compat20; |
@@ -91,7 +103,7 @@ mm_request_send(int sock, enum monitor_reqtype type, Buffer *m) | |||
91 | 103 | ||
92 | debug3("%s entering: type %d", __func__, type); | 104 | debug3("%s entering: type %d", __func__, type); |
93 | 105 | ||
94 | PUT_32BIT(buf, mlen + 1); | 106 | put_u32(buf, mlen + 1); |
95 | buf[4] = (u_char) type; /* 1st byte of payload is mesg-type */ | 107 | buf[4] = (u_char) type; /* 1st byte of payload is mesg-type */ |
96 | if (atomicio(vwrite, sock, buf, sizeof(buf)) != sizeof(buf)) | 108 | if (atomicio(vwrite, sock, buf, sizeof(buf)) != sizeof(buf)) |
97 | fatal("%s: write: %s", __func__, strerror(errno)); | 109 | fatal("%s: write: %s", __func__, strerror(errno)); |
@@ -112,7 +124,7 @@ mm_request_receive(int sock, Buffer *m) | |||
112 | cleanup_exit(255); | 124 | cleanup_exit(255); |
113 | fatal("%s: read: %s", __func__, strerror(errno)); | 125 | fatal("%s: read: %s", __func__, strerror(errno)); |
114 | } | 126 | } |
115 | msg_len = GET_32BIT(buf); | 127 | msg_len = get_u32(buf); |
116 | if (msg_len > 256 * 1024) | 128 | if (msg_len > 256 * 1024) |
117 | fatal("%s: read: bad msg_len %d", __func__, msg_len); | 129 | fatal("%s: read: bad msg_len %d", __func__, msg_len); |
118 | buffer_clear(m); | 130 | buffer_clear(m); |
@@ -196,7 +208,8 @@ mm_getpwnamallow(const char *username) | |||
196 | { | 208 | { |
197 | Buffer m; | 209 | Buffer m; |
198 | struct passwd *pw; | 210 | struct passwd *pw; |
199 | u_int pwlen; | 211 | u_int len; |
212 | ServerOptions *newopts; | ||
200 | 213 | ||
201 | debug3("%s entering", __func__); | 214 | debug3("%s entering", __func__); |
202 | 215 | ||
@@ -212,8 +225,8 @@ mm_getpwnamallow(const char *username) | |||
212 | buffer_free(&m); | 225 | buffer_free(&m); |
213 | return (NULL); | 226 | return (NULL); |
214 | } | 227 | } |
215 | pw = buffer_get_string(&m, &pwlen); | 228 | pw = buffer_get_string(&m, &len); |
216 | if (pwlen != sizeof(struct passwd)) | 229 | if (len != sizeof(struct passwd)) |
217 | fatal("%s: struct passwd size mismatch", __func__); | 230 | fatal("%s: struct passwd size mismatch", __func__); |
218 | pw->pw_name = buffer_get_string(&m, NULL); | 231 | pw->pw_name = buffer_get_string(&m, NULL); |
219 | pw->pw_passwd = buffer_get_string(&m, NULL); | 232 | pw->pw_passwd = buffer_get_string(&m, NULL); |
@@ -223,6 +236,16 @@ mm_getpwnamallow(const char *username) | |||
223 | #endif | 236 | #endif |
224 | pw->pw_dir = buffer_get_string(&m, NULL); | 237 | pw->pw_dir = buffer_get_string(&m, NULL); |
225 | pw->pw_shell = buffer_get_string(&m, NULL); | 238 | pw->pw_shell = buffer_get_string(&m, NULL); |
239 | |||
240 | /* copy options block as a Match directive may have changed some */ | ||
241 | newopts = buffer_get_string(&m, &len); | ||
242 | if (len != sizeof(*newopts)) | ||
243 | fatal("%s: option block size mismatch", __func__); | ||
244 | if (newopts->banner != NULL) | ||
245 | newopts->banner = buffer_get_string(&m, NULL); | ||
246 | copy_set_server_options(&options, newopts, 1); | ||
247 | xfree(newopts); | ||
248 | |||
226 | buffer_free(&m); | 249 | buffer_free(&m); |
227 | 250 | ||
228 | return (pw); | 251 | return (pw); |
@@ -655,7 +678,7 @@ mm_send_keystate(struct monitor *monitor) | |||
655 | } | 678 | } |
656 | 679 | ||
657 | int | 680 | int |
658 | mm_pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen) | 681 | mm_pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, size_t namebuflen) |
659 | { | 682 | { |
660 | Buffer m; | 683 | Buffer m; |
661 | char *p, *msg; | 684 | char *p, *msg; |
@@ -794,8 +817,11 @@ mm_sshpam_query(void *ctx, char **name, char **info, | |||
794 | *name = buffer_get_string(&m, NULL); | 817 | *name = buffer_get_string(&m, NULL); |
795 | *info = buffer_get_string(&m, NULL); | 818 | *info = buffer_get_string(&m, NULL); |
796 | *num = buffer_get_int(&m); | 819 | *num = buffer_get_int(&m); |
797 | *prompts = xmalloc((*num + 1) * sizeof(char *)); | 820 | if (*num > PAM_MAX_NUM_MSG) |
798 | *echo_on = xmalloc((*num + 1) * sizeof(u_int)); | 821 | fatal("%s: recieved %u PAM messages, expected <= %u", |
822 | __func__, *num, PAM_MAX_NUM_MSG); | ||
823 | *prompts = xcalloc((*num + 1), sizeof(char *)); | ||
824 | *echo_on = xcalloc((*num + 1), sizeof(u_int)); | ||
799 | for (i = 0; i < *num; ++i) { | 825 | for (i = 0; i < *num; ++i) { |
800 | (*prompts)[i] = buffer_get_string(&m, NULL); | 826 | (*prompts)[i] = buffer_get_string(&m, NULL); |
801 | (*echo_on)[i] = buffer_get_int(&m); | 827 | (*echo_on)[i] = buffer_get_int(&m); |
@@ -878,8 +904,8 @@ mm_chall_setup(char **name, char **infotxt, u_int *numprompts, | |||
878 | *name = xstrdup(""); | 904 | *name = xstrdup(""); |
879 | *infotxt = xstrdup(""); | 905 | *infotxt = xstrdup(""); |
880 | *numprompts = 1; | 906 | *numprompts = 1; |
881 | *prompts = xmalloc(*numprompts * sizeof(char *)); | 907 | *prompts = xcalloc(*numprompts, sizeof(char *)); |
882 | *echo_on = xmalloc(*numprompts * sizeof(u_int)); | 908 | *echo_on = xcalloc(*numprompts, sizeof(u_int)); |
883 | (*echo_on)[0] = 0; | 909 | (*echo_on)[0] = 0; |
884 | } | 910 | } |
885 | 911 | ||
@@ -946,9 +972,8 @@ mm_skey_query(void *ctx, char **name, char **infotxt, | |||
946 | u_int *numprompts, char ***prompts, u_int **echo_on) | 972 | u_int *numprompts, char ***prompts, u_int **echo_on) |
947 | { | 973 | { |
948 | Buffer m; | 974 | Buffer m; |
949 | int len; | ||
950 | u_int success; | 975 | u_int success; |
951 | char *p, *challenge; | 976 | char *challenge; |
952 | 977 | ||
953 | debug3("%s: entering", __func__); | 978 | debug3("%s: entering", __func__); |
954 | 979 | ||
@@ -972,11 +997,7 @@ mm_skey_query(void *ctx, char **name, char **infotxt, | |||
972 | 997 | ||
973 | mm_chall_setup(name, infotxt, numprompts, prompts, echo_on); | 998 | mm_chall_setup(name, infotxt, numprompts, prompts, echo_on); |
974 | 999 | ||
975 | len = strlen(challenge) + strlen(SKEY_PROMPT) + 1; | 1000 | xasprintf(*prompts, "%s%s", challenge, SKEY_PROMPT); |
976 | p = xmalloc(len); | ||
977 | strlcpy(p, challenge, len); | ||
978 | strlcat(p, SKEY_PROMPT, len); | ||
979 | (*prompts)[0] = p; | ||
980 | xfree(challenge); | 1001 | xfree(challenge); |
981 | 1002 | ||
982 | return (0); | 1003 | return (0); |
diff --git a/monitor_wrap.h b/monitor_wrap.h index 8417b61f8..5920a90b2 100644 --- a/monitor_wrap.h +++ b/monitor_wrap.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: monitor_wrap.h,v 1.14 2004/06/21 17:36:31 avsm Exp $ */ | 1 | /* $OpenBSD: monitor_wrap.h,v 1.20 2006/08/03 03:34:42 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright 2002 Niels Provos <provos@citi.umich.edu> | 4 | * Copyright 2002 Niels Provos <provos@citi.umich.edu> |
@@ -27,8 +27,6 @@ | |||
27 | 27 | ||
28 | #ifndef _MM_WRAP_H_ | 28 | #ifndef _MM_WRAP_H_ |
29 | #define _MM_WRAP_H_ | 29 | #define _MM_WRAP_H_ |
30 | #include "key.h" | ||
31 | #include "buffer.h" | ||
32 | 30 | ||
33 | extern int use_privsep; | 31 | extern int use_privsep; |
34 | #define PRIVSEP(x) (use_privsep ? mm_##x : x) | 32 | #define PRIVSEP(x) (use_privsep ? mm_##x : x) |
@@ -37,7 +35,6 @@ enum mm_keytype {MM_NOKEY, MM_HOSTKEY, MM_USERKEY, MM_RSAHOSTKEY, MM_RSAUSERKEY} | |||
37 | 35 | ||
38 | struct monitor; | 36 | struct monitor; |
39 | struct mm_master; | 37 | struct mm_master; |
40 | struct passwd; | ||
41 | struct Authctxt; | 38 | struct Authctxt; |
42 | 39 | ||
43 | int mm_is_monitor(void); | 40 | int mm_is_monitor(void); |
@@ -58,7 +55,6 @@ int mm_auth_rsa_verify_response(Key *, BIGNUM *, u_char *); | |||
58 | BIGNUM *mm_auth_rsa_generate_challenge(Key *); | 55 | BIGNUM *mm_auth_rsa_generate_challenge(Key *); |
59 | 56 | ||
60 | #ifdef GSSAPI | 57 | #ifdef GSSAPI |
61 | #include "ssh-gss.h" | ||
62 | OM_uint32 mm_ssh_gssapi_server_ctx(Gssctxt **, gss_OID); | 58 | OM_uint32 mm_ssh_gssapi_server_ctx(Gssctxt **, gss_OID); |
63 | OM_uint32 mm_ssh_gssapi_accept_ctx(Gssctxt *, | 59 | OM_uint32 mm_ssh_gssapi_accept_ctx(Gssctxt *, |
64 | gss_buffer_desc *, gss_buffer_desc *, OM_uint32 *); | 60 | gss_buffer_desc *, gss_buffer_desc *, OM_uint32 *); |
@@ -84,7 +80,7 @@ void mm_audit_run_command(const char *); | |||
84 | 80 | ||
85 | struct Session; | 81 | struct Session; |
86 | void mm_terminate(void); | 82 | void mm_terminate(void); |
87 | int mm_pty_allocate(int *, int *, char *, int); | 83 | int mm_pty_allocate(int *, int *, char *, size_t); |
88 | void mm_session_pty_cleanup2(struct Session *); | 84 | void mm_session_pty_cleanup2(struct Session *); |
89 | 85 | ||
90 | /* SSHv1 interfaces */ | 86 | /* SSHv1 interfaces */ |
@@ -113,4 +109,4 @@ void *mm_zalloc(struct mm_master *, u_int, u_int); | |||
113 | void mm_zfree(struct mm_master *, void *); | 109 | void mm_zfree(struct mm_master *, void *); |
114 | void mm_init_compression(struct mm_master *); | 110 | void mm_init_compression(struct mm_master *); |
115 | 111 | ||
116 | #endif /* _MM_H_ */ | 112 | #endif /* _MM_WRAP_H_ */ |
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: msg.c,v 1.15 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2002 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2002 Markus Friedl. All rights reserved. |
3 | * | 4 | * |
@@ -21,14 +22,23 @@ | |||
21 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
22 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 24 | */ |
25 | |||
24 | #include "includes.h" | 26 | #include "includes.h" |
25 | RCSID("$OpenBSD: msg.c,v 1.8 2005/05/24 17:32:43 avsm Exp $"); | 27 | |
28 | #include <sys/types.h> | ||
29 | #include <sys/uio.h> | ||
30 | |||
31 | #include <errno.h> | ||
32 | #include <stdio.h> | ||
33 | #include <string.h> | ||
34 | #include <unistd.h> | ||
35 | #include <stdarg.h> | ||
26 | 36 | ||
27 | #include "buffer.h" | 37 | #include "buffer.h" |
28 | #include "getput.h" | ||
29 | #include "log.h" | 38 | #include "log.h" |
30 | #include "atomicio.h" | 39 | #include "atomicio.h" |
31 | #include "msg.h" | 40 | #include "msg.h" |
41 | #include "misc.h" | ||
32 | 42 | ||
33 | int | 43 | int |
34 | ssh_msg_send(int fd, u_char type, Buffer *m) | 44 | ssh_msg_send(int fd, u_char type, Buffer *m) |
@@ -38,7 +48,7 @@ ssh_msg_send(int fd, u_char type, Buffer *m) | |||
38 | 48 | ||
39 | debug3("ssh_msg_send: type %u", (unsigned int)type & 0xff); | 49 | debug3("ssh_msg_send: type %u", (unsigned int)type & 0xff); |
40 | 50 | ||
41 | PUT_32BIT(buf, mlen + 1); | 51 | put_u32(buf, mlen + 1); |
42 | buf[4] = type; /* 1st byte of payload is mesg-type */ | 52 | buf[4] = type; /* 1st byte of payload is mesg-type */ |
43 | if (atomicio(vwrite, fd, buf, sizeof(buf)) != sizeof(buf)) { | 53 | if (atomicio(vwrite, fd, buf, sizeof(buf)) != sizeof(buf)) { |
44 | error("ssh_msg_send: write"); | 54 | error("ssh_msg_send: write"); |
@@ -64,7 +74,7 @@ ssh_msg_recv(int fd, Buffer *m) | |||
64 | error("ssh_msg_recv: read: header"); | 74 | error("ssh_msg_recv: read: header"); |
65 | return (-1); | 75 | return (-1); |
66 | } | 76 | } |
67 | msg_len = GET_32BIT(buf); | 77 | msg_len = get_u32(buf); |
68 | if (msg_len > 256 * 1024) { | 78 | if (msg_len > 256 * 1024) { |
69 | error("ssh_msg_recv: read: bad msg_len %u", msg_len); | 79 | error("ssh_msg_recv: read: bad msg_len %u", msg_len); |
70 | return (-1); | 80 | return (-1); |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: msg.h,v 1.3 2003/11/17 09:45:39 djm Exp $ */ | 1 | /* $OpenBSD: msg.h,v 1.4 2006/03/25 22:22:43 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2002 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2002 Markus Friedl. All rights reserved. |
4 | * | 4 | * |
diff --git a/myproposal.h b/myproposal.h index d8cba1caf..e246e0dd9 100644 --- a/myproposal.h +++ b/myproposal.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: myproposal.h,v 1.18 2005/07/25 11:59:39 markus Exp $ */ | 1 | /* $OpenBSD: myproposal.h,v 1.21 2006/03/25 22:22:43 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
@@ -23,9 +23,23 @@ | |||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 | */ | 25 | */ |
26 | #define KEX_DEFAULT_KEX "diffie-hellman-group-exchange-sha1," \ | 26 | |
27 | #include <openssl/opensslv.h> | ||
28 | |||
29 | /* Old OpenSSL doesn't support what we need for DHGEX-sha256 */ | ||
30 | #if OPENSSL_VERSION_NUMBER < 0x00907000L | ||
31 | # define KEX_DEFAULT_KEX \ | ||
32 | "diffie-hellman-group-exchange-sha1," \ | ||
27 | "diffie-hellman-group14-sha1," \ | 33 | "diffie-hellman-group14-sha1," \ |
28 | "diffie-hellman-group1-sha1" | 34 | "diffie-hellman-group1-sha1" |
35 | #else | ||
36 | # define KEX_DEFAULT_KEX \ | ||
37 | "diffie-hellman-group-exchange-sha256," \ | ||
38 | "diffie-hellman-group-exchange-sha1," \ | ||
39 | "diffie-hellman-group14-sha1," \ | ||
40 | "diffie-hellman-group1-sha1" | ||
41 | #endif | ||
42 | |||
29 | #define KEX_DEFAULT_PK_ALG "ssh-rsa,ssh-dss" | 43 | #define KEX_DEFAULT_PK_ALG "ssh-rsa,ssh-dss" |
30 | #define KEX_DEFAULT_ENCRYPT \ | 44 | #define KEX_DEFAULT_ENCRYPT \ |
31 | "aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc," \ | 45 | "aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc," \ |
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: nchan.c,v 1.57 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 1999, 2000, 2001, 2002 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 1999, 2000, 2001, 2002 Markus Friedl. All rights reserved. |
3 | * | 4 | * |
@@ -23,7 +24,13 @@ | |||
23 | */ | 24 | */ |
24 | 25 | ||
25 | #include "includes.h" | 26 | #include "includes.h" |
26 | RCSID("$OpenBSD: nchan.c,v 1.51 2004/07/11 17:48:47 deraadt Exp $"); | 27 | |
28 | #include <sys/types.h> | ||
29 | #include <sys/socket.h> | ||
30 | |||
31 | #include <errno.h> | ||
32 | #include <string.h> | ||
33 | #include <stdarg.h> | ||
27 | 34 | ||
28 | #include "ssh1.h" | 35 | #include "ssh1.h" |
29 | #include "ssh2.h" | 36 | #include "ssh2.h" |
diff --git a/openbsd-compat/Makefile.in b/openbsd-compat/Makefile.in index 3a8703bc1..9f06605d7 100644 --- a/openbsd-compat/Makefile.in +++ b/openbsd-compat/Makefile.in | |||
@@ -1,4 +1,4 @@ | |||
1 | # $Id: Makefile.in,v 1.37 2005/12/31 05:33:37 djm Exp $ | 1 | # $Id: Makefile.in,v 1.40 2006/08/30 17:24:41 djm Exp $ |
2 | 2 | ||
3 | sysconfdir=@sysconfdir@ | 3 | sysconfdir=@sysconfdir@ |
4 | piddir=@piddir@ | 4 | piddir=@piddir@ |
@@ -16,11 +16,11 @@ RANLIB=@RANLIB@ | |||
16 | INSTALL=@INSTALL@ | 16 | INSTALL=@INSTALL@ |
17 | LDFLAGS=-L. @LDFLAGS@ | 17 | LDFLAGS=-L. @LDFLAGS@ |
18 | 18 | ||
19 | OPENBSD=base64.o basename.o bindresvport.o daemon.o dirname.o getcwd.o getgrouplist.o getopt.o getrrsetbyname.o glob.o inet_aton.o inet_ntoa.o inet_ntop.o mktemp.o readpassphrase.o realpath.o rresvport.o setenv.o setproctitle.o sigact.o strlcat.o strlcpy.o strmode.o strsep.o strtonum.o strtoll.o strtoul.o vis.o | 19 | OPENBSD=base64.o basename.o bindresvport.o daemon.o dirname.o getcwd.o getgrouplist.o getopt.o getrrsetbyname.o glob.o inet_aton.o inet_ntoa.o inet_ntop.o mktemp.o readpassphrase.o realpath.o rresvport.o setenv.o setproctitle.o sha2.o sigact.o strlcat.o strlcpy.o strmode.o strsep.o strtonum.o strtoll.o strtoul.o vis.o |
20 | 20 | ||
21 | COMPAT=bsd-arc4random.o bsd-asprintf.o bsd-closefrom.o bsd-cray.o bsd-cygwin_util.o bsd-getpeereid.o bsd-misc.o bsd-nextstep.o bsd-openpty.o bsd-snprintf.o bsd-waitpid.o fake-rfc2553.o openssl-compat.o xmmap.o xcrypt.o | 21 | COMPAT=bsd-arc4random.o bsd-asprintf.o bsd-closefrom.o bsd-cray.o bsd-cygwin_util.o bsd-getpeereid.o bsd-misc.o bsd-nextstep.o bsd-openpty.o bsd-snprintf.o bsd-waitpid.o fake-rfc2553.o openssl-compat.o xmmap.o xcrypt.o |
22 | 22 | ||
23 | PORTS=port-irix.o port-aix.o port-uw.o port-tun.o | 23 | PORTS=port-aix.o port-irix.o port-linux.o port-solaris.o port-tun.o port-uw.o |
24 | 24 | ||
25 | .c.o: | 25 | .c.o: |
26 | $(CC) $(CFLAGS) $(CPPFLAGS) -c $< | 26 | $(CC) $(CFLAGS) $(CPPFLAGS) -c $< |
diff --git a/openbsd-compat/basename.c b/openbsd-compat/basename.c index ad040e139..ffa5c8984 100644 --- a/openbsd-compat/basename.c +++ b/openbsd-compat/basename.c | |||
@@ -20,6 +20,8 @@ | |||
20 | 20 | ||
21 | #include "includes.h" | 21 | #include "includes.h" |
22 | #ifndef HAVE_BASENAME | 22 | #ifndef HAVE_BASENAME |
23 | #include <errno.h> | ||
24 | #include <string.h> | ||
23 | 25 | ||
24 | char * | 26 | char * |
25 | basename(const char *path) | 27 | basename(const char *path) |
diff --git a/openbsd-compat/bindresvport.c b/openbsd-compat/bindresvport.c index 7f48fd03a..65afed1e3 100644 --- a/openbsd-compat/bindresvport.c +++ b/openbsd-compat/bindresvport.c | |||
@@ -33,8 +33,14 @@ | |||
33 | #include "includes.h" | 33 | #include "includes.h" |
34 | 34 | ||
35 | #ifndef HAVE_BINDRESVPORT_SA | 35 | #ifndef HAVE_BINDRESVPORT_SA |
36 | #include <sys/types.h> | ||
37 | #include <sys/socket.h> | ||
36 | 38 | ||
37 | #include "includes.h" | 39 | #include <netinet/in.h> |
40 | #include <arpa/inet.h> | ||
41 | |||
42 | #include <errno.h> | ||
43 | #include <string.h> | ||
38 | 44 | ||
39 | #define STARTPORT 600 | 45 | #define STARTPORT 600 |
40 | #define ENDPORT (IPPORT_RESERVED - 1) | 46 | #define ENDPORT (IPPORT_RESERVED - 1) |
diff --git a/openbsd-compat/bsd-arc4random.c b/openbsd-compat/bsd-arc4random.c index 1eeb6953b..d45fb182a 100644 --- a/openbsd-compat/bsd-arc4random.c +++ b/openbsd-compat/bsd-arc4random.c | |||
@@ -15,9 +15,13 @@ | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "includes.h" | 17 | #include "includes.h" |
18 | #include "log.h" | ||
19 | 18 | ||
20 | RCSID("$Id: bsd-arc4random.c,v 1.10 2005/02/16 02:01:28 djm Exp $"); | 19 | #include <sys/types.h> |
20 | |||
21 | #include <string.h> | ||
22 | #include <stdarg.h> | ||
23 | |||
24 | #include "log.h" | ||
21 | 25 | ||
22 | #ifndef HAVE_ARC4RANDOM | 26 | #ifndef HAVE_ARC4RANDOM |
23 | 27 | ||
diff --git a/openbsd-compat/bsd-asprintf.c b/openbsd-compat/bsd-asprintf.c index 5ca01f80f..00fa0dfd8 100644 --- a/openbsd-compat/bsd-asprintf.c +++ b/openbsd-compat/bsd-asprintf.c | |||
@@ -21,6 +21,10 @@ | |||
21 | 21 | ||
22 | #ifndef HAVE_VASPRINTF | 22 | #ifndef HAVE_VASPRINTF |
23 | 23 | ||
24 | #include <errno.h> | ||
25 | #include <stdarg.h> | ||
26 | #include <stdlib.h> | ||
27 | |||
24 | #ifndef VA_COPY | 28 | #ifndef VA_COPY |
25 | # ifdef HAVE_VA_COPY | 29 | # ifdef HAVE_VA_COPY |
26 | # define VA_COPY(dest, src) va_copy(dest, src) | 30 | # define VA_COPY(dest, src) va_copy(dest, src) |
@@ -35,7 +39,8 @@ | |||
35 | 39 | ||
36 | #define INIT_SZ 128 | 40 | #define INIT_SZ 128 |
37 | 41 | ||
38 | int vasprintf(char **str, const char *fmt, va_list ap) | 42 | int |
43 | vasprintf(char **str, const char *fmt, va_list ap) | ||
39 | { | 44 | { |
40 | int ret = -1; | 45 | int ret = -1; |
41 | va_list ap2; | 46 | va_list ap2; |
@@ -49,7 +54,7 @@ int vasprintf(char **str, const char *fmt, va_list ap) | |||
49 | ret = vsnprintf(string, INIT_SZ, fmt, ap2); | 54 | ret = vsnprintf(string, INIT_SZ, fmt, ap2); |
50 | if (ret >= 0 && ret < INIT_SZ) { /* succeeded with initial alloc */ | 55 | if (ret >= 0 && ret < INIT_SZ) { /* succeeded with initial alloc */ |
51 | *str = string; | 56 | *str = string; |
52 | } else if (ret == INT_MAX) { /* shouldn't happen */ | 57 | } else if (ret == INT_MAX || ret < 0) { /* Bad length */ |
53 | goto fail; | 58 | goto fail; |
54 | } else { /* bigger than initial, realloc allowing for nul */ | 59 | } else { /* bigger than initial, realloc allowing for nul */ |
55 | len = (size_t)ret + 1; | 60 | len = (size_t)ret + 1; |
diff --git a/openbsd-compat/bsd-closefrom.c b/openbsd-compat/bsd-closefrom.c index 5b7b94ae4..9380b33a7 100644 --- a/openbsd-compat/bsd-closefrom.c +++ b/openbsd-compat/bsd-closefrom.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2004 Todd C. Miller <Todd.Miller@courtesan.com> | 2 | * Copyright (c) 2004-2005 Todd C. Miller <Todd.Miller@courtesan.com> |
3 | * | 3 | * |
4 | * Permission to use, copy, modify, and distribute this software for any | 4 | * Permission to use, copy, modify, and distribute this software for any |
5 | * purpose with or without fee is hereby granted, provided that the above | 5 | * purpose with or without fee is hereby granted, provided that the above |
@@ -22,9 +22,14 @@ | |||
22 | #include <sys/param.h> | 22 | #include <sys/param.h> |
23 | #include <unistd.h> | 23 | #include <unistd.h> |
24 | #include <stdio.h> | 24 | #include <stdio.h> |
25 | #ifdef HAVE_FCNTL_H | ||
26 | # include <fcntl.h> | ||
27 | #endif | ||
25 | #include <limits.h> | 28 | #include <limits.h> |
26 | #include <stdlib.h> | 29 | #include <stdlib.h> |
27 | #include <stddef.h> | 30 | #include <stddef.h> |
31 | #include <string.h> | ||
32 | #include <unistd.h> | ||
28 | #ifdef HAVE_DIRENT_H | 33 | #ifdef HAVE_DIRENT_H |
29 | # include <dirent.h> | 34 | # include <dirent.h> |
30 | # define NAMLEN(dirent) strlen((dirent)->d_name) | 35 | # define NAMLEN(dirent) strlen((dirent)->d_name) |
@@ -46,15 +51,20 @@ | |||
46 | # define OPEN_MAX 256 | 51 | # define OPEN_MAX 256 |
47 | #endif | 52 | #endif |
48 | 53 | ||
49 | RCSID("$Id: bsd-closefrom.c,v 1.2 2005/11/10 08:29:13 dtucker Exp $"); | 54 | #if 0 |
50 | 55 | __unused static const char rcsid[] = "$Sudo: closefrom.c,v 1.11 2006/08/17 15:26:54 millert Exp $"; | |
51 | #ifndef lint | ||
52 | static const char sudorcsid[] = "$Sudo: closefrom.c,v 1.6 2004/06/01 20:51:56 millert Exp $"; | ||
53 | #endif /* lint */ | 56 | #endif /* lint */ |
54 | 57 | ||
55 | /* | 58 | /* |
56 | * Close all file descriptors greater than or equal to lowfd. | 59 | * Close all file descriptors greater than or equal to lowfd. |
57 | */ | 60 | */ |
61 | #ifdef HAVE_FCNTL_CLOSEM | ||
62 | void | ||
63 | closefrom(int lowfd) | ||
64 | { | ||
65 | (void) fcntl(lowfd, F_CLOSEM, 0); | ||
66 | } | ||
67 | #else | ||
58 | void | 68 | void |
59 | closefrom(int lowfd) | 69 | closefrom(int lowfd) |
60 | { | 70 | { |
@@ -67,7 +77,7 @@ closefrom(int lowfd) | |||
67 | 77 | ||
68 | /* Check for a /proc/$$/fd directory. */ | 78 | /* Check for a /proc/$$/fd directory. */ |
69 | len = snprintf(fdpath, sizeof(fdpath), "/proc/%ld/fd", (long)getpid()); | 79 | len = snprintf(fdpath, sizeof(fdpath), "/proc/%ld/fd", (long)getpid()); |
70 | if (len >= 0 && (u_int)len <= sizeof(fdpath) && (dirp = opendir(fdpath))) { | 80 | if (len > 0 && (size_t)len <= sizeof(fdpath) && (dirp = opendir(fdpath))) { |
71 | while ((dent = readdir(dirp)) != NULL) { | 81 | while ((dent = readdir(dirp)) != NULL) { |
72 | fd = strtol(dent->d_name, &endp, 10); | 82 | fd = strtol(dent->d_name, &endp, 10); |
73 | if (dent->d_name != endp && *endp == '\0' && | 83 | if (dent->d_name != endp && *endp == '\0' && |
@@ -95,6 +105,5 @@ closefrom(int lowfd) | |||
95 | (void) close((int) fd); | 105 | (void) close((int) fd); |
96 | } | 106 | } |
97 | } | 107 | } |
98 | 108 | #endif /* !HAVE_FCNTL_CLOSEM */ | |
99 | #endif /* HAVE_CLOSEFROM */ | 109 | #endif /* HAVE_CLOSEFROM */ |
100 | |||
diff --git a/openbsd-compat/bsd-cray.c b/openbsd-compat/bsd-cray.c index d1f1c059c..1532c991c 100644 --- a/openbsd-compat/bsd-cray.c +++ b/openbsd-compat/bsd-cray.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: bsd-cray.c,v 1.14 2005/02/02 06:10:11 dtucker Exp $ | 2 | * $Id: bsd-cray.c,v 1.16 2006/09/01 05:38:41 djm Exp $ |
3 | * | 3 | * |
4 | * bsd-cray.c | 4 | * bsd-cray.c |
5 | * | 5 | * |
@@ -52,7 +52,10 @@ | |||
52 | #include <sys/secstat.h> | 52 | #include <sys/secstat.h> |
53 | #include <sys/stat.h> | 53 | #include <sys/stat.h> |
54 | #include <sys/session.h> | 54 | #include <sys/session.h> |
55 | #include <stdarg.h> | ||
55 | #include <stdlib.h> | 56 | #include <stdlib.h> |
57 | #include <string.h> | ||
58 | #include <unistd.h> | ||
56 | #include <pwd.h> | 59 | #include <pwd.h> |
57 | #include <fcntl.h> | 60 | #include <fcntl.h> |
58 | #include <errno.h> | 61 | #include <errno.h> |
diff --git a/openbsd-compat/bsd-cygwin_util.c b/openbsd-compat/bsd-cygwin_util.c index b5e3cc52b..dbf8176b6 100644 --- a/openbsd-compat/bsd-cygwin_util.c +++ b/openbsd-compat/bsd-cygwin_util.c | |||
@@ -29,15 +29,25 @@ | |||
29 | 29 | ||
30 | #include "includes.h" | 30 | #include "includes.h" |
31 | 31 | ||
32 | RCSID("$Id: bsd-cygwin_util.c,v 1.14 2005/05/25 09:42:11 dtucker Exp $"); | ||
33 | |||
34 | #ifdef HAVE_CYGWIN | 32 | #ifdef HAVE_CYGWIN |
35 | 33 | ||
36 | #include <fcntl.h> | 34 | #if defined(open) && open == binary_open |
37 | #include <stdlib.h> | 35 | # undef open |
36 | #endif | ||
37 | #if defined(pipe) && open == binary_pipe | ||
38 | # undef pipe | ||
39 | #endif | ||
40 | |||
41 | #include <sys/types.h> | ||
42 | #include <sys/stat.h> | ||
38 | #include <sys/utsname.h> | 43 | #include <sys/utsname.h> |
39 | #include <sys/vfs.h> | 44 | #include <sys/vfs.h> |
45 | |||
46 | #include <fcntl.h> | ||
47 | #include <stdlib.h> | ||
48 | #include <unistd.h> | ||
40 | #include <windows.h> | 49 | #include <windows.h> |
50 | |||
41 | #include "xmalloc.h" | 51 | #include "xmalloc.h" |
42 | #define is_winnt (GetVersion() < 0x80000000) | 52 | #define is_winnt (GetVersion() < 0x80000000) |
43 | 53 | ||
@@ -45,13 +55,6 @@ RCSID("$Id: bsd-cygwin_util.c,v 1.14 2005/05/25 09:42:11 dtucker Exp $"); | |||
45 | #define ntsec_off(c) ((c) && strstr((c),"nontsec")) | 55 | #define ntsec_off(c) ((c) && strstr((c),"nontsec")) |
46 | #define ntea_on(c) ((c) && strstr((c),"ntea") && !strstr((c),"nontea")) | 56 | #define ntea_on(c) ((c) && strstr((c),"ntea") && !strstr((c),"nontea")) |
47 | 57 | ||
48 | #if defined(open) && open == binary_open | ||
49 | # undef open | ||
50 | #endif | ||
51 | #if defined(pipe) && open == binary_pipe | ||
52 | # undef pipe | ||
53 | #endif | ||
54 | |||
55 | int | 58 | int |
56 | binary_open(const char *filename, int flags, ...) | 59 | binary_open(const char *filename, int flags, ...) |
57 | { | 60 | { |
@@ -268,9 +271,9 @@ char ** | |||
268 | fetch_windows_environment(void) | 271 | fetch_windows_environment(void) |
269 | { | 272 | { |
270 | char **e, **p; | 273 | char **e, **p; |
271 | int i, idx = 0; | 274 | unsigned int i, idx = 0; |
272 | 275 | ||
273 | p = xmalloc((WENV_SIZ + 1) * sizeof(char *)); | 276 | p = xcalloc(WENV_SIZ + 1, sizeof(char *)); |
274 | for (e = environ; *e != NULL; ++e) { | 277 | for (e = environ; *e != NULL; ++e) { |
275 | for (i = 0; i < WENV_SIZ; ++i) { | 278 | for (i = 0; i < WENV_SIZ; ++i) { |
276 | if (!strncmp(*e, wenv_arr[i].name, wenv_arr[i].namelen)) | 279 | if (!strncmp(*e, wenv_arr[i].name, wenv_arr[i].namelen)) |
diff --git a/openbsd-compat/bsd-getpeereid.c b/openbsd-compat/bsd-getpeereid.c index fe2edad71..bdae8b637 100644 --- a/openbsd-compat/bsd-getpeereid.c +++ b/openbsd-compat/bsd-getpeereid.c | |||
@@ -16,10 +16,13 @@ | |||
16 | 16 | ||
17 | #include "includes.h" | 17 | #include "includes.h" |
18 | 18 | ||
19 | RCSID("$Id: bsd-getpeereid.c,v 1.3 2004/02/17 05:49:55 djm Exp $"); | ||
20 | |||
21 | #if !defined(HAVE_GETPEEREID) | 19 | #if !defined(HAVE_GETPEEREID) |
22 | 20 | ||
21 | #include <sys/types.h> | ||
22 | #include <sys/socket.h> | ||
23 | |||
24 | #include <unistd.h> | ||
25 | |||
23 | #if defined(SO_PEERCRED) | 26 | #if defined(SO_PEERCRED) |
24 | int | 27 | int |
25 | getpeereid(int s, uid_t *euid, gid_t *gid) | 28 | getpeereid(int s, uid_t *euid, gid_t *gid) |
diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c index d32b054d7..17d731bd2 100644 --- a/openbsd-compat/bsd-misc.c +++ b/openbsd-compat/bsd-misc.c | |||
@@ -16,9 +16,19 @@ | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include "includes.h" | 18 | #include "includes.h" |
19 | #include "xmalloc.h" | ||
20 | 19 | ||
21 | RCSID("$Id: bsd-misc.c,v 1.28 2005/11/01 22:07:31 dtucker Exp $"); | 20 | #ifdef HAVE_SYS_SELECT_H |
21 | # include <sys/select.h> | ||
22 | #endif | ||
23 | #ifdef HAVE_SYS_TIME_H | ||
24 | # include <sys/time.h> | ||
25 | #endif | ||
26 | |||
27 | #include <string.h> | ||
28 | #include <signal.h> | ||
29 | #include <stdlib.h> | ||
30 | |||
31 | #include "xmalloc.h" | ||
22 | 32 | ||
23 | #ifndef HAVE___PROGNAME | 33 | #ifndef HAVE___PROGNAME |
24 | char *__progname; | 34 | char *__progname; |
diff --git a/openbsd-compat/bsd-nextstep.c b/openbsd-compat/bsd-nextstep.c index bd35a3afc..8195af88a 100644 --- a/openbsd-compat/bsd-nextstep.c +++ b/openbsd-compat/bsd-nextstep.c | |||
@@ -24,8 +24,6 @@ | |||
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | 26 | ||
27 | RCSID("$Id: bsd-nextstep.c,v 1.6 2003/06/01 03:23:57 mouring Exp $"); | ||
28 | |||
29 | #ifdef HAVE_NEXT | 27 | #ifdef HAVE_NEXT |
30 | #include <errno.h> | 28 | #include <errno.h> |
31 | #include <sys/wait.h> | 29 | #include <sys/wait.h> |
diff --git a/openbsd-compat/bsd-openpty.c b/openbsd-compat/bsd-openpty.c index 8eb62b7a8..9777eb556 100644 --- a/openbsd-compat/bsd-openpty.c +++ b/openbsd-compat/bsd-openpty.c | |||
@@ -35,6 +35,21 @@ | |||
35 | #include "includes.h" | 35 | #include "includes.h" |
36 | #if !defined(HAVE_OPENPTY) | 36 | #if !defined(HAVE_OPENPTY) |
37 | 37 | ||
38 | #include <sys/types.h> | ||
39 | |||
40 | #include <stdlib.h> | ||
41 | |||
42 | #ifdef HAVE_SYS_STAT_H | ||
43 | # include <sys/stat.h> | ||
44 | #endif | ||
45 | #ifdef HAVE_SYS_IOCTL_H | ||
46 | # include <sys/ioctl.h> | ||
47 | #endif | ||
48 | |||
49 | #ifdef HAVE_FCNTL_H | ||
50 | # include <fcntl.h> | ||
51 | #endif | ||
52 | |||
38 | #ifdef HAVE_UTIL_H | 53 | #ifdef HAVE_UTIL_H |
39 | # include <util.h> | 54 | # include <util.h> |
40 | #endif /* HAVE_UTIL_H */ | 55 | #endif /* HAVE_UTIL_H */ |
@@ -46,6 +61,10 @@ | |||
46 | # include <sys/stropts.h> | 61 | # include <sys/stropts.h> |
47 | #endif | 62 | #endif |
48 | 63 | ||
64 | #include <signal.h> | ||
65 | #include <string.h> | ||
66 | #include <unistd.h> | ||
67 | |||
49 | #ifndef O_NOCTTY | 68 | #ifndef O_NOCTTY |
50 | #define O_NOCTTY 0 | 69 | #define O_NOCTTY 0 |
51 | #endif | 70 | #endif |
diff --git a/openbsd-compat/bsd-snprintf.c b/openbsd-compat/bsd-snprintf.c index e4ba154fd..41d2be238 100644 --- a/openbsd-compat/bsd-snprintf.c +++ b/openbsd-compat/bsd-snprintf.c | |||
@@ -85,12 +85,15 @@ | |||
85 | * | 85 | * |
86 | * Move #endif to make sure VA_COPY, LDOUBLE, etc are defined even | 86 | * Move #endif to make sure VA_COPY, LDOUBLE, etc are defined even |
87 | * if the C library has some snprintf functions already. | 87 | * if the C library has some snprintf functions already. |
88 | * | ||
89 | * Damien Miller (djm@mindrot.org) Jan 2007 | ||
90 | * Fix integer overflows in return value. | ||
91 | * Make formatting quite a bit faster by inlining dopr_outch() | ||
92 | * | ||
88 | **************************************************************/ | 93 | **************************************************************/ |
89 | 94 | ||
90 | #include "includes.h" | 95 | #include "includes.h" |
91 | 96 | ||
92 | RCSID("$Id: bsd-snprintf.c,v 1.11 2005/12/17 11:32:04 dtucker Exp $"); | ||
93 | |||
94 | #if defined(BROKEN_SNPRINTF) /* For those with broken snprintf() */ | 97 | #if defined(BROKEN_SNPRINTF) /* For those with broken snprintf() */ |
95 | # undef HAVE_SNPRINTF | 98 | # undef HAVE_SNPRINTF |
96 | # undef HAVE_VSNPRINTF | 99 | # undef HAVE_VSNPRINTF |
@@ -110,6 +113,13 @@ RCSID("$Id: bsd-snprintf.c,v 1.11 2005/12/17 11:32:04 dtucker Exp $"); | |||
110 | 113 | ||
111 | #if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) | 114 | #if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) |
112 | 115 | ||
116 | #include <ctype.h> | ||
117 | #include <stdarg.h> | ||
118 | #include <stdlib.h> | ||
119 | #include <string.h> | ||
120 | #include <limits.h> | ||
121 | #include <errno.h> | ||
122 | |||
113 | #ifdef HAVE_LONG_DOUBLE | 123 | #ifdef HAVE_LONG_DOUBLE |
114 | # define LDOUBLE long double | 124 | # define LDOUBLE long double |
115 | #else | 125 | #else |
@@ -156,17 +166,28 @@ RCSID("$Id: bsd-snprintf.c,v 1.11 2005/12/17 11:32:04 dtucker Exp $"); | |||
156 | # define MAX(p,q) (((p) >= (q)) ? (p) : (q)) | 166 | # define MAX(p,q) (((p) >= (q)) ? (p) : (q)) |
157 | #endif | 167 | #endif |
158 | 168 | ||
159 | static size_t dopr(char *buffer, size_t maxlen, const char *format, | 169 | #define DOPR_OUTCH(buf, pos, buflen, thechar) \ |
160 | va_list args_in); | 170 | do { \ |
161 | static void fmtstr(char *buffer, size_t *currlen, size_t maxlen, | 171 | if (pos + 1 >= INT_MAX) { \ |
162 | char *value, int flags, int min, int max); | 172 | errno = ERANGE; \ |
163 | static void fmtint(char *buffer, size_t *currlen, size_t maxlen, | 173 | return -1; \ |
164 | long value, int base, int min, int max, int flags); | 174 | } \ |
165 | static void fmtfp(char *buffer, size_t *currlen, size_t maxlen, | 175 | if (pos < buflen) \ |
166 | LDOUBLE fvalue, int min, int max, int flags); | 176 | buf[pos] = thechar; \ |
167 | static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c); | 177 | (pos)++; \ |
168 | 178 | } while (0) | |
169 | static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args_in) | 179 | |
180 | static int dopr(char *buffer, size_t maxlen, const char *format, | ||
181 | va_list args_in); | ||
182 | static int fmtstr(char *buffer, size_t *currlen, size_t maxlen, | ||
183 | char *value, int flags, int min, int max); | ||
184 | static int fmtint(char *buffer, size_t *currlen, size_t maxlen, | ||
185 | LLONG value, int base, int min, int max, int flags); | ||
186 | static int fmtfp(char *buffer, size_t *currlen, size_t maxlen, | ||
187 | LDOUBLE fvalue, int min, int max, int flags); | ||
188 | |||
189 | static int | ||
190 | dopr(char *buffer, size_t maxlen, const char *format, va_list args_in) | ||
170 | { | 191 | { |
171 | char ch; | 192 | char ch; |
172 | LLONG value; | 193 | LLONG value; |
@@ -195,8 +216,8 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args | |||
195 | case DP_S_DEFAULT: | 216 | case DP_S_DEFAULT: |
196 | if (ch == '%') | 217 | if (ch == '%') |
197 | state = DP_S_FLAGS; | 218 | state = DP_S_FLAGS; |
198 | else | 219 | else |
199 | dopr_outch (buffer, &currlen, maxlen, ch); | 220 | DOPR_OUTCH(buffer, currlen, maxlen, ch); |
200 | ch = *format++; | 221 | ch = *format++; |
201 | break; | 222 | break; |
202 | case DP_S_FLAGS: | 223 | case DP_S_FLAGS: |
@@ -295,7 +316,9 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args | |||
295 | value = va_arg (args, LLONG); | 316 | value = va_arg (args, LLONG); |
296 | else | 317 | else |
297 | value = va_arg (args, int); | 318 | value = va_arg (args, int); |
298 | fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags); | 319 | if (fmtint(buffer, &currlen, maxlen, |
320 | value, 10, min, max, flags) == -1) | ||
321 | return -1; | ||
299 | break; | 322 | break; |
300 | case 'o': | 323 | case 'o': |
301 | flags |= DP_F_UNSIGNED; | 324 | flags |= DP_F_UNSIGNED; |
@@ -307,7 +330,9 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args | |||
307 | value = (long)va_arg (args, unsigned LLONG); | 330 | value = (long)va_arg (args, unsigned LLONG); |
308 | else | 331 | else |
309 | value = (long)va_arg (args, unsigned int); | 332 | value = (long)va_arg (args, unsigned int); |
310 | fmtint (buffer, &currlen, maxlen, value, 8, min, max, flags); | 333 | if (fmtint(buffer, &currlen, maxlen, value, |
334 | 8, min, max, flags) == -1) | ||
335 | return -1; | ||
311 | break; | 336 | break; |
312 | case 'u': | 337 | case 'u': |
313 | flags |= DP_F_UNSIGNED; | 338 | flags |= DP_F_UNSIGNED; |
@@ -319,7 +344,9 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args | |||
319 | value = (LLONG)va_arg (args, unsigned LLONG); | 344 | value = (LLONG)va_arg (args, unsigned LLONG); |
320 | else | 345 | else |
321 | value = (long)va_arg (args, unsigned int); | 346 | value = (long)va_arg (args, unsigned int); |
322 | fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags); | 347 | if (fmtint(buffer, &currlen, maxlen, value, |
348 | 10, min, max, flags) == -1) | ||
349 | return -1; | ||
323 | break; | 350 | break; |
324 | case 'X': | 351 | case 'X': |
325 | flags |= DP_F_UP; | 352 | flags |= DP_F_UP; |
@@ -333,15 +360,18 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args | |||
333 | value = (LLONG)va_arg (args, unsigned LLONG); | 360 | value = (LLONG)va_arg (args, unsigned LLONG); |
334 | else | 361 | else |
335 | value = (long)va_arg (args, unsigned int); | 362 | value = (long)va_arg (args, unsigned int); |
336 | fmtint (buffer, &currlen, maxlen, value, 16, min, max, flags); | 363 | if (fmtint(buffer, &currlen, maxlen, value, |
364 | 16, min, max, flags) == -1) | ||
365 | return -1; | ||
337 | break; | 366 | break; |
338 | case 'f': | 367 | case 'f': |
339 | if (cflags == DP_C_LDOUBLE) | 368 | if (cflags == DP_C_LDOUBLE) |
340 | fvalue = va_arg (args, LDOUBLE); | 369 | fvalue = va_arg (args, LDOUBLE); |
341 | else | 370 | else |
342 | fvalue = va_arg (args, double); | 371 | fvalue = va_arg (args, double); |
343 | /* um, floating point? */ | 372 | if (fmtfp(buffer, &currlen, maxlen, fvalue, |
344 | fmtfp (buffer, &currlen, maxlen, fvalue, min, max, flags); | 373 | min, max, flags) == -1) |
374 | return -1; | ||
345 | break; | 375 | break; |
346 | case 'E': | 376 | case 'E': |
347 | flags |= DP_F_UP; | 377 | flags |= DP_F_UP; |
@@ -350,7 +380,9 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args | |||
350 | fvalue = va_arg (args, LDOUBLE); | 380 | fvalue = va_arg (args, LDOUBLE); |
351 | else | 381 | else |
352 | fvalue = va_arg (args, double); | 382 | fvalue = va_arg (args, double); |
353 | fmtfp (buffer, &currlen, maxlen, fvalue, min, max, flags); | 383 | if (fmtfp(buffer, &currlen, maxlen, fvalue, |
384 | min, max, flags) == -1) | ||
385 | return -1; | ||
354 | break; | 386 | break; |
355 | case 'G': | 387 | case 'G': |
356 | flags |= DP_F_UP; | 388 | flags |= DP_F_UP; |
@@ -359,10 +391,13 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args | |||
359 | fvalue = va_arg (args, LDOUBLE); | 391 | fvalue = va_arg (args, LDOUBLE); |
360 | else | 392 | else |
361 | fvalue = va_arg (args, double); | 393 | fvalue = va_arg (args, double); |
362 | fmtfp (buffer, &currlen, maxlen, fvalue, min, max, flags); | 394 | if (fmtfp(buffer, &currlen, maxlen, fvalue, |
395 | min, max, flags) == -1) | ||
396 | return -1; | ||
363 | break; | 397 | break; |
364 | case 'c': | 398 | case 'c': |
365 | dopr_outch (buffer, &currlen, maxlen, va_arg (args, int)); | 399 | DOPR_OUTCH(buffer, currlen, maxlen, |
400 | va_arg (args, int)); | ||
366 | break; | 401 | break; |
367 | case 's': | 402 | case 's': |
368 | strvalue = va_arg (args, char *); | 403 | strvalue = va_arg (args, char *); |
@@ -371,11 +406,15 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args | |||
371 | max = strlen(strvalue); | 406 | max = strlen(strvalue); |
372 | } | 407 | } |
373 | if (min > 0 && max >= 0 && min > max) max = min; | 408 | if (min > 0 && max >= 0 && min > max) max = min; |
374 | fmtstr (buffer, &currlen, maxlen, strvalue, flags, min, max); | 409 | if (fmtstr(buffer, &currlen, maxlen, |
410 | strvalue, flags, min, max) == -1) | ||
411 | return -1; | ||
375 | break; | 412 | break; |
376 | case 'p': | 413 | case 'p': |
377 | strvalue = va_arg (args, void *); | 414 | strvalue = va_arg (args, void *); |
378 | fmtint (buffer, &currlen, maxlen, (long) strvalue, 16, min, max, flags); | 415 | if (fmtint(buffer, &currlen, maxlen, |
416 | (long) strvalue, 16, min, max, flags) == -1) | ||
417 | return -1; | ||
379 | break; | 418 | break; |
380 | case 'n': | 419 | case 'n': |
381 | if (cflags == DP_C_SHORT) { | 420 | if (cflags == DP_C_SHORT) { |
@@ -397,7 +436,7 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args | |||
397 | } | 436 | } |
398 | break; | 437 | break; |
399 | case '%': | 438 | case '%': |
400 | dopr_outch (buffer, &currlen, maxlen, ch); | 439 | DOPR_OUTCH(buffer, currlen, maxlen, ch); |
401 | break; | 440 | break; |
402 | case 'w': | 441 | case 'w': |
403 | /* not supported yet, treat as next char */ | 442 | /* not supported yet, treat as next char */ |
@@ -426,11 +465,12 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args | |||
426 | buffer[maxlen - 1] = '\0'; | 465 | buffer[maxlen - 1] = '\0'; |
427 | } | 466 | } |
428 | 467 | ||
429 | return currlen; | 468 | return currlen < INT_MAX ? (int)currlen : -1; |
430 | } | 469 | } |
431 | 470 | ||
432 | static void fmtstr(char *buffer, size_t *currlen, size_t maxlen, | 471 | static int |
433 | char *value, int flags, int min, int max) | 472 | fmtstr(char *buffer, size_t *currlen, size_t maxlen, |
473 | char *value, int flags, int min, int max) | ||
434 | { | 474 | { |
435 | int padlen, strln; /* amount to pad */ | 475 | int padlen, strln; /* amount to pad */ |
436 | int cnt = 0; | 476 | int cnt = 0; |
@@ -450,28 +490,31 @@ static void fmtstr(char *buffer, size_t *currlen, size_t maxlen, | |||
450 | padlen = -padlen; /* Left Justify */ | 490 | padlen = -padlen; /* Left Justify */ |
451 | 491 | ||
452 | while ((padlen > 0) && (cnt < max)) { | 492 | while ((padlen > 0) && (cnt < max)) { |
453 | dopr_outch (buffer, currlen, maxlen, ' '); | 493 | DOPR_OUTCH(buffer, *currlen, maxlen, ' '); |
454 | --padlen; | 494 | --padlen; |
455 | ++cnt; | 495 | ++cnt; |
456 | } | 496 | } |
457 | while (*value && (cnt < max)) { | 497 | while (*value && (cnt < max)) { |
458 | dopr_outch (buffer, currlen, maxlen, *value++); | 498 | DOPR_OUTCH(buffer, *currlen, maxlen, *value); |
499 | *value++; | ||
459 | ++cnt; | 500 | ++cnt; |
460 | } | 501 | } |
461 | while ((padlen < 0) && (cnt < max)) { | 502 | while ((padlen < 0) && (cnt < max)) { |
462 | dopr_outch (buffer, currlen, maxlen, ' '); | 503 | DOPR_OUTCH(buffer, *currlen, maxlen, ' '); |
463 | ++padlen; | 504 | ++padlen; |
464 | ++cnt; | 505 | ++cnt; |
465 | } | 506 | } |
507 | return 0; | ||
466 | } | 508 | } |
467 | 509 | ||
468 | /* Have to handle DP_F_NUM (ie 0x and 0 alternates) */ | 510 | /* Have to handle DP_F_NUM (ie 0x and 0 alternates) */ |
469 | 511 | ||
470 | static void fmtint(char *buffer, size_t *currlen, size_t maxlen, | 512 | static int |
471 | long value, int base, int min, int max, int flags) | 513 | fmtint(char *buffer, size_t *currlen, size_t maxlen, |
514 | LLONG value, int base, int min, int max, int flags) | ||
472 | { | 515 | { |
473 | int signvalue = 0; | 516 | int signvalue = 0; |
474 | unsigned long uvalue; | 517 | unsigned LLONG uvalue; |
475 | char convert[20]; | 518 | char convert[20]; |
476 | int place = 0; | 519 | int place = 0; |
477 | int spadlen = 0; /* amount to space pad */ | 520 | int spadlen = 0; /* amount to space pad */ |
@@ -524,31 +567,34 @@ static void fmtint(char *buffer, size_t *currlen, size_t maxlen, | |||
524 | 567 | ||
525 | /* Spaces */ | 568 | /* Spaces */ |
526 | while (spadlen > 0) { | 569 | while (spadlen > 0) { |
527 | dopr_outch (buffer, currlen, maxlen, ' '); | 570 | DOPR_OUTCH(buffer, *currlen, maxlen, ' '); |
528 | --spadlen; | 571 | --spadlen; |
529 | } | 572 | } |
530 | 573 | ||
531 | /* Sign */ | 574 | /* Sign */ |
532 | if (signvalue) | 575 | if (signvalue) |
533 | dopr_outch (buffer, currlen, maxlen, signvalue); | 576 | DOPR_OUTCH(buffer, *currlen, maxlen, signvalue); |
534 | 577 | ||
535 | /* Zeros */ | 578 | /* Zeros */ |
536 | if (zpadlen > 0) { | 579 | if (zpadlen > 0) { |
537 | while (zpadlen > 0) { | 580 | while (zpadlen > 0) { |
538 | dopr_outch (buffer, currlen, maxlen, '0'); | 581 | DOPR_OUTCH(buffer, *currlen, maxlen, '0'); |
539 | --zpadlen; | 582 | --zpadlen; |
540 | } | 583 | } |
541 | } | 584 | } |
542 | 585 | ||
543 | /* Digits */ | 586 | /* Digits */ |
544 | while (place > 0) | 587 | while (place > 0) { |
545 | dopr_outch (buffer, currlen, maxlen, convert[--place]); | 588 | --place; |
589 | DOPR_OUTCH(buffer, *currlen, maxlen, convert[place]); | ||
590 | } | ||
546 | 591 | ||
547 | /* Left Justified spaces */ | 592 | /* Left Justified spaces */ |
548 | while (spadlen < 0) { | 593 | while (spadlen < 0) { |
549 | dopr_outch (buffer, currlen, maxlen, ' '); | 594 | DOPR_OUTCH(buffer, *currlen, maxlen, ' '); |
550 | ++spadlen; | 595 | ++spadlen; |
551 | } | 596 | } |
597 | return 0; | ||
552 | } | 598 | } |
553 | 599 | ||
554 | static LDOUBLE abs_val(LDOUBLE value) | 600 | static LDOUBLE abs_val(LDOUBLE value) |
@@ -561,13 +607,13 @@ static LDOUBLE abs_val(LDOUBLE value) | |||
561 | return result; | 607 | return result; |
562 | } | 608 | } |
563 | 609 | ||
564 | static LDOUBLE POW10(int exp) | 610 | static LDOUBLE POW10(int val) |
565 | { | 611 | { |
566 | LDOUBLE result = 1; | 612 | LDOUBLE result = 1; |
567 | 613 | ||
568 | while (exp) { | 614 | while (val) { |
569 | result *= 10; | 615 | result *= 10; |
570 | exp--; | 616 | val--; |
571 | } | 617 | } |
572 | 618 | ||
573 | return result; | 619 | return result; |
@@ -601,7 +647,10 @@ static double my_modf(double x0, double *iptr) | |||
601 | } | 647 | } |
602 | 648 | ||
603 | if (i == 100) { | 649 | if (i == 100) { |
604 | /* yikes! the number is beyond what we can handle. What do we do? */ | 650 | /* |
651 | * yikes! the number is beyond what we can handle. | ||
652 | * What do we do? | ||
653 | */ | ||
605 | (*iptr) = 0; | 654 | (*iptr) = 0; |
606 | return 0; | 655 | return 0; |
607 | } | 656 | } |
@@ -620,8 +669,9 @@ static double my_modf(double x0, double *iptr) | |||
620 | } | 669 | } |
621 | 670 | ||
622 | 671 | ||
623 | static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, | 672 | static int |
624 | LDOUBLE fvalue, int min, int max, int flags) | 673 | fmtfp (char *buffer, size_t *currlen, size_t maxlen, |
674 | LDOUBLE fvalue, int min, int max, int flags) | ||
625 | { | 675 | { |
626 | int signvalue = 0; | 676 | int signvalue = 0; |
627 | double ufvalue; | 677 | double ufvalue; |
@@ -726,24 +776,26 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, | |||
726 | 776 | ||
727 | if ((flags & DP_F_ZERO) && (padlen > 0)) { | 777 | if ((flags & DP_F_ZERO) && (padlen > 0)) { |
728 | if (signvalue) { | 778 | if (signvalue) { |
729 | dopr_outch (buffer, currlen, maxlen, signvalue); | 779 | DOPR_OUTCH(buffer, *currlen, maxlen, signvalue); |
730 | --padlen; | 780 | --padlen; |
731 | signvalue = 0; | 781 | signvalue = 0; |
732 | } | 782 | } |
733 | while (padlen > 0) { | 783 | while (padlen > 0) { |
734 | dopr_outch (buffer, currlen, maxlen, '0'); | 784 | DOPR_OUTCH(buffer, *currlen, maxlen, '0'); |
735 | --padlen; | 785 | --padlen; |
736 | } | 786 | } |
737 | } | 787 | } |
738 | while (padlen > 0) { | 788 | while (padlen > 0) { |
739 | dopr_outch (buffer, currlen, maxlen, ' '); | 789 | DOPR_OUTCH(buffer, *currlen, maxlen, ' '); |
740 | --padlen; | 790 | --padlen; |
741 | } | 791 | } |
742 | if (signvalue) | 792 | if (signvalue) |
743 | dopr_outch (buffer, currlen, maxlen, signvalue); | 793 | DOPR_OUTCH(buffer, *currlen, maxlen, signvalue); |
744 | 794 | ||
745 | while (iplace > 0) | 795 | while (iplace > 0) { |
746 | dopr_outch (buffer, currlen, maxlen, iconvert[--iplace]); | 796 | --iplace; |
797 | DOPR_OUTCH(buffer, *currlen, maxlen, iconvert[iplace]); | ||
798 | } | ||
747 | 799 | ||
748 | #ifdef DEBUG_SNPRINTF | 800 | #ifdef DEBUG_SNPRINTF |
749 | printf("fmtfp: fplace=%d zpadlen=%d\n", fplace, zpadlen); | 801 | printf("fmtfp: fplace=%d zpadlen=%d\n", fplace, zpadlen); |
@@ -754,41 +806,38 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, | |||
754 | * char to print out. | 806 | * char to print out. |
755 | */ | 807 | */ |
756 | if (max > 0) { | 808 | if (max > 0) { |
757 | dopr_outch (buffer, currlen, maxlen, '.'); | 809 | DOPR_OUTCH(buffer, *currlen, maxlen, '.'); |
758 | 810 | ||
759 | while (zpadlen > 0) { | 811 | while (zpadlen > 0) { |
760 | dopr_outch (buffer, currlen, maxlen, '0'); | 812 | DOPR_OUTCH(buffer, *currlen, maxlen, '0'); |
761 | --zpadlen; | 813 | --zpadlen; |
762 | } | 814 | } |
763 | 815 | ||
764 | while (fplace > 0) | 816 | while (fplace > 0) { |
765 | dopr_outch (buffer, currlen, maxlen, fconvert[--fplace]); | 817 | --fplace; |
818 | DOPR_OUTCH(buffer, *currlen, maxlen, fconvert[fplace]); | ||
819 | } | ||
766 | } | 820 | } |
767 | 821 | ||
768 | while (padlen < 0) { | 822 | while (padlen < 0) { |
769 | dopr_outch (buffer, currlen, maxlen, ' '); | 823 | DOPR_OUTCH(buffer, *currlen, maxlen, ' '); |
770 | ++padlen; | 824 | ++padlen; |
771 | } | 825 | } |
772 | } | 826 | return 0; |
773 | |||
774 | static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c) | ||
775 | { | ||
776 | if (*currlen < maxlen) { | ||
777 | buffer[(*currlen)] = c; | ||
778 | } | ||
779 | (*currlen)++; | ||
780 | } | 827 | } |
781 | #endif /* !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) */ | 828 | #endif /* !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) */ |
782 | 829 | ||
783 | #if !defined(HAVE_VSNPRINTF) | 830 | #if !defined(HAVE_VSNPRINTF) |
784 | int vsnprintf (char *str, size_t count, const char *fmt, va_list args) | 831 | int |
832 | vsnprintf (char *str, size_t count, const char *fmt, va_list args) | ||
785 | { | 833 | { |
786 | return dopr(str, count, fmt, args); | 834 | return dopr(str, count, fmt, args); |
787 | } | 835 | } |
788 | #endif | 836 | #endif |
789 | 837 | ||
790 | #if !defined(HAVE_SNPRINTF) | 838 | #if !defined(HAVE_SNPRINTF) |
791 | int snprintf(char *str, size_t count, SNPRINTF_CONST char *fmt, ...) | 839 | int |
840 | snprintf(char *str, size_t count, SNPRINTF_CONST char *fmt, ...) | ||
792 | { | 841 | { |
793 | size_t ret; | 842 | size_t ret; |
794 | va_list ap; | 843 | va_list ap; |
@@ -799,4 +848,3 @@ int snprintf(char *str, size_t count, SNPRINTF_CONST char *fmt, ...) | |||
799 | return ret; | 848 | return ret; |
800 | } | 849 | } |
801 | #endif | 850 | #endif |
802 | |||
diff --git a/openbsd-compat/bsd-waitpid.c b/openbsd-compat/bsd-waitpid.c index 93c9ec35e..40e6ffaa8 100644 --- a/openbsd-compat/bsd-waitpid.c +++ b/openbsd-compat/bsd-waitpid.c | |||
@@ -24,8 +24,6 @@ | |||
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | 26 | ||
27 | RCSID("$Id: bsd-waitpid.c,v 1.5 2003/06/01 03:23:57 mouring Exp $"); | ||
28 | |||
29 | #ifndef HAVE_WAITPID | 27 | #ifndef HAVE_WAITPID |
30 | #include <errno.h> | 28 | #include <errno.h> |
31 | #include <sys/wait.h> | 29 | #include <sys/wait.h> |
diff --git a/openbsd-compat/daemon.c b/openbsd-compat/daemon.c index f8a0680bf..e3a6886bd 100644 --- a/openbsd-compat/daemon.c +++ b/openbsd-compat/daemon.c | |||
@@ -34,6 +34,20 @@ | |||
34 | 34 | ||
35 | #ifndef HAVE_DAEMON | 35 | #ifndef HAVE_DAEMON |
36 | 36 | ||
37 | #include <sys/types.h> | ||
38 | |||
39 | #ifdef HAVE_SYS_STAT_H | ||
40 | # include <sys/stat.h> | ||
41 | #endif | ||
42 | |||
43 | #ifdef HAVE_FCNTL_H | ||
44 | # include <fcntl.h> | ||
45 | #endif | ||
46 | |||
47 | #ifdef HAVE_UNISTD_H | ||
48 | # include <unistd.h> | ||
49 | #endif | ||
50 | |||
37 | int | 51 | int |
38 | daemon(int nochdir, int noclose) | 52 | daemon(int nochdir, int noclose) |
39 | { | 53 | { |
diff --git a/openbsd-compat/fake-rfc2553.c b/openbsd-compat/fake-rfc2553.c index 0186b5300..b6ea3d21e 100644 --- a/openbsd-compat/fake-rfc2553.c +++ b/openbsd-compat/fake-rfc2553.c | |||
@@ -37,7 +37,11 @@ | |||
37 | 37 | ||
38 | #include "includes.h" | 38 | #include "includes.h" |
39 | 39 | ||
40 | RCSID("$Id: fake-rfc2553.c,v 1.5 2003/09/22 02:08:23 dtucker Exp $"); | 40 | #include <stdlib.h> |
41 | #include <string.h> | ||
42 | |||
43 | #include <netinet/in.h> | ||
44 | #include <arpa/inet.h> | ||
41 | 45 | ||
42 | #ifndef HAVE_GETNAMEINFO | 46 | #ifndef HAVE_GETNAMEINFO |
43 | int getnameinfo(const struct sockaddr *sa, size_t salen, char *host, | 47 | int getnameinfo(const struct sockaddr *sa, size_t salen, char *host, |
diff --git a/openbsd-compat/fake-rfc2553.h b/openbsd-compat/fake-rfc2553.h index cbcf7f727..5c2ce5b1b 100644 --- a/openbsd-compat/fake-rfc2553.h +++ b/openbsd-compat/fake-rfc2553.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $Id: fake-rfc2553.h,v 1.12 2005/08/03 05:36:21 dtucker Exp $ */ | 1 | /* $Id: fake-rfc2553.h,v 1.13 2006/07/24 03:51:52 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (C) 2000-2003 Damien Miller. All rights reserved. | 4 | * Copyright (C) 2000-2003 Damien Miller. All rights reserved. |
@@ -41,7 +41,10 @@ | |||
41 | #define _FAKE_RFC2553_H | 41 | #define _FAKE_RFC2553_H |
42 | 42 | ||
43 | #include "includes.h" | 43 | #include "includes.h" |
44 | #include "sys/types.h" | 44 | #include <sys/types.h> |
45 | #if defined(HAVE_NETDB_H) | ||
46 | # include <netdb.h> | ||
47 | #endif | ||
45 | 48 | ||
46 | /* | 49 | /* |
47 | * First, socket and INET6 related definitions | 50 | * First, socket and INET6 related definitions |
diff --git a/openbsd-compat/getrrsetbyname.c b/openbsd-compat/getrrsetbyname.c index bea6aea3b..07231d005 100644 --- a/openbsd-compat/getrrsetbyname.c +++ b/openbsd-compat/getrrsetbyname.c | |||
@@ -49,6 +49,12 @@ | |||
49 | 49 | ||
50 | #ifndef HAVE_GETRRSETBYNAME | 50 | #ifndef HAVE_GETRRSETBYNAME |
51 | 51 | ||
52 | #include <stdlib.h> | ||
53 | #include <string.h> | ||
54 | |||
55 | #include <netinet/in.h> | ||
56 | #include <arpa/inet.h> | ||
57 | |||
52 | #include "getrrsetbyname.h" | 58 | #include "getrrsetbyname.h" |
53 | 59 | ||
54 | #if defined(HAVE_DECL_H_ERRNO) && !HAVE_DECL_H_ERRNO | 60 | #if defined(HAVE_DECL_H_ERRNO) && !HAVE_DECL_H_ERRNO |
@@ -60,6 +66,13 @@ extern int h_errno; | |||
60 | # undef _THREAD_PRIVATE | 66 | # undef _THREAD_PRIVATE |
61 | #endif | 67 | #endif |
62 | #define _THREAD_PRIVATE(a,b,c) (c) | 68 | #define _THREAD_PRIVATE(a,b,c) (c) |
69 | |||
70 | /* to avoid conflicts where a platform already has _res */ | ||
71 | #ifdef _res | ||
72 | # undef _res | ||
73 | #endif | ||
74 | #define _res _compat_res | ||
75 | |||
63 | struct __res_state _res; | 76 | struct __res_state _res; |
64 | 77 | ||
65 | /* Necessary functions and macros */ | 78 | /* Necessary functions and macros */ |
@@ -290,10 +303,12 @@ getrrsetbyname(const char *hostname, unsigned int rdclass, | |||
290 | } | 303 | } |
291 | 304 | ||
292 | /* allocate memory for signatures */ | 305 | /* allocate memory for signatures */ |
293 | rrset->rri_sigs = calloc(rrset->rri_nsigs, sizeof(struct rdatainfo)); | 306 | if (rrset->rri_nsigs > 0) { |
294 | if (rrset->rri_sigs == NULL) { | 307 | rrset->rri_sigs = calloc(rrset->rri_nsigs, sizeof(struct rdatainfo)); |
295 | result = ERRSET_NOMEMORY; | 308 | if (rrset->rri_sigs == NULL) { |
296 | goto fail; | 309 | result = ERRSET_NOMEMORY; |
310 | goto fail; | ||
311 | } | ||
297 | } | 312 | } |
298 | 313 | ||
299 | /* copy answers & signatures */ | 314 | /* copy answers & signatures */ |
diff --git a/openbsd-compat/glob.c b/openbsd-compat/glob.c index f6a04ea3f..b3dd2b171 100644 --- a/openbsd-compat/glob.c +++ b/openbsd-compat/glob.c | |||
@@ -34,7 +34,21 @@ | |||
34 | /* OPENBSD ORIGINAL: lib/libc/gen/glob.c */ | 34 | /* OPENBSD ORIGINAL: lib/libc/gen/glob.c */ |
35 | 35 | ||
36 | #include "includes.h" | 36 | #include "includes.h" |
37 | |||
38 | #include <sys/types.h> | ||
39 | #include <sys/stat.h> | ||
40 | |||
41 | #include <dirent.h> | ||
37 | #include <ctype.h> | 42 | #include <ctype.h> |
43 | #include <errno.h> | ||
44 | #include <pwd.h> | ||
45 | #include <stdlib.h> | ||
46 | #include <string.h> | ||
47 | #include <unistd.h> | ||
48 | |||
49 | #if !defined(HAVE_GLOB) || !defined(GLOB_HAS_ALTDIRFUNC) || \ | ||
50 | !defined(GLOB_HAS_GL_MATCHC) || \ | ||
51 | !defined(HAVE_DECL_GLOB_NOMATCH) || HAVE_DECL_GLOB_NOMATCH == 0 | ||
38 | 52 | ||
39 | static long | 53 | static long |
40 | get_arg_max(void) | 54 | get_arg_max(void) |
@@ -48,9 +62,6 @@ get_arg_max(void) | |||
48 | #endif | 62 | #endif |
49 | } | 63 | } |
50 | 64 | ||
51 | #if !defined(HAVE_GLOB) || !defined(GLOB_HAS_ALTDIRFUNC) || \ | ||
52 | !defined(GLOB_HAS_GL_MATCHC) | ||
53 | |||
54 | /* | 65 | /* |
55 | * glob(3) -- a superset of the one defined in POSIX 1003.2. | 66 | * glob(3) -- a superset of the one defined in POSIX 1003.2. |
56 | * | 67 | * |
diff --git a/openbsd-compat/glob.h b/openbsd-compat/glob.h index 4fdbfc1ea..9ba07f76e 100644 --- a/openbsd-compat/glob.h +++ b/openbsd-compat/glob.h | |||
@@ -38,7 +38,8 @@ | |||
38 | /* OPENBSD ORIGINAL: include/glob.h */ | 38 | /* OPENBSD ORIGINAL: include/glob.h */ |
39 | 39 | ||
40 | #if !defined(HAVE_GLOB_H) || !defined(GLOB_HAS_ALTDIRFUNC) || \ | 40 | #if !defined(HAVE_GLOB_H) || !defined(GLOB_HAS_ALTDIRFUNC) || \ |
41 | !defined(GLOB_HAS_GL_MATCHC) | 41 | !defined(GLOB_HAS_GL_MATCHC) || \ |
42 | !defined(HAVE_DECL_GLOB_NOMATCH) || HAVE_DECL_GLOB_NOMATCH == 0 | ||
42 | 43 | ||
43 | #ifndef _GLOB_H_ | 44 | #ifndef _GLOB_H_ |
44 | #define _GLOB_H_ | 45 | #define _GLOB_H_ |
diff --git a/openbsd-compat/mktemp.c b/openbsd-compat/mktemp.c index 88e04c520..2285c84df 100644 --- a/openbsd-compat/mktemp.c +++ b/openbsd-compat/mktemp.c | |||
@@ -35,6 +35,14 @@ | |||
35 | 35 | ||
36 | #include "includes.h" | 36 | #include "includes.h" |
37 | 37 | ||
38 | #include <sys/types.h> | ||
39 | #include <sys/stat.h> | ||
40 | |||
41 | #include <fcntl.h> | ||
42 | #include <ctype.h> | ||
43 | #include <errno.h> | ||
44 | #include <unistd.h> | ||
45 | |||
38 | #if !defined(HAVE_MKDTEMP) || defined(HAVE_STRICT_MKSTEMP) | 46 | #if !defined(HAVE_MKDTEMP) || defined(HAVE_STRICT_MKSTEMP) |
39 | 47 | ||
40 | static int _gettemp(char *, int *, int, int); | 48 | static int _gettemp(char *, int *, int, int); |
diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h index 1a3027353..aac2e6cbc 100644 --- a/openbsd-compat/openbsd-compat.h +++ b/openbsd-compat/openbsd-compat.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $Id: openbsd-compat.h,v 1.33 2005/12/31 05:33:37 djm Exp $ */ | 1 | /* $Id: openbsd-compat.h,v 1.42 2006/09/03 12:44:50 dtucker Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 1999-2003 Damien Miller. All rights reserved. | 4 | * Copyright (c) 1999-2003 Damien Miller. All rights reserved. |
@@ -31,6 +31,11 @@ | |||
31 | 31 | ||
32 | #include "includes.h" | 32 | #include "includes.h" |
33 | 33 | ||
34 | #include <sys/types.h> | ||
35 | #include <pwd.h> | ||
36 | |||
37 | #include <sys/socket.h> | ||
38 | |||
34 | /* OpenBSD function replacements */ | 39 | /* OpenBSD function replacements */ |
35 | #include "base64.h" | 40 | #include "base64.h" |
36 | #include "sigact.h" | 41 | #include "sigact.h" |
@@ -38,7 +43,7 @@ | |||
38 | #include "readpassphrase.h" | 43 | #include "readpassphrase.h" |
39 | #include "vis.h" | 44 | #include "vis.h" |
40 | #include "getrrsetbyname.h" | 45 | #include "getrrsetbyname.h" |
41 | 46 | #include "sha2.h" | |
42 | 47 | ||
43 | #ifndef HAVE_BASENAME | 48 | #ifndef HAVE_BASENAME |
44 | char *basename(const char *path); | 49 | char *basename(const char *path); |
@@ -126,13 +131,16 @@ int getgrouplist(const char *, gid_t, gid_t *, int *); | |||
126 | int BSDgetopt(int argc, char * const *argv, const char *opts); | 131 | int BSDgetopt(int argc, char * const *argv, const char *opts); |
127 | #endif | 132 | #endif |
128 | 133 | ||
134 | #if defined(HAVE_DECL_WRITEV) && HAVE_DECL_WRITEV == 0 | ||
135 | # include <sys/types.h> | ||
136 | # include <sys/uio.h> | ||
137 | int writev(int, struct iovec *, int); | ||
138 | #endif | ||
129 | 139 | ||
130 | /* Home grown routines */ | 140 | /* Home grown routines */ |
131 | #include "bsd-misc.h" | 141 | #include "bsd-misc.h" |
132 | #include "bsd-waitpid.h" | 142 | #include "bsd-waitpid.h" |
133 | 143 | ||
134 | /*#include <sys/types.h> XXX Still needed? * For uid_t, gid_t * */ | ||
135 | |||
136 | #ifndef HAVE_GETPEEREID | 144 | #ifndef HAVE_GETPEEREID |
137 | int getpeereid(int , uid_t *, gid_t *); | 145 | int getpeereid(int , uid_t *, gid_t *); |
138 | #endif | 146 | #endif |
@@ -147,13 +155,14 @@ int asprintf(char **, const char *, ...); | |||
147 | #endif | 155 | #endif |
148 | 156 | ||
149 | #ifndef HAVE_OPENPTY | 157 | #ifndef HAVE_OPENPTY |
158 | # include <sys/ioctl.h> /* for struct winsize */ | ||
150 | int openpty(int *, int *, char *, struct termios *, struct winsize *); | 159 | int openpty(int *, int *, char *, struct termios *, struct winsize *); |
151 | #endif /* HAVE_OPENPTY */ | 160 | #endif /* HAVE_OPENPTY */ |
152 | 161 | ||
153 | /* #include <sys/types.h> XXX needed? For size_t */ | 162 | /* #include <sys/types.h> XXX needed? For size_t */ |
154 | 163 | ||
155 | #ifndef HAVE_SNPRINTF | 164 | #ifndef HAVE_SNPRINTF |
156 | int snprintf(char *, size_t, const char *, ...); | 165 | int snprintf(char *, size_t, SNPRINTF_CONST char *, ...); |
157 | #endif | 166 | #endif |
158 | 167 | ||
159 | #ifndef HAVE_STRTOLL | 168 | #ifndef HAVE_STRTOLL |
@@ -164,6 +173,10 @@ long long strtoll(const char *, char **, int); | |||
164 | long long strtonum(const char *, long long, long long, const char **); | 173 | long long strtonum(const char *, long long, long long, const char **); |
165 | #endif | 174 | #endif |
166 | 175 | ||
176 | #if !defined(HAVE_VASPRINTF) || !defined(HAVE_VSNPRINTF) | ||
177 | # include <stdarg.h> | ||
178 | #endif | ||
179 | |||
167 | #ifndef HAVE_VASPRINTF | 180 | #ifndef HAVE_VASPRINTF |
168 | int vasprintf(char **, const char *, va_list); | 181 | int vasprintf(char **, const char *, va_list); |
169 | #endif | 182 | #endif |
@@ -176,16 +189,18 @@ void *xmmap(size_t size); | |||
176 | char *xcrypt(const char *password, const char *salt); | 189 | char *xcrypt(const char *password, const char *salt); |
177 | char *shadow_pw(struct passwd *pw); | 190 | char *shadow_pw(struct passwd *pw); |
178 | 191 | ||
179 | |||
180 | /* rfc2553 socket API replacements */ | 192 | /* rfc2553 socket API replacements */ |
181 | #include "fake-rfc2553.h" | 193 | #include "fake-rfc2553.h" |
182 | 194 | ||
183 | /* Routines for a single OS platform */ | 195 | /* Routines for a single OS platform */ |
184 | #include "bsd-cray.h" | 196 | #include "bsd-cray.h" |
185 | #include "bsd-cygwin_util.h" | 197 | #include "bsd-cygwin_util.h" |
186 | #include "port-irix.h" | 198 | |
187 | #include "port-aix.h" | 199 | #include "port-aix.h" |
188 | #include "port-uw.h" | 200 | #include "port-irix.h" |
201 | #include "port-linux.h" | ||
202 | #include "port-solaris.h" | ||
189 | #include "port-tun.h" | 203 | #include "port-tun.h" |
204 | #include "port-uw.h" | ||
190 | 205 | ||
191 | #endif /* _OPENBSD_COMPAT_H */ | 206 | #endif /* _OPENBSD_COMPAT_H */ |
diff --git a/openbsd-compat/openssl-compat.c b/openbsd-compat/openssl-compat.c index b690e8fe6..45ebd3f66 100644 --- a/openbsd-compat/openssl-compat.c +++ b/openbsd-compat/openssl-compat.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $Id: openssl-compat.c,v 1.2 2005/06/17 11:15:21 dtucker Exp $ */ | 1 | /* $Id: openssl-compat.c,v 1.4 2006/02/22 11:24:47 dtucker Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2005 Darren Tucker <dtucker@zip.com.au> | 4 | * Copyright (c) 2005 Darren Tucker <dtucker@zip.com.au> |
@@ -18,7 +18,11 @@ | |||
18 | 18 | ||
19 | #include "includes.h" | 19 | #include "includes.h" |
20 | 20 | ||
21 | #define SSH_DONT_REDEF_EVP | 21 | #ifdef USE_OPENSSL_ENGINE |
22 | # include <openssl/engine.h> | ||
23 | #endif | ||
24 | |||
25 | #define SSH_DONT_OVERLOAD_OPENSSL_FUNCS | ||
22 | #include "openssl-compat.h" | 26 | #include "openssl-compat.h" |
23 | 27 | ||
24 | #ifdef SSH_OLD_EVP | 28 | #ifdef SSH_OLD_EVP |
@@ -44,3 +48,15 @@ ssh_EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *evp) | |||
44 | return 1; | 48 | return 1; |
45 | } | 49 | } |
46 | #endif | 50 | #endif |
51 | |||
52 | #ifdef USE_OPENSSL_ENGINE | ||
53 | void | ||
54 | ssh_SSLeay_add_all_algorithms(void) | ||
55 | { | ||
56 | SSLeay_add_all_algorithms(); | ||
57 | |||
58 | /* Enable use of crypto hardware */ | ||
59 | ENGINE_load_builtin_engines(); | ||
60 | ENGINE_register_all_complete(); | ||
61 | } | ||
62 | #endif | ||
diff --git a/openbsd-compat/openssl-compat.h b/openbsd-compat/openssl-compat.h index 8a015ec43..9b5ccff5f 100644 --- a/openbsd-compat/openssl-compat.h +++ b/openbsd-compat/openssl-compat.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $Id: openssl-compat.h,v 1.3 2005/12/19 06:40:40 dtucker Exp $ */ | 1 | /* $Id: openssl-compat.h,v 1.7 2007/03/05 07:25:20 dtucker Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2005 Darren Tucker <dtucker@zip.com.au> | 4 | * Copyright (c) 2005 Darren Tucker <dtucker@zip.com.au> |
@@ -46,6 +46,11 @@ extern const EVP_CIPHER *evp_acss(void); | |||
46 | # endif | 46 | # endif |
47 | #endif | 47 | #endif |
48 | 48 | ||
49 | /* OpenSSL 0.9.8e returns cipher key len not context key len */ | ||
50 | #if (OPENSSL_VERSION_NUMBER == 0x0090805fL) | ||
51 | # define EVP_CIPHER_CTX_key_length(c) ((c)->key_len) | ||
52 | #endif | ||
53 | |||
49 | /* | 54 | /* |
50 | * We overload some of the OpenSSL crypto functions with ssh_* equivalents | 55 | * We overload some of the OpenSSL crypto functions with ssh_* equivalents |
51 | * which cater for older and/or less featureful OpenSSL version. | 56 | * which cater for older and/or less featureful OpenSSL version. |
@@ -54,21 +59,27 @@ extern const EVP_CIPHER *evp_acss(void); | |||
54 | * define SSH_DONT_OVERLOAD_OPENSSL_FUNCS before including this file and | 59 | * define SSH_DONT_OVERLOAD_OPENSSL_FUNCS before including this file and |
55 | * implement the ssh_* equivalents. | 60 | * implement the ssh_* equivalents. |
56 | */ | 61 | */ |
57 | #ifdef SSH_OLD_EVP | 62 | #ifndef SSH_DONT_OVERLOAD_OPENSSL_FUNCS |
58 | |||
59 | # ifndef SSH_DONT_REDEF_EVP | ||
60 | 63 | ||
64 | # ifdef SSH_OLD_EVP | ||
61 | # ifdef EVP_Cipher | 65 | # ifdef EVP_Cipher |
62 | # undef EVP_Cipher | 66 | # undef EVP_Cipher |
63 | # endif | 67 | # endif |
64 | |||
65 | # define EVP_CipherInit(a,b,c,d,e) ssh_EVP_CipherInit((a),(b),(c),(d),(e)) | 68 | # define EVP_CipherInit(a,b,c,d,e) ssh_EVP_CipherInit((a),(b),(c),(d),(e)) |
66 | # define EVP_Cipher(a,b,c,d) ssh_EVP_Cipher((a),(b),(c),(d)) | 69 | # define EVP_Cipher(a,b,c,d) ssh_EVP_Cipher((a),(b),(c),(d)) |
67 | # define EVP_CIPHER_CTX_cleanup(a) ssh_EVP_CIPHER_CTX_cleanup((a)) | 70 | # define EVP_CIPHER_CTX_cleanup(a) ssh_EVP_CIPHER_CTX_cleanup((a)) |
68 | # endif | 71 | # endif /* SSH_OLD_EVP */ |
72 | |||
73 | # ifdef USE_OPENSSL_ENGINE | ||
74 | # ifdef SSLeay_add_all_algorithms | ||
75 | # undef SSLeay_add_all_algorithms | ||
76 | # endif | ||
77 | # define SSLeay_add_all_algorithms() ssh_SSLeay_add_all_algorithms() | ||
78 | #endif | ||
69 | 79 | ||
70 | int ssh_EVP_CipherInit(EVP_CIPHER_CTX *, const EVP_CIPHER *, unsigned char *, | 80 | int ssh_EVP_CipherInit(EVP_CIPHER_CTX *, const EVP_CIPHER *, unsigned char *, |
71 | unsigned char *, int); | 81 | unsigned char *, int); |
72 | int ssh_EVP_Cipher(EVP_CIPHER_CTX *, char *, char *, int); | 82 | int ssh_EVP_Cipher(EVP_CIPHER_CTX *, char *, char *, int); |
73 | int ssh_EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *); | 83 | int ssh_EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *); |
74 | #endif | 84 | void ssh_SSLeay_add_all_algorithms(void); |
85 | #endif /* SSH_DONT_OVERLOAD_OPENSSL_FUNCS */ | ||
diff --git a/openbsd-compat/port-aix.c b/openbsd-compat/port-aix.c index 81d8124e0..b9fabf61f 100644 --- a/openbsd-compat/port-aix.c +++ b/openbsd-compat/port-aix.c | |||
@@ -25,16 +25,36 @@ | |||
25 | * | 25 | * |
26 | */ | 26 | */ |
27 | #include "includes.h" | 27 | #include "includes.h" |
28 | |||
29 | #include "xmalloc.h" | ||
30 | #include "buffer.h" | ||
31 | #include "key.h" | ||
32 | #include "hostfile.h" | ||
28 | #include "auth.h" | 33 | #include "auth.h" |
29 | #include "ssh.h" | 34 | #include "ssh.h" |
30 | #include "log.h" | 35 | #include "log.h" |
31 | #include "xmalloc.h" | ||
32 | #include "buffer.h" | ||
33 | 36 | ||
34 | #ifdef _AIX | 37 | #ifdef _AIX |
35 | 38 | ||
39 | #include <errno.h> | ||
40 | #if defined(HAVE_NETDB_H) | ||
41 | # include <netdb.h> | ||
42 | #endif | ||
36 | #include <uinfo.h> | 43 | #include <uinfo.h> |
44 | #include <stdarg.h> | ||
45 | #include <string.h> | ||
46 | #include <unistd.h> | ||
37 | #include <sys/socket.h> | 47 | #include <sys/socket.h> |
48 | |||
49 | #ifdef WITH_AIXAUTHENTICATE | ||
50 | # include <login.h> | ||
51 | # include <userpw.h> | ||
52 | # if defined(HAVE_SYS_AUDIT_H) && defined(AIX_LOGINFAILED_4ARG) | ||
53 | # include <sys/audit.h> | ||
54 | # endif | ||
55 | # include <usersec.h> | ||
56 | #endif | ||
57 | |||
38 | #include "port-aix.h" | 58 | #include "port-aix.h" |
39 | 59 | ||
40 | # ifdef HAVE_SETAUTHDB | 60 | # ifdef HAVE_SETAUTHDB |
@@ -256,15 +276,17 @@ sys_auth_record_login(const char *user, const char *host, const char *ttynm, | |||
256 | Buffer *loginmsg) | 276 | Buffer *loginmsg) |
257 | { | 277 | { |
258 | char *msg = NULL; | 278 | char *msg = NULL; |
279 | static int msg_done = 0; | ||
259 | int success = 0; | 280 | int success = 0; |
260 | 281 | ||
261 | aix_setauthdb(user); | 282 | aix_setauthdb(user); |
262 | if (loginsuccess((char *)user, (char *)host, (char *)ttynm, &msg) == 0) { | 283 | if (loginsuccess((char *)user, (char *)host, (char *)ttynm, &msg) == 0) { |
263 | success = 1; | 284 | success = 1; |
264 | if (msg != NULL) { | 285 | if (msg != NULL && loginmsg != NULL && !msg_done) { |
265 | debug("AIX/loginsuccess: msg %s", msg); | 286 | debug("AIX/loginsuccess: msg %s", msg); |
266 | buffer_append(loginmsg, msg, strlen(msg)); | 287 | buffer_append(loginmsg, msg, strlen(msg)); |
267 | xfree(msg); | 288 | xfree(msg); |
289 | msg_done = 1; | ||
268 | } | 290 | } |
269 | } | 291 | } |
270 | aix_restoreauthdb(); | 292 | aix_restoreauthdb(); |
diff --git a/openbsd-compat/port-aix.h b/openbsd-compat/port-aix.h index 37b2c12b0..5a04bedad 100644 --- a/openbsd-compat/port-aix.h +++ b/openbsd-compat/port-aix.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $Id: port-aix.h,v 1.26 2005/05/28 10:28:40 dtucker Exp $ */ | 1 | /* $Id: port-aix.h,v 1.27 2006/09/18 13:54:33 dtucker Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * | 4 | * |
@@ -31,18 +31,6 @@ | |||
31 | #ifdef HAVE_SYS_SOCKET_H | 31 | #ifdef HAVE_SYS_SOCKET_H |
32 | # include <sys/socket.h> | 32 | # include <sys/socket.h> |
33 | #endif | 33 | #endif |
34 | #ifdef HAVE_UNISTD_H | ||
35 | # include <unistd.h> /* for seteuid() */ | ||
36 | #endif | ||
37 | |||
38 | #ifdef WITH_AIXAUTHENTICATE | ||
39 | # include <login.h> | ||
40 | # include <userpw.h> | ||
41 | # if defined(HAVE_SYS_AUDIT_H) && defined(AIX_LOGINFAILED_4ARG) | ||
42 | # include <sys/audit.h> | ||
43 | # endif | ||
44 | # include <usersec.h> | ||
45 | #endif | ||
46 | 34 | ||
47 | #include "buffer.h" | 35 | #include "buffer.h" |
48 | 36 | ||
diff --git a/openbsd-compat/port-irix.c b/openbsd-compat/port-irix.c index aa6db1cf8..ba751a538 100644 --- a/openbsd-compat/port-irix.c +++ b/openbsd-compat/port-irix.c | |||
@@ -29,6 +29,10 @@ | |||
29 | defined(WITH_IRIX_JOBS) || \ | 29 | defined(WITH_IRIX_JOBS) || \ |
30 | defined(WITH_IRIX_ARRAY) | 30 | defined(WITH_IRIX_ARRAY) |
31 | 31 | ||
32 | #include <errno.h> | ||
33 | #include <string.h> | ||
34 | #include <unistd.h> | ||
35 | |||
32 | #ifdef WITH_IRIX_PROJECT | 36 | #ifdef WITH_IRIX_PROJECT |
33 | # include <proj.h> | 37 | # include <proj.h> |
34 | #endif /* WITH_IRIX_PROJECT */ | 38 | #endif /* WITH_IRIX_PROJECT */ |
diff --git a/openbsd-compat/port-linux.c b/openbsd-compat/port-linux.c new file mode 100644 index 000000000..d153f8fb5 --- /dev/null +++ b/openbsd-compat/port-linux.c | |||
@@ -0,0 +1,178 @@ | |||
1 | /* $Id: port-linux.c,v 1.3 2006/09/01 05:38:41 djm Exp $ */ | ||
2 | |||
3 | /* | ||
4 | * Copyright (c) 2005 Daniel Walsh <dwalsh@redhat.com> | ||
5 | * Copyright (c) 2006 Damien Miller <djm@openbsd.org> | ||
6 | * | ||
7 | * Permission to use, copy, modify, and distribute this software for any | ||
8 | * purpose with or without fee is hereby granted, provided that the above | ||
9 | * copyright notice and this permission notice appear in all copies. | ||
10 | * | ||
11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
18 | */ | ||
19 | |||
20 | /* | ||
21 | * Linux-specific portability code - just SELinux support at present | ||
22 | */ | ||
23 | |||
24 | #include "includes.h" | ||
25 | |||
26 | #include <errno.h> | ||
27 | #include <stdarg.h> | ||
28 | #include <string.h> | ||
29 | |||
30 | #ifdef WITH_SELINUX | ||
31 | #include "log.h" | ||
32 | #include "port-linux.h" | ||
33 | |||
34 | #include <selinux/selinux.h> | ||
35 | #include <selinux/flask.h> | ||
36 | #include <selinux/get_context_list.h> | ||
37 | |||
38 | /* Wrapper around is_selinux_enabled() to log its return value once only */ | ||
39 | static int | ||
40 | ssh_selinux_enabled(void) | ||
41 | { | ||
42 | static int enabled = -1; | ||
43 | |||
44 | if (enabled == -1) { | ||
45 | enabled = is_selinux_enabled(); | ||
46 | debug("SELinux support %s", enabled ? "enabled" : "disabled"); | ||
47 | } | ||
48 | |||
49 | return (enabled); | ||
50 | } | ||
51 | |||
52 | /* Return the default security context for the given username */ | ||
53 | static security_context_t | ||
54 | ssh_selinux_getctxbyname(char *pwname) | ||
55 | { | ||
56 | security_context_t sc; | ||
57 | char *sename = NULL, *role = NULL, *lvl = NULL; | ||
58 | int r; | ||
59 | |||
60 | #ifdef HAVE_GETSEUSERBYNAME | ||
61 | if (getseuserbyname(pwname, &sename, &lvl) != 0) | ||
62 | return NULL; | ||
63 | #else | ||
64 | sename = pwname; | ||
65 | lvl = NULL; | ||
66 | #endif | ||
67 | if (the_authctxt) | ||
68 | role = the_authctxt->role; | ||
69 | |||
70 | #ifdef HAVE_GET_DEFAULT_CONTEXT_WITH_LEVEL | ||
71 | if (role != NULL && role[0]) | ||
72 | r = get_default_context_with_rolelevel(sename, role, lvl, NULL, | ||
73 | &sc); | ||
74 | else | ||
75 | r = get_default_context_with_level(sename, lvl, NULL, &sc); | ||
76 | #else | ||
77 | if (role != NULL && role[0]) | ||
78 | r = get_default_context_with_role(sename, role, NULL, &sc); | ||
79 | else | ||
80 | r = get_default_context(sename, NULL, &sc); | ||
81 | #endif | ||
82 | |||
83 | if (r != 0) { | ||
84 | switch (security_getenforce()) { | ||
85 | case -1: | ||
86 | fatal("%s: ssh_selinux_getctxbyname: " | ||
87 | "security_getenforce() failed", __func__); | ||
88 | case 0: | ||
89 | error("%s: Failed to get default SELinux security " | ||
90 | "context for %s", __func__, pwname); | ||
91 | default: | ||
92 | fatal("%s: Failed to get default SELinux security " | ||
93 | "context for %s (in enforcing mode)", | ||
94 | __func__, pwname); | ||
95 | } | ||
96 | } | ||
97 | |||
98 | #ifdef HAVE_GETSEUSERBYNAME | ||
99 | if (sename != NULL) | ||
100 | xfree(sename); | ||
101 | if (lvl != NULL) | ||
102 | xfree(lvl); | ||
103 | #endif | ||
104 | |||
105 | return (sc); | ||
106 | } | ||
107 | |||
108 | /* Set the execution context to the default for the specified user */ | ||
109 | void | ||
110 | ssh_selinux_setup_exec_context(char *pwname) | ||
111 | { | ||
112 | security_context_t user_ctx = NULL; | ||
113 | |||
114 | if (!ssh_selinux_enabled()) | ||
115 | return; | ||
116 | |||
117 | debug3("%s: setting execution context", __func__); | ||
118 | |||
119 | user_ctx = ssh_selinux_getctxbyname(pwname); | ||
120 | if (setexeccon(user_ctx) != 0) { | ||
121 | switch (security_getenforce()) { | ||
122 | case -1: | ||
123 | fatal("%s: security_getenforce() failed", __func__); | ||
124 | case 0: | ||
125 | error("%s: Failed to set SELinux execution " | ||
126 | "context for %s", __func__, pwname); | ||
127 | default: | ||
128 | fatal("%s: Failed to set SELinux execution context " | ||
129 | "for %s (in enforcing mode)", __func__, pwname); | ||
130 | } | ||
131 | } | ||
132 | if (user_ctx != NULL) | ||
133 | freecon(user_ctx); | ||
134 | |||
135 | debug3("%s: done", __func__); | ||
136 | } | ||
137 | |||
138 | /* Set the TTY context for the specified user */ | ||
139 | void | ||
140 | ssh_selinux_setup_pty(char *pwname, const char *tty) | ||
141 | { | ||
142 | security_context_t new_tty_ctx = NULL; | ||
143 | security_context_t user_ctx = NULL; | ||
144 | security_context_t old_tty_ctx = NULL; | ||
145 | |||
146 | if (!ssh_selinux_enabled()) | ||
147 | return; | ||
148 | |||
149 | debug3("%s: setting TTY context on %s", __func__, tty); | ||
150 | |||
151 | user_ctx = ssh_selinux_getctxbyname(pwname); | ||
152 | |||
153 | /* XXX: should these calls fatal() upon failure in enforcing mode? */ | ||
154 | |||
155 | if (getfilecon(tty, &old_tty_ctx) == -1) { | ||
156 | error("%s: getfilecon: %s", __func__, strerror(errno)); | ||
157 | goto out; | ||
158 | } | ||
159 | |||
160 | if (security_compute_relabel(user_ctx, old_tty_ctx, | ||
161 | SECCLASS_CHR_FILE, &new_tty_ctx) != 0) { | ||
162 | error("%s: security_compute_relabel: %s", | ||
163 | __func__, strerror(errno)); | ||
164 | goto out; | ||
165 | } | ||
166 | |||
167 | if (setfilecon(tty, new_tty_ctx) != 0) | ||
168 | error("%s: setfilecon: %s", __func__, strerror(errno)); | ||
169 | out: | ||
170 | if (new_tty_ctx != NULL) | ||
171 | freecon(new_tty_ctx); | ||
172 | if (old_tty_ctx != NULL) | ||
173 | freecon(old_tty_ctx); | ||
174 | if (user_ctx != NULL) | ||
175 | freecon(user_ctx); | ||
176 | debug3("%s: done", __func__); | ||
177 | } | ||
178 | #endif /* WITH_SELINUX */ | ||
diff --git a/openbsd-compat/port-linux.h b/openbsd-compat/port-linux.h new file mode 100644 index 000000000..05e520e1c --- /dev/null +++ b/openbsd-compat/port-linux.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* $Id: port-linux.h,v 1.1 2006/04/22 11:26:08 djm Exp $ */ | ||
2 | |||
3 | /* | ||
4 | * Copyright (c) 2006 Damien Miller <djm@openbsd.org> | ||
5 | * | ||
6 | * Permission to use, copy, modify, and distribute this software for any | ||
7 | * purpose with or without fee is hereby granted, provided that the above | ||
8 | * copyright notice and this permission notice appear in all copies. | ||
9 | * | ||
10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
17 | */ | ||
18 | |||
19 | #ifndef _PORT_LINUX_H | ||
20 | #define _PORT_LINUX_H | ||
21 | |||
22 | #ifdef WITH_SELINUX | ||
23 | void ssh_selinux_setup_pty(char *, const char *); | ||
24 | void ssh_selinux_setup_exec_context(char *); | ||
25 | #endif | ||
26 | |||
27 | #endif /* ! _PORT_LINUX_H */ | ||
diff --git a/openbsd-compat/port-solaris.c b/openbsd-compat/port-solaris.c new file mode 100644 index 000000000..2ab64d487 --- /dev/null +++ b/openbsd-compat/port-solaris.c | |||
@@ -0,0 +1,199 @@ | |||
1 | /* $Id: port-solaris.c,v 1.3 2006/10/31 23:28:49 dtucker Exp $ */ | ||
2 | |||
3 | /* | ||
4 | * Copyright (c) 2006 Chad Mynhier. | ||
5 | * | ||
6 | * Permission to use, copy, modify, and distribute this software for any | ||
7 | * purpose with or without fee is hereby granted, provided that the above | ||
8 | * copyright notice and this permission notice appear in all copies. | ||
9 | * | ||
10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
17 | */ | ||
18 | |||
19 | #include "config.h" | ||
20 | #include "includes.h" | ||
21 | |||
22 | #ifdef USE_SOLARIS_PROCESS_CONTRACTS | ||
23 | |||
24 | #include <sys/types.h> | ||
25 | #include <sys/stat.h> | ||
26 | #include <sys/param.h> | ||
27 | |||
28 | #include <errno.h> | ||
29 | #ifdef HAVE_FCNTL_H | ||
30 | # include <fcntl.h> | ||
31 | #endif | ||
32 | #include <stdarg.h> | ||
33 | #include <string.h> | ||
34 | #include <unistd.h> | ||
35 | |||
36 | #include <libcontract.h> | ||
37 | #include <sys/contract/process.h> | ||
38 | #include <sys/ctfs.h> | ||
39 | |||
40 | #include "log.h" | ||
41 | |||
42 | #define CT_TEMPLATE CTFS_ROOT "/process/template" | ||
43 | #define CT_LATEST CTFS_ROOT "/process/latest" | ||
44 | |||
45 | static int tmpl_fd = -1; | ||
46 | |||
47 | /* Lookup the latest process contract */ | ||
48 | static ctid_t | ||
49 | get_active_process_contract_id(void) | ||
50 | { | ||
51 | int stat_fd; | ||
52 | ctid_t ctid = -1; | ||
53 | ct_stathdl_t stathdl; | ||
54 | |||
55 | if ((stat_fd = open64(CT_LATEST, O_RDONLY)) == -1) { | ||
56 | error("%s: Error opening 'latest' process " | ||
57 | "contract: %s", __func__, strerror(errno)); | ||
58 | return -1; | ||
59 | } | ||
60 | if (ct_status_read(stat_fd, CTD_COMMON, &stathdl) != 0) { | ||
61 | error("%s: Error reading process contract " | ||
62 | "status: %s", __func__, strerror(errno)); | ||
63 | goto out; | ||
64 | } | ||
65 | if ((ctid = ct_status_get_id(stathdl)) < 0) { | ||
66 | error("%s: Error getting process contract id: %s", | ||
67 | __func__, strerror(errno)); | ||
68 | goto out; | ||
69 | } | ||
70 | |||
71 | ct_status_free(stathdl); | ||
72 | out: | ||
73 | close(stat_fd); | ||
74 | return ctid; | ||
75 | } | ||
76 | |||
77 | void | ||
78 | solaris_contract_pre_fork(void) | ||
79 | { | ||
80 | if ((tmpl_fd = open64(CT_TEMPLATE, O_RDWR)) == -1) { | ||
81 | error("%s: open %s: %s", __func__, | ||
82 | CT_TEMPLATE, strerror(errno)); | ||
83 | return; | ||
84 | } | ||
85 | |||
86 | debug2("%s: setting up process contract template on fd %d", | ||
87 | __func__, tmpl_fd); | ||
88 | |||
89 | /* First we set the template parameters and event sets. */ | ||
90 | if (ct_pr_tmpl_set_param(tmpl_fd, CT_PR_PGRPONLY) != 0) { | ||
91 | error("%s: Error setting process contract parameter set " | ||
92 | "(pgrponly): %s", __func__, strerror(errno)); | ||
93 | goto fail; | ||
94 | } | ||
95 | if (ct_pr_tmpl_set_fatal(tmpl_fd, CT_PR_EV_HWERR) != 0) { | ||
96 | error("%s: Error setting process contract template " | ||
97 | "fatal events: %s", __func__, strerror(errno)); | ||
98 | goto fail; | ||
99 | } | ||
100 | if (ct_tmpl_set_critical(tmpl_fd, 0) != 0) { | ||
101 | error("%s: Error setting process contract template " | ||
102 | "critical events: %s", __func__, strerror(errno)); | ||
103 | goto fail; | ||
104 | } | ||
105 | if (ct_tmpl_set_informative(tmpl_fd, CT_PR_EV_HWERR) != 0) { | ||
106 | error("%s: Error setting process contract template " | ||
107 | "informative events: %s", __func__, strerror(errno)); | ||
108 | goto fail; | ||
109 | } | ||
110 | |||
111 | /* Now make this the active template for this process. */ | ||
112 | if (ct_tmpl_activate(tmpl_fd) != 0) { | ||
113 | error("%s: Error activating process contract " | ||
114 | "template: %s", __func__, strerror(errno)); | ||
115 | goto fail; | ||
116 | } | ||
117 | return; | ||
118 | |||
119 | fail: | ||
120 | if (tmpl_fd != -1) { | ||
121 | close(tmpl_fd); | ||
122 | tmpl_fd = -1; | ||
123 | } | ||
124 | } | ||
125 | |||
126 | void | ||
127 | solaris_contract_post_fork_child() | ||
128 | { | ||
129 | debug2("%s: clearing process contract template on fd %d", | ||
130 | __func__, tmpl_fd); | ||
131 | |||
132 | /* Clear the active template. */ | ||
133 | if (ct_tmpl_clear(tmpl_fd) != 0) | ||
134 | error("%s: Error clearing active process contract " | ||
135 | "template: %s", __func__, strerror(errno)); | ||
136 | |||
137 | close(tmpl_fd); | ||
138 | tmpl_fd = -1; | ||
139 | } | ||
140 | |||
141 | void | ||
142 | solaris_contract_post_fork_parent(pid_t pid) | ||
143 | { | ||
144 | ctid_t ctid; | ||
145 | char ctl_path[256]; | ||
146 | int r, ctl_fd = -1, stat_fd = -1; | ||
147 | |||
148 | debug2("%s: clearing template (fd %d)", __func__, tmpl_fd); | ||
149 | |||
150 | if (tmpl_fd == -1) | ||
151 | return; | ||
152 | |||
153 | /* First clear the active template. */ | ||
154 | if ((r = ct_tmpl_clear(tmpl_fd)) != 0) | ||
155 | error("%s: Error clearing active process contract " | ||
156 | "template: %s", __func__, strerror(errno)); | ||
157 | |||
158 | close(tmpl_fd); | ||
159 | tmpl_fd = -1; | ||
160 | |||
161 | /* | ||
162 | * If either the fork didn't succeed (pid < 0), or clearing | ||
163 | * th active contract failed (r != 0), then we have nothing | ||
164 | * more do. | ||
165 | */ | ||
166 | if (r != 0 || pid <= 0) | ||
167 | return; | ||
168 | |||
169 | /* Now lookup and abandon the contract we've created. */ | ||
170 | ctid = get_active_process_contract_id(); | ||
171 | |||
172 | debug2("%s: abandoning contract id %ld", __func__, ctid); | ||
173 | |||
174 | snprintf(ctl_path, sizeof(ctl_path), | ||
175 | CTFS_ROOT "/process/%ld/ctl", ctid); | ||
176 | if ((ctl_fd = open64(ctl_path, O_WRONLY)) < 0) { | ||
177 | error("%s: Error opening process contract " | ||
178 | "ctl file: %s", __func__, strerror(errno)); | ||
179 | goto fail; | ||
180 | } | ||
181 | if (ct_ctl_abandon(ctl_fd) < 0) { | ||
182 | error("%s: Error abandoning process contract: %s", | ||
183 | __func__, strerror(errno)); | ||
184 | goto fail; | ||
185 | } | ||
186 | close(ctl_fd); | ||
187 | return; | ||
188 | |||
189 | fail: | ||
190 | if (tmpl_fd != -1) { | ||
191 | close(tmpl_fd); | ||
192 | tmpl_fd = -1; | ||
193 | } | ||
194 | if (stat_fd != -1) | ||
195 | close(stat_fd); | ||
196 | if (ctl_fd != -1) | ||
197 | close(ctl_fd); | ||
198 | } | ||
199 | #endif | ||
diff --git a/openbsd-compat/port-solaris.h b/openbsd-compat/port-solaris.h new file mode 100644 index 000000000..4c324871e --- /dev/null +++ b/openbsd-compat/port-solaris.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* $Id: port-solaris.h,v 1.1 2006/08/30 17:24:42 djm Exp $ */ | ||
2 | |||
3 | /* | ||
4 | * Copyright (c) 2006 Chad Mynhier. | ||
5 | * | ||
6 | * Permission to use, copy, modify, and distribute this software for any | ||
7 | * purpose with or without fee is hereby granted, provided that the above | ||
8 | * copyright notice and this permission notice appear in all copies. | ||
9 | * | ||
10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
17 | */ | ||
18 | |||
19 | #ifndef _PORT_SOLARIS_H | ||
20 | |||
21 | #include <sys/types.h> | ||
22 | |||
23 | void solaris_contract_pre_fork(void); | ||
24 | void solaris_contract_post_fork_child(void); | ||
25 | void solaris_contract_post_fork_parent(pid_t pid); | ||
26 | |||
27 | #endif | ||
diff --git a/openbsd-compat/port-tun.c b/openbsd-compat/port-tun.c index 31921615f..276474db8 100644 --- a/openbsd-compat/port-tun.c +++ b/openbsd-compat/port-tun.c | |||
@@ -16,9 +16,23 @@ | |||
16 | 16 | ||
17 | #include "includes.h" | 17 | #include "includes.h" |
18 | 18 | ||
19 | #include <sys/types.h> | ||
20 | #include <sys/ioctl.h> | ||
21 | |||
22 | #include <netinet/in.h> | ||
23 | #include <arpa/inet.h> | ||
24 | #include <netinet/ip.h> | ||
25 | |||
26 | #include <errno.h> | ||
27 | #include <fcntl.h> | ||
28 | #include <stdarg.h> | ||
29 | #include <string.h> | ||
30 | #include <unistd.h> | ||
31 | |||
19 | #include "log.h" | 32 | #include "log.h" |
20 | #include "misc.h" | 33 | #include "misc.h" |
21 | #include "bufaux.h" | 34 | #include "buffer.h" |
35 | #include "channels.h" | ||
22 | 36 | ||
23 | /* | 37 | /* |
24 | * This is the portable version of the SSH tunnel forwarding, it | 38 | * This is the portable version of the SSH tunnel forwarding, it |
@@ -26,6 +40,7 @@ | |||
26 | * settings. | 40 | * settings. |
27 | * | 41 | * |
28 | * SSH_TUN_LINUX Use the (newer) Linux tun/tap device | 42 | * SSH_TUN_LINUX Use the (newer) Linux tun/tap device |
43 | * SSH_TUN_FREEBSD Use the FreeBSD tun/tap device | ||
29 | * SSH_TUN_COMPAT_AF Translate the OpenBSD address family | 44 | * SSH_TUN_COMPAT_AF Translate the OpenBSD address family |
30 | * SSH_TUN_PREPEND_AF Prepend/remove the address family | 45 | * SSH_TUN_PREPEND_AF Prepend/remove the address family |
31 | */ | 46 | */ |
@@ -93,7 +108,10 @@ sys_tun_open(int tun, int mode) | |||
93 | #ifdef SSH_TUN_FREEBSD | 108 | #ifdef SSH_TUN_FREEBSD |
94 | #include <sys/socket.h> | 109 | #include <sys/socket.h> |
95 | #include <net/if.h> | 110 | #include <net/if.h> |
111 | |||
112 | #ifdef HAVE_NET_IF_TUN_H | ||
96 | #include <net/if_tun.h> | 113 | #include <net/if_tun.h> |
114 | #endif | ||
97 | 115 | ||
98 | int | 116 | int |
99 | sys_tun_open(int tun, int mode) | 117 | sys_tun_open(int tun, int mode) |
diff --git a/openbsd-compat/port-tun.h b/openbsd-compat/port-tun.h index 86d9272b4..c53df01fc 100644 --- a/openbsd-compat/port-tun.h +++ b/openbsd-compat/port-tun.h | |||
@@ -17,7 +17,7 @@ | |||
17 | #ifndef _PORT_TUN_H | 17 | #ifndef _PORT_TUN_H |
18 | #define _PORT_TUN_H | 18 | #define _PORT_TUN_H |
19 | 19 | ||
20 | #include "channels.h" | 20 | struct Channel; |
21 | 21 | ||
22 | #if defined(SSH_TUN_LINUX) || defined(SSH_TUN_FREEBSD) | 22 | #if defined(SSH_TUN_LINUX) || defined(SSH_TUN_FREEBSD) |
23 | # define CUSTOM_SYS_TUN_OPEN | 23 | # define CUSTOM_SYS_TUN_OPEN |
diff --git a/openbsd-compat/port-uw.c b/openbsd-compat/port-uw.c index c64427121..6f3523902 100644 --- a/openbsd-compat/port-uw.c +++ b/openbsd-compat/port-uw.c | |||
@@ -26,15 +26,26 @@ | |||
26 | #include "includes.h" | 26 | #include "includes.h" |
27 | 27 | ||
28 | #ifdef HAVE_LIBIAF | 28 | #ifdef HAVE_LIBIAF |
29 | #include <sys/types.h> | ||
29 | #ifdef HAVE_CRYPT_H | 30 | #ifdef HAVE_CRYPT_H |
30 | #include <crypt.h> | 31 | # include <crypt.h> |
31 | #endif | 32 | #endif |
33 | #include <pwd.h> | ||
34 | #include <stdarg.h> | ||
35 | #include <stdlib.h> | ||
36 | #include <stdio.h> | ||
37 | #include <string.h> | ||
38 | |||
39 | #include "xmalloc.h" | ||
32 | #include "packet.h" | 40 | #include "packet.h" |
33 | #include "buffer.h" | 41 | #include "buffer.h" |
42 | #include "auth-options.h" | ||
34 | #include "log.h" | 43 | #include "log.h" |
35 | #include "servconf.h" | 44 | #include "servconf.h" |
45 | #include "key.h" | ||
46 | #include "hostfile.h" | ||
36 | #include "auth.h" | 47 | #include "auth.h" |
37 | #include "auth-options.h" | 48 | #include "ssh.h" |
38 | 49 | ||
39 | int nischeck(char *); | 50 | int nischeck(char *); |
40 | 51 | ||
diff --git a/openbsd-compat/readpassphrase.c b/openbsd-compat/readpassphrase.c index 919c0174a..11bd8f646 100644 --- a/openbsd-compat/readpassphrase.c +++ b/openbsd-compat/readpassphrase.c | |||
@@ -27,7 +27,13 @@ | |||
27 | #ifndef HAVE_READPASSPHRASE | 27 | #ifndef HAVE_READPASSPHRASE |
28 | 28 | ||
29 | #include <termios.h> | 29 | #include <termios.h> |
30 | #include <signal.h> | ||
31 | #include <ctype.h> | ||
32 | #include <fcntl.h> | ||
30 | #include <readpassphrase.h> | 33 | #include <readpassphrase.h> |
34 | #include <errno.h> | ||
35 | #include <string.h> | ||
36 | #include <unistd.h> | ||
31 | 37 | ||
32 | #ifdef TCSASOFT | 38 | #ifdef TCSASOFT |
33 | # define _T_FLUSH (TCSAFLUSH|TCSASOFT) | 39 | # define _T_FLUSH (TCSAFLUSH|TCSASOFT) |
diff --git a/openbsd-compat/regress/Makefile.in b/openbsd-compat/regress/Makefile.in new file mode 100644 index 000000000..bcf214bd0 --- /dev/null +++ b/openbsd-compat/regress/Makefile.in | |||
@@ -0,0 +1,38 @@ | |||
1 | # $Id: Makefile.in,v 1.4 2006/08/19 09:12:14 dtucker Exp $ | ||
2 | |||
3 | sysconfdir=@sysconfdir@ | ||
4 | piddir=@piddir@ | ||
5 | srcdir=@srcdir@ | ||
6 | top_srcdir=@top_srcdir@ | ||
7 | |||
8 | VPATH=@srcdir@ | ||
9 | CC=@CC@ | ||
10 | LD=@LD@ | ||
11 | CFLAGS=@CFLAGS@ | ||
12 | CPPFLAGS=-I. -I.. -I$(srcdir) -I$(srcdir)/.. @CPPFLAGS@ @DEFS@ | ||
13 | EXEEXT=@EXEEXT@ | ||
14 | LIBCOMPAT=../libopenbsd-compat.a | ||
15 | LIBS=@LIBS@ | ||
16 | LDFLAGS=@LDFLAGS@ $(LIBCOMPAT) | ||
17 | |||
18 | TESTPROGS=closefromtest$(EXEEXT) snprintftest$(EXEEXT) strduptest$(EXEEXT) \ | ||
19 | strtonumtest$(EXEEXT) | ||
20 | |||
21 | all: t-exec ${OTHERTESTS} | ||
22 | |||
23 | %$(EXEEXT): %.c | ||
24 | $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $< $(LIBCOMPAT) $(LIBS) | ||
25 | |||
26 | t-exec: $(TESTPROGS) | ||
27 | @echo running compat regress tests | ||
28 | @for TEST in ""$?; do \ | ||
29 | echo "run test $${TEST}" ... 1>&2; \ | ||
30 | ./$${TEST}$(EXEEXT) || exit $$? ; \ | ||
31 | done | ||
32 | @echo finished compat regress tests | ||
33 | |||
34 | clean: | ||
35 | rm -f *.o *.a core $(TESTPROGS) valid.out | ||
36 | |||
37 | distclean: clean | ||
38 | rm -f Makefile *~ | ||
diff --git a/openbsd-compat/regress/closefromtest.c b/openbsd-compat/regress/closefromtest.c new file mode 100644 index 000000000..feb1b567d --- /dev/null +++ b/openbsd-compat/regress/closefromtest.c | |||
@@ -0,0 +1,60 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2006 Darren Tucker | ||
3 | * | ||
4 | * Permission to use, copy, modify, and distribute this software for any | ||
5 | * purpose with or without fee is hereby granted, provided that the above | ||
6 | * copyright notice and this permission notice appear in all copies. | ||
7 | * | ||
8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
15 | */ | ||
16 | |||
17 | #include <sys/types.h> | ||
18 | #include <sys/stat.h> | ||
19 | |||
20 | #include <fcntl.h> | ||
21 | #include <stdio.h> | ||
22 | #include <stdlib.h> | ||
23 | #include <unistd.h> | ||
24 | |||
25 | #define NUM_OPENS 10 | ||
26 | |||
27 | void | ||
28 | fail(char *msg) | ||
29 | { | ||
30 | fprintf(stderr, "closefrom: %s\n", msg); | ||
31 | exit(1); | ||
32 | } | ||
33 | |||
34 | int | ||
35 | main(void) | ||
36 | { | ||
37 | int i, max, fds[NUM_OPENS]; | ||
38 | char buf[512]; | ||
39 | |||
40 | for (i = 0; i < NUM_OPENS; i++) | ||
41 | if ((fds[i] = open("/dev/null", "r")) == -1) | ||
42 | exit(0); /* can't test */ | ||
43 | max = i - 1; | ||
44 | |||
45 | /* should close last fd only */ | ||
46 | closefrom(fds[max]); | ||
47 | if (close(fds[max]) != -1) | ||
48 | fail("failed to close highest fd"); | ||
49 | |||
50 | /* make sure we can still use remaining descriptors */ | ||
51 | for (i = 0; i < max; i++) | ||
52 | if (read(fds[i], buf, sizeof(buf)) == -1) | ||
53 | fail("closed descriptors it should not have"); | ||
54 | |||
55 | /* should close all fds */ | ||
56 | closefrom(fds[0]); | ||
57 | for (i = 0; i < NUM_OPENS; i++) | ||
58 | if (close(fds[i]) != -1) | ||
59 | fail("failed to close from lowest fd"); | ||
60 | } | ||
diff --git a/openbsd-compat/regress/snprintftest.c b/openbsd-compat/regress/snprintftest.c new file mode 100644 index 000000000..4ca63e180 --- /dev/null +++ b/openbsd-compat/regress/snprintftest.c | |||
@@ -0,0 +1,73 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2005 Darren Tucker | ||
3 | * Copyright (c) 2005 Damien Miller | ||
4 | * | ||
5 | * Permission to use, copy, modify, and distribute this software for any | ||
6 | * purpose with or without fee is hereby granted, provided that the above | ||
7 | * copyright notice and this permission notice appear in all copies. | ||
8 | * | ||
9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | */ | ||
17 | |||
18 | #define BUFSZ 2048 | ||
19 | |||
20 | #include <sys/types.h> | ||
21 | #include <stdlib.h> | ||
22 | #include <stdio.h> | ||
23 | #include <stdarg.h> | ||
24 | #include <string.h> | ||
25 | |||
26 | static int failed = 0; | ||
27 | |||
28 | static void | ||
29 | fail(const char *m) | ||
30 | { | ||
31 | fprintf(stderr, "snprintftest: %s\n", m); | ||
32 | failed = 1; | ||
33 | } | ||
34 | |||
35 | int x_snprintf(char *str, size_t count, const char *fmt, ...) | ||
36 | { | ||
37 | size_t ret; | ||
38 | va_list ap; | ||
39 | |||
40 | va_start(ap, fmt); | ||
41 | ret = vsnprintf(str, count, fmt, ap); | ||
42 | va_end(ap); | ||
43 | return ret; | ||
44 | } | ||
45 | |||
46 | int | ||
47 | main(void) | ||
48 | { | ||
49 | char b[5]; | ||
50 | char *src; | ||
51 | |||
52 | snprintf(b,5,"123456789"); | ||
53 | if (b[4] != '\0') | ||
54 | fail("snprintf does not correctly terminate long strings"); | ||
55 | |||
56 | /* check for read overrun on unterminated string */ | ||
57 | if ((src = malloc(BUFSZ)) == NULL) { | ||
58 | fail("malloc failed"); | ||
59 | } else { | ||
60 | memset(src, 'a', BUFSZ); | ||
61 | snprintf(b, sizeof(b), "%.*s", 1, src); | ||
62 | if (strcmp(b, "a") != 0) | ||
63 | fail("failed with length limit '%%.s'"); | ||
64 | } | ||
65 | |||
66 | /* check that snprintf and vsnprintf return sane values */ | ||
67 | if (snprintf(b, 1, "%s %d", "hello", 12345) != 11) | ||
68 | fail("snprintf does not return required length"); | ||
69 | if (x_snprintf(b, 1, "%s %d", "hello", 12345) != 11) | ||
70 | fail("vsnprintf does not return required length"); | ||
71 | |||
72 | return failed; | ||
73 | } | ||
diff --git a/openbsd-compat/regress/strduptest.c b/openbsd-compat/regress/strduptest.c new file mode 100644 index 000000000..7f6d779be --- /dev/null +++ b/openbsd-compat/regress/strduptest.c | |||
@@ -0,0 +1,45 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2005 Darren Tucker | ||
3 | * | ||
4 | * Permission to use, copy, modify, and distribute this software for any | ||
5 | * purpose with or without fee is hereby granted, provided that the above | ||
6 | * copyright notice and this permission notice appear in all copies. | ||
7 | * | ||
8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
15 | */ | ||
16 | |||
17 | #include <stdlib.h> | ||
18 | #include <string.h> | ||
19 | |||
20 | static int fail = 0; | ||
21 | |||
22 | void | ||
23 | test(const char *a) | ||
24 | { | ||
25 | char *b; | ||
26 | |||
27 | b = strdup(a); | ||
28 | if (b == 0) { | ||
29 | fail = 1; | ||
30 | return; | ||
31 | } | ||
32 | if (strcmp(a, b) != 0) | ||
33 | fail = 1; | ||
34 | free(b); | ||
35 | } | ||
36 | |||
37 | int | ||
38 | main(void) | ||
39 | { | ||
40 | test(""); | ||
41 | test("a"); | ||
42 | test("\0"); | ||
43 | test("abcdefghijklmnopqrstuvwxyz"); | ||
44 | return fail; | ||
45 | } | ||
diff --git a/openbsd-compat/regress/strtonumtest.c b/openbsd-compat/regress/strtonumtest.c new file mode 100644 index 000000000..cb8585129 --- /dev/null +++ b/openbsd-compat/regress/strtonumtest.c | |||
@@ -0,0 +1,66 @@ | |||
1 | /* $OpenBSD: strtonumtest.c,v 1.1 2004/08/03 20:38:36 otto Exp $ */ | ||
2 | /* | ||
3 | * Copyright (c) 2004 Otto Moerbeek <otto@drijf.net> | ||
4 | * | ||
5 | * Permission to use, copy, modify, and distribute this software for any | ||
6 | * purpose with or without fee is hereby granted, provided that the above | ||
7 | * copyright notice and this permission notice appear in all copies. | ||
8 | * | ||
9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | */ | ||
17 | |||
18 | /* OPENBSD ORIGINAL: regress/lib/libc/strtonum/strtonumtest.c */ | ||
19 | |||
20 | #include <limits.h> | ||
21 | #include <stdio.h> | ||
22 | #include <stdlib.h> | ||
23 | |||
24 | int fail; | ||
25 | |||
26 | void | ||
27 | test(const char *p, long long lb, long long ub, int ok) | ||
28 | { | ||
29 | long long val; | ||
30 | const char *q; | ||
31 | |||
32 | val = strtonum(p, lb, ub, &q); | ||
33 | if (ok && q != NULL) { | ||
34 | fprintf(stderr, "%s [%lld-%lld] ", p, lb, ub); | ||
35 | fprintf(stderr, "NUMBER NOT ACCEPTED %s\n", q); | ||
36 | fail = 1; | ||
37 | } else if (!ok && q == NULL) { | ||
38 | fprintf(stderr, "%s [%lld-%lld] %lld ", p, lb, ub, val); | ||
39 | fprintf(stderr, "NUMBER ACCEPTED\n"); | ||
40 | fail = 1; | ||
41 | } | ||
42 | } | ||
43 | |||
44 | int main(int argc, char *argv[]) | ||
45 | { | ||
46 | test("1", 0, 10, 1); | ||
47 | test("0", -2, 5, 1); | ||
48 | test("0", 2, 5, 0); | ||
49 | test("0", 2, LLONG_MAX, 0); | ||
50 | test("-2", 0, LLONG_MAX, 0); | ||
51 | test("0", -5, LLONG_MAX, 1); | ||
52 | test("-3", -3, LLONG_MAX, 1); | ||
53 | test("-9223372036854775808", LLONG_MIN, LLONG_MAX, 1); | ||
54 | test("9223372036854775807", LLONG_MIN, LLONG_MAX, 1); | ||
55 | test("-9223372036854775809", LLONG_MIN, LLONG_MAX, 0); | ||
56 | test("9223372036854775808", LLONG_MIN, LLONG_MAX, 0); | ||
57 | test("1000000000000000000000000", LLONG_MIN, LLONG_MAX, 0); | ||
58 | test("-1000000000000000000000000", LLONG_MIN, LLONG_MAX, 0); | ||
59 | test("-2", 10, -1, 0); | ||
60 | test("-2", -10, -1, 1); | ||
61 | test("-20", -10, -1, 0); | ||
62 | test("20", -10, -1, 0); | ||
63 | |||
64 | return (fail); | ||
65 | } | ||
66 | |||
diff --git a/openbsd-compat/rresvport.c b/openbsd-compat/rresvport.c index 71cf6e6eb..5b0275ce0 100644 --- a/openbsd-compat/rresvport.c +++ b/openbsd-compat/rresvport.c | |||
@@ -35,6 +35,16 @@ | |||
35 | 35 | ||
36 | #ifndef HAVE_RRESVPORT_AF | 36 | #ifndef HAVE_RRESVPORT_AF |
37 | 37 | ||
38 | #include <sys/types.h> | ||
39 | #include <sys/socket.h> | ||
40 | |||
41 | #include <netinet/in.h> | ||
42 | #include <arpa/inet.h> | ||
43 | |||
44 | #include <errno.h> | ||
45 | #include <stdlib.h> | ||
46 | #include <string.h> | ||
47 | |||
38 | #if 0 | 48 | #if 0 |
39 | int | 49 | int |
40 | rresvport(int *alport) | 50 | rresvport(int *alport) |
diff --git a/openbsd-compat/setproctitle.c b/openbsd-compat/setproctitle.c index 6e2b19bb4..b511f6649 100644 --- a/openbsd-compat/setproctitle.c +++ b/openbsd-compat/setproctitle.c | |||
@@ -35,10 +35,13 @@ | |||
35 | 35 | ||
36 | #ifndef HAVE_SETPROCTITLE | 36 | #ifndef HAVE_SETPROCTITLE |
37 | 37 | ||
38 | #include <stdarg.h> | ||
39 | #include <stdlib.h> | ||
38 | #include <unistd.h> | 40 | #include <unistd.h> |
39 | #ifdef HAVE_SYS_PSTAT_H | 41 | #ifdef HAVE_SYS_PSTAT_H |
40 | #include <sys/pstat.h> | 42 | #include <sys/pstat.h> |
41 | #endif | 43 | #endif |
44 | #include <string.h> | ||
42 | 45 | ||
43 | #define SPT_NONE 0 /* don't use it at all */ | 46 | #define SPT_NONE 0 /* don't use it at all */ |
44 | #define SPT_PSTAT 1 /* use pstat(PSTAT_SETCMD, ...) */ | 47 | #define SPT_PSTAT 1 /* use pstat(PSTAT_SETCMD, ...) */ |
@@ -80,7 +83,7 @@ compat_init_setproctitle(int argc, char *argv[]) | |||
80 | /* Fail if we can't allocate room for the new environment */ | 83 | /* Fail if we can't allocate room for the new environment */ |
81 | for (i = 0; envp[i] != NULL; i++) | 84 | for (i = 0; envp[i] != NULL; i++) |
82 | ; | 85 | ; |
83 | if ((environ = malloc(sizeof(*environ) * (i + 1))) == NULL) { | 86 | if ((environ = calloc(i + 1, sizeof(*environ))) == NULL) { |
84 | environ = envp; /* put it back */ | 87 | environ = envp; /* put it back */ |
85 | return; | 88 | return; |
86 | } | 89 | } |
diff --git a/openbsd-compat/sha2.c b/openbsd-compat/sha2.c new file mode 100755 index 000000000..cf8e0ad66 --- /dev/null +++ b/openbsd-compat/sha2.c | |||
@@ -0,0 +1,882 @@ | |||
1 | /* $OpenBSD: sha2.c,v 1.11 2005/08/08 08:05:35 espie Exp $ */ | ||
2 | |||
3 | /* | ||
4 | * FILE: sha2.c | ||
5 | * AUTHOR: Aaron D. Gifford <me@aarongifford.com> | ||
6 | * | ||
7 | * Copyright (c) 2000-2001, Aaron D. Gifford | ||
8 | * All rights reserved. | ||
9 | * | ||
10 | * Redistribution and use in source and binary forms, with or without | ||
11 | * modification, are permitted provided that the following conditions | ||
12 | * are met: | ||
13 | * 1. Redistributions of source code must retain the above copyright | ||
14 | * notice, this list of conditions and the following disclaimer. | ||
15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
16 | * notice, this list of conditions and the following disclaimer in the | ||
17 | * documentation and/or other materials provided with the distribution. | ||
18 | * 3. Neither the name of the copyright holder nor the names of contributors | ||
19 | * may be used to endorse or promote products derived from this software | ||
20 | * without specific prior written permission. | ||
21 | * | ||
22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND | ||
23 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
25 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTOR(S) BE LIABLE | ||
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
32 | * SUCH DAMAGE. | ||
33 | * | ||
34 | * $From: sha2.c,v 1.1 2001/11/08 00:01:51 adg Exp adg $ | ||
35 | */ | ||
36 | |||
37 | /* OPENBSD ORIGINAL: lib/libc/hash/sha2.c */ | ||
38 | |||
39 | #include "includes.h" | ||
40 | |||
41 | #include <openssl/opensslv.h> | ||
42 | |||
43 | #if !defined(HAVE_EVP_SHA256) && !defined(HAVE_SHA256_UPDATE) && \ | ||
44 | (OPENSSL_VERSION_NUMBER >= 0x00907000L) | ||
45 | #include <sys/types.h> | ||
46 | #include <string.h> | ||
47 | #include "sha2.h" | ||
48 | |||
49 | /* | ||
50 | * UNROLLED TRANSFORM LOOP NOTE: | ||
51 | * You can define SHA2_UNROLL_TRANSFORM to use the unrolled transform | ||
52 | * loop version for the hash transform rounds (defined using macros | ||
53 | * later in this file). Either define on the command line, for example: | ||
54 | * | ||
55 | * cc -DSHA2_UNROLL_TRANSFORM -o sha2 sha2.c sha2prog.c | ||
56 | * | ||
57 | * or define below: | ||
58 | * | ||
59 | * #define SHA2_UNROLL_TRANSFORM | ||
60 | * | ||
61 | */ | ||
62 | |||
63 | /*** SHA-256/384/512 Machine Architecture Definitions *****************/ | ||
64 | /* | ||
65 | * BYTE_ORDER NOTE: | ||
66 | * | ||
67 | * Please make sure that your system defines BYTE_ORDER. If your | ||
68 | * architecture is little-endian, make sure it also defines | ||
69 | * LITTLE_ENDIAN and that the two (BYTE_ORDER and LITTLE_ENDIAN) are | ||
70 | * equivilent. | ||
71 | * | ||
72 | * If your system does not define the above, then you can do so by | ||
73 | * hand like this: | ||
74 | * | ||
75 | * #define LITTLE_ENDIAN 1234 | ||
76 | * #define BIG_ENDIAN 4321 | ||
77 | * | ||
78 | * And for little-endian machines, add: | ||
79 | * | ||
80 | * #define BYTE_ORDER LITTLE_ENDIAN | ||
81 | * | ||
82 | * Or for big-endian machines: | ||
83 | * | ||
84 | * #define BYTE_ORDER BIG_ENDIAN | ||
85 | * | ||
86 | * The FreeBSD machine this was written on defines BYTE_ORDER | ||
87 | * appropriately by including <sys/types.h> (which in turn includes | ||
88 | * <machine/endian.h> where the appropriate definitions are actually | ||
89 | * made). | ||
90 | */ | ||
91 | #if !defined(BYTE_ORDER) || (BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != BIG_ENDIAN) | ||
92 | #error Define BYTE_ORDER to be equal to either LITTLE_ENDIAN or BIG_ENDIAN | ||
93 | #endif | ||
94 | |||
95 | |||
96 | /*** SHA-256/384/512 Various Length Definitions ***********************/ | ||
97 | /* NOTE: Most of these are in sha2.h */ | ||
98 | #define SHA256_SHORT_BLOCK_LENGTH (SHA256_BLOCK_LENGTH - 8) | ||
99 | #define SHA384_SHORT_BLOCK_LENGTH (SHA384_BLOCK_LENGTH - 16) | ||
100 | #define SHA512_SHORT_BLOCK_LENGTH (SHA512_BLOCK_LENGTH - 16) | ||
101 | |||
102 | /*** ENDIAN SPECIFIC COPY MACROS **************************************/ | ||
103 | #define BE_8_TO_32(dst, cp) do { \ | ||
104 | (dst) = (u_int32_t)(cp)[3] | ((u_int32_t)(cp)[2] << 8) | \ | ||
105 | ((u_int32_t)(cp)[1] << 16) | ((u_int32_t)(cp)[0] << 24); \ | ||
106 | } while(0) | ||
107 | |||
108 | #define BE_8_TO_64(dst, cp) do { \ | ||
109 | (dst) = (u_int64_t)(cp)[7] | ((u_int64_t)(cp)[6] << 8) | \ | ||
110 | ((u_int64_t)(cp)[5] << 16) | ((u_int64_t)(cp)[4] << 24) | \ | ||
111 | ((u_int64_t)(cp)[3] << 32) | ((u_int64_t)(cp)[2] << 40) | \ | ||
112 | ((u_int64_t)(cp)[1] << 48) | ((u_int64_t)(cp)[0] << 56); \ | ||
113 | } while (0) | ||
114 | |||
115 | #define BE_64_TO_8(cp, src) do { \ | ||
116 | (cp)[0] = (src) >> 56; \ | ||
117 | (cp)[1] = (src) >> 48; \ | ||
118 | (cp)[2] = (src) >> 40; \ | ||
119 | (cp)[3] = (src) >> 32; \ | ||
120 | (cp)[4] = (src) >> 24; \ | ||
121 | (cp)[5] = (src) >> 16; \ | ||
122 | (cp)[6] = (src) >> 8; \ | ||
123 | (cp)[7] = (src); \ | ||
124 | } while (0) | ||
125 | |||
126 | #define BE_32_TO_8(cp, src) do { \ | ||
127 | (cp)[0] = (src) >> 24; \ | ||
128 | (cp)[1] = (src) >> 16; \ | ||
129 | (cp)[2] = (src) >> 8; \ | ||
130 | (cp)[3] = (src); \ | ||
131 | } while (0) | ||
132 | |||
133 | /* | ||
134 | * Macro for incrementally adding the unsigned 64-bit integer n to the | ||
135 | * unsigned 128-bit integer (represented using a two-element array of | ||
136 | * 64-bit words): | ||
137 | */ | ||
138 | #define ADDINC128(w,n) do { \ | ||
139 | (w)[0] += (u_int64_t)(n); \ | ||
140 | if ((w)[0] < (n)) { \ | ||
141 | (w)[1]++; \ | ||
142 | } \ | ||
143 | } while (0) | ||
144 | |||
145 | /*** THE SIX LOGICAL FUNCTIONS ****************************************/ | ||
146 | /* | ||
147 | * Bit shifting and rotation (used by the six SHA-XYZ logical functions: | ||
148 | * | ||
149 | * NOTE: The naming of R and S appears backwards here (R is a SHIFT and | ||
150 | * S is a ROTATION) because the SHA-256/384/512 description document | ||
151 | * (see http://csrc.nist.gov/cryptval/shs/sha256-384-512.pdf) uses this | ||
152 | * same "backwards" definition. | ||
153 | */ | ||
154 | /* Shift-right (used in SHA-256, SHA-384, and SHA-512): */ | ||
155 | #define R(b,x) ((x) >> (b)) | ||
156 | /* 32-bit Rotate-right (used in SHA-256): */ | ||
157 | #define S32(b,x) (((x) >> (b)) | ((x) << (32 - (b)))) | ||
158 | /* 64-bit Rotate-right (used in SHA-384 and SHA-512): */ | ||
159 | #define S64(b,x) (((x) >> (b)) | ((x) << (64 - (b)))) | ||
160 | |||
161 | /* Two of six logical functions used in SHA-256, SHA-384, and SHA-512: */ | ||
162 | #define Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z))) | ||
163 | #define Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) | ||
164 | |||
165 | /* Four of six logical functions used in SHA-256: */ | ||
166 | #define Sigma0_256(x) (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x))) | ||
167 | #define Sigma1_256(x) (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x))) | ||
168 | #define sigma0_256(x) (S32(7, (x)) ^ S32(18, (x)) ^ R(3 , (x))) | ||
169 | #define sigma1_256(x) (S32(17, (x)) ^ S32(19, (x)) ^ R(10, (x))) | ||
170 | |||
171 | /* Four of six logical functions used in SHA-384 and SHA-512: */ | ||
172 | #define Sigma0_512(x) (S64(28, (x)) ^ S64(34, (x)) ^ S64(39, (x))) | ||
173 | #define Sigma1_512(x) (S64(14, (x)) ^ S64(18, (x)) ^ S64(41, (x))) | ||
174 | #define sigma0_512(x) (S64( 1, (x)) ^ S64( 8, (x)) ^ R( 7, (x))) | ||
175 | #define sigma1_512(x) (S64(19, (x)) ^ S64(61, (x)) ^ R( 6, (x))) | ||
176 | |||
177 | |||
178 | /*** SHA-XYZ INITIAL HASH VALUES AND CONSTANTS ************************/ | ||
179 | /* Hash constant words K for SHA-256: */ | ||
180 | const static u_int32_t K256[64] = { | ||
181 | 0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL, | ||
182 | 0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL, | ||
183 | 0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL, | ||
184 | 0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL, 0xc19bf174UL, | ||
185 | 0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL, | ||
186 | 0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL, | ||
187 | 0x983e5152UL, 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL, | ||
188 | 0xc6e00bf3UL, 0xd5a79147UL, 0x06ca6351UL, 0x14292967UL, | ||
189 | 0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL, 0x53380d13UL, | ||
190 | 0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL, | ||
191 | 0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL, | ||
192 | 0xd192e819UL, 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL, | ||
193 | 0x19a4c116UL, 0x1e376c08UL, 0x2748774cUL, 0x34b0bcb5UL, | ||
194 | 0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL, 0x682e6ff3UL, | ||
195 | 0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL, | ||
196 | 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL | ||
197 | }; | ||
198 | |||
199 | /* Initial hash value H for SHA-256: */ | ||
200 | const static u_int32_t sha256_initial_hash_value[8] = { | ||
201 | 0x6a09e667UL, | ||
202 | 0xbb67ae85UL, | ||
203 | 0x3c6ef372UL, | ||
204 | 0xa54ff53aUL, | ||
205 | 0x510e527fUL, | ||
206 | 0x9b05688cUL, | ||
207 | 0x1f83d9abUL, | ||
208 | 0x5be0cd19UL | ||
209 | }; | ||
210 | |||
211 | /* Hash constant words K for SHA-384 and SHA-512: */ | ||
212 | const static u_int64_t K512[80] = { | ||
213 | 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL, | ||
214 | 0xb5c0fbcfec4d3b2fULL, 0xe9b5dba58189dbbcULL, | ||
215 | 0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL, | ||
216 | 0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL, | ||
217 | 0xd807aa98a3030242ULL, 0x12835b0145706fbeULL, | ||
218 | 0x243185be4ee4b28cULL, 0x550c7dc3d5ffb4e2ULL, | ||
219 | 0x72be5d74f27b896fULL, 0x80deb1fe3b1696b1ULL, | ||
220 | 0x9bdc06a725c71235ULL, 0xc19bf174cf692694ULL, | ||
221 | 0xe49b69c19ef14ad2ULL, 0xefbe4786384f25e3ULL, | ||
222 | 0x0fc19dc68b8cd5b5ULL, 0x240ca1cc77ac9c65ULL, | ||
223 | 0x2de92c6f592b0275ULL, 0x4a7484aa6ea6e483ULL, | ||
224 | 0x5cb0a9dcbd41fbd4ULL, 0x76f988da831153b5ULL, | ||
225 | 0x983e5152ee66dfabULL, 0xa831c66d2db43210ULL, | ||
226 | 0xb00327c898fb213fULL, 0xbf597fc7beef0ee4ULL, | ||
227 | 0xc6e00bf33da88fc2ULL, 0xd5a79147930aa725ULL, | ||
228 | 0x06ca6351e003826fULL, 0x142929670a0e6e70ULL, | ||
229 | 0x27b70a8546d22ffcULL, 0x2e1b21385c26c926ULL, | ||
230 | 0x4d2c6dfc5ac42aedULL, 0x53380d139d95b3dfULL, | ||
231 | 0x650a73548baf63deULL, 0x766a0abb3c77b2a8ULL, | ||
232 | 0x81c2c92e47edaee6ULL, 0x92722c851482353bULL, | ||
233 | 0xa2bfe8a14cf10364ULL, 0xa81a664bbc423001ULL, | ||
234 | 0xc24b8b70d0f89791ULL, 0xc76c51a30654be30ULL, | ||
235 | 0xd192e819d6ef5218ULL, 0xd69906245565a910ULL, | ||
236 | 0xf40e35855771202aULL, 0x106aa07032bbd1b8ULL, | ||
237 | 0x19a4c116b8d2d0c8ULL, 0x1e376c085141ab53ULL, | ||
238 | 0x2748774cdf8eeb99ULL, 0x34b0bcb5e19b48a8ULL, | ||
239 | 0x391c0cb3c5c95a63ULL, 0x4ed8aa4ae3418acbULL, | ||
240 | 0x5b9cca4f7763e373ULL, 0x682e6ff3d6b2b8a3ULL, | ||
241 | 0x748f82ee5defb2fcULL, 0x78a5636f43172f60ULL, | ||
242 | 0x84c87814a1f0ab72ULL, 0x8cc702081a6439ecULL, | ||
243 | 0x90befffa23631e28ULL, 0xa4506cebde82bde9ULL, | ||
244 | 0xbef9a3f7b2c67915ULL, 0xc67178f2e372532bULL, | ||
245 | 0xca273eceea26619cULL, 0xd186b8c721c0c207ULL, | ||
246 | 0xeada7dd6cde0eb1eULL, 0xf57d4f7fee6ed178ULL, | ||
247 | 0x06f067aa72176fbaULL, 0x0a637dc5a2c898a6ULL, | ||
248 | 0x113f9804bef90daeULL, 0x1b710b35131c471bULL, | ||
249 | 0x28db77f523047d84ULL, 0x32caab7b40c72493ULL, | ||
250 | 0x3c9ebe0a15c9bebcULL, 0x431d67c49c100d4cULL, | ||
251 | 0x4cc5d4becb3e42b6ULL, 0x597f299cfc657e2aULL, | ||
252 | 0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL | ||
253 | }; | ||
254 | |||
255 | /* Initial hash value H for SHA-384 */ | ||
256 | const static u_int64_t sha384_initial_hash_value[8] = { | ||
257 | 0xcbbb9d5dc1059ed8ULL, | ||
258 | 0x629a292a367cd507ULL, | ||
259 | 0x9159015a3070dd17ULL, | ||
260 | 0x152fecd8f70e5939ULL, | ||
261 | 0x67332667ffc00b31ULL, | ||
262 | 0x8eb44a8768581511ULL, | ||
263 | 0xdb0c2e0d64f98fa7ULL, | ||
264 | 0x47b5481dbefa4fa4ULL | ||
265 | }; | ||
266 | |||
267 | /* Initial hash value H for SHA-512 */ | ||
268 | const static u_int64_t sha512_initial_hash_value[8] = { | ||
269 | 0x6a09e667f3bcc908ULL, | ||
270 | 0xbb67ae8584caa73bULL, | ||
271 | 0x3c6ef372fe94f82bULL, | ||
272 | 0xa54ff53a5f1d36f1ULL, | ||
273 | 0x510e527fade682d1ULL, | ||
274 | 0x9b05688c2b3e6c1fULL, | ||
275 | 0x1f83d9abfb41bd6bULL, | ||
276 | 0x5be0cd19137e2179ULL | ||
277 | }; | ||
278 | |||
279 | |||
280 | /*** SHA-256: *********************************************************/ | ||
281 | void | ||
282 | SHA256_Init(SHA256_CTX *context) | ||
283 | { | ||
284 | if (context == NULL) | ||
285 | return; | ||
286 | memcpy(context->state, sha256_initial_hash_value, | ||
287 | sizeof(sha256_initial_hash_value)); | ||
288 | memset(context->buffer, 0, sizeof(context->buffer)); | ||
289 | context->bitcount = 0; | ||
290 | } | ||
291 | |||
292 | #ifdef SHA2_UNROLL_TRANSFORM | ||
293 | |||
294 | /* Unrolled SHA-256 round macros: */ | ||
295 | |||
296 | #define ROUND256_0_TO_15(a,b,c,d,e,f,g,h) do { \ | ||
297 | BE_8_TO_32(W256[j], data); \ | ||
298 | data += 4; \ | ||
299 | T1 = (h) + Sigma1_256((e)) + Ch((e), (f), (g)) + K256[j] + W256[j]; \ | ||
300 | (d) += T1; \ | ||
301 | (h) = T1 + Sigma0_256((a)) + Maj((a), (b), (c)); \ | ||
302 | j++; \ | ||
303 | } while(0) | ||
304 | |||
305 | #define ROUND256(a,b,c,d,e,f,g,h) do { \ | ||
306 | s0 = W256[(j+1)&0x0f]; \ | ||
307 | s0 = sigma0_256(s0); \ | ||
308 | s1 = W256[(j+14)&0x0f]; \ | ||
309 | s1 = sigma1_256(s1); \ | ||
310 | T1 = (h) + Sigma1_256((e)) + Ch((e), (f), (g)) + K256[j] + \ | ||
311 | (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0); \ | ||
312 | (d) += T1; \ | ||
313 | (h) = T1 + Sigma0_256((a)) + Maj((a), (b), (c)); \ | ||
314 | j++; \ | ||
315 | } while(0) | ||
316 | |||
317 | void | ||
318 | SHA256_Transform(u_int32_t state[8], const u_int8_t data[SHA256_BLOCK_LENGTH]) | ||
319 | { | ||
320 | u_int32_t a, b, c, d, e, f, g, h, s0, s1; | ||
321 | u_int32_t T1, W256[16]; | ||
322 | int j; | ||
323 | |||
324 | /* Initialize registers with the prev. intermediate value */ | ||
325 | a = state[0]; | ||
326 | b = state[1]; | ||
327 | c = state[2]; | ||
328 | d = state[3]; | ||
329 | e = state[4]; | ||
330 | f = state[5]; | ||
331 | g = state[6]; | ||
332 | h = state[7]; | ||
333 | |||
334 | j = 0; | ||
335 | do { | ||
336 | /* Rounds 0 to 15 (unrolled): */ | ||
337 | ROUND256_0_TO_15(a,b,c,d,e,f,g,h); | ||
338 | ROUND256_0_TO_15(h,a,b,c,d,e,f,g); | ||
339 | ROUND256_0_TO_15(g,h,a,b,c,d,e,f); | ||
340 | ROUND256_0_TO_15(f,g,h,a,b,c,d,e); | ||
341 | ROUND256_0_TO_15(e,f,g,h,a,b,c,d); | ||
342 | ROUND256_0_TO_15(d,e,f,g,h,a,b,c); | ||
343 | ROUND256_0_TO_15(c,d,e,f,g,h,a,b); | ||
344 | ROUND256_0_TO_15(b,c,d,e,f,g,h,a); | ||
345 | } while (j < 16); | ||
346 | |||
347 | /* Now for the remaining rounds up to 63: */ | ||
348 | do { | ||
349 | ROUND256(a,b,c,d,e,f,g,h); | ||
350 | ROUND256(h,a,b,c,d,e,f,g); | ||
351 | ROUND256(g,h,a,b,c,d,e,f); | ||
352 | ROUND256(f,g,h,a,b,c,d,e); | ||
353 | ROUND256(e,f,g,h,a,b,c,d); | ||
354 | ROUND256(d,e,f,g,h,a,b,c); | ||
355 | ROUND256(c,d,e,f,g,h,a,b); | ||
356 | ROUND256(b,c,d,e,f,g,h,a); | ||
357 | } while (j < 64); | ||
358 | |||
359 | /* Compute the current intermediate hash value */ | ||
360 | state[0] += a; | ||
361 | state[1] += b; | ||
362 | state[2] += c; | ||
363 | state[3] += d; | ||
364 | state[4] += e; | ||
365 | state[5] += f; | ||
366 | state[6] += g; | ||
367 | state[7] += h; | ||
368 | |||
369 | /* Clean up */ | ||
370 | a = b = c = d = e = f = g = h = T1 = 0; | ||
371 | } | ||
372 | |||
373 | #else /* SHA2_UNROLL_TRANSFORM */ | ||
374 | |||
375 | void | ||
376 | SHA256_Transform(u_int32_t state[8], const u_int8_t data[SHA256_BLOCK_LENGTH]) | ||
377 | { | ||
378 | u_int32_t a, b, c, d, e, f, g, h, s0, s1; | ||
379 | u_int32_t T1, T2, W256[16]; | ||
380 | int j; | ||
381 | |||
382 | /* Initialize registers with the prev. intermediate value */ | ||
383 | a = state[0]; | ||
384 | b = state[1]; | ||
385 | c = state[2]; | ||
386 | d = state[3]; | ||
387 | e = state[4]; | ||
388 | f = state[5]; | ||
389 | g = state[6]; | ||
390 | h = state[7]; | ||
391 | |||
392 | j = 0; | ||
393 | do { | ||
394 | BE_8_TO_32(W256[j], data); | ||
395 | data += 4; | ||
396 | /* Apply the SHA-256 compression function to update a..h */ | ||
397 | T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + W256[j]; | ||
398 | T2 = Sigma0_256(a) + Maj(a, b, c); | ||
399 | h = g; | ||
400 | g = f; | ||
401 | f = e; | ||
402 | e = d + T1; | ||
403 | d = c; | ||
404 | c = b; | ||
405 | b = a; | ||
406 | a = T1 + T2; | ||
407 | |||
408 | j++; | ||
409 | } while (j < 16); | ||
410 | |||
411 | do { | ||
412 | /* Part of the message block expansion: */ | ||
413 | s0 = W256[(j+1)&0x0f]; | ||
414 | s0 = sigma0_256(s0); | ||
415 | s1 = W256[(j+14)&0x0f]; | ||
416 | s1 = sigma1_256(s1); | ||
417 | |||
418 | /* Apply the SHA-256 compression function to update a..h */ | ||
419 | T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + | ||
420 | (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0); | ||
421 | T2 = Sigma0_256(a) + Maj(a, b, c); | ||
422 | h = g; | ||
423 | g = f; | ||
424 | f = e; | ||
425 | e = d + T1; | ||
426 | d = c; | ||
427 | c = b; | ||
428 | b = a; | ||
429 | a = T1 + T2; | ||
430 | |||
431 | j++; | ||
432 | } while (j < 64); | ||
433 | |||
434 | /* Compute the current intermediate hash value */ | ||
435 | state[0] += a; | ||
436 | state[1] += b; | ||
437 | state[2] += c; | ||
438 | state[3] += d; | ||
439 | state[4] += e; | ||
440 | state[5] += f; | ||
441 | state[6] += g; | ||
442 | state[7] += h; | ||
443 | |||
444 | /* Clean up */ | ||
445 | a = b = c = d = e = f = g = h = T1 = T2 = 0; | ||
446 | } | ||
447 | |||
448 | #endif /* SHA2_UNROLL_TRANSFORM */ | ||
449 | |||
450 | void | ||
451 | SHA256_Update(SHA256_CTX *context, const u_int8_t *data, size_t len) | ||
452 | { | ||
453 | size_t freespace, usedspace; | ||
454 | |||
455 | /* Calling with no data is valid (we do nothing) */ | ||
456 | if (len == 0) | ||
457 | return; | ||
458 | |||
459 | usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH; | ||
460 | if (usedspace > 0) { | ||
461 | /* Calculate how much free space is available in the buffer */ | ||
462 | freespace = SHA256_BLOCK_LENGTH - usedspace; | ||
463 | |||
464 | if (len >= freespace) { | ||
465 | /* Fill the buffer completely and process it */ | ||
466 | memcpy(&context->buffer[usedspace], data, freespace); | ||
467 | context->bitcount += freespace << 3; | ||
468 | len -= freespace; | ||
469 | data += freespace; | ||
470 | SHA256_Transform(context->state, context->buffer); | ||
471 | } else { | ||
472 | /* The buffer is not yet full */ | ||
473 | memcpy(&context->buffer[usedspace], data, len); | ||
474 | context->bitcount += len << 3; | ||
475 | /* Clean up: */ | ||
476 | usedspace = freespace = 0; | ||
477 | return; | ||
478 | } | ||
479 | } | ||
480 | while (len >= SHA256_BLOCK_LENGTH) { | ||
481 | /* Process as many complete blocks as we can */ | ||
482 | SHA256_Transform(context->state, data); | ||
483 | context->bitcount += SHA256_BLOCK_LENGTH << 3; | ||
484 | len -= SHA256_BLOCK_LENGTH; | ||
485 | data += SHA256_BLOCK_LENGTH; | ||
486 | } | ||
487 | if (len > 0) { | ||
488 | /* There's left-overs, so save 'em */ | ||
489 | memcpy(context->buffer, data, len); | ||
490 | context->bitcount += len << 3; | ||
491 | } | ||
492 | /* Clean up: */ | ||
493 | usedspace = freespace = 0; | ||
494 | } | ||
495 | |||
496 | void | ||
497 | SHA256_Pad(SHA256_CTX *context) | ||
498 | { | ||
499 | unsigned int usedspace; | ||
500 | |||
501 | usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH; | ||
502 | if (usedspace > 0) { | ||
503 | /* Begin padding with a 1 bit: */ | ||
504 | context->buffer[usedspace++] = 0x80; | ||
505 | |||
506 | if (usedspace <= SHA256_SHORT_BLOCK_LENGTH) { | ||
507 | /* Set-up for the last transform: */ | ||
508 | memset(&context->buffer[usedspace], 0, | ||
509 | SHA256_SHORT_BLOCK_LENGTH - usedspace); | ||
510 | } else { | ||
511 | if (usedspace < SHA256_BLOCK_LENGTH) { | ||
512 | memset(&context->buffer[usedspace], 0, | ||
513 | SHA256_BLOCK_LENGTH - usedspace); | ||
514 | } | ||
515 | /* Do second-to-last transform: */ | ||
516 | SHA256_Transform(context->state, context->buffer); | ||
517 | |||
518 | /* Prepare for last transform: */ | ||
519 | memset(context->buffer, 0, SHA256_SHORT_BLOCK_LENGTH); | ||
520 | } | ||
521 | } else { | ||
522 | /* Set-up for the last transform: */ | ||
523 | memset(context->buffer, 0, SHA256_SHORT_BLOCK_LENGTH); | ||
524 | |||
525 | /* Begin padding with a 1 bit: */ | ||
526 | *context->buffer = 0x80; | ||
527 | } | ||
528 | /* Store the length of input data (in bits) in big endian format: */ | ||
529 | BE_64_TO_8(&context->buffer[SHA256_SHORT_BLOCK_LENGTH], | ||
530 | context->bitcount); | ||
531 | |||
532 | /* Final transform: */ | ||
533 | SHA256_Transform(context->state, context->buffer); | ||
534 | |||
535 | /* Clean up: */ | ||
536 | usedspace = 0; | ||
537 | } | ||
538 | |||
539 | void | ||
540 | SHA256_Final(u_int8_t digest[SHA256_DIGEST_LENGTH], SHA256_CTX *context) | ||
541 | { | ||
542 | SHA256_Pad(context); | ||
543 | |||
544 | /* If no digest buffer is passed, we don't bother doing this: */ | ||
545 | if (digest != NULL) { | ||
546 | #if BYTE_ORDER == LITTLE_ENDIAN | ||
547 | int i; | ||
548 | |||
549 | /* Convert TO host byte order */ | ||
550 | for (i = 0; i < 8; i++) | ||
551 | BE_32_TO_8(digest + i * 4, context->state[i]); | ||
552 | #else | ||
553 | memcpy(digest, context->state, SHA256_DIGEST_LENGTH); | ||
554 | #endif | ||
555 | memset(context, 0, sizeof(*context)); | ||
556 | } | ||
557 | } | ||
558 | |||
559 | |||
560 | /*** SHA-512: *********************************************************/ | ||
561 | void | ||
562 | SHA512_Init(SHA512_CTX *context) | ||
563 | { | ||
564 | if (context == NULL) | ||
565 | return; | ||
566 | memcpy(context->state, sha512_initial_hash_value, | ||
567 | sizeof(sha512_initial_hash_value)); | ||
568 | memset(context->buffer, 0, sizeof(context->buffer)); | ||
569 | context->bitcount[0] = context->bitcount[1] = 0; | ||
570 | } | ||
571 | |||
572 | #ifdef SHA2_UNROLL_TRANSFORM | ||
573 | |||
574 | /* Unrolled SHA-512 round macros: */ | ||
575 | |||
576 | #define ROUND512_0_TO_15(a,b,c,d,e,f,g,h) do { \ | ||
577 | BE_8_TO_64(W512[j], data); \ | ||
578 | data += 8; \ | ||
579 | T1 = (h) + Sigma1_512((e)) + Ch((e), (f), (g)) + K512[j] + W512[j]; \ | ||
580 | (d) += T1; \ | ||
581 | (h) = T1 + Sigma0_512((a)) + Maj((a), (b), (c)); \ | ||
582 | j++; \ | ||
583 | } while(0) | ||
584 | |||
585 | |||
586 | #define ROUND512(a,b,c,d,e,f,g,h) do { \ | ||
587 | s0 = W512[(j+1)&0x0f]; \ | ||
588 | s0 = sigma0_512(s0); \ | ||
589 | s1 = W512[(j+14)&0x0f]; \ | ||
590 | s1 = sigma1_512(s1); \ | ||
591 | T1 = (h) + Sigma1_512((e)) + Ch((e), (f), (g)) + K512[j] + \ | ||
592 | (W512[j&0x0f] += s1 + W512[(j+9)&0x0f] + s0); \ | ||
593 | (d) += T1; \ | ||
594 | (h) = T1 + Sigma0_512((a)) + Maj((a), (b), (c)); \ | ||
595 | j++; \ | ||
596 | } while(0) | ||
597 | |||
598 | void | ||
599 | SHA512_Transform(u_int64_t state[8], const u_int8_t data[SHA512_BLOCK_LENGTH]) | ||
600 | { | ||
601 | u_int64_t a, b, c, d, e, f, g, h, s0, s1; | ||
602 | u_int64_t T1, W512[16]; | ||
603 | int j; | ||
604 | |||
605 | /* Initialize registers with the prev. intermediate value */ | ||
606 | a = state[0]; | ||
607 | b = state[1]; | ||
608 | c = state[2]; | ||
609 | d = state[3]; | ||
610 | e = state[4]; | ||
611 | f = state[5]; | ||
612 | g = state[6]; | ||
613 | h = state[7]; | ||
614 | |||
615 | j = 0; | ||
616 | do { | ||
617 | /* Rounds 0 to 15 (unrolled): */ | ||
618 | ROUND512_0_TO_15(a,b,c,d,e,f,g,h); | ||
619 | ROUND512_0_TO_15(h,a,b,c,d,e,f,g); | ||
620 | ROUND512_0_TO_15(g,h,a,b,c,d,e,f); | ||
621 | ROUND512_0_TO_15(f,g,h,a,b,c,d,e); | ||
622 | ROUND512_0_TO_15(e,f,g,h,a,b,c,d); | ||
623 | ROUND512_0_TO_15(d,e,f,g,h,a,b,c); | ||
624 | ROUND512_0_TO_15(c,d,e,f,g,h,a,b); | ||
625 | ROUND512_0_TO_15(b,c,d,e,f,g,h,a); | ||
626 | } while (j < 16); | ||
627 | |||
628 | /* Now for the remaining rounds up to 79: */ | ||
629 | do { | ||
630 | ROUND512(a,b,c,d,e,f,g,h); | ||
631 | ROUND512(h,a,b,c,d,e,f,g); | ||
632 | ROUND512(g,h,a,b,c,d,e,f); | ||
633 | ROUND512(f,g,h,a,b,c,d,e); | ||
634 | ROUND512(e,f,g,h,a,b,c,d); | ||
635 | ROUND512(d,e,f,g,h,a,b,c); | ||
636 | ROUND512(c,d,e,f,g,h,a,b); | ||
637 | ROUND512(b,c,d,e,f,g,h,a); | ||
638 | } while (j < 80); | ||
639 | |||
640 | /* Compute the current intermediate hash value */ | ||
641 | state[0] += a; | ||
642 | state[1] += b; | ||
643 | state[2] += c; | ||
644 | state[3] += d; | ||
645 | state[4] += e; | ||
646 | state[5] += f; | ||
647 | state[6] += g; | ||
648 | state[7] += h; | ||
649 | |||
650 | /* Clean up */ | ||
651 | a = b = c = d = e = f = g = h = T1 = 0; | ||
652 | } | ||
653 | |||
654 | #else /* SHA2_UNROLL_TRANSFORM */ | ||
655 | |||
656 | void | ||
657 | SHA512_Transform(u_int64_t state[8], const u_int8_t data[SHA512_BLOCK_LENGTH]) | ||
658 | { | ||
659 | u_int64_t a, b, c, d, e, f, g, h, s0, s1; | ||
660 | u_int64_t T1, T2, W512[16]; | ||
661 | int j; | ||
662 | |||
663 | /* Initialize registers with the prev. intermediate value */ | ||
664 | a = state[0]; | ||
665 | b = state[1]; | ||
666 | c = state[2]; | ||
667 | d = state[3]; | ||
668 | e = state[4]; | ||
669 | f = state[5]; | ||
670 | g = state[6]; | ||
671 | h = state[7]; | ||
672 | |||
673 | j = 0; | ||
674 | do { | ||
675 | BE_8_TO_64(W512[j], data); | ||
676 | data += 8; | ||
677 | /* Apply the SHA-512 compression function to update a..h */ | ||
678 | T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + W512[j]; | ||
679 | T2 = Sigma0_512(a) + Maj(a, b, c); | ||
680 | h = g; | ||
681 | g = f; | ||
682 | f = e; | ||
683 | e = d + T1; | ||
684 | d = c; | ||
685 | c = b; | ||
686 | b = a; | ||
687 | a = T1 + T2; | ||
688 | |||
689 | j++; | ||
690 | } while (j < 16); | ||
691 | |||
692 | do { | ||
693 | /* Part of the message block expansion: */ | ||
694 | s0 = W512[(j+1)&0x0f]; | ||
695 | s0 = sigma0_512(s0); | ||
696 | s1 = W512[(j+14)&0x0f]; | ||
697 | s1 = sigma1_512(s1); | ||
698 | |||
699 | /* Apply the SHA-512 compression function to update a..h */ | ||
700 | T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + | ||
701 | (W512[j&0x0f] += s1 + W512[(j+9)&0x0f] + s0); | ||
702 | T2 = Sigma0_512(a) + Maj(a, b, c); | ||
703 | h = g; | ||
704 | g = f; | ||
705 | f = e; | ||
706 | e = d + T1; | ||
707 | d = c; | ||
708 | c = b; | ||
709 | b = a; | ||
710 | a = T1 + T2; | ||
711 | |||
712 | j++; | ||
713 | } while (j < 80); | ||
714 | |||
715 | /* Compute the current intermediate hash value */ | ||
716 | state[0] += a; | ||
717 | state[1] += b; | ||
718 | state[2] += c; | ||
719 | state[3] += d; | ||
720 | state[4] += e; | ||
721 | state[5] += f; | ||
722 | state[6] += g; | ||
723 | state[7] += h; | ||
724 | |||
725 | /* Clean up */ | ||
726 | a = b = c = d = e = f = g = h = T1 = T2 = 0; | ||
727 | } | ||
728 | |||
729 | #endif /* SHA2_UNROLL_TRANSFORM */ | ||
730 | |||
731 | void | ||
732 | SHA512_Update(SHA512_CTX *context, const u_int8_t *data, size_t len) | ||
733 | { | ||
734 | size_t freespace, usedspace; | ||
735 | |||
736 | /* Calling with no data is valid (we do nothing) */ | ||
737 | if (len == 0) | ||
738 | return; | ||
739 | |||
740 | usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH; | ||
741 | if (usedspace > 0) { | ||
742 | /* Calculate how much free space is available in the buffer */ | ||
743 | freespace = SHA512_BLOCK_LENGTH - usedspace; | ||
744 | |||
745 | if (len >= freespace) { | ||
746 | /* Fill the buffer completely and process it */ | ||
747 | memcpy(&context->buffer[usedspace], data, freespace); | ||
748 | ADDINC128(context->bitcount, freespace << 3); | ||
749 | len -= freespace; | ||
750 | data += freespace; | ||
751 | SHA512_Transform(context->state, context->buffer); | ||
752 | } else { | ||
753 | /* The buffer is not yet full */ | ||
754 | memcpy(&context->buffer[usedspace], data, len); | ||
755 | ADDINC128(context->bitcount, len << 3); | ||
756 | /* Clean up: */ | ||
757 | usedspace = freespace = 0; | ||
758 | return; | ||
759 | } | ||
760 | } | ||
761 | while (len >= SHA512_BLOCK_LENGTH) { | ||
762 | /* Process as many complete blocks as we can */ | ||
763 | SHA512_Transform(context->state, data); | ||
764 | ADDINC128(context->bitcount, SHA512_BLOCK_LENGTH << 3); | ||
765 | len -= SHA512_BLOCK_LENGTH; | ||
766 | data += SHA512_BLOCK_LENGTH; | ||
767 | } | ||
768 | if (len > 0) { | ||
769 | /* There's left-overs, so save 'em */ | ||
770 | memcpy(context->buffer, data, len); | ||
771 | ADDINC128(context->bitcount, len << 3); | ||
772 | } | ||
773 | /* Clean up: */ | ||
774 | usedspace = freespace = 0; | ||
775 | } | ||
776 | |||
777 | void | ||
778 | SHA512_Pad(SHA512_CTX *context) | ||
779 | { | ||
780 | unsigned int usedspace; | ||
781 | |||
782 | usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH; | ||
783 | if (usedspace > 0) { | ||
784 | /* Begin padding with a 1 bit: */ | ||
785 | context->buffer[usedspace++] = 0x80; | ||
786 | |||
787 | if (usedspace <= SHA512_SHORT_BLOCK_LENGTH) { | ||
788 | /* Set-up for the last transform: */ | ||
789 | memset(&context->buffer[usedspace], 0, SHA512_SHORT_BLOCK_LENGTH - usedspace); | ||
790 | } else { | ||
791 | if (usedspace < SHA512_BLOCK_LENGTH) { | ||
792 | memset(&context->buffer[usedspace], 0, SHA512_BLOCK_LENGTH - usedspace); | ||
793 | } | ||
794 | /* Do second-to-last transform: */ | ||
795 | SHA512_Transform(context->state, context->buffer); | ||
796 | |||
797 | /* And set-up for the last transform: */ | ||
798 | memset(context->buffer, 0, SHA512_BLOCK_LENGTH - 2); | ||
799 | } | ||
800 | } else { | ||
801 | /* Prepare for final transform: */ | ||
802 | memset(context->buffer, 0, SHA512_SHORT_BLOCK_LENGTH); | ||
803 | |||
804 | /* Begin padding with a 1 bit: */ | ||
805 | *context->buffer = 0x80; | ||
806 | } | ||
807 | /* Store the length of input data (in bits) in big endian format: */ | ||
808 | BE_64_TO_8(&context->buffer[SHA512_SHORT_BLOCK_LENGTH], | ||
809 | context->bitcount[1]); | ||
810 | BE_64_TO_8(&context->buffer[SHA512_SHORT_BLOCK_LENGTH + 8], | ||
811 | context->bitcount[0]); | ||
812 | |||
813 | /* Final transform: */ | ||
814 | SHA512_Transform(context->state, context->buffer); | ||
815 | |||
816 | /* Clean up: */ | ||
817 | usedspace = 0; | ||
818 | } | ||
819 | |||
820 | void | ||
821 | SHA512_Final(u_int8_t digest[SHA512_DIGEST_LENGTH], SHA512_CTX *context) | ||
822 | { | ||
823 | SHA512_Pad(context); | ||
824 | |||
825 | /* If no digest buffer is passed, we don't bother doing this: */ | ||
826 | if (digest != NULL) { | ||
827 | #if BYTE_ORDER == LITTLE_ENDIAN | ||
828 | int i; | ||
829 | |||
830 | /* Convert TO host byte order */ | ||
831 | for (i = 0; i < 8; i++) | ||
832 | BE_64_TO_8(digest + i * 8, context->state[i]); | ||
833 | #else | ||
834 | memcpy(digest, context->state, SHA512_DIGEST_LENGTH); | ||
835 | #endif | ||
836 | memset(context, 0, sizeof(*context)); | ||
837 | } | ||
838 | } | ||
839 | |||
840 | |||
841 | #if 0 | ||
842 | /*** SHA-384: *********************************************************/ | ||
843 | void | ||
844 | SHA384_Init(SHA384_CTX *context) | ||
845 | { | ||
846 | if (context == NULL) | ||
847 | return; | ||
848 | memcpy(context->state, sha384_initial_hash_value, | ||
849 | sizeof(sha384_initial_hash_value)); | ||
850 | memset(context->buffer, 0, sizeof(context->buffer)); | ||
851 | context->bitcount[0] = context->bitcount[1] = 0; | ||
852 | } | ||
853 | |||
854 | __weak_alias(SHA384_Transform, SHA512_Transform); | ||
855 | __weak_alias(SHA384_Update, SHA512_Update); | ||
856 | __weak_alias(SHA384_Pad, SHA512_Pad); | ||
857 | |||
858 | void | ||
859 | SHA384_Final(u_int8_t digest[SHA384_DIGEST_LENGTH], SHA384_CTX *context) | ||
860 | { | ||
861 | SHA384_Pad(context); | ||
862 | |||
863 | /* If no digest buffer is passed, we don't bother doing this: */ | ||
864 | if (digest != NULL) { | ||
865 | #if BYTE_ORDER == LITTLE_ENDIAN | ||
866 | int i; | ||
867 | |||
868 | /* Convert TO host byte order */ | ||
869 | for (i = 0; i < 6; i++) | ||
870 | BE_64_TO_8(digest + i * 8, context->state[i]); | ||
871 | #else | ||
872 | memcpy(digest, context->state, SHA384_DIGEST_LENGTH); | ||
873 | #endif | ||
874 | } | ||
875 | |||
876 | /* Zero out state data */ | ||
877 | memset(context, 0, sizeof(*context)); | ||
878 | } | ||
879 | #endif | ||
880 | |||
881 | #endif /* !defined(HAVE_EVP_SHA256) && !defined(HAVE_SHA256_UPDATE) && \ | ||
882 | (OPENSSL_VERSION_NUMBER >= 0x00907000L) */ | ||
diff --git a/openbsd-compat/sha2.h b/openbsd-compat/sha2.h new file mode 100755 index 000000000..821f2dd6c --- /dev/null +++ b/openbsd-compat/sha2.h | |||
@@ -0,0 +1,133 @@ | |||
1 | /* $OpenBSD: sha2.h,v 1.6 2004/06/22 01:57:30 jfb Exp $ */ | ||
2 | |||
3 | /* | ||
4 | * FILE: sha2.h | ||
5 | * AUTHOR: Aaron D. Gifford <me@aarongifford.com> | ||
6 | * | ||
7 | * Copyright (c) 2000-2001, Aaron D. Gifford | ||
8 | * All rights reserved. | ||
9 | * | ||
10 | * Redistribution and use in source and binary forms, with or without | ||
11 | * modification, are permitted provided that the following conditions | ||
12 | * are met: | ||
13 | * 1. Redistributions of source code must retain the above copyright | ||
14 | * notice, this list of conditions and the following disclaimer. | ||
15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
16 | * notice, this list of conditions and the following disclaimer in the | ||
17 | * documentation and/or other materials provided with the distribution. | ||
18 | * 3. Neither the name of the copyright holder nor the names of contributors | ||
19 | * may be used to endorse or promote products derived from this software | ||
20 | * without specific prior written permission. | ||
21 | * | ||
22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND | ||
23 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
25 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTOR(S) BE LIABLE | ||
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
32 | * SUCH DAMAGE. | ||
33 | * | ||
34 | * $From: sha2.h,v 1.1 2001/11/08 00:02:01 adg Exp adg $ | ||
35 | */ | ||
36 | |||
37 | /* OPENBSD ORIGINAL: include/sha2.h */ | ||
38 | |||
39 | #ifndef _SSHSHA2_H | ||
40 | #define _SSHSHA2_H | ||
41 | |||
42 | #include "includes.h" | ||
43 | |||
44 | #include <openssl/opensslv.h> | ||
45 | |||
46 | #if !defined(HAVE_EVP_SHA256) && !defined(HAVE_SHA256_UPDATE) && \ | ||
47 | (OPENSSL_VERSION_NUMBER >= 0x00907000L) | ||
48 | |||
49 | /*** SHA-256/384/512 Various Length Definitions ***********************/ | ||
50 | #define SHA256_BLOCK_LENGTH 64 | ||
51 | #define SHA256_DIGEST_LENGTH 32 | ||
52 | #define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1) | ||
53 | #define SHA384_BLOCK_LENGTH 128 | ||
54 | #define SHA384_DIGEST_LENGTH 48 | ||
55 | #define SHA384_DIGEST_STRING_LENGTH (SHA384_DIGEST_LENGTH * 2 + 1) | ||
56 | #define SHA512_BLOCK_LENGTH 128 | ||
57 | #define SHA512_DIGEST_LENGTH 64 | ||
58 | #define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1) | ||
59 | |||
60 | |||
61 | /*** SHA-256/384/512 Context Structures *******************************/ | ||
62 | typedef struct _SHA256_CTX { | ||
63 | u_int32_t state[8]; | ||
64 | u_int64_t bitcount; | ||
65 | u_int8_t buffer[SHA256_BLOCK_LENGTH]; | ||
66 | } SHA256_CTX; | ||
67 | typedef struct _SHA512_CTX { | ||
68 | u_int64_t state[8]; | ||
69 | u_int64_t bitcount[2]; | ||
70 | u_int8_t buffer[SHA512_BLOCK_LENGTH]; | ||
71 | } SHA512_CTX; | ||
72 | |||
73 | #if 0 | ||
74 | typedef SHA512_CTX SHA384_CTX; | ||
75 | #endif | ||
76 | |||
77 | void SHA256_Init(SHA256_CTX *); | ||
78 | void SHA256_Transform(u_int32_t state[8], const u_int8_t [SHA256_BLOCK_LENGTH]); | ||
79 | void SHA256_Update(SHA256_CTX *, const u_int8_t *, size_t) | ||
80 | __attribute__((__bounded__(__string__,2,3))); | ||
81 | void SHA256_Pad(SHA256_CTX *); | ||
82 | void SHA256_Final(u_int8_t [SHA256_DIGEST_LENGTH], SHA256_CTX *) | ||
83 | __attribute__((__bounded__(__minbytes__,1,SHA256_DIGEST_LENGTH))); | ||
84 | char *SHA256_End(SHA256_CTX *, char *) | ||
85 | __attribute__((__bounded__(__minbytes__,2,SHA256_DIGEST_STRING_LENGTH))); | ||
86 | char *SHA256_File(const char *, char *) | ||
87 | __attribute__((__bounded__(__minbytes__,2,SHA256_DIGEST_STRING_LENGTH))); | ||
88 | char *SHA256_FileChunk(const char *, char *, off_t, off_t) | ||
89 | __attribute__((__bounded__(__minbytes__,2,SHA256_DIGEST_STRING_LENGTH))); | ||
90 | char *SHA256_Data(const u_int8_t *, size_t, char *) | ||
91 | __attribute__((__bounded__(__string__,1,2))) | ||
92 | __attribute__((__bounded__(__minbytes__,3,SHA256_DIGEST_STRING_LENGTH))); | ||
93 | |||
94 | #if 0 | ||
95 | void SHA384_Init(SHA384_CTX *); | ||
96 | void SHA384_Transform(u_int64_t state[8], const u_int8_t [SHA384_BLOCK_LENGTH]); | ||
97 | void SHA384_Update(SHA384_CTX *, const u_int8_t *, size_t) | ||
98 | __attribute__((__bounded__(__string__,2,3))); | ||
99 | void SHA384_Pad(SHA384_CTX *); | ||
100 | void SHA384_Final(u_int8_t [SHA384_DIGEST_LENGTH], SHA384_CTX *) | ||
101 | __attribute__((__bounded__(__minbytes__,1,SHA384_DIGEST_LENGTH))); | ||
102 | char *SHA384_End(SHA384_CTX *, char *) | ||
103 | __attribute__((__bounded__(__minbytes__,2,SHA384_DIGEST_STRING_LENGTH))); | ||
104 | char *SHA384_File(const char *, char *) | ||
105 | __attribute__((__bounded__(__minbytes__,2,SHA384_DIGEST_STRING_LENGTH))); | ||
106 | char *SHA384_FileChunk(const char *, char *, off_t, off_t) | ||
107 | __attribute__((__bounded__(__minbytes__,2,SHA384_DIGEST_STRING_LENGTH))); | ||
108 | char *SHA384_Data(const u_int8_t *, size_t, char *) | ||
109 | __attribute__((__bounded__(__string__,1,2))) | ||
110 | __attribute__((__bounded__(__minbytes__,3,SHA384_DIGEST_STRING_LENGTH))); | ||
111 | #endif /* 0 */ | ||
112 | |||
113 | void SHA512_Init(SHA512_CTX *); | ||
114 | void SHA512_Transform(u_int64_t state[8], const u_int8_t [SHA512_BLOCK_LENGTH]); | ||
115 | void SHA512_Update(SHA512_CTX *, const u_int8_t *, size_t) | ||
116 | __attribute__((__bounded__(__string__,2,3))); | ||
117 | void SHA512_Pad(SHA512_CTX *); | ||
118 | void SHA512_Final(u_int8_t [SHA512_DIGEST_LENGTH], SHA512_CTX *) | ||
119 | __attribute__((__bounded__(__minbytes__,1,SHA512_DIGEST_LENGTH))); | ||
120 | char *SHA512_End(SHA512_CTX *, char *) | ||
121 | __attribute__((__bounded__(__minbytes__,2,SHA512_DIGEST_STRING_LENGTH))); | ||
122 | char *SHA512_File(const char *, char *) | ||
123 | __attribute__((__bounded__(__minbytes__,2,SHA512_DIGEST_STRING_LENGTH))); | ||
124 | char *SHA512_FileChunk(const char *, char *, off_t, off_t) | ||
125 | __attribute__((__bounded__(__minbytes__,2,SHA512_DIGEST_STRING_LENGTH))); | ||
126 | char *SHA512_Data(const u_int8_t *, size_t, char *) | ||
127 | __attribute__((__bounded__(__string__,1,2))) | ||
128 | __attribute__((__bounded__(__minbytes__,3,SHA512_DIGEST_STRING_LENGTH))); | ||
129 | |||
130 | #endif /* !defined(HAVE_EVP_SHA256) && !defined(HAVE_SHA256_UPDATE) && \ | ||
131 | (OPENSSL_VERSION_NUMBER >= 0x00907000L) */ | ||
132 | |||
133 | #endif /* _SSHSHA2_H */ | ||
diff --git a/openbsd-compat/strtonum.c b/openbsd-compat/strtonum.c index 8ad0d0058..87f2f24b2 100644 --- a/openbsd-compat/strtonum.c +++ b/openbsd-compat/strtonum.c | |||
@@ -20,8 +20,11 @@ | |||
20 | /* OPENBSD ORIGINAL: lib/libc/stdlib/strtonum.c */ | 20 | /* OPENBSD ORIGINAL: lib/libc/stdlib/strtonum.c */ |
21 | 21 | ||
22 | #include "includes.h" | 22 | #include "includes.h" |
23 | |||
23 | #ifndef HAVE_STRTONUM | 24 | #ifndef HAVE_STRTONUM |
25 | #include <stdlib.h> | ||
24 | #include <limits.h> | 26 | #include <limits.h> |
27 | #include <errno.h> | ||
25 | 28 | ||
26 | #define INVALID 1 | 29 | #define INVALID 1 |
27 | #define TOOSMALL 2 | 30 | #define TOOSMALL 2 |
diff --git a/openbsd-compat/xcrypt.c b/openbsd-compat/xcrypt.c index 9afa0b9f2..14899321f 100644 --- a/openbsd-compat/xcrypt.c +++ b/openbsd-compat/xcrypt.c | |||
@@ -24,6 +24,10 @@ | |||
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | 26 | ||
27 | #include <sys/types.h> | ||
28 | #include <unistd.h> | ||
29 | #include <pwd.h> | ||
30 | |||
27 | # ifdef HAVE_CRYPT_H | 31 | # ifdef HAVE_CRYPT_H |
28 | # include <crypt.h> | 32 | # include <crypt.h> |
29 | # endif | 33 | # endif |
diff --git a/openbsd-compat/xmmap.c b/openbsd-compat/xmmap.c index 74e8a8b13..0fb23269b 100644 --- a/openbsd-compat/xmmap.c +++ b/openbsd-compat/xmmap.c | |||
@@ -23,21 +23,31 @@ | |||
23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | /* $Id: xmmap.c,v 1.6 2004/10/06 13:15:44 dtucker Exp $ */ | 26 | /* $Id: xmmap.c,v 1.12 2006/08/24 09:58:36 dtucker Exp $ */ |
27 | 27 | ||
28 | #include "includes.h" | 28 | #include "includes.h" |
29 | 29 | ||
30 | #include <sys/types.h> | ||
30 | #ifdef HAVE_SYS_MMAN_H | 31 | #ifdef HAVE_SYS_MMAN_H |
31 | #include <sys/mman.h> | 32 | #include <sys/mman.h> |
32 | #endif | 33 | #endif |
34 | #include <sys/stat.h> | ||
35 | |||
36 | #ifdef HAVE_FCNTL_H | ||
37 | # include <fcntl.h> | ||
38 | #endif | ||
39 | #include <errno.h> | ||
40 | #include <stdarg.h> | ||
41 | #include <string.h> | ||
42 | #include <unistd.h> | ||
33 | 43 | ||
34 | #include "log.h" | 44 | #include "log.h" |
35 | 45 | ||
36 | void *xmmap(size_t size) | 46 | void *xmmap(size_t size) |
37 | { | 47 | { |
48 | #ifdef HAVE_MMAP | ||
38 | void *address; | 49 | void *address; |
39 | 50 | ||
40 | #ifdef HAVE_MMAP | ||
41 | # ifdef MAP_ANON | 51 | # ifdef MAP_ANON |
42 | address = mmap(NULL, size, PROT_WRITE|PROT_READ, MAP_ANON|MAP_SHARED, | 52 | address = mmap(NULL, size, PROT_WRITE|PROT_READ, MAP_ANON|MAP_SHARED, |
43 | -1, (off_t)0); | 53 | -1, (off_t)0); |
diff --git a/openssh.xml.in b/openssh.xml.in new file mode 100644 index 000000000..2fcdea0a1 --- /dev/null +++ b/openssh.xml.in | |||
@@ -0,0 +1,90 @@ | |||
1 | <?xml version='1.0'?> | ||
2 | <!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'> | ||
3 | <!-- | ||
4 | Copyright (c) 2006 Chad Mynhier. | ||
5 | |||
6 | Permission to use, copy, modify, and distribute this software for any | ||
7 | purpose with or without fee is hereby granted, provided that the above | ||
8 | copyright notice and this permission notice appear in all copies. | ||
9 | |||
10 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
11 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
12 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
13 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
14 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
15 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
16 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
17 | --> | ||
18 | |||
19 | <service_bundle type='manifest' name='OpenSSH server'> | ||
20 | |||
21 | <service | ||
22 | name='site/openssh' | ||
23 | type='service' | ||
24 | version='1'> | ||
25 | |||
26 | <!-- | ||
27 | We default to disabled so administrator can decide to enable or not. | ||
28 | --> | ||
29 | <create_default_instance enabled='false'/> | ||
30 | |||
31 | <single_instance/> | ||
32 | |||
33 | <dependency | ||
34 | name='filesystem-local' | ||
35 | grouping='require_all' | ||
36 | restart_on='none' | ||
37 | type='service'> | ||
38 | <service_fmri value='svc:/system/filesystem/local'/> | ||
39 | </dependency> | ||
40 | |||
41 | <dependency | ||
42 | name='network' | ||
43 | grouping='require_all' | ||
44 | restart_on='none' | ||
45 | type='service'> | ||
46 | <service_fmri value='svc:/milestone/network'/> | ||
47 | </dependency> | ||
48 | |||
49 | <dependent | ||
50 | name='multi-user-server' | ||
51 | restart_on='none' | ||
52 | grouping='optional_all'> | ||
53 | <service_fmri value='svc:/milestone/multi-user-server'/> | ||
54 | </dependent> | ||
55 | |||
56 | <exec_method | ||
57 | name='start' | ||
58 | type='method' | ||
59 | exec='/lib/svc/method/site/__SYSVINIT_NAME__ start' | ||
60 | timeout_seconds='60'> | ||
61 | <method_context/> | ||
62 | </exec_method> | ||
63 | |||
64 | <exec_method | ||
65 | name='stop' | ||
66 | type='method' | ||
67 | exec=':kill' | ||
68 | timeout_seconds='60'> | ||
69 | <method_context/> | ||
70 | </exec_method> | ||
71 | |||
72 | <property_group | ||
73 | name='startd' | ||
74 | type='framework'> | ||
75 | <propval name='ignore_error' type='astring' value='core,signal'/> | ||
76 | </property_group> | ||
77 | |||
78 | <template> | ||
79 | <common_name> | ||
80 | <loctext xml:lang='C'>OpenSSH server</loctext> | ||
81 | </common_name> | ||
82 | <documentation> | ||
83 | <manpage | ||
84 | title='sshd' | ||
85 | section='1M' | ||
86 | manpath='@prefix@/man'/> | ||
87 | </documentation> | ||
88 | </template> | ||
89 | </service> | ||
90 | </service_bundle> | ||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: packet.c,v 1.145 2006/09/19 21:14:08 markus Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -37,26 +38,39 @@ | |||
37 | */ | 38 | */ |
38 | 39 | ||
39 | #include "includes.h" | 40 | #include "includes.h" |
40 | RCSID("$OpenBSD: packet.c,v 1.120 2005/10/30 08:52:17 djm Exp $"); | 41 | |
41 | 42 | #include <sys/types.h> | |
42 | #include "openbsd-compat/sys-queue.h" | 43 | #include "openbsd-compat/sys-queue.h" |
44 | #include <sys/param.h> | ||
45 | #include <sys/socket.h> | ||
46 | #ifdef HAVE_SYS_TIME_H | ||
47 | # include <sys/time.h> | ||
48 | #endif | ||
49 | |||
50 | #include <netinet/in.h> | ||
51 | #include <netinet/ip.h> | ||
52 | #include <arpa/inet.h> | ||
53 | |||
54 | #include <errno.h> | ||
55 | #include <stdarg.h> | ||
56 | #include <stdio.h> | ||
57 | #include <stdlib.h> | ||
58 | #include <string.h> | ||
59 | #include <unistd.h> | ||
60 | #include <signal.h> | ||
43 | 61 | ||
44 | #include "xmalloc.h" | 62 | #include "xmalloc.h" |
45 | #include "buffer.h" | 63 | #include "buffer.h" |
46 | #include "packet.h" | 64 | #include "packet.h" |
47 | #include "bufaux.h" | ||
48 | #include "crc32.h" | 65 | #include "crc32.h" |
49 | #include "getput.h" | ||
50 | |||
51 | #include "compress.h" | 66 | #include "compress.h" |
52 | #include "deattack.h" | 67 | #include "deattack.h" |
53 | #include "channels.h" | 68 | #include "channels.h" |
54 | |||
55 | #include "compat.h" | 69 | #include "compat.h" |
56 | #include "ssh1.h" | 70 | #include "ssh1.h" |
57 | #include "ssh2.h" | 71 | #include "ssh2.h" |
58 | |||
59 | #include "cipher.h" | 72 | #include "cipher.h" |
73 | #include "key.h" | ||
60 | #include "kex.h" | 74 | #include "kex.h" |
61 | #include "mac.h" | 75 | #include "mac.h" |
62 | #include "log.h" | 76 | #include "log.h" |
@@ -261,6 +275,7 @@ packet_get_keyiv_len(int mode) | |||
261 | 275 | ||
262 | return (cipher_get_keyiv_len(cc)); | 276 | return (cipher_get_keyiv_len(cc)); |
263 | } | 277 | } |
278 | |||
264 | void | 279 | void |
265 | packet_set_iv(int mode, u_char *dat) | 280 | packet_set_iv(int mode, u_char *dat) |
266 | { | 281 | { |
@@ -273,6 +288,7 @@ packet_set_iv(int mode, u_char *dat) | |||
273 | 288 | ||
274 | cipher_set_keyiv(cc, dat); | 289 | cipher_set_keyiv(cc, dat); |
275 | } | 290 | } |
291 | |||
276 | int | 292 | int |
277 | packet_get_ssh1_cipher(void) | 293 | packet_get_ssh1_cipher(void) |
278 | { | 294 | { |
@@ -474,31 +490,37 @@ packet_put_char(int value) | |||
474 | 490 | ||
475 | buffer_append(&outgoing_packet, &ch, 1); | 491 | buffer_append(&outgoing_packet, &ch, 1); |
476 | } | 492 | } |
493 | |||
477 | void | 494 | void |
478 | packet_put_int(u_int value) | 495 | packet_put_int(u_int value) |
479 | { | 496 | { |
480 | buffer_put_int(&outgoing_packet, value); | 497 | buffer_put_int(&outgoing_packet, value); |
481 | } | 498 | } |
499 | |||
482 | void | 500 | void |
483 | packet_put_string(const void *buf, u_int len) | 501 | packet_put_string(const void *buf, u_int len) |
484 | { | 502 | { |
485 | buffer_put_string(&outgoing_packet, buf, len); | 503 | buffer_put_string(&outgoing_packet, buf, len); |
486 | } | 504 | } |
505 | |||
487 | void | 506 | void |
488 | packet_put_cstring(const char *str) | 507 | packet_put_cstring(const char *str) |
489 | { | 508 | { |
490 | buffer_put_cstring(&outgoing_packet, str); | 509 | buffer_put_cstring(&outgoing_packet, str); |
491 | } | 510 | } |
511 | |||
492 | void | 512 | void |
493 | packet_put_raw(const void *buf, u_int len) | 513 | packet_put_raw(const void *buf, u_int len) |
494 | { | 514 | { |
495 | buffer_append(&outgoing_packet, buf, len); | 515 | buffer_append(&outgoing_packet, buf, len); |
496 | } | 516 | } |
517 | |||
497 | void | 518 | void |
498 | packet_put_bignum(BIGNUM * value) | 519 | packet_put_bignum(BIGNUM * value) |
499 | { | 520 | { |
500 | buffer_put_bignum(&outgoing_packet, value); | 521 | buffer_put_bignum(&outgoing_packet, value); |
501 | } | 522 | } |
523 | |||
502 | void | 524 | void |
503 | packet_put_bignum2(BIGNUM * value) | 525 | packet_put_bignum2(BIGNUM * value) |
504 | { | 526 | { |
@@ -552,7 +574,7 @@ packet_send1(void) | |||
552 | /* Add check bytes. */ | 574 | /* Add check bytes. */ |
553 | checksum = ssh_crc32(buffer_ptr(&outgoing_packet), | 575 | checksum = ssh_crc32(buffer_ptr(&outgoing_packet), |
554 | buffer_len(&outgoing_packet)); | 576 | buffer_len(&outgoing_packet)); |
555 | PUT_32BIT(buf, checksum); | 577 | put_u32(buf, checksum); |
556 | buffer_append(&outgoing_packet, buf, 4); | 578 | buffer_append(&outgoing_packet, buf, 4); |
557 | 579 | ||
558 | #ifdef PACKET_DEBUG | 580 | #ifdef PACKET_DEBUG |
@@ -561,7 +583,7 @@ packet_send1(void) | |||
561 | #endif | 583 | #endif |
562 | 584 | ||
563 | /* Append to output. */ | 585 | /* Append to output. */ |
564 | PUT_32BIT(buf, len); | 586 | put_u32(buf, len); |
565 | buffer_append(&output, buf, 4); | 587 | buffer_append(&output, buf, 4); |
566 | cp = buffer_append_space(&output, buffer_len(&outgoing_packet)); | 588 | cp = buffer_append_space(&output, buffer_len(&outgoing_packet)); |
567 | cipher_crypt(&send_context, cp, buffer_ptr(&outgoing_packet), | 589 | cipher_crypt(&send_context, cp, buffer_ptr(&outgoing_packet), |
@@ -657,7 +679,7 @@ set_newkeys(int mode) | |||
657 | 679 | ||
658 | /* | 680 | /* |
659 | * Delayed compression for SSH2 is enabled after authentication: | 681 | * Delayed compression for SSH2 is enabled after authentication: |
660 | * This happans on the server side after a SSH2_MSG_USERAUTH_SUCCESS is sent, | 682 | * This happens on the server side after a SSH2_MSG_USERAUTH_SUCCESS is sent, |
661 | * and on the client side after a SSH2_MSG_USERAUTH_SUCCESS is received. | 683 | * and on the client side after a SSH2_MSG_USERAUTH_SUCCESS is received. |
662 | */ | 684 | */ |
663 | static void | 685 | static void |
@@ -672,6 +694,9 @@ packet_enable_delayed_compress(void) | |||
672 | */ | 694 | */ |
673 | after_authentication = 1; | 695 | after_authentication = 1; |
674 | for (mode = 0; mode < MODE_MAX; mode++) { | 696 | for (mode = 0; mode < MODE_MAX; mode++) { |
697 | /* protocol error: USERAUTH_SUCCESS received before NEWKEYS */ | ||
698 | if (newkeys[mode] == NULL) | ||
699 | continue; | ||
675 | comp = &newkeys[mode]->comp; | 700 | comp = &newkeys[mode]->comp; |
676 | if (comp && !comp->enabled && comp->type == COMP_DELAYED) { | 701 | if (comp && !comp->enabled && comp->type == COMP_DELAYED) { |
677 | packet_init_compression(); | 702 | packet_init_compression(); |
@@ -764,7 +789,7 @@ packet_send2_wrapped(void) | |||
764 | /* packet_length includes payload, padding and padding length field */ | 789 | /* packet_length includes payload, padding and padding length field */ |
765 | packet_length = buffer_len(&outgoing_packet) - 4; | 790 | packet_length = buffer_len(&outgoing_packet) - 4; |
766 | cp = buffer_ptr(&outgoing_packet); | 791 | cp = buffer_ptr(&outgoing_packet); |
767 | PUT_32BIT(cp, packet_length); | 792 | put_u32(cp, packet_length); |
768 | cp[4] = padlen; | 793 | cp[4] = padlen; |
769 | DBG(debug("send: len %d (includes padlen %d)", packet_length+4, padlen)); | 794 | DBG(debug("send: len %d (includes padlen %d)", packet_length+4, padlen)); |
770 | 795 | ||
@@ -781,7 +806,7 @@ packet_send2_wrapped(void) | |||
781 | buffer_len(&outgoing_packet)); | 806 | buffer_len(&outgoing_packet)); |
782 | /* append unencrypted MAC */ | 807 | /* append unencrypted MAC */ |
783 | if (mac && mac->enabled) | 808 | if (mac && mac->enabled) |
784 | buffer_append(&output, (char *)macbuf, mac->mac_len); | 809 | buffer_append(&output, macbuf, mac->mac_len); |
785 | #ifdef PACKET_DEBUG | 810 | #ifdef PACKET_DEBUG |
786 | fprintf(stderr, "encrypted: "); | 811 | fprintf(stderr, "encrypted: "); |
787 | buffer_dump(&output); | 812 | buffer_dump(&output); |
@@ -872,7 +897,7 @@ packet_read_seqnr(u_int32_t *seqnr_p) | |||
872 | struct timeval tv, *tvp; | 897 | struct timeval tv, *tvp; |
873 | DBG(debug("packet_read()")); | 898 | DBG(debug("packet_read()")); |
874 | 899 | ||
875 | setp = (fd_set *)xmalloc(howmany(connection_in+1, NFDBITS) * | 900 | setp = (fd_set *)xcalloc(howmany(connection_in+1, NFDBITS), |
876 | sizeof(fd_mask)); | 901 | sizeof(fd_mask)); |
877 | 902 | ||
878 | /* Since we are blocking, ensure that all written packets have been sent. */ | 903 | /* Since we are blocking, ensure that all written packets have been sent. */ |
@@ -902,11 +927,11 @@ packet_read_seqnr(u_int32_t *seqnr_p) | |||
902 | FD_SET(connection_in, setp); | 927 | FD_SET(connection_in, setp); |
903 | 928 | ||
904 | if (setup_timeout > 0) { | 929 | if (setup_timeout > 0) { |
905 | tvp = &tv; | 930 | tvp = &tv; |
906 | tv.tv_sec = setup_timeout; | 931 | tv.tv_sec = setup_timeout; |
907 | tv.tv_usec = 0; | 932 | tv.tv_usec = 0; |
908 | } else | 933 | } else |
909 | tvp = 0; | 934 | tvp = NULL; |
910 | 935 | ||
911 | /* Wait for some data to arrive. */ | 936 | /* Wait for some data to arrive. */ |
912 | while (select(connection_in + 1, setp, NULL, NULL, tvp) == -1 && | 937 | while (select(connection_in + 1, setp, NULL, NULL, tvp) == -1 && |
@@ -914,7 +939,7 @@ packet_read_seqnr(u_int32_t *seqnr_p) | |||
914 | ; | 939 | ; |
915 | 940 | ||
916 | if (!FD_ISSET(connection_in, setp)) | 941 | if (!FD_ISSET(connection_in, setp)) |
917 | fatal("packet_read: Setup timeout expired, giving up"); | 942 | fatal("packet_read: Setup timeout expired, giving up"); |
918 | 943 | ||
919 | /* Read data from the socket. */ | 944 | /* Read data from the socket. */ |
920 | len = read(connection_in, buf, sizeof(buf)); | 945 | len = read(connection_in, buf, sizeof(buf)); |
@@ -973,7 +998,7 @@ packet_read_poll1(void) | |||
973 | return SSH_MSG_NONE; | 998 | return SSH_MSG_NONE; |
974 | /* Get length of incoming packet. */ | 999 | /* Get length of incoming packet. */ |
975 | cp = buffer_ptr(&input); | 1000 | cp = buffer_ptr(&input); |
976 | len = GET_32BIT(cp); | 1001 | len = get_u32(cp); |
977 | if (len < 1 + 2 + 2 || len > 256 * 1024) | 1002 | if (len < 1 + 2 + 2 || len > 256 * 1024) |
978 | packet_disconnect("Bad packet length %u.", len); | 1003 | packet_disconnect("Bad packet length %u.", len); |
979 | padded_len = (len + 8) & ~7; | 1004 | padded_len = (len + 8) & ~7; |
@@ -993,7 +1018,7 @@ packet_read_poll1(void) | |||
993 | * Ariel Futoransky(futo@core-sdi.com) | 1018 | * Ariel Futoransky(futo@core-sdi.com) |
994 | */ | 1019 | */ |
995 | if (!receive_context.plaintext) { | 1020 | if (!receive_context.plaintext) { |
996 | switch (detect_attack(buffer_ptr(&input), padded_len, NULL)) { | 1021 | switch (detect_attack(buffer_ptr(&input), padded_len)) { |
997 | case DEATTACK_DETECTED: | 1022 | case DEATTACK_DETECTED: |
998 | packet_disconnect("crc32 compensation attack: " | 1023 | packet_disconnect("crc32 compensation attack: " |
999 | "network attack detected"); | 1024 | "network attack detected"); |
@@ -1028,7 +1053,7 @@ packet_read_poll1(void) | |||
1028 | len, buffer_len(&incoming_packet)); | 1053 | len, buffer_len(&incoming_packet)); |
1029 | 1054 | ||
1030 | cp = (u_char *)buffer_ptr(&incoming_packet) + len - 4; | 1055 | cp = (u_char *)buffer_ptr(&incoming_packet) + len - 4; |
1031 | stored_checksum = GET_32BIT(cp); | 1056 | stored_checksum = get_u32(cp); |
1032 | if (checksum != stored_checksum) | 1057 | if (checksum != stored_checksum) |
1033 | packet_disconnect("Corrupted check bytes on input."); | 1058 | packet_disconnect("Corrupted check bytes on input."); |
1034 | buffer_consume_end(&incoming_packet, 4); | 1059 | buffer_consume_end(&incoming_packet, 4); |
@@ -1077,7 +1102,7 @@ packet_read_poll2(u_int32_t *seqnr_p) | |||
1077 | cipher_crypt(&receive_context, cp, buffer_ptr(&input), | 1102 | cipher_crypt(&receive_context, cp, buffer_ptr(&input), |
1078 | block_size); | 1103 | block_size); |
1079 | cp = buffer_ptr(&incoming_packet); | 1104 | cp = buffer_ptr(&incoming_packet); |
1080 | packet_length = GET_32BIT(cp); | 1105 | packet_length = get_u32(cp); |
1081 | if (packet_length < 1 + 4 || packet_length > 256 * 1024) { | 1106 | if (packet_length < 1 + 4 || packet_length > 256 * 1024) { |
1082 | #ifdef PACKET_DEBUG | 1107 | #ifdef PACKET_DEBUG |
1083 | buffer_dump(&incoming_packet); | 1108 | buffer_dump(&incoming_packet); |
@@ -1208,7 +1233,6 @@ packet_read_poll_seqnr(u_int32_t *seqnr_p) | |||
1208 | break; | 1233 | break; |
1209 | default: | 1234 | default: |
1210 | return type; | 1235 | return type; |
1211 | break; | ||
1212 | } | 1236 | } |
1213 | } else { | 1237 | } else { |
1214 | type = packet_read_poll1(); | 1238 | type = packet_read_poll1(); |
@@ -1231,7 +1255,6 @@ packet_read_poll_seqnr(u_int32_t *seqnr_p) | |||
1231 | if (type) | 1255 | if (type) |
1232 | DBG(debug("received packet type %d", type)); | 1256 | DBG(debug("received packet type %d", type)); |
1233 | return type; | 1257 | return type; |
1234 | break; | ||
1235 | } | 1258 | } |
1236 | } | 1259 | } |
1237 | } | 1260 | } |
@@ -1433,7 +1456,7 @@ packet_write_wait(void) | |||
1433 | { | 1456 | { |
1434 | fd_set *setp; | 1457 | fd_set *setp; |
1435 | 1458 | ||
1436 | setp = (fd_set *)xmalloc(howmany(connection_out + 1, NFDBITS) * | 1459 | setp = (fd_set *)xcalloc(howmany(connection_out + 1, NFDBITS), |
1437 | sizeof(fd_mask)); | 1460 | sizeof(fd_mask)); |
1438 | packet_write_poll(); | 1461 | packet_write_poll(); |
1439 | while (packet_have_data_to_write()) { | 1462 | while (packet_have_data_to_write()) { |
@@ -1501,8 +1524,7 @@ packet_set_interactive(int interactive) | |||
1501 | /* Only set socket options if using a socket. */ | 1524 | /* Only set socket options if using a socket. */ |
1502 | if (!packet_connection_is_on_socket()) | 1525 | if (!packet_connection_is_on_socket()) |
1503 | return; | 1526 | return; |
1504 | if (interactive) | 1527 | set_nodelay(connection_in); |
1505 | set_nodelay(connection_in); | ||
1506 | packet_set_tos(interactive); | 1528 | packet_set_tos(interactive); |
1507 | } | 1529 | } |
1508 | 1530 | ||
@@ -1563,7 +1585,7 @@ packet_send_ignore(int nbytes) | |||
1563 | for (i = 0; i < nbytes; i++) { | 1585 | for (i = 0; i < nbytes; i++) { |
1564 | if (i % 4 == 0) | 1586 | if (i % 4 == 0) |
1565 | rnd = arc4random(); | 1587 | rnd = arc4random(); |
1566 | packet_put_char(rnd & 0xff); | 1588 | packet_put_char((u_char)rnd & 0xff); |
1567 | rnd >>= 8; | 1589 | rnd >>= 8; |
1568 | } | 1590 | } |
1569 | } | 1591 | } |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: packet.h,v 1.43 2005/07/25 11:59:40 markus Exp $ */ | 1 | /* $OpenBSD: packet.h,v 1.45 2006/03/25 22:22:43 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -16,6 +16,8 @@ | |||
16 | #ifndef PACKET_H | 16 | #ifndef PACKET_H |
17 | #define PACKET_H | 17 | #define PACKET_H |
18 | 18 | ||
19 | #include <termios.h> | ||
20 | |||
19 | #include <openssl/bn.h> | 21 | #include <openssl/bn.h> |
20 | 22 | ||
21 | void packet_set_connection(int, int, int); | 23 | void packet_set_connection(int, int, int); |
diff --git a/pathnames.h b/pathnames.h index cf42625a4..f2571e274 100644 --- a/pathnames.h +++ b/pathnames.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: pathnames.h,v 1.15 2004/07/11 17:48:47 deraadt Exp $ */ | 1 | /* $OpenBSD: pathnames.h,v 1.16 2006/03/25 22:22:43 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
diff --git a/platform.c b/platform.c new file mode 100644 index 000000000..aee4b01e7 --- /dev/null +++ b/platform.c | |||
@@ -0,0 +1,46 @@ | |||
1 | /* $Id: platform.c,v 1.1 2006/08/30 17:24:41 djm Exp $ */ | ||
2 | |||
3 | /* | ||
4 | * Copyright (c) 2006 Darren Tucker. All rights reserved. | ||
5 | * | ||
6 | * Permission to use, copy, modify, and distribute this software for any | ||
7 | * purpose with or without fee is hereby granted, provided that the above | ||
8 | * copyright notice and this permission notice appear in all copies. | ||
9 | * | ||
10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
17 | */ | ||
18 | |||
19 | #include "config.h" | ||
20 | #include "platform.h" | ||
21 | |||
22 | #include "openbsd-compat/openbsd-compat.h" | ||
23 | |||
24 | void | ||
25 | platform_pre_fork(void) | ||
26 | { | ||
27 | #ifdef USE_SOLARIS_PROCESS_CONTRACTS | ||
28 | solaris_contract_pre_fork(); | ||
29 | #endif | ||
30 | } | ||
31 | |||
32 | void | ||
33 | platform_post_fork_parent(pid_t child_pid) | ||
34 | { | ||
35 | #ifdef USE_SOLARIS_PROCESS_CONTRACTS | ||
36 | solaris_contract_post_fork_parent(child_pid); | ||
37 | #endif | ||
38 | } | ||
39 | |||
40 | void | ||
41 | platform_post_fork_child(void) | ||
42 | { | ||
43 | #ifdef USE_SOLARIS_PROCESS_CONTRACTS | ||
44 | solaris_contract_post_fork_child(); | ||
45 | #endif | ||
46 | } | ||
diff --git a/platform.h b/platform.h new file mode 100644 index 000000000..cf93bc57c --- /dev/null +++ b/platform.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* $Id: platform.h,v 1.1 2006/08/30 17:24:41 djm Exp $ */ | ||
2 | |||
3 | /* | ||
4 | * Copyright (c) 2006 Darren Tucker. All rights reserved. | ||
5 | * | ||
6 | * Permission to use, copy, modify, and distribute this software for any | ||
7 | * purpose with or without fee is hereby granted, provided that the above | ||
8 | * copyright notice and this permission notice appear in all copies. | ||
9 | * | ||
10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
17 | */ | ||
18 | |||
19 | #include <sys/types.h> | ||
20 | |||
21 | void platform_pre_fork(void); | ||
22 | void platform_post_fork_parent(pid_t child_pid); | ||
23 | void platform_post_fork_child(void); | ||
diff --git a/progressmeter.c b/progressmeter.c index 13c51d87e..0f95222d2 100644 --- a/progressmeter.c +++ b/progressmeter.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: progressmeter.c,v 1.37 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2003 Nils Nordman. All rights reserved. | 3 | * Copyright (c) 2003 Nils Nordman. All rights reserved. |
3 | * | 4 | * |
@@ -23,7 +24,17 @@ | |||
23 | */ | 24 | */ |
24 | 25 | ||
25 | #include "includes.h" | 26 | #include "includes.h" |
26 | RCSID("$OpenBSD: progressmeter.c,v 1.24 2005/06/07 13:25:23 jaredy Exp $"); | 27 | |
28 | #include <sys/types.h> | ||
29 | #include <sys/ioctl.h> | ||
30 | #include <sys/uio.h> | ||
31 | |||
32 | #include <errno.h> | ||
33 | #include <signal.h> | ||
34 | #include <stdio.h> | ||
35 | #include <string.h> | ||
36 | #include <time.h> | ||
37 | #include <unistd.h> | ||
27 | 38 | ||
28 | #include "progressmeter.h" | 39 | #include "progressmeter.h" |
29 | #include "atomicio.h" | 40 | #include "atomicio.h" |
@@ -154,7 +165,7 @@ refresh_progress_meter(void) | |||
154 | len = 0; | 165 | len = 0; |
155 | if (len >= file_len + 1) | 166 | if (len >= file_len + 1) |
156 | len = file_len; | 167 | len = file_len; |
157 | for (i = len; i < file_len; i++ ) | 168 | for (i = len; i < file_len; i++) |
158 | buf[i] = ' '; | 169 | buf[i] = ' '; |
159 | buf[file_len] = '\0'; | 170 | buf[file_len] = '\0'; |
160 | } | 171 | } |
@@ -215,6 +226,7 @@ refresh_progress_meter(void) | |||
215 | last_update = now; | 226 | last_update = now; |
216 | } | 227 | } |
217 | 228 | ||
229 | /*ARGSUSED*/ | ||
218 | static void | 230 | static void |
219 | update_progress_meter(int ignore) | 231 | update_progress_meter(int ignore) |
220 | { | 232 | { |
@@ -269,6 +281,7 @@ stop_progress_meter(void) | |||
269 | atomicio(vwrite, STDOUT_FILENO, "\n", 1); | 281 | atomicio(vwrite, STDOUT_FILENO, "\n", 1); |
270 | } | 282 | } |
271 | 283 | ||
284 | /*ARGSUSED*/ | ||
272 | static void | 285 | static void |
273 | sig_winch(int sig) | 286 | sig_winch(int sig) |
274 | { | 287 | { |
diff --git a/progressmeter.h b/progressmeter.h index bfb9a0b77..10bab99ba 100644 --- a/progressmeter.h +++ b/progressmeter.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: progressmeter.h,v 1.1 2003/01/10 08:19:07 fgsch Exp $ */ | 1 | /* $OpenBSD: progressmeter.h,v 1.2 2006/03/25 22:22:43 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2002 Nils Nordman. All rights reserved. | 3 | * Copyright (c) 2002 Nils Nordman. All rights reserved. |
4 | * | 4 | * |
diff --git a/readconf.c b/readconf.c index b3e14b9d2..6a0ffd634 100644 --- a/readconf.c +++ b/readconf.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: readconf.c,v 1.161 2007/01/21 01:45:35 stevesk Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -12,17 +13,33 @@ | |||
12 | */ | 13 | */ |
13 | 14 | ||
14 | #include "includes.h" | 15 | #include "includes.h" |
15 | RCSID("$OpenBSD: readconf.c,v 1.145 2005/12/08 18:34:11 reyk Exp $"); | ||
16 | 16 | ||
17 | #include "ssh.h" | 17 | #include <sys/types.h> |
18 | #include <sys/stat.h> | ||
19 | #include <sys/socket.h> | ||
20 | |||
21 | #include <netinet/in.h> | ||
22 | |||
23 | #include <ctype.h> | ||
24 | #include <errno.h> | ||
25 | #include <netdb.h> | ||
26 | #include <signal.h> | ||
27 | #include <stdarg.h> | ||
28 | #include <stdio.h> | ||
29 | #include <string.h> | ||
30 | #include <unistd.h> | ||
31 | |||
18 | #include "xmalloc.h" | 32 | #include "xmalloc.h" |
33 | #include "ssh.h" | ||
19 | #include "compat.h" | 34 | #include "compat.h" |
20 | #include "cipher.h" | 35 | #include "cipher.h" |
21 | #include "pathnames.h" | 36 | #include "pathnames.h" |
22 | #include "log.h" | 37 | #include "log.h" |
38 | #include "key.h" | ||
23 | #include "readconf.h" | 39 | #include "readconf.h" |
24 | #include "match.h" | 40 | #include "match.h" |
25 | #include "misc.h" | 41 | #include "misc.h" |
42 | #include "buffer.h" | ||
26 | #include "kex.h" | 43 | #include "kex.h" |
27 | #include "mac.h" | 44 | #include "mac.h" |
28 | 45 | ||
@@ -94,6 +111,7 @@ RCSID("$OpenBSD: readconf.c,v 1.145 2005/12/08 18:34:11 reyk Exp $"); | |||
94 | typedef enum { | 111 | typedef enum { |
95 | oBadOption, | 112 | oBadOption, |
96 | oForwardAgent, oForwardX11, oForwardX11Trusted, oGatewayPorts, | 113 | oForwardAgent, oForwardX11, oForwardX11Trusted, oGatewayPorts, |
114 | oExitOnForwardFailure, | ||
97 | oPasswordAuthentication, oRSAAuthentication, | 115 | oPasswordAuthentication, oRSAAuthentication, |
98 | oChallengeResponseAuthentication, oXAuthLocation, | 116 | oChallengeResponseAuthentication, oXAuthLocation, |
99 | oIdentityFile, oHostName, oPort, oCipher, oRemoteForward, oLocalForward, | 117 | oIdentityFile, oHostName, oPort, oCipher, oRemoteForward, oLocalForward, |
@@ -109,6 +127,7 @@ typedef enum { | |||
109 | oClearAllForwardings, oNoHostAuthenticationForLocalhost, | 127 | oClearAllForwardings, oNoHostAuthenticationForLocalhost, |
110 | oEnableSSHKeysign, oRekeyLimit, oVerifyHostKeyDNS, oConnectTimeout, | 128 | oEnableSSHKeysign, oRekeyLimit, oVerifyHostKeyDNS, oConnectTimeout, |
111 | oAddressFamily, oGssAuthentication, oGssDelegateCreds, | 129 | oAddressFamily, oGssAuthentication, oGssDelegateCreds, |
130 | oGssKeyEx, | ||
112 | oGssTrustDns, | 131 | oGssTrustDns, |
113 | oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly, | 132 | oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly, |
114 | oSendEnv, oControlPath, oControlMaster, oHashKnownHosts, | 133 | oSendEnv, oControlPath, oControlMaster, oHashKnownHosts, |
@@ -126,6 +145,7 @@ static struct { | |||
126 | { "forwardagent", oForwardAgent }, | 145 | { "forwardagent", oForwardAgent }, |
127 | { "forwardx11", oForwardX11 }, | 146 | { "forwardx11", oForwardX11 }, |
128 | { "forwardx11trusted", oForwardX11Trusted }, | 147 | { "forwardx11trusted", oForwardX11Trusted }, |
148 | { "exitonforwardfailure", oExitOnForwardFailure }, | ||
129 | { "xauthlocation", oXAuthLocation }, | 149 | { "xauthlocation", oXAuthLocation }, |
130 | { "gatewayports", oGatewayPorts }, | 150 | { "gatewayports", oGatewayPorts }, |
131 | { "useprivilegedport", oUsePrivilegedPort }, | 151 | { "useprivilegedport", oUsePrivilegedPort }, |
@@ -146,10 +166,12 @@ static struct { | |||
146 | { "afstokenpassing", oUnsupported }, | 166 | { "afstokenpassing", oUnsupported }, |
147 | #if defined(GSSAPI) | 167 | #if defined(GSSAPI) |
148 | { "gssapiauthentication", oGssAuthentication }, | 168 | { "gssapiauthentication", oGssAuthentication }, |
169 | { "gssapikeyexchange", oGssKeyEx }, | ||
149 | { "gssapidelegatecredentials", oGssDelegateCreds }, | 170 | { "gssapidelegatecredentials", oGssDelegateCreds }, |
150 | { "gssapitrustdns", oGssTrustDns }, | 171 | { "gssapitrustdns", oGssTrustDns }, |
151 | #else | 172 | #else |
152 | { "gssapiauthentication", oUnsupported }, | 173 | { "gssapiauthentication", oUnsupported }, |
174 | { "gssapikeyexchange", oUnsupported }, | ||
153 | { "gssapidelegatecredentials", oUnsupported }, | 175 | { "gssapidelegatecredentials", oUnsupported }, |
154 | { "gssapitrustdns", oUnsupported }, | 176 | { "gssapitrustdns", oUnsupported }, |
155 | #endif | 177 | #endif |
@@ -312,7 +334,8 @@ process_config_line(Options *options, const char *host, | |||
312 | int *activep) | 334 | int *activep) |
313 | { | 335 | { |
314 | char *s, **charptr, *endofnumber, *keyword, *arg, *arg2, fwdarg[256]; | 336 | char *s, **charptr, *endofnumber, *keyword, *arg, *arg2, fwdarg[256]; |
315 | int opcode, *intptr, value, value2; | 337 | int opcode, *intptr, value, value2, scale; |
338 | long long orig, val64; | ||
316 | size_t len; | 339 | size_t len; |
317 | Forward fwd; | 340 | Forward fwd; |
318 | 341 | ||
@@ -325,7 +348,8 @@ process_config_line(Options *options, const char *host, | |||
325 | 348 | ||
326 | s = line; | 349 | s = line; |
327 | /* Get the keyword. (Each line is supposed to begin with a keyword). */ | 350 | /* Get the keyword. (Each line is supposed to begin with a keyword). */ |
328 | keyword = strdelim(&s); | 351 | if ((keyword = strdelim(&s)) == NULL) |
352 | return 0; | ||
329 | /* Ignore leading whitespace. */ | 353 | /* Ignore leading whitespace. */ |
330 | if (*keyword == '\0') | 354 | if (*keyword == '\0') |
331 | keyword = strdelim(&s); | 355 | keyword = strdelim(&s); |
@@ -349,7 +373,7 @@ parse_time: | |||
349 | if ((value = convtime(arg)) == -1) | 373 | if ((value = convtime(arg)) == -1) |
350 | fatal("%s line %d: invalid time value.", | 374 | fatal("%s line %d: invalid time value.", |
351 | filename, linenum); | 375 | filename, linenum); |
352 | if (*intptr == -1) | 376 | if (*activep && *intptr == -1) |
353 | *intptr = value; | 377 | *intptr = value; |
354 | break; | 378 | break; |
355 | 379 | ||
@@ -382,6 +406,10 @@ parse_flag: | |||
382 | intptr = &options->gateway_ports; | 406 | intptr = &options->gateway_ports; |
383 | goto parse_flag; | 407 | goto parse_flag; |
384 | 408 | ||
409 | case oExitOnForwardFailure: | ||
410 | intptr = &options->exit_on_forward_failure; | ||
411 | goto parse_flag; | ||
412 | |||
385 | case oUsePrivilegedPort: | 413 | case oUsePrivilegedPort: |
386 | intptr = &options->use_privileged_port; | 414 | intptr = &options->use_privileged_port; |
387 | goto parse_flag; | 415 | goto parse_flag; |
@@ -422,6 +450,10 @@ parse_flag: | |||
422 | intptr = &options->gss_authentication; | 450 | intptr = &options->gss_authentication; |
423 | goto parse_flag; | 451 | goto parse_flag; |
424 | 452 | ||
453 | case oGssKeyEx: | ||
454 | intptr = &options->gss_keyex; | ||
455 | goto parse_flag; | ||
456 | |||
425 | case oGssDelegateCreds: | 457 | case oGssDelegateCreds: |
426 | intptr = &options->gss_deleg_creds; | 458 | intptr = &options->gss_deleg_creds; |
427 | goto parse_flag; | 459 | goto parse_flag; |
@@ -489,22 +521,36 @@ parse_yesnoask: | |||
489 | fatal("%.200s line %d: Missing argument.", filename, linenum); | 521 | fatal("%.200s line %d: Missing argument.", filename, linenum); |
490 | if (arg[0] < '0' || arg[0] > '9') | 522 | if (arg[0] < '0' || arg[0] > '9') |
491 | fatal("%.200s line %d: Bad number.", filename, linenum); | 523 | fatal("%.200s line %d: Bad number.", filename, linenum); |
492 | value = strtol(arg, &endofnumber, 10); | 524 | orig = val64 = strtoll(arg, &endofnumber, 10); |
493 | if (arg == endofnumber) | 525 | if (arg == endofnumber) |
494 | fatal("%.200s line %d: Bad number.", filename, linenum); | 526 | fatal("%.200s line %d: Bad number.", filename, linenum); |
495 | switch (toupper(*endofnumber)) { | 527 | switch (toupper(*endofnumber)) { |
528 | case '\0': | ||
529 | scale = 1; | ||
530 | break; | ||
496 | case 'K': | 531 | case 'K': |
497 | value *= 1<<10; | 532 | scale = 1<<10; |
498 | break; | 533 | break; |
499 | case 'M': | 534 | case 'M': |
500 | value *= 1<<20; | 535 | scale = 1<<20; |
501 | break; | 536 | break; |
502 | case 'G': | 537 | case 'G': |
503 | value *= 1<<30; | 538 | scale = 1<<30; |
504 | break; | 539 | break; |
540 | default: | ||
541 | fatal("%.200s line %d: Invalid RekeyLimit suffix", | ||
542 | filename, linenum); | ||
505 | } | 543 | } |
544 | val64 *= scale; | ||
545 | /* detect integer wrap and too-large limits */ | ||
546 | if ((val64 / scale) != orig || val64 > INT_MAX) | ||
547 | fatal("%.200s line %d: RekeyLimit too large", | ||
548 | filename, linenum); | ||
549 | if (val64 < 16) | ||
550 | fatal("%.200s line %d: RekeyLimit too small", | ||
551 | filename, linenum); | ||
506 | if (*activep && *intptr == -1) | 552 | if (*activep && *intptr == -1) |
507 | *intptr = value; | 553 | *intptr = (int)val64; |
508 | break; | 554 | break; |
509 | 555 | ||
510 | case oIdentityFile: | 556 | case oIdentityFile: |
@@ -516,7 +562,7 @@ parse_yesnoask: | |||
516 | if (*intptr >= SSH_MAX_IDENTITY_FILES) | 562 | if (*intptr >= SSH_MAX_IDENTITY_FILES) |
517 | fatal("%.200s line %d: Too many identity files specified (max %d).", | 563 | fatal("%.200s line %d: Too many identity files specified (max %d).", |
518 | filename, linenum, SSH_MAX_IDENTITY_FILES); | 564 | filename, linenum, SSH_MAX_IDENTITY_FILES); |
519 | charptr = &options->identity_files[*intptr]; | 565 | charptr = &options->identity_files[*intptr]; |
520 | *charptr = xstrdup(arg); | 566 | *charptr = xstrdup(arg); |
521 | *intptr = *intptr + 1; | 567 | *intptr = *intptr + 1; |
522 | } | 568 | } |
@@ -997,6 +1043,7 @@ initialize_options(Options * options) | |||
997 | options->forward_agent = -1; | 1043 | options->forward_agent = -1; |
998 | options->forward_x11 = -1; | 1044 | options->forward_x11 = -1; |
999 | options->forward_x11_trusted = -1; | 1045 | options->forward_x11_trusted = -1; |
1046 | options->exit_on_forward_failure = -1; | ||
1000 | options->xauth_location = NULL; | 1047 | options->xauth_location = NULL; |
1001 | options->gateway_ports = -1; | 1048 | options->gateway_ports = -1; |
1002 | options->use_privileged_port = -1; | 1049 | options->use_privileged_port = -1; |
@@ -1004,6 +1051,7 @@ initialize_options(Options * options) | |||
1004 | options->pubkey_authentication = -1; | 1051 | options->pubkey_authentication = -1; |
1005 | options->challenge_response_authentication = -1; | 1052 | options->challenge_response_authentication = -1; |
1006 | options->gss_authentication = -1; | 1053 | options->gss_authentication = -1; |
1054 | options->gss_keyex = -1; | ||
1007 | options->gss_deleg_creds = -1; | 1055 | options->gss_deleg_creds = -1; |
1008 | options->gss_trust_dns = -1; | 1056 | options->gss_trust_dns = -1; |
1009 | options->password_authentication = -1; | 1057 | options->password_authentication = -1; |
@@ -1079,6 +1127,8 @@ fill_default_options(Options * options) | |||
1079 | options->forward_x11 = 0; | 1127 | options->forward_x11 = 0; |
1080 | if (options->forward_x11_trusted == -1) | 1128 | if (options->forward_x11_trusted == -1) |
1081 | options->forward_x11_trusted = 1; | 1129 | options->forward_x11_trusted = 1; |
1130 | if (options->exit_on_forward_failure == -1) | ||
1131 | options->exit_on_forward_failure = 0; | ||
1082 | if (options->xauth_location == NULL) | 1132 | if (options->xauth_location == NULL) |
1083 | options->xauth_location = _PATH_XAUTH; | 1133 | options->xauth_location = _PATH_XAUTH; |
1084 | if (options->gateway_ports == -1) | 1134 | if (options->gateway_ports == -1) |
@@ -1093,6 +1143,8 @@ fill_default_options(Options * options) | |||
1093 | options->challenge_response_authentication = 1; | 1143 | options->challenge_response_authentication = 1; |
1094 | if (options->gss_authentication == -1) | 1144 | if (options->gss_authentication == -1) |
1095 | options->gss_authentication = 0; | 1145 | options->gss_authentication = 0; |
1146 | if (options->gss_keyex == -1) | ||
1147 | options->gss_keyex = 0; | ||
1096 | if (options->gss_deleg_creds == -1) | 1148 | if (options->gss_deleg_creds == -1) |
1097 | options->gss_deleg_creds = 0; | 1149 | options->gss_deleg_creds = 0; |
1098 | if (options->gss_trust_dns == -1) | 1150 | if (options->gss_trust_dns == -1) |
diff --git a/readconf.h b/readconf.h index 4639a74a4..a7d9200b5 100644 --- a/readconf.h +++ b/readconf.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: readconf.h,v 1.68 2005/12/06 22:38:27 reyk Exp $ */ | 1 | /* $OpenBSD: readconf.h,v 1.71 2006/08/03 03:34:42 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -16,8 +16,6 @@ | |||
16 | #ifndef READCONF_H | 16 | #ifndef READCONF_H |
17 | #define READCONF_H | 17 | #define READCONF_H |
18 | 18 | ||
19 | #include "key.h" | ||
20 | |||
21 | /* Data structure for representing a forwarding request. */ | 19 | /* Data structure for representing a forwarding request. */ |
22 | 20 | ||
23 | typedef struct { | 21 | typedef struct { |
@@ -34,6 +32,7 @@ typedef struct { | |||
34 | int forward_agent; /* Forward authentication agent. */ | 32 | int forward_agent; /* Forward authentication agent. */ |
35 | int forward_x11; /* Forward X11 display. */ | 33 | int forward_x11; /* Forward X11 display. */ |
36 | int forward_x11_trusted; /* Trust Forward X11 display. */ | 34 | int forward_x11_trusted; /* Trust Forward X11 display. */ |
35 | int exit_on_forward_failure; /* Exit if bind(2) fails for -L/-R */ | ||
37 | char *xauth_location; /* Location for xauth program */ | 36 | char *xauth_location; /* Location for xauth program */ |
38 | int gateway_ports; /* Allow remote connects to forwarded ports. */ | 37 | int gateway_ports; /* Allow remote connects to forwarded ports. */ |
39 | int use_privileged_port; /* Don't use privileged port if false. */ | 38 | int use_privileged_port; /* Don't use privileged port if false. */ |
@@ -45,6 +44,7 @@ typedef struct { | |||
45 | int challenge_response_authentication; | 44 | int challenge_response_authentication; |
46 | /* Try S/Key or TIS, authentication. */ | 45 | /* Try S/Key or TIS, authentication. */ |
47 | int gss_authentication; /* Try GSS authentication */ | 46 | int gss_authentication; /* Try GSS authentication */ |
47 | int gss_keyex; /* Try GSS key exchange */ | ||
48 | int gss_deleg_creds; /* Delegate GSS credentials */ | 48 | int gss_deleg_creds; /* Delegate GSS credentials */ |
49 | int gss_trust_dns; /* Trust DNS for GSS canonicalization */ | 49 | int gss_trust_dns; /* Trust DNS for GSS canonicalization */ |
50 | int password_authentication; /* Try password | 50 | int password_authentication; /* Try password |
@@ -58,7 +58,7 @@ typedef struct { | |||
58 | int compression_level; /* Compression level 1 (fast) to 9 | 58 | int compression_level; /* Compression level 1 (fast) to 9 |
59 | * (best). */ | 59 | * (best). */ |
60 | int tcp_keep_alive; /* Set SO_KEEPALIVE. */ | 60 | int tcp_keep_alive; /* Set SO_KEEPALIVE. */ |
61 | int setuptimeout; /* timeout in the protocol banner exchange */ | 61 | int setuptimeout; /* timeout in the protocol banner exchange */ |
62 | LogLevel log_level; /* Level for logging. */ | 62 | LogLevel log_level; /* Level for logging. */ |
63 | 63 | ||
64 | int port; /* Port to connect. */ | 64 | int port; /* Port to connect. */ |
diff --git a/readpass.c b/readpass.c index 7914799a4..bd144c2e3 100644 --- a/readpass.c +++ b/readpass.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: readpass.c,v 1.47 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
3 | * | 4 | * |
@@ -23,13 +24,27 @@ | |||
23 | */ | 24 | */ |
24 | 25 | ||
25 | #include "includes.h" | 26 | #include "includes.h" |
26 | RCSID("$OpenBSD: readpass.c,v 1.33 2005/05/02 21:13:22 markus Exp $"); | 27 | |
28 | #include <sys/types.h> | ||
29 | #include <sys/wait.h> | ||
30 | |||
31 | #include <errno.h> | ||
32 | #include <fcntl.h> | ||
33 | #ifdef HAVE_PATHS_H | ||
34 | # include <paths.h> | ||
35 | #endif | ||
36 | #include <stdarg.h> | ||
37 | #include <stdio.h> | ||
38 | #include <stdlib.h> | ||
39 | #include <string.h> | ||
40 | #include <unistd.h> | ||
27 | 41 | ||
28 | #include "xmalloc.h" | 42 | #include "xmalloc.h" |
29 | #include "misc.h" | 43 | #include "misc.h" |
30 | #include "pathnames.h" | 44 | #include "pathnames.h" |
31 | #include "log.h" | 45 | #include "log.h" |
32 | #include "ssh.h" | 46 | #include "ssh.h" |
47 | #include "uidswap.h" | ||
33 | 48 | ||
34 | static char * | 49 | static char * |
35 | ssh_askpass(char *askpass, const char *msg) | 50 | ssh_askpass(char *askpass, const char *msg) |
@@ -53,8 +68,7 @@ ssh_askpass(char *askpass, const char *msg) | |||
53 | return NULL; | 68 | return NULL; |
54 | } | 69 | } |
55 | if (pid == 0) { | 70 | if (pid == 0) { |
56 | seteuid(getuid()); | 71 | permanently_drop_suid(getuid()); |
57 | setuid(getuid()); | ||
58 | close(p[0]); | 72 | close(p[0]); |
59 | if (dup2(p[1], STDOUT_FILENO) < 0) | 73 | if (dup2(p[1], STDOUT_FILENO) < 0) |
60 | fatal("ssh_askpass: dup2: %s", strerror(errno)); | 74 | fatal("ssh_askpass: dup2: %s", strerror(errno)); |
diff --git a/regress/Makefile b/regress/Makefile index 4f47bc3fd..539956398 100644 --- a/regress/Makefile +++ b/regress/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.36 2005/03/04 08:48:46 djm Exp $ | 1 | # $OpenBSD: Makefile,v 1.42 2006/07/19 13:34:52 dtucker Exp $ |
2 | 2 | ||
3 | REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t-exec | 3 | REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t-exec |
4 | tests: $(REGRESS_TARGETS) | 4 | tests: $(REGRESS_TARGETS) |
@@ -40,7 +40,9 @@ LTESTS= connect \ | |||
40 | forwarding \ | 40 | forwarding \ |
41 | multiplex \ | 41 | multiplex \ |
42 | reexec \ | 42 | reexec \ |
43 | brokenkeys | 43 | brokenkeys \ |
44 | cfgmatch \ | ||
45 | forcecommand | ||
44 | 46 | ||
45 | USER!= id -un | 47 | USER!= id -un |
46 | CLEANFILES= t2.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \ | 48 | CLEANFILES= t2.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \ |
@@ -49,8 +51,8 @@ CLEANFILES= t2.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \ | |||
49 | rsa.pub rsa rsa1.pub rsa1 host.rsa host.rsa1 \ | 51 | rsa.pub rsa rsa1.pub rsa1 host.rsa host.rsa1 \ |
50 | rsa-agent rsa-agent.pub rsa1-agent rsa1-agent.pub \ | 52 | rsa-agent rsa-agent.pub rsa1-agent rsa1-agent.pub \ |
51 | ls.copy banner.in banner.out empty.in \ | 53 | ls.copy banner.in banner.out empty.in \ |
52 | scp-ssh-wrapper.scp ssh_proxy_envpass \ | 54 | scp-ssh-wrapper.scp ssh_proxy_envpass remote_pid \ |
53 | remote_pid | 55 | sshd_proxy_bak rsa_ssh2_cr.prv rsa_ssh2_crnl.prv |
54 | 56 | ||
55 | #LTESTS += ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp | 57 | #LTESTS += ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp |
56 | 58 | ||
diff --git a/regress/agent-getpeereid.sh b/regress/agent-getpeereid.sh index 6186a8d48..e5fcedda7 100644 --- a/regress/agent-getpeereid.sh +++ b/regress/agent-getpeereid.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: agent-getpeereid.sh,v 1.2 2005/11/14 21:25:56 grunk Exp $ | 1 | # $OpenBSD: agent-getpeereid.sh,v 1.3 2006/07/06 12:01:53 grunk Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | tid="disallow agent attach from other uid" | 4 | tid="disallow agent attach from other uid" |
@@ -12,6 +12,11 @@ then | |||
12 | echo "skipped (not supported on this platform)" | 12 | echo "skipped (not supported on this platform)" |
13 | exit 0 | 13 | exit 0 |
14 | fi | 14 | fi |
15 | if [ -z "$SUDO" ]; then | ||
16 | echo "skipped: need SUDO to switch to uid $UNPRIV" | ||
17 | exit 0 | ||
18 | fi | ||
19 | |||
15 | 20 | ||
16 | trace "start agent" | 21 | trace "start agent" |
17 | eval `${SSHAGENT} -s -a ${ASOCK}` > /dev/null | 22 | eval `${SSHAGENT} -s -a ${ASOCK}` > /dev/null |
diff --git a/regress/agent-ptrace.sh b/regress/agent-ptrace.sh index 4de2638e4..d5892ed03 100644 --- a/regress/agent-ptrace.sh +++ b/regress/agent-ptrace.sh | |||
@@ -41,7 +41,7 @@ EOF | |||
41 | if [ $? -ne 0 ]; then | 41 | if [ $? -ne 0 ]; then |
42 | fail "gdb failed: exit code $?" | 42 | fail "gdb failed: exit code $?" |
43 | fi | 43 | fi |
44 | egrep 'ptrace: Operation not permitted.|procfs:.*Permission denied.|ttrace attach: Permission denied.|procfs:.*: Invalid argument.' >/dev/null ${OBJ}/gdb.out | 44 | egrep 'ptrace: Operation not permitted.|procfs:.*Permission denied.|ttrace.*Permission denied.|procfs:.*: Invalid argument.' >/dev/null ${OBJ}/gdb.out |
45 | r=$? | 45 | r=$? |
46 | rm -f ${OBJ}/gdb.out | 46 | rm -f ${OBJ}/gdb.out |
47 | if [ $r -ne 0 ]; then | 47 | if [ $r -ne 0 ]; then |
diff --git a/regress/cfgmatch.sh b/regress/cfgmatch.sh new file mode 100644 index 000000000..d987dcb97 --- /dev/null +++ b/regress/cfgmatch.sh | |||
@@ -0,0 +1,106 @@ | |||
1 | # $OpenBSD: cfgmatch.sh,v 1.2 2006/07/22 01:50:00 dtucker Exp $ | ||
2 | # Placed in the Public Domain. | ||
3 | |||
4 | tid="sshd_config match" | ||
5 | |||
6 | pidfile=$OBJ/remote_pid | ||
7 | fwdport=3301 | ||
8 | fwd="-L $fwdport:127.0.0.1:$PORT" | ||
9 | |||
10 | stop_client() | ||
11 | { | ||
12 | pid=`cat $pidfile` | ||
13 | if [ ! -z "$pid" ]; then | ||
14 | kill $pid | ||
15 | sleep 1 | ||
16 | fi | ||
17 | } | ||
18 | |||
19 | cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak | ||
20 | |||
21 | echo "PermitOpen 127.0.0.1:1" >>$OBJ/sshd_config | ||
22 | echo "Match Address 127.0.0.1" >>$OBJ/sshd_config | ||
23 | echo "PermitOpen 127.0.0.1:$PORT" >>$OBJ/sshd_config | ||
24 | |||
25 | echo "PermitOpen 127.0.0.1:1" >>$OBJ/sshd_proxy | ||
26 | echo "Match Address 127.0.0.1" >>$OBJ/sshd_proxy | ||
27 | echo "PermitOpen 127.0.0.1:$PORT" >>$OBJ/sshd_proxy | ||
28 | |||
29 | start_sshd | ||
30 | |||
31 | #set -x | ||
32 | |||
33 | # Test Match + PermitOpen in sshd_config. This should be permitted | ||
34 | for p in 1 2; do | ||
35 | rm -f $pidfile | ||
36 | trace "match permitopen localhost proto $p" | ||
37 | ${SSH} -$p $fwd -F $OBJ/ssh_config -f somehost \ | ||
38 | "echo \$\$ > $pidfile; exec sleep 100" >>$TEST_SSH_LOGFILE 2>&1 ||\ | ||
39 | fail "match permitopen proto $p sshd failed" | ||
40 | sleep 1; | ||
41 | ${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true || \ | ||
42 | fail "match permitopen permit proto $p" | ||
43 | stop_client | ||
44 | done | ||
45 | |||
46 | # Same but from different source. This should not be permitted | ||
47 | for p in 1 2; do | ||
48 | rm -f $pidfile | ||
49 | trace "match permitopen proxy proto $p" | ||
50 | ${SSH} -q -$p $fwd -F $OBJ/ssh_proxy -f somehost \ | ||
51 | "echo \$\$ > $pidfile; exec sleep 100" >>$TEST_SSH_LOGFILE 2>&1 ||\ | ||
52 | fail "match permitopen proxy proto $p sshd failed" | ||
53 | sleep 1; | ||
54 | ${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true && \ | ||
55 | fail "match permitopen deny proto $p" | ||
56 | stop_client | ||
57 | done | ||
58 | |||
59 | # Retry previous with key option, should also be denied. | ||
60 | echo -n 'permitopen="127.0.0.1:'$PORT'" ' >$OBJ/authorized_keys_$USER | ||
61 | cat $OBJ/rsa.pub >> $OBJ/authorized_keys_$USER | ||
62 | echo -n 'permitopen="127.0.0.1:'$PORT'" ' >>$OBJ/authorized_keys_$USER | ||
63 | cat $OBJ/rsa1.pub >> $OBJ/authorized_keys_$USER | ||
64 | for p in 1 2; do | ||
65 | rm -f $pidfile | ||
66 | trace "match permitopen proxy w/key opts proto $p" | ||
67 | ${SSH} -q -$p $fwd -F $OBJ/ssh_proxy -f somehost \ | ||
68 | "echo \$\$ > $pidfile; exec sleep 100" >>$TEST_SSH_LOGFILE 2>&1 ||\ | ||
69 | fail "match permitopen w/key opt proto $p sshd failed" | ||
70 | sleep 1; | ||
71 | ${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true && \ | ||
72 | fail "match permitopen deny w/key opt proto $p" | ||
73 | stop_client | ||
74 | done | ||
75 | |||
76 | # Test both sshd_config and key options permitting the same dst/port pair. | ||
77 | # Should be permitted. | ||
78 | for p in 1 2; do | ||
79 | rm -f $pidfile | ||
80 | trace "match permitopen localhost proto $p" | ||
81 | ${SSH} -$p $fwd -F $OBJ/ssh_config -f somehost \ | ||
82 | "echo \$\$ > $pidfile; exec sleep 100" >>$TEST_SSH_LOGFILE 2>&1 ||\ | ||
83 | fail "match permitopen proto $p sshd failed" | ||
84 | sleep 1; | ||
85 | ${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true || \ | ||
86 | fail "match permitopen permit proto $p" | ||
87 | stop_client | ||
88 | done | ||
89 | |||
90 | cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy | ||
91 | echo "PermitOpen 127.0.0.1:1 127.0.0.1:$PORT 127.0.0.2:2" >>$OBJ/sshd_proxy | ||
92 | echo "Match User $USER" >>$OBJ/sshd_proxy | ||
93 | echo "PermitOpen 127.0.0.1:1 127.0.0.1:2" >>$OBJ/sshd_proxy | ||
94 | |||
95 | # Test that a Match overrides a PermitOpen in the global section | ||
96 | for p in 1 2; do | ||
97 | rm -f $pidfile | ||
98 | trace "match permitopen proxy w/key opts proto $p" | ||
99 | ${SSH} -q -$p $fwd -F $OBJ/ssh_proxy -f somehost \ | ||
100 | "echo \$\$ > $pidfile; exec sleep 100" >>$TEST_SSH_LOGFILE 2>&1 ||\ | ||
101 | fail "match override permitopen proto $p sshd failed" | ||
102 | sleep 1; | ||
103 | ${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true && \ | ||
104 | fail "match override permitopen proto $p" | ||
105 | stop_client | ||
106 | done | ||
diff --git a/regress/cipher-speed.sh b/regress/cipher-speed.sh new file mode 100644 index 000000000..592511143 --- /dev/null +++ b/regress/cipher-speed.sh | |||
@@ -0,0 +1,47 @@ | |||
1 | # $OpenBSD: cipher-speed.sh,v 1.2 2005/05/24 04:09:54 djm Exp $ | ||
2 | # Placed in the Public Domain. | ||
3 | |||
4 | tid="cipher speed" | ||
5 | |||
6 | getbytes () | ||
7 | { | ||
8 | sed -n '/transferred/s/.*secs (\(.* bytes.sec\).*/\1/p' | ||
9 | } | ||
10 | |||
11 | tries="1 2" | ||
12 | DATA=/bin/ls | ||
13 | DATA=/bsd | ||
14 | |||
15 | macs="hmac-sha1 hmac-md5 hmac-sha1-96 hmac-md5-96" | ||
16 | ciphers="aes128-cbc 3des-cbc blowfish-cbc cast128-cbc | ||
17 | arcfour128 arcfour256 arcfour aes192-cbc aes256-cbc aes128-ctr" | ||
18 | |||
19 | for c in $ciphers; do for m in $macs; do | ||
20 | trace "proto 2 cipher $c mac $m" | ||
21 | for x in $tries; do | ||
22 | echo -n "$c/$m:\t" | ||
23 | ( ${SSH} -o 'compression no' \ | ||
24 | -F $OBJ/ssh_proxy -2 -m $m -c $c somehost \ | ||
25 | exec sh -c \'"dd of=/dev/null obs=32k"\' \ | ||
26 | < ${DATA} ) 2>&1 | getbytes | ||
27 | |||
28 | if [ $? -ne 0 ]; then | ||
29 | fail "ssh -2 failed with mac $m cipher $c" | ||
30 | fi | ||
31 | done | ||
32 | done; done | ||
33 | |||
34 | ciphers="3des blowfish" | ||
35 | for c in $ciphers; do | ||
36 | trace "proto 1 cipher $c" | ||
37 | for x in $tries; do | ||
38 | echo -n "$c:\t" | ||
39 | ( ${SSH} -o 'compression no' \ | ||
40 | -F $OBJ/ssh_proxy -1 -c $c somehost \ | ||
41 | exec sh -c \'"dd of=/dev/null obs=32k"\' \ | ||
42 | < ${DATA} ) 2>&1 | getbytes | ||
43 | if [ $? -ne 0 ]; then | ||
44 | fail "ssh -1 failed with cipher $c" | ||
45 | fi | ||
46 | done | ||
47 | done | ||
diff --git a/regress/forcecommand.sh b/regress/forcecommand.sh new file mode 100644 index 000000000..99e51a60f --- /dev/null +++ b/regress/forcecommand.sh | |||
@@ -0,0 +1,42 @@ | |||
1 | # $OpenBSD: forcecommand.sh,v 1.1 2006/07/19 13:09:28 dtucker Exp $ | ||
2 | # Placed in the Public Domain. | ||
3 | |||
4 | tid="forced command" | ||
5 | |||
6 | cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak | ||
7 | |||
8 | echon 'command="true" ' >$OBJ/authorized_keys_$USER | ||
9 | cat $OBJ/rsa.pub >> $OBJ/authorized_keys_$USER | ||
10 | echon 'command="true" ' >>$OBJ/authorized_keys_$USER | ||
11 | cat $OBJ/rsa1.pub >> $OBJ/authorized_keys_$USER | ||
12 | |||
13 | for p in 1 2; do | ||
14 | trace "forced command in key option proto $p" | ||
15 | ${SSH} -$p -F $OBJ/ssh_proxy somehost false \ || | ||
16 | fail "forced command in key proto $p" | ||
17 | done | ||
18 | |||
19 | echon 'command="false" ' >$OBJ/authorized_keys_$USER | ||
20 | cat $OBJ/rsa.pub >> $OBJ/authorized_keys_$USER | ||
21 | echon 'command="false" ' >>$OBJ/authorized_keys_$USER | ||
22 | cat $OBJ/rsa1.pub >> $OBJ/authorized_keys_$USER | ||
23 | |||
24 | cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy | ||
25 | echo "ForceCommand true" >> $OBJ/sshd_proxy | ||
26 | |||
27 | for p in 1 2; do | ||
28 | trace "forced command in sshd_config overrides key option proto $p" | ||
29 | ${SSH} -$p -F $OBJ/ssh_proxy somehost false \ || | ||
30 | fail "forced command in key proto $p" | ||
31 | done | ||
32 | |||
33 | cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy | ||
34 | echo "ForceCommand false" >> $OBJ/sshd_proxy | ||
35 | echo "Match User $USER" >> $OBJ/sshd_proxy | ||
36 | echo " ForceCommand true" >> $OBJ/sshd_proxy | ||
37 | |||
38 | for p in 1 2; do | ||
39 | trace "forced command with match proto $p" | ||
40 | ${SSH} -$p -F $OBJ/ssh_proxy somehost false \ || | ||
41 | fail "forced command in key proto $p" | ||
42 | done | ||
diff --git a/regress/forwarding.sh b/regress/forwarding.sh index 3b171144f..9ffbb3dd4 100644 --- a/regress/forwarding.sh +++ b/regress/forwarding.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: forwarding.sh,v 1.5 2005/03/10 10:20:39 dtucker Exp $ | 1 | # $OpenBSD: forwarding.sh,v 1.6 2006/07/11 18:51:21 markus Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | tid="local and remote forwarding" | 4 | tid="local and remote forwarding" |
@@ -34,6 +34,36 @@ for p in 1 2; do | |||
34 | done | 34 | done |
35 | 35 | ||
36 | for p in 1 2; do | 36 | for p in 1 2; do |
37 | for d in L R; do | ||
38 | trace "exit on -$d forward failure, proto $p" | ||
39 | |||
40 | # this one should succeed | ||
41 | ${SSH} -$p -F $OBJ/ssh_config \ | ||
42 | -$d ${base}01:127.0.0.1:$PORT \ | ||
43 | -$d ${base}02:127.0.0.1:$PORT \ | ||
44 | -$d ${base}03:127.0.0.1:$PORT \ | ||
45 | -$d ${base}04:127.0.0.1:$PORT \ | ||
46 | -oExitOnForwardFailure=yes somehost true | ||
47 | if [ $? != 0 ]; then | ||
48 | fail "connection failed, should not" | ||
49 | else | ||
50 | # this one should fail | ||
51 | ${SSH} -q -$p -F $OBJ/ssh_config \ | ||
52 | -$d ${base}01:127.0.0.1:$PORT \ | ||
53 | -$d ${base}02:127.0.0.1:$PORT \ | ||
54 | -$d ${base}03:127.0.0.1:$PORT \ | ||
55 | -$d ${base}01:127.0.0.1:$PORT \ | ||
56 | -$d ${base}04:127.0.0.1:$PORT \ | ||
57 | -oExitOnForwardFailure=yes somehost true | ||
58 | r=$? | ||
59 | if [ $r != 255 ]; then | ||
60 | fail "connection not termintated, but should ($r)" | ||
61 | fi | ||
62 | fi | ||
63 | done | ||
64 | done | ||
65 | |||
66 | for p in 1 2; do | ||
37 | trace "simple clear forwarding proto $p" | 67 | trace "simple clear forwarding proto $p" |
38 | ${SSH} -$p -F $OBJ/ssh_config -oClearAllForwardings=yes somehost true | 68 | ${SSH} -$p -F $OBJ/ssh_config -oClearAllForwardings=yes somehost true |
39 | 69 | ||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: rsa.c,v 1.29 2006/11/06 21:25:28 markus Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -60,11 +61,15 @@ | |||
60 | */ | 61 | */ |
61 | 62 | ||
62 | #include "includes.h" | 63 | #include "includes.h" |
63 | RCSID("$OpenBSD: rsa.c,v 1.24 2001/12/27 18:22:16 markus Exp $"); | ||
64 | 64 | ||
65 | #include <sys/types.h> | ||
66 | |||
67 | #include <stdarg.h> | ||
68 | #include <string.h> | ||
69 | |||
70 | #include "xmalloc.h" | ||
65 | #include "rsa.h" | 71 | #include "rsa.h" |
66 | #include "log.h" | 72 | #include "log.h" |
67 | #include "xmalloc.h" | ||
68 | 73 | ||
69 | void | 74 | void |
70 | rsa_public_encrypt(BIGNUM *out, BIGNUM *in, RSA *key) | 75 | rsa_public_encrypt(BIGNUM *out, BIGNUM *in, RSA *key) |
@@ -86,7 +91,8 @@ rsa_public_encrypt(BIGNUM *out, BIGNUM *in, RSA *key) | |||
86 | RSA_PKCS1_PADDING)) <= 0) | 91 | RSA_PKCS1_PADDING)) <= 0) |
87 | fatal("rsa_public_encrypt() failed"); | 92 | fatal("rsa_public_encrypt() failed"); |
88 | 93 | ||
89 | BN_bin2bn(outbuf, len, out); | 94 | if (BN_bin2bn(outbuf, len, out) == NULL) |
95 | fatal("rsa_public_encrypt: BN_bin2bn failed"); | ||
90 | 96 | ||
91 | memset(outbuf, 0, olen); | 97 | memset(outbuf, 0, olen); |
92 | memset(inbuf, 0, ilen); | 98 | memset(inbuf, 0, ilen); |
@@ -111,7 +117,8 @@ rsa_private_decrypt(BIGNUM *out, BIGNUM *in, RSA *key) | |||
111 | RSA_PKCS1_PADDING)) <= 0) { | 117 | RSA_PKCS1_PADDING)) <= 0) { |
112 | error("rsa_private_decrypt() failed"); | 118 | error("rsa_private_decrypt() failed"); |
113 | } else { | 119 | } else { |
114 | BN_bin2bn(outbuf, len, out); | 120 | if (BN_bin2bn(outbuf, len, out) == NULL) |
121 | fatal("rsa_private_decrypt: BN_bin2bn failed"); | ||
115 | } | 122 | } |
116 | memset(outbuf, 0, olen); | 123 | memset(outbuf, 0, olen); |
117 | memset(inbuf, 0, ilen); | 124 | memset(inbuf, 0, ilen); |
@@ -132,11 +139,11 @@ rsa_generate_additional_parameters(RSA *rsa) | |||
132 | if ((ctx = BN_CTX_new()) == NULL) | 139 | if ((ctx = BN_CTX_new()) == NULL) |
133 | fatal("rsa_generate_additional_parameters: BN_CTX_new failed"); | 140 | fatal("rsa_generate_additional_parameters: BN_CTX_new failed"); |
134 | 141 | ||
135 | BN_sub(aux, rsa->q, BN_value_one()); | 142 | if ((BN_sub(aux, rsa->q, BN_value_one()) == 0) || |
136 | BN_mod(rsa->dmq1, rsa->d, aux, ctx); | 143 | (BN_mod(rsa->dmq1, rsa->d, aux, ctx) == 0) || |
137 | 144 | (BN_sub(aux, rsa->p, BN_value_one()) == 0) || | |
138 | BN_sub(aux, rsa->p, BN_value_one()); | 145 | (BN_mod(rsa->dmp1, rsa->d, aux, ctx) == 0)) |
139 | BN_mod(rsa->dmp1, rsa->d, aux, ctx); | 146 | fatal("rsa_generate_additional_parameters: BN_sub/mod failed"); |
140 | 147 | ||
141 | BN_clear_free(aux); | 148 | BN_clear_free(aux); |
142 | BN_CTX_free(ctx); | 149 | BN_CTX_free(ctx); |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa.h,v 1.15 2002/03/04 17:27:39 stevesk Exp $ */ | 1 | /* $OpenBSD: rsa.h,v 1.16 2006/03/25 22:22:43 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
diff --git a/scard-opensc.c b/scard-opensc.c index dd2c28df2..4751ea295 100644 --- a/scard-opensc.c +++ b/scard-opensc.c | |||
@@ -26,9 +26,13 @@ | |||
26 | #include "includes.h" | 26 | #include "includes.h" |
27 | #if defined(SMARTCARD) && defined(USE_OPENSC) | 27 | #if defined(SMARTCARD) && defined(USE_OPENSC) |
28 | 28 | ||
29 | #include <sys/types.h> | ||
30 | |||
29 | #include <openssl/evp.h> | 31 | #include <openssl/evp.h> |
30 | #include <openssl/x509.h> | 32 | #include <openssl/x509.h> |
31 | 33 | ||
34 | #include <stdarg.h> | ||
35 | |||
32 | #include <opensc/opensc.h> | 36 | #include <opensc/opensc.h> |
33 | #include <opensc/pkcs15.h> | 37 | #include <opensc/pkcs15.h> |
34 | 38 | ||
@@ -455,7 +459,9 @@ sc_get_keys(const char *id, const char *pin) | |||
455 | } | 459 | } |
456 | key_count = r; | 460 | key_count = r; |
457 | } | 461 | } |
458 | keys = xmalloc(sizeof(Key *) * (key_count*2+1)); | 462 | if (key_count > 1024) |
463 | fatal("Too many keys (%u), expected <= 1024", key_count); | ||
464 | keys = xcalloc(key_count * 2 + 1, sizeof(Key *)); | ||
459 | for (i = 0; i < key_count; i++) { | 465 | for (i = 0; i < key_count; i++) { |
460 | sc_pkcs15_object_t *tmp_obj = NULL; | 466 | sc_pkcs15_object_t *tmp_obj = NULL; |
461 | cert_id = ((sc_pkcs15_cert_info_t *)(certs[i]->data))->id; | 467 | cert_id = ((sc_pkcs15_cert_info_t *)(certs[i]->data))->id; |
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: scard.c,v 1.36 2006/11/06 21:25:28 markus Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
3 | * | 4 | * |
@@ -24,14 +25,18 @@ | |||
24 | 25 | ||
25 | #include "includes.h" | 26 | #include "includes.h" |
26 | #if defined(SMARTCARD) && defined(USE_SECTOK) | 27 | #if defined(SMARTCARD) && defined(USE_SECTOK) |
27 | RCSID("$OpenBSD: scard.c,v 1.29 2004/05/08 00:21:31 djm Exp $"); | ||
28 | 28 | ||
29 | #include <openssl/evp.h> | 29 | #include <sys/types.h> |
30 | |||
30 | #include <sectok.h> | 31 | #include <sectok.h> |
32 | #include <stdarg.h> | ||
33 | #include <string.h> | ||
34 | |||
35 | #include <openssl/evp.h> | ||
31 | 36 | ||
37 | #include "xmalloc.h" | ||
32 | #include "key.h" | 38 | #include "key.h" |
33 | #include "log.h" | 39 | #include "log.h" |
34 | #include "xmalloc.h" | ||
35 | #include "misc.h" | 40 | #include "misc.h" |
36 | #include "scard.h" | 41 | #include "scard.h" |
37 | 42 | ||
@@ -125,7 +130,7 @@ sc_init(void) | |||
125 | if (status == SCARD_ERROR_NOCARD) { | 130 | if (status == SCARD_ERROR_NOCARD) { |
126 | return SCARD_ERROR_NOCARD; | 131 | return SCARD_ERROR_NOCARD; |
127 | } | 132 | } |
128 | if (status < 0 ) { | 133 | if (status < 0) { |
129 | error("sc_open failed"); | 134 | error("sc_open failed"); |
130 | return status; | 135 | return status; |
131 | } | 136 | } |
@@ -215,7 +220,7 @@ sc_private_decrypt(int flen, u_char *from, u_char *to, RSA *rsa, | |||
215 | olen = len = sw = 0; | 220 | olen = len = sw = 0; |
216 | if (sc_fd < 0) { | 221 | if (sc_fd < 0) { |
217 | status = sc_init(); | 222 | status = sc_init(); |
218 | if (status < 0 ) | 223 | if (status < 0) |
219 | goto err; | 224 | goto err; |
220 | } | 225 | } |
221 | if (padding != RSA_PKCS1_PADDING) | 226 | if (padding != RSA_PKCS1_PADDING) |
@@ -255,7 +260,7 @@ sc_private_encrypt(int flen, u_char *from, u_char *to, RSA *rsa, | |||
255 | len = sw = 0; | 260 | len = sw = 0; |
256 | if (sc_fd < 0) { | 261 | if (sc_fd < 0) { |
257 | status = sc_init(); | 262 | status = sc_init(); |
258 | if (status < 0 ) | 263 | if (status < 0) |
259 | goto err; | 264 | goto err; |
260 | } | 265 | } |
261 | if (padding != RSA_PKCS1_PADDING) | 266 | if (padding != RSA_PKCS1_PADDING) |
@@ -378,23 +383,25 @@ sc_get_keys(const char *id, const char *pin) | |||
378 | key_free(k); | 383 | key_free(k); |
379 | return NULL; | 384 | return NULL; |
380 | } | 385 | } |
381 | if (status < 0 ) { | 386 | if (status < 0) { |
382 | error("sc_read_pubkey failed"); | 387 | error("sc_read_pubkey failed"); |
383 | key_free(k); | 388 | key_free(k); |
384 | return NULL; | 389 | return NULL; |
385 | } | 390 | } |
386 | keys = xmalloc((nkeys+1) * sizeof(Key *)); | 391 | keys = xcalloc((nkeys+1), sizeof(Key *)); |
387 | 392 | ||
388 | n = key_new(KEY_RSA1); | 393 | n = key_new(KEY_RSA1); |
389 | BN_copy(n->rsa->n, k->rsa->n); | 394 | if ((BN_copy(n->rsa->n, k->rsa->n) == NULL) || |
390 | BN_copy(n->rsa->e, k->rsa->e); | 395 | (BN_copy(n->rsa->e, k->rsa->e) == NULL)) |
396 | fatal("sc_get_keys: BN_copy failed"); | ||
391 | RSA_set_method(n->rsa, sc_get_rsa()); | 397 | RSA_set_method(n->rsa, sc_get_rsa()); |
392 | n->flags |= KEY_FLAG_EXT; | 398 | n->flags |= KEY_FLAG_EXT; |
393 | keys[0] = n; | 399 | keys[0] = n; |
394 | 400 | ||
395 | n = key_new(KEY_RSA); | 401 | n = key_new(KEY_RSA); |
396 | BN_copy(n->rsa->n, k->rsa->n); | 402 | if ((BN_copy(n->rsa->n, k->rsa->n) == NULL) || |
397 | BN_copy(n->rsa->e, k->rsa->e); | 403 | (BN_copy(n->rsa->e, k->rsa->e) == NULL)) |
404 | fatal("sc_get_keys: BN_copy failed"); | ||
398 | RSA_set_method(n->rsa, sc_get_rsa()); | 405 | RSA_set_method(n->rsa, sc_get_rsa()); |
399 | n->flags |= KEY_FLAG_EXT; | 406 | n->flags |= KEY_FLAG_EXT; |
400 | keys[1] = n; | 407 | keys[1] = n; |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: scard.h,v 1.12 2003/06/12 19:12:03 markus Exp $ */ | 1 | /* $OpenBSD: scard.h,v 1.14 2006/08/03 03:34:42 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
@@ -27,8 +27,6 @@ | |||
27 | #ifndef SCARD_H | 27 | #ifndef SCARD_H |
28 | #define SCARD_H | 28 | #define SCARD_H |
29 | 29 | ||
30 | #include "key.h" | ||
31 | |||
32 | #define SCARD_ERROR_FAIL -1 | 30 | #define SCARD_ERROR_FAIL -1 |
33 | #define SCARD_ERROR_NOCARD -2 | 31 | #define SCARD_ERROR_NOCARD -2 |
34 | #define SCARD_ERROR_APPLET -3 | 32 | #define SCARD_ERROR_APPLET -3 |
diff --git a/scard/Makefile.in b/scard/Makefile.in index ab4e22043..8519e208b 100644 --- a/scard/Makefile.in +++ b/scard/Makefile.in | |||
@@ -1,7 +1,8 @@ | |||
1 | # $Id: Makefile.in,v 1.4 2002/04/26 01:25:41 djm Exp $ | 1 | # $Id: Makefile.in,v 1.5 2006/10/23 21:44:47 tim Exp $ |
2 | 2 | ||
3 | prefix=@prefix@ | 3 | prefix=@prefix@ |
4 | datadir=@datadir@ | 4 | datadir=@datadir@ |
5 | datarootdir=@datarootdir@ | ||
5 | srcdir=@srcdir@ | 6 | srcdir=@srcdir@ |
6 | top_srcdir=@top_srcdir@ | 7 | top_srcdir=@top_srcdir@ |
7 | 8 | ||
@@ -127,8 +127,7 @@ DESCRIPTION | |||
127 | about their progress. This is helpful in debugging connection, | 127 | about their progress. This is helpful in debugging connection, |
128 | authentication, and configuration problems. | 128 | authentication, and configuration problems. |
129 | 129 | ||
130 | DIAGNOSTICS | 130 | The scp utility exits 0 on success, and >0 if an error occurs. |
131 | scp exits with 0 on success or >0 if an error occurred. | ||
132 | 131 | ||
133 | SEE ALSO | 132 | SEE ALSO |
134 | rcp(1), sftp(1), ssh(1), ssh-add(1), ssh-agent(1), ssh-keygen(1), | 133 | rcp(1), sftp(1), ssh(1), ssh-add(1), ssh-agent(1), ssh-keygen(1), |
@@ -142,4 +141,4 @@ AUTHORS | |||
142 | Timo Rinne <tri@iki.fi> | 141 | Timo Rinne <tri@iki.fi> |
143 | Tatu Ylonen <ylo@cs.hut.fi> | 142 | Tatu Ylonen <ylo@cs.hut.fi> |
144 | 143 | ||
145 | OpenBSD 3.9 September 25, 1999 3 | 144 | OpenBSD 4.1 September 25, 1999 3 |
@@ -9,7 +9,7 @@ | |||
9 | .\" | 9 | .\" |
10 | .\" Created: Sun May 7 00:14:37 1995 ylo | 10 | .\" Created: Sun May 7 00:14:37 1995 ylo |
11 | .\" | 11 | .\" |
12 | .\" $OpenBSD: scp.1,v 1.39 2006/01/20 00:14:55 dtucker Exp $ | 12 | .\" $OpenBSD: scp.1,v 1.40 2006/07/18 07:56:28 jmc Exp $ |
13 | .\" | 13 | .\" |
14 | .Dd September 25, 1999 | 14 | .Dd September 25, 1999 |
15 | .Dt SCP 1 | 15 | .Dt SCP 1 |
@@ -198,9 +198,8 @@ to print debugging messages about their progress. | |||
198 | This is helpful in | 198 | This is helpful in |
199 | debugging connection, authentication, and configuration problems. | 199 | debugging connection, authentication, and configuration problems. |
200 | .El | 200 | .El |
201 | .Sh DIAGNOSTICS | 201 | .Pp |
202 | .Nm | 202 | .Ex -std scp |
203 | exits with 0 on success or >0 if an error occurred. | ||
204 | .Sh SEE ALSO | 203 | .Sh SEE ALSO |
205 | .Xr rcp 1 , | 204 | .Xr rcp 1 , |
206 | .Xr sftp 1 , | 205 | .Xr sftp 1 , |
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: scp.c,v 1.156 2007/01/22 13:06:21 djm Exp $ */ | ||
1 | /* | 2 | /* |
2 | * scp - secure remote copy. This is basically patched BSD rcp which | 3 | * scp - secure remote copy. This is basically patched BSD rcp which |
3 | * uses ssh to do the data transfer (instead of using rcmd). | 4 | * uses ssh to do the data transfer (instead of using rcmd). |
@@ -71,7 +72,30 @@ | |||
71 | */ | 72 | */ |
72 | 73 | ||
73 | #include "includes.h" | 74 | #include "includes.h" |
74 | RCSID("$OpenBSD: scp.c,v 1.130 2006/01/31 10:35:43 djm Exp $"); | 75 | |
76 | #include <sys/types.h> | ||
77 | #include <sys/param.h> | ||
78 | #ifdef HAVE_SYS_STAT_H | ||
79 | # include <sys/stat.h> | ||
80 | #endif | ||
81 | #ifdef HAVE_SYS_TIME_H | ||
82 | # include <sys/time.h> | ||
83 | #endif | ||
84 | #include <sys/wait.h> | ||
85 | #include <sys/uio.h> | ||
86 | |||
87 | #include <ctype.h> | ||
88 | #include <dirent.h> | ||
89 | #include <errno.h> | ||
90 | #include <fcntl.h> | ||
91 | #include <pwd.h> | ||
92 | #include <signal.h> | ||
93 | #include <stdarg.h> | ||
94 | #include <stdio.h> | ||
95 | #include <stdlib.h> | ||
96 | #include <string.h> | ||
97 | #include <time.h> | ||
98 | #include <unistd.h> | ||
75 | 99 | ||
76 | #include "xmalloc.h" | 100 | #include "xmalloc.h" |
77 | #include "atomicio.h" | 101 | #include "atomicio.h" |
@@ -82,6 +106,8 @@ RCSID("$OpenBSD: scp.c,v 1.130 2006/01/31 10:35:43 djm Exp $"); | |||
82 | 106 | ||
83 | extern char *__progname; | 107 | extern char *__progname; |
84 | 108 | ||
109 | int do_cmd(char *host, char *remuser, char *cmd, int *fdin, int *fdout); | ||
110 | |||
85 | void bwlimit(int); | 111 | void bwlimit(int); |
86 | 112 | ||
87 | /* Struct for addargs */ | 113 | /* Struct for addargs */ |
@@ -167,7 +193,7 @@ do_local_cmd(arglist *a) | |||
167 | */ | 193 | */ |
168 | 194 | ||
169 | int | 195 | int |
170 | do_cmd(char *host, char *remuser, char *cmd, int *fdin, int *fdout, int argc) | 196 | do_cmd(char *host, char *remuser, char *cmd, int *fdin, int *fdout) |
171 | { | 197 | { |
172 | int pin[2], pout[2], reserved[2]; | 198 | int pin[2], pout[2], reserved[2]; |
173 | 199 | ||
@@ -181,7 +207,8 @@ do_cmd(char *host, char *remuser, char *cmd, int *fdin, int *fdout, int argc) | |||
181 | * Reserve two descriptors so that the real pipes won't get | 207 | * Reserve two descriptors so that the real pipes won't get |
182 | * descriptors 0 and 1 because that will screw up dup2 below. | 208 | * descriptors 0 and 1 because that will screw up dup2 below. |
183 | */ | 209 | */ |
184 | pipe(reserved); | 210 | if (pipe(reserved) < 0) |
211 | fatal("pipe: %s", strerror(errno)); | ||
185 | 212 | ||
186 | /* Create a socket pair for communicating with ssh. */ | 213 | /* Create a socket pair for communicating with ssh. */ |
187 | if (pipe(pin) < 0) | 214 | if (pipe(pin) < 0) |
@@ -234,7 +261,6 @@ typedef struct { | |||
234 | 261 | ||
235 | BUF *allocbuf(BUF *, int, int); | 262 | BUF *allocbuf(BUF *, int, int); |
236 | void lostconn(int); | 263 | void lostconn(int); |
237 | void nospace(void); | ||
238 | int okname(char *); | 264 | int okname(char *); |
239 | void run_err(const char *,...); | 265 | void run_err(const char *,...); |
240 | void verifydir(char *); | 266 | void verifydir(char *); |
@@ -258,15 +284,21 @@ void usage(void); | |||
258 | int | 284 | int |
259 | main(int argc, char **argv) | 285 | main(int argc, char **argv) |
260 | { | 286 | { |
261 | int ch, fflag, tflag, status; | 287 | int ch, fflag, tflag, status, n; |
262 | double speed; | 288 | double speed; |
263 | char *targ, *endp; | 289 | char *targ, *endp, **newargv; |
264 | extern char *optarg; | 290 | extern char *optarg; |
265 | extern int optind; | 291 | extern int optind; |
266 | 292 | ||
267 | /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ | 293 | /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ |
268 | sanitise_stdfd(); | 294 | sanitise_stdfd(); |
269 | 295 | ||
296 | /* Copy argv, because we modify it */ | ||
297 | newargv = xcalloc(MAX(argc + 1, 1), sizeof(*newargv)); | ||
298 | for (n = 0; n < argc; n++) | ||
299 | newargv[n] = xstrdup(argv[n]); | ||
300 | argv = newargv; | ||
301 | |||
270 | __progname = ssh_get_progname(argv[0]); | 302 | __progname = ssh_get_progname(argv[0]); |
271 | 303 | ||
272 | memset(&args, '\0', sizeof(args)); | 304 | memset(&args, '\0', sizeof(args)); |
@@ -348,7 +380,7 @@ main(int argc, char **argv) | |||
348 | if ((pwd = getpwuid(userid = getuid())) == NULL) | 380 | if ((pwd = getpwuid(userid = getuid())) == NULL) |
349 | fatal("unknown user %u", (u_int) userid); | 381 | fatal("unknown user %u", (u_int) userid); |
350 | 382 | ||
351 | if (!isatty(STDERR_FILENO)) | 383 | if (!isatty(STDOUT_FILENO)) |
352 | showprogress = 0; | 384 | showprogress = 0; |
353 | 385 | ||
354 | remin = STDIN_FILENO; | 386 | remin = STDIN_FILENO; |
@@ -409,9 +441,9 @@ main(int argc, char **argv) | |||
409 | void | 441 | void |
410 | toremote(char *targ, int argc, char **argv) | 442 | toremote(char *targ, int argc, char **argv) |
411 | { | 443 | { |
412 | int i, len; | ||
413 | char *bp, *host, *src, *suser, *thost, *tuser, *arg; | 444 | char *bp, *host, *src, *suser, *thost, *tuser, *arg; |
414 | arglist alist; | 445 | arglist alist; |
446 | int i; | ||
415 | 447 | ||
416 | memset(&alist, '\0', sizeof(alist)); | 448 | memset(&alist, '\0', sizeof(alist)); |
417 | alist.list = NULL; | 449 | alist.list = NULL; |
@@ -476,12 +508,10 @@ toremote(char *targ, int argc, char **argv) | |||
476 | errs = 1; | 508 | errs = 1; |
477 | } else { /* local to remote */ | 509 | } else { /* local to remote */ |
478 | if (remin == -1) { | 510 | if (remin == -1) { |
479 | len = strlen(targ) + CMDNEEDS + 20; | 511 | xasprintf(&bp, "%s -t %s", cmd, targ); |
480 | bp = xmalloc(len); | ||
481 | (void) snprintf(bp, len, "%s -t %s", cmd, targ); | ||
482 | host = cleanhostname(thost); | 512 | host = cleanhostname(thost); |
483 | if (do_cmd(host, tuser, bp, &remin, | 513 | if (do_cmd(host, tuser, bp, &remin, |
484 | &remout, argc) < 0) | 514 | &remout) < 0) |
485 | exit(1); | 515 | exit(1); |
486 | if (response() < 0) | 516 | if (response() < 0) |
487 | exit(1); | 517 | exit(1); |
@@ -490,14 +520,15 @@ toremote(char *targ, int argc, char **argv) | |||
490 | source(1, argv + i); | 520 | source(1, argv + i); |
491 | } | 521 | } |
492 | } | 522 | } |
523 | xfree(arg); | ||
493 | } | 524 | } |
494 | 525 | ||
495 | void | 526 | void |
496 | tolocal(int argc, char **argv) | 527 | tolocal(int argc, char **argv) |
497 | { | 528 | { |
498 | int i, len; | ||
499 | char *bp, *host, *src, *suser; | 529 | char *bp, *host, *src, *suser; |
500 | arglist alist; | 530 | arglist alist; |
531 | int i; | ||
501 | 532 | ||
502 | memset(&alist, '\0', sizeof(alist)); | 533 | memset(&alist, '\0', sizeof(alist)); |
503 | alist.list = NULL; | 534 | alist.list = NULL; |
@@ -529,10 +560,8 @@ tolocal(int argc, char **argv) | |||
529 | suser = pwd->pw_name; | 560 | suser = pwd->pw_name; |
530 | } | 561 | } |
531 | host = cleanhostname(host); | 562 | host = cleanhostname(host); |
532 | len = strlen(src) + CMDNEEDS + 20; | 563 | xasprintf(&bp, "%s -f %s", cmd, src); |
533 | bp = xmalloc(len); | 564 | if (do_cmd(host, suser, bp, &remin, &remout) < 0) { |
534 | (void) snprintf(bp, len, "%s -f %s", cmd, src); | ||
535 | if (do_cmd(host, suser, bp, &remin, &remout, argc) < 0) { | ||
536 | (void) xfree(bp); | 565 | (void) xfree(bp); |
537 | ++errs; | 566 | ++errs; |
538 | continue; | 567 | continue; |
@@ -777,7 +806,8 @@ sink(int argc, char **argv) | |||
777 | BUF *bp; | 806 | BUF *bp; |
778 | off_t i; | 807 | off_t i; |
779 | size_t j, count; | 808 | size_t j, count; |
780 | int amt, exists, first, mask, mode, ofd, omode; | 809 | int amt, exists, first, ofd; |
810 | mode_t mode, omode, mask; | ||
781 | off_t size, statbytes; | 811 | off_t size, statbytes; |
782 | int setimes, targisdir, wrerrno = 0; | 812 | int setimes, targisdir, wrerrno = 0; |
783 | char ch, *cp, *np, *targ, *why, *vect[1], buf[2048]; | 813 | char ch, *cp, *np, *targ, *why, *vect[1], buf[2048]; |
@@ -1097,15 +1127,15 @@ run_err(const char *fmt,...) | |||
1097 | va_list ap; | 1127 | va_list ap; |
1098 | 1128 | ||
1099 | ++errs; | 1129 | ++errs; |
1100 | if (fp == NULL && !(fp = fdopen(remout, "w"))) | 1130 | if (fp != NULL || (remout != -1 && (fp = fdopen(remout, "w")))) { |
1101 | return; | 1131 | (void) fprintf(fp, "%c", 0x01); |
1102 | (void) fprintf(fp, "%c", 0x01); | 1132 | (void) fprintf(fp, "scp: "); |
1103 | (void) fprintf(fp, "scp: "); | 1133 | va_start(ap, fmt); |
1104 | va_start(ap, fmt); | 1134 | (void) vfprintf(fp, fmt, ap); |
1105 | (void) vfprintf(fp, fmt, ap); | 1135 | va_end(ap); |
1106 | va_end(ap); | 1136 | (void) fprintf(fp, "\n"); |
1107 | (void) fprintf(fp, "\n"); | 1137 | (void) fflush(fp); |
1108 | (void) fflush(fp); | 1138 | } |
1109 | 1139 | ||
1110 | if (!iamremote) { | 1140 | if (!iamremote) { |
1111 | va_start(ap, fmt); | 1141 | va_start(ap, fmt); |
@@ -1181,7 +1211,7 @@ allocbuf(BUF *bp, int fd, int blksize) | |||
1181 | if (bp->buf == NULL) | 1211 | if (bp->buf == NULL) |
1182 | bp->buf = xmalloc(size); | 1212 | bp->buf = xmalloc(size); |
1183 | else | 1213 | else |
1184 | bp->buf = xrealloc(bp->buf, size); | 1214 | bp->buf = xrealloc(bp->buf, 1, size); |
1185 | memset(bp->buf, 0, size); | 1215 | memset(bp->buf, 0, size); |
1186 | bp->cnt = size; | 1216 | bp->cnt = size; |
1187 | return (bp); | 1217 | return (bp); |
diff --git a/selinux.c b/selinux.c deleted file mode 100644 index 2811a9b80..000000000 --- a/selinux.c +++ /dev/null | |||
@@ -1,95 +0,0 @@ | |||
1 | #include "includes.h" | ||
2 | #include "auth.h" | ||
3 | #include "log.h" | ||
4 | |||
5 | #ifdef WITH_SELINUX | ||
6 | #include <selinux/selinux.h> | ||
7 | #include <selinux/flask.h> | ||
8 | #include <selinux/context.h> | ||
9 | #include <selinux/get_context_list.h> | ||
10 | #include <selinux/get_default_type.h> | ||
11 | |||
12 | extern Authctxt *the_authctxt; | ||
13 | |||
14 | static const security_context_t | ||
15 | selinux_get_user_context(const char *name) | ||
16 | { | ||
17 | security_context_t user_context=NULL; | ||
18 | char *role=NULL; | ||
19 | int ret = -1; | ||
20 | char *seuser=NULL; | ||
21 | char *level=NULL; | ||
22 | |||
23 | if (the_authctxt) | ||
24 | role=the_authctxt->role; | ||
25 | if (getseuserbyname(name, &seuser, &level)==0) { | ||
26 | if (role != NULL && role[0]) | ||
27 | ret=get_default_context_with_rolelevel(seuser, role, level,NULL, | ||
28 | &user_context); | ||
29 | else | ||
30 | ret=get_default_context_with_level(seuser, level, NULL,&user_context); | ||
31 | } | ||
32 | if ( ret < 0 ) { | ||
33 | if (security_getenforce() > 0) | ||
34 | fatal("Failed to get default security context for %s.", | ||
35 | name); | ||
36 | else | ||
37 | error("Failed to get default security context for %s." | ||
38 | "Continuing in permissive mode", | ||
39 | name); | ||
40 | } | ||
41 | return user_context; | ||
42 | } | ||
43 | |||
44 | void | ||
45 | setup_selinux_pty(const char *name, const char *tty) | ||
46 | { | ||
47 | if (is_selinux_enabled() > 0) { | ||
48 | security_context_t new_tty_context=NULL, user_context=NULL, old_tty_context=NULL; | ||
49 | |||
50 | user_context=selinux_get_user_context(name); | ||
51 | |||
52 | if (getfilecon(tty, &old_tty_context) < 0) { | ||
53 | error("getfilecon(%.100s) failed: %.100s", | ||
54 | tty, strerror(errno)); | ||
55 | } else { | ||
56 | if (security_compute_relabel(user_context,old_tty_context, | ||
57 | SECCLASS_CHR_FILE, &new_tty_context) != 0) { | ||
58 | error("security_compute_relabel(%.100s) failed: " | ||
59 | "%.100s", tty, strerror(errno)); | ||
60 | } else { | ||
61 | if (setfilecon (tty, new_tty_context) != 0) | ||
62 | error("setfilecon(%.100s, %s) failed: %.100s", | ||
63 | tty, new_tty_context, strerror(errno)); | ||
64 | freecon(new_tty_context); | ||
65 | } | ||
66 | freecon(old_tty_context); | ||
67 | } | ||
68 | if (user_context) { | ||
69 | freecon(user_context); | ||
70 | } | ||
71 | } | ||
72 | } | ||
73 | |||
74 | void | ||
75 | setup_selinux_exec_context(char *name) | ||
76 | { | ||
77 | |||
78 | if (is_selinux_enabled() > 0) { | ||
79 | security_context_t user_context=selinux_get_user_context(name); | ||
80 | if (setexeccon(user_context)) { | ||
81 | if (security_getenforce() > 0) | ||
82 | fatal("Failed to set exec security context %s for %s.", | ||
83 | user_context, name); | ||
84 | else | ||
85 | error("Failed to set exec security context %s for %s. " | ||
86 | "Continuing in permissive mode", | ||
87 | user_context, name); | ||
88 | } | ||
89 | if (user_context) { | ||
90 | freecon(user_context); | ||
91 | } | ||
92 | } | ||
93 | } | ||
94 | |||
95 | #endif /* WITH_SELINUX */ | ||
diff --git a/selinux.h b/selinux.h deleted file mode 100644 index af1d44632..000000000 --- a/selinux.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | #ifndef SELINUX_H | ||
2 | #define SELINUX_H | ||
3 | |||
4 | # ifdef WITH_SELINUX | ||
5 | |||
6 | extern void setup_selinux_pty(const char *, const char *); | ||
7 | extern void setup_selinux_exec_context(const char *); | ||
8 | |||
9 | # else | ||
10 | |||
11 | static inline void setup_selinux_pty(const char *name, const char *tty) {} | ||
12 | static inline void setup_selinux_exec_context(const char *name) {} | ||
13 | |||
14 | #endif /* WITH_SELINUX */ | ||
15 | #endif /* SELINUX_H */ | ||
diff --git a/servconf.c b/servconf.c index 60febff99..951bbc4bf 100644 --- a/servconf.c +++ b/servconf.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: servconf.c,v 1.170 2007/03/01 10:28:02 dtucker Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
3 | * All rights reserved | 4 | * All rights reserved |
@@ -10,24 +11,41 @@ | |||
10 | */ | 11 | */ |
11 | 12 | ||
12 | #include "includes.h" | 13 | #include "includes.h" |
13 | RCSID("$OpenBSD: servconf.c,v 1.146 2005/12/08 18:34:11 reyk Exp $"); | ||
14 | 14 | ||
15 | #include <sys/types.h> | ||
16 | #include <sys/socket.h> | ||
17 | |||
18 | #include <netdb.h> | ||
19 | #include <pwd.h> | ||
20 | #include <stdio.h> | ||
21 | #include <stdlib.h> | ||
22 | #include <string.h> | ||
23 | #include <signal.h> | ||
24 | #include <unistd.h> | ||
25 | #include <stdarg.h> | ||
26 | |||
27 | #include "xmalloc.h" | ||
15 | #include "ssh.h" | 28 | #include "ssh.h" |
16 | #include "log.h" | 29 | #include "log.h" |
30 | #include "buffer.h" | ||
17 | #include "servconf.h" | 31 | #include "servconf.h" |
18 | #include "xmalloc.h" | ||
19 | #include "compat.h" | 32 | #include "compat.h" |
20 | #include "pathnames.h" | 33 | #include "pathnames.h" |
21 | #include "misc.h" | 34 | #include "misc.h" |
22 | #include "cipher.h" | 35 | #include "cipher.h" |
36 | #include "key.h" | ||
23 | #include "kex.h" | 37 | #include "kex.h" |
24 | #include "mac.h" | 38 | #include "mac.h" |
39 | #include "match.h" | ||
40 | #include "channels.h" | ||
41 | #include "groupaccess.h" | ||
25 | 42 | ||
26 | static void add_listen_addr(ServerOptions *, char *, u_short); | 43 | static void add_listen_addr(ServerOptions *, char *, u_short); |
27 | static void add_one_listen_addr(ServerOptions *, char *, u_short); | 44 | static void add_one_listen_addr(ServerOptions *, char *, u_short); |
28 | 45 | ||
29 | /* Use of privilege separation or not */ | 46 | /* Use of privilege separation or not */ |
30 | extern int use_privsep; | 47 | extern int use_privsep; |
48 | extern Buffer cfg; | ||
31 | 49 | ||
32 | /* Initializes the server options to their default values. */ | 50 | /* Initializes the server options to their default values. */ |
33 | 51 | ||
@@ -74,6 +92,7 @@ initialize_server_options(ServerOptions *options) | |||
74 | options->gss_authentication=-1; | 92 | options->gss_authentication=-1; |
75 | options->gss_keyex = -1; | 93 | options->gss_keyex = -1; |
76 | options->gss_cleanup_creds = -1; | 94 | options->gss_cleanup_creds = -1; |
95 | options->gss_strict_acceptor = -1; | ||
77 | options->password_authentication = -1; | 96 | options->password_authentication = -1; |
78 | options->kbd_interactive_authentication = -1; | 97 | options->kbd_interactive_authentication = -1; |
79 | options->challenge_response_authentication = -1; | 98 | options->challenge_response_authentication = -1; |
@@ -103,9 +122,8 @@ initialize_server_options(ServerOptions *options) | |||
103 | options->authorized_keys_file2 = NULL; | 122 | options->authorized_keys_file2 = NULL; |
104 | options->num_accept_env = 0; | 123 | options->num_accept_env = 0; |
105 | options->permit_tun = -1; | 124 | options->permit_tun = -1; |
106 | 125 | options->num_permitted_opens = -1; | |
107 | /* Needs to be accessable in many places */ | 126 | options->adm_forced_command = NULL; |
108 | use_privsep = -1; | ||
109 | } | 127 | } |
110 | 128 | ||
111 | void | 129 | void |
@@ -192,6 +210,8 @@ fill_default_server_options(ServerOptions *options) | |||
192 | options->gss_keyex = 0; | 210 | options->gss_keyex = 0; |
193 | if (options->gss_cleanup_creds == -1) | 211 | if (options->gss_cleanup_creds == -1) |
194 | options->gss_cleanup_creds = 1; | 212 | options->gss_cleanup_creds = 1; |
213 | if (options->gss_strict_acceptor == -1) | ||
214 | options->gss_strict_acceptor = 1; | ||
195 | if (options->password_authentication == -1) | 215 | if (options->password_authentication == -1) |
196 | options->password_authentication = 1; | 216 | options->password_authentication = 1; |
197 | if (options->kbd_interactive_authentication == -1) | 217 | if (options->kbd_interactive_authentication == -1) |
@@ -276,118 +296,130 @@ typedef enum { | |||
276 | sBanner, sUseDNS, sHostbasedAuthentication, | 296 | sBanner, sUseDNS, sHostbasedAuthentication, |
277 | sHostbasedUsesNameFromPacketOnly, sClientAliveInterval, | 297 | sHostbasedUsesNameFromPacketOnly, sClientAliveInterval, |
278 | sClientAliveCountMax, sAuthorizedKeysFile, sAuthorizedKeysFile2, | 298 | sClientAliveCountMax, sAuthorizedKeysFile, sAuthorizedKeysFile2, |
279 | sGssAuthentication, sGssKeyEx, sGssCleanupCreds, | 299 | sGssAuthentication, sGssCleanupCreds, sGssStrictAcceptor, |
300 | sGssKeyEx, | ||
280 | sAcceptEnv, sPermitTunnel, | 301 | sAcceptEnv, sPermitTunnel, |
302 | sMatch, sPermitOpen, sForceCommand, | ||
281 | sUsePrivilegeSeparation, | 303 | sUsePrivilegeSeparation, |
282 | sDeprecated, sUnsupported | 304 | sDeprecated, sUnsupported |
283 | } ServerOpCodes; | 305 | } ServerOpCodes; |
284 | 306 | ||
307 | #define SSHCFG_GLOBAL 0x01 /* allowed in main section of sshd_config */ | ||
308 | #define SSHCFG_MATCH 0x02 /* allowed inside a Match section */ | ||
309 | #define SSHCFG_ALL (SSHCFG_GLOBAL|SSHCFG_MATCH) | ||
310 | |||
285 | /* Textual representation of the tokens. */ | 311 | /* Textual representation of the tokens. */ |
286 | static struct { | 312 | static struct { |
287 | const char *name; | 313 | const char *name; |
288 | ServerOpCodes opcode; | 314 | ServerOpCodes opcode; |
315 | u_int flags; | ||
289 | } keywords[] = { | 316 | } keywords[] = { |
290 | /* Portable-specific options */ | 317 | /* Portable-specific options */ |
291 | #ifdef USE_PAM | 318 | #ifdef USE_PAM |
292 | { "usepam", sUsePAM }, | 319 | { "usepam", sUsePAM, SSHCFG_GLOBAL }, |
293 | #else | 320 | #else |
294 | { "usepam", sUnsupported }, | 321 | { "usepam", sUnsupported, SSHCFG_GLOBAL }, |
295 | #endif | 322 | #endif |
296 | { "pamauthenticationviakbdint", sDeprecated }, | 323 | { "pamauthenticationviakbdint", sDeprecated, SSHCFG_GLOBAL }, |
297 | /* Standard Options */ | 324 | /* Standard Options */ |
298 | { "port", sPort }, | 325 | { "port", sPort, SSHCFG_GLOBAL }, |
299 | { "hostkey", sHostKeyFile }, | 326 | { "hostkey", sHostKeyFile, SSHCFG_GLOBAL }, |
300 | { "hostdsakey", sHostKeyFile }, /* alias */ | 327 | { "hostdsakey", sHostKeyFile, SSHCFG_GLOBAL }, /* alias */ |
301 | { "pidfile", sPidFile }, | 328 | { "pidfile", sPidFile, SSHCFG_GLOBAL }, |
302 | { "serverkeybits", sServerKeyBits }, | 329 | { "serverkeybits", sServerKeyBits, SSHCFG_GLOBAL }, |
303 | { "logingracetime", sLoginGraceTime }, | 330 | { "logingracetime", sLoginGraceTime, SSHCFG_GLOBAL }, |
304 | { "keyregenerationinterval", sKeyRegenerationTime }, | 331 | { "keyregenerationinterval", sKeyRegenerationTime, SSHCFG_GLOBAL }, |
305 | { "permitrootlogin", sPermitRootLogin }, | 332 | { "permitrootlogin", sPermitRootLogin, SSHCFG_GLOBAL }, |
306 | { "syslogfacility", sLogFacility }, | 333 | { "syslogfacility", sLogFacility, SSHCFG_GLOBAL }, |
307 | { "loglevel", sLogLevel }, | 334 | { "loglevel", sLogLevel, SSHCFG_GLOBAL }, |
308 | { "rhostsauthentication", sDeprecated }, | 335 | { "rhostsauthentication", sDeprecated, SSHCFG_GLOBAL }, |
309 | { "rhostsrsaauthentication", sRhostsRSAAuthentication }, | 336 | { "rhostsrsaauthentication", sRhostsRSAAuthentication, SSHCFG_ALL }, |
310 | { "hostbasedauthentication", sHostbasedAuthentication }, | 337 | { "hostbasedauthentication", sHostbasedAuthentication, SSHCFG_ALL }, |
311 | { "hostbasedusesnamefrompacketonly", sHostbasedUsesNameFromPacketOnly }, | 338 | { "hostbasedusesnamefrompacketonly", sHostbasedUsesNameFromPacketOnly, SSHCFG_GLOBAL }, |
312 | { "rsaauthentication", sRSAAuthentication }, | 339 | { "rsaauthentication", sRSAAuthentication, SSHCFG_ALL }, |
313 | { "pubkeyauthentication", sPubkeyAuthentication }, | 340 | { "pubkeyauthentication", sPubkeyAuthentication, SSHCFG_ALL }, |
314 | { "dsaauthentication", sPubkeyAuthentication }, /* alias */ | 341 | { "dsaauthentication", sPubkeyAuthentication, SSHCFG_GLOBAL }, /* alias */ |
315 | #ifdef KRB5 | 342 | #ifdef KRB5 |
316 | { "kerberosauthentication", sKerberosAuthentication }, | 343 | { "kerberosauthentication", sKerberosAuthentication, SSHCFG_ALL }, |
317 | { "kerberosorlocalpasswd", sKerberosOrLocalPasswd }, | 344 | { "kerberosorlocalpasswd", sKerberosOrLocalPasswd, SSHCFG_GLOBAL }, |
318 | { "kerberosticketcleanup", sKerberosTicketCleanup }, | 345 | { "kerberosticketcleanup", sKerberosTicketCleanup, SSHCFG_GLOBAL }, |
319 | #ifdef USE_AFS | 346 | #ifdef USE_AFS |
320 | { "kerberosgetafstoken", sKerberosGetAFSToken }, | 347 | { "kerberosgetafstoken", sKerberosGetAFSToken, SSHCFG_GLOBAL }, |
321 | #else | 348 | #else |
322 | { "kerberosgetafstoken", sUnsupported }, | 349 | { "kerberosgetafstoken", sUnsupported, SSHCFG_GLOBAL }, |
323 | #endif | 350 | #endif |
324 | #else | 351 | #else |
325 | { "kerberosauthentication", sUnsupported }, | 352 | { "kerberosauthentication", sUnsupported, SSHCFG_ALL }, |
326 | { "kerberosorlocalpasswd", sUnsupported }, | 353 | { "kerberosorlocalpasswd", sUnsupported, SSHCFG_GLOBAL }, |
327 | { "kerberosticketcleanup", sUnsupported }, | 354 | { "kerberosticketcleanup", sUnsupported, SSHCFG_GLOBAL }, |
328 | { "kerberosgetafstoken", sUnsupported }, | 355 | { "kerberosgetafstoken", sUnsupported, SSHCFG_GLOBAL }, |
329 | #endif | 356 | #endif |
330 | { "kerberostgtpassing", sUnsupported }, | 357 | { "kerberostgtpassing", sUnsupported, SSHCFG_GLOBAL }, |
331 | { "afstokenpassing", sUnsupported }, | 358 | { "afstokenpassing", sUnsupported, SSHCFG_GLOBAL }, |
332 | #ifdef GSSAPI | 359 | #ifdef GSSAPI |
333 | { "gssapiauthentication", sGssAuthentication }, | 360 | { "gssapiauthentication", sGssAuthentication, SSHCFG_ALL }, |
334 | { "gssapikeyexchange", sGssKeyEx }, | 361 | { "gssapicleanupcredentials", sGssCleanupCreds, SSHCFG_GLOBAL }, |
335 | { "gssapicleanupcredentials", sGssCleanupCreds }, | 362 | { "gssapicleanupcreds", sGssCleanupCreds, SSHCFG_GLOBAL }, |
336 | { "gssapicleanupcreds", sGssCleanupCreds }, | 363 | { "gssapistrictacceptorcheck", sGssStrictAcceptor, SSHCFG_GLOBAL }, |
364 | { "gssapikeyexchange", sGssKeyEx, SSHCFG_GLOBAL }, | ||
337 | #else | 365 | #else |
338 | { "gssapiauthentication", sUnsupported }, | 366 | { "gssapiauthentication", sUnsupported, SSHCFG_ALL }, |
339 | { "gssapikeyexchange", sUnsupported }, | 367 | { "gssapicleanupcredentials", sUnsupported, SSHCFG_GLOBAL }, |
340 | { "gssapicleanupcredentials", sUnsupported }, | 368 | { "gssapicleanupcreds", sUnsupported, SSHCFG_GLOBAL }, |
341 | { "gssapicleanupcreds", sUnsupported }, | 369 | { "gssapistrictacceptorcheck", sUnsupported, SSHCFG_GLOBAL }, |
370 | { "gssapikeyexchange", sUnsupported, SSHCFG_GLOBAL }, | ||
342 | #endif | 371 | #endif |
343 | { "gssusesessionccache", sUnsupported }, | 372 | { "gssusesessionccache", sUnsupported, SSHCFG_GLOBAL }, |
344 | { "gssapiusesessioncredcache", sUnsupported }, | 373 | { "gssapiusesessioncredcache", sUnsupported, SSHCFG_GLOBAL }, |
345 | { "passwordauthentication", sPasswordAuthentication }, | 374 | { "passwordauthentication", sPasswordAuthentication, SSHCFG_ALL }, |
346 | { "kbdinteractiveauthentication", sKbdInteractiveAuthentication }, | 375 | { "kbdinteractiveauthentication", sKbdInteractiveAuthentication, SSHCFG_ALL }, |
347 | { "challengeresponseauthentication", sChallengeResponseAuthentication }, | 376 | { "challengeresponseauthentication", sChallengeResponseAuthentication, SSHCFG_GLOBAL }, |
348 | { "skeyauthentication", sChallengeResponseAuthentication }, /* alias */ | 377 | { "skeyauthentication", sChallengeResponseAuthentication, SSHCFG_GLOBAL }, /* alias */ |
349 | { "checkmail", sDeprecated }, | 378 | { "checkmail", sDeprecated, SSHCFG_GLOBAL }, |
350 | { "listenaddress", sListenAddress }, | 379 | { "listenaddress", sListenAddress, SSHCFG_GLOBAL }, |
351 | { "addressfamily", sAddressFamily }, | 380 | { "addressfamily", sAddressFamily, SSHCFG_GLOBAL }, |
352 | { "printmotd", sPrintMotd }, | 381 | { "printmotd", sPrintMotd, SSHCFG_GLOBAL }, |
353 | { "printlastlog", sPrintLastLog }, | 382 | { "printlastlog", sPrintLastLog, SSHCFG_GLOBAL }, |
354 | { "ignorerhosts", sIgnoreRhosts }, | 383 | { "ignorerhosts", sIgnoreRhosts, SSHCFG_GLOBAL }, |
355 | { "ignoreuserknownhosts", sIgnoreUserKnownHosts }, | 384 | { "ignoreuserknownhosts", sIgnoreUserKnownHosts, SSHCFG_GLOBAL }, |
356 | { "x11forwarding", sX11Forwarding }, | 385 | { "x11forwarding", sX11Forwarding, SSHCFG_ALL }, |
357 | { "x11displayoffset", sX11DisplayOffset }, | 386 | { "x11displayoffset", sX11DisplayOffset, SSHCFG_ALL }, |
358 | { "x11uselocalhost", sX11UseLocalhost }, | 387 | { "x11uselocalhost", sX11UseLocalhost, SSHCFG_ALL }, |
359 | { "xauthlocation", sXAuthLocation }, | 388 | { "xauthlocation", sXAuthLocation, SSHCFG_GLOBAL }, |
360 | { "strictmodes", sStrictModes }, | 389 | { "strictmodes", sStrictModes, SSHCFG_GLOBAL }, |
361 | { "permitemptypasswords", sEmptyPasswd }, | 390 | { "permitemptypasswords", sEmptyPasswd, SSHCFG_GLOBAL }, |
362 | { "permituserenvironment", sPermitUserEnvironment }, | 391 | { "permituserenvironment", sPermitUserEnvironment, SSHCFG_GLOBAL }, |
363 | { "uselogin", sUseLogin }, | 392 | { "uselogin", sUseLogin, SSHCFG_GLOBAL }, |
364 | { "compression", sCompression }, | 393 | { "compression", sCompression, SSHCFG_GLOBAL }, |
365 | { "tcpkeepalive", sTCPKeepAlive }, | 394 | { "tcpkeepalive", sTCPKeepAlive, SSHCFG_GLOBAL }, |
366 | { "keepalive", sTCPKeepAlive }, /* obsolete alias */ | 395 | { "keepalive", sTCPKeepAlive, SSHCFG_GLOBAL }, /* obsolete alias */ |
367 | { "allowtcpforwarding", sAllowTcpForwarding }, | 396 | { "allowtcpforwarding", sAllowTcpForwarding, SSHCFG_ALL }, |
368 | { "allowusers", sAllowUsers }, | 397 | { "allowusers", sAllowUsers, SSHCFG_GLOBAL }, |
369 | { "denyusers", sDenyUsers }, | 398 | { "denyusers", sDenyUsers, SSHCFG_GLOBAL }, |
370 | { "allowgroups", sAllowGroups }, | 399 | { "allowgroups", sAllowGroups, SSHCFG_GLOBAL }, |
371 | { "denygroups", sDenyGroups }, | 400 | { "denygroups", sDenyGroups, SSHCFG_GLOBAL }, |
372 | { "ciphers", sCiphers }, | 401 | { "ciphers", sCiphers, SSHCFG_GLOBAL }, |
373 | { "macs", sMacs }, | 402 | { "macs", sMacs, SSHCFG_GLOBAL }, |
374 | { "protocol", sProtocol }, | 403 | { "protocol", sProtocol, SSHCFG_GLOBAL }, |
375 | { "gatewayports", sGatewayPorts }, | 404 | { "gatewayports", sGatewayPorts, SSHCFG_ALL }, |
376 | { "subsystem", sSubsystem }, | 405 | { "subsystem", sSubsystem, SSHCFG_GLOBAL }, |
377 | { "maxstartups", sMaxStartups }, | 406 | { "maxstartups", sMaxStartups, SSHCFG_GLOBAL }, |
378 | { "maxauthtries", sMaxAuthTries }, | 407 | { "maxauthtries", sMaxAuthTries, SSHCFG_GLOBAL }, |
379 | { "banner", sBanner }, | 408 | { "banner", sBanner, SSHCFG_ALL }, |
380 | { "usedns", sUseDNS }, | 409 | { "usedns", sUseDNS, SSHCFG_GLOBAL }, |
381 | { "verifyreversemapping", sDeprecated }, | 410 | { "verifyreversemapping", sDeprecated, SSHCFG_GLOBAL }, |
382 | { "reversemappingcheck", sDeprecated }, | 411 | { "reversemappingcheck", sDeprecated, SSHCFG_GLOBAL }, |
383 | { "clientaliveinterval", sClientAliveInterval }, | 412 | { "clientaliveinterval", sClientAliveInterval, SSHCFG_GLOBAL }, |
384 | { "clientalivecountmax", sClientAliveCountMax }, | 413 | { "clientalivecountmax", sClientAliveCountMax, SSHCFG_GLOBAL }, |
385 | { "authorizedkeysfile", sAuthorizedKeysFile }, | 414 | { "authorizedkeysfile", sAuthorizedKeysFile, SSHCFG_GLOBAL }, |
386 | { "authorizedkeysfile2", sAuthorizedKeysFile2 }, | 415 | { "authorizedkeysfile2", sAuthorizedKeysFile2, SSHCFG_GLOBAL }, |
387 | { "useprivilegeseparation", sUsePrivilegeSeparation}, | 416 | { "useprivilegeseparation", sUsePrivilegeSeparation, SSHCFG_GLOBAL }, |
388 | { "acceptenv", sAcceptEnv }, | 417 | { "acceptenv", sAcceptEnv, SSHCFG_GLOBAL }, |
389 | { "permittunnel", sPermitTunnel }, | 418 | { "permittunnel", sPermitTunnel, SSHCFG_GLOBAL }, |
390 | { NULL, sBadOption } | 419 | { "match", sMatch, SSHCFG_ALL }, |
420 | { "permitopen", sPermitOpen, SSHCFG_ALL }, | ||
421 | { "forcecommand", sForceCommand, SSHCFG_ALL }, | ||
422 | { NULL, sBadOption, 0 } | ||
391 | }; | 423 | }; |
392 | 424 | ||
393 | /* | 425 | /* |
@@ -396,13 +428,15 @@ static struct { | |||
396 | 428 | ||
397 | static ServerOpCodes | 429 | static ServerOpCodes |
398 | parse_token(const char *cp, const char *filename, | 430 | parse_token(const char *cp, const char *filename, |
399 | int linenum) | 431 | int linenum, u_int *flags) |
400 | { | 432 | { |
401 | u_int i; | 433 | u_int i; |
402 | 434 | ||
403 | for (i = 0; keywords[i].name; i++) | 435 | for (i = 0; keywords[i].name; i++) |
404 | if (strcasecmp(cp, keywords[i].name) == 0) | 436 | if (strcasecmp(cp, keywords[i].name) == 0) { |
437 | *flags = keywords[i].flags; | ||
405 | return keywords[i].opcode; | 438 | return keywords[i].opcode; |
439 | } | ||
406 | 440 | ||
407 | error("%s: line %d: Bad configuration option: %s", | 441 | error("%s: line %d: Bad configuration option: %s", |
408 | filename, linenum, cp); | 442 | filename, linenum, cp); |
@@ -447,18 +481,171 @@ add_one_listen_addr(ServerOptions *options, char *addr, u_short port) | |||
447 | options->listen_addrs = aitop; | 481 | options->listen_addrs = aitop; |
448 | } | 482 | } |
449 | 483 | ||
484 | /* | ||
485 | * The strategy for the Match blocks is that the config file is parsed twice. | ||
486 | * | ||
487 | * The first time is at startup. activep is initialized to 1 and the | ||
488 | * directives in the global context are processed and acted on. Hitting a | ||
489 | * Match directive unsets activep and the directives inside the block are | ||
490 | * checked for syntax only. | ||
491 | * | ||
492 | * The second time is after a connection has been established but before | ||
493 | * authentication. activep is initialized to 2 and global config directives | ||
494 | * are ignored since they have already been processed. If the criteria in a | ||
495 | * Match block is met, activep is set and the subsequent directives | ||
496 | * processed and actioned until EOF or another Match block unsets it. Any | ||
497 | * options set are copied into the main server config. | ||
498 | * | ||
499 | * Potential additions/improvements: | ||
500 | * - Add Match support for pre-kex directives, eg Protocol, Ciphers. | ||
501 | * | ||
502 | * - Add a Tag directive (idea from David Leonard) ala pf, eg: | ||
503 | * Match Address 192.168.0.* | ||
504 | * Tag trusted | ||
505 | * Match Group wheel | ||
506 | * Tag trusted | ||
507 | * Match Tag trusted | ||
508 | * AllowTcpForwarding yes | ||
509 | * GatewayPorts clientspecified | ||
510 | * [...] | ||
511 | * | ||
512 | * - Add a PermittedChannelRequests directive | ||
513 | * Match Group shell | ||
514 | * PermittedChannelRequests session,forwarded-tcpip | ||
515 | */ | ||
516 | |||
517 | static int | ||
518 | match_cfg_line_group(const char *grps, int line, const char *user) | ||
519 | { | ||
520 | int result = 0; | ||
521 | u_int ngrps = 0; | ||
522 | char *arg, *p, *cp, *grplist[MAX_MATCH_GROUPS]; | ||
523 | struct passwd *pw; | ||
524 | |||
525 | /* | ||
526 | * Even if we do not have a user yet, we still need to check for | ||
527 | * valid syntax. | ||
528 | */ | ||
529 | arg = cp = xstrdup(grps); | ||
530 | while ((p = strsep(&cp, ",")) != NULL && *p != '\0') { | ||
531 | if (ngrps >= MAX_MATCH_GROUPS) { | ||
532 | error("line %d: too many groups in Match Group", line); | ||
533 | result = -1; | ||
534 | goto out; | ||
535 | } | ||
536 | grplist[ngrps++] = p; | ||
537 | } | ||
538 | |||
539 | if (user == NULL) | ||
540 | goto out; | ||
541 | |||
542 | if ((pw = getpwnam(user)) == NULL) { | ||
543 | debug("Can't match group at line %d because user %.100s does " | ||
544 | "not exist", line, user); | ||
545 | } else if (ga_init(pw->pw_name, pw->pw_gid) == 0) { | ||
546 | debug("Can't Match group because user %.100s not in any group " | ||
547 | "at line %d", user, line); | ||
548 | } else if (ga_match(grplist, ngrps) != 1) { | ||
549 | debug("user %.100s does not match group %.100s at line %d", | ||
550 | user, arg, line); | ||
551 | } else { | ||
552 | debug("user %.100s matched group %.100s at line %d", user, | ||
553 | arg, line); | ||
554 | result = 1; | ||
555 | } | ||
556 | out: | ||
557 | ga_free(); | ||
558 | xfree(arg); | ||
559 | return result; | ||
560 | } | ||
561 | |||
562 | static int | ||
563 | match_cfg_line(char **condition, int line, const char *user, const char *host, | ||
564 | const char *address) | ||
565 | { | ||
566 | int result = 1; | ||
567 | char *arg, *attrib, *cp = *condition; | ||
568 | size_t len; | ||
569 | |||
570 | if (user == NULL) | ||
571 | debug3("checking syntax for 'Match %s'", cp); | ||
572 | else | ||
573 | debug3("checking match for '%s' user %s host %s addr %s", cp, | ||
574 | user ? user : "(null)", host ? host : "(null)", | ||
575 | address ? address : "(null)"); | ||
576 | |||
577 | while ((attrib = strdelim(&cp)) && *attrib != '\0') { | ||
578 | if ((arg = strdelim(&cp)) == NULL || *arg == '\0') { | ||
579 | error("Missing Match criteria for %s", attrib); | ||
580 | return -1; | ||
581 | } | ||
582 | len = strlen(arg); | ||
583 | if (strcasecmp(attrib, "user") == 0) { | ||
584 | if (!user) { | ||
585 | result = 0; | ||
586 | continue; | ||
587 | } | ||
588 | if (match_pattern_list(user, arg, len, 0) != 1) | ||
589 | result = 0; | ||
590 | else | ||
591 | debug("user %.100s matched 'User %.100s' at " | ||
592 | "line %d", user, arg, line); | ||
593 | } else if (strcasecmp(attrib, "group") == 0) { | ||
594 | switch (match_cfg_line_group(arg, line, user)) { | ||
595 | case -1: | ||
596 | return -1; | ||
597 | case 0: | ||
598 | result = 0; | ||
599 | } | ||
600 | } else if (strcasecmp(attrib, "host") == 0) { | ||
601 | if (!host) { | ||
602 | result = 0; | ||
603 | continue; | ||
604 | } | ||
605 | if (match_hostname(host, arg, len) != 1) | ||
606 | result = 0; | ||
607 | else | ||
608 | debug("connection from %.100s matched 'Host " | ||
609 | "%.100s' at line %d", host, arg, line); | ||
610 | } else if (strcasecmp(attrib, "address") == 0) { | ||
611 | debug("address '%s' arg '%s'", address, arg); | ||
612 | if (!address) { | ||
613 | result = 0; | ||
614 | continue; | ||
615 | } | ||
616 | if (match_hostname(address, arg, len) != 1) | ||
617 | result = 0; | ||
618 | else | ||
619 | debug("connection from %.100s matched 'Address " | ||
620 | "%.100s' at line %d", address, arg, line); | ||
621 | } else { | ||
622 | error("Unsupported Match attribute %s", attrib); | ||
623 | return -1; | ||
624 | } | ||
625 | } | ||
626 | if (user != NULL) | ||
627 | debug3("match %sfound", result ? "" : "not "); | ||
628 | *condition = cp; | ||
629 | return result; | ||
630 | } | ||
631 | |||
632 | #define WHITESPACE " \t\r\n" | ||
633 | |||
450 | int | 634 | int |
451 | process_server_config_line(ServerOptions *options, char *line, | 635 | process_server_config_line(ServerOptions *options, char *line, |
452 | const char *filename, int linenum) | 636 | const char *filename, int linenum, int *activep, const char *user, |
637 | const char *host, const char *address) | ||
453 | { | 638 | { |
454 | char *cp, **charptr, *arg, *p; | 639 | char *cp, **charptr, *arg, *p; |
455 | int *intptr, value, n; | 640 | int cmdline = 0, *intptr, value, n; |
456 | ServerOpCodes opcode; | 641 | ServerOpCodes opcode; |
457 | u_short port; | 642 | u_short port; |
458 | u_int i; | 643 | u_int i, flags = 0; |
644 | size_t len; | ||
459 | 645 | ||
460 | cp = line; | 646 | cp = line; |
461 | arg = strdelim(&cp); | 647 | if ((arg = strdelim(&cp)) == NULL) |
648 | return 0; | ||
462 | /* Ignore leading whitespace */ | 649 | /* Ignore leading whitespace */ |
463 | if (*arg == '\0') | 650 | if (*arg == '\0') |
464 | arg = strdelim(&cp); | 651 | arg = strdelim(&cp); |
@@ -466,7 +653,25 @@ process_server_config_line(ServerOptions *options, char *line, | |||
466 | return 0; | 653 | return 0; |
467 | intptr = NULL; | 654 | intptr = NULL; |
468 | charptr = NULL; | 655 | charptr = NULL; |
469 | opcode = parse_token(arg, filename, linenum); | 656 | opcode = parse_token(arg, filename, linenum, &flags); |
657 | |||
658 | if (activep == NULL) { /* We are processing a command line directive */ | ||
659 | cmdline = 1; | ||
660 | activep = &cmdline; | ||
661 | } | ||
662 | if (*activep && opcode != sMatch) | ||
663 | debug3("%s:%d setting %s %s", filename, linenum, arg, cp); | ||
664 | if (*activep == 0 && !(flags & SSHCFG_MATCH)) { | ||
665 | if (user == NULL) { | ||
666 | fatal("%s line %d: Directive '%s' is not allowed " | ||
667 | "within a Match block", filename, linenum, arg); | ||
668 | } else { /* this is a directive we have already processed */ | ||
669 | while (arg) | ||
670 | arg = strdelim(&cp); | ||
671 | return 0; | ||
672 | } | ||
673 | } | ||
674 | |||
470 | switch (opcode) { | 675 | switch (opcode) { |
471 | /* Portable-specific options */ | 676 | /* Portable-specific options */ |
472 | case sUsePAM: | 677 | case sUsePAM: |
@@ -504,7 +709,7 @@ parse_int: | |||
504 | fatal("%s line %d: missing integer value.", | 709 | fatal("%s line %d: missing integer value.", |
505 | filename, linenum); | 710 | filename, linenum); |
506 | value = atoi(arg); | 711 | value = atoi(arg); |
507 | if (*intptr == -1) | 712 | if (*activep && *intptr == -1) |
508 | *intptr = value; | 713 | *intptr = value; |
509 | break; | 714 | break; |
510 | 715 | ||
@@ -584,7 +789,7 @@ parse_filename: | |||
584 | if (!arg || *arg == '\0') | 789 | if (!arg || *arg == '\0') |
585 | fatal("%s line %d: missing file name.", | 790 | fatal("%s line %d: missing file name.", |
586 | filename, linenum); | 791 | filename, linenum); |
587 | if (*charptr == NULL) { | 792 | if (*activep && *charptr == NULL) { |
588 | *charptr = tilde_expand_filename(arg, getuid()); | 793 | *charptr = tilde_expand_filename(arg, getuid()); |
589 | /* increase optional counter */ | 794 | /* increase optional counter */ |
590 | if (intptr != NULL) | 795 | if (intptr != NULL) |
@@ -635,7 +840,7 @@ parse_flag: | |||
635 | else | 840 | else |
636 | fatal("%s line %d: Bad yes/no argument: %s", | 841 | fatal("%s line %d: Bad yes/no argument: %s", |
637 | filename, linenum, arg); | 842 | filename, linenum, arg); |
638 | if (*intptr == -1) | 843 | if (*activep && *intptr == -1) |
639 | *intptr = value; | 844 | *intptr = value; |
640 | break; | 845 | break; |
641 | 846 | ||
@@ -691,6 +896,10 @@ parse_flag: | |||
691 | intptr = &options->gss_cleanup_creds; | 896 | intptr = &options->gss_cleanup_creds; |
692 | goto parse_flag; | 897 | goto parse_flag; |
693 | 898 | ||
899 | case sGssStrictAcceptor: | ||
900 | intptr = &options->gss_strict_acceptor; | ||
901 | goto parse_flag; | ||
902 | |||
694 | case sPasswordAuthentication: | 903 | case sPasswordAuthentication: |
695 | intptr = &options->password_authentication; | 904 | intptr = &options->password_authentication; |
696 | goto parse_flag; | 905 | goto parse_flag; |
@@ -783,7 +992,7 @@ parse_flag: | |||
783 | else | 992 | else |
784 | fatal("%s line %d: Bad yes/no/clientspecified " | 993 | fatal("%s line %d: Bad yes/no/clientspecified " |
785 | "argument: %s", filename, linenum, arg); | 994 | "argument: %s", filename, linenum, arg); |
786 | if (*intptr == -1) | 995 | if (*activep && *intptr == -1) |
787 | *intptr = value; | 996 | *intptr = value; |
788 | break; | 997 | break; |
789 | 998 | ||
@@ -834,7 +1043,7 @@ parse_flag: | |||
834 | case sDenyUsers: | 1043 | case sDenyUsers: |
835 | while ((arg = strdelim(&cp)) && *arg != '\0') { | 1044 | while ((arg = strdelim(&cp)) && *arg != '\0') { |
836 | if (options->num_deny_users >= MAX_DENY_USERS) | 1045 | if (options->num_deny_users >= MAX_DENY_USERS) |
837 | fatal( "%s line %d: too many deny users.", | 1046 | fatal("%s line %d: too many deny users.", |
838 | filename, linenum); | 1047 | filename, linenum); |
839 | options->deny_users[options->num_deny_users++] = | 1048 | options->deny_users[options->num_deny_users++] = |
840 | xstrdup(arg); | 1049 | xstrdup(arg); |
@@ -904,6 +1113,10 @@ parse_flag: | |||
904 | if (!arg || *arg == '\0') | 1113 | if (!arg || *arg == '\0') |
905 | fatal("%s line %d: Missing subsystem name.", | 1114 | fatal("%s line %d: Missing subsystem name.", |
906 | filename, linenum); | 1115 | filename, linenum); |
1116 | if (!*activep) { | ||
1117 | arg = strdelim(&cp); | ||
1118 | break; | ||
1119 | } | ||
907 | for (i = 0; i < options->num_subsystems; i++) | 1120 | for (i = 0; i < options->num_subsystems; i++) |
908 | if (strcmp(arg, options->subsystem_name[i]) == 0) | 1121 | if (strcmp(arg, options->subsystem_name[i]) == 0) |
909 | fatal("%s line %d: Subsystem '%s' already defined.", | 1122 | fatal("%s line %d: Subsystem '%s' already defined.", |
@@ -914,6 +1127,17 @@ parse_flag: | |||
914 | fatal("%s line %d: Missing subsystem command.", | 1127 | fatal("%s line %d: Missing subsystem command.", |
915 | filename, linenum); | 1128 | filename, linenum); |
916 | options->subsystem_command[options->num_subsystems] = xstrdup(arg); | 1129 | options->subsystem_command[options->num_subsystems] = xstrdup(arg); |
1130 | |||
1131 | /* Collect arguments (separate to executable) */ | ||
1132 | p = xstrdup(arg); | ||
1133 | len = strlen(p) + 1; | ||
1134 | while ((arg = strdelim(&cp)) != NULL && *arg != '\0') { | ||
1135 | len += 1 + strlen(arg); | ||
1136 | p = xrealloc(p, 1, len); | ||
1137 | strlcat(p, " ", len); | ||
1138 | strlcat(p, arg, len); | ||
1139 | } | ||
1140 | options->subsystem_args[options->num_subsystems] = p; | ||
917 | options->num_subsystems++; | 1141 | options->num_subsystems++; |
918 | break; | 1142 | break; |
919 | 1143 | ||
@@ -954,7 +1178,7 @@ parse_flag: | |||
954 | */ | 1178 | */ |
955 | case sAuthorizedKeysFile: | 1179 | case sAuthorizedKeysFile: |
956 | case sAuthorizedKeysFile2: | 1180 | case sAuthorizedKeysFile2: |
957 | charptr = (opcode == sAuthorizedKeysFile ) ? | 1181 | charptr = (opcode == sAuthorizedKeysFile) ? |
958 | &options->authorized_keys_file : | 1182 | &options->authorized_keys_file : |
959 | &options->authorized_keys_file2; | 1183 | &options->authorized_keys_file2; |
960 | goto parse_filename; | 1184 | goto parse_filename; |
@@ -975,6 +1199,8 @@ parse_flag: | |||
975 | if (options->num_accept_env >= MAX_ACCEPT_ENV) | 1199 | if (options->num_accept_env >= MAX_ACCEPT_ENV) |
976 | fatal("%s line %d: too many allow env.", | 1200 | fatal("%s line %d: too many allow env.", |
977 | filename, linenum); | 1201 | filename, linenum); |
1202 | if (!*activep) | ||
1203 | break; | ||
978 | options->accept_env[options->num_accept_env++] = | 1204 | options->accept_env[options->num_accept_env++] = |
979 | xstrdup(arg); | 1205 | xstrdup(arg); |
980 | } | 1206 | } |
@@ -1002,6 +1228,56 @@ parse_flag: | |||
1002 | *intptr = value; | 1228 | *intptr = value; |
1003 | break; | 1229 | break; |
1004 | 1230 | ||
1231 | case sMatch: | ||
1232 | if (cmdline) | ||
1233 | fatal("Match directive not supported as a command-line " | ||
1234 | "option"); | ||
1235 | value = match_cfg_line(&cp, linenum, user, host, address); | ||
1236 | if (value < 0) | ||
1237 | fatal("%s line %d: Bad Match condition", filename, | ||
1238 | linenum); | ||
1239 | *activep = value; | ||
1240 | break; | ||
1241 | |||
1242 | case sPermitOpen: | ||
1243 | arg = strdelim(&cp); | ||
1244 | if (!arg || *arg == '\0') | ||
1245 | fatal("%s line %d: missing PermitOpen specification", | ||
1246 | filename, linenum); | ||
1247 | n = options->num_permitted_opens; /* modified later */ | ||
1248 | if (strcmp(arg, "any") == 0) { | ||
1249 | if (*activep && n == -1) { | ||
1250 | channel_clear_adm_permitted_opens(); | ||
1251 | options->num_permitted_opens = 0; | ||
1252 | } | ||
1253 | break; | ||
1254 | } | ||
1255 | if (*activep && n == -1) | ||
1256 | channel_clear_adm_permitted_opens(); | ||
1257 | for (; arg != NULL && *arg != '\0'; arg = strdelim(&cp)) { | ||
1258 | p = hpdelim(&arg); | ||
1259 | if (p == NULL) | ||
1260 | fatal("%s line %d: missing host in PermitOpen", | ||
1261 | filename, linenum); | ||
1262 | p = cleanhostname(p); | ||
1263 | if (arg == NULL || (port = a2port(arg)) == 0) | ||
1264 | fatal("%s line %d: bad port number in " | ||
1265 | "PermitOpen", filename, linenum); | ||
1266 | if (*activep && n == -1) | ||
1267 | options->num_permitted_opens = | ||
1268 | channel_add_adm_permitted_opens(p, port); | ||
1269 | } | ||
1270 | break; | ||
1271 | |||
1272 | case sForceCommand: | ||
1273 | if (cp == NULL) | ||
1274 | fatal("%.200s line %d: Missing argument.", filename, | ||
1275 | linenum); | ||
1276 | len = strspn(cp, WHITESPACE); | ||
1277 | if (*activep && options->adm_forced_command == NULL) | ||
1278 | options->adm_forced_command = xstrdup(cp + len); | ||
1279 | return 0; | ||
1280 | |||
1005 | case sDeprecated: | 1281 | case sDeprecated: |
1006 | logit("%s line %d: Deprecated option %s", | 1282 | logit("%s line %d: Deprecated option %s", |
1007 | filename, linenum, arg); | 1283 | filename, linenum, arg); |
@@ -1058,22 +1334,85 @@ load_server_config(const char *filename, Buffer *conf) | |||
1058 | } | 1334 | } |
1059 | 1335 | ||
1060 | void | 1336 | void |
1061 | parse_server_config(ServerOptions *options, const char *filename, Buffer *conf) | 1337 | parse_server_match_config(ServerOptions *options, const char *user, |
1338 | const char *host, const char *address) | ||
1062 | { | 1339 | { |
1063 | int linenum, bad_options = 0; | 1340 | ServerOptions mo; |
1341 | |||
1342 | initialize_server_options(&mo); | ||
1343 | parse_server_config(&mo, "reprocess config", &cfg, user, host, address); | ||
1344 | copy_set_server_options(options, &mo, 0); | ||
1345 | } | ||
1346 | |||
1347 | /* Helper macros */ | ||
1348 | #define M_CP_INTOPT(n) do {\ | ||
1349 | if (src->n != -1) \ | ||
1350 | dst->n = src->n; \ | ||
1351 | } while (0) | ||
1352 | #define M_CP_STROPT(n) do {\ | ||
1353 | if (src->n != NULL) { \ | ||
1354 | if (dst->n != NULL) \ | ||
1355 | xfree(dst->n); \ | ||
1356 | dst->n = src->n; \ | ||
1357 | } \ | ||
1358 | } while(0) | ||
1359 | |||
1360 | /* | ||
1361 | * Copy any supported values that are set. | ||
1362 | * | ||
1363 | * If the preauth flag is set, we do not bother copying the the string or | ||
1364 | * array values that are not used pre-authentication, because any that we | ||
1365 | * do use must be explictly sent in mm_getpwnamallow(). | ||
1366 | */ | ||
1367 | void | ||
1368 | copy_set_server_options(ServerOptions *dst, ServerOptions *src, int preauth) | ||
1369 | { | ||
1370 | M_CP_INTOPT(password_authentication); | ||
1371 | M_CP_INTOPT(gss_authentication); | ||
1372 | M_CP_INTOPT(rsa_authentication); | ||
1373 | M_CP_INTOPT(pubkey_authentication); | ||
1374 | M_CP_INTOPT(kerberos_authentication); | ||
1375 | M_CP_INTOPT(hostbased_authentication); | ||
1376 | M_CP_INTOPT(kbd_interactive_authentication); | ||
1377 | |||
1378 | M_CP_INTOPT(allow_tcp_forwarding); | ||
1379 | M_CP_INTOPT(gateway_ports); | ||
1380 | M_CP_INTOPT(x11_display_offset); | ||
1381 | M_CP_INTOPT(x11_forwarding); | ||
1382 | M_CP_INTOPT(x11_use_localhost); | ||
1383 | |||
1384 | M_CP_STROPT(banner); | ||
1385 | if (preauth) | ||
1386 | return; | ||
1387 | M_CP_STROPT(adm_forced_command); | ||
1388 | } | ||
1389 | |||
1390 | #undef M_CP_INTOPT | ||
1391 | #undef M_CP_STROPT | ||
1392 | |||
1393 | void | ||
1394 | parse_server_config(ServerOptions *options, const char *filename, Buffer *conf, | ||
1395 | const char *user, const char *host, const char *address) | ||
1396 | { | ||
1397 | int active, linenum, bad_options = 0; | ||
1064 | char *cp, *obuf, *cbuf; | 1398 | char *cp, *obuf, *cbuf; |
1065 | 1399 | ||
1066 | debug2("%s: config %s len %d", __func__, filename, buffer_len(conf)); | 1400 | debug2("%s: config %s len %d", __func__, filename, buffer_len(conf)); |
1067 | 1401 | ||
1068 | obuf = cbuf = xstrdup(buffer_ptr(conf)); | 1402 | obuf = cbuf = xstrdup(buffer_ptr(conf)); |
1403 | active = user ? 0 : 1; | ||
1069 | linenum = 1; | 1404 | linenum = 1; |
1070 | while ((cp = strsep(&cbuf, "\n")) != NULL) { | 1405 | while ((cp = strsep(&cbuf, "\n")) != NULL) { |
1071 | if (process_server_config_line(options, cp, filename, | 1406 | if (process_server_config_line(options, cp, filename, |
1072 | linenum++) != 0) | 1407 | linenum++, &active, user, host, address) != 0) |
1073 | bad_options++; | 1408 | bad_options++; |
1074 | } | 1409 | } |
1075 | xfree(obuf); | 1410 | xfree(obuf); |
1076 | if (bad_options > 0) | 1411 | if (bad_options > 0) |
1077 | fatal("%s: terminating, %d bad configuration options", | 1412 | fatal("%s: terminating, %d bad configuration options", |
1078 | filename, bad_options); | 1413 | filename, bad_options); |
1414 | |||
1415 | /* challenge-response is implemented via keyboard interactive */ | ||
1416 | if (options->challenge_response_authentication == 1) | ||
1417 | options->kbd_interactive_authentication = 1; | ||
1079 | } | 1418 | } |
diff --git a/servconf.h b/servconf.h index 0ef05bcd9..257de1c8b 100644 --- a/servconf.h +++ b/servconf.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: servconf.h,v 1.72 2005/12/06 22:38:27 reyk Exp $ */ | 1 | /* $OpenBSD: servconf.h,v 1.80 2007/02/19 10:45:58 dtucker Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -16,8 +16,6 @@ | |||
16 | #ifndef SERVCONF_H | 16 | #ifndef SERVCONF_H |
17 | #define SERVCONF_H | 17 | #define SERVCONF_H |
18 | 18 | ||
19 | #include "buffer.h" | ||
20 | |||
21 | #define MAX_PORTS 256 /* Max # ports. */ | 19 | #define MAX_PORTS 256 /* Max # ports. */ |
22 | 20 | ||
23 | #define MAX_ALLOW_USERS 256 /* Max # users on allow list. */ | 21 | #define MAX_ALLOW_USERS 256 /* Max # users on allow list. */ |
@@ -27,6 +25,7 @@ | |||
27 | #define MAX_SUBSYSTEMS 256 /* Max # subsystems. */ | 25 | #define MAX_SUBSYSTEMS 256 /* Max # subsystems. */ |
28 | #define MAX_HOSTKEYS 256 /* Max # hostkeys. */ | 26 | #define MAX_HOSTKEYS 256 /* Max # hostkeys. */ |
29 | #define MAX_ACCEPT_ENV 256 /* Max # of env vars. */ | 27 | #define MAX_ACCEPT_ENV 256 /* Max # of env vars. */ |
28 | #define MAX_MATCH_GROUPS 256 /* Max # of groups for Match. */ | ||
30 | 29 | ||
31 | /* permit_root_login */ | 30 | /* permit_root_login */ |
32 | #define PERMIT_NOT_SET -1 | 31 | #define PERMIT_NOT_SET -1 |
@@ -90,6 +89,7 @@ typedef struct { | |||
90 | int gss_authentication; /* If true, permit GSSAPI authentication */ | 89 | int gss_authentication; /* If true, permit GSSAPI authentication */ |
91 | int gss_keyex; /* If true, permit GSSAPI key exchange */ | 90 | int gss_keyex; /* If true, permit GSSAPI key exchange */ |
92 | int gss_cleanup_creds; /* If true, destroy cred cache on logout */ | 91 | int gss_cleanup_creds; /* If true, destroy cred cache on logout */ |
92 | int gss_strict_acceptor; /* If true, restrict the GSSAPI acceptor name */ | ||
93 | int password_authentication; /* If true, permit password | 93 | int password_authentication; /* If true, permit password |
94 | * authentication. */ | 94 | * authentication. */ |
95 | int kbd_interactive_authentication; /* If true, permit */ | 95 | int kbd_interactive_authentication; /* If true, permit */ |
@@ -112,6 +112,7 @@ typedef struct { | |||
112 | u_int num_subsystems; | 112 | u_int num_subsystems; |
113 | char *subsystem_name[MAX_SUBSYSTEMS]; | 113 | char *subsystem_name[MAX_SUBSYSTEMS]; |
114 | char *subsystem_command[MAX_SUBSYSTEMS]; | 114 | char *subsystem_command[MAX_SUBSYSTEMS]; |
115 | char *subsystem_args[MAX_SUBSYSTEMS]; | ||
115 | 116 | ||
116 | u_int num_accept_env; | 117 | u_int num_accept_env; |
117 | char *accept_env[MAX_ACCEPT_ENV]; | 118 | char *accept_env[MAX_ACCEPT_ENV]; |
@@ -135,15 +136,24 @@ typedef struct { | |||
135 | char *authorized_keys_file; /* File containing public keys */ | 136 | char *authorized_keys_file; /* File containing public keys */ |
136 | char *authorized_keys_file2; | 137 | char *authorized_keys_file2; |
137 | 138 | ||
139 | char *adm_forced_command; | ||
140 | |||
138 | int use_pam; /* Enable auth via PAM */ | 141 | int use_pam; /* Enable auth via PAM */ |
139 | 142 | ||
140 | int permit_tun; | 143 | int permit_tun; |
144 | |||
145 | int num_permitted_opens; | ||
141 | } ServerOptions; | 146 | } ServerOptions; |
142 | 147 | ||
143 | void initialize_server_options(ServerOptions *); | 148 | void initialize_server_options(ServerOptions *); |
144 | void fill_default_server_options(ServerOptions *); | 149 | void fill_default_server_options(ServerOptions *); |
145 | int process_server_config_line(ServerOptions *, char *, const char *, int); | 150 | int process_server_config_line(ServerOptions *, char *, const char *, int, |
151 | int *, const char *, const char *, const char *); | ||
146 | void load_server_config(const char *, Buffer *); | 152 | void load_server_config(const char *, Buffer *); |
147 | void parse_server_config(ServerOptions *, const char *, Buffer *); | 153 | void parse_server_config(ServerOptions *, const char *, Buffer *, |
154 | const char *, const char *, const char *); | ||
155 | void parse_server_match_config(ServerOptions *, const char *, const char *, | ||
156 | const char *); | ||
157 | void copy_set_server_options(ServerOptions *, ServerOptions *, int); | ||
148 | 158 | ||
149 | #endif /* SERVCONF_H */ | 159 | #endif /* SERVCONF_H */ |
diff --git a/serverloop.c b/serverloop.c index f72b73bf8..29ffcfee1 100644 --- a/serverloop.c +++ b/serverloop.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: serverloop.c,v 1.145 2006/10/11 12:38:03 markus Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -35,7 +36,25 @@ | |||
35 | */ | 36 | */ |
36 | 37 | ||
37 | #include "includes.h" | 38 | #include "includes.h" |
38 | RCSID("$OpenBSD: serverloop.c,v 1.124 2005/12/13 15:03:02 reyk Exp $"); | 39 | |
40 | #include <sys/types.h> | ||
41 | #include <sys/param.h> | ||
42 | #include <sys/wait.h> | ||
43 | #include <sys/socket.h> | ||
44 | #ifdef HAVE_SYS_TIME_H | ||
45 | # include <sys/time.h> | ||
46 | #endif | ||
47 | |||
48 | #include <netinet/in.h> | ||
49 | |||
50 | #include <errno.h> | ||
51 | #include <fcntl.h> | ||
52 | #include <pwd.h> | ||
53 | #include <signal.h> | ||
54 | #include <string.h> | ||
55 | #include <termios.h> | ||
56 | #include <unistd.h> | ||
57 | #include <stdarg.h> | ||
39 | 58 | ||
40 | #include "xmalloc.h" | 59 | #include "xmalloc.h" |
41 | #include "packet.h" | 60 | #include "packet.h" |
@@ -48,13 +67,16 @@ RCSID("$OpenBSD: serverloop.c,v 1.124 2005/12/13 15:03:02 reyk Exp $"); | |||
48 | #include "compat.h" | 67 | #include "compat.h" |
49 | #include "ssh1.h" | 68 | #include "ssh1.h" |
50 | #include "ssh2.h" | 69 | #include "ssh2.h" |
70 | #include "key.h" | ||
71 | #include "cipher.h" | ||
72 | #include "kex.h" | ||
73 | #include "hostfile.h" | ||
51 | #include "auth.h" | 74 | #include "auth.h" |
52 | #include "session.h" | 75 | #include "session.h" |
53 | #include "dispatch.h" | 76 | #include "dispatch.h" |
54 | #include "auth-options.h" | 77 | #include "auth-options.h" |
55 | #include "serverloop.h" | 78 | #include "serverloop.h" |
56 | #include "misc.h" | 79 | #include "misc.h" |
57 | #include "kex.h" | ||
58 | 80 | ||
59 | extern ServerOptions options; | 81 | extern ServerOptions options; |
60 | 82 | ||
@@ -142,11 +164,11 @@ notify_done(fd_set *readset) | |||
142 | debug2("notify_done: reading"); | 164 | debug2("notify_done: reading"); |
143 | } | 165 | } |
144 | 166 | ||
167 | /*ARGSUSED*/ | ||
145 | static void | 168 | static void |
146 | sigchld_handler(int sig) | 169 | sigchld_handler(int sig) |
147 | { | 170 | { |
148 | int save_errno = errno; | 171 | int save_errno = errno; |
149 | debug("Received SIGCHLD."); | ||
150 | child_terminated = 1; | 172 | child_terminated = 1; |
151 | #ifndef _UNICOS | 173 | #ifndef _UNICOS |
152 | mysignal(SIGCHLD, sigchld_handler); | 174 | mysignal(SIGCHLD, sigchld_handler); |
@@ -155,6 +177,7 @@ sigchld_handler(int sig) | |||
155 | errno = save_errno; | 177 | errno = save_errno; |
156 | } | 178 | } |
157 | 179 | ||
180 | /*ARGSUSED*/ | ||
158 | static void | 181 | static void |
159 | sigterm_handler(int sig) | 182 | sigterm_handler(int sig) |
160 | { | 183 | { |
@@ -225,8 +248,10 @@ client_alive_check(void) | |||
225 | int channel_id; | 248 | int channel_id; |
226 | 249 | ||
227 | /* timeout, check to see how many we have had */ | 250 | /* timeout, check to see how many we have had */ |
228 | if (++client_alive_timeouts > options.client_alive_count_max) | 251 | if (++client_alive_timeouts > options.client_alive_count_max) { |
229 | packet_disconnect("Timeout, your session not responding."); | 252 | logit("Timeout, client not responding."); |
253 | cleanup_exit(255); | ||
254 | } | ||
230 | 255 | ||
231 | /* | 256 | /* |
232 | * send a bogus global/channel request with "wantreply", | 257 | * send a bogus global/channel request with "wantreply", |
@@ -255,6 +280,7 @@ wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, int *maxfdp, | |||
255 | struct timeval tv, *tvp; | 280 | struct timeval tv, *tvp; |
256 | int ret; | 281 | int ret; |
257 | int client_alive_scheduled = 0; | 282 | int client_alive_scheduled = 0; |
283 | int program_alive_scheduled = 0; | ||
258 | 284 | ||
259 | /* | 285 | /* |
260 | * if using client_alive, set the max timeout accordingly, | 286 | * if using client_alive, set the max timeout accordingly, |
@@ -292,6 +318,7 @@ wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, int *maxfdp, | |||
292 | * the client, try to get some more data from the program. | 318 | * the client, try to get some more data from the program. |
293 | */ | 319 | */ |
294 | if (packet_not_very_much_data_to_write()) { | 320 | if (packet_not_very_much_data_to_write()) { |
321 | program_alive_scheduled = child_terminated; | ||
295 | if (!fdout_eof) | 322 | if (!fdout_eof) |
296 | FD_SET(fdout, *readsetp); | 323 | FD_SET(fdout, *readsetp); |
297 | if (!fderr_eof) | 324 | if (!fderr_eof) |
@@ -337,8 +364,16 @@ wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, int *maxfdp, | |||
337 | memset(*writesetp, 0, *nallocp); | 364 | memset(*writesetp, 0, *nallocp); |
338 | if (errno != EINTR) | 365 | if (errno != EINTR) |
339 | error("select: %.100s", strerror(errno)); | 366 | error("select: %.100s", strerror(errno)); |
340 | } else if (ret == 0 && client_alive_scheduled) | 367 | } else { |
341 | client_alive_check(); | 368 | if (ret == 0 && client_alive_scheduled) |
369 | client_alive_check(); | ||
370 | if (!compat20 && program_alive_scheduled && fdin_is_tty) { | ||
371 | if (!fdout_eof) | ||
372 | FD_SET(fdout, *readsetp); | ||
373 | if (!fderr_eof) | ||
374 | FD_SET(fderr, *readsetp); | ||
375 | } | ||
376 | } | ||
342 | 377 | ||
343 | notify_done(*readsetp); | 378 | notify_done(*readsetp); |
344 | } | 379 | } |
@@ -348,7 +383,7 @@ wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, int *maxfdp, | |||
348 | * in buffers and processed later. | 383 | * in buffers and processed later. |
349 | */ | 384 | */ |
350 | static void | 385 | static void |
351 | process_input(fd_set * readset) | 386 | process_input(fd_set *readset) |
352 | { | 387 | { |
353 | int len; | 388 | int len; |
354 | char buf[16384]; | 389 | char buf[16384]; |
@@ -380,10 +415,17 @@ process_input(fd_set * readset) | |||
380 | 415 | ||
381 | /* Read and buffer any available stdout data from the program. */ | 416 | /* Read and buffer any available stdout data from the program. */ |
382 | if (!fdout_eof && FD_ISSET(fdout, readset)) { | 417 | if (!fdout_eof && FD_ISSET(fdout, readset)) { |
418 | errno = 0; | ||
383 | len = read(fdout, buf, sizeof(buf)); | 419 | len = read(fdout, buf, sizeof(buf)); |
384 | if (len < 0 && (errno == EINTR || errno == EAGAIN)) { | 420 | if (len < 0 && (errno == EINTR || |
421 | (errno == EAGAIN && !child_terminated))) { | ||
385 | /* do nothing */ | 422 | /* do nothing */ |
423 | #ifndef PTY_ZEROREAD | ||
386 | } else if (len <= 0) { | 424 | } else if (len <= 0) { |
425 | #else | ||
426 | } else if ((!isatty(fdout) && len <= 0) || | ||
427 | (isatty(fdout) && (len < 0 || (len == 0 && errno != 0)))) { | ||
428 | #endif | ||
387 | fdout_eof = 1; | 429 | fdout_eof = 1; |
388 | } else { | 430 | } else { |
389 | buffer_append(&stdout_buffer, buf, len); | 431 | buffer_append(&stdout_buffer, buf, len); |
@@ -392,10 +434,17 @@ process_input(fd_set * readset) | |||
392 | } | 434 | } |
393 | /* Read and buffer any available stderr data from the program. */ | 435 | /* Read and buffer any available stderr data from the program. */ |
394 | if (!fderr_eof && FD_ISSET(fderr, readset)) { | 436 | if (!fderr_eof && FD_ISSET(fderr, readset)) { |
437 | errno = 0; | ||
395 | len = read(fderr, buf, sizeof(buf)); | 438 | len = read(fderr, buf, sizeof(buf)); |
396 | if (len < 0 && (errno == EINTR || errno == EAGAIN)) { | 439 | if (len < 0 && (errno == EINTR || |
440 | (errno == EAGAIN && !child_terminated))) { | ||
397 | /* do nothing */ | 441 | /* do nothing */ |
442 | #ifndef PTY_ZEROREAD | ||
398 | } else if (len <= 0) { | 443 | } else if (len <= 0) { |
444 | #else | ||
445 | } else if ((!isatty(fderr) && len <= 0) || | ||
446 | (isatty(fderr) && (len < 0 || (len == 0 && errno != 0)))) { | ||
447 | #endif | ||
399 | fderr_eof = 1; | 448 | fderr_eof = 1; |
400 | } else { | 449 | } else { |
401 | buffer_append(&stderr_buffer, buf, len); | 450 | buffer_append(&stderr_buffer, buf, len); |
@@ -407,7 +456,7 @@ process_input(fd_set * readset) | |||
407 | * Sends data from internal buffers to client program stdin. | 456 | * Sends data from internal buffers to client program stdin. |
408 | */ | 457 | */ |
409 | static void | 458 | static void |
410 | process_output(fd_set * writeset) | 459 | process_output(fd_set *writeset) |
411 | { | 460 | { |
412 | struct termios tio; | 461 | struct termios tio; |
413 | u_char *data; | 462 | u_char *data; |
@@ -749,6 +798,7 @@ collect_children(void) | |||
749 | sigaddset(&nset, SIGCHLD); | 798 | sigaddset(&nset, SIGCHLD); |
750 | sigprocmask(SIG_BLOCK, &nset, &oset); | 799 | sigprocmask(SIG_BLOCK, &nset, &oset); |
751 | if (child_terminated) { | 800 | if (child_terminated) { |
801 | debug("Received SIGCHLD."); | ||
752 | while ((pid = waitpid(-1, &status, WNOHANG)) > 0 || | 802 | while ((pid = waitpid(-1, &status, WNOHANG)) > 0 || |
753 | (pid < 0 && errno == EINTR)) | 803 | (pid < 0 && errno == EINTR)) |
754 | if (pid > 0) | 804 | if (pid > 0) |
@@ -873,10 +923,10 @@ server_input_eof(int type, u_int32_t seq, void *ctxt) | |||
873 | static void | 923 | static void |
874 | server_input_window_size(int type, u_int32_t seq, void *ctxt) | 924 | server_input_window_size(int type, u_int32_t seq, void *ctxt) |
875 | { | 925 | { |
876 | int row = packet_get_int(); | 926 | u_int row = packet_get_int(); |
877 | int col = packet_get_int(); | 927 | u_int col = packet_get_int(); |
878 | int xpixel = packet_get_int(); | 928 | u_int xpixel = packet_get_int(); |
879 | int ypixel = packet_get_int(); | 929 | u_int ypixel = packet_get_int(); |
880 | 930 | ||
881 | debug("Window change received."); | 931 | debug("Window change received."); |
882 | packet_check_eom(); | 932 | packet_check_eom(); |
@@ -937,7 +987,7 @@ server_request_tun(void) | |||
937 | 987 | ||
938 | tun = packet_get_int(); | 988 | tun = packet_get_int(); |
939 | if (forced_tun_device != -1) { | 989 | if (forced_tun_device != -1) { |
940 | if (tun != SSH_TUNID_ANY && forced_tun_device != tun) | 990 | if (tun != SSH_TUNID_ANY && forced_tun_device != tun) |
941 | goto done; | 991 | goto done; |
942 | tun = forced_tun_device; | 992 | tun = forced_tun_device; |
943 | } | 993 | } |
@@ -1085,6 +1135,7 @@ server_input_global_request(int type, u_int32_t seq, void *ctxt) | |||
1085 | 1135 | ||
1086 | success = channel_cancel_rport_listener(cancel_address, | 1136 | success = channel_cancel_rport_listener(cancel_address, |
1087 | cancel_port); | 1137 | cancel_port); |
1138 | xfree(cancel_address); | ||
1088 | } | 1139 | } |
1089 | if (want_reply) { | 1140 | if (want_reply) { |
1090 | packet_start(success ? | 1141 | packet_start(success ? |
@@ -1094,6 +1145,7 @@ server_input_global_request(int type, u_int32_t seq, void *ctxt) | |||
1094 | } | 1145 | } |
1095 | xfree(rtype); | 1146 | xfree(rtype); |
1096 | } | 1147 | } |
1148 | |||
1097 | static void | 1149 | static void |
1098 | server_input_channel_req(int type, u_int32_t seq, void *ctxt) | 1150 | server_input_channel_req(int type, u_int32_t seq, void *ctxt) |
1099 | { | 1151 | { |
diff --git a/serverloop.h b/serverloop.h index f419198d1..7311558f9 100644 --- a/serverloop.h +++ b/serverloop.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: serverloop.h,v 1.5 2001/06/27 02:12:53 markus Exp $ */ | 1 | /* $OpenBSD: serverloop.h,v 1.6 2006/03/25 22:22:43 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: session.c,v 1.221 2007/01/21 01:41:54 stevesk Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
3 | * All rights reserved | 4 | * All rights reserved |
@@ -33,12 +34,35 @@ | |||
33 | */ | 34 | */ |
34 | 35 | ||
35 | #include "includes.h" | 36 | #include "includes.h" |
36 | RCSID("$OpenBSD: session.c,v 1.191 2005/12/24 02:27:41 djm Exp $"); | ||
37 | 37 | ||
38 | #include <sys/types.h> | ||
39 | #include <sys/param.h> | ||
40 | #ifdef HAVE_SYS_STAT_H | ||
41 | # include <sys/stat.h> | ||
42 | #endif | ||
43 | #include <sys/socket.h> | ||
44 | #include <sys/un.h> | ||
45 | #include <sys/wait.h> | ||
46 | |||
47 | #include <arpa/inet.h> | ||
48 | |||
49 | #include <errno.h> | ||
50 | #include <grp.h> | ||
51 | #ifdef HAVE_PATHS_H | ||
52 | #include <paths.h> | ||
53 | #endif | ||
54 | #include <pwd.h> | ||
55 | #include <signal.h> | ||
56 | #include <stdarg.h> | ||
57 | #include <stdio.h> | ||
58 | #include <stdlib.h> | ||
59 | #include <string.h> | ||
60 | #include <unistd.h> | ||
61 | |||
62 | #include "xmalloc.h" | ||
38 | #include "ssh.h" | 63 | #include "ssh.h" |
39 | #include "ssh1.h" | 64 | #include "ssh1.h" |
40 | #include "ssh2.h" | 65 | #include "ssh2.h" |
41 | #include "xmalloc.h" | ||
42 | #include "sshpty.h" | 66 | #include "sshpty.h" |
43 | #include "packet.h" | 67 | #include "packet.h" |
44 | #include "buffer.h" | 68 | #include "buffer.h" |
@@ -46,7 +70,12 @@ RCSID("$OpenBSD: session.c,v 1.191 2005/12/24 02:27:41 djm Exp $"); | |||
46 | #include "uidswap.h" | 70 | #include "uidswap.h" |
47 | #include "compat.h" | 71 | #include "compat.h" |
48 | #include "channels.h" | 72 | #include "channels.h" |
49 | #include "bufaux.h" | 73 | #include "key.h" |
74 | #include "cipher.h" | ||
75 | #ifdef GSSAPI | ||
76 | #include "ssh-gss.h" | ||
77 | #endif | ||
78 | #include "hostfile.h" | ||
50 | #include "auth.h" | 79 | #include "auth.h" |
51 | #include "auth-options.h" | 80 | #include "auth-options.h" |
52 | #include "pathnames.h" | 81 | #include "pathnames.h" |
@@ -59,16 +88,10 @@ RCSID("$OpenBSD: session.c,v 1.191 2005/12/24 02:27:41 djm Exp $"); | |||
59 | #include "kex.h" | 88 | #include "kex.h" |
60 | #include "monitor_wrap.h" | 89 | #include "monitor_wrap.h" |
61 | 90 | ||
62 | #include "selinux.h" | ||
63 | |||
64 | #if defined(KRB5) && defined(USE_AFS) | 91 | #if defined(KRB5) && defined(USE_AFS) |
65 | #include <kafs.h> | 92 | #include <kafs.h> |
66 | #endif | 93 | #endif |
67 | 94 | ||
68 | #ifdef GSSAPI | ||
69 | #include "ssh-gss.h" | ||
70 | #endif | ||
71 | |||
72 | /* func */ | 95 | /* func */ |
73 | 96 | ||
74 | Session *session_new(void); | 97 | Session *session_new(void); |
@@ -177,7 +200,7 @@ auth_input_request_forwarding(struct passwd * pw) | |||
177 | sunaddr.sun_family = AF_UNIX; | 200 | sunaddr.sun_family = AF_UNIX; |
178 | strlcpy(sunaddr.sun_path, auth_sock_name, sizeof(sunaddr.sun_path)); | 201 | strlcpy(sunaddr.sun_path, auth_sock_name, sizeof(sunaddr.sun_path)); |
179 | 202 | ||
180 | if (bind(sock, (struct sockaddr *) & sunaddr, sizeof(sunaddr)) < 0) | 203 | if (bind(sock, (struct sockaddr *)&sunaddr, sizeof(sunaddr)) < 0) |
181 | packet_disconnect("bind: %.100s", strerror(errno)); | 204 | packet_disconnect("bind: %.100s", strerror(errno)); |
182 | 205 | ||
183 | /* Restore the privileged uid. */ | 206 | /* Restore the privileged uid. */ |
@@ -324,7 +347,11 @@ do_authenticated1(Authctxt *authctxt) | |||
324 | break; | 347 | break; |
325 | } | 348 | } |
326 | debug("Received TCP/IP port forwarding request."); | 349 | debug("Received TCP/IP port forwarding request."); |
327 | channel_input_port_forward_request(s->pw->pw_uid == 0, options.gateway_ports); | 350 | if (channel_input_port_forward_request(s->pw->pw_uid == 0, |
351 | options.gateway_ports) < 0) { | ||
352 | debug("Port forwarding failed."); | ||
353 | break; | ||
354 | } | ||
328 | success = 1; | 355 | success = 1; |
329 | break; | 356 | break; |
330 | 357 | ||
@@ -634,7 +661,7 @@ do_pre_login(Session *s) | |||
634 | fromlen = sizeof(from); | 661 | fromlen = sizeof(from); |
635 | if (packet_connection_is_on_socket()) { | 662 | if (packet_connection_is_on_socket()) { |
636 | if (getpeername(packet_get_connection_in(), | 663 | if (getpeername(packet_get_connection_in(), |
637 | (struct sockaddr *) & from, &fromlen) < 0) { | 664 | (struct sockaddr *)&from, &fromlen) < 0) { |
638 | debug("getpeername: %.100s", strerror(errno)); | 665 | debug("getpeername: %.100s", strerror(errno)); |
639 | cleanup_exit(255); | 666 | cleanup_exit(255); |
640 | } | 667 | } |
@@ -653,10 +680,14 @@ do_pre_login(Session *s) | |||
653 | void | 680 | void |
654 | do_exec(Session *s, const char *command) | 681 | do_exec(Session *s, const char *command) |
655 | { | 682 | { |
656 | if (forced_command) { | 683 | if (options.adm_forced_command) { |
684 | original_command = command; | ||
685 | command = options.adm_forced_command; | ||
686 | debug("Forced command (config) '%.900s'", command); | ||
687 | } else if (forced_command) { | ||
657 | original_command = command; | 688 | original_command = command; |
658 | command = forced_command; | 689 | command = forced_command; |
659 | debug("Forced command '%.900s'", command); | 690 | debug("Forced command (key option) '%.900s'", command); |
660 | } | 691 | } |
661 | 692 | ||
662 | #ifdef SSH_AUDIT_EVENTS | 693 | #ifdef SSH_AUDIT_EVENTS |
@@ -828,7 +859,7 @@ child_set_env(char ***envp, u_int *envsizep, const char *name, | |||
828 | if (envsize >= 1000) | 859 | if (envsize >= 1000) |
829 | fatal("child_set_env: too many env vars"); | 860 | fatal("child_set_env: too many env vars"); |
830 | envsize += 50; | 861 | envsize += 50; |
831 | env = (*envp) = xrealloc(env, envsize * sizeof(char *)); | 862 | env = (*envp) = xrealloc(env, envsize, sizeof(char *)); |
832 | *envsizep = envsize; | 863 | *envsizep = envsize; |
833 | } | 864 | } |
834 | /* Need to set the NULL pointer at end of array beyond the new slot. */ | 865 | /* Need to set the NULL pointer at end of array beyond the new slot. */ |
@@ -969,12 +1000,15 @@ do_setup_env(Session *s, const char *shell) | |||
969 | { | 1000 | { |
970 | char buf[256]; | 1001 | char buf[256]; |
971 | u_int i, envsize; | 1002 | u_int i, envsize; |
972 | char **env, *laddr, *path = NULL; | 1003 | char **env, *laddr; |
973 | struct passwd *pw = s->pw; | 1004 | struct passwd *pw = s->pw; |
1005 | #ifndef HAVE_LOGIN_CAP | ||
1006 | char *path = NULL; | ||
1007 | #endif | ||
974 | 1008 | ||
975 | /* Initialize the environment. */ | 1009 | /* Initialize the environment. */ |
976 | envsize = 100; | 1010 | envsize = 100; |
977 | env = xmalloc(envsize * sizeof(char *)); | 1011 | env = xcalloc(envsize, sizeof(char *)); |
978 | env[0] = NULL; | 1012 | env[0] = NULL; |
979 | 1013 | ||
980 | #ifdef HAVE_CYGWIN | 1014 | #ifdef HAVE_CYGWIN |
@@ -1343,7 +1377,9 @@ do_setusercontext(struct passwd *pw) | |||
1343 | if (getuid() != pw->pw_uid || geteuid() != pw->pw_uid) | 1377 | if (getuid() != pw->pw_uid || geteuid() != pw->pw_uid) |
1344 | fatal("Failed to set uids to %u.", (u_int) pw->pw_uid); | 1378 | fatal("Failed to set uids to %u.", (u_int) pw->pw_uid); |
1345 | 1379 | ||
1346 | setup_selinux_exec_context(pw->pw_name); | 1380 | #ifdef WITH_SELINUX |
1381 | ssh_selinux_setup_exec_context(pw->pw_name); | ||
1382 | #endif | ||
1347 | } | 1383 | } |
1348 | 1384 | ||
1349 | static void | 1385 | static void |
@@ -1563,7 +1599,7 @@ do_child(Session *s, const char *command) | |||
1563 | do_rc_files(s, shell); | 1599 | do_rc_files(s, shell); |
1564 | 1600 | ||
1565 | /* restore SIGPIPE for child */ | 1601 | /* restore SIGPIPE for child */ |
1566 | signal(SIGPIPE, SIG_DFL); | 1602 | signal(SIGPIPE, SIG_DFL); |
1567 | 1603 | ||
1568 | if (options.use_login) { | 1604 | if (options.use_login) { |
1569 | launch_login(pw, hostname); | 1605 | launch_login(pw, hostname); |
@@ -1827,7 +1863,7 @@ session_subsystem_req(Session *s) | |||
1827 | struct stat st; | 1863 | struct stat st; |
1828 | u_int len; | 1864 | u_int len; |
1829 | int success = 0; | 1865 | int success = 0; |
1830 | char *cmd, *subsys = packet_get_string(&len); | 1866 | char *prog, *cmd, *subsys = packet_get_string(&len); |
1831 | u_int i; | 1867 | u_int i; |
1832 | 1868 | ||
1833 | packet_check_eom(); | 1869 | packet_check_eom(); |
@@ -1835,9 +1871,10 @@ session_subsystem_req(Session *s) | |||
1835 | 1871 | ||
1836 | for (i = 0; i < options.num_subsystems; i++) { | 1872 | for (i = 0; i < options.num_subsystems; i++) { |
1837 | if (strcmp(subsys, options.subsystem_name[i]) == 0) { | 1873 | if (strcmp(subsys, options.subsystem_name[i]) == 0) { |
1838 | cmd = options.subsystem_command[i]; | 1874 | prog = options.subsystem_command[i]; |
1839 | if (stat(cmd, &st) < 0) { | 1875 | cmd = options.subsystem_args[i]; |
1840 | error("subsystem: cannot stat %s: %s", cmd, | 1876 | if (stat(prog, &st) < 0) { |
1877 | error("subsystem: cannot stat %s: %s", prog, | ||
1841 | strerror(errno)); | 1878 | strerror(errno)); |
1842 | break; | 1879 | break; |
1843 | } | 1880 | } |
@@ -1934,8 +1971,8 @@ session_env_req(Session *s) | |||
1934 | for (i = 0; i < options.num_accept_env; i++) { | 1971 | for (i = 0; i < options.num_accept_env; i++) { |
1935 | if (match_pattern(name, options.accept_env[i])) { | 1972 | if (match_pattern(name, options.accept_env[i])) { |
1936 | debug2("Setting env %d: %s=%s", s->num_env, name, val); | 1973 | debug2("Setting env %d: %s=%s", s->num_env, name, val); |
1937 | s->env = xrealloc(s->env, sizeof(*s->env) * | 1974 | s->env = xrealloc(s->env, s->num_env + 1, |
1938 | (s->num_env + 1)); | 1975 | sizeof(*s->env)); |
1939 | s->env[s->num_env].name = name; | 1976 | s->env[s->num_env].name = name; |
1940 | s->env[s->num_env].val = val; | 1977 | s->env[s->num_env].val = val; |
1941 | s->num_env++; | 1978 | s->num_env++; |
@@ -1990,7 +2027,7 @@ session_input_channel_req(Channel *c, const char *rtype) | |||
1990 | } else if (strcmp(rtype, "exec") == 0) { | 2027 | } else if (strcmp(rtype, "exec") == 0) { |
1991 | success = session_exec_req(s); | 2028 | success = session_exec_req(s); |
1992 | } else if (strcmp(rtype, "pty-req") == 0) { | 2029 | } else if (strcmp(rtype, "pty-req") == 0) { |
1993 | success = session_pty_req(s); | 2030 | success = session_pty_req(s); |
1994 | } else if (strcmp(rtype, "x11-req") == 0) { | 2031 | } else if (strcmp(rtype, "x11-req") == 0) { |
1995 | success = session_x11_req(s); | 2032 | success = session_x11_req(s); |
1996 | } else if (strcmp(rtype, "auth-agent-req@openssh.com") == 0) { | 2033 | } else if (strcmp(rtype, "auth-agent-req@openssh.com") == 0) { |
@@ -2115,7 +2152,7 @@ session_close_single_x11(int id, void *arg) | |||
2115 | 2152 | ||
2116 | debug3("session_close_single_x11: channel %d", id); | 2153 | debug3("session_close_single_x11: channel %d", id); |
2117 | channel_cancel_cleanup(id); | 2154 | channel_cancel_cleanup(id); |
2118 | if ((s = session_by_x11_channel(id)) == NULL) | 2155 | if ((s = session_by_x11_channel(id)) == NULL) |
2119 | fatal("session_close_single_x11: no x11 channel %d", id); | 2156 | fatal("session_close_single_x11: no x11 channel %d", id); |
2120 | for (i = 0; s->x11_chanids[i] != -1; i++) { | 2157 | for (i = 0; s->x11_chanids[i] != -1; i++) { |
2121 | debug("session_close_single_x11: session %d: " | 2158 | debug("session_close_single_x11: session %d: " |
@@ -2183,7 +2220,7 @@ session_exit_message(Session *s, int status) | |||
2183 | 2220 | ||
2184 | /* | 2221 | /* |
2185 | * Adjust cleanup callback attachment to send close messages when | 2222 | * Adjust cleanup callback attachment to send close messages when |
2186 | * the channel gets EOF. The session will be then be closed | 2223 | * the channel gets EOF. The session will be then be closed |
2187 | * by session_close_by_channel when the childs close their fds. | 2224 | * by session_close_by_channel when the childs close their fds. |
2188 | */ | 2225 | */ |
2189 | channel_register_cleanup(c->self, session_close_by_channel, 1); | 2226 | channel_register_cleanup(c->self, session_close_by_channel, 1); |
@@ -2219,12 +2256,13 @@ session_close(Session *s) | |||
2219 | if (s->auth_proto) | 2256 | if (s->auth_proto) |
2220 | xfree(s->auth_proto); | 2257 | xfree(s->auth_proto); |
2221 | s->used = 0; | 2258 | s->used = 0; |
2222 | for (i = 0; i < s->num_env; i++) { | 2259 | if (s->env != NULL) { |
2223 | xfree(s->env[i].name); | 2260 | for (i = 0; i < s->num_env; i++) { |
2224 | xfree(s->env[i].val); | 2261 | xfree(s->env[i].name); |
2225 | } | 2262 | xfree(s->env[i].val); |
2226 | if (s->env != NULL) | 2263 | } |
2227 | xfree(s->env); | 2264 | xfree(s->env); |
2265 | } | ||
2228 | session_proctitle(s); | 2266 | session_proctitle(s); |
2229 | } | 2267 | } |
2230 | 2268 | ||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: session.h,v 1.25 2005/07/17 06:49:04 djm Exp $ */ | 1 | /* $OpenBSD: session.h,v 1.29 2006/08/03 03:34:42 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. |
@@ -34,11 +34,13 @@ struct Session { | |||
34 | struct passwd *pw; | 34 | struct passwd *pw; |
35 | Authctxt *authctxt; | 35 | Authctxt *authctxt; |
36 | pid_t pid; | 36 | pid_t pid; |
37 | |||
37 | /* tty */ | 38 | /* tty */ |
38 | char *term; | 39 | char *term; |
39 | int ptyfd, ttyfd, ptymaster; | 40 | int ptyfd, ttyfd, ptymaster; |
40 | u_int row, col, xpixel, ypixel; | 41 | u_int row, col, xpixel, ypixel; |
41 | char tty[TTYSZ]; | 42 | char tty[TTYSZ]; |
43 | |||
42 | /* X11 */ | 44 | /* X11 */ |
43 | u_int display_number; | 45 | u_int display_number; |
44 | char *display; | 46 | char *display; |
@@ -47,6 +49,7 @@ struct Session { | |||
47 | char *auth_proto; | 49 | char *auth_proto; |
48 | char *auth_data; | 50 | char *auth_data; |
49 | int single_connection; | 51 | int single_connection; |
52 | |||
50 | /* proto 2 */ | 53 | /* proto 2 */ |
51 | int chanid; | 54 | int chanid; |
52 | int *x11_chanids; | 55 | int *x11_chanids; |
@@ -55,7 +58,7 @@ struct Session { | |||
55 | struct { | 58 | struct { |
56 | char *name; | 59 | char *name; |
57 | char *val; | 60 | char *val; |
58 | } *env; | 61 | } *env; |
59 | }; | 62 | }; |
60 | 63 | ||
61 | void do_authenticated(Authctxt *); | 64 | void do_authenticated(Authctxt *); |
diff --git a/sftp-client.c b/sftp-client.c index 05bce3368..2746f3245 100644 --- a/sftp-client.c +++ b/sftp-client.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: sftp-client.c,v 1.76 2007/01/22 11:32:50 djm Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> | 3 | * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> |
3 | * | 4 | * |
@@ -20,17 +21,32 @@ | |||
20 | /* XXX: copy between two remote sites */ | 21 | /* XXX: copy between two remote sites */ |
21 | 22 | ||
22 | #include "includes.h" | 23 | #include "includes.h" |
23 | RCSID("$OpenBSD: sftp-client.c,v 1.58 2006/01/02 01:20:31 djm Exp $"); | ||
24 | 24 | ||
25 | #include <sys/types.h> | ||
26 | #include <sys/param.h> | ||
25 | #include "openbsd-compat/sys-queue.h" | 27 | #include "openbsd-compat/sys-queue.h" |
28 | #ifdef HAVE_SYS_STAT_H | ||
29 | # include <sys/stat.h> | ||
30 | #endif | ||
31 | #ifdef HAVE_SYS_TIME_H | ||
32 | # include <sys/time.h> | ||
33 | #endif | ||
34 | #include <sys/uio.h> | ||
35 | |||
36 | #include <errno.h> | ||
37 | #include <fcntl.h> | ||
38 | #include <signal.h> | ||
39 | #include <stdarg.h> | ||
40 | #include <stdio.h> | ||
41 | #include <string.h> | ||
42 | #include <unistd.h> | ||
26 | 43 | ||
27 | #include "buffer.h" | ||
28 | #include "bufaux.h" | ||
29 | #include "getput.h" | ||
30 | #include "xmalloc.h" | 44 | #include "xmalloc.h" |
45 | #include "buffer.h" | ||
31 | #include "log.h" | 46 | #include "log.h" |
32 | #include "atomicio.h" | 47 | #include "atomicio.h" |
33 | #include "progressmeter.h" | 48 | #include "progressmeter.h" |
49 | #include "misc.h" | ||
34 | 50 | ||
35 | #include "sftp.h" | 51 | #include "sftp.h" |
36 | #include "sftp-common.h" | 52 | #include "sftp-common.h" |
@@ -39,7 +55,7 @@ RCSID("$OpenBSD: sftp-client.c,v 1.58 2006/01/02 01:20:31 djm Exp $"); | |||
39 | extern volatile sig_atomic_t interrupted; | 55 | extern volatile sig_atomic_t interrupted; |
40 | extern int showprogress; | 56 | extern int showprogress; |
41 | 57 | ||
42 | /* Minimum amount of data to read at at time */ | 58 | /* Minimum amount of data to read at a time */ |
43 | #define MIN_READ_SIZE 512 | 59 | #define MIN_READ_SIZE 512 |
44 | 60 | ||
45 | struct sftp_conn { | 61 | struct sftp_conn { |
@@ -55,16 +71,19 @@ static void | |||
55 | send_msg(int fd, Buffer *m) | 71 | send_msg(int fd, Buffer *m) |
56 | { | 72 | { |
57 | u_char mlen[4]; | 73 | u_char mlen[4]; |
74 | struct iovec iov[2]; | ||
58 | 75 | ||
59 | if (buffer_len(m) > SFTP_MAX_MSG_LENGTH) | 76 | if (buffer_len(m) > SFTP_MAX_MSG_LENGTH) |
60 | fatal("Outbound message too long %u", buffer_len(m)); | 77 | fatal("Outbound message too long %u", buffer_len(m)); |
61 | 78 | ||
62 | /* Send length first */ | 79 | /* Send length first */ |
63 | PUT_32BIT(mlen, buffer_len(m)); | 80 | put_u32(mlen, buffer_len(m)); |
64 | if (atomicio(vwrite, fd, mlen, sizeof(mlen)) != sizeof(mlen)) | 81 | iov[0].iov_base = mlen; |
65 | fatal("Couldn't send packet: %s", strerror(errno)); | 82 | iov[0].iov_len = sizeof(mlen); |
83 | iov[1].iov_base = buffer_ptr(m); | ||
84 | iov[1].iov_len = buffer_len(m); | ||
66 | 85 | ||
67 | if (atomicio(vwrite, fd, buffer_ptr(m), buffer_len(m)) != buffer_len(m)) | 86 | if (atomiciov(writev, fd, iov, 2) != buffer_len(m) + sizeof(mlen)) |
68 | fatal("Couldn't send packet: %s", strerror(errno)); | 87 | fatal("Couldn't send packet: %s", strerror(errno)); |
69 | 88 | ||
70 | buffer_clear(m); | 89 | buffer_clear(m); |
@@ -388,8 +407,7 @@ do_lsreaddir(struct sftp_conn *conn, char *path, int printflag, | |||
388 | printf("%s\n", longname); | 407 | printf("%s\n", longname); |
389 | 408 | ||
390 | if (dir) { | 409 | if (dir) { |
391 | *dir = xrealloc(*dir, sizeof(**dir) * | 410 | *dir = xrealloc(*dir, ents + 2, sizeof(**dir)); |
392 | (ents + 2)); | ||
393 | (*dir)[ents] = xmalloc(sizeof(***dir)); | 411 | (*dir)[ents] = xmalloc(sizeof(***dir)); |
394 | (*dir)[ents]->filename = xstrdup(filename); | 412 | (*dir)[ents]->filename = xstrdup(filename); |
395 | (*dir)[ents]->longname = xstrdup(longname); | 413 | (*dir)[ents]->longname = xstrdup(longname); |
@@ -1116,10 +1134,13 @@ do_upload(struct sftp_conn *conn, char *local_path, char *remote_path, | |||
1116 | if (status != SSH2_FX_OK) { | 1134 | if (status != SSH2_FX_OK) { |
1117 | error("Couldn't write to remote file \"%s\": %s", | 1135 | error("Couldn't write to remote file \"%s\": %s", |
1118 | remote_path, fx2txt(status)); | 1136 | remote_path, fx2txt(status)); |
1137 | if (showprogress) | ||
1138 | stop_progress_meter(); | ||
1119 | do_close(conn, handle, handle_len); | 1139 | do_close(conn, handle, handle_len); |
1120 | close(local_fd); | 1140 | close(local_fd); |
1121 | xfree(data); | 1141 | xfree(data); |
1122 | xfree(ack); | 1142 | xfree(ack); |
1143 | status = -1; | ||
1123 | goto done; | 1144 | goto done; |
1124 | } | 1145 | } |
1125 | debug3("In write loop, ack for %u %u bytes at %llu", | 1146 | debug3("In write loop, ack for %u %u bytes at %llu", |
diff --git a/sftp-common.c b/sftp-common.c index 4cea3c305..7ebadcc53 100644 --- a/sftp-common.c +++ b/sftp-common.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: sftp-common.c,v 1.20 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
3 | * Copyright (c) 2001 Damien Miller. All rights reserved. | 4 | * Copyright (c) 2001 Damien Miller. All rights reserved. |
@@ -24,12 +25,21 @@ | |||
24 | */ | 25 | */ |
25 | 26 | ||
26 | #include "includes.h" | 27 | #include "includes.h" |
27 | RCSID("$OpenBSD: sftp-common.c,v 1.10 2003/11/10 16:23:41 jakob Exp $"); | ||
28 | 28 | ||
29 | #include <sys/types.h> | ||
30 | #include <sys/stat.h> | ||
31 | #include <sys/param.h> | ||
32 | |||
33 | #include <grp.h> | ||
34 | #include <pwd.h> | ||
35 | #include <stdio.h> | ||
36 | #include <string.h> | ||
37 | #include <time.h> | ||
38 | #include <stdarg.h> | ||
39 | |||
40 | #include "xmalloc.h" | ||
29 | #include "buffer.h" | 41 | #include "buffer.h" |
30 | #include "bufaux.h" | ||
31 | #include "log.h" | 42 | #include "log.h" |
32 | #include "xmalloc.h" | ||
33 | 43 | ||
34 | #include "sftp.h" | 44 | #include "sftp.h" |
35 | #include "sftp-common.h" | 45 | #include "sftp-common.h" |
diff --git a/sftp-common.h b/sftp-common.h index 2b1995a2d..9b5848462 100644 --- a/sftp-common.h +++ b/sftp-common.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sftp-common.h,v 1.6 2006/01/02 01:20:31 djm Exp $ */ | 1 | /* $OpenBSD: sftp-common.h,v 1.10 2006/08/03 03:34:42 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
diff --git a/sftp-glob.c b/sftp-glob.c index 16c5e206a..cdc270827 100644 --- a/sftp-glob.c +++ b/sftp-glob.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: sftp-glob.c,v 1.22 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> | 3 | * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> |
3 | * | 4 | * |
@@ -15,14 +16,18 @@ | |||
15 | */ | 16 | */ |
16 | 17 | ||
17 | #include "includes.h" | 18 | #include "includes.h" |
18 | RCSID("$OpenBSD: sftp-glob.c,v 1.15 2004/02/17 07:17:29 djm Exp $"); | ||
19 | 19 | ||
20 | #include "buffer.h" | 20 | #include <sys/types.h> |
21 | #include "bufaux.h" | 21 | #ifdef HAVE_SYS_STAT_H |
22 | #include "xmalloc.h" | 22 | # include <sys/stat.h> |
23 | #include "log.h" | 23 | #endif |
24 | 24 | ||
25 | #include <dirent.h> | ||
26 | #include <string.h> | ||
27 | |||
28 | #include "xmalloc.h" | ||
25 | #include "sftp.h" | 29 | #include "sftp.h" |
30 | #include "buffer.h" | ||
26 | #include "sftp-common.h" | 31 | #include "sftp-common.h" |
27 | #include "sftp-client.h" | 32 | #include "sftp-client.h" |
28 | 33 | ||
diff --git a/sftp-server.0 b/sftp-server.0 index 5367b5fdb..a5caf8229 100644 --- a/sftp-server.0 +++ b/sftp-server.0 | |||
@@ -4,13 +4,32 @@ NAME | |||
4 | sftp-server - SFTP server subsystem | 4 | sftp-server - SFTP server subsystem |
5 | 5 | ||
6 | SYNOPSIS | 6 | SYNOPSIS |
7 | sftp-server | 7 | sftp-server [-f log_facility] [-l log_level] |
8 | 8 | ||
9 | DESCRIPTION | 9 | DESCRIPTION |
10 | sftp-server is a program that speaks the server side of SFTP protocol to | 10 | sftp-server is a program that speaks the server side of SFTP protocol to |
11 | stdout and expects client requests from stdin. sftp-server is not in- | 11 | stdout and expects client requests from stdin. sftp-server is not in- |
12 | tended to be called directly, but from sshd(8) using the Subsystem op- | 12 | tended to be called directly, but from sshd(8) using the Subsystem op- |
13 | tion. See sshd_config(5) for more information. | 13 | tion. |
14 | |||
15 | Command-line flags to sftp-server should be specified in the Subsystem | ||
16 | declaration. See sshd_config(5) for more information. | ||
17 | |||
18 | Valid options are: | ||
19 | |||
20 | -f log_facility | ||
21 | Specifies the facility code that is used when logging messages | ||
22 | from sftp-server. The possible values are: DAEMON, USER, AUTH, | ||
23 | LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7. | ||
24 | The default is AUTH. | ||
25 | |||
26 | -l log_level | ||
27 | Specifies which messages will be logged by sftp-server. The pos- | ||
28 | sible values are: QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DE- | ||
29 | BUG1, DEBUG2, and DEBUG3. INFO and VERBOSE log transactions that | ||
30 | sftp-server performs on behalf of the client. DEBUG and DEBUG1 | ||
31 | are equivalent. DEBUG2 and DEBUG3 each specify higher levels of | ||
32 | debugging output. The default is ERROR. | ||
14 | 33 | ||
15 | SEE ALSO | 34 | SEE ALSO |
16 | sftp(1), ssh(1), sshd_config(5), sshd(8) | 35 | sftp(1), ssh(1), sshd_config(5), sshd(8) |
@@ -18,10 +37,10 @@ SEE ALSO | |||
18 | T. Ylonen and S. Lehtinen, SSH File Transfer Protocol, draft-ietf-secsh- | 37 | T. Ylonen and S. Lehtinen, SSH File Transfer Protocol, draft-ietf-secsh- |
19 | filexfer-00.txt, January 2001, work in progress material. | 38 | filexfer-00.txt, January 2001, work in progress material. |
20 | 39 | ||
40 | HISTORY | ||
41 | sftp-server first appeared in OpenBSD 2.8. | ||
42 | |||
21 | AUTHORS | 43 | AUTHORS |
22 | Markus Friedl <markus@openbsd.org> | 44 | Markus Friedl <markus@openbsd.org> |
23 | 45 | ||
24 | HISTORY | 46 | OpenBSD 4.1 August 30, 2000 1 |
25 | sftp-server first appeared in OpenBSD 2.8 . | ||
26 | |||
27 | OpenBSD 3.9 August 30, 2000 1 | ||
diff --git a/sftp-server.8 b/sftp-server.8 index 42f5d437c..199c4f30e 100644 --- a/sftp-server.8 +++ b/sftp-server.8 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: sftp-server.8,v 1.10 2003/10/08 08:27:36 jmc Exp $ | 1 | .\" $OpenBSD: sftp-server.8,v 1.11 2006/07/06 10:47:57 djm Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | .\" Copyright (c) 2000 Markus Friedl. All rights reserved. |
4 | .\" | 4 | .\" |
@@ -30,6 +30,8 @@ | |||
30 | .Nd SFTP server subsystem | 30 | .Nd SFTP server subsystem |
31 | .Sh SYNOPSIS | 31 | .Sh SYNOPSIS |
32 | .Nm sftp-server | 32 | .Nm sftp-server |
33 | .Op Fl f Ar log_facility | ||
34 | .Op Fl l Ar log_level | ||
33 | .Sh DESCRIPTION | 35 | .Sh DESCRIPTION |
34 | .Nm | 36 | .Nm |
35 | is a program that speaks the server side of SFTP protocol | 37 | is a program that speaks the server side of SFTP protocol |
@@ -40,9 +42,36 @@ is not intended to be called directly, but from | |||
40 | using the | 42 | using the |
41 | .Cm Subsystem | 43 | .Cm Subsystem |
42 | option. | 44 | option. |
45 | .Pp | ||
46 | Command-line flags to | ||
47 | .Nm | ||
48 | should be specified in the | ||
49 | .Cm Subsystem | ||
50 | declaration. | ||
43 | See | 51 | See |
44 | .Xr sshd_config 5 | 52 | .Xr sshd_config 5 |
45 | for more information. | 53 | for more information. |
54 | .Pp | ||
55 | Valid options are: | ||
56 | .Bl -tag -width Ds | ||
57 | .It Fl f Ar log_facility | ||
58 | Specifies the facility code that is used when logging messages from | ||
59 | .Nm . | ||
60 | The possible values are: DAEMON, USER, AUTH, LOCAL0, LOCAL1, LOCAL2, | ||
61 | LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7. | ||
62 | The default is AUTH. | ||
63 | .It Fl l Ar log_level | ||
64 | Specifies which messages will be logged by | ||
65 | .Nm . | ||
66 | The possible values are: | ||
67 | QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3. | ||
68 | INFO and VERBOSE log transactions that | ||
69 | .Nm | ||
70 | performs on behalf of the client. | ||
71 | DEBUG and DEBUG1 are equivalent. | ||
72 | DEBUG2 and DEBUG3 each specify higher levels of debugging output. | ||
73 | The default is ERROR. | ||
74 | .El | ||
46 | .Sh SEE ALSO | 75 | .Sh SEE ALSO |
47 | .Xr sftp 1 , | 76 | .Xr sftp 1 , |
48 | .Xr ssh 1 , | 77 | .Xr ssh 1 , |
@@ -56,8 +85,9 @@ for more information. | |||
56 | .%D January 2001 | 85 | .%D January 2001 |
57 | .%O work in progress material | 86 | .%O work in progress material |
58 | .Re | 87 | .Re |
59 | .Sh AUTHORS | ||
60 | .An Markus Friedl Aq markus@openbsd.org | ||
61 | .Sh HISTORY | 88 | .Sh HISTORY |
62 | .Nm | 89 | .Nm |
63 | first appeared in OpenBSD 2.8 . | 90 | first appeared in |
91 | .Ox 2.8 . | ||
92 | .Sh AUTHORS | ||
93 | .An Markus Friedl Aq markus@openbsd.org | ||
diff --git a/sftp-server.c b/sftp-server.c index 7060c44ad..64777beff 100644 --- a/sftp-server.c +++ b/sftp-server.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: sftp-server.c,v 1.71 2007/01/03 07:22:36 stevesk Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2000-2004 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000-2004 Markus Friedl. All rights reserved. |
3 | * | 4 | * |
@@ -13,15 +14,33 @@ | |||
13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
15 | */ | 16 | */ |
17 | |||
16 | #include "includes.h" | 18 | #include "includes.h" |
17 | RCSID("$OpenBSD: sftp-server.c,v 1.50 2006/01/02 01:20:31 djm Exp $"); | ||
18 | 19 | ||
20 | #include <sys/types.h> | ||
21 | #include <sys/param.h> | ||
22 | #include <sys/stat.h> | ||
23 | #ifdef HAVE_SYS_TIME_H | ||
24 | # include <sys/time.h> | ||
25 | #endif | ||
26 | |||
27 | #include <dirent.h> | ||
28 | #include <errno.h> | ||
29 | #include <fcntl.h> | ||
30 | #include <pwd.h> | ||
31 | #include <stdlib.h> | ||
32 | #include <stdio.h> | ||
33 | #include <string.h> | ||
34 | #include <pwd.h> | ||
35 | #include <time.h> | ||
36 | #include <unistd.h> | ||
37 | #include <stdarg.h> | ||
38 | |||
39 | #include "xmalloc.h" | ||
19 | #include "buffer.h" | 40 | #include "buffer.h" |
20 | #include "bufaux.h" | ||
21 | #include "getput.h" | ||
22 | #include "log.h" | 41 | #include "log.h" |
23 | #include "xmalloc.h" | ||
24 | #include "misc.h" | 42 | #include "misc.h" |
43 | #include "uidswap.h" | ||
25 | 44 | ||
26 | #include "sftp.h" | 45 | #include "sftp.h" |
27 | #include "sftp-common.h" | 46 | #include "sftp-common.h" |
@@ -30,9 +49,13 @@ RCSID("$OpenBSD: sftp-server.c,v 1.50 2006/01/02 01:20:31 djm Exp $"); | |||
30 | #define get_int64() buffer_get_int64(&iqueue); | 49 | #define get_int64() buffer_get_int64(&iqueue); |
31 | #define get_int() buffer_get_int(&iqueue); | 50 | #define get_int() buffer_get_int(&iqueue); |
32 | #define get_string(lenp) buffer_get_string(&iqueue, lenp); | 51 | #define get_string(lenp) buffer_get_string(&iqueue, lenp); |
33 | #define TRACE debug | ||
34 | 52 | ||
35 | extern char *__progname; | 53 | /* Our verbosity */ |
54 | LogLevel log_level = SYSLOG_LEVEL_ERROR; | ||
55 | |||
56 | /* Our client */ | ||
57 | struct passwd *pw = NULL; | ||
58 | char *client_addr = NULL; | ||
36 | 59 | ||
37 | /* input and output queue */ | 60 | /* input and output queue */ |
38 | Buffer iqueue; | 61 | Buffer iqueue; |
@@ -104,6 +127,33 @@ flags_from_portable(int pflags) | |||
104 | return flags; | 127 | return flags; |
105 | } | 128 | } |
106 | 129 | ||
130 | static const char * | ||
131 | string_from_portable(int pflags) | ||
132 | { | ||
133 | static char ret[128]; | ||
134 | |||
135 | *ret = '\0'; | ||
136 | |||
137 | #define PAPPEND(str) { \ | ||
138 | if (*ret != '\0') \ | ||
139 | strlcat(ret, ",", sizeof(ret)); \ | ||
140 | strlcat(ret, str, sizeof(ret)); \ | ||
141 | } | ||
142 | |||
143 | if (pflags & SSH2_FXF_READ) | ||
144 | PAPPEND("READ") | ||
145 | if (pflags & SSH2_FXF_WRITE) | ||
146 | PAPPEND("WRITE") | ||
147 | if (pflags & SSH2_FXF_CREAT) | ||
148 | PAPPEND("CREATE") | ||
149 | if (pflags & SSH2_FXF_TRUNC) | ||
150 | PAPPEND("TRUNCATE") | ||
151 | if (pflags & SSH2_FXF_EXCL) | ||
152 | PAPPEND("EXCL") | ||
153 | |||
154 | return ret; | ||
155 | } | ||
156 | |||
107 | static Attrib * | 157 | static Attrib * |
108 | get_attrib(void) | 158 | get_attrib(void) |
109 | { | 159 | { |
@@ -118,6 +168,7 @@ struct Handle { | |||
118 | DIR *dirp; | 168 | DIR *dirp; |
119 | int fd; | 169 | int fd; |
120 | char *name; | 170 | char *name; |
171 | u_int64_t bytes_read, bytes_write; | ||
121 | }; | 172 | }; |
122 | 173 | ||
123 | enum { | 174 | enum { |
@@ -148,6 +199,7 @@ handle_new(int use, const char *name, int fd, DIR *dirp) | |||
148 | handles[i].dirp = dirp; | 199 | handles[i].dirp = dirp; |
149 | handles[i].fd = fd; | 200 | handles[i].fd = fd; |
150 | handles[i].name = xstrdup(name); | 201 | handles[i].name = xstrdup(name); |
202 | handles[i].bytes_read = handles[i].bytes_write = 0; | ||
151 | return i; | 203 | return i; |
152 | } | 204 | } |
153 | } | 205 | } |
@@ -167,7 +219,7 @@ handle_to_string(int handle, char **stringp, int *hlenp) | |||
167 | if (stringp == NULL || hlenp == NULL) | 219 | if (stringp == NULL || hlenp == NULL) |
168 | return -1; | 220 | return -1; |
169 | *stringp = xmalloc(sizeof(int32_t)); | 221 | *stringp = xmalloc(sizeof(int32_t)); |
170 | PUT_32BIT(*stringp, handle); | 222 | put_u32(*stringp, handle); |
171 | *hlenp = sizeof(int32_t); | 223 | *hlenp = sizeof(int32_t); |
172 | return 0; | 224 | return 0; |
173 | } | 225 | } |
@@ -179,7 +231,7 @@ handle_from_string(const char *handle, u_int hlen) | |||
179 | 231 | ||
180 | if (hlen != sizeof(int32_t)) | 232 | if (hlen != sizeof(int32_t)) |
181 | return -1; | 233 | return -1; |
182 | val = GET_32BIT(handle); | 234 | val = get_u32(handle); |
183 | if (handle_is_ok(val, HANDLE_FILE) || | 235 | if (handle_is_ok(val, HANDLE_FILE) || |
184 | handle_is_ok(val, HANDLE_DIR)) | 236 | handle_is_ok(val, HANDLE_DIR)) |
185 | return val; | 237 | return val; |
@@ -211,6 +263,36 @@ handle_to_fd(int handle) | |||
211 | return -1; | 263 | return -1; |
212 | } | 264 | } |
213 | 265 | ||
266 | static void | ||
267 | handle_update_read(int handle, ssize_t bytes) | ||
268 | { | ||
269 | if (handle_is_ok(handle, HANDLE_FILE) && bytes > 0) | ||
270 | handles[handle].bytes_read += bytes; | ||
271 | } | ||
272 | |||
273 | static void | ||
274 | handle_update_write(int handle, ssize_t bytes) | ||
275 | { | ||
276 | if (handle_is_ok(handle, HANDLE_FILE) && bytes > 0) | ||
277 | handles[handle].bytes_write += bytes; | ||
278 | } | ||
279 | |||
280 | static u_int64_t | ||
281 | handle_bytes_read(int handle) | ||
282 | { | ||
283 | if (handle_is_ok(handle, HANDLE_FILE)) | ||
284 | return (handles[handle].bytes_read); | ||
285 | return 0; | ||
286 | } | ||
287 | |||
288 | static u_int64_t | ||
289 | handle_bytes_write(int handle) | ||
290 | { | ||
291 | if (handle_is_ok(handle, HANDLE_FILE)) | ||
292 | return (handles[handle].bytes_write); | ||
293 | return 0; | ||
294 | } | ||
295 | |||
214 | static int | 296 | static int |
215 | handle_close(int handle) | 297 | handle_close(int handle) |
216 | { | 298 | { |
@@ -230,6 +312,31 @@ handle_close(int handle) | |||
230 | return ret; | 312 | return ret; |
231 | } | 313 | } |
232 | 314 | ||
315 | static void | ||
316 | handle_log_close(int handle, char *emsg) | ||
317 | { | ||
318 | if (handle_is_ok(handle, HANDLE_FILE)) { | ||
319 | logit("%s%sclose \"%s\" bytes read %llu written %llu", | ||
320 | emsg == NULL ? "" : emsg, emsg == NULL ? "" : " ", | ||
321 | handle_to_name(handle), | ||
322 | handle_bytes_read(handle), handle_bytes_write(handle)); | ||
323 | } else { | ||
324 | logit("%s%sclosedir \"%s\"", | ||
325 | emsg == NULL ? "" : emsg, emsg == NULL ? "" : " ", | ||
326 | handle_to_name(handle)); | ||
327 | } | ||
328 | } | ||
329 | |||
330 | static void | ||
331 | handle_log_exit(void) | ||
332 | { | ||
333 | u_int i; | ||
334 | |||
335 | for (i = 0; i < sizeof(handles)/sizeof(Handle); i++) | ||
336 | if (handles[i].use != HANDLE_UNUSED) | ||
337 | handle_log_close(i, "forced"); | ||
338 | } | ||
339 | |||
233 | static int | 340 | static int |
234 | get_handle(void) | 341 | get_handle(void) |
235 | { | 342 | { |
@@ -256,10 +363,9 @@ send_msg(Buffer *m) | |||
256 | buffer_consume(m, mlen); | 363 | buffer_consume(m, mlen); |
257 | } | 364 | } |
258 | 365 | ||
259 | static void | 366 | static const char * |
260 | send_status(u_int32_t id, u_int32_t status) | 367 | status_to_message(u_int32_t status) |
261 | { | 368 | { |
262 | Buffer msg; | ||
263 | const char *status_messages[] = { | 369 | const char *status_messages[] = { |
264 | "Success", /* SSH_FX_OK */ | 370 | "Success", /* SSH_FX_OK */ |
265 | "End of file", /* SSH_FX_EOF */ | 371 | "End of file", /* SSH_FX_EOF */ |
@@ -272,15 +378,24 @@ send_status(u_int32_t id, u_int32_t status) | |||
272 | "Operation unsupported", /* SSH_FX_OP_UNSUPPORTED */ | 378 | "Operation unsupported", /* SSH_FX_OP_UNSUPPORTED */ |
273 | "Unknown error" /* Others */ | 379 | "Unknown error" /* Others */ |
274 | }; | 380 | }; |
381 | return (status_messages[MIN(status,SSH2_FX_MAX)]); | ||
382 | } | ||
383 | |||
384 | static void | ||
385 | send_status(u_int32_t id, u_int32_t status) | ||
386 | { | ||
387 | Buffer msg; | ||
275 | 388 | ||
276 | TRACE("sent status id %u error %u", id, status); | 389 | debug3("request %u: sent status %u", id, status); |
390 | if (log_level > SYSLOG_LEVEL_VERBOSE || | ||
391 | (status != SSH2_FX_OK && status != SSH2_FX_EOF)) | ||
392 | logit("sent status %s", status_to_message(status)); | ||
277 | buffer_init(&msg); | 393 | buffer_init(&msg); |
278 | buffer_put_char(&msg, SSH2_FXP_STATUS); | 394 | buffer_put_char(&msg, SSH2_FXP_STATUS); |
279 | buffer_put_int(&msg, id); | 395 | buffer_put_int(&msg, id); |
280 | buffer_put_int(&msg, status); | 396 | buffer_put_int(&msg, status); |
281 | if (version >= 3) { | 397 | if (version >= 3) { |
282 | buffer_put_cstring(&msg, | 398 | buffer_put_cstring(&msg, status_to_message(status)); |
283 | status_messages[MIN(status,SSH2_FX_MAX)]); | ||
284 | buffer_put_cstring(&msg, ""); | 399 | buffer_put_cstring(&msg, ""); |
285 | } | 400 | } |
286 | send_msg(&msg); | 401 | send_msg(&msg); |
@@ -302,7 +417,7 @@ send_data_or_handle(char type, u_int32_t id, const char *data, int dlen) | |||
302 | static void | 417 | static void |
303 | send_data(u_int32_t id, const char *data, int dlen) | 418 | send_data(u_int32_t id, const char *data, int dlen) |
304 | { | 419 | { |
305 | TRACE("sent data id %u len %d", id, dlen); | 420 | debug("request %u: sent data len %d", id, dlen); |
306 | send_data_or_handle(SSH2_FXP_DATA, id, data, dlen); | 421 | send_data_or_handle(SSH2_FXP_DATA, id, data, dlen); |
307 | } | 422 | } |
308 | 423 | ||
@@ -313,7 +428,7 @@ send_handle(u_int32_t id, int handle) | |||
313 | int hlen; | 428 | int hlen; |
314 | 429 | ||
315 | handle_to_string(handle, &string, &hlen); | 430 | handle_to_string(handle, &string, &hlen); |
316 | TRACE("sent handle id %u handle %d", id, handle); | 431 | debug("request %u: sent handle handle %d", id, handle); |
317 | send_data_or_handle(SSH2_FXP_HANDLE, id, string, hlen); | 432 | send_data_or_handle(SSH2_FXP_HANDLE, id, string, hlen); |
318 | xfree(string); | 433 | xfree(string); |
319 | } | 434 | } |
@@ -328,7 +443,7 @@ send_names(u_int32_t id, int count, const Stat *stats) | |||
328 | buffer_put_char(&msg, SSH2_FXP_NAME); | 443 | buffer_put_char(&msg, SSH2_FXP_NAME); |
329 | buffer_put_int(&msg, id); | 444 | buffer_put_int(&msg, id); |
330 | buffer_put_int(&msg, count); | 445 | buffer_put_int(&msg, count); |
331 | TRACE("sent names id %u count %d", id, count); | 446 | debug("request %u: sent names count %d", id, count); |
332 | for (i = 0; i < count; i++) { | 447 | for (i = 0; i < count; i++) { |
333 | buffer_put_cstring(&msg, stats[i].name); | 448 | buffer_put_cstring(&msg, stats[i].name); |
334 | buffer_put_cstring(&msg, stats[i].long_name); | 449 | buffer_put_cstring(&msg, stats[i].long_name); |
@@ -343,7 +458,7 @@ send_attrib(u_int32_t id, const Attrib *a) | |||
343 | { | 458 | { |
344 | Buffer msg; | 459 | Buffer msg; |
345 | 460 | ||
346 | TRACE("sent attrib id %u have 0x%x", id, a->flags); | 461 | debug("request %u: sent attrib have 0x%x", id, a->flags); |
347 | buffer_init(&msg); | 462 | buffer_init(&msg); |
348 | buffer_put_char(&msg, SSH2_FXP_ATTRS); | 463 | buffer_put_char(&msg, SSH2_FXP_ATTRS); |
349 | buffer_put_int(&msg, id); | 464 | buffer_put_int(&msg, id); |
@@ -360,7 +475,7 @@ process_init(void) | |||
360 | Buffer msg; | 475 | Buffer msg; |
361 | 476 | ||
362 | version = get_int(); | 477 | version = get_int(); |
363 | TRACE("client version %d", version); | 478 | verbose("received client version %d", version); |
364 | buffer_init(&msg); | 479 | buffer_init(&msg); |
365 | buffer_put_char(&msg, SSH2_FXP_VERSION); | 480 | buffer_put_char(&msg, SSH2_FXP_VERSION); |
366 | buffer_put_int(&msg, SSH2_FILEXFER_VERSION); | 481 | buffer_put_int(&msg, SSH2_FILEXFER_VERSION); |
@@ -379,10 +494,12 @@ process_open(void) | |||
379 | id = get_int(); | 494 | id = get_int(); |
380 | name = get_string(NULL); | 495 | name = get_string(NULL); |
381 | pflags = get_int(); /* portable flags */ | 496 | pflags = get_int(); /* portable flags */ |
497 | debug3("request %u: open flags %d", id, pflags); | ||
382 | a = get_attrib(); | 498 | a = get_attrib(); |
383 | flags = flags_from_portable(pflags); | 499 | flags = flags_from_portable(pflags); |
384 | mode = (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) ? a->perm : 0666; | 500 | mode = (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) ? a->perm : 0666; |
385 | TRACE("open id %u name %s flags %d mode 0%o", id, name, pflags, mode); | 501 | logit("open \"%s\" flags %s mode 0%o", |
502 | name, string_from_portable(pflags), mode); | ||
386 | fd = open(name, flags, mode); | 503 | fd = open(name, flags, mode); |
387 | if (fd < 0) { | 504 | if (fd < 0) { |
388 | status = errno_to_portable(errno); | 505 | status = errno_to_portable(errno); |
@@ -408,7 +525,8 @@ process_close(void) | |||
408 | 525 | ||
409 | id = get_int(); | 526 | id = get_int(); |
410 | handle = get_handle(); | 527 | handle = get_handle(); |
411 | TRACE("close id %u handle %d", id, handle); | 528 | debug3("request %u: close handle %u", id, handle); |
529 | handle_log_close(handle, NULL); | ||
412 | ret = handle_close(handle); | 530 | ret = handle_close(handle); |
413 | status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; | 531 | status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; |
414 | send_status(id, status); | 532 | send_status(id, status); |
@@ -427,11 +545,11 @@ process_read(void) | |||
427 | off = get_int64(); | 545 | off = get_int64(); |
428 | len = get_int(); | 546 | len = get_int(); |
429 | 547 | ||
430 | TRACE("read id %u handle %d off %llu len %d", id, handle, | 548 | debug("request %u: read \"%s\" (handle %d) off %llu len %d", |
431 | (unsigned long long)off, len); | 549 | id, handle_to_name(handle), handle, (unsigned long long)off, len); |
432 | if (len > sizeof buf) { | 550 | if (len > sizeof buf) { |
433 | len = sizeof buf; | 551 | len = sizeof buf; |
434 | logit("read change len %d", len); | 552 | debug2("read change len %d", len); |
435 | } | 553 | } |
436 | fd = handle_to_fd(handle); | 554 | fd = handle_to_fd(handle); |
437 | if (fd >= 0) { | 555 | if (fd >= 0) { |
@@ -447,6 +565,7 @@ process_read(void) | |||
447 | } else { | 565 | } else { |
448 | send_data(id, buf, ret); | 566 | send_data(id, buf, ret); |
449 | status = SSH2_FX_OK; | 567 | status = SSH2_FX_OK; |
568 | handle_update_read(handle, ret); | ||
450 | } | 569 | } |
451 | } | 570 | } |
452 | } | 571 | } |
@@ -468,8 +587,8 @@ process_write(void) | |||
468 | off = get_int64(); | 587 | off = get_int64(); |
469 | data = get_string(&len); | 588 | data = get_string(&len); |
470 | 589 | ||
471 | TRACE("write id %u handle %d off %llu len %d", id, handle, | 590 | debug("request %u: write \"%s\" (handle %d) off %llu len %d", |
472 | (unsigned long long)off, len); | 591 | id, handle_to_name(handle), handle, (unsigned long long)off, len); |
473 | fd = handle_to_fd(handle); | 592 | fd = handle_to_fd(handle); |
474 | if (fd >= 0) { | 593 | if (fd >= 0) { |
475 | if (lseek(fd, off, SEEK_SET) < 0) { | 594 | if (lseek(fd, off, SEEK_SET) < 0) { |
@@ -483,8 +602,9 @@ process_write(void) | |||
483 | status = errno_to_portable(errno); | 602 | status = errno_to_portable(errno); |
484 | } else if ((size_t)ret == len) { | 603 | } else if ((size_t)ret == len) { |
485 | status = SSH2_FX_OK; | 604 | status = SSH2_FX_OK; |
605 | handle_update_write(handle, ret); | ||
486 | } else { | 606 | } else { |
487 | logit("nothing at all written"); | 607 | debug2("nothing at all written"); |
488 | } | 608 | } |
489 | } | 609 | } |
490 | } | 610 | } |
@@ -503,7 +623,8 @@ process_do_stat(int do_lstat) | |||
503 | 623 | ||
504 | id = get_int(); | 624 | id = get_int(); |
505 | name = get_string(NULL); | 625 | name = get_string(NULL); |
506 | TRACE("%sstat id %u name %s", do_lstat ? "l" : "", id, name); | 626 | debug3("request %u: %sstat", id, do_lstat ? "l" : ""); |
627 | verbose("%sstat name \"%s\"", do_lstat ? "l" : "", name); | ||
507 | ret = do_lstat ? lstat(name, &st) : stat(name, &st); | 628 | ret = do_lstat ? lstat(name, &st) : stat(name, &st); |
508 | if (ret < 0) { | 629 | if (ret < 0) { |
509 | status = errno_to_portable(errno); | 630 | status = errno_to_portable(errno); |
@@ -539,9 +660,10 @@ process_fstat(void) | |||
539 | 660 | ||
540 | id = get_int(); | 661 | id = get_int(); |
541 | handle = get_handle(); | 662 | handle = get_handle(); |
542 | TRACE("fstat id %u handle %d", id, handle); | 663 | debug("request %u: fstat \"%s\" (handle %u)", |
664 | id, handle_to_name(handle), handle); | ||
543 | fd = handle_to_fd(handle); | 665 | fd = handle_to_fd(handle); |
544 | if (fd >= 0) { | 666 | if (fd >= 0) { |
545 | ret = fstat(fd, &st); | 667 | ret = fstat(fd, &st); |
546 | if (ret < 0) { | 668 | if (ret < 0) { |
547 | status = errno_to_portable(errno); | 669 | status = errno_to_portable(errno); |
@@ -578,23 +700,33 @@ process_setstat(void) | |||
578 | id = get_int(); | 700 | id = get_int(); |
579 | name = get_string(NULL); | 701 | name = get_string(NULL); |
580 | a = get_attrib(); | 702 | a = get_attrib(); |
581 | TRACE("setstat id %u name %s", id, name); | 703 | debug("request %u: setstat name \"%s\"", id, name); |
582 | if (a->flags & SSH2_FILEXFER_ATTR_SIZE) { | 704 | if (a->flags & SSH2_FILEXFER_ATTR_SIZE) { |
705 | logit("set \"%s\" size %llu", name, a->size); | ||
583 | ret = truncate(name, a->size); | 706 | ret = truncate(name, a->size); |
584 | if (ret == -1) | 707 | if (ret == -1) |
585 | status = errno_to_portable(errno); | 708 | status = errno_to_portable(errno); |
586 | } | 709 | } |
587 | if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) { | 710 | if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) { |
711 | logit("set \"%s\" mode %04o", name, a->perm); | ||
588 | ret = chmod(name, a->perm & 0777); | 712 | ret = chmod(name, a->perm & 0777); |
589 | if (ret == -1) | 713 | if (ret == -1) |
590 | status = errno_to_portable(errno); | 714 | status = errno_to_portable(errno); |
591 | } | 715 | } |
592 | if (a->flags & SSH2_FILEXFER_ATTR_ACMODTIME) { | 716 | if (a->flags & SSH2_FILEXFER_ATTR_ACMODTIME) { |
717 | char buf[64]; | ||
718 | time_t t = a->mtime; | ||
719 | |||
720 | strftime(buf, sizeof(buf), "%Y%m%d-%H:%M:%S", | ||
721 | localtime(&t)); | ||
722 | logit("set \"%s\" modtime %s", name, buf); | ||
593 | ret = utimes(name, attrib_to_tv(a)); | 723 | ret = utimes(name, attrib_to_tv(a)); |
594 | if (ret == -1) | 724 | if (ret == -1) |
595 | status = errno_to_portable(errno); | 725 | status = errno_to_portable(errno); |
596 | } | 726 | } |
597 | if (a->flags & SSH2_FILEXFER_ATTR_UIDGID) { | 727 | if (a->flags & SSH2_FILEXFER_ATTR_UIDGID) { |
728 | logit("set \"%s\" owner %lu group %lu", name, | ||
729 | (u_long)a->uid, (u_long)a->gid); | ||
598 | ret = chown(name, a->uid, a->gid); | 730 | ret = chown(name, a->uid, a->gid); |
599 | if (ret == -1) | 731 | if (ret == -1) |
600 | status = errno_to_portable(errno); | 732 | status = errno_to_portable(errno); |
@@ -610,23 +742,25 @@ process_fsetstat(void) | |||
610 | u_int32_t id; | 742 | u_int32_t id; |
611 | int handle, fd, ret; | 743 | int handle, fd, ret; |
612 | int status = SSH2_FX_OK; | 744 | int status = SSH2_FX_OK; |
613 | char *name; | ||
614 | 745 | ||
615 | id = get_int(); | 746 | id = get_int(); |
616 | handle = get_handle(); | 747 | handle = get_handle(); |
617 | a = get_attrib(); | 748 | a = get_attrib(); |
618 | TRACE("fsetstat id %u handle %d", id, handle); | 749 | debug("request %u: fsetstat handle %d", id, handle); |
619 | fd = handle_to_fd(handle); | 750 | fd = handle_to_fd(handle); |
620 | name = handle_to_name(handle); | 751 | if (fd < 0) { |
621 | if (fd < 0 || name == NULL) { | ||
622 | status = SSH2_FX_FAILURE; | 752 | status = SSH2_FX_FAILURE; |
623 | } else { | 753 | } else { |
754 | char *name = handle_to_name(handle); | ||
755 | |||
624 | if (a->flags & SSH2_FILEXFER_ATTR_SIZE) { | 756 | if (a->flags & SSH2_FILEXFER_ATTR_SIZE) { |
757 | logit("set \"%s\" size %llu", name, a->size); | ||
625 | ret = ftruncate(fd, a->size); | 758 | ret = ftruncate(fd, a->size); |
626 | if (ret == -1) | 759 | if (ret == -1) |
627 | status = errno_to_portable(errno); | 760 | status = errno_to_portable(errno); |
628 | } | 761 | } |
629 | if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) { | 762 | if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) { |
763 | logit("set \"%s\" mode %04o", name, a->perm); | ||
630 | #ifdef HAVE_FCHMOD | 764 | #ifdef HAVE_FCHMOD |
631 | ret = fchmod(fd, a->perm & 0777); | 765 | ret = fchmod(fd, a->perm & 0777); |
632 | #else | 766 | #else |
@@ -636,6 +770,12 @@ process_fsetstat(void) | |||
636 | status = errno_to_portable(errno); | 770 | status = errno_to_portable(errno); |
637 | } | 771 | } |
638 | if (a->flags & SSH2_FILEXFER_ATTR_ACMODTIME) { | 772 | if (a->flags & SSH2_FILEXFER_ATTR_ACMODTIME) { |
773 | char buf[64]; | ||
774 | time_t t = a->mtime; | ||
775 | |||
776 | strftime(buf, sizeof(buf), "%Y%m%d-%H:%M:%S", | ||
777 | localtime(&t)); | ||
778 | logit("set \"%s\" modtime %s", name, buf); | ||
639 | #ifdef HAVE_FUTIMES | 779 | #ifdef HAVE_FUTIMES |
640 | ret = futimes(fd, attrib_to_tv(a)); | 780 | ret = futimes(fd, attrib_to_tv(a)); |
641 | #else | 781 | #else |
@@ -645,6 +785,8 @@ process_fsetstat(void) | |||
645 | status = errno_to_portable(errno); | 785 | status = errno_to_portable(errno); |
646 | } | 786 | } |
647 | if (a->flags & SSH2_FILEXFER_ATTR_UIDGID) { | 787 | if (a->flags & SSH2_FILEXFER_ATTR_UIDGID) { |
788 | logit("set \"%s\" owner %lu group %lu", name, | ||
789 | (u_long)a->uid, (u_long)a->gid); | ||
648 | #ifdef HAVE_FCHOWN | 790 | #ifdef HAVE_FCHOWN |
649 | ret = fchown(fd, a->uid, a->gid); | 791 | ret = fchown(fd, a->uid, a->gid); |
650 | #else | 792 | #else |
@@ -667,7 +809,8 @@ process_opendir(void) | |||
667 | 809 | ||
668 | id = get_int(); | 810 | id = get_int(); |
669 | path = get_string(NULL); | 811 | path = get_string(NULL); |
670 | TRACE("opendir id %u path %s", id, path); | 812 | debug3("request %u: opendir", id); |
813 | logit("opendir \"%s\"", path); | ||
671 | dirp = opendir(path); | 814 | dirp = opendir(path); |
672 | if (dirp == NULL) { | 815 | if (dirp == NULL) { |
673 | status = errno_to_portable(errno); | 816 | status = errno_to_portable(errno); |
@@ -697,22 +840,23 @@ process_readdir(void) | |||
697 | 840 | ||
698 | id = get_int(); | 841 | id = get_int(); |
699 | handle = get_handle(); | 842 | handle = get_handle(); |
700 | TRACE("readdir id %u handle %d", id, handle); | 843 | debug("request %u: readdir \"%s\" (handle %d)", id, |
844 | handle_to_name(handle), handle); | ||
701 | dirp = handle_to_dir(handle); | 845 | dirp = handle_to_dir(handle); |
702 | path = handle_to_name(handle); | 846 | path = handle_to_name(handle); |
703 | if (dirp == NULL || path == NULL) { | 847 | if (dirp == NULL || path == NULL) { |
704 | send_status(id, SSH2_FX_FAILURE); | 848 | send_status(id, SSH2_FX_FAILURE); |
705 | } else { | 849 | } else { |
706 | struct stat st; | 850 | struct stat st; |
707 | char pathname[1024]; | 851 | char pathname[MAXPATHLEN]; |
708 | Stat *stats; | 852 | Stat *stats; |
709 | int nstats = 10, count = 0, i; | 853 | int nstats = 10, count = 0, i; |
710 | 854 | ||
711 | stats = xmalloc(nstats * sizeof(Stat)); | 855 | stats = xcalloc(nstats, sizeof(Stat)); |
712 | while ((dp = readdir(dirp)) != NULL) { | 856 | while ((dp = readdir(dirp)) != NULL) { |
713 | if (count >= nstats) { | 857 | if (count >= nstats) { |
714 | nstats *= 2; | 858 | nstats *= 2; |
715 | stats = xrealloc(stats, nstats * sizeof(Stat)); | 859 | stats = xrealloc(stats, nstats, sizeof(Stat)); |
716 | } | 860 | } |
717 | /* XXX OVERFLOW ? */ | 861 | /* XXX OVERFLOW ? */ |
718 | snprintf(pathname, sizeof pathname, "%s%s%s", path, | 862 | snprintf(pathname, sizeof pathname, "%s%s%s", path, |
@@ -751,7 +895,8 @@ process_remove(void) | |||
751 | 895 | ||
752 | id = get_int(); | 896 | id = get_int(); |
753 | name = get_string(NULL); | 897 | name = get_string(NULL); |
754 | TRACE("remove id %u name %s", id, name); | 898 | debug3("request %u: remove", id); |
899 | logit("remove name \"%s\"", name); | ||
755 | ret = unlink(name); | 900 | ret = unlink(name); |
756 | status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; | 901 | status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; |
757 | send_status(id, status); | 902 | send_status(id, status); |
@@ -771,7 +916,8 @@ process_mkdir(void) | |||
771 | a = get_attrib(); | 916 | a = get_attrib(); |
772 | mode = (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) ? | 917 | mode = (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) ? |
773 | a->perm & 0777 : 0777; | 918 | a->perm & 0777 : 0777; |
774 | TRACE("mkdir id %u name %s mode 0%o", id, name, mode); | 919 | debug3("request %u: mkdir", id); |
920 | logit("mkdir name \"%s\" mode 0%o", name, mode); | ||
775 | ret = mkdir(name, mode); | 921 | ret = mkdir(name, mode); |
776 | status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; | 922 | status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; |
777 | send_status(id, status); | 923 | send_status(id, status); |
@@ -787,7 +933,8 @@ process_rmdir(void) | |||
787 | 933 | ||
788 | id = get_int(); | 934 | id = get_int(); |
789 | name = get_string(NULL); | 935 | name = get_string(NULL); |
790 | TRACE("rmdir id %u name %s", id, name); | 936 | debug3("request %u: rmdir", id); |
937 | logit("rmdir name \"%s\"", name); | ||
791 | ret = rmdir(name); | 938 | ret = rmdir(name); |
792 | status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; | 939 | status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; |
793 | send_status(id, status); | 940 | send_status(id, status); |
@@ -807,7 +954,8 @@ process_realpath(void) | |||
807 | xfree(path); | 954 | xfree(path); |
808 | path = xstrdup("."); | 955 | path = xstrdup("."); |
809 | } | 956 | } |
810 | TRACE("realpath id %u path %s", id, path); | 957 | debug3("request %u: realpath", id); |
958 | verbose("realpath \"%s\"", path); | ||
811 | if (realpath(path, resolvedname) == NULL) { | 959 | if (realpath(path, resolvedname) == NULL) { |
812 | send_status(id, errno_to_portable(errno)); | 960 | send_status(id, errno_to_portable(errno)); |
813 | } else { | 961 | } else { |
@@ -830,7 +978,8 @@ process_rename(void) | |||
830 | id = get_int(); | 978 | id = get_int(); |
831 | oldpath = get_string(NULL); | 979 | oldpath = get_string(NULL); |
832 | newpath = get_string(NULL); | 980 | newpath = get_string(NULL); |
833 | TRACE("rename id %u old %s new %s", id, oldpath, newpath); | 981 | debug3("request %u: rename", id); |
982 | logit("rename old \"%s\" new \"%s\"", oldpath, newpath); | ||
834 | status = SSH2_FX_FAILURE; | 983 | status = SSH2_FX_FAILURE; |
835 | if (lstat(oldpath, &sb) == -1) | 984 | if (lstat(oldpath, &sb) == -1) |
836 | status = errno_to_portable(errno); | 985 | status = errno_to_portable(errno); |
@@ -885,7 +1034,8 @@ process_readlink(void) | |||
885 | 1034 | ||
886 | id = get_int(); | 1035 | id = get_int(); |
887 | path = get_string(NULL); | 1036 | path = get_string(NULL); |
888 | TRACE("readlink id %u path %s", id, path); | 1037 | debug3("request %u: readlink", id); |
1038 | verbose("readlink \"%s\"", path); | ||
889 | if ((len = readlink(path, buf, sizeof(buf) - 1)) == -1) | 1039 | if ((len = readlink(path, buf, sizeof(buf) - 1)) == -1) |
890 | send_status(id, errno_to_portable(errno)); | 1040 | send_status(id, errno_to_portable(errno)); |
891 | else { | 1041 | else { |
@@ -909,7 +1059,8 @@ process_symlink(void) | |||
909 | id = get_int(); | 1059 | id = get_int(); |
910 | oldpath = get_string(NULL); | 1060 | oldpath = get_string(NULL); |
911 | newpath = get_string(NULL); | 1061 | newpath = get_string(NULL); |
912 | TRACE("symlink id %u old %s new %s", id, oldpath, newpath); | 1062 | debug3("request %u: symlink", id); |
1063 | logit("symlink old \"%s\" new \"%s\"", oldpath, newpath); | ||
913 | /* this will fail if 'newpath' exists */ | 1064 | /* this will fail if 'newpath' exists */ |
914 | ret = symlink(oldpath, newpath); | 1065 | ret = symlink(oldpath, newpath); |
915 | status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; | 1066 | status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; |
@@ -945,10 +1096,11 @@ process(void) | |||
945 | if (buf_len < 5) | 1096 | if (buf_len < 5) |
946 | return; /* Incomplete message. */ | 1097 | return; /* Incomplete message. */ |
947 | cp = buffer_ptr(&iqueue); | 1098 | cp = buffer_ptr(&iqueue); |
948 | msg_len = GET_32BIT(cp); | 1099 | msg_len = get_u32(cp); |
949 | if (msg_len > SFTP_MAX_MSG_LENGTH) { | 1100 | if (msg_len > SFTP_MAX_MSG_LENGTH) { |
950 | error("bad message "); | 1101 | error("bad message from %s local user %s", |
951 | exit(11); | 1102 | client_addr, pw->pw_name); |
1103 | cleanup_exit(11); | ||
952 | } | 1104 | } |
953 | if (buf_len < msg_len + 4) | 1105 | if (buf_len < msg_len + 4) |
954 | return; | 1106 | return; |
@@ -1022,7 +1174,7 @@ process(void) | |||
1022 | } | 1174 | } |
1023 | /* discard the remaining bytes from the current packet */ | 1175 | /* discard the remaining bytes from the current packet */ |
1024 | if (buf_len < buffer_len(&iqueue)) | 1176 | if (buf_len < buffer_len(&iqueue)) |
1025 | fatal("iqueue grows"); | 1177 | fatal("iqueue grew unexpectedly"); |
1026 | consumed = buf_len - buffer_len(&iqueue); | 1178 | consumed = buf_len - buffer_len(&iqueue); |
1027 | if (msg_len < consumed) | 1179 | if (msg_len < consumed) |
1028 | fatal("msg_len %d < consumed %d", msg_len, consumed); | 1180 | fatal("msg_len %d < consumed %d", msg_len, consumed); |
@@ -1030,24 +1182,93 @@ process(void) | |||
1030 | buffer_consume(&iqueue, msg_len - consumed); | 1182 | buffer_consume(&iqueue, msg_len - consumed); |
1031 | } | 1183 | } |
1032 | 1184 | ||
1185 | /* Cleanup handler that logs active handles upon normal exit */ | ||
1186 | void | ||
1187 | cleanup_exit(int i) | ||
1188 | { | ||
1189 | if (pw != NULL && client_addr != NULL) { | ||
1190 | handle_log_exit(); | ||
1191 | logit("session closed for local user %s from [%s]", | ||
1192 | pw->pw_name, client_addr); | ||
1193 | } | ||
1194 | _exit(i); | ||
1195 | } | ||
1196 | |||
1197 | static void | ||
1198 | usage(void) | ||
1199 | { | ||
1200 | extern char *__progname; | ||
1201 | |||
1202 | fprintf(stderr, | ||
1203 | "usage: %s [-he] [-l log_level] [-f log_facility]\n", __progname); | ||
1204 | exit(1); | ||
1205 | } | ||
1206 | |||
1033 | int | 1207 | int |
1034 | main(int ac, char **av) | 1208 | main(int argc, char **argv) |
1035 | { | 1209 | { |
1036 | fd_set *rset, *wset; | 1210 | fd_set *rset, *wset; |
1037 | int in, out, max; | 1211 | int in, out, max, ch, skipargs = 0, log_stderr = 0; |
1038 | ssize_t len, olen, set_size; | 1212 | ssize_t len, olen, set_size; |
1213 | SyslogFacility log_facility = SYSLOG_FACILITY_AUTH; | ||
1214 | char *cp; | ||
1215 | |||
1216 | extern char *optarg; | ||
1217 | extern char *__progname; | ||
1039 | 1218 | ||
1040 | /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ | 1219 | /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ |
1041 | sanitise_stdfd(); | 1220 | sanitise_stdfd(); |
1042 | 1221 | ||
1043 | /* XXX should use getopt */ | 1222 | __progname = ssh_get_progname(argv[0]); |
1223 | log_init(__progname, log_level, log_facility, log_stderr); | ||
1224 | |||
1225 | while (!skipargs && (ch = getopt(argc, argv, "C:f:l:che")) != -1) { | ||
1226 | switch (ch) { | ||
1227 | case 'c': | ||
1228 | /* | ||
1229 | * Ignore all arguments if we are invoked as a | ||
1230 | * shell using "sftp-server -c command" | ||
1231 | */ | ||
1232 | skipargs = 1; | ||
1233 | break; | ||
1234 | case 'e': | ||
1235 | log_stderr = 1; | ||
1236 | break; | ||
1237 | case 'l': | ||
1238 | log_level = log_level_number(optarg); | ||
1239 | if (log_level == SYSLOG_LEVEL_NOT_SET) | ||
1240 | error("Invalid log level \"%s\"", optarg); | ||
1241 | break; | ||
1242 | case 'f': | ||
1243 | log_facility = log_facility_number(optarg); | ||
1244 | if (log_level == SYSLOG_FACILITY_NOT_SET) | ||
1245 | error("Invalid log facility \"%s\"", optarg); | ||
1246 | break; | ||
1247 | case 'h': | ||
1248 | default: | ||
1249 | usage(); | ||
1250 | } | ||
1251 | } | ||
1044 | 1252 | ||
1045 | __progname = ssh_get_progname(av[0]); | 1253 | log_init(__progname, log_level, log_facility, log_stderr); |
1046 | handle_init(); | ||
1047 | 1254 | ||
1048 | #ifdef DEBUG_SFTP_SERVER | 1255 | if ((cp = getenv("SSH_CONNECTION")) != NULL) { |
1049 | log_init("sftp-server", SYSLOG_LEVEL_DEBUG1, SYSLOG_FACILITY_AUTH, 0); | 1256 | client_addr = xstrdup(cp); |
1050 | #endif | 1257 | if ((cp = strchr(client_addr, ' ')) == NULL) |
1258 | fatal("Malformed SSH_CONNECTION variable: \"%s\"", | ||
1259 | getenv("SSH_CONNECTION")); | ||
1260 | *cp = '\0'; | ||
1261 | } else | ||
1262 | client_addr = xstrdup("UNKNOWN"); | ||
1263 | |||
1264 | if ((pw = getpwuid(getuid())) == NULL) | ||
1265 | fatal("No user found for uid %lu", (u_long)getuid()); | ||
1266 | pw = pwcopy(pw); | ||
1267 | |||
1268 | logit("session opened for local user %s from [%s]", | ||
1269 | pw->pw_name, client_addr); | ||
1270 | |||
1271 | handle_init(); | ||
1051 | 1272 | ||
1052 | in = dup(STDIN_FILENO); | 1273 | in = dup(STDIN_FILENO); |
1053 | out = dup(STDOUT_FILENO); | 1274 | out = dup(STDOUT_FILENO); |
@@ -1082,7 +1303,8 @@ main(int ac, char **av) | |||
1082 | if (select(max+1, rset, wset, NULL, NULL) < 0) { | 1303 | if (select(max+1, rset, wset, NULL, NULL) < 0) { |
1083 | if (errno == EINTR) | 1304 | if (errno == EINTR) |
1084 | continue; | 1305 | continue; |
1085 | exit(2); | 1306 | error("select: %s", strerror(errno)); |
1307 | cleanup_exit(2); | ||
1086 | } | 1308 | } |
1087 | 1309 | ||
1088 | /* copy stdin to iqueue */ | 1310 | /* copy stdin to iqueue */ |
@@ -1091,10 +1313,10 @@ main(int ac, char **av) | |||
1091 | len = read(in, buf, sizeof buf); | 1313 | len = read(in, buf, sizeof buf); |
1092 | if (len == 0) { | 1314 | if (len == 0) { |
1093 | debug("read eof"); | 1315 | debug("read eof"); |
1094 | exit(0); | 1316 | cleanup_exit(0); |
1095 | } else if (len < 0) { | 1317 | } else if (len < 0) { |
1096 | error("read error"); | 1318 | error("read: %s", strerror(errno)); |
1097 | exit(1); | 1319 | cleanup_exit(1); |
1098 | } else { | 1320 | } else { |
1099 | buffer_append(&iqueue, buf, len); | 1321 | buffer_append(&iqueue, buf, len); |
1100 | } | 1322 | } |
@@ -1103,8 +1325,8 @@ main(int ac, char **av) | |||
1103 | if (FD_ISSET(out, wset)) { | 1325 | if (FD_ISSET(out, wset)) { |
1104 | len = write(out, buffer_ptr(&oqueue), olen); | 1326 | len = write(out, buffer_ptr(&oqueue), olen); |
1105 | if (len < 0) { | 1327 | if (len < 0) { |
1106 | error("write error"); | 1328 | error("write: %s", strerror(errno)); |
1107 | exit(1); | 1329 | cleanup_exit(1); |
1108 | } else { | 1330 | } else { |
1109 | buffer_consume(&oqueue, len); | 1331 | buffer_consume(&oqueue, len); |
1110 | } | 1332 | } |
@@ -263,4 +263,4 @@ SEE ALSO | |||
263 | T. Ylonen and S. Lehtinen, SSH File Transfer Protocol, draft-ietf-secsh- | 263 | T. Ylonen and S. Lehtinen, SSH File Transfer Protocol, draft-ietf-secsh- |
264 | filexfer-00.txt, January 2001, work in progress material. | 264 | filexfer-00.txt, January 2001, work in progress material. |
265 | 265 | ||
266 | OpenBSD 3.9 February 4, 2001 4 | 266 | OpenBSD 4.1 February 4, 2001 4 |
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: sftp.c,v 1.96 2007/01/03 04:09:15 stevesk Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> | 3 | * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> |
3 | * | 4 | * |
@@ -16,21 +17,39 @@ | |||
16 | 17 | ||
17 | #include "includes.h" | 18 | #include "includes.h" |
18 | 19 | ||
19 | RCSID("$OpenBSD: sftp.c,v 1.70 2006/01/31 10:19:02 djm Exp $"); | 20 | #include <sys/types.h> |
21 | #include <sys/ioctl.h> | ||
22 | #ifdef HAVE_SYS_STAT_H | ||
23 | # include <sys/stat.h> | ||
24 | #endif | ||
25 | #include <sys/param.h> | ||
26 | #include <sys/socket.h> | ||
27 | #include <sys/wait.h> | ||
28 | |||
29 | #include <errno.h> | ||
20 | 30 | ||
31 | #ifdef HAVE_PATHS_H | ||
32 | # include <paths.h> | ||
33 | #endif | ||
21 | #ifdef USE_LIBEDIT | 34 | #ifdef USE_LIBEDIT |
22 | #include <histedit.h> | 35 | #include <histedit.h> |
23 | #else | 36 | #else |
24 | typedef void EditLine; | 37 | typedef void EditLine; |
25 | #endif | 38 | #endif |
39 | #include <signal.h> | ||
40 | #include <stdlib.h> | ||
41 | #include <stdio.h> | ||
42 | #include <string.h> | ||
43 | #include <unistd.h> | ||
44 | #include <stdarg.h> | ||
26 | 45 | ||
27 | #include "buffer.h" | ||
28 | #include "xmalloc.h" | 46 | #include "xmalloc.h" |
29 | #include "log.h" | 47 | #include "log.h" |
30 | #include "pathnames.h" | 48 | #include "pathnames.h" |
31 | #include "misc.h" | 49 | #include "misc.h" |
32 | 50 | ||
33 | #include "sftp.h" | 51 | #include "sftp.h" |
52 | #include "buffer.h" | ||
34 | #include "sftp-common.h" | 53 | #include "sftp-common.h" |
35 | #include "sftp-client.h" | 54 | #include "sftp-client.h" |
36 | 55 | ||
@@ -147,6 +166,7 @@ static const struct CMD cmds[] = { | |||
147 | 166 | ||
148 | int interactive_loop(int fd_in, int fd_out, char *file1, char *file2); | 167 | int interactive_loop(int fd_in, int fd_out, char *file1, char *file2); |
149 | 168 | ||
169 | /* ARGSUSED */ | ||
150 | static void | 170 | static void |
151 | killchild(int signo) | 171 | killchild(int signo) |
152 | { | 172 | { |
@@ -158,6 +178,7 @@ killchild(int signo) | |||
158 | _exit(1); | 178 | _exit(1); |
159 | } | 179 | } |
160 | 180 | ||
181 | /* ARGSUSED */ | ||
161 | static void | 182 | static void |
162 | cmd_interrupt(int signo) | 183 | cmd_interrupt(int signo) |
163 | { | 184 | { |
@@ -235,7 +256,7 @@ local_do_shell(const char *args) | |||
235 | if (errno != EINTR) | 256 | if (errno != EINTR) |
236 | fatal("Couldn't wait for child: %s", strerror(errno)); | 257 | fatal("Couldn't wait for child: %s", strerror(errno)); |
237 | if (!WIFEXITED(status)) | 258 | if (!WIFEXITED(status)) |
238 | error("Shell exited abormally"); | 259 | error("Shell exited abnormally"); |
239 | else if (WEXITSTATUS(status)) | 260 | else if (WEXITSTATUS(status)) |
240 | error("Shell exited with status %d", WEXITSTATUS(status)); | 261 | error("Shell exited with status %d", WEXITSTATUS(status)); |
241 | } | 262 | } |
@@ -279,11 +300,11 @@ static char * | |||
279 | path_append(char *p1, char *p2) | 300 | path_append(char *p1, char *p2) |
280 | { | 301 | { |
281 | char *ret; | 302 | char *ret; |
282 | int len = strlen(p1) + strlen(p2) + 2; | 303 | size_t len = strlen(p1) + strlen(p2) + 2; |
283 | 304 | ||
284 | ret = xmalloc(len); | 305 | ret = xmalloc(len); |
285 | strlcpy(ret, p1, len); | 306 | strlcpy(ret, p1, len); |
286 | if (p1[strlen(p1) - 1] != '/') | 307 | if (p1[0] != '\0' && p1[strlen(p1) - 1] != '/') |
287 | strlcat(ret, "/", len); | 308 | strlcat(ret, "/", len); |
288 | strlcat(ret, p2, len); | 309 | strlcat(ret, p2, len); |
289 | 310 | ||
@@ -474,7 +495,7 @@ is_dir(char *path) | |||
474 | if (stat(path, &sb) == -1) | 495 | if (stat(path, &sb) == -1) |
475 | return(0); | 496 | return(0); |
476 | 497 | ||
477 | return(sb.st_mode & S_IFDIR); | 498 | return(S_ISDIR(sb.st_mode)); |
478 | } | 499 | } |
479 | 500 | ||
480 | static int | 501 | static int |
@@ -498,7 +519,7 @@ remote_is_dir(struct sftp_conn *conn, char *path) | |||
498 | return(0); | 519 | return(0); |
499 | if (!(a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS)) | 520 | if (!(a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS)) |
500 | return(0); | 521 | return(0); |
501 | return(a->perm & S_IFDIR); | 522 | return(S_ISDIR(a->perm)); |
502 | } | 523 | } |
503 | 524 | ||
504 | static int | 525 | static int |
@@ -538,6 +559,7 @@ process_get(struct sftp_conn *conn, char *src, char *dst, char *pwd, int pflag) | |||
538 | 559 | ||
539 | if (g.gl_matchc == 1 && dst) { | 560 | if (g.gl_matchc == 1 && dst) { |
540 | /* If directory specified, append filename */ | 561 | /* If directory specified, append filename */ |
562 | xfree(tmp); | ||
541 | if (is_dir(dst)) { | 563 | if (is_dir(dst)) { |
542 | if (infer_path(g.gl_pathv[0], &tmp)) { | 564 | if (infer_path(g.gl_pathv[0], &tmp)) { |
543 | err = 1; | 565 | err = 1; |
@@ -562,8 +584,6 @@ process_get(struct sftp_conn *conn, char *src, char *dst, char *pwd, int pflag) | |||
562 | 584 | ||
563 | out: | 585 | out: |
564 | xfree(abs_src); | 586 | xfree(abs_src); |
565 | if (abs_dst) | ||
566 | xfree(abs_dst); | ||
567 | globfree(&g); | 587 | globfree(&g); |
568 | return(err); | 588 | return(err); |
569 | } | 589 | } |
@@ -959,6 +979,7 @@ parse_args(const char **cpp, int *pflag, int *lflag, int *iflag, | |||
959 | case I_CHOWN: | 979 | case I_CHOWN: |
960 | case I_CHGRP: | 980 | case I_CHGRP: |
961 | /* Get numeric arg (mandatory) */ | 981 | /* Get numeric arg (mandatory) */ |
982 | errno = 0; | ||
962 | l = strtol(cp, &cp2, base); | 983 | l = strtol(cp, &cp2, base); |
963 | if (cp2 == cp || ((l == LONG_MIN || l == LONG_MAX) && | 984 | if (cp2 == cp || ((l == LONG_MIN || l == LONG_MAX) && |
964 | errno == ERANGE) || l < 0) { | 985 | errno == ERANGE) || l < 0) { |
@@ -1280,6 +1301,7 @@ interactive_loop(int fd_in, int fd_out, char *file1, char *file2) | |||
1280 | if (parse_dispatch_command(conn, cmd, &pwd, 1) != 0) { | 1301 | if (parse_dispatch_command(conn, cmd, &pwd, 1) != 0) { |
1281 | xfree(dir); | 1302 | xfree(dir); |
1282 | xfree(pwd); | 1303 | xfree(pwd); |
1304 | xfree(conn); | ||
1283 | return (-1); | 1305 | return (-1); |
1284 | } | 1306 | } |
1285 | } else { | 1307 | } else { |
@@ -1292,6 +1314,7 @@ interactive_loop(int fd_in, int fd_out, char *file1, char *file2) | |||
1292 | err = parse_dispatch_command(conn, cmd, &pwd, 1); | 1314 | err = parse_dispatch_command(conn, cmd, &pwd, 1); |
1293 | xfree(dir); | 1315 | xfree(dir); |
1294 | xfree(pwd); | 1316 | xfree(pwd); |
1317 | xfree(conn); | ||
1295 | return (err); | 1318 | return (err); |
1296 | } | 1319 | } |
1297 | xfree(dir); | 1320 | xfree(dir); |
@@ -1356,6 +1379,7 @@ interactive_loop(int fd_in, int fd_out, char *file1, char *file2) | |||
1356 | break; | 1379 | break; |
1357 | } | 1380 | } |
1358 | xfree(pwd); | 1381 | xfree(pwd); |
1382 | xfree(conn); | ||
1359 | 1383 | ||
1360 | #ifdef USE_LIBEDIT | 1384 | #ifdef USE_LIBEDIT |
1361 | if (el != NULL) | 1385 | if (el != NULL) |
@@ -1455,7 +1479,7 @@ main(int argc, char **argv) | |||
1455 | __progname = ssh_get_progname(argv[0]); | 1479 | __progname = ssh_get_progname(argv[0]); |
1456 | memset(&args, '\0', sizeof(args)); | 1480 | memset(&args, '\0', sizeof(args)); |
1457 | args.list = NULL; | 1481 | args.list = NULL; |
1458 | addargs(&args, ssh_program); | 1482 | addargs(&args, "%s", ssh_program); |
1459 | addargs(&args, "-oForwardX11 no"); | 1483 | addargs(&args, "-oForwardX11 no"); |
1460 | addargs(&args, "-oForwardAgent no"); | 1484 | addargs(&args, "-oForwardAgent no"); |
1461 | addargs(&args, "-oPermitLocalCommand no"); | 1485 | addargs(&args, "-oPermitLocalCommand no"); |
@@ -1544,7 +1568,7 @@ main(int argc, char **argv) | |||
1544 | fprintf(stderr, "Missing username\n"); | 1568 | fprintf(stderr, "Missing username\n"); |
1545 | usage(); | 1569 | usage(); |
1546 | } | 1570 | } |
1547 | addargs(&args, "-l%s",userhost); | 1571 | addargs(&args, "-l%s", userhost); |
1548 | } | 1572 | } |
1549 | 1573 | ||
1550 | if ((cp = colon(host)) != NULL) { | 1574 | if ((cp = colon(host)) != NULL) { |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sftp.h,v 1.4 2002/02/13 00:59:23 djm Exp $ */ | 1 | /* $OpenBSD: sftp.h,v 1.5 2006/03/25 22:22:43 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
@@ -99,4 +99,4 @@ AUTHORS | |||
99 | ated OpenSSH. Markus Friedl contributed the support for SSH protocol | 99 | ated OpenSSH. Markus Friedl contributed the support for SSH protocol |
100 | versions 1.5 and 2.0. | 100 | versions 1.5 and 2.0. |
101 | 101 | ||
102 | OpenBSD 3.9 September 25, 1999 2 | 102 | OpenBSD 4.1 September 25, 1999 2 |
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-add.c,v 1.89 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -35,15 +36,27 @@ | |||
35 | */ | 36 | */ |
36 | 37 | ||
37 | #include "includes.h" | 38 | #include "includes.h" |
38 | RCSID("$OpenBSD: ssh-add.c,v 1.74 2005/11/12 18:37:59 deraadt Exp $"); | 39 | |
40 | #include <sys/types.h> | ||
41 | #include <sys/stat.h> | ||
42 | #include <sys/param.h> | ||
39 | 43 | ||
40 | #include <openssl/evp.h> | 44 | #include <openssl/evp.h> |
41 | 45 | ||
46 | #include <fcntl.h> | ||
47 | #include <pwd.h> | ||
48 | #include <stdarg.h> | ||
49 | #include <stdio.h> | ||
50 | #include <stdlib.h> | ||
51 | #include <string.h> | ||
52 | #include <unistd.h> | ||
53 | |||
54 | #include "xmalloc.h" | ||
42 | #include "ssh.h" | 55 | #include "ssh.h" |
43 | #include "rsa.h" | 56 | #include "rsa.h" |
44 | #include "log.h" | 57 | #include "log.h" |
45 | #include "xmalloc.h" | ||
46 | #include "key.h" | 58 | #include "key.h" |
59 | #include "buffer.h" | ||
47 | #include "authfd.h" | 60 | #include "authfd.h" |
48 | #include "authfile.h" | 61 | #include "authfile.h" |
49 | #include "pathnames.h" | 62 | #include "pathnames.h" |
@@ -124,16 +137,25 @@ delete_all(AuthenticationConnection *ac) | |||
124 | static int | 137 | static int |
125 | add_file(AuthenticationConnection *ac, const char *filename) | 138 | add_file(AuthenticationConnection *ac, const char *filename) |
126 | { | 139 | { |
127 | struct stat st; | ||
128 | Key *private; | 140 | Key *private; |
129 | char *comment = NULL; | 141 | char *comment = NULL; |
130 | char msg[1024]; | 142 | char msg[1024]; |
131 | int ret = -1; | 143 | int fd, perms_ok, ret = -1; |
132 | 144 | ||
133 | if (stat(filename, &st) < 0) { | 145 | if ((fd = open(filename, O_RDONLY)) < 0) { |
134 | perror(filename); | 146 | perror(filename); |
135 | return -1; | 147 | return -1; |
136 | } | 148 | } |
149 | |||
150 | /* | ||
151 | * Since we'll try to load a keyfile multiple times, permission errors | ||
152 | * will occur multiple times, so check perms first and bail if wrong. | ||
153 | */ | ||
154 | perms_ok = key_perm_ok(fd, filename); | ||
155 | close(fd); | ||
156 | if (!perms_ok) | ||
157 | return -1; | ||
158 | |||
137 | /* At first, try empty passphrase */ | 159 | /* At first, try empty passphrase */ |
138 | private = key_load_private(filename, "", &comment); | 160 | private = key_load_private(filename, "", &comment); |
139 | if (comment == NULL) | 161 | if (comment == NULL) |
@@ -287,7 +309,7 @@ do_file(AuthenticationConnection *ac, int deleting, char *file) | |||
287 | static void | 309 | static void |
288 | usage(void) | 310 | usage(void) |
289 | { | 311 | { |
290 | fprintf(stderr, "Usage: %s [options]\n", __progname); | 312 | fprintf(stderr, "Usage: %s [options] [file ...]\n", __progname); |
291 | fprintf(stderr, "Options:\n"); | 313 | fprintf(stderr, "Options:\n"); |
292 | fprintf(stderr, " -l List fingerprints of all identities.\n"); | 314 | fprintf(stderr, " -l List fingerprints of all identities.\n"); |
293 | fprintf(stderr, " -L List public key parameters of all identities.\n"); | 315 | fprintf(stderr, " -L List public key parameters of all identities.\n"); |
@@ -335,13 +357,11 @@ main(int argc, char **argv) | |||
335 | if (list_identities(ac, ch == 'l' ? 1 : 0) == -1) | 357 | if (list_identities(ac, ch == 'l' ? 1 : 0) == -1) |
336 | ret = 1; | 358 | ret = 1; |
337 | goto done; | 359 | goto done; |
338 | break; | ||
339 | case 'x': | 360 | case 'x': |
340 | case 'X': | 361 | case 'X': |
341 | if (lock_agent(ac, ch == 'x' ? 1 : 0) == -1) | 362 | if (lock_agent(ac, ch == 'x' ? 1 : 0) == -1) |
342 | ret = 1; | 363 | ret = 1; |
343 | goto done; | 364 | goto done; |
344 | break; | ||
345 | case 'c': | 365 | case 'c': |
346 | confirm = 1; | 366 | confirm = 1; |
347 | break; | 367 | break; |
@@ -352,7 +372,6 @@ main(int argc, char **argv) | |||
352 | if (delete_all(ac) == -1) | 372 | if (delete_all(ac) == -1) |
353 | ret = 1; | 373 | ret = 1; |
354 | goto done; | 374 | goto done; |
355 | break; | ||
356 | case 's': | 375 | case 's': |
357 | sc_reader_id = optarg; | 376 | sc_reader_id = optarg; |
358 | break; | 377 | break; |
diff --git a/ssh-agent.0 b/ssh-agent.0 index 7d64d550f..f3f52b67d 100644 --- a/ssh-agent.0 +++ b/ssh-agent.0 | |||
@@ -114,4 +114,4 @@ AUTHORS | |||
114 | ated OpenSSH. Markus Friedl contributed the support for SSH protocol | 114 | ated OpenSSH. Markus Friedl contributed the support for SSH protocol |
115 | versions 1.5 and 2.0. | 115 | versions 1.5 and 2.0. |
116 | 116 | ||
117 | OpenBSD 3.9 September 25, 1999 2 | 117 | OpenBSD 4.1 September 25, 1999 2 |
diff --git a/ssh-agent.1 b/ssh-agent.1 index fd6bd3f6c..f1b877790 100644 --- a/ssh-agent.1 +++ b/ssh-agent.1 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: ssh-agent.1,v 1.43 2005/11/28 06:02:56 dtucker Exp $ | 1 | .\" $OpenBSD: ssh-agent.1,v 1.44 2006/07/18 08:03:09 jmc Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | .\" Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | .\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | .\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -70,7 +70,7 @@ The options are as follows: | |||
70 | Bind the agent to the unix-domain socket | 70 | Bind the agent to the unix-domain socket |
71 | .Ar bind_address . | 71 | .Ar bind_address . |
72 | The default is | 72 | The default is |
73 | .Pa /tmp/ssh-XXXXXXXXXX/agent.<ppid> . | 73 | .Pa /tmp/ssh-XXXXXXXXXX/agent.\*(Ltppid\*(Gt . |
74 | .It Fl c | 74 | .It Fl c |
75 | Generate C-shell commands on | 75 | Generate C-shell commands on |
76 | .Dv stdout . | 76 | .Dv stdout . |
@@ -185,7 +185,7 @@ Contains the protocol version 1 RSA authentication identity of the user. | |||
185 | Contains the protocol version 2 DSA authentication identity of the user. | 185 | Contains the protocol version 2 DSA authentication identity of the user. |
186 | .It Pa ~/.ssh/id_rsa | 186 | .It Pa ~/.ssh/id_rsa |
187 | Contains the protocol version 2 RSA authentication identity of the user. | 187 | Contains the protocol version 2 RSA authentication identity of the user. |
188 | .It Pa /tmp/ssh-XXXXXXXXXX/agent.<ppid> | 188 | .It Pa /tmp/ssh-XXXXXXXXXX/agent.\*(Ltppid\*(Gt |
189 | Unix-domain sockets used to contain the connection to the | 189 | Unix-domain sockets used to contain the connection to the |
190 | authentication agent. | 190 | authentication agent. |
191 | These sockets should only be readable by the owner. | 191 | These sockets should only be readable by the owner. |
diff --git a/ssh-agent.c b/ssh-agent.c index a69c25eec..a3a867c33 100644 --- a/ssh-agent.c +++ b/ssh-agent.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-agent.c,v 1.154 2007/02/28 00:55:30 dtucker Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -34,18 +35,40 @@ | |||
34 | */ | 35 | */ |
35 | 36 | ||
36 | #include "includes.h" | 37 | #include "includes.h" |
38 | |||
39 | #include <sys/types.h> | ||
40 | #include <sys/param.h> | ||
41 | #include <sys/resource.h> | ||
42 | #include <sys/stat.h> | ||
43 | #include <sys/socket.h> | ||
44 | #ifdef HAVE_SYS_TIME_H | ||
45 | # include <sys/time.h> | ||
46 | #endif | ||
47 | #ifdef HAVE_SYS_UN_H | ||
48 | # include <sys/un.h> | ||
49 | #endif | ||
37 | #include "openbsd-compat/sys-queue.h" | 50 | #include "openbsd-compat/sys-queue.h" |
38 | RCSID("$OpenBSD: ssh-agent.c,v 1.124 2005/10/30 08:52:18 djm Exp $"); | ||
39 | 51 | ||
40 | #include <openssl/evp.h> | 52 | #include <openssl/evp.h> |
41 | #include <openssl/md5.h> | 53 | #include <openssl/md5.h> |
42 | 54 | ||
55 | #include <errno.h> | ||
56 | #include <fcntl.h> | ||
57 | #ifdef HAVE_PATHS_H | ||
58 | # include <paths.h> | ||
59 | #endif | ||
60 | #include <signal.h> | ||
61 | #include <stdarg.h> | ||
62 | #include <stdio.h> | ||
63 | #include <stdlib.h> | ||
64 | #include <time.h> | ||
65 | #include <string.h> | ||
66 | #include <unistd.h> | ||
67 | |||
68 | #include "xmalloc.h" | ||
43 | #include "ssh.h" | 69 | #include "ssh.h" |
44 | #include "rsa.h" | 70 | #include "rsa.h" |
45 | #include "buffer.h" | 71 | #include "buffer.h" |
46 | #include "bufaux.h" | ||
47 | #include "xmalloc.h" | ||
48 | #include "getput.h" | ||
49 | #include "key.h" | 72 | #include "key.h" |
50 | #include "authfd.h" | 73 | #include "authfd.h" |
51 | #include "compat.h" | 74 | #include "compat.h" |
@@ -99,8 +122,8 @@ int max_fd = 0; | |||
99 | pid_t parent_pid = -1; | 122 | pid_t parent_pid = -1; |
100 | 123 | ||
101 | /* pathname and directory for AUTH_SOCKET */ | 124 | /* pathname and directory for AUTH_SOCKET */ |
102 | char socket_name[1024]; | 125 | char socket_name[MAXPATHLEN]; |
103 | char socket_dir[1024]; | 126 | char socket_dir[MAXPATHLEN]; |
104 | 127 | ||
105 | /* locking */ | 128 | /* locking */ |
106 | int locked = 0; | 129 | int locked = 0; |
@@ -305,8 +328,8 @@ process_sign_request2(SocketEntry *e) | |||
305 | Identity *id = lookup_identity(key, 2); | 328 | Identity *id = lookup_identity(key, 2); |
306 | if (id != NULL && (!id->confirm || confirm_key(id) == 0)) | 329 | if (id != NULL && (!id->confirm || confirm_key(id) == 0)) |
307 | ok = key_sign(id->key, &signature, &slen, data, dlen); | 330 | ok = key_sign(id->key, &signature, &slen, data, dlen); |
331 | key_free(key); | ||
308 | } | 332 | } |
309 | key_free(key); | ||
310 | buffer_init(&msg); | 333 | buffer_init(&msg); |
311 | if (ok == 0) { | 334 | if (ok == 0) { |
312 | buffer_put_char(&msg, SSH2_AGENT_SIGN_RESPONSE); | 335 | buffer_put_char(&msg, SSH2_AGENT_SIGN_RESPONSE); |
@@ -411,6 +434,7 @@ reaper(void) | |||
411 | for (id = TAILQ_FIRST(&tab->idlist); id; id = nxt) { | 434 | for (id = TAILQ_FIRST(&tab->idlist); id; id = nxt) { |
412 | nxt = TAILQ_NEXT(id, next); | 435 | nxt = TAILQ_NEXT(id, next); |
413 | if (id->death != 0 && now >= id->death) { | 436 | if (id->death != 0 && now >= id->death) { |
437 | debug("expiring key '%s'", id->comment); | ||
414 | TAILQ_REMOVE(&tab->idlist, id, next); | 438 | TAILQ_REMOVE(&tab->idlist, id, next); |
415 | free_identity(id); | 439 | free_identity(id); |
416 | tab->nentries--; | 440 | tab->nentries--; |
@@ -675,13 +699,10 @@ process_message(SocketEntry *e) | |||
675 | u_int msg_len, type; | 699 | u_int msg_len, type; |
676 | u_char *cp; | 700 | u_char *cp; |
677 | 701 | ||
678 | /* kill dead keys */ | ||
679 | reaper(); | ||
680 | |||
681 | if (buffer_len(&e->input) < 5) | 702 | if (buffer_len(&e->input) < 5) |
682 | return; /* Incomplete message. */ | 703 | return; /* Incomplete message. */ |
683 | cp = buffer_ptr(&e->input); | 704 | cp = buffer_ptr(&e->input); |
684 | msg_len = GET_32BIT(cp); | 705 | msg_len = get_u32(cp); |
685 | if (msg_len > 256 * 1024) { | 706 | if (msg_len > 256 * 1024) { |
686 | close_socket(e); | 707 | close_socket(e); |
687 | return; | 708 | return; |
@@ -793,10 +814,7 @@ new_socket(sock_type type, int fd) | |||
793 | } | 814 | } |
794 | old_alloc = sockets_alloc; | 815 | old_alloc = sockets_alloc; |
795 | new_alloc = sockets_alloc + 10; | 816 | new_alloc = sockets_alloc + 10; |
796 | if (sockets) | 817 | sockets = xrealloc(sockets, new_alloc, sizeof(sockets[0])); |
797 | sockets = xrealloc(sockets, new_alloc * sizeof(sockets[0])); | ||
798 | else | ||
799 | sockets = xmalloc(new_alloc * sizeof(sockets[0])); | ||
800 | for (i = old_alloc; i < new_alloc; i++) | 818 | for (i = old_alloc; i < new_alloc; i++) |
801 | sockets[i].type = AUTH_UNUSED; | 819 | sockets[i].type = AUTH_UNUSED; |
802 | sockets_alloc = new_alloc; | 820 | sockets_alloc = new_alloc; |
@@ -877,7 +895,7 @@ after_select(fd_set *readset, fd_set *writeset) | |||
877 | if (FD_ISSET(sockets[i].fd, readset)) { | 895 | if (FD_ISSET(sockets[i].fd, readset)) { |
878 | slen = sizeof(sunaddr); | 896 | slen = sizeof(sunaddr); |
879 | sock = accept(sockets[i].fd, | 897 | sock = accept(sockets[i].fd, |
880 | (struct sockaddr *) &sunaddr, &slen); | 898 | (struct sockaddr *)&sunaddr, &slen); |
881 | if (sock < 0) { | 899 | if (sock < 0) { |
882 | error("accept from AUTH_SOCKET: %s", | 900 | error("accept from AUTH_SOCKET: %s", |
883 | strerror(errno)); | 901 | strerror(errno)); |
@@ -954,6 +972,7 @@ cleanup_exit(int i) | |||
954 | _exit(i); | 972 | _exit(i); |
955 | } | 973 | } |
956 | 974 | ||
975 | /*ARGSUSED*/ | ||
957 | static void | 976 | static void |
958 | cleanup_handler(int sig) | 977 | cleanup_handler(int sig) |
959 | { | 978 | { |
@@ -961,6 +980,7 @@ cleanup_handler(int sig) | |||
961 | _exit(2); | 980 | _exit(2); |
962 | } | 981 | } |
963 | 982 | ||
983 | /*ARGSUSED*/ | ||
964 | static void | 984 | static void |
965 | check_parent_exists(int sig) | 985 | check_parent_exists(int sig) |
966 | { | 986 | { |
@@ -994,7 +1014,7 @@ int | |||
994 | main(int ac, char **av) | 1014 | main(int ac, char **av) |
995 | { | 1015 | { |
996 | int c_flag = 0, d_flag = 0, k_flag = 0, s_flag = 0; | 1016 | int c_flag = 0, d_flag = 0, k_flag = 0, s_flag = 0; |
997 | int sock, fd, ch; | 1017 | int sock, fd, ch, result, saved_errno; |
998 | u_int nalloc; | 1018 | u_int nalloc; |
999 | char *shell, *format, *pidstr, *agentsocket = NULL; | 1019 | char *shell, *format, *pidstr, *agentsocket = NULL; |
1000 | fd_set *readsetp = NULL, *writesetp = NULL; | 1020 | fd_set *readsetp = NULL, *writesetp = NULL; |
@@ -1007,6 +1027,7 @@ main(int ac, char **av) | |||
1007 | extern char *optarg; | 1027 | extern char *optarg; |
1008 | pid_t pid; | 1028 | pid_t pid; |
1009 | char pidstrbuf[1 + 3 * sizeof pid]; | 1029 | char pidstrbuf[1 + 3 * sizeof pid]; |
1030 | struct timeval tv; | ||
1010 | 1031 | ||
1011 | /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ | 1032 | /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ |
1012 | sanitise_stdfd(); | 1033 | sanitise_stdfd(); |
@@ -1067,20 +1088,24 @@ main(int ac, char **av) | |||
1067 | 1088 | ||
1068 | if (ac == 0 && !c_flag && !s_flag) { | 1089 | if (ac == 0 && !c_flag && !s_flag) { |
1069 | shell = getenv("SHELL"); | 1090 | shell = getenv("SHELL"); |
1070 | if (shell != NULL && strncmp(shell + strlen(shell) - 3, "csh", 3) == 0) | 1091 | if (shell != NULL && |
1092 | strncmp(shell + strlen(shell) - 3, "csh", 3) == 0) | ||
1071 | c_flag = 1; | 1093 | c_flag = 1; |
1072 | } | 1094 | } |
1073 | if (k_flag) { | 1095 | if (k_flag) { |
1096 | const char *errstr = NULL; | ||
1097 | |||
1074 | pidstr = getenv(SSH_AGENTPID_ENV_NAME); | 1098 | pidstr = getenv(SSH_AGENTPID_ENV_NAME); |
1075 | if (pidstr == NULL) { | 1099 | if (pidstr == NULL) { |
1076 | fprintf(stderr, "%s not set, cannot kill agent\n", | 1100 | fprintf(stderr, "%s not set, cannot kill agent\n", |
1077 | SSH_AGENTPID_ENV_NAME); | 1101 | SSH_AGENTPID_ENV_NAME); |
1078 | exit(1); | 1102 | exit(1); |
1079 | } | 1103 | } |
1080 | pid = atoi(pidstr); | 1104 | pid = (int)strtonum(pidstr, 2, INT_MAX, &errstr); |
1081 | if (pid < 1) { | 1105 | if (errstr) { |
1082 | fprintf(stderr, "%s=\"%s\", which is not a good PID\n", | 1106 | fprintf(stderr, |
1083 | SSH_AGENTPID_ENV_NAME, pidstr); | 1107 | "%s=\"%s\", which is not a good PID: %s\n", |
1108 | SSH_AGENTPID_ENV_NAME, pidstr, errstr); | ||
1084 | exit(1); | 1109 | exit(1); |
1085 | } | 1110 | } |
1086 | if (kill(pid, SIGTERM) == -1) { | 1111 | if (kill(pid, SIGTERM) == -1) { |
@@ -1124,7 +1149,7 @@ main(int ac, char **av) | |||
1124 | sunaddr.sun_family = AF_UNIX; | 1149 | sunaddr.sun_family = AF_UNIX; |
1125 | strlcpy(sunaddr.sun_path, socket_name, sizeof(sunaddr.sun_path)); | 1150 | strlcpy(sunaddr.sun_path, socket_name, sizeof(sunaddr.sun_path)); |
1126 | prev_mask = umask(0177); | 1151 | prev_mask = umask(0177); |
1127 | if (bind(sock, (struct sockaddr *) & sunaddr, sizeof(sunaddr)) < 0) { | 1152 | if (bind(sock, (struct sockaddr *) &sunaddr, sizeof(sunaddr)) < 0) { |
1128 | perror("bind"); | 1153 | perror("bind"); |
1129 | *socket_name = '\0'; /* Don't unlink any existing file */ | 1154 | *socket_name = '\0'; /* Don't unlink any existing file */ |
1130 | umask(prev_mask); | 1155 | umask(prev_mask); |
@@ -1216,13 +1241,18 @@ skip: | |||
1216 | nalloc = 0; | 1241 | nalloc = 0; |
1217 | 1242 | ||
1218 | while (1) { | 1243 | while (1) { |
1244 | tv.tv_sec = 10; | ||
1245 | tv.tv_usec = 0; | ||
1219 | prepare_select(&readsetp, &writesetp, &max_fd, &nalloc); | 1246 | prepare_select(&readsetp, &writesetp, &max_fd, &nalloc); |
1220 | if (select(max_fd + 1, readsetp, writesetp, NULL, NULL) < 0) { | 1247 | result = select(max_fd + 1, readsetp, writesetp, NULL, &tv); |
1221 | if (errno == EINTR) | 1248 | saved_errno = errno; |
1249 | reaper(); /* remove expired keys */ | ||
1250 | if (result < 0) { | ||
1251 | if (saved_errno == EINTR) | ||
1222 | continue; | 1252 | continue; |
1223 | fatal("select: %s", strerror(errno)); | 1253 | fatal("select: %s", strerror(saved_errno)); |
1224 | } | 1254 | } else if (result > 0) |
1225 | after_select(readsetp, writesetp); | 1255 | after_select(readsetp, writesetp); |
1226 | } | 1256 | } |
1227 | /* NOTREACHED */ | 1257 | /* NOTREACHED */ |
1228 | } | 1258 | } |
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-dss.c,v 1.24 2006/11/06 21:25:28 markus Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
3 | * | 4 | * |
@@ -23,14 +24,17 @@ | |||
23 | */ | 24 | */ |
24 | 25 | ||
25 | #include "includes.h" | 26 | #include "includes.h" |
26 | RCSID("$OpenBSD: ssh-dss.c,v 1.19 2003/11/10 16:23:41 jakob Exp $"); | 27 | |
28 | #include <sys/types.h> | ||
27 | 29 | ||
28 | #include <openssl/bn.h> | 30 | #include <openssl/bn.h> |
29 | #include <openssl/evp.h> | 31 | #include <openssl/evp.h> |
30 | 32 | ||
33 | #include <stdarg.h> | ||
34 | #include <string.h> | ||
35 | |||
31 | #include "xmalloc.h" | 36 | #include "xmalloc.h" |
32 | #include "buffer.h" | 37 | #include "buffer.h" |
33 | #include "bufaux.h" | ||
34 | #include "compat.h" | 38 | #include "compat.h" |
35 | #include "log.h" | 39 | #include "log.h" |
36 | #include "key.h" | 40 | #include "key.h" |
@@ -157,8 +161,9 @@ ssh_dss_verify(const Key *key, const u_char *signature, u_int signaturelen, | |||
157 | fatal("ssh_dss_verify: BN_new failed"); | 161 | fatal("ssh_dss_verify: BN_new failed"); |
158 | if ((sig->s = BN_new()) == NULL) | 162 | if ((sig->s = BN_new()) == NULL) |
159 | fatal("ssh_dss_verify: BN_new failed"); | 163 | fatal("ssh_dss_verify: BN_new failed"); |
160 | BN_bin2bn(sigblob, INTBLOB_LEN, sig->r); | 164 | if ((BN_bin2bn(sigblob, INTBLOB_LEN, sig->r) == NULL) || |
161 | BN_bin2bn(sigblob+ INTBLOB_LEN, INTBLOB_LEN, sig->s); | 165 | (BN_bin2bn(sigblob+ INTBLOB_LEN, INTBLOB_LEN, sig->s) == NULL)) |
166 | fatal("ssh_dss_verify: BN_bin2bn failed"); | ||
162 | 167 | ||
163 | /* clean up */ | 168 | /* clean up */ |
164 | memset(sigblob, 0, len); | 169 | memset(sigblob, 0, len); |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-gss.h,v 1.5 2004/06/21 17:36:31 avsm Exp $ */ | 1 | /* $OpenBSD: ssh-gss.h,v 1.9 2006/08/18 14:40:34 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. | 3 | * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. |
4 | * | 4 | * |
@@ -28,8 +28,6 @@ | |||
28 | 28 | ||
29 | #ifdef GSSAPI | 29 | #ifdef GSSAPI |
30 | 30 | ||
31 | #include "buffer.h" | ||
32 | |||
33 | #ifdef HAVE_GSSAPI_H | 31 | #ifdef HAVE_GSSAPI_H |
34 | #include <gssapi.h> | 32 | #include <gssapi.h> |
35 | #elif defined(HAVE_GSSAPI_GSSAPI_H) | 33 | #elif defined(HAVE_GSSAPI_GSSAPI_H) |
@@ -62,14 +60,15 @@ | |||
62 | 60 | ||
63 | #define SSH_GSS_OIDTYPE 0x06 | 61 | #define SSH_GSS_OIDTYPE 0x06 |
64 | 62 | ||
65 | #define SSH2_MSG_KEXGSS_INIT 30 | 63 | #define SSH2_MSG_KEXGSS_INIT 30 |
66 | #define SSH2_MSG_KEXGSS_CONTINUE 31 | 64 | #define SSH2_MSG_KEXGSS_CONTINUE 31 |
67 | #define SSH2_MSG_KEXGSS_COMPLETE 32 | 65 | #define SSH2_MSG_KEXGSS_COMPLETE 32 |
68 | #define SSH2_MSG_KEXGSS_HOSTKEY 33 | 66 | #define SSH2_MSG_KEXGSS_HOSTKEY 33 |
69 | #define SSH2_MSG_KEXGSS_ERROR 34 | 67 | #define SSH2_MSG_KEXGSS_ERROR 34 |
70 | #define SSH2_MSG_KEXGSS_GROUPREQ 40 | 68 | #define SSH2_MSG_KEXGSS_GROUPREQ 40 |
71 | #define SSH2_MSG_KEXGSS_GROUP 41 | 69 | #define SSH2_MSG_KEXGSS_GROUP 41 |
72 | #define KEX_GSS_GRP1_SHA1_ID "gss-group1-sha1-" | 70 | #define KEX_GSS_GRP1_SHA1_ID "gss-group1-sha1-" |
71 | #define KEX_GSS_GRP14_SHA1_ID "gss-group14-sha1-" | ||
73 | #define KEX_GSS_GEX_SHA1_ID "gss-gex-sha1-" | 72 | #define KEX_GSS_GEX_SHA1_ID "gss-gex-sha1-" |
74 | 73 | ||
75 | typedef struct { | 74 | typedef struct { |
@@ -131,20 +130,21 @@ void ssh_gssapi_delete_ctx(Gssctxt **); | |||
131 | OM_uint32 ssh_gssapi_sign(Gssctxt *, gss_buffer_t, gss_buffer_t); | 130 | OM_uint32 ssh_gssapi_sign(Gssctxt *, gss_buffer_t, gss_buffer_t); |
132 | OM_uint32 ssh_gssapi_server_ctx(Gssctxt **, gss_OID); | 131 | OM_uint32 ssh_gssapi_server_ctx(Gssctxt **, gss_OID); |
133 | void ssh_gssapi_buildmic(Buffer *, const char *, const char *, const char *); | 132 | void ssh_gssapi_buildmic(Buffer *, const char *, const char *, const char *); |
133 | int ssh_gssapi_check_mechanism(Gssctxt **, gss_OID, const char *); | ||
134 | 134 | ||
135 | typedef int ssh_gssapi_check_fn(gss_OID, void *); | 135 | /* In the server */ |
136 | typedef int ssh_gssapi_check_fn(Gssctxt **, gss_OID, const char *); | ||
136 | char *ssh_gssapi_client_mechanisms(const char *host); | 137 | char *ssh_gssapi_client_mechanisms(const char *host); |
137 | char *ssh_gssapi_kex_mechs(gss_OID_set, ssh_gssapi_check_fn *, void *); | 138 | char *ssh_gssapi_kex_mechs(gss_OID_set, ssh_gssapi_check_fn *, const char *); |
138 | int ssh_gssapi_check_mechanism(gss_OID, void *); | 139 | gss_OID ssh_gssapi_id_kex(Gssctxt *, char *, int); |
139 | gss_OID ssh_gssapi_id_kex(Gssctxt *, char *, int *); | 140 | int ssh_gssapi_server_check_mech(Gssctxt **,gss_OID, const char *); |
140 | |||
141 | int ssh_gssapi_server_check_mech(gss_OID, void *); | ||
142 | int ssh_gssapi_userok(char *name); | 141 | int ssh_gssapi_userok(char *name); |
143 | OM_uint32 ssh_gssapi_checkmic(Gssctxt *, gss_buffer_t, gss_buffer_t); | 142 | OM_uint32 ssh_gssapi_checkmic(Gssctxt *, gss_buffer_t, gss_buffer_t); |
144 | void ssh_gssapi_do_child(char ***, u_int *); | 143 | void ssh_gssapi_do_child(char ***, u_int *); |
145 | void ssh_gssapi_cleanup_creds(void); | 144 | void ssh_gssapi_cleanup_creds(void); |
146 | void ssh_gssapi_storecreds(void); | 145 | void ssh_gssapi_storecreds(void); |
147 | char * ssh_gssapi_server_mechanisms(void); | 146 | |
147 | char *ssh_gssapi_server_mechanisms(void); | ||
148 | int ssh_gssapi_oid_table_ok(); | 148 | int ssh_gssapi_oid_table_ok(); |
149 | #endif /* GSSAPI */ | 149 | #endif /* GSSAPI */ |
150 | 150 | ||
diff --git a/ssh-keygen.0 b/ssh-keygen.0 index a972607b2..fe169d81c 100644 --- a/ssh-keygen.0 +++ b/ssh-keygen.0 | |||
@@ -93,7 +93,7 @@ DESCRIPTION | |||
93 | Download the RSA public key stored in the smartcard in reader. | 93 | Download the RSA public key stored in the smartcard in reader. |
94 | 94 | ||
95 | -e This option will read a private or public OpenSSH key file and | 95 | -e This option will read a private or public OpenSSH key file and |
96 | print the key in a `SECSH Public Key File Format' to stdout. | 96 | print the key in RFC 4716 SSH Public Key File Format to stdout. |
97 | This option allows exporting keys for use by several commercial | 97 | This option allows exporting keys for use by several commercial |
98 | SSH implementations. | 98 | SSH implementations. |
99 | 99 | ||
@@ -124,9 +124,9 @@ DESCRIPTION | |||
124 | 124 | ||
125 | -i This option will read an unencrypted private (or public) key file | 125 | -i This option will read an unencrypted private (or public) key file |
126 | in SSH2-compatible format and print an OpenSSH compatible private | 126 | in SSH2-compatible format and print an OpenSSH compatible private |
127 | (or public) key to stdout. ssh-keygen also reads the `SECSH | 127 | (or public) key to stdout. ssh-keygen also reads the RFC 4716 |
128 | Public Key File Format'. This option allows importing keys from | 128 | SSH Public Key File Format. This option allows importing keys |
129 | several commercial SSH implementations. | 129 | from several commercial SSH implementations. |
130 | 130 | ||
131 | -l Show fingerprint of specified public key file. Private RSA1 keys | 131 | -l Show fingerprint of specified public key file. Private RSA1 keys |
132 | are also supported. For RSA and DSA keys ssh-keygen tries to | 132 | are also supported. For RSA and DSA keys ssh-keygen tries to |
@@ -275,8 +275,7 @@ FILES | |||
275 | SEE ALSO | 275 | SEE ALSO |
276 | ssh(1), ssh-add(1), ssh-agent(1), moduli(5), sshd(8) | 276 | ssh(1), ssh-add(1), ssh-agent(1), moduli(5), sshd(8) |
277 | 277 | ||
278 | J. Galbraith and R. Thayer, SECSH Public Key File Format, draft-ietf- | 278 | The Secure Shell (SSH) Public Key File Format, RFC 4716, 2006. |
279 | secsh-publickeyfile-01.txt, March 2001, work in progress material. | ||
280 | 279 | ||
281 | AUTHORS | 280 | AUTHORS |
282 | OpenSSH is a derivative of the original and free ssh 1.2.12 release by | 281 | OpenSSH is a derivative of the original and free ssh 1.2.12 release by |
@@ -285,4 +284,4 @@ AUTHORS | |||
285 | created OpenSSH. Markus Friedl contributed the support for SSH protocol | 284 | created OpenSSH. Markus Friedl contributed the support for SSH protocol |
286 | versions 1.5 and 2.0. | 285 | versions 1.5 and 2.0. |
287 | 286 | ||
288 | OpenBSD 3.9 September 25, 1999 5 | 287 | OpenBSD 4.1 September 25, 1999 5 |
diff --git a/ssh-keygen.1 b/ssh-keygen.1 index ab16bcd77..5a8c8c471 100644 --- a/ssh-keygen.1 +++ b/ssh-keygen.1 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: ssh-keygen.1,v 1.72 2005/11/28 05:16:53 dtucker Exp $ | 1 | .\" $OpenBSD: ssh-keygen.1,v 1.74 2007/01/12 20:20:41 jmc Exp $ |
2 | .\" | 2 | .\" |
3 | .\" -*- nroff -*- | 3 | .\" -*- nroff -*- |
4 | .\" | 4 | .\" |
@@ -205,8 +205,8 @@ Download the RSA public key stored in the smartcard in | |||
205 | .Ar reader . | 205 | .Ar reader . |
206 | .It Fl e | 206 | .It Fl e |
207 | This option will read a private or public OpenSSH key file and | 207 | This option will read a private or public OpenSSH key file and |
208 | print the key in a | 208 | print the key in |
209 | .Sq SECSH Public Key File Format | 209 | RFC 4716 SSH Public Key File Format |
210 | to stdout. | 210 | to stdout. |
211 | This option allows exporting keys for use by several commercial | 211 | This option allows exporting keys for use by several commercial |
212 | SSH implementations. | 212 | SSH implementations. |
@@ -253,7 +253,7 @@ in SSH2-compatible format and print an OpenSSH compatible private | |||
253 | (or public) key to stdout. | 253 | (or public) key to stdout. |
254 | .Nm | 254 | .Nm |
255 | also reads the | 255 | also reads the |
256 | .Sq SECSH Public Key File Format . | 256 | RFC 4716 SSH Public Key File Format. |
257 | This option allows importing keys from several commercial | 257 | This option allows importing keys from several commercial |
258 | SSH implementations. | 258 | SSH implementations. |
259 | .It Fl l | 259 | .It Fl l |
@@ -450,12 +450,9 @@ The file format is described in | |||
450 | .Xr moduli 5 , | 450 | .Xr moduli 5 , |
451 | .Xr sshd 8 | 451 | .Xr sshd 8 |
452 | .Rs | 452 | .Rs |
453 | .%A J. Galbraith | 453 | .%R RFC 4716 |
454 | .%A R. Thayer | 454 | .%T "The Secure Shell (SSH) Public Key File Format" |
455 | .%T "SECSH Public Key File Format" | 455 | .%D 2006 |
456 | .%N draft-ietf-secsh-publickeyfile-01.txt | ||
457 | .%D March 2001 | ||
458 | .%O work in progress material | ||
459 | .Re | 456 | .Re |
460 | .Sh AUTHORS | 457 | .Sh AUTHORS |
461 | OpenSSH is a derivative of the original and free | 458 | OpenSSH is a derivative of the original and free |
diff --git a/ssh-keygen.c b/ssh-keygen.c index 64fadc7a1..04a9b939a 100644 --- a/ssh-keygen.c +++ b/ssh-keygen.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-keygen.c,v 1.160 2007/01/21 01:41:54 stevesk Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -12,28 +13,44 @@ | |||
12 | */ | 13 | */ |
13 | 14 | ||
14 | #include "includes.h" | 15 | #include "includes.h" |
15 | RCSID("$OpenBSD: ssh-keygen.c,v 1.135 2005/11/29 02:04:55 dtucker Exp $"); | 16 | |
17 | #include <sys/types.h> | ||
18 | #include <sys/socket.h> | ||
19 | #include <sys/stat.h> | ||
20 | #include <sys/param.h> | ||
16 | 21 | ||
17 | #include <openssl/evp.h> | 22 | #include <openssl/evp.h> |
18 | #include <openssl/pem.h> | 23 | #include <openssl/pem.h> |
19 | 24 | ||
25 | #include <errno.h> | ||
26 | #include <fcntl.h> | ||
27 | #include <netdb.h> | ||
28 | #ifdef HAVE_PATHS_H | ||
29 | # include <paths.h> | ||
30 | #endif | ||
31 | #include <pwd.h> | ||
32 | #include <stdarg.h> | ||
33 | #include <stdio.h> | ||
34 | #include <stdlib.h> | ||
35 | #include <string.h> | ||
36 | #include <unistd.h> | ||
37 | |||
20 | #include "xmalloc.h" | 38 | #include "xmalloc.h" |
21 | #include "key.h" | 39 | #include "key.h" |
22 | #include "rsa.h" | 40 | #include "rsa.h" |
23 | #include "authfile.h" | 41 | #include "authfile.h" |
24 | #include "uuencode.h" | 42 | #include "uuencode.h" |
25 | #include "buffer.h" | 43 | #include "buffer.h" |
26 | #include "bufaux.h" | ||
27 | #include "pathnames.h" | 44 | #include "pathnames.h" |
28 | #include "log.h" | 45 | #include "log.h" |
29 | #include "misc.h" | 46 | #include "misc.h" |
30 | #include "match.h" | 47 | #include "match.h" |
31 | #include "hostfile.h" | 48 | #include "hostfile.h" |
49 | #include "dns.h" | ||
32 | 50 | ||
33 | #ifdef SMARTCARD | 51 | #ifdef SMARTCARD |
34 | #include "scard.h" | 52 | #include "scard.h" |
35 | #endif | 53 | #endif |
36 | #include "dns.h" | ||
37 | 54 | ||
38 | /* Number of bits in the RSA/DSA key. This value can be set on the command line. */ | 55 | /* Number of bits in the RSA/DSA key. This value can be set on the command line. */ |
39 | #define DEFAULT_BITS 2048 | 56 | #define DEFAULT_BITS 2048 |
@@ -103,7 +120,7 @@ ask_filename(struct passwd *pw, const char *prompt) | |||
103 | 120 | ||
104 | if (key_type_name == NULL) | 121 | if (key_type_name == NULL) |
105 | name = _PATH_SSH_CLIENT_ID_RSA; | 122 | name = _PATH_SSH_CLIENT_ID_RSA; |
106 | else | 123 | else { |
107 | switch (key_type_from_name(key_type_name)) { | 124 | switch (key_type_from_name(key_type_name)) { |
108 | case KEY_RSA1: | 125 | case KEY_RSA1: |
109 | name = _PATH_SSH_CLIENT_IDENTITY; | 126 | name = _PATH_SSH_CLIENT_IDENTITY; |
@@ -119,7 +136,7 @@ ask_filename(struct passwd *pw, const char *prompt) | |||
119 | exit(1); | 136 | exit(1); |
120 | break; | 137 | break; |
121 | } | 138 | } |
122 | 139 | } | |
123 | snprintf(identity_file, sizeof(identity_file), "%s/%s", pw->pw_dir, name); | 140 | snprintf(identity_file, sizeof(identity_file), "%s/%s", pw->pw_dir, name); |
124 | fprintf(stderr, "%s (%s): ", prompt, identity_file); | 141 | fprintf(stderr, "%s (%s): ", prompt, identity_file); |
125 | if (fgets(buf, sizeof(buf), stdin) == NULL) | 142 | if (fgets(buf, sizeof(buf), stdin) == NULL) |
@@ -205,7 +222,8 @@ buffer_get_bignum_bits(Buffer *b, BIGNUM *value) | |||
205 | if (buffer_len(b) < bytes) | 222 | if (buffer_len(b) < bytes) |
206 | fatal("buffer_get_bignum_bits: input buffer too small: " | 223 | fatal("buffer_get_bignum_bits: input buffer too small: " |
207 | "need %d have %d", bytes, buffer_len(b)); | 224 | "need %d have %d", bytes, buffer_len(b)); |
208 | BN_bin2bn(buffer_ptr(b), bytes, value); | 225 | if (BN_bin2bn(buffer_ptr(b), bytes, value) == NULL) |
226 | fatal("buffer_get_bignum_bits: BN_bin2bn failed"); | ||
209 | buffer_consume(b, bytes); | 227 | buffer_consume(b, bytes); |
210 | } | 228 | } |
211 | 229 | ||
@@ -223,7 +241,7 @@ do_convert_private_ssh2_from_blob(u_char *blob, u_int blen) | |||
223 | buffer_init(&b); | 241 | buffer_init(&b); |
224 | buffer_append(&b, blob, blen); | 242 | buffer_append(&b, blob, blen); |
225 | 243 | ||
226 | magic = buffer_get_int(&b); | 244 | magic = buffer_get_int(&b); |
227 | if (magic != SSH_COM_PRIVATE_KEY_MAGIC) { | 245 | if (magic != SSH_COM_PRIVATE_KEY_MAGIC) { |
228 | error("bad magic 0x%x != 0x%x", magic, SSH_COM_PRIVATE_KEY_MAGIC); | 246 | error("bad magic 0x%x != 0x%x", magic, SSH_COM_PRIVATE_KEY_MAGIC); |
229 | buffer_free(&b); | 247 | buffer_free(&b); |
@@ -235,7 +253,7 @@ do_convert_private_ssh2_from_blob(u_char *blob, u_int blen) | |||
235 | i2 = buffer_get_int(&b); | 253 | i2 = buffer_get_int(&b); |
236 | i3 = buffer_get_int(&b); | 254 | i3 = buffer_get_int(&b); |
237 | i4 = buffer_get_int(&b); | 255 | i4 = buffer_get_int(&b); |
238 | debug("ignore (%d %d %d %d)", i1,i2,i3,i4); | 256 | debug("ignore (%d %d %d %d)", i1, i2, i3, i4); |
239 | if (strcmp(cipher, "none") != 0) { | 257 | if (strcmp(cipher, "none") != 0) { |
240 | error("unsupported cipher %s", cipher); | 258 | error("unsupported cipher %s", cipher); |
241 | xfree(cipher); | 259 | xfree(cipher); |
@@ -266,7 +284,7 @@ do_convert_private_ssh2_from_blob(u_char *blob, u_int blen) | |||
266 | buffer_get_bignum_bits(&b, key->dsa->priv_key); | 284 | buffer_get_bignum_bits(&b, key->dsa->priv_key); |
267 | break; | 285 | break; |
268 | case KEY_RSA: | 286 | case KEY_RSA: |
269 | e = buffer_get_char(&b); | 287 | e = buffer_get_char(&b); |
270 | debug("e %lx", e); | 288 | debug("e %lx", e); |
271 | if (e < 30) { | 289 | if (e < 30) { |
272 | e <<= 8; | 290 | e <<= 8; |
@@ -302,13 +320,43 @@ do_convert_private_ssh2_from_blob(u_char *blob, u_int blen) | |||
302 | return key; | 320 | return key; |
303 | } | 321 | } |
304 | 322 | ||
323 | static int | ||
324 | get_line(FILE *fp, char *line, size_t len) | ||
325 | { | ||
326 | int c; | ||
327 | size_t pos = 0; | ||
328 | |||
329 | line[0] = '\0'; | ||
330 | while ((c = fgetc(fp)) != EOF) { | ||
331 | if (pos >= len - 1) { | ||
332 | fprintf(stderr, "input line too long.\n"); | ||
333 | exit(1); | ||
334 | } | ||
335 | switch (c) { | ||
336 | case '\r': | ||
337 | c = fgetc(fp); | ||
338 | if (c != EOF && c != '\n' && ungetc(c, fp) == EOF) { | ||
339 | fprintf(stderr, "unget: %s\n", strerror(errno)); | ||
340 | exit(1); | ||
341 | } | ||
342 | return pos; | ||
343 | case '\n': | ||
344 | return pos; | ||
345 | } | ||
346 | line[pos++] = c; | ||
347 | line[pos] = '\0'; | ||
348 | } | ||
349 | /* We reached EOF */ | ||
350 | return -1; | ||
351 | } | ||
352 | |||
305 | static void | 353 | static void |
306 | do_convert_from_ssh2(struct passwd *pw) | 354 | do_convert_from_ssh2(struct passwd *pw) |
307 | { | 355 | { |
308 | Key *k; | 356 | Key *k; |
309 | int blen; | 357 | int blen; |
310 | u_int len; | 358 | u_int len; |
311 | char line[1024], *p; | 359 | char line[1024]; |
312 | u_char blob[8096]; | 360 | u_char blob[8096]; |
313 | char encoded[8096]; | 361 | char encoded[8096]; |
314 | struct stat st; | 362 | struct stat st; |
@@ -327,12 +375,8 @@ do_convert_from_ssh2(struct passwd *pw) | |||
327 | exit(1); | 375 | exit(1); |
328 | } | 376 | } |
329 | encoded[0] = '\0'; | 377 | encoded[0] = '\0'; |
330 | while (fgets(line, sizeof(line), fp)) { | 378 | while ((blen = get_line(fp, line, sizeof(line))) != -1) { |
331 | if (!(p = strchr(line, '\n'))) { | 379 | if (line[blen - 1] == '\\') |
332 | fprintf(stderr, "input line too long.\n"); | ||
333 | exit(1); | ||
334 | } | ||
335 | if (p > line && p[-1] == '\\') | ||
336 | escaped++; | 380 | escaped++; |
337 | if (strncmp(line, "----", 4) == 0 || | 381 | if (strncmp(line, "----", 4) == 0 || |
338 | strstr(line, ": ") != NULL) { | 382 | strstr(line, ": ") != NULL) { |
@@ -349,7 +393,6 @@ do_convert_from_ssh2(struct passwd *pw) | |||
349 | /* fprintf(stderr, "escaped: %s", line); */ | 393 | /* fprintf(stderr, "escaped: %s", line); */ |
350 | continue; | 394 | continue; |
351 | } | 395 | } |
352 | *p = '\0'; | ||
353 | strlcat(encoded, line, sizeof(encoded)); | 396 | strlcat(encoded, line, sizeof(encoded)); |
354 | } | 397 | } |
355 | len = strlen(encoded); | 398 | len = strlen(encoded); |
@@ -485,8 +528,10 @@ do_fingerprint(struct passwd *pw) | |||
485 | xfree(fp); | 528 | xfree(fp); |
486 | exit(0); | 529 | exit(0); |
487 | } | 530 | } |
488 | if (comment) | 531 | if (comment) { |
489 | xfree(comment); | 532 | xfree(comment); |
533 | comment = NULL; | ||
534 | } | ||
490 | 535 | ||
491 | f = fopen(identity_file, "r"); | 536 | f = fopen(identity_file, "r"); |
492 | if (f != NULL) { | 537 | if (f != NULL) { |
@@ -508,7 +553,7 @@ do_fingerprint(struct passwd *pw) | |||
508 | for (cp = line; *cp == ' ' || *cp == '\t'; cp++) | 553 | for (cp = line; *cp == ' ' || *cp == '\t'; cp++) |
509 | ; | 554 | ; |
510 | if (!*cp || *cp == '\n' || *cp == '#') | 555 | if (!*cp || *cp == '\n' || *cp == '#') |
511 | continue ; | 556 | continue; |
512 | i = strtol(cp, &ep, 10); | 557 | i = strtol(cp, &ep, 10); |
513 | if (i == 0 || ep == NULL || (*ep != ' ' && *ep != '\t')) { | 558 | if (i == 0 || ep == NULL || (*ep != ' ' && *ep != '\t')) { |
514 | int quoted = 0; | 559 | int quoted = 0; |
@@ -832,30 +877,32 @@ do_change_passphrase(struct passwd *pw) | |||
832 | /* | 877 | /* |
833 | * Print the SSHFP RR. | 878 | * Print the SSHFP RR. |
834 | */ | 879 | */ |
835 | static void | 880 | static int |
836 | do_print_resource_record(struct passwd *pw, char *hname) | 881 | do_print_resource_record(struct passwd *pw, char *fname, char *hname) |
837 | { | 882 | { |
838 | Key *public; | 883 | Key *public; |
839 | char *comment = NULL; | 884 | char *comment = NULL; |
840 | struct stat st; | 885 | struct stat st; |
841 | 886 | ||
842 | if (!have_identity) | 887 | if (fname == NULL) |
843 | ask_filename(pw, "Enter file in which the key is"); | 888 | ask_filename(pw, "Enter file in which the key is"); |
844 | if (stat(identity_file, &st) < 0) { | 889 | if (stat(fname, &st) < 0) { |
845 | perror(identity_file); | 890 | if (errno == ENOENT) |
891 | return 0; | ||
892 | perror(fname); | ||
846 | exit(1); | 893 | exit(1); |
847 | } | 894 | } |
848 | public = key_load_public(identity_file, &comment); | 895 | public = key_load_public(fname, &comment); |
849 | if (public != NULL) { | 896 | if (public != NULL) { |
850 | export_dns_rr(hname, public, stdout, print_generic); | 897 | export_dns_rr(hname, public, stdout, print_generic); |
851 | key_free(public); | 898 | key_free(public); |
852 | xfree(comment); | 899 | xfree(comment); |
853 | exit(0); | 900 | return 1; |
854 | } | 901 | } |
855 | if (comment) | 902 | if (comment) |
856 | xfree(comment); | 903 | xfree(comment); |
857 | 904 | ||
858 | printf("failed to read v2 public key from %s.\n", identity_file); | 905 | printf("failed to read v2 public key from %s.\n", fname); |
859 | exit(1); | 906 | exit(1); |
860 | } | 907 | } |
861 | 908 | ||
@@ -969,13 +1016,13 @@ usage(void) | |||
969 | #ifdef SMARTCARD | 1016 | #ifdef SMARTCARD |
970 | fprintf(stderr, " -D reader Download public key from smartcard.\n"); | 1017 | fprintf(stderr, " -D reader Download public key from smartcard.\n"); |
971 | #endif /* SMARTCARD */ | 1018 | #endif /* SMARTCARD */ |
972 | fprintf(stderr, " -e Convert OpenSSH to IETF SECSH key file.\n"); | 1019 | fprintf(stderr, " -e Convert OpenSSH to RFC 4716 key file.\n"); |
973 | fprintf(stderr, " -F hostname Find hostname in known hosts file.\n"); | 1020 | fprintf(stderr, " -F hostname Find hostname in known hosts file.\n"); |
974 | fprintf(stderr, " -f filename Filename of the key file.\n"); | 1021 | fprintf(stderr, " -f filename Filename of the key file.\n"); |
975 | fprintf(stderr, " -G file Generate candidates for DH-GEX moduli.\n"); | 1022 | fprintf(stderr, " -G file Generate candidates for DH-GEX moduli.\n"); |
976 | fprintf(stderr, " -g Use generic DNS resource record format.\n"); | 1023 | fprintf(stderr, " -g Use generic DNS resource record format.\n"); |
977 | fprintf(stderr, " -H Hash names in known_hosts file.\n"); | 1024 | fprintf(stderr, " -H Hash names in known_hosts file.\n"); |
978 | fprintf(stderr, " -i Convert IETF SECSH to OpenSSH key file.\n"); | 1025 | fprintf(stderr, " -i Convert RFC 4716 to OpenSSH key file.\n"); |
979 | fprintf(stderr, " -l Show fingerprint of key file.\n"); | 1026 | fprintf(stderr, " -l Show fingerprint of key file.\n"); |
980 | fprintf(stderr, " -M memory Amount of memory (MB) to use for generating DH-GEX moduli.\n"); | 1027 | fprintf(stderr, " -M memory Amount of memory (MB) to use for generating DH-GEX moduli.\n"); |
981 | fprintf(stderr, " -N phrase Provide new passphrase.\n"); | 1028 | fprintf(stderr, " -N phrase Provide new passphrase.\n"); |
@@ -1001,7 +1048,7 @@ usage(void) | |||
1001 | * Main program for key management. | 1048 | * Main program for key management. |
1002 | */ | 1049 | */ |
1003 | int | 1050 | int |
1004 | main(int ac, char **av) | 1051 | main(int argc, char **argv) |
1005 | { | 1052 | { |
1006 | char dotsshdir[MAXPATHLEN], comment[1024], *passphrase1, *passphrase2; | 1053 | char dotsshdir[MAXPATHLEN], comment[1024], *passphrase1, *passphrase2; |
1007 | char out_file[MAXPATHLEN], *reader_id = NULL; | 1054 | char out_file[MAXPATHLEN], *reader_id = NULL; |
@@ -1023,10 +1070,10 @@ main(int ac, char **av) | |||
1023 | /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ | 1070 | /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ |
1024 | sanitise_stdfd(); | 1071 | sanitise_stdfd(); |
1025 | 1072 | ||
1026 | __progname = ssh_get_progname(av[0]); | 1073 | __progname = ssh_get_progname(argv[0]); |
1027 | 1074 | ||
1028 | SSLeay_add_all_algorithms(); | 1075 | SSLeay_add_all_algorithms(); |
1029 | log_init(av[0], SYSLOG_LEVEL_INFO, SYSLOG_FACILITY_USER, 1); | 1076 | log_init(argv[0], SYSLOG_LEVEL_INFO, SYSLOG_FACILITY_USER, 1); |
1030 | 1077 | ||
1031 | init_rng(); | 1078 | init_rng(); |
1032 | seed_rng(); | 1079 | seed_rng(); |
@@ -1042,11 +1089,11 @@ main(int ac, char **av) | |||
1042 | exit(1); | 1089 | exit(1); |
1043 | } | 1090 | } |
1044 | 1091 | ||
1045 | while ((opt = getopt(ac, av, | 1092 | while ((opt = getopt(argc, argv, |
1046 | "degiqpclBHvxXyF:b:f:t:U:D:P:N:C:r:g:R:T:G:M:S:a:W:")) != -1) { | 1093 | "degiqpclBHvxXyF:b:f:t:U:D:P:N:C:r:g:R:T:G:M:S:a:W:")) != -1) { |
1047 | switch (opt) { | 1094 | switch (opt) { |
1048 | case 'b': | 1095 | case 'b': |
1049 | bits = strtonum(optarg, 768, 32768, &errstr); | 1096 | bits = (u_int32_t)strtonum(optarg, 768, 32768, &errstr); |
1050 | if (errstr) | 1097 | if (errstr) |
1051 | fatal("Bits has bad value %s (%s)", | 1098 | fatal("Bits has bad value %s (%s)", |
1052 | optarg, errstr); | 1099 | optarg, errstr); |
@@ -1116,6 +1163,7 @@ main(int ac, char **av) | |||
1116 | break; | 1163 | break; |
1117 | case 'D': | 1164 | case 'D': |
1118 | download = 1; | 1165 | download = 1; |
1166 | /*FALLTHROUGH*/ | ||
1119 | case 'U': | 1167 | case 'U': |
1120 | reader_id = optarg; | 1168 | reader_id = optarg; |
1121 | break; | 1169 | break; |
@@ -1132,19 +1180,20 @@ main(int ac, char **av) | |||
1132 | rr_hostname = optarg; | 1180 | rr_hostname = optarg; |
1133 | break; | 1181 | break; |
1134 | case 'W': | 1182 | case 'W': |
1135 | generator_wanted = strtonum(optarg, 1, UINT_MAX, &errstr); | 1183 | generator_wanted = (u_int32_t)strtonum(optarg, 1, |
1184 | UINT_MAX, &errstr); | ||
1136 | if (errstr) | 1185 | if (errstr) |
1137 | fatal("Desired generator has bad value: %s (%s)", | 1186 | fatal("Desired generator has bad value: %s (%s)", |
1138 | optarg, errstr); | 1187 | optarg, errstr); |
1139 | break; | 1188 | break; |
1140 | case 'a': | 1189 | case 'a': |
1141 | trials = strtonum(optarg, 1, UINT_MAX, &errstr); | 1190 | trials = (u_int32_t)strtonum(optarg, 1, UINT_MAX, &errstr); |
1142 | if (errstr) | 1191 | if (errstr) |
1143 | fatal("Invalid number of trials: %s (%s)", | 1192 | fatal("Invalid number of trials: %s (%s)", |
1144 | optarg, errstr); | 1193 | optarg, errstr); |
1145 | break; | 1194 | break; |
1146 | case 'M': | 1195 | case 'M': |
1147 | memory = strtonum(optarg, 1, UINT_MAX, &errstr); | 1196 | memory = (u_int32_t)strtonum(optarg, 1, UINT_MAX, &errstr); |
1148 | if (errstr) { | 1197 | if (errstr) { |
1149 | fatal("Memory limit is %s: %s", errstr, optarg); | 1198 | fatal("Memory limit is %s: %s", errstr, optarg); |
1150 | } | 1199 | } |
@@ -1173,9 +1222,9 @@ main(int ac, char **av) | |||
1173 | } | 1222 | } |
1174 | 1223 | ||
1175 | /* reinit */ | 1224 | /* reinit */ |
1176 | log_init(av[0], log_level, SYSLOG_FACILITY_USER, 1); | 1225 | log_init(argv[0], log_level, SYSLOG_FACILITY_USER, 1); |
1177 | 1226 | ||
1178 | if (optind < ac) { | 1227 | if (optind < argc) { |
1179 | printf("Too many arguments.\n"); | 1228 | printf("Too many arguments.\n"); |
1180 | usage(); | 1229 | usage(); |
1181 | } | 1230 | } |
@@ -1198,7 +1247,27 @@ main(int ac, char **av) | |||
1198 | if (print_public) | 1247 | if (print_public) |
1199 | do_print_public(pw); | 1248 | do_print_public(pw); |
1200 | if (rr_hostname != NULL) { | 1249 | if (rr_hostname != NULL) { |
1201 | do_print_resource_record(pw, rr_hostname); | 1250 | unsigned int n = 0; |
1251 | |||
1252 | if (have_identity) { | ||
1253 | n = do_print_resource_record(pw, | ||
1254 | identity_file, rr_hostname); | ||
1255 | if (n == 0) { | ||
1256 | perror(identity_file); | ||
1257 | exit(1); | ||
1258 | } | ||
1259 | exit(0); | ||
1260 | } else { | ||
1261 | |||
1262 | n += do_print_resource_record(pw, | ||
1263 | _PATH_HOST_RSA_KEY_FILE, rr_hostname); | ||
1264 | n += do_print_resource_record(pw, | ||
1265 | _PATH_HOST_DSA_KEY_FILE, rr_hostname); | ||
1266 | |||
1267 | if (n == 0) | ||
1268 | fatal("no keys found."); | ||
1269 | exit(0); | ||
1270 | } | ||
1202 | } | 1271 | } |
1203 | if (reader_id != NULL) { | 1272 | if (reader_id != NULL) { |
1204 | #ifdef SMARTCARD | 1273 | #ifdef SMARTCARD |
diff --git a/ssh-keyscan.0 b/ssh-keyscan.0 index 0206c04fb..f655abd47 100644 --- a/ssh-keyscan.0 +++ b/ssh-keyscan.0 | |||
@@ -56,7 +56,7 @@ DESCRIPTION | |||
56 | about its progress. | 56 | about its progress. |
57 | 57 | ||
58 | SECURITY | 58 | SECURITY |
59 | If a ssh_known_hosts file is constructed using ssh-keyscan without veri- | 59 | If an ssh_known_hosts file is constructed using ssh-keyscan without veri- |
60 | fying the keys, users will be vulnerable to man in the middle attacks. | 60 | fying the keys, users will be vulnerable to man in the middle attacks. |
61 | On the other hand, if the security model allows such a risk, ssh-keyscan | 61 | On the other hand, if the security model allows such a risk, ssh-keyscan |
62 | can help in the detection of tampered keyfiles or man in the middle at- | 62 | can help in the detection of tampered keyfiles or man in the middle at- |
@@ -104,4 +104,4 @@ BUGS | |||
104 | This is because it opens a connection to the ssh port, reads the public | 104 | This is because it opens a connection to the ssh port, reads the public |
105 | key, and drops the connection as soon as it gets the key. | 105 | key, and drops the connection as soon as it gets the key. |
106 | 106 | ||
107 | OpenBSD 3.9 January 1, 1996 2 | 107 | OpenBSD 4.1 January 1, 1996 2 |
diff --git a/ssh-keyscan.1 b/ssh-keyscan.1 index 80fc8cd96..a3656fc77 100644 --- a/ssh-keyscan.1 +++ b/ssh-keyscan.1 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: ssh-keyscan.1,v 1.21 2005/09/30 20:34:26 jaredy Exp $ | 1 | .\" $OpenBSD: ssh-keyscan.1,v 1.22 2006/09/25 04:55:38 ray Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>. | 3 | .\" Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>. |
4 | .\" | 4 | .\" |
@@ -102,7 +102,7 @@ Causes | |||
102 | to print debugging messages about its progress. | 102 | to print debugging messages about its progress. |
103 | .El | 103 | .El |
104 | .Sh SECURITY | 104 | .Sh SECURITY |
105 | If a ssh_known_hosts file is constructed using | 105 | If an ssh_known_hosts file is constructed using |
106 | .Nm | 106 | .Nm |
107 | without verifying the keys, users will be vulnerable to | 107 | without verifying the keys, users will be vulnerable to |
108 | .Em man in the middle | 108 | .Em man in the middle |
diff --git a/ssh-keyscan.c b/ssh-keyscan.c index f429c2c02..7ffbda421 100644 --- a/ssh-keyscan.c +++ b/ssh-keyscan.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-keyscan.c,v 1.74 2006/10/06 02:29:19 djm Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>. | 3 | * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>. |
3 | * | 4 | * |
@@ -7,24 +8,39 @@ | |||
7 | */ | 8 | */ |
8 | 9 | ||
9 | #include "includes.h" | 10 | #include "includes.h" |
10 | RCSID("$OpenBSD: ssh-keyscan.c,v 1.57 2005/10/30 04:01:03 djm Exp $"); | 11 | |
11 | |||
12 | #include "openbsd-compat/sys-queue.h" | 12 | #include "openbsd-compat/sys-queue.h" |
13 | #include <sys/resource.h> | ||
14 | #ifdef HAVE_SYS_TIME_H | ||
15 | # include <sys/time.h> | ||
16 | #endif | ||
17 | |||
18 | #include <netinet/in.h> | ||
19 | #include <arpa/inet.h> | ||
13 | 20 | ||
14 | #include <openssl/bn.h> | 21 | #include <openssl/bn.h> |
15 | 22 | ||
23 | #include <netdb.h> | ||
24 | #include <errno.h> | ||
16 | #include <setjmp.h> | 25 | #include <setjmp.h> |
26 | #include <stdarg.h> | ||
27 | #include <stdio.h> | ||
28 | #include <stdlib.h> | ||
29 | #include <signal.h> | ||
30 | #include <string.h> | ||
31 | #include <unistd.h> | ||
32 | |||
17 | #include "xmalloc.h" | 33 | #include "xmalloc.h" |
18 | #include "ssh.h" | 34 | #include "ssh.h" |
19 | #include "ssh1.h" | 35 | #include "ssh1.h" |
36 | #include "buffer.h" | ||
20 | #include "key.h" | 37 | #include "key.h" |
38 | #include "cipher.h" | ||
21 | #include "kex.h" | 39 | #include "kex.h" |
22 | #include "compat.h" | 40 | #include "compat.h" |
23 | #include "myproposal.h" | 41 | #include "myproposal.h" |
24 | #include "packet.h" | 42 | #include "packet.h" |
25 | #include "dispatch.h" | 43 | #include "dispatch.h" |
26 | #include "buffer.h" | ||
27 | #include "bufaux.h" | ||
28 | #include "log.h" | 44 | #include "log.h" |
29 | #include "atomicio.h" | 45 | #include "atomicio.h" |
30 | #include "misc.h" | 46 | #include "misc.h" |
@@ -54,7 +70,7 @@ int maxfd; | |||
54 | 70 | ||
55 | extern char *__progname; | 71 | extern char *__progname; |
56 | fd_set *read_wait; | 72 | fd_set *read_wait; |
57 | size_t read_wait_size; | 73 | size_t read_wait_nfdset; |
58 | int ncon; | 74 | int ncon; |
59 | int nonfatal_fatal = 0; | 75 | int nonfatal_fatal = 0; |
60 | jmp_buf kexjmp; | 76 | jmp_buf kexjmp; |
@@ -128,7 +144,7 @@ Linebuf_alloc(const char *filename, void (*errfun) (const char *,...)) | |||
128 | lb->stream = stdin; | 144 | lb->stream = stdin; |
129 | } | 145 | } |
130 | 146 | ||
131 | if (!(lb->buf = malloc(lb->size = LINEBUF_SIZE))) { | 147 | if (!(lb->buf = malloc((lb->size = LINEBUF_SIZE)))) { |
132 | if (errfun) | 148 | if (errfun) |
133 | (*errfun) ("linebuf (%s): malloc failed\n", lb->filename); | 149 | (*errfun) ("linebuf (%s): malloc failed\n", lb->filename); |
134 | xfree(lb); | 150 | xfree(lb); |
@@ -350,6 +366,7 @@ keygrab_ssh2(con *c) | |||
350 | c->c_kex->kex[KEX_DH_GRP1_SHA1] = kexdh_client; | 366 | c->c_kex->kex[KEX_DH_GRP1_SHA1] = kexdh_client; |
351 | c->c_kex->kex[KEX_DH_GRP14_SHA1] = kexdh_client; | 367 | c->c_kex->kex[KEX_DH_GRP14_SHA1] = kexdh_client; |
352 | c->c_kex->kex[KEX_DH_GEX_SHA1] = kexgex_client; | 368 | c->c_kex->kex[KEX_DH_GEX_SHA1] = kexgex_client; |
369 | c->c_kex->kex[KEX_DH_GEX_SHA256] = kexgex_client; | ||
353 | c->c_kex->verify_host_key = hostjump; | 370 | c->c_kex->verify_host_key = hostjump; |
354 | 371 | ||
355 | if (!(j = setjmp(kexjmp))) { | 372 | if (!(j = setjmp(kexjmp))) { |
@@ -602,7 +619,6 @@ conread(int s) | |||
602 | keyprint(c, keygrab_ssh1(c)); | 619 | keyprint(c, keygrab_ssh1(c)); |
603 | confree(s); | 620 | confree(s); |
604 | return; | 621 | return; |
605 | break; | ||
606 | default: | 622 | default: |
607 | fatal("conread: invalid status %d", c->c_status); | 623 | fatal("conread: invalid status %d", c->c_status); |
608 | break; | 624 | break; |
@@ -634,10 +650,10 @@ conloop(void) | |||
634 | } else | 650 | } else |
635 | seltime.tv_sec = seltime.tv_usec = 0; | 651 | seltime.tv_sec = seltime.tv_usec = 0; |
636 | 652 | ||
637 | r = xmalloc(read_wait_size); | 653 | r = xcalloc(read_wait_nfdset, sizeof(fd_mask)); |
638 | memcpy(r, read_wait, read_wait_size); | 654 | e = xcalloc(read_wait_nfdset, sizeof(fd_mask)); |
639 | e = xmalloc(read_wait_size); | 655 | memcpy(r, read_wait, read_wait_nfdset * sizeof(fd_mask)); |
640 | memcpy(e, read_wait, read_wait_size); | 656 | memcpy(e, read_wait, read_wait_nfdset * sizeof(fd_mask)); |
641 | 657 | ||
642 | while (select(maxfd, r, NULL, e, &seltime) == -1 && | 658 | while (select(maxfd, r, NULL, e, &seltime) == -1 && |
643 | (errno == EAGAIN || errno == EINTR)) | 659 | (errno == EAGAIN || errno == EINTR)) |
@@ -804,12 +820,10 @@ main(int argc, char **argv) | |||
804 | fatal("%s: not enough file descriptors", __progname); | 820 | fatal("%s: not enough file descriptors", __progname); |
805 | if (maxfd > fdlim_get(0)) | 821 | if (maxfd > fdlim_get(0)) |
806 | fdlim_set(maxfd); | 822 | fdlim_set(maxfd); |
807 | fdcon = xmalloc(maxfd * sizeof(con)); | 823 | fdcon = xcalloc(maxfd, sizeof(con)); |
808 | memset(fdcon, 0, maxfd * sizeof(con)); | ||
809 | 824 | ||
810 | read_wait_size = howmany(maxfd, NFDBITS) * sizeof(fd_mask); | 825 | read_wait_nfdset = howmany(maxfd, NFDBITS); |
811 | read_wait = xmalloc(read_wait_size); | 826 | read_wait = xcalloc(read_wait_nfdset, sizeof(fd_mask)); |
812 | memset(read_wait, 0, read_wait_size); | ||
813 | 827 | ||
814 | if (fopt_count) { | 828 | if (fopt_count) { |
815 | Linebuf *lb; | 829 | Linebuf *lb; |
diff --git a/ssh-keysign.0 b/ssh-keysign.0 index c32c42fb2..d509f5ef0 100644 --- a/ssh-keysign.0 +++ b/ssh-keysign.0 | |||
@@ -1,14 +1,14 @@ | |||
1 | SSH-KEYSIGN(8) OpenBSD System Manager's Manual SSH-KEYSIGN(8) | 1 | SSH-KEYSIGN(8) OpenBSD System Manager's Manual SSH-KEYSIGN(8) |
2 | 2 | ||
3 | NAME | 3 | NAME |
4 | ssh-keysign - ssh helper program for hostbased authentication | 4 | ssh-keysign - ssh helper program for host-based authentication |
5 | 5 | ||
6 | SYNOPSIS | 6 | SYNOPSIS |
7 | ssh-keysign | 7 | ssh-keysign |
8 | 8 | ||
9 | DESCRIPTION | 9 | DESCRIPTION |
10 | ssh-keysign is used by ssh(1) to access the local host keys and generate | 10 | ssh-keysign is used by ssh(1) to access the local host keys and generate |
11 | the digital signature required during hostbased authentication with SSH | 11 | the digital signature required during host-based authentication with SSH |
12 | protocol version 2. | 12 | protocol version 2. |
13 | 13 | ||
14 | ssh-keysign is disabled by default and can only be enabled in the global | 14 | ssh-keysign is disabled by default and can only be enabled in the global |
@@ -16,7 +16,7 @@ DESCRIPTION | |||
16 | to ``yes''. | 16 | to ``yes''. |
17 | 17 | ||
18 | ssh-keysign is not intended to be invoked by the user, but from ssh(1). | 18 | ssh-keysign is not intended to be invoked by the user, but from ssh(1). |
19 | See ssh(1) and sshd(8) for more information about hostbased authentica- | 19 | See ssh(1) and sshd(8) for more information about host-based authentica- |
20 | tion. | 20 | tion. |
21 | 21 | ||
22 | FILES | 22 | FILES |
@@ -28,7 +28,7 @@ FILES | |||
28 | generate the digital signature. They should be owned by root, | 28 | generate the digital signature. They should be owned by root, |
29 | readable only by root, and not accessible to others. Since they | 29 | readable only by root, and not accessible to others. Since they |
30 | are readable only by root, ssh-keysign must be set-uid root if | 30 | are readable only by root, ssh-keysign must be set-uid root if |
31 | hostbased authentication is used. | 31 | host-based authentication is used. |
32 | 32 | ||
33 | SEE ALSO | 33 | SEE ALSO |
34 | ssh(1), ssh-keygen(1), ssh_config(5), sshd(8) | 34 | ssh(1), ssh-keygen(1), ssh_config(5), sshd(8) |
@@ -39,4 +39,4 @@ HISTORY | |||
39 | AUTHORS | 39 | AUTHORS |
40 | Markus Friedl <markus@openbsd.org> | 40 | Markus Friedl <markus@openbsd.org> |
41 | 41 | ||
42 | OpenBSD 3.9 May 24, 2002 1 | 42 | OpenBSD 4.1 May 24, 2002 1 |
diff --git a/ssh-keysign.8 b/ssh-keysign.8 index a17e8d5cf..4cdcb7a43 100644 --- a/ssh-keysign.8 +++ b/ssh-keysign.8 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: ssh-keysign.8,v 1.7 2003/06/10 09:12:11 jmc Exp $ | 1 | .\" $OpenBSD: ssh-keysign.8,v 1.8 2006/02/24 20:22:16 jmc Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright (c) 2002 Markus Friedl. All rights reserved. | 3 | .\" Copyright (c) 2002 Markus Friedl. All rights reserved. |
4 | .\" | 4 | .\" |
@@ -27,7 +27,7 @@ | |||
27 | .Os | 27 | .Os |
28 | .Sh NAME | 28 | .Sh NAME |
29 | .Nm ssh-keysign | 29 | .Nm ssh-keysign |
30 | .Nd ssh helper program for hostbased authentication | 30 | .Nd ssh helper program for host-based authentication |
31 | .Sh SYNOPSIS | 31 | .Sh SYNOPSIS |
32 | .Nm | 32 | .Nm |
33 | .Sh DESCRIPTION | 33 | .Sh DESCRIPTION |
@@ -35,7 +35,7 @@ | |||
35 | is used by | 35 | is used by |
36 | .Xr ssh 1 | 36 | .Xr ssh 1 |
37 | to access the local host keys and generate the digital signature | 37 | to access the local host keys and generate the digital signature |
38 | required during hostbased authentication with SSH protocol version 2. | 38 | required during host-based authentication with SSH protocol version 2. |
39 | .Pp | 39 | .Pp |
40 | .Nm | 40 | .Nm |
41 | is disabled by default and can only be enabled in the | 41 | is disabled by default and can only be enabled in the |
@@ -53,7 +53,7 @@ See | |||
53 | .Xr ssh 1 | 53 | .Xr ssh 1 |
54 | and | 54 | and |
55 | .Xr sshd 8 | 55 | .Xr sshd 8 |
56 | for more information about hostbased authentication. | 56 | for more information about host-based authentication. |
57 | .Sh FILES | 57 | .Sh FILES |
58 | .Bl -tag -width Ds | 58 | .Bl -tag -width Ds |
59 | .It Pa /etc/ssh/ssh_config | 59 | .It Pa /etc/ssh/ssh_config |
@@ -67,7 +67,7 @@ They should be owned by root, readable only by root, and not | |||
67 | accessible to others. | 67 | accessible to others. |
68 | Since they are readable only by root, | 68 | Since they are readable only by root, |
69 | .Nm | 69 | .Nm |
70 | must be set-uid root if hostbased authentication is used. | 70 | must be set-uid root if host-based authentication is used. |
71 | .El | 71 | .El |
72 | .Sh SEE ALSO | 72 | .Sh SEE ALSO |
73 | .Xr ssh 1 , | 73 | .Xr ssh 1 , |
diff --git a/ssh-keysign.c b/ssh-keysign.c index dae3a2e8c..c4bc7e56e 100644 --- a/ssh-keysign.c +++ b/ssh-keysign.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-keysign.c,v 1.29 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2002 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2002 Markus Friedl. All rights reserved. |
3 | * | 4 | * |
@@ -21,21 +22,30 @@ | |||
21 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
22 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 24 | */ |
25 | |||
24 | #include "includes.h" | 26 | #include "includes.h" |
25 | RCSID("$OpenBSD: ssh-keysign.c,v 1.19 2005/09/13 23:40:07 djm Exp $"); | 27 | |
28 | #include <fcntl.h> | ||
29 | #ifdef HAVE_PATHS_H | ||
30 | #include <paths.h> | ||
31 | #endif | ||
32 | #include <pwd.h> | ||
33 | #include <stdarg.h> | ||
34 | #include <stdlib.h> | ||
35 | #include <string.h> | ||
36 | #include <unistd.h> | ||
26 | 37 | ||
27 | #include <openssl/evp.h> | 38 | #include <openssl/evp.h> |
28 | #include <openssl/rand.h> | 39 | #include <openssl/rand.h> |
29 | #include <openssl/rsa.h> | 40 | #include <openssl/rsa.h> |
30 | 41 | ||
42 | #include "xmalloc.h" | ||
31 | #include "log.h" | 43 | #include "log.h" |
32 | #include "key.h" | 44 | #include "key.h" |
33 | #include "ssh.h" | 45 | #include "ssh.h" |
34 | #include "ssh2.h" | 46 | #include "ssh2.h" |
35 | #include "misc.h" | 47 | #include "misc.h" |
36 | #include "xmalloc.h" | ||
37 | #include "buffer.h" | 48 | #include "buffer.h" |
38 | #include "bufaux.h" | ||
39 | #include "authfile.h" | 49 | #include "authfile.h" |
40 | #include "msg.h" | 50 | #include "msg.h" |
41 | #include "canohost.h" | 51 | #include "canohost.h" |
@@ -64,9 +74,9 @@ valid_request(struct passwd *pw, char *host, Key **ret, u_char *data, | |||
64 | buffer_init(&b); | 74 | buffer_init(&b); |
65 | buffer_append(&b, data, datalen); | 75 | buffer_append(&b, data, datalen); |
66 | 76 | ||
67 | /* session id, currently limited to SHA1 (20 bytes) */ | 77 | /* session id, currently limited to SHA1 (20 bytes) or SHA256 (32) */ |
68 | p = buffer_get_string(&b, &len); | 78 | p = buffer_get_string(&b, &len); |
69 | if (len != 20) | 79 | if (len != 20 && len != 32) |
70 | fail++; | 80 | fail++; |
71 | xfree(p); | 81 | xfree(p); |
72 | 82 | ||
@@ -140,7 +150,7 @@ main(int argc, char **argv) | |||
140 | { | 150 | { |
141 | Buffer b; | 151 | Buffer b; |
142 | Options options; | 152 | Options options; |
143 | Key *keys[2], *key; | 153 | Key *keys[2], *key = NULL; |
144 | struct passwd *pw; | 154 | struct passwd *pw; |
145 | int key_fd[2], i, found, version = 2, fd; | 155 | int key_fd[2], i, found, version = 2, fd; |
146 | u_char *signature, *data; | 156 | u_char *signature, *data; |
diff --git a/ssh-rand-helper.0 b/ssh-rand-helper.0 index 75ad52fa4..429582b78 100644 --- a/ssh-rand-helper.0 +++ b/ssh-rand-helper.0 | |||
@@ -1,7 +1,7 @@ | |||
1 | SSH-RAND-HELPER(8) OpenBSD System Manager's Manual SSH-RAND-HELPER(8) | 1 | SSH-RAND-HELPER(8) OpenBSD System Manager's Manual SSH-RAND-HELPER(8) |
2 | 2 | ||
3 | NAME | 3 | NAME |
4 | ssh-rand-helper - Random number gatherer for OpenSSH | 4 | ssh-rand-helper - random number gatherer for OpenSSH |
5 | 5 | ||
6 | SYNOPSIS | 6 | SYNOPSIS |
7 | ssh-rand-hlper [-vxXh] [-b bytes] | 7 | ssh-rand-hlper [-vxXh] [-b bytes] |
@@ -38,7 +38,9 @@ DESCRIPTION | |||
38 | -X Force output of a binary seed, even if standard output is a tty | 38 | -X Force output of a binary seed, even if standard output is a tty |
39 | 39 | ||
40 | -v Turn on debugging message. Multiple -v options will increase the | 40 | -v Turn on debugging message. Multiple -v options will increase the |
41 | debugging level. -h Display a summary of options. | 41 | debugging level. |
42 | |||
43 | -h Display a summary of options. | ||
42 | 44 | ||
43 | AUTHORS | 45 | AUTHORS |
44 | Damien Miller <djm@mindrot.org> | 46 | Damien Miller <djm@mindrot.org> |
@@ -46,4 +48,4 @@ AUTHORS | |||
46 | SEE ALSO | 48 | SEE ALSO |
47 | ssh(1), ssh-add(1), ssh-keygen(1), sshd(8) | 49 | ssh(1), ssh-add(1), ssh-keygen(1), sshd(8) |
48 | 50 | ||
49 | OpenBSD 3.9 April 14, 2002 1 | 51 | OpenBSD 4.1 April 14, 2002 1 |
diff --git a/ssh-rand-helper.8 b/ssh-rand-helper.8 index df559d332..af5a72fcb 100644 --- a/ssh-rand-helper.8 +++ b/ssh-rand-helper.8 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $Id: ssh-rand-helper.8,v 1.2 2003/11/21 12:48:56 djm Exp $ | 1 | .\" $Id: ssh-rand-helper.8,v 1.3 2007/01/22 01:44:53 djm Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright (c) 2002 Damien Miller. All rights reserved. | 3 | .\" Copyright (c) 2002 Damien Miller. All rights reserved. |
4 | .\" | 4 | .\" |
@@ -27,7 +27,7 @@ | |||
27 | .Os | 27 | .Os |
28 | .Sh NAME | 28 | .Sh NAME |
29 | .Nm ssh-rand-helper | 29 | .Nm ssh-rand-helper |
30 | .Nd Random number gatherer for OpenSSH | 30 | .Nd random number gatherer for OpenSSH |
31 | .Sh SYNOPSIS | 31 | .Sh SYNOPSIS |
32 | .Nm ssh-rand-hlper | 32 | .Nm ssh-rand-hlper |
33 | .Op Fl vxXh | 33 | .Op Fl vxXh |
@@ -82,7 +82,7 @@ Force output of a binary seed, even if standard output is a tty | |||
82 | Turn on debugging message. Multiple | 82 | Turn on debugging message. Multiple |
83 | .Fl v | 83 | .Fl v |
84 | options will increase the debugging level. | 84 | options will increase the debugging level. |
85 | .Fl h | 85 | .It Fl h |
86 | Display a summary of options. | 86 | Display a summary of options. |
87 | .El | 87 | .El |
88 | .Sh AUTHORS | 88 | .Sh AUTHORS |
diff --git a/ssh-rand-helper.c b/ssh-rand-helper.c index 87e52cf75..8520c3a62 100644 --- a/ssh-rand-helper.c +++ b/ssh-rand-helper.c | |||
@@ -24,6 +24,29 @@ | |||
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | 26 | ||
27 | #include <sys/types.h> | ||
28 | #include <sys/resource.h> | ||
29 | #include <sys/stat.h> | ||
30 | #include <sys/wait.h> | ||
31 | #include <sys/socket.h> | ||
32 | |||
33 | #include <stdarg.h> | ||
34 | #include <stddef.h> | ||
35 | |||
36 | #include <netinet/in.h> | ||
37 | #include <arpa/inet.h> | ||
38 | |||
39 | #ifdef HAVE_SYS_UN_H | ||
40 | # include <sys/un.h> | ||
41 | #endif | ||
42 | |||
43 | #include <errno.h> | ||
44 | #include <fcntl.h> | ||
45 | #include <pwd.h> | ||
46 | #include <signal.h> | ||
47 | #include <time.h> | ||
48 | #include <unistd.h> | ||
49 | |||
27 | #include <openssl/rand.h> | 50 | #include <openssl/rand.h> |
28 | #include <openssl/sha.h> | 51 | #include <openssl/sha.h> |
29 | #include <openssl/crypto.h> | 52 | #include <openssl/crypto.h> |
@@ -39,8 +62,6 @@ | |||
39 | #include "pathnames.h" | 62 | #include "pathnames.h" |
40 | #include "log.h" | 63 | #include "log.h" |
41 | 64 | ||
42 | RCSID("$Id: ssh-rand-helper.c,v 1.26 2005/07/17 07:26:44 djm Exp $"); | ||
43 | |||
44 | /* Number of bytes we write out */ | 65 | /* Number of bytes we write out */ |
45 | #define OUTPUT_SEED_SIZE 48 | 66 | #define OUTPUT_SEED_SIZE 48 |
46 | 67 | ||
@@ -564,7 +585,8 @@ prng_write_seedfile(void) | |||
564 | /* Try to ensure that the parent directory is there */ | 585 | /* Try to ensure that the parent directory is there */ |
565 | snprintf(filename, sizeof(filename), "%.512s/%s", pw->pw_dir, | 586 | snprintf(filename, sizeof(filename), "%.512s/%s", pw->pw_dir, |
566 | _PATH_SSH_USER_DIR); | 587 | _PATH_SSH_USER_DIR); |
567 | mkdir(filename, 0700); | 588 | if (mkdir(filename, 0700) < 0 && errno != EEXIST) |
589 | fatal("mkdir %.200s: %s", filename, strerror(errno)); | ||
568 | 590 | ||
569 | snprintf(filename, sizeof(filename), "%.512s/%s", pw->pw_dir, | 591 | snprintf(filename, sizeof(filename), "%.512s/%s", pw->pw_dir, |
570 | SSH_PRNG_SEED_FILE); | 592 | SSH_PRNG_SEED_FILE); |
@@ -665,8 +687,7 @@ prng_read_commands(char *cmdfilename) | |||
665 | } | 687 | } |
666 | 688 | ||
667 | num_cmds = 64; | 689 | num_cmds = 64; |
668 | entcmd = xmalloc(num_cmds * sizeof(entropy_cmd_t)); | 690 | entcmd = xcalloc(num_cmds, sizeof(entropy_cmd_t)); |
669 | memset(entcmd, '\0', num_cmds * sizeof(entropy_cmd_t)); | ||
670 | 691 | ||
671 | /* Read in file */ | 692 | /* Read in file */ |
672 | cur_cmd = linenum = 0; | 693 | cur_cmd = linenum = 0; |
@@ -759,7 +780,7 @@ prng_read_commands(char *cmdfilename) | |||
759 | */ | 780 | */ |
760 | if (cur_cmd == num_cmds) { | 781 | if (cur_cmd == num_cmds) { |
761 | num_cmds *= 2; | 782 | num_cmds *= 2; |
762 | entcmd = xrealloc(entcmd, num_cmds * | 783 | entcmd = xrealloc(entcmd, num_cmds, |
763 | sizeof(entropy_cmd_t)); | 784 | sizeof(entropy_cmd_t)); |
764 | } | 785 | } |
765 | } | 786 | } |
@@ -768,12 +789,13 @@ prng_read_commands(char *cmdfilename) | |||
768 | memset(&entcmd[cur_cmd], '\0', sizeof(entropy_cmd_t)); | 789 | memset(&entcmd[cur_cmd], '\0', sizeof(entropy_cmd_t)); |
769 | 790 | ||
770 | /* trim to size */ | 791 | /* trim to size */ |
771 | entropy_cmds = xrealloc(entcmd, (cur_cmd + 1) * | 792 | entropy_cmds = xrealloc(entcmd, (cur_cmd + 1), |
772 | sizeof(entropy_cmd_t)); | 793 | sizeof(entropy_cmd_t)); |
773 | 794 | ||
774 | debug("Loaded %d entropy commands from %.100s", cur_cmd, | 795 | debug("Loaded %d entropy commands from %.100s", cur_cmd, |
775 | cmdfilename); | 796 | cmdfilename); |
776 | 797 | ||
798 | fclose(f); | ||
777 | return cur_cmd < MIN_ENTROPY_SOURCES ? -1 : 0; | 799 | return cur_cmd < MIN_ENTROPY_SOURCES ? -1 : 0; |
778 | } | 800 | } |
779 | 801 | ||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-rsa.c,v 1.39 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2000, 2003 Markus Friedl <markus@openbsd.org> | 3 | * Copyright (c) 2000, 2003 Markus Friedl <markus@openbsd.org> |
3 | * | 4 | * |
@@ -13,16 +14,20 @@ | |||
13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
15 | */ | 16 | */ |
17 | |||
16 | #include "includes.h" | 18 | #include "includes.h" |
17 | RCSID("$OpenBSD: ssh-rsa.c,v 1.32 2005/06/17 02:44:33 djm Exp $"); | 19 | |
20 | #include <sys/types.h> | ||
18 | 21 | ||
19 | #include <openssl/evp.h> | 22 | #include <openssl/evp.h> |
20 | #include <openssl/err.h> | 23 | #include <openssl/err.h> |
21 | 24 | ||
25 | #include <stdarg.h> | ||
26 | #include <string.h> | ||
27 | |||
22 | #include "xmalloc.h" | 28 | #include "xmalloc.h" |
23 | #include "log.h" | 29 | #include "log.h" |
24 | #include "buffer.h" | 30 | #include "buffer.h" |
25 | #include "bufaux.h" | ||
26 | #include "key.h" | 31 | #include "key.h" |
27 | #include "compat.h" | 32 | #include "compat.h" |
28 | #include "ssh.h" | 33 | #include "ssh.h" |
@@ -62,6 +67,7 @@ ssh_rsa_sign(const Key *key, u_char **sigp, u_int *lenp, | |||
62 | 67 | ||
63 | if (ok != 1) { | 68 | if (ok != 1) { |
64 | int ecode = ERR_get_error(); | 69 | int ecode = ERR_get_error(); |
70 | |||
65 | error("ssh_rsa_sign: RSA_sign failed: %s", | 71 | error("ssh_rsa_sign: RSA_sign failed: %s", |
66 | ERR_error_string(ecode, NULL)); | 72 | ERR_error_string(ecode, NULL)); |
67 | xfree(sig); | 73 | xfree(sig); |
@@ -144,7 +150,7 @@ ssh_rsa_verify(const Key *key, const u_char *signature, u_int signaturelen, | |||
144 | u_int diff = modlen - len; | 150 | u_int diff = modlen - len; |
145 | debug("ssh_rsa_verify: add padding: modlen %u > len %u", | 151 | debug("ssh_rsa_verify: add padding: modlen %u > len %u", |
146 | modlen, len); | 152 | modlen, len); |
147 | sigblob = xrealloc(sigblob, modlen); | 153 | sigblob = xrealloc(sigblob, 1, modlen); |
148 | memmove(sigblob + diff, sigblob, len); | 154 | memmove(sigblob + diff, sigblob, len); |
149 | memset(sigblob, 0, diff); | 155 | memset(sigblob, 0, diff); |
150 | len = modlen; | 156 | len = modlen; |
@@ -220,7 +226,6 @@ openssh_RSA_verify(int type, u_char *hash, u_int hashlen, | |||
220 | break; | 226 | break; |
221 | default: | 227 | default: |
222 | goto done; | 228 | goto done; |
223 | break; | ||
224 | } | 229 | } |
225 | if (hashlen != hlen) { | 230 | if (hashlen != hlen) { |
226 | error("bad hashlen"); | 231 | error("bad hashlen"); |
@@ -9,7 +9,7 @@ SYNOPSIS | |||
9 | [-i identity_file] [-L [bind_address:]port:host:hostport] | 9 | [-i identity_file] [-L [bind_address:]port:host:hostport] |
10 | [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port] | 10 | [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port] |
11 | [-R [bind_address:]port:host:hostport] [-S ctl_path] | 11 | [-R [bind_address:]port:host:hostport] [-S ctl_path] |
12 | [-w tunnel:tunnel] [user@]hostname [command] | 12 | [-w local_tun[:remote_tun]] [user@]hostname [command] |
13 | 13 | ||
14 | DESCRIPTION | 14 | DESCRIPTION |
15 | ssh (SSH client) is a program for logging into a remote machine and for | 15 | ssh (SSH client) is a program for logging into a remote machine and for |
@@ -225,6 +225,7 @@ DESCRIPTION | |||
225 | ControlPath | 225 | ControlPath |
226 | DynamicForward | 226 | DynamicForward |
227 | EscapeChar | 227 | EscapeChar |
228 | ExitOnForwardFailure | ||
228 | ForwardAgent | 229 | ForwardAgent |
229 | ForwardX11 | 230 | ForwardX11 |
230 | ForwardX11Trusted | 231 | ForwardX11Trusted |
@@ -315,7 +316,7 @@ DESCRIPTION | |||
315 | 316 | ||
316 | -t Force pseudo-tty allocation. This can be used to execute arbi- | 317 | -t Force pseudo-tty allocation. This can be used to execute arbi- |
317 | trary screen-based programs on a remote machine, which can be | 318 | trary screen-based programs on a remote machine, which can be |
318 | very useful, e.g., when implementing menu services. Multiple -t | 319 | very useful, e.g. when implementing menu services. Multiple -t |
319 | options force tty allocation, even if ssh has no local tty. | 320 | options force tty allocation, even if ssh has no local tty. |
320 | 321 | ||
321 | -V Display the version number and exit. | 322 | -V Display the version number and exit. |
@@ -325,11 +326,16 @@ DESCRIPTION | |||
325 | tion, and configuration problems. Multiple -v options increase | 326 | tion, and configuration problems. Multiple -v options increase |
326 | the verbosity. The maximum is 3. | 327 | the verbosity. The maximum is 3. |
327 | 328 | ||
328 | -w tunnel:tunnel | 329 | -w local_tun[:remote_tun] |
329 | Requests a tun(4) device on the client (first tunnel arg) and | 330 | Requests tunnel device forwarding with the specified tun(4) de- |
330 | server (second tunnel arg). The devices may be specified by nu- | 331 | vices between the client (local_tun) and the server (remote_tun). |
331 | merical ID or the keyword ``any'', which uses the next available | 332 | |
332 | tunnel device. See also the Tunnel directive in ssh_config(5). | 333 | The devices may be specified by numerical ID or the keyword |
334 | ``any'', which uses the next available tunnel device. If | ||
335 | remote_tun is not specified, it defaults to ``any''. See also | ||
336 | the Tunnel and TunnelDevice directives in ssh_config(5). If the | ||
337 | Tunnel directive is unset, it is set to the default tunnel mode, | ||
338 | which is ``point-to-point''. | ||
333 | 339 | ||
334 | -X Enables X11 forwarding. This can also be specified on a per-host | 340 | -X Enables X11 forwarding. This can also be specified on a per-host |
335 | basis in a configuration file. | 341 | basis in a configuration file. |
@@ -368,11 +374,11 @@ AUTHENTICATION | |||
368 | integrity (hmac-md5, hmac-sha1, hmac-ripemd160). Protocol 1 lacks a | 374 | integrity (hmac-md5, hmac-sha1, hmac-ripemd160). Protocol 1 lacks a |
369 | strong mechanism for ensuring the integrity of the connection. | 375 | strong mechanism for ensuring the integrity of the connection. |
370 | 376 | ||
371 | The methods available for authentication are: host-based authentication, | 377 | The methods available for authentication are: GSSAPI-based authentica- |
372 | public key authentication, challenge-response authentication, and pass- | 378 | tion, host-based authentication, public key authentication, challenge-re- |
373 | word authentication. Authentication methods are tried in the order spec- | 379 | sponse authentication, and password authentication. Authentication meth- |
374 | ified above, though protocol 2 has a configuration option to change the | 380 | ods are tried in the order specified above, though protocol 2 has a con- |
375 | default order: PreferredAuthentications. | 381 | figuration option to change the default order: PreferredAuthentications. |
376 | 382 | ||
377 | Host-based authentication works as follows: If the machine the user logs | 383 | Host-based authentication works as follows: If the machine the user logs |
378 | in from is listed in /etc/hosts.equiv or /etc/shosts.equiv on the remote | 384 | in from is listed in /etc/hosts.equiv or /etc/shosts.equiv on the remote |
@@ -487,8 +493,8 @@ ESCAPE CHARACTERS | |||
487 | ~C Open command line. Currently this allows the addition of port | 493 | ~C Open command line. Currently this allows the addition of port |
488 | forwardings using the -L and -R options (see above). It also al- | 494 | forwardings using the -L and -R options (see above). It also al- |
489 | lows the cancellation of existing remote port-forwardings using | 495 | lows the cancellation of existing remote port-forwardings using |
490 | -KR hostport. !command allows the user to execute a local com- | 496 | -KR[bind_address:]port. !command allows the user to execute a |
491 | mand if the PermitLocalCommand option is enabled in | 497 | local command if the PermitLocalCommand option is enabled in |
492 | ssh_config(5). Basic help is available, using the -h option. | 498 | ssh_config(5). Basic help is available, using the -h option. |
493 | 499 | ||
494 | ~R Request rekeying of the connection (only useful for SSH protocol | 500 | ~R Request rekeying of the connection (only useful for SSH protocol |
@@ -573,8 +579,7 @@ VERIFYING HOST KEYS | |||
573 | ``host.example.com''. The SSHFP resource records should first be added | 579 | ``host.example.com''. The SSHFP resource records should first be added |
574 | to the zonefile for host.example.com: | 580 | to the zonefile for host.example.com: |
575 | 581 | ||
576 | $ ssh-keygen -f /etc/ssh/ssh_host_rsa_key.pub -r host.example.com. | 582 | $ ssh-keygen -r host.example.com. |
577 | $ ssh-keygen -f /etc/ssh/ssh_host_dsa_key.pub -r host.example.com. | ||
578 | 583 | ||
579 | The output lines will have to be added to the zonefile. To check that | 584 | The output lines will have to be added to the zonefile. To check that |
580 | the zone is answering fingerprint queries: | 585 | the zone is answering fingerprint queries: |
@@ -598,24 +603,34 @@ SSH-BASED VIRTUAL PRIVATE NETWORKS | |||
598 | fic). | 603 | fic). |
599 | 604 | ||
600 | The following example would connect client network 10.0.50.0/24 with re- | 605 | The following example would connect client network 10.0.50.0/24 with re- |
601 | mote network 10.0.99.0/24, provided that the SSH server running on the | 606 | mote network 10.0.99.0/24 using a point-to-point connection from 10.1.1.1 |
602 | gateway to the remote network, at 192.168.1.15, allows it: | 607 | to 10.1.1.2, provided that the SSH server running on the gateway to the |
608 | remote network, at 192.168.1.15, allows it. | ||
609 | |||
610 | On the client: | ||
603 | 611 | ||
604 | # ssh -f -w 0:1 192.168.1.15 true | 612 | # ssh -f -w 0:1 192.168.1.15 true |
605 | # ifconfig tun0 10.0.50.1 10.0.99.1 netmask 255.255.255.252 | 613 | # ifconfig tun0 10.1.1.1 10.1.1.2 netmask 255.255.255.252 |
614 | # route add 10.0.99.0/24 10.1.1.2 | ||
615 | |||
616 | On the server: | ||
617 | |||
618 | # ifconfig tun1 10.1.1.2 10.1.1.1 netmask 255.255.255.252 | ||
619 | # route add 10.0.50.0/24 10.1.1.1 | ||
606 | 620 | ||
607 | Client access may be more finely tuned via the /root/.ssh/authorized_keys | 621 | Client access may be more finely tuned via the /root/.ssh/authorized_keys |
608 | file (see below) and the PermitRootLogin server option. The following | 622 | file (see below) and the PermitRootLogin server option. The following |
609 | entry would permit connections on the first tun(4) device from user | 623 | entry would permit connections on tun(4) device 1 from user ``jane'' and |
610 | ``jane'' and on the second device from user ``john'', if PermitRootLogin | 624 | on tun device 2 from user ``john'', if PermitRootLogin is set to |
611 | is set to ``forced-commands-only'': | 625 | ``forced-commands-only'': |
612 | 626 | ||
613 | tunnel="1",command="sh /etc/netstart tun1" ssh-rsa ... jane | 627 | tunnel="1",command="sh /etc/netstart tun1" ssh-rsa ... jane |
614 | tunnel="2",command="sh /etc/netstart tun1" ssh-rsa ... john | 628 | tunnel="2",command="sh /etc/netstart tun2" ssh-rsa ... john |
615 | 629 | ||
616 | Since a SSH-based setup entails a fair amount of overhead, it may be more | 630 | Since an SSH-based setup entails a fair amount of overhead, it may be |
617 | suited to temporary setups, such as for wireless VPNs. More permanent | 631 | more suited to temporary setups, such as for wireless VPNs. More perma- |
618 | VPNs are better provided by tools such as ipsecctl(8) and isakmpd(8). | 632 | nent VPNs are better provided by tools such as ipsecctl(8) and |
633 | isakmpd(8). | ||
619 | 634 | ||
620 | ENVIRONMENT | 635 | ENVIRONMENT |
621 | ssh will normally set the following environment variables: | 636 | ssh will normally set the following environment variables: |
@@ -671,8 +686,8 @@ ENVIRONMENT | |||
671 | 686 | ||
672 | TZ This variable is set to indicate the present time | 687 | TZ This variable is set to indicate the present time |
673 | zone if it was set when the daemon was started | 688 | zone if it was set when the daemon was started |
674 | (i.e., the daemon passes the value on to new con- | 689 | (i.e. the daemon passes the value on to new connec- |
675 | nections). | 690 | tions). |
676 | 691 | ||
677 | USER Set to the name of the user logging in. | 692 | USER Set to the name of the user logging in. |
678 | 693 | ||
@@ -779,9 +794,33 @@ SEE ALSO | |||
779 | scp(1), sftp(1), ssh-add(1), ssh-agent(1), ssh-keygen(1), ssh-keyscan(1), | 794 | scp(1), sftp(1), ssh-add(1), ssh-agent(1), ssh-keygen(1), ssh-keyscan(1), |
780 | tun(4), hosts.equiv(5), ssh_config(5), ssh-keysign(8), sshd(8) | 795 | tun(4), hosts.equiv(5), ssh_config(5), ssh-keysign(8), sshd(8) |
781 | 796 | ||
782 | T. Ylonen, T. Kivinen, M. Saarinen, T. Rinne, and S. Lehtinen, SSH | 797 | The Secure Shell (SSH) Protocol Assigned Numbers, RFC 4250, 2006. |
783 | Protocol Architecture, draft-ietf-secsh-architecture-12.txt, January | 798 | |
784 | 2002, work in progress material. | 799 | The Secure Shell (SSH) Protocol Architecture, RFC 4251, 2006. |
800 | |||
801 | The Secure Shell (SSH) Authentication Protocol, RFC 4252, 2006. | ||
802 | |||
803 | The Secure Shell (SSH) Transport Layer Protocol, RFC 4253, 2006. | ||
804 | |||
805 | The Secure Shell (SSH) Connection Protocol, RFC 4254, 2006. | ||
806 | |||
807 | Using DNS to Securely Publish Secure Shell (SSH) Key Fingerprints, RFC | ||
808 | 4255, 2006. | ||
809 | |||
810 | Generic Message Exchange Authentication for the Secure Shell Protocol | ||
811 | (SSH), RFC 4256, 2006. | ||
812 | |||
813 | The Secure Shell (SSH) Session Channel Break Extension, RFC 4335, 2006. | ||
814 | |||
815 | The Secure Shell (SSH) Transport Layer Encryption Modes, RFC 4344, 2006. | ||
816 | |||
817 | Improved Arcfour Modes for the Secure Shell (SSH) Transport Layer | ||
818 | Protocol, RFC 4345, 2006. | ||
819 | |||
820 | Diffie-Hellman Group Exchange for the Secure Shell (SSH) Transport Layer | ||
821 | Protocol, RFC 4419, 2006. | ||
822 | |||
823 | The Secure Shell (SSH) Public Key File Format, RFC 4716, 2006. | ||
785 | 824 | ||
786 | AUTHORS | 825 | AUTHORS |
787 | OpenSSH is a derivative of the original and free ssh 1.2.12 release by | 826 | OpenSSH is a derivative of the original and free ssh 1.2.12 release by |
@@ -790,4 +829,4 @@ AUTHORS | |||
790 | created OpenSSH. Markus Friedl contributed the support for SSH protocol | 829 | created OpenSSH. Markus Friedl contributed the support for SSH protocol |
791 | versions 1.5 and 2.0. | 830 | versions 1.5 and 2.0. |
792 | 831 | ||
793 | OpenBSD 3.9 September 25, 1999 12 | 832 | OpenBSD 4.1 September 25, 1999 13 |
@@ -34,7 +34,7 @@ | |||
34 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 34 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
35 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 35 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
36 | .\" | 36 | .\" |
37 | .\" $OpenBSD: ssh.1,v 1.253 2006/01/30 13:37:49 jmc Exp $ | 37 | .\" $OpenBSD: ssh.1,v 1.266 2006/12/11 21:25:46 markus Exp $ |
38 | .Dd September 25, 1999 | 38 | .Dd September 25, 1999 |
39 | .Dt SSH 1 | 39 | .Dt SSH 1 |
40 | .Os | 40 | .Os |
@@ -78,7 +78,8 @@ | |||
78 | .Oc | 78 | .Oc |
79 | .Op Fl S Ar ctl_path | 79 | .Op Fl S Ar ctl_path |
80 | .Bk -words | 80 | .Bk -words |
81 | .Op Fl w Ar tunnel : Ns Ar tunnel | 81 | .Oo Fl w Ar local_tun Ns |
82 | .Op : Ns Ar remote_tun Oc | ||
82 | .Oo Ar user Ns @ Oc Ns Ar hostname | 83 | .Oo Ar user Ns @ Oc Ns Ar hostname |
83 | .Op Ar command | 84 | .Op Ar command |
84 | .Ek | 85 | .Ek |
@@ -450,6 +451,7 @@ For full details of the options listed below, and their possible values, see | |||
450 | .It ControlPath | 451 | .It ControlPath |
451 | .It DynamicForward | 452 | .It DynamicForward |
452 | .It EscapeChar | 453 | .It EscapeChar |
454 | .It ExitOnForwardFailure | ||
453 | .It ForwardAgent | 455 | .It ForwardAgent |
454 | .It ForwardX11 | 456 | .It ForwardX11 |
455 | .It ForwardX11Trusted | 457 | .It ForwardX11Trusted |
@@ -575,7 +577,7 @@ Disable pseudo-tty allocation. | |||
575 | Force pseudo-tty allocation. | 577 | Force pseudo-tty allocation. |
576 | This can be used to execute arbitrary | 578 | This can be used to execute arbitrary |
577 | screen-based programs on a remote machine, which can be very useful, | 579 | screen-based programs on a remote machine, which can be very useful, |
578 | e.g., when implementing menu services. | 580 | e.g. when implementing menu services. |
579 | Multiple | 581 | Multiple |
580 | .Fl t | 582 | .Fl t |
581 | options force tty allocation, even if | 583 | options force tty allocation, even if |
@@ -594,24 +596,35 @@ Multiple | |||
594 | .Fl v | 596 | .Fl v |
595 | options increase the verbosity. | 597 | options increase the verbosity. |
596 | The maximum is 3. | 598 | The maximum is 3. |
597 | .It Fl w Ar tunnel : Ns Ar tunnel | 599 | .It Fl w Xo |
598 | Requests a | 600 | .Ar local_tun Ns Op : Ns Ar remote_tun |
601 | .Xc | ||
602 | Requests | ||
603 | tunnel | ||
604 | device forwarding with the specified | ||
599 | .Xr tun 4 | 605 | .Xr tun 4 |
600 | device on the client | 606 | devices between the client |
601 | (first | 607 | .Pq Ar local_tun |
602 | .Ar tunnel | 608 | and the server |
603 | arg) | 609 | .Pq Ar remote_tun . |
604 | and server | 610 | .Pp |
605 | (second | ||
606 | .Ar tunnel | ||
607 | arg). | ||
608 | The devices may be specified by numerical ID or the keyword | 611 | The devices may be specified by numerical ID or the keyword |
609 | .Dq any , | 612 | .Dq any , |
610 | which uses the next available tunnel device. | 613 | which uses the next available tunnel device. |
614 | If | ||
615 | .Ar remote_tun | ||
616 | is not specified, it defaults to | ||
617 | .Dq any . | ||
611 | See also the | 618 | See also the |
612 | .Cm Tunnel | 619 | .Cm Tunnel |
613 | directive in | 620 | and |
621 | .Cm TunnelDevice | ||
622 | directives in | ||
614 | .Xr ssh_config 5 . | 623 | .Xr ssh_config 5 . |
624 | If the | ||
625 | .Cm Tunnel | ||
626 | directive is unset, it is set to the default tunnel mode, which is | ||
627 | .Dq point-to-point . | ||
615 | .It Fl X | 628 | .It Fl X |
616 | Enables X11 forwarding. | 629 | Enables X11 forwarding. |
617 | This can also be specified on a per-host basis in a configuration file. | 630 | This can also be specified on a per-host basis in a configuration file. |
@@ -672,6 +685,7 @@ Protocol 1 lacks a strong mechanism for ensuring the | |||
672 | integrity of the connection. | 685 | integrity of the connection. |
673 | .Pp | 686 | .Pp |
674 | The methods available for authentication are: | 687 | The methods available for authentication are: |
688 | GSSAPI-based authentication, | ||
675 | host-based authentication, | 689 | host-based authentication, |
676 | public key authentication, | 690 | public key authentication, |
677 | challenge-response authentication, | 691 | challenge-response authentication, |
@@ -878,7 +892,9 @@ and | |||
878 | options (see above). | 892 | options (see above). |
879 | It also allows the cancellation of existing remote port-forwardings | 893 | It also allows the cancellation of existing remote port-forwardings |
880 | using | 894 | using |
881 | .Fl KR Ar hostport . | 895 | .Sm off |
896 | .Fl KR Oo Ar bind_address : Oc Ar port . | ||
897 | .Sm on | ||
882 | .Ic !\& Ns Ar command | 898 | .Ic !\& Ns Ar command |
883 | allows the user to execute a local command if the | 899 | allows the user to execute a local command if the |
884 | .Ic PermitLocalCommand | 900 | .Ic PermitLocalCommand |
@@ -1031,8 +1047,7 @@ In this example, we are connecting a client to a server, | |||
1031 | The SSHFP resource records should first be added to the zonefile for | 1047 | The SSHFP resource records should first be added to the zonefile for |
1032 | host.example.com: | 1048 | host.example.com: |
1033 | .Bd -literal -offset indent | 1049 | .Bd -literal -offset indent |
1034 | $ ssh-keygen -f /etc/ssh/ssh_host_rsa_key.pub -r host.example.com. | 1050 | $ ssh-keygen -r host.example.com. |
1035 | $ ssh-keygen -f /etc/ssh/ssh_host_dsa_key.pub -r host.example.com. | ||
1036 | .Ed | 1051 | .Ed |
1037 | .Pp | 1052 | .Pp |
1038 | The output lines will have to be added to the zonefile. | 1053 | The output lines will have to be added to the zonefile. |
@@ -1068,12 +1083,22 @@ controls whether the server supports this, | |||
1068 | and at what level (layer 2 or 3 traffic). | 1083 | and at what level (layer 2 or 3 traffic). |
1069 | .Pp | 1084 | .Pp |
1070 | The following example would connect client network 10.0.50.0/24 | 1085 | The following example would connect client network 10.0.50.0/24 |
1071 | with remote network 10.0.99.0/24, provided that the SSH server | 1086 | with remote network 10.0.99.0/24 using a point-to-point connection |
1072 | running on the gateway to the remote network, | 1087 | from 10.1.1.1 to 10.1.1.2, |
1073 | at 192.168.1.15, allows it: | 1088 | provided that the SSH server running on the gateway to the remote network, |
1089 | at 192.168.1.15, allows it. | ||
1090 | .Pp | ||
1091 | On the client: | ||
1074 | .Bd -literal -offset indent | 1092 | .Bd -literal -offset indent |
1075 | # ssh -f -w 0:1 192.168.1.15 true | 1093 | # ssh -f -w 0:1 192.168.1.15 true |
1076 | # ifconfig tun0 10.0.50.1 10.0.99.1 netmask 255.255.255.252 | 1094 | # ifconfig tun0 10.1.1.1 10.1.1.2 netmask 255.255.255.252 |
1095 | # route add 10.0.99.0/24 10.1.1.2 | ||
1096 | .Ed | ||
1097 | .Pp | ||
1098 | On the server: | ||
1099 | .Bd -literal -offset indent | ||
1100 | # ifconfig tun1 10.1.1.2 10.1.1.1 netmask 255.255.255.252 | ||
1101 | # route add 10.0.50.0/24 10.1.1.1 | ||
1077 | .Ed | 1102 | .Ed |
1078 | .Pp | 1103 | .Pp |
1079 | Client access may be more finely tuned via the | 1104 | Client access may be more finely tuned via the |
@@ -1081,11 +1106,11 @@ Client access may be more finely tuned via the | |||
1081 | file (see below) and the | 1106 | file (see below) and the |
1082 | .Cm PermitRootLogin | 1107 | .Cm PermitRootLogin |
1083 | server option. | 1108 | server option. |
1084 | The following entry would permit connections on the first | 1109 | The following entry would permit connections on |
1085 | .Xr tun 4 | 1110 | .Xr tun 4 |
1086 | device from user | 1111 | device 1 from user |
1087 | .Dq jane | 1112 | .Dq jane |
1088 | and on the second device from user | 1113 | and on tun device 2 from user |
1089 | .Dq john , | 1114 | .Dq john , |
1090 | if | 1115 | if |
1091 | .Cm PermitRootLogin | 1116 | .Cm PermitRootLogin |
@@ -1093,10 +1118,10 @@ is set to | |||
1093 | .Dq forced-commands-only : | 1118 | .Dq forced-commands-only : |
1094 | .Bd -literal -offset 2n | 1119 | .Bd -literal -offset 2n |
1095 | tunnel="1",command="sh /etc/netstart tun1" ssh-rsa ... jane | 1120 | tunnel="1",command="sh /etc/netstart tun1" ssh-rsa ... jane |
1096 | tunnel="2",command="sh /etc/netstart tun1" ssh-rsa ... john | 1121 | tunnel="2",command="sh /etc/netstart tun2" ssh-rsa ... john |
1097 | .Ed | 1122 | .Ed |
1098 | .Pp | 1123 | .Pp |
1099 | Since a SSH-based setup entails a fair amount of overhead, | 1124 | Since an SSH-based setup entails a fair amount of overhead, |
1100 | it may be more suited to temporary setups, | 1125 | it may be more suited to temporary setups, |
1101 | such as for wireless VPNs. | 1126 | such as for wireless VPNs. |
1102 | More permanent VPNs are better provided by tools such as | 1127 | More permanent VPNs are better provided by tools such as |
@@ -1184,7 +1209,7 @@ If the current session has no tty, | |||
1184 | this variable is not set. | 1209 | this variable is not set. |
1185 | .It Ev TZ | 1210 | .It Ev TZ |
1186 | This variable is set to indicate the present time zone if it | 1211 | This variable is set to indicate the present time zone if it |
1187 | was set when the daemon was started (i.e., the daemon passes the value | 1212 | was set when the daemon was started (i.e. the daemon passes the value |
1188 | on to new connections). | 1213 | on to new connections). |
1189 | .It Ev USER | 1214 | .It Ev USER |
1190 | Set to the name of the user logging in. | 1215 | Set to the name of the user logging in. |
@@ -1348,15 +1373,64 @@ manual page for more information. | |||
1348 | .Xr ssh-keysign 8 , | 1373 | .Xr ssh-keysign 8 , |
1349 | .Xr sshd 8 | 1374 | .Xr sshd 8 |
1350 | .Rs | 1375 | .Rs |
1351 | .%A T. Ylonen | 1376 | .%R RFC 4250 |
1352 | .%A T. Kivinen | 1377 | .%T "The Secure Shell (SSH) Protocol Assigned Numbers" |
1353 | .%A M. Saarinen | 1378 | .%D 2006 |
1354 | .%A T. Rinne | 1379 | .Re |
1355 | .%A S. Lehtinen | 1380 | .Rs |
1356 | .%T "SSH Protocol Architecture" | 1381 | .%R RFC 4251 |
1357 | .%N draft-ietf-secsh-architecture-12.txt | 1382 | .%T "The Secure Shell (SSH) Protocol Architecture" |
1358 | .%D January 2002 | 1383 | .%D 2006 |
1359 | .%O work in progress material | 1384 | .Re |
1385 | .Rs | ||
1386 | .%R RFC 4252 | ||
1387 | .%T "The Secure Shell (SSH) Authentication Protocol" | ||
1388 | .%D 2006 | ||
1389 | .Re | ||
1390 | .Rs | ||
1391 | .%R RFC 4253 | ||
1392 | .%T "The Secure Shell (SSH) Transport Layer Protocol" | ||
1393 | .%D 2006 | ||
1394 | .Re | ||
1395 | .Rs | ||
1396 | .%R RFC 4254 | ||
1397 | .%T "The Secure Shell (SSH) Connection Protocol" | ||
1398 | .%D 2006 | ||
1399 | .Re | ||
1400 | .Rs | ||
1401 | .%R RFC 4255 | ||
1402 | .%T "Using DNS to Securely Publish Secure Shell (SSH) Key Fingerprints" | ||
1403 | .%D 2006 | ||
1404 | .Re | ||
1405 | .Rs | ||
1406 | .%R RFC 4256 | ||
1407 | .%T "Generic Message Exchange Authentication for the Secure Shell Protocol (SSH)" | ||
1408 | .%D 2006 | ||
1409 | .Re | ||
1410 | .Rs | ||
1411 | .%R RFC 4335 | ||
1412 | .%T "The Secure Shell (SSH) Session Channel Break Extension" | ||
1413 | .%D 2006 | ||
1414 | .Re | ||
1415 | .Rs | ||
1416 | .%R RFC 4344 | ||
1417 | .%T "The Secure Shell (SSH) Transport Layer Encryption Modes" | ||
1418 | .%D 2006 | ||
1419 | .Re | ||
1420 | .Rs | ||
1421 | .%R RFC 4345 | ||
1422 | .%T "Improved Arcfour Modes for the Secure Shell (SSH) Transport Layer Protocol" | ||
1423 | .%D 2006 | ||
1424 | .Re | ||
1425 | .Rs | ||
1426 | .%R RFC 4419 | ||
1427 | .%T "Diffie-Hellman Group Exchange for the Secure Shell (SSH) Transport Layer Protocol" | ||
1428 | .%D 2006 | ||
1429 | .Re | ||
1430 | .Rs | ||
1431 | .%R RFC 4716 | ||
1432 | .%T "The Secure Shell (SSH) Public Key File Format" | ||
1433 | .%D 2006 | ||
1360 | .Re | 1434 | .Re |
1361 | .Sh AUTHORS | 1435 | .Sh AUTHORS |
1362 | OpenSSH is a derivative of the original and free | 1436 | OpenSSH is a derivative of the original and free |
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: ssh.c,v 1.295 2007/01/03 03:01:40 stevesk Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -40,20 +41,46 @@ | |||
40 | */ | 41 | */ |
41 | 42 | ||
42 | #include "includes.h" | 43 | #include "includes.h" |
43 | RCSID("$OpenBSD: ssh.c,v 1.257 2005/12/20 04:41:07 dtucker Exp $"); | 44 | |
45 | #include <sys/types.h> | ||
46 | #ifdef HAVE_SYS_STAT_H | ||
47 | # include <sys/stat.h> | ||
48 | #endif | ||
49 | #include <sys/resource.h> | ||
50 | #include <sys/ioctl.h> | ||
51 | #include <sys/socket.h> | ||
52 | #include <sys/un.h> | ||
53 | |||
54 | #include <ctype.h> | ||
55 | #include <errno.h> | ||
56 | #include <fcntl.h> | ||
57 | #include <netdb.h> | ||
58 | #ifdef HAVE_PATHS_H | ||
59 | #include <paths.h> | ||
60 | #endif | ||
61 | #include <pwd.h> | ||
62 | #include <signal.h> | ||
63 | #include <stdarg.h> | ||
64 | #include <stddef.h> | ||
65 | #include <stdio.h> | ||
66 | #include <stdlib.h> | ||
67 | #include <string.h> | ||
68 | #include <unistd.h> | ||
69 | |||
70 | #include <netinet/in.h> | ||
71 | #include <arpa/inet.h> | ||
44 | 72 | ||
45 | #include <openssl/evp.h> | 73 | #include <openssl/evp.h> |
46 | #include <openssl/err.h> | 74 | #include <openssl/err.h> |
47 | 75 | ||
76 | #include "xmalloc.h" | ||
48 | #include "ssh.h" | 77 | #include "ssh.h" |
49 | #include "ssh1.h" | 78 | #include "ssh1.h" |
50 | #include "ssh2.h" | 79 | #include "ssh2.h" |
51 | #include "compat.h" | 80 | #include "compat.h" |
52 | #include "cipher.h" | 81 | #include "cipher.h" |
53 | #include "xmalloc.h" | ||
54 | #include "packet.h" | 82 | #include "packet.h" |
55 | #include "buffer.h" | 83 | #include "buffer.h" |
56 | #include "bufaux.h" | ||
57 | #include "channels.h" | 84 | #include "channels.h" |
58 | #include "key.h" | 85 | #include "key.h" |
59 | #include "authfd.h" | 86 | #include "authfd.h" |
@@ -72,6 +99,7 @@ RCSID("$OpenBSD: ssh.c,v 1.257 2005/12/20 04:41:07 dtucker Exp $"); | |||
72 | #include "msg.h" | 99 | #include "msg.h" |
73 | #include "monitor_fdpass.h" | 100 | #include "monitor_fdpass.h" |
74 | #include "uidswap.h" | 101 | #include "uidswap.h" |
102 | #include "version.h" | ||
75 | 103 | ||
76 | #ifdef SMARTCARD | 104 | #ifdef SMARTCARD |
77 | #include "scard.h" | 105 | #include "scard.h" |
@@ -162,7 +190,7 @@ usage(void) | |||
162 | " [-i identity_file] [-L [bind_address:]port:host:hostport]\n" | 190 | " [-i identity_file] [-L [bind_address:]port:host:hostport]\n" |
163 | " [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]\n" | 191 | " [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]\n" |
164 | " [-R [bind_address:]port:host:hostport] [-S ctl_path]\n" | 192 | " [-R [bind_address:]port:host:hostport] [-S ctl_path]\n" |
165 | " [-w tunnel:tunnel] [user@]hostname [command]\n" | 193 | " [-w local_tun[:remote_tun]] [user@]hostname [command]\n" |
166 | ); | 194 | ); |
167 | exit(255); | 195 | exit(255); |
168 | } | 196 | } |
@@ -242,7 +270,7 @@ main(int ac, char **av) | |||
242 | /* Parse command-line arguments. */ | 270 | /* Parse command-line arguments. */ |
243 | host = NULL; | 271 | host = NULL; |
244 | 272 | ||
245 | again: | 273 | again: |
246 | while ((opt = getopt(ac, av, | 274 | while ((opt = getopt(ac, av, |
247 | "1246ab:c:e:fgi:kl:m:no:p:qstvxACD:F:I:KL:MNO:PR:S:TVw:XY")) != -1) { | 275 | "1246ab:c:e:fgi:kl:m:no:p:qstvxACD:F:I:KL:MNO:PR:S:TVw:XY")) != -1) { |
248 | switch (opt) { | 276 | switch (opt) { |
@@ -594,7 +622,7 @@ again: | |||
594 | if (!read_config_file(config, host, &options, 0)) | 622 | if (!read_config_file(config, host, &options, 0)) |
595 | fatal("Can't open user config file %.100s: " | 623 | fatal("Can't open user config file %.100s: " |
596 | "%.100s", config, strerror(errno)); | 624 | "%.100s", config, strerror(errno)); |
597 | } else { | 625 | } else { |
598 | snprintf(buf, sizeof buf, "%.100s/%.100s", pw->pw_dir, | 626 | snprintf(buf, sizeof buf, "%.100s/%.100s", pw->pw_dir, |
599 | _PATH_SSH_USER_CONFFILE); | 627 | _PATH_SSH_USER_CONFFILE); |
600 | (void)read_config_file(buf, host, &options, 1); | 628 | (void)read_config_file(buf, host, &options, 1); |
@@ -624,7 +652,7 @@ again: | |||
624 | if (options.host_key_alias != NULL) { | 652 | if (options.host_key_alias != NULL) { |
625 | for (p = options.host_key_alias; *p; p++) | 653 | for (p = options.host_key_alias; *p; p++) |
626 | if (isupper(*p)) | 654 | if (isupper(*p)) |
627 | *p = tolower(*p); | 655 | *p = (char)tolower(*p); |
628 | } | 656 | } |
629 | 657 | ||
630 | /* Get default port if port has not been set. */ | 658 | /* Get default port if port has not been set. */ |
@@ -641,11 +669,15 @@ again: | |||
641 | options.control_path = NULL; | 669 | options.control_path = NULL; |
642 | 670 | ||
643 | if (options.control_path != NULL) { | 671 | if (options.control_path != NULL) { |
672 | char thishost[NI_MAXHOST]; | ||
673 | |||
674 | if (gethostname(thishost, sizeof(thishost)) == -1) | ||
675 | fatal("gethostname: %s", strerror(errno)); | ||
644 | snprintf(buf, sizeof(buf), "%d", options.port); | 676 | snprintf(buf, sizeof(buf), "%d", options.port); |
645 | cp = tilde_expand_filename(options.control_path, | 677 | cp = tilde_expand_filename(options.control_path, |
646 | original_real_uid); | 678 | original_real_uid); |
647 | options.control_path = percent_expand(cp, "p", buf, "h", host, | 679 | options.control_path = percent_expand(cp, "p", buf, "h", host, |
648 | "r", options.user, (char *)NULL); | 680 | "r", options.user, "l", thishost, (char *)NULL); |
649 | xfree(cp); | 681 | xfree(cp); |
650 | } | 682 | } |
651 | if (mux_command != 0 && options.control_path == NULL) | 683 | if (mux_command != 0 && options.control_path == NULL) |
@@ -678,16 +710,16 @@ again: | |||
678 | if (options.rhosts_rsa_authentication || | 710 | if (options.rhosts_rsa_authentication || |
679 | options.hostbased_authentication) { | 711 | options.hostbased_authentication) { |
680 | sensitive_data.nkeys = 3; | 712 | sensitive_data.nkeys = 3; |
681 | sensitive_data.keys = xmalloc(sensitive_data.nkeys * | 713 | sensitive_data.keys = xcalloc(sensitive_data.nkeys, |
682 | sizeof(Key)); | 714 | sizeof(Key)); |
683 | 715 | ||
684 | PRIV_START; | 716 | PRIV_START; |
685 | sensitive_data.keys[0] = key_load_private_type(KEY_RSA1, | 717 | sensitive_data.keys[0] = key_load_private_type(KEY_RSA1, |
686 | _PATH_HOST_KEY_FILE, "", NULL); | 718 | _PATH_HOST_KEY_FILE, "", NULL, NULL); |
687 | sensitive_data.keys[1] = key_load_private_type(KEY_DSA, | 719 | sensitive_data.keys[1] = key_load_private_type(KEY_DSA, |
688 | _PATH_HOST_DSA_KEY_FILE, "", NULL); | 720 | _PATH_HOST_DSA_KEY_FILE, "", NULL, NULL); |
689 | sensitive_data.keys[2] = key_load_private_type(KEY_RSA, | 721 | sensitive_data.keys[2] = key_load_private_type(KEY_RSA, |
690 | _PATH_HOST_RSA_KEY_FILE, "", NULL); | 722 | _PATH_HOST_RSA_KEY_FILE, "", NULL, NULL); |
691 | PRIV_END; | 723 | PRIV_END; |
692 | 724 | ||
693 | if (options.hostbased_authentication == 1 && | 725 | if (options.hostbased_authentication == 1 && |
@@ -803,6 +835,8 @@ ssh_init_forwarding(void) | |||
803 | options.local_forwards[i].connect_port, | 835 | options.local_forwards[i].connect_port, |
804 | options.gateway_ports); | 836 | options.gateway_ports); |
805 | } | 837 | } |
838 | if (i > 0 && success != i && options.exit_on_forward_failure) | ||
839 | fatal("Could not request local forwarding."); | ||
806 | if (i > 0 && success == 0) | 840 | if (i > 0 && success == 0) |
807 | error("Could not request local forwarding."); | 841 | error("Could not request local forwarding."); |
808 | 842 | ||
@@ -815,11 +849,17 @@ ssh_init_forwarding(void) | |||
815 | options.remote_forwards[i].listen_port, | 849 | options.remote_forwards[i].listen_port, |
816 | options.remote_forwards[i].connect_host, | 850 | options.remote_forwards[i].connect_host, |
817 | options.remote_forwards[i].connect_port); | 851 | options.remote_forwards[i].connect_port); |
818 | channel_request_remote_forwarding( | 852 | if (channel_request_remote_forwarding( |
819 | options.remote_forwards[i].listen_host, | 853 | options.remote_forwards[i].listen_host, |
820 | options.remote_forwards[i].listen_port, | 854 | options.remote_forwards[i].listen_port, |
821 | options.remote_forwards[i].connect_host, | 855 | options.remote_forwards[i].connect_host, |
822 | options.remote_forwards[i].connect_port); | 856 | options.remote_forwards[i].connect_port) < 0) { |
857 | if (options.exit_on_forward_failure) | ||
858 | fatal("Could not request remote forwarding."); | ||
859 | else | ||
860 | logit("Warning: Could not request remote " | ||
861 | "forwarding."); | ||
862 | } | ||
823 | } | 863 | } |
824 | } | 864 | } |
825 | 865 | ||
@@ -880,10 +920,10 @@ ssh_session(void) | |||
880 | /* Store window size in the packet. */ | 920 | /* Store window size in the packet. */ |
881 | if (ioctl(fileno(stdin), TIOCGWINSZ, &ws) < 0) | 921 | if (ioctl(fileno(stdin), TIOCGWINSZ, &ws) < 0) |
882 | memset(&ws, 0, sizeof(ws)); | 922 | memset(&ws, 0, sizeof(ws)); |
883 | packet_put_int(ws.ws_row); | 923 | packet_put_int((u_int)ws.ws_row); |
884 | packet_put_int(ws.ws_col); | 924 | packet_put_int((u_int)ws.ws_col); |
885 | packet_put_int(ws.ws_xpixel); | 925 | packet_put_int((u_int)ws.ws_xpixel); |
886 | packet_put_int(ws.ws_ypixel); | 926 | packet_put_int((u_int)ws.ws_ypixel); |
887 | 927 | ||
888 | /* Store tty modes in the packet. */ | 928 | /* Store tty modes in the packet. */ |
889 | tty_make_modes(fileno(stdin), NULL); | 929 | tty_make_modes(fileno(stdin), NULL); |
@@ -1001,9 +1041,16 @@ client_global_request_reply_fwd(int type, u_int32_t seq, void *ctxt) | |||
1001 | options.remote_forwards[i].listen_port, | 1041 | options.remote_forwards[i].listen_port, |
1002 | options.remote_forwards[i].connect_host, | 1042 | options.remote_forwards[i].connect_host, |
1003 | options.remote_forwards[i].connect_port); | 1043 | options.remote_forwards[i].connect_port); |
1004 | if (type == SSH2_MSG_REQUEST_FAILURE) | 1044 | if (type == SSH2_MSG_REQUEST_FAILURE) { |
1005 | logit("Warning: remote port forwarding failed for listen " | 1045 | if (options.exit_on_forward_failure) |
1006 | "port %d", options.remote_forwards[i].listen_port); | 1046 | fatal("Error: remote port forwarding failed for " |
1047 | "listen port %d", | ||
1048 | options.remote_forwards[i].listen_port); | ||
1049 | else | ||
1050 | logit("Warning: remote port forwarding failed for " | ||
1051 | "listen port %d", | ||
1052 | options.remote_forwards[i].listen_port); | ||
1053 | } | ||
1007 | } | 1054 | } |
1008 | 1055 | ||
1009 | static void | 1056 | static void |
@@ -1032,7 +1079,7 @@ ssh_control_listener(void) | |||
1032 | fatal("%s socket(): %s", __func__, strerror(errno)); | 1079 | fatal("%s socket(): %s", __func__, strerror(errno)); |
1033 | 1080 | ||
1034 | old_umask = umask(0177); | 1081 | old_umask = umask(0177); |
1035 | if (bind(control_fd, (struct sockaddr*)&addr, addr_len) == -1) { | 1082 | if (bind(control_fd, (struct sockaddr *)&addr, addr_len) == -1) { |
1036 | control_fd = -1; | 1083 | control_fd = -1; |
1037 | if (errno == EINVAL || errno == EADDRINUSE) | 1084 | if (errno == EINVAL || errno == EADDRINUSE) |
1038 | fatal("ControlSocket %s already exists", | 1085 | fatal("ControlSocket %s already exists", |
@@ -1184,15 +1231,16 @@ ssh_session2(void) | |||
1184 | static void | 1231 | static void |
1185 | load_public_identity_files(void) | 1232 | load_public_identity_files(void) |
1186 | { | 1233 | { |
1187 | char *filename; | 1234 | char *filename, *cp, thishost[NI_MAXHOST]; |
1188 | int i = 0; | 1235 | int i = 0; |
1189 | Key *public; | 1236 | Key *public; |
1237 | struct passwd *pw; | ||
1190 | #ifdef SMARTCARD | 1238 | #ifdef SMARTCARD |
1191 | Key **keys; | 1239 | Key **keys; |
1192 | 1240 | ||
1193 | if (options.smartcard_device != NULL && | 1241 | if (options.smartcard_device != NULL && |
1194 | options.num_identity_files < SSH_MAX_IDENTITY_FILES && | 1242 | options.num_identity_files < SSH_MAX_IDENTITY_FILES && |
1195 | (keys = sc_get_keys(options.smartcard_device, NULL)) != NULL ) { | 1243 | (keys = sc_get_keys(options.smartcard_device, NULL)) != NULL) { |
1196 | int count = 0; | 1244 | int count = 0; |
1197 | for (i = 0; keys[i] != NULL; i++) { | 1245 | for (i = 0; keys[i] != NULL; i++) { |
1198 | count++; | 1246 | count++; |
@@ -1210,9 +1258,18 @@ load_public_identity_files(void) | |||
1210 | xfree(keys); | 1258 | xfree(keys); |
1211 | } | 1259 | } |
1212 | #endif /* SMARTCARD */ | 1260 | #endif /* SMARTCARD */ |
1261 | if ((pw = getpwuid(original_real_uid)) == NULL) | ||
1262 | fatal("load_public_identity_files: getpwuid failed"); | ||
1263 | if (gethostname(thishost, sizeof(thishost)) == -1) | ||
1264 | fatal("load_public_identity_files: gethostname: %s", | ||
1265 | strerror(errno)); | ||
1213 | for (; i < options.num_identity_files; i++) { | 1266 | for (; i < options.num_identity_files; i++) { |
1214 | filename = tilde_expand_filename(options.identity_files[i], | 1267 | cp = tilde_expand_filename(options.identity_files[i], |
1215 | original_real_uid); | 1268 | original_real_uid); |
1269 | filename = percent_expand(cp, "d", pw->pw_dir, | ||
1270 | "u", pw->pw_name, "l", thishost, "h", host, | ||
1271 | "r", options.user, (char *)NULL); | ||
1272 | xfree(cp); | ||
1216 | public = key_load_public(filename, NULL); | 1273 | public = key_load_public(filename, NULL); |
1217 | debug("identity file %s type %d", filename, | 1274 | debug("identity file %s type %d", filename, |
1218 | public ? public->type : -1); | 1275 | public ? public->type : -1); |
@@ -1238,14 +1295,14 @@ control_client_sigrelay(int signo) | |||
1238 | static int | 1295 | static int |
1239 | env_permitted(char *env) | 1296 | env_permitted(char *env) |
1240 | { | 1297 | { |
1241 | int i; | 1298 | int i, ret; |
1242 | char name[1024], *cp; | 1299 | char name[1024], *cp; |
1243 | 1300 | ||
1244 | strlcpy(name, env, sizeof(name)); | 1301 | if ((cp = strchr(env, '=')) == NULL || cp == env) |
1245 | if ((cp = strchr(name, '=')) == NULL) | ||
1246 | return (0); | 1302 | return (0); |
1247 | 1303 | ret = snprintf(name, sizeof(name), "%.*s", (int)(cp - env), env); | |
1248 | *cp = '\0'; | 1304 | if (ret <= 0 || (size_t)ret >= sizeof(name)) |
1305 | fatal("env_permitted: name '%.100s...' too long", env); | ||
1249 | 1306 | ||
1250 | for (i = 0; i < options.num_send_env; i++) | 1307 | for (i = 0; i < options.num_send_env; i++) |
1251 | if (match_pattern(name, options.send_env[i])) | 1308 | if (match_pattern(name, options.send_env[i])) |
@@ -1290,29 +1347,29 @@ control_client(const char *path) | |||
1290 | if ((sock = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) | 1347 | if ((sock = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) |
1291 | fatal("%s socket(): %s", __func__, strerror(errno)); | 1348 | fatal("%s socket(): %s", __func__, strerror(errno)); |
1292 | 1349 | ||
1293 | if (connect(sock, (struct sockaddr*)&addr, addr_len) == -1) { | 1350 | if (connect(sock, (struct sockaddr *)&addr, addr_len) == -1) { |
1294 | if (mux_command != SSHMUX_COMMAND_OPEN) { | 1351 | if (mux_command != SSHMUX_COMMAND_OPEN) { |
1295 | fatal("Control socket connect(%.100s): %s", path, | 1352 | fatal("Control socket connect(%.100s): %s", path, |
1296 | strerror(errno)); | 1353 | strerror(errno)); |
1297 | } | 1354 | } |
1298 | if (errno == ENOENT) | 1355 | if (errno == ENOENT) |
1299 | debug("Control socket \"%.100s\" does not exist", path); | 1356 | debug("Control socket \"%.100s\" does not exist", path); |
1300 | else { | 1357 | else { |
1301 | error("Control socket connect(%.100s): %s", path, | 1358 | error("Control socket connect(%.100s): %s", path, |
1302 | strerror(errno)); | 1359 | strerror(errno)); |
1303 | } | 1360 | } |
1304 | close(sock); | 1361 | close(sock); |
1305 | return; | 1362 | return; |
1306 | } | 1363 | } |
1307 | 1364 | ||
1308 | if (stdin_null_flag) { | 1365 | if (stdin_null_flag) { |
1309 | if ((fd = open(_PATH_DEVNULL, O_RDONLY)) == -1) | 1366 | if ((fd = open(_PATH_DEVNULL, O_RDONLY)) == -1) |
1310 | fatal("open(/dev/null): %s", strerror(errno)); | 1367 | fatal("open(/dev/null): %s", strerror(errno)); |
1311 | if (dup2(fd, STDIN_FILENO) == -1) | 1368 | if (dup2(fd, STDIN_FILENO) == -1) |
1312 | fatal("dup2: %s", strerror(errno)); | 1369 | fatal("dup2: %s", strerror(errno)); |
1313 | if (fd > STDERR_FILENO) | 1370 | if (fd > STDERR_FILENO) |
1314 | close(fd); | 1371 | close(fd); |
1315 | } | 1372 | } |
1316 | 1373 | ||
1317 | term = getenv("TERM"); | 1374 | term = getenv("TERM"); |
1318 | 1375 | ||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh.h,v 1.76 2004/12/06 11:41:03 dtucker Exp $ */ | 1 | /* $OpenBSD: ssh.h,v 1.78 2006/08/03 03:34:42 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -12,18 +12,6 @@ | |||
12 | * called by a name other than "ssh" or "Secure Shell". | 12 | * called by a name other than "ssh" or "Secure Shell". |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #ifndef SSH_H | ||
16 | #define SSH_H | ||
17 | |||
18 | #include <netinet/in.h> /* For struct sockaddr_in */ | ||
19 | #include <pwd.h> /* For struct pw */ | ||
20 | #include <stdarg.h> /* For va_list */ | ||
21 | #include <syslog.h> /* For LOG_AUTH and friends */ | ||
22 | #include <sys/socket.h> /* For struct sockaddr_storage */ | ||
23 | #ifdef HAVE_SYS_SELECT_H | ||
24 | # include <sys/select.h> | ||
25 | #endif | ||
26 | |||
27 | /* Cipher used for encrypting authentication files. */ | 15 | /* Cipher used for encrypting authentication files. */ |
28 | #define SSH_AUTHFILE_CIPHER SSH_CIPHER_3DES | 16 | #define SSH_AUTHFILE_CIPHER SSH_CIPHER_3DES |
29 | 17 | ||
@@ -112,5 +100,3 @@ | |||
112 | 100 | ||
113 | /* Listen backlog for sshd, ssh-agent and forwarding sockets */ | 101 | /* Listen backlog for sshd, ssh-agent and forwarding sockets */ |
114 | #define SSH_LISTEN_BACKLOG 128 | 102 | #define SSH_LISTEN_BACKLOG 128 |
115 | |||
116 | #endif /* SSH_H */ | ||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh1.h,v 1.5 2004/10/20 11:48:53 markus Exp $ */ | 1 | /* $OpenBSD: ssh1.h,v 1.6 2006/03/25 22:22:43 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh2.h,v 1.9 2003/05/14 00:52:59 markus Exp $ */ | 1 | /* $OpenBSD: ssh2.h,v 1.10 2006/03/25 22:22:43 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
diff --git a/ssh_config b/ssh_config index 9a6614398..12bdb2b22 100644 --- a/ssh_config +++ b/ssh_config | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: ssh_config,v 1.21 2005/12/06 22:38:27 reyk Exp $ | 1 | # $OpenBSD: ssh_config,v 1.22 2006/05/29 12:56:33 dtucker Exp $ |
2 | 2 | ||
3 | # This is the ssh client system-wide configuration file. See | 3 | # This is the ssh client system-wide configuration file. See |
4 | # ssh_config(5) for more information. This file provides defaults for | 4 | # ssh_config(5) for more information. This file provides defaults for |
@@ -25,6 +25,10 @@ Host * | |||
25 | # RSAAuthentication yes | 25 | # RSAAuthentication yes |
26 | # PasswordAuthentication yes | 26 | # PasswordAuthentication yes |
27 | # HostbasedAuthentication no | 27 | # HostbasedAuthentication no |
28 | # GSSAPIAuthentication no | ||
29 | # GSSAPIDelegateCredentials no | ||
30 | # GSSAPIKeyExchange no | ||
31 | # GSSAPITrustDNS no | ||
28 | # BatchMode no | 32 | # BatchMode no |
29 | # CheckHostIP yes | 33 | # CheckHostIP yes |
30 | # AddressFamily any | 34 | # AddressFamily any |
diff --git a/ssh_config.0 b/ssh_config.0 index 46a0543c3..2ca4ee31b 100644 --- a/ssh_config.0 +++ b/ssh_config.0 | |||
@@ -8,8 +8,9 @@ SYNOPSIS | |||
8 | /etc/ssh/ssh_config | 8 | /etc/ssh/ssh_config |
9 | 9 | ||
10 | DESCRIPTION | 10 | DESCRIPTION |
11 | ssh obtains configuration data from the following sources in the follow- | 11 | ssh(1) obtains configuration data from the following sources in the fol- |
12 | ing order: | 12 | lowing order: |
13 | |||
13 | 1. command-line options | 14 | 1. command-line options |
14 | 2. user's configuration file (~/.ssh/config) | 15 | 2. user's configuration file (~/.ssh/config) |
15 | 3. system-wide configuration file (/etc/ssh/ssh_config) | 16 | 3. system-wide configuration file (/etc/ssh/ssh_config) |
@@ -26,28 +27,29 @@ DESCRIPTION | |||
26 | 27 | ||
27 | The configuration file has the following format: | 28 | The configuration file has the following format: |
28 | 29 | ||
29 | Empty lines and lines starting with `#' are comments. | 30 | Empty lines and lines starting with `#' are comments. Otherwise a line |
30 | 31 | is of the format ``keyword arguments''. Configuration options may be | |
31 | Otherwise a line is of the format ``keyword arguments''. Configuration | 32 | separated by whitespace or optional whitespace and exactly one `='; the |
32 | options may be separated by whitespace or optional whitespace and exactly | 33 | latter format is useful to avoid the need to quote whitespace when speci- |
33 | one `='; the latter format is useful to avoid the need to quote whites- | 34 | fying configuration options using the ssh, scp, and sftp -o option. Ar- |
34 | pace when specifying configuration options using the ssh, scp and sftp -o | 35 | guments may optionally be enclosed in double quotes (") in order to rep- |
35 | option. | 36 | resent arguments containing spaces. |
36 | 37 | ||
37 | The possible keywords and their meanings are as follows (note that key- | 38 | The possible keywords and their meanings are as follows (note that key- |
38 | words are case-insensitive and arguments are case-sensitive): | 39 | words are case-insensitive and arguments are case-sensitive): |
39 | 40 | ||
40 | Host Restricts the following declarations (up to the next Host key- | 41 | Host Restricts the following declarations (up to the next Host key- |
41 | word) to be only for those hosts that match one of the patterns | 42 | word) to be only for those hosts that match one of the patterns |
42 | given after the keyword. `*' and `?' can be used as wildcards in | 43 | given after the keyword. A single `*' as a pattern can be used |
43 | the patterns. A single `*' as a pattern can be used to provide | 44 | to provide global defaults for all hosts. The host is the |
44 | global defaults for all hosts. The host is the hostname argument | 45 | hostname argument given on the command line (i.e. the name is not |
45 | given on the command line (i.e., the name is not converted to a | 46 | converted to a canonicalized host name before matching). |
46 | canonicalized host name before matching). | 47 | |
48 | See PATTERNS for more information on patterns. | ||
47 | 49 | ||
48 | AddressFamily | 50 | AddressFamily |
49 | Specifies which address family to use when connecting. Valid ar- | 51 | Specifies which address family to use when connecting. Valid ar- |
50 | guments are ``any'', ``inet'' (use IPv4 only) or ``inet6'' (use | 52 | guments are ``any'', ``inet'' (use IPv4 only), or ``inet6'' (use |
51 | IPv6 only). | 53 | IPv6 only). |
52 | 54 | ||
53 | BatchMode | 55 | BatchMode |
@@ -63,23 +65,23 @@ DESCRIPTION | |||
63 | UsePrivilegedPort is set to ``yes''. | 65 | UsePrivilegedPort is set to ``yes''. |
64 | 66 | ||
65 | ChallengeResponseAuthentication | 67 | ChallengeResponseAuthentication |
66 | Specifies whether to use challenge response authentication. The | 68 | Specifies whether to use challenge-response authentication. The |
67 | argument to this keyword must be ``yes'' or ``no''. The default | 69 | argument to this keyword must be ``yes'' or ``no''. The default |
68 | is ``yes''. | 70 | is ``yes''. |
69 | 71 | ||
70 | CheckHostIP | 72 | CheckHostIP |
71 | If this flag is set to ``yes'', ssh will additionally check the | 73 | If this flag is set to ``yes'', ssh(1) will additionally check |
72 | host IP address in the known_hosts file. This allows ssh to de- | 74 | the host IP address in the known_hosts file. This allows ssh to |
73 | tect if a host key changed due to DNS spoofing. If the option is | 75 | detect if a host key changed due to DNS spoofing. If the option |
74 | set to ``no'', the check will not be executed. The default is | 76 | is set to ``no'', the check will not be executed. The default is |
75 | ``yes''. | 77 | ``yes''. |
76 | 78 | ||
77 | Cipher Specifies the cipher to use for encrypting the session in proto- | 79 | Cipher Specifies the cipher to use for encrypting the session in proto- |
78 | col version 1. Currently, ``blowfish'', ``3des'', and ``des'' | 80 | col version 1. Currently, ``blowfish'', ``3des'', and ``des'' |
79 | are supported. des is only supported in the ssh client for in- | 81 | are supported. des is only supported in the ssh(1) client for |
80 | teroperability with legacy protocol 1 implementations that do not | 82 | interoperability with legacy protocol 1 implementations that do |
81 | support the 3des cipher. Its use is strongly discouraged due to | 83 | not support the 3des cipher. Its use is strongly discouraged due |
82 | cryptographic weaknesses. The default is ``3des''. | 84 | to cryptographic weaknesses. The default is ``3des''. |
83 | 85 | ||
84 | Ciphers | 86 | Ciphers |
85 | Specifies the ciphers allowed for protocol version 2 in order of | 87 | Specifies the ciphers allowed for protocol version 2 in order of |
@@ -87,19 +89,19 @@ DESCRIPTION | |||
87 | ported ciphers are ``3des-cbc'', ``aes128-cbc'', ``aes192-cbc'', | 89 | ported ciphers are ``3des-cbc'', ``aes128-cbc'', ``aes192-cbc'', |
88 | ``aes256-cbc'', ``aes128-ctr'', ``aes192-ctr'', ``aes256-ctr'', | 90 | ``aes256-cbc'', ``aes128-ctr'', ``aes192-ctr'', ``aes256-ctr'', |
89 | ``arcfour128'', ``arcfour256'', ``arcfour'', ``blowfish-cbc'', | 91 | ``arcfour128'', ``arcfour256'', ``arcfour'', ``blowfish-cbc'', |
90 | and ``cast128-cbc''. The default is | 92 | and ``cast128-cbc''. The default is: |
91 | 93 | ||
92 | ``aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128, | 94 | aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128, |
93 | arcfour256,arcfour,aes192-cbc,aes256-cbc,aes128-ctr, | 95 | arcfour256,arcfour,aes192-cbc,aes256-cbc,aes128-ctr, |
94 | aes192-ctr,aes256-ctr'' | 96 | aes192-ctr,aes256-ctr |
95 | 97 | ||
96 | ClearAllForwardings | 98 | ClearAllForwardings |
97 | Specifies that all local, remote and dynamic port forwardings | 99 | Specifies that all local, remote, and dynamic port forwardings |
98 | specified in the configuration files or on the command line be | 100 | specified in the configuration files or on the command line be |
99 | cleared. This option is primarily useful when used from the ssh | 101 | cleared. This option is primarily useful when used from the |
100 | command line to clear port forwardings set in configuration | 102 | ssh(1) command line to clear port forwardings set in configura- |
101 | files, and is automatically set by scp(1) and sftp(1). The argu- | 103 | tion files, and is automatically set by scp(1) and sftp(1). The |
102 | ment must be ``yes'' or ``no''. The default is ``no''. | 104 | argument must be ``yes'' or ``no''. The default is ``no''. |
103 | 105 | ||
104 | Compression | 106 | Compression |
105 | Specifies whether to use compression. The argument must be | 107 | Specifies whether to use compression. The argument must be |
@@ -119,16 +121,16 @@ DESCRIPTION | |||
119 | 121 | ||
120 | ConnectTimeout | 122 | ConnectTimeout |
121 | Specifies the timeout (in seconds) used when connecting to the | 123 | Specifies the timeout (in seconds) used when connecting to the |
122 | ssh server, instead of using the default system TCP timeout. | 124 | SSH server, instead of using the default system TCP timeout. |
123 | This value is used only when the target is down or really un- | 125 | This value is used only when the target is down or really un- |
124 | reachable, not when it refuses the connection. | 126 | reachable, not when it refuses the connection. |
125 | 127 | ||
126 | ControlMaster | 128 | ControlMaster |
127 | Enables the sharing of multiple sessions over a single network | 129 | Enables the sharing of multiple sessions over a single network |
128 | connection. When set to ``yes'' ssh will listen for connections | 130 | connection. When set to ``yes'', ssh(1) will listen for connec- |
129 | on a control socket specified using the ControlPath argument. | 131 | tions on a control socket specified using the ControlPath argu- |
130 | Additional sessions can connect to this socket using the same | 132 | ment. Additional sessions can connect to this socket using the |
131 | ControlPath with ControlMaster set to ``no'' (the default). | 133 | same ControlPath with ControlMaster set to ``no'' (the default). |
132 | These sessions will try to reuse the master instance's network | 134 | These sessions will try to reuse the master instance's network |
133 | connection rather than initiating new ones, but will fall back to | 135 | connection rather than initiating new ones, but will fall back to |
134 | connecting normally if the control socket does not exist, or is | 136 | connecting normally if the control socket does not exist, or is |
@@ -137,7 +139,7 @@ DESCRIPTION | |||
137 | Setting this to ``ask'' will cause ssh to listen for control con- | 139 | Setting this to ``ask'' will cause ssh to listen for control con- |
138 | nections, but require confirmation using the SSH_ASKPASS program | 140 | nections, but require confirmation using the SSH_ASKPASS program |
139 | before they are accepted (see ssh-add(1) for details). If the | 141 | before they are accepted (see ssh-add(1) for details). If the |
140 | ControlPath can not be opened, ssh will continue without connect- | 142 | ControlPath cannot be opened, ssh will continue without connect- |
141 | ing to a master instance. | 143 | ing to a master instance. |
142 | 144 | ||
143 | X11 and ssh-agent(1) forwarding is supported over these multi- | 145 | X11 and ssh-agent(1) forwarding is supported over these multi- |
@@ -154,12 +156,12 @@ DESCRIPTION | |||
154 | ControlPath | 156 | ControlPath |
155 | Specify the path to the control socket used for connection shar- | 157 | Specify the path to the control socket used for connection shar- |
156 | ing as described in the ControlMaster section above or the string | 158 | ing as described in the ControlMaster section above or the string |
157 | ``none'' to disable connection sharing. In the path, `%h' will | 159 | ``none'' to disable connection sharing. In the path, `%l' will |
158 | be substituted by the target host name, `%p' the port and `%r' by | 160 | be substituted by the local host name, `%h' will be substituted |
159 | the remote login username. It is recommended that any | 161 | by the target host name, `%p' the port, and `%r' by the remote |
160 | ControlPath used for opportunistic connection sharing include all | 162 | login username. It is recommended that any ControlPath used for |
161 | three of these escape sequences. This ensures that shared con- | 163 | opportunistic connection sharing include at least %h, %p, and %r. |
162 | nections are uniquely identified. | 164 | This ensures that shared connections are uniquely identified. |
163 | 165 | ||
164 | DynamicForward | 166 | DynamicForward |
165 | Specifies that a TCP port on the local machine be forwarded over | 167 | Specifies that a TCP port on the local machine be forwarded over |
@@ -176,9 +178,9 @@ DESCRIPTION | |||
176 | while an empty address or `*' indicates that the port should be | 178 | while an empty address or `*' indicates that the port should be |
177 | available from all interfaces. | 179 | available from all interfaces. |
178 | 180 | ||
179 | Currently the SOCKS4 and SOCKS5 protocols are supported, and ssh | 181 | Currently the SOCKS4 and SOCKS5 protocols are supported, and |
180 | will act as a SOCKS server. Multiple forwardings may be speci- | 182 | ssh(1) will act as a SOCKS server. Multiple forwardings may be |
181 | fied, and additional forwardings can be given on the command | 183 | specified, and additional forwardings can be given on the command |
182 | line. Only the superuser can forward privileged ports. | 184 | line. Only the superuser can forward privileged ports. |
183 | 185 | ||
184 | EnableSSHKeysign | 186 | EnableSSHKeysign |
@@ -196,6 +198,12 @@ DESCRIPTION | |||
196 | able the escape character entirely (making the connection trans- | 198 | able the escape character entirely (making the connection trans- |
197 | parent for binary data). | 199 | parent for binary data). |
198 | 200 | ||
201 | ExitOnForwardFailure | ||
202 | Specifies whether ssh(1) should terminate the connection if it | ||
203 | cannot set up all requested dynamic, local, and remote port for- | ||
204 | wardings. The argument must be ``yes'' or ``no''. The default | ||
205 | is ``no''. | ||
206 | |||
199 | ForwardAgent | 207 | ForwardAgent |
200 | Specifies whether the connection to the authentication agent (if | 208 | Specifies whether the connection to the authentication agent (if |
201 | any) will be forwarded to the remote machine. The argument must | 209 | any) will be forwarded to the remote machine. The argument must |
@@ -222,15 +230,14 @@ DESCRIPTION | |||
222 | ForwardX11Trusted option is also enabled. | 230 | ForwardX11Trusted option is also enabled. |
223 | 231 | ||
224 | ForwardX11Trusted | 232 | ForwardX11Trusted |
225 | If this option is set to ``yes'' then remote X11 clients will | 233 | If this option is set to ``yes'', remote X11 clients will have |
226 | have full access to the original X11 display. | 234 | full access to the original X11 display. |
227 | 235 | ||
228 | If this option is set to ``no'' then remote X11 clients will be | 236 | If this option is set to ``no'', remote X11 clients will be con- |
229 | considered untrusted and prevented from stealing or tampering | 237 | sidered untrusted and prevented from stealing or tampering with |
230 | with data belonging to trusted X11 clients. Furthermore, the | 238 | data belonging to trusted X11 clients. Furthermore, the xauth(1) |
231 | xauth(1) token used for the session will be set to expire after | 239 | token used for the session will be set to expire after 20 min- |
232 | 20 minutes. Remote clients will be refused access after this | 240 | utes. Remote clients will be refused access after this time. |
233 | time. | ||
234 | 241 | ||
235 | The default is ``no''. | 242 | The default is ``no''. |
236 | 243 | ||
@@ -239,12 +246,13 @@ DESCRIPTION | |||
239 | 246 | ||
240 | GatewayPorts | 247 | GatewayPorts |
241 | Specifies whether remote hosts are allowed to connect to local | 248 | Specifies whether remote hosts are allowed to connect to local |
242 | forwarded ports. By default, ssh binds local port forwardings to | 249 | forwarded ports. By default, ssh(1) binds local port forwardings |
243 | the loopback address. This prevents other remote hosts from con- | 250 | to the loopback address. This prevents other remote hosts from |
244 | necting to forwarded ports. GatewayPorts can be used to specify | 251 | connecting to forwarded ports. GatewayPorts can be used to spec- |
245 | that ssh should bind local port forwardings to the wildcard ad- | 252 | ify that ssh should bind local port forwardings to the wildcard |
246 | dress, thus allowing remote hosts to connect to forwarded ports. | 253 | address, thus allowing remote hosts to connect to forwarded |
247 | The argument must be ``yes'' or ``no''. The default is ``no''. | 254 | ports. The argument must be ``yes'' or ``no''. The default is |
255 | ``no''. | ||
248 | 256 | ||
249 | GlobalKnownHostsFile | 257 | GlobalKnownHostsFile |
250 | Specifies a file to use for the global host key database instead | 258 | Specifies a file to use for the global host key database instead |
@@ -261,13 +269,13 @@ DESCRIPTION | |||
261 | ly. | 269 | ly. |
262 | 270 | ||
263 | HashKnownHosts | 271 | HashKnownHosts |
264 | Indicates that ssh should hash host names and addresses when they | 272 | Indicates that ssh(1) should hash host names and addresses when |
265 | are added to ~/.ssh/known_hosts. These hashed names may be used | 273 | they are added to ~/.ssh/known_hosts. These hashed names may be |
266 | normally by ssh and sshd, but they do not reveal identifying in- | 274 | used normally by ssh(1) and sshd(8), but they do not reveal iden- |
267 | formation should the file's contents be disclosed. The default | 275 | tifying information should the file's contents be disclosed. The |
268 | is ``no''. Note that hashing of names and addresses will not be | 276 | default is ``no''. Note that existing names and addresses in |
269 | retrospectively applied to existing known hosts files, but these | 277 | known hosts files will not be converted automatically, but may be |
270 | may be manually hashed using ssh-keygen(1). | 278 | manually hashed using ssh-keygen(1). |
271 | 279 | ||
272 | HostbasedAuthentication | 280 | HostbasedAuthentication |
273 | Specifies whether to try rhosts based authentication with public | 281 | Specifies whether to try rhosts based authentication with public |
@@ -283,19 +291,19 @@ DESCRIPTION | |||
283 | HostKeyAlias | 291 | HostKeyAlias |
284 | Specifies an alias that should be used instead of the real host | 292 | Specifies an alias that should be used instead of the real host |
285 | name when looking up or saving the host key in the host key | 293 | name when looking up or saving the host key in the host key |
286 | database files. This option is useful for tunneling ssh connec- | 294 | database files. This option is useful for tunneling SSH connec- |
287 | tions or for multiple servers running on a single host. | 295 | tions or for multiple servers running on a single host. |
288 | 296 | ||
289 | HostName | 297 | HostName |
290 | Specifies the real host name to log into. This can be used to | 298 | Specifies the real host name to log into. This can be used to |
291 | specify nicknames or abbreviations for hosts. Default is the | 299 | specify nicknames or abbreviations for hosts. The default is the |
292 | name given on the command line. Numeric IP addresses are also | 300 | name given on the command line. Numeric IP addresses are also |
293 | permitted (both on the command line and in HostName specifica- | 301 | permitted (both on the command line and in HostName specifica- |
294 | tions). | 302 | tions). |
295 | 303 | ||
296 | IdentitiesOnly | 304 | IdentitiesOnly |
297 | Specifies that ssh should only use the authentication identity | 305 | Specifies that ssh(1) should only use the authentication identity |
298 | files configured in the ssh_config files, even if the ssh-agent | 306 | files configured in the ssh_config files, even if ssh-agent(1) |
299 | offers more identities. The argument to this keyword must be | 307 | offers more identities. The argument to this keyword must be |
300 | ``yes'' or ``no''. This option is intended for situations where | 308 | ``yes'' or ``no''. This option is intended for situations where |
301 | ssh-agent offers many different identities. The default is | 309 | ssh-agent offers many different identities. The default is |
@@ -306,15 +314,23 @@ DESCRIPTION | |||
306 | identity is read. The default is ~/.ssh/identity for protocol | 314 | identity is read. The default is ~/.ssh/identity for protocol |
307 | version 1, and ~/.ssh/id_rsa and ~/.ssh/id_dsa for protocol ver- | 315 | version 1, and ~/.ssh/id_rsa and ~/.ssh/id_dsa for protocol ver- |
308 | sion 2. Additionally, any identities represented by the authen- | 316 | sion 2. Additionally, any identities represented by the authen- |
309 | tication agent will be used for authentication. The file name | 317 | tication agent will be used for authentication. |
310 | may use the tilde syntax to refer to a user's home directory. It | 318 | |
311 | is possible to have multiple identity files specified in configu- | 319 | The file name may use the tilde syntax to refer to a user's home |
312 | ration files; all these identities will be tried in sequence. | 320 | directory or one of the following escape characters: `%d' (local |
321 | user's home directory), `%u' (local user name), `%l' (local host | ||
322 | name), `%h' (remote host name) or `%r' (remote user name). | ||
323 | |||
324 | It is possible to have multiple identity files specified in con- | ||
325 | figuration files; all these identities will be tried in sequence. | ||
313 | 326 | ||
314 | KbdInteractiveDevices | 327 | KbdInteractiveDevices |
315 | Specifies the list of methods to use in keyboard-interactive au- | 328 | Specifies the list of methods to use in keyboard-interactive au- |
316 | thentication. Multiple method names must be comma-separated. | 329 | thentication. Multiple method names must be comma-separated. |
317 | The default is to use the server specified list. | 330 | The default is to use the server specified list. The methods |
331 | available vary depending on what the server supports. For an | ||
332 | OpenSSH server, it may be zero or more of: ``bsdauth'', ``pam'', | ||
333 | and ``skey''. | ||
318 | 334 | ||
319 | LocalCommand | 335 | LocalCommand |
320 | Specifies a command to execute on the local machine after suc- | 336 | Specifies a command to execute on the local machine after suc- |
@@ -341,15 +357,15 @@ DESCRIPTION | |||
341 | 357 | ||
342 | LogLevel | 358 | LogLevel |
343 | Gives the verbosity level that is used when logging messages from | 359 | Gives the verbosity level that is used when logging messages from |
344 | ssh. The possible values are: QUIET, FATAL, ERROR, INFO, VER- | 360 | ssh(1). The possible values are: QUIET, FATAL, ERROR, INFO, VER- |
345 | BOSE, DEBUG, DEBUG1, DEBUG2 and DEBUG3. The default is INFO. | 361 | BOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3. The default is INFO. |
346 | DEBUG and DEBUG1 are equivalent. DEBUG2 and DEBUG3 each specify | 362 | DEBUG and DEBUG1 are equivalent. DEBUG2 and DEBUG3 each specify |
347 | higher levels of verbose output. | 363 | higher levels of verbose output. |
348 | 364 | ||
349 | MACs Specifies the MAC (message authentication code) algorithms in or- | 365 | MACs Specifies the MAC (message authentication code) algorithms in or- |
350 | der of preference. The MAC algorithm is used in protocol version | 366 | der of preference. The MAC algorithm is used in protocol version |
351 | 2 for data integrity protection. Multiple algorithms must be | 367 | 2 for data integrity protection. Multiple algorithms must be |
352 | comma-separated. The default is ``hmac-md5,hmac-sha1,hmac- | 368 | comma-separated. The default is: ``hmac-md5,hmac-sha1,hmac- |
353 | ripemd160,hmac-sha1-96,hmac-md5-96''. | 369 | ripemd160,hmac-sha1-96,hmac-md5-96''. |
354 | 370 | ||
355 | NoHostAuthenticationForLocalhost | 371 | NoHostAuthenticationForLocalhost |
@@ -363,7 +379,7 @@ DESCRIPTION | |||
363 | 379 | ||
364 | NumberOfPasswordPrompts | 380 | NumberOfPasswordPrompts |
365 | Specifies the number of password prompts before giving up. The | 381 | Specifies the number of password prompts before giving up. The |
366 | argument to this keyword must be an integer. Default is 3. | 382 | argument to this keyword must be an integer. The default is 3. |
367 | 383 | ||
368 | PasswordAuthentication | 384 | PasswordAuthentication |
369 | Specifies whether to use password authentication. The argument | 385 | Specifies whether to use password authentication. The argument |
@@ -375,20 +391,20 @@ DESCRIPTION | |||
375 | ing the !command escape sequence in ssh(1). The argument must be | 391 | ing the !command escape sequence in ssh(1). The argument must be |
376 | ``yes'' or ``no''. The default is ``no''. | 392 | ``yes'' or ``no''. The default is ``no''. |
377 | 393 | ||
378 | Port Specifies the port number to connect on the remote host. Default | 394 | Port Specifies the port number to connect on the remote host. The de- |
379 | is 22. | 395 | fault is 22. |
380 | 396 | ||
381 | PreferredAuthentications | 397 | PreferredAuthentications |
382 | Specifies the order in which the client should try protocol 2 au- | 398 | Specifies the order in which the client should try protocol 2 au- |
383 | thentication methods. This allows a client to prefer one method | 399 | thentication methods. This allows a client to prefer one method |
384 | (e.g. keyboard-interactive) over another method (e.g. password) | 400 | (e.g. keyboard-interactive) over another method (e.g. password) |
385 | The default for this option is: ``hostbased,publickey,keyboard- | 401 | The default for this option is: ``gssapi-with-mic,hostbased, |
386 | interactive,password''. | 402 | publickey, keyboard-interactive, password''. |
387 | 403 | ||
388 | Protocol | 404 | Protocol |
389 | Specifies the protocol versions ssh should support in order of | 405 | Specifies the protocol versions ssh(1) should support in order of |
390 | preference. The possible values are ``1'' and ``2''. Multiple | 406 | preference. The possible values are `1' and `2'. Multiple ver- |
391 | versions must be comma-separated. The default is ``2,1''. This | 407 | sions must be comma-separated. The default is ``2,1''. This |
392 | means that ssh tries version 2 and falls back to version 1 if | 408 | means that ssh tries version 2 and falls back to version 1 if |
393 | version 2 is not available. | 409 | version 2 is not available. |
394 | 410 | ||
@@ -422,8 +438,8 @@ DESCRIPTION | |||
422 | fore the session key is renegotiated. The argument is the number | 438 | fore the session key is renegotiated. The argument is the number |
423 | of bytes, with an optional suffix of `K', `M', or `G' to indicate | 439 | of bytes, with an optional suffix of `K', `M', or `G' to indicate |
424 | Kilobytes, Megabytes, or Gigabytes, respectively. The default is | 440 | Kilobytes, Megabytes, or Gigabytes, respectively. The default is |
425 | between ``1G'' and ``4G'', depending on the cipher. This option | 441 | between `1G' and `4G', depending on the cipher. This option ap- |
426 | applies to protocol version 2 only. | 442 | plies to protocol version 2 only. |
427 | 443 | ||
428 | RemoteForward | 444 | RemoteForward |
429 | Specifies that a TCP port on the remote machine be forwarded over | 445 | Specifies that a TCP port on the remote machine be forwarded over |
@@ -446,7 +462,7 @@ DESCRIPTION | |||
446 | Specifies whether to try rhosts based authentication with RSA | 462 | Specifies whether to try rhosts based authentication with RSA |
447 | host authentication. The argument must be ``yes'' or ``no''. | 463 | host authentication. The argument must be ``yes'' or ``no''. |
448 | The default is ``no''. This option applies to protocol version 1 | 464 | The default is ``no''. This option applies to protocol version 1 |
449 | only and requires ssh to be setuid root. | 465 | only and requires ssh(1) to be setuid root. |
450 | 466 | ||
451 | RSAAuthentication | 467 | RSAAuthentication |
452 | Specifies whether to try RSA authentication. The argument to | 468 | Specifies whether to try RSA authentication. The argument to |
@@ -458,21 +474,23 @@ DESCRIPTION | |||
458 | SendEnv | 474 | SendEnv |
459 | Specifies what variables from the local environ(7) should be sent | 475 | Specifies what variables from the local environ(7) should be sent |
460 | to the server. Note that environment passing is only supported | 476 | to the server. Note that environment passing is only supported |
461 | for protocol 2, the server must also support it, and the server | 477 | for protocol 2. The server must also support it, and the server |
462 | must be configured to accept these environment variables. Refer | 478 | must be configured to accept these environment variables. Refer |
463 | to AcceptEnv in sshd_config(5) for how to configure the server. | 479 | to AcceptEnv in sshd_config(5) for how to configure the server. |
464 | Variables are specified by name, which may contain the wildcard | 480 | Variables are specified by name, which may contain wildcard char- |
465 | characters `*' and `?'. Multiple environment variables may be | 481 | acters. Multiple environment variables may be separated by |
466 | separated by whitespace or spread across multiple SendEnv direc- | 482 | whitespace or spread across multiple SendEnv directives. The de- |
467 | tives. The default is not to send any environment variables. | 483 | fault is not to send any environment variables. |
484 | |||
485 | See PATTERNS for more information on patterns. | ||
468 | 486 | ||
469 | ServerAliveCountMax | 487 | ServerAliveCountMax |
470 | Sets the number of server alive messages (see below) which may be | 488 | Sets the number of server alive messages (see below) which may be |
471 | sent without ssh receiving any messages back from the server. If | 489 | sent without ssh(1) receiving any messages back from the server. |
472 | this threshold is reached while server alive messages are being | 490 | If this threshold is reached while server alive messages are be- |
473 | sent, ssh will disconnect from the server, terminating the ses- | 491 | ing sent, ssh will disconnect from the server, terminating the |
474 | sion. It is important to note that the use of server alive mes- | 492 | session. It is important to note that the use of server alive |
475 | sages is very different from TCPKeepAlive (below). The server | 493 | messages is very different from TCPKeepAlive (below). The server |
476 | alive messages are sent through the encrypted channel and there- | 494 | alive messages are sent through the encrypted channel and there- |
477 | fore will not be spoofable. The TCP keepalive option enabled by | 495 | fore will not be spoofable. The TCP keepalive option enabled by |
478 | TCPKeepAlive is spoofable. The server alive mechanism is valu- | 496 | TCPKeepAlive is spoofable. The server alive mechanism is valu- |
@@ -480,39 +498,41 @@ DESCRIPTION | |||
480 | tion has become inactive. | 498 | tion has become inactive. |
481 | 499 | ||
482 | The default value is 3. If, for example, ServerAliveInterval | 500 | The default value is 3. If, for example, ServerAliveInterval |
483 | (see below) is set to 15, and ServerAliveCountMax is left at the | 501 | (see below) is set to 15 and ServerAliveCountMax is left at the |
484 | default, if the server becomes unresponsive ssh will disconnect | 502 | default, if the server becomes unresponsive, ssh will disconnect |
485 | after approximately 45 seconds. | 503 | after approximately 45 seconds. This option applies to protocol |
504 | version 2 only. | ||
486 | 505 | ||
487 | ServerAliveInterval | 506 | ServerAliveInterval |
488 | Sets a timeout interval in seconds after which if no data has | 507 | Sets a timeout interval in seconds after which if no data has |
489 | been received from the server, ssh will send a message through | 508 | been received from the server, ssh(1) will send a message through |
490 | the encrypted channel to request a response from the server. The | 509 | the encrypted channel to request a response from the server. The |
491 | default is 0, indicating that these messages will not be sent to | 510 | default is 0, indicating that these messages will not be sent to |
492 | the server. This option applies to protocol version 2 only. | 511 | the server. This option applies to protocol version 2 only. |
493 | 512 | ||
494 | SmartcardDevice | 513 | SmartcardDevice |
495 | Specifies which smartcard device to use. The argument to this | 514 | Specifies which smartcard device to use. The argument to this |
496 | keyword is the device ssh should use to communicate with a smart- | 515 | keyword is the device ssh(1) should use to communicate with a |
497 | card used for storing the user's private RSA key. By default, no | 516 | smartcard used for storing the user's private RSA key. By de- |
498 | device is specified and smartcard support is not activated. | 517 | fault, no device is specified and smartcard support is not acti- |
518 | vated. | ||
499 | 519 | ||
500 | StrictHostKeyChecking | 520 | StrictHostKeyChecking |
501 | If this flag is set to ``yes'', ssh will never automatically add | 521 | If this flag is set to ``yes'', ssh(1) will never automatically |
502 | host keys to the ~/.ssh/known_hosts file, and refuses to connect | 522 | add host keys to the ~/.ssh/known_hosts file, and refuses to con- |
503 | to hosts whose host key has changed. This provides maximum pro- | 523 | nect to hosts whose host key has changed. This provides maximum |
504 | tection against trojan horse attacks, however, can be annoying | 524 | protection against trojan horse attacks, though it can be annoy- |
505 | when the /etc/ssh/ssh_known_hosts file is poorly maintained, or | 525 | ing when the /etc/ssh/ssh_known_hosts file is poorly maintained |
506 | connections to new hosts are frequently made. This option forces | 526 | or when connections to new hosts are frequently made. This op- |
507 | the user to manually add all new hosts. If this flag is set to | 527 | tion forces the user to manually add all new hosts. If this flag |
508 | ``no'', ssh will automatically add new host keys to the user | 528 | is set to ``no'', ssh will automatically add new host keys to the |
509 | known hosts files. If this flag is set to ``ask'', new host keys | 529 | user known hosts files. If this flag is set to ``ask'', new host |
510 | will be added to the user known host files only after the user | 530 | keys will be added to the user known host files only after the |
511 | has confirmed that is what they really want to do, and ssh will | 531 | user has confirmed that is what they really want to do, and ssh |
512 | refuse to connect to hosts whose host key has changed. The host | 532 | will refuse to connect to hosts whose host key has changed. The |
513 | keys of known hosts will be verified automatically in all cases. | 533 | host keys of known hosts will be verified automatically in all |
514 | The argument must be ``yes'', ``no'' or ``ask''. The default is | 534 | cases. The argument must be ``yes'', ``no'', or ``ask''. The |
515 | ``ask''. | 535 | default is ``ask''. |
516 | 536 | ||
517 | TCPKeepAlive | 537 | TCPKeepAlive |
518 | Specifies whether the system should send TCP keepalive messages | 538 | Specifies whether the system should send TCP keepalive messages |
@@ -528,22 +548,27 @@ DESCRIPTION | |||
528 | To disable TCP keepalive messages, the value should be set to | 548 | To disable TCP keepalive messages, the value should be set to |
529 | ``no''. | 549 | ``no''. |
530 | 550 | ||
531 | Tunnel Request starting tun(4) device forwarding between the client and | 551 | Tunnel Request tun(4) device forwarding between the client and the serv- |
532 | the server. This option also allows requesting layer 2 (ether- | 552 | er. The argument must be ``yes'', ``point-to-point'' (layer 3), |
533 | net) instead of layer 3 (point-to-point) tunneling from the serv- | 553 | ``ethernet'' (layer 2), or ``no''. Specifying ``yes'' requests |
534 | er. The argument must be ``yes'', ``point-to-point'', | 554 | the default tunnel mode, which is ``point-to-point''. The de- |
535 | ``ethernet'' or ``no''. The default is ``no''. | 555 | fault is ``no''. |
536 | 556 | ||
537 | TunnelDevice | 557 | TunnelDevice |
538 | Force a specified tun(4) device on the client. Without this op- | 558 | Specifies the tun(4) devices to open on the client (local_tun) |
539 | tion, the next available device will be used. | 559 | and the server (remote_tun). |
560 | |||
561 | The argument must be local_tun[:remote_tun]. The devices may be | ||
562 | specified by numerical ID or the keyword ``any'', which uses the | ||
563 | next available tunnel device. If remote_tun is not specified, it | ||
564 | defaults to ``any''. The default is ``any:any''. | ||
540 | 565 | ||
541 | UsePrivilegedPort | 566 | UsePrivilegedPort |
542 | Specifies whether to use a privileged port for outgoing connec- | 567 | Specifies whether to use a privileged port for outgoing connec- |
543 | tions. The argument must be ``yes'' or ``no''. The default is | 568 | tions. The argument must be ``yes'' or ``no''. The default is |
544 | ``no''. If set to ``yes'' ssh must be setuid root. Note that | 569 | ``no''. If set to ``yes'', ssh(1) must be setuid root. Note |
545 | this option must be set to ``yes'' for RhostsRSAAuthentication | 570 | that this option must be set to ``yes'' for |
546 | with older servers. | 571 | RhostsRSAAuthentication with older servers. |
547 | 572 | ||
548 | User Specifies the user to log in as. This can be useful when a dif- | 573 | User Specifies the user to log in as. This can be useful when a dif- |
549 | ferent user name is used on different machines. This saves the | 574 | ferent user name is used on different machines. This saves the |
@@ -562,18 +587,42 @@ DESCRIPTION | |||
562 | set to ``ask''. If this option is set to ``ask'', information on | 587 | set to ``ask''. If this option is set to ``ask'', information on |
563 | fingerprint match will be displayed, but the user will still need | 588 | fingerprint match will be displayed, but the user will still need |
564 | to confirm new host keys according to the StrictHostKeyChecking | 589 | to confirm new host keys according to the StrictHostKeyChecking |
565 | option. The argument must be ``yes'', ``no'' or ``ask''. The | 590 | option. The argument must be ``yes'', ``no'', or ``ask''. The |
566 | default is ``no''. Note that this option applies to protocol | 591 | default is ``no''. Note that this option applies to protocol |
567 | version 2 only. | 592 | version 2 only. |
568 | 593 | ||
594 | See also VERIFYING HOST KEYS in ssh(1). | ||
595 | |||
569 | XAuthLocation | 596 | XAuthLocation |
570 | Specifies the full pathname of the xauth(1) program. The default | 597 | Specifies the full pathname of the xauth(1) program. The default |
571 | is /usr/X11R6/bin/xauth. | 598 | is /usr/X11R6/bin/xauth. |
572 | 599 | ||
600 | PATTERNS | ||
601 | A pattern consists of zero or more non-whitespace characters, `*' (a | ||
602 | wildcard that matches zero or more characters), or `?' (a wildcard that | ||
603 | matches exactly one character). For example, to specify a set of decla- | ||
604 | rations for any host in the ``.co.uk'' set of domains, the following pat- | ||
605 | tern could be used: | ||
606 | |||
607 | Host *.co.uk | ||
608 | |||
609 | The following pattern would match any host in the 192.168.0.[0-9] network | ||
610 | range: | ||
611 | |||
612 | Host 192.168.0.? | ||
613 | |||
614 | A pattern-list is a comma-separated list of patterns. Patterns within | ||
615 | pattern-lists may be negated by preceding them with an exclamation mark | ||
616 | (`!'). For example, to allow a key to be used from anywhere within an | ||
617 | organisation except from the ``dialup'' pool, the following entry (in au- | ||
618 | thorized_keys) could be used: | ||
619 | |||
620 | from="!*.dialup.example.com,*.example.com" | ||
621 | |||
573 | FILES | 622 | FILES |
574 | ~/.ssh/config | 623 | ~/.ssh/config |
575 | This is the per-user configuration file. The format of this file | 624 | This is the per-user configuration file. The format of this file |
576 | is described above. This file is used by the ssh client. Be- | 625 | is described above. This file is used by the SSH client. Be- |
577 | cause of the potential for abuse, this file must have strict per- | 626 | cause of the potential for abuse, this file must have strict per- |
578 | missions: read/write for the user, and not accessible by others. | 627 | missions: read/write for the user, and not accessible by others. |
579 | 628 | ||
@@ -593,4 +642,4 @@ AUTHORS | |||
593 | ated OpenSSH. Markus Friedl contributed the support for SSH protocol | 642 | ated OpenSSH. Markus Friedl contributed the support for SSH protocol |
594 | versions 1.5 and 2.0. | 643 | versions 1.5 and 2.0. |
595 | 644 | ||
596 | OpenBSD 3.9 September 25, 1999 9 | 645 | OpenBSD 4.1 September 25, 1999 10 |
diff --git a/ssh_config.5 b/ssh_config.5 index 979f9282f..4c46c62cb 100644 --- a/ssh_config.5 +++ b/ssh_config.5 | |||
@@ -34,7 +34,7 @@ | |||
34 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 34 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
35 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 35 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
36 | .\" | 36 | .\" |
37 | .\" $OpenBSD: ssh_config.5,v 1.76 2006/01/20 11:21:45 jmc Exp $ | 37 | .\" $OpenBSD: ssh_config.5,v 1.98 2007/01/10 13:23:22 jmc Exp $ |
38 | .Dd September 25, 1999 | 38 | .Dd September 25, 1999 |
39 | .Dt SSH_CONFIG 5 | 39 | .Dt SSH_CONFIG 5 |
40 | .Os | 40 | .Os |
@@ -42,14 +42,13 @@ | |||
42 | .Nm ssh_config | 42 | .Nm ssh_config |
43 | .Nd OpenSSH SSH client configuration files | 43 | .Nd OpenSSH SSH client configuration files |
44 | .Sh SYNOPSIS | 44 | .Sh SYNOPSIS |
45 | .Bl -tag -width Ds -compact | 45 | .Nm ~/.ssh/config |
46 | .It Pa ~/.ssh/config | 46 | .Nm /etc/ssh/ssh_config |
47 | .It Pa /etc/ssh/ssh_config | ||
48 | .El | ||
49 | .Sh DESCRIPTION | 47 | .Sh DESCRIPTION |
50 | .Nm ssh | 48 | .Xr ssh 1 |
51 | obtains configuration data from the following sources in | 49 | obtains configuration data from the following sources in |
52 | the following order: | 50 | the following order: |
51 | .Pp | ||
53 | .Bl -enum -offset indent -compact | 52 | .Bl -enum -offset indent -compact |
54 | .It | 53 | .It |
55 | command-line options | 54 | command-line options |
@@ -78,7 +77,6 @@ The configuration file has the following format: | |||
78 | Empty lines and lines starting with | 77 | Empty lines and lines starting with |
79 | .Ql # | 78 | .Ql # |
80 | are comments. | 79 | are comments. |
81 | .Pp | ||
82 | Otherwise a line is of the format | 80 | Otherwise a line is of the format |
83 | .Dq keyword arguments . | 81 | .Dq keyword arguments . |
84 | Configuration options may be separated by whitespace or | 82 | Configuration options may be separated by whitespace or |
@@ -87,11 +85,14 @@ optional whitespace and exactly one | |||
87 | the latter format is useful to avoid the need to quote whitespace | 85 | the latter format is useful to avoid the need to quote whitespace |
88 | when specifying configuration options using the | 86 | when specifying configuration options using the |
89 | .Nm ssh , | 87 | .Nm ssh , |
90 | .Nm scp | 88 | .Nm scp , |
91 | and | 89 | and |
92 | .Nm sftp | 90 | .Nm sftp |
93 | .Fl o | 91 | .Fl o |
94 | option. | 92 | option. |
93 | Arguments may optionally be enclosed in double quotes | ||
94 | .Pq \&" | ||
95 | in order to represent arguments containing spaces. | ||
95 | .Pp | 96 | .Pp |
96 | The possible | 97 | The possible |
97 | keywords and their meanings are as follows (note that | 98 | keywords and their meanings are as follows (note that |
@@ -102,25 +103,24 @@ Restricts the following declarations (up to the next | |||
102 | .Cm Host | 103 | .Cm Host |
103 | keyword) to be only for those hosts that match one of the patterns | 104 | keyword) to be only for those hosts that match one of the patterns |
104 | given after the keyword. | 105 | given after the keyword. |
105 | .Ql \&* | ||
106 | and | ||
107 | .Ql \&? | ||
108 | can be used as wildcards in the | ||
109 | patterns. | ||
110 | A single | 106 | A single |
111 | .Ql \&* | 107 | .Ql * |
112 | as a pattern can be used to provide global | 108 | as a pattern can be used to provide global |
113 | defaults for all hosts. | 109 | defaults for all hosts. |
114 | The host is the | 110 | The host is the |
115 | .Ar hostname | 111 | .Ar hostname |
116 | argument given on the command line (i.e., the name is not converted to | 112 | argument given on the command line (i.e. the name is not converted to |
117 | a canonicalized host name before matching). | 113 | a canonicalized host name before matching). |
114 | .Pp | ||
115 | See | ||
116 | .Sx PATTERNS | ||
117 | for more information on patterns. | ||
118 | .It Cm AddressFamily | 118 | .It Cm AddressFamily |
119 | Specifies which address family to use when connecting. | 119 | Specifies which address family to use when connecting. |
120 | Valid arguments are | 120 | Valid arguments are |
121 | .Dq any , | 121 | .Dq any , |
122 | .Dq inet | 122 | .Dq inet |
123 | (use IPv4 only) or | 123 | (use IPv4 only), or |
124 | .Dq inet6 | 124 | .Dq inet6 |
125 | (use IPv6 only). | 125 | (use IPv6 only). |
126 | .It Cm BatchMode | 126 | .It Cm BatchMode |
@@ -134,8 +134,7 @@ and | |||
134 | options will both be set to 300 seconds by default. | 134 | options will both be set to 300 seconds by default. |
135 | This option is useful in scripts and other batch jobs where no user | 135 | This option is useful in scripts and other batch jobs where no user |
136 | is present to supply the password, | 136 | is present to supply the password, |
137 | and where it is desirable to detect a | 137 | and where it is desirable to detect a broken network swiftly. |
138 | broken network swiftly. | ||
139 | The argument must be | 138 | The argument must be |
140 | .Dq yes | 139 | .Dq yes |
141 | or | 140 | or |
@@ -151,7 +150,7 @@ Note that this option does not work if | |||
151 | is set to | 150 | is set to |
152 | .Dq yes . | 151 | .Dq yes . |
153 | .It Cm ChallengeResponseAuthentication | 152 | .It Cm ChallengeResponseAuthentication |
154 | Specifies whether to use challenge response authentication. | 153 | Specifies whether to use challenge-response authentication. |
155 | The argument to this keyword must be | 154 | The argument to this keyword must be |
156 | .Dq yes | 155 | .Dq yes |
157 | or | 156 | or |
@@ -161,7 +160,8 @@ The default is | |||
161 | .It Cm CheckHostIP | 160 | .It Cm CheckHostIP |
162 | If this flag is set to | 161 | If this flag is set to |
163 | .Dq yes , | 162 | .Dq yes , |
164 | ssh will additionally check the host IP address in the | 163 | .Xr ssh 1 |
164 | will additionally check the host IP address in the | ||
165 | .Pa known_hosts | 165 | .Pa known_hosts |
166 | file. | 166 | file. |
167 | This allows ssh to detect if a host key changed due to DNS spoofing. | 167 | This allows ssh to detect if a host key changed due to DNS spoofing. |
@@ -181,7 +181,7 @@ and | |||
181 | are supported. | 181 | are supported. |
182 | .Ar des | 182 | .Ar des |
183 | is only supported in the | 183 | is only supported in the |
184 | .Nm ssh | 184 | .Xr ssh 1 |
185 | client for interoperability with legacy protocol 1 implementations | 185 | client for interoperability with legacy protocol 1 implementations |
186 | that do not support the | 186 | that do not support the |
187 | .Ar 3des | 187 | .Ar 3des |
@@ -207,18 +207,18 @@ The supported ciphers are | |||
207 | .Dq blowfish-cbc , | 207 | .Dq blowfish-cbc , |
208 | and | 208 | and |
209 | .Dq cast128-cbc . | 209 | .Dq cast128-cbc . |
210 | The default is | 210 | The default is: |
211 | .Bd -literal | 211 | .Bd -literal -offset 3n |
212 | ``aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128, | 212 | aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128, |
213 | arcfour256,arcfour,aes192-cbc,aes256-cbc,aes128-ctr, | 213 | arcfour256,arcfour,aes192-cbc,aes256-cbc,aes128-ctr, |
214 | aes192-ctr,aes256-ctr'' | 214 | aes192-ctr,aes256-ctr |
215 | .Ed | 215 | .Ed |
216 | .It Cm ClearAllForwardings | 216 | .It Cm ClearAllForwardings |
217 | Specifies that all local, remote and dynamic port forwardings | 217 | Specifies that all local, remote, and dynamic port forwardings |
218 | specified in the configuration files or on the command line be | 218 | specified in the configuration files or on the command line be |
219 | cleared. | 219 | cleared. |
220 | This option is primarily useful when used from the | 220 | This option is primarily useful when used from the |
221 | .Nm ssh | 221 | .Xr ssh 1 |
222 | command line to clear port forwardings set in | 222 | command line to clear port forwardings set in |
223 | configuration files, and is automatically set by | 223 | configuration files, and is automatically set by |
224 | .Xr scp 1 | 224 | .Xr scp 1 |
@@ -251,15 +251,15 @@ The argument must be an integer. | |||
251 | This may be useful in scripts if the connection sometimes fails. | 251 | This may be useful in scripts if the connection sometimes fails. |
252 | The default is 1. | 252 | The default is 1. |
253 | .It Cm ConnectTimeout | 253 | .It Cm ConnectTimeout |
254 | Specifies the timeout (in seconds) used when connecting to the ssh | 254 | Specifies the timeout (in seconds) used when connecting to the |
255 | server, instead of using the default system TCP timeout. | 255 | SSH server, instead of using the default system TCP timeout. |
256 | This value is used only when the target is down or really unreachable, | 256 | This value is used only when the target is down or really unreachable, |
257 | not when it refuses the connection. | 257 | not when it refuses the connection. |
258 | .It Cm ControlMaster | 258 | .It Cm ControlMaster |
259 | Enables the sharing of multiple sessions over a single network connection. | 259 | Enables the sharing of multiple sessions over a single network connection. |
260 | When set to | 260 | When set to |
261 | .Dq yes | 261 | .Dq yes , |
262 | .Nm ssh | 262 | .Xr ssh 1 |
263 | will listen for connections on a control socket specified using the | 263 | will listen for connections on a control socket specified using the |
264 | .Cm ControlPath | 264 | .Cm ControlPath |
265 | argument. | 265 | argument. |
@@ -276,8 +276,7 @@ if the control socket does not exist, or is not listening. | |||
276 | .Pp | 276 | .Pp |
277 | Setting this to | 277 | Setting this to |
278 | .Dq ask | 278 | .Dq ask |
279 | will cause | 279 | will cause ssh |
280 | .Nm ssh | ||
281 | to listen for control connections, but require confirmation using the | 280 | to listen for control connections, but require confirmation using the |
282 | .Ev SSH_ASKPASS | 281 | .Ev SSH_ASKPASS |
283 | program before they are accepted (see | 282 | program before they are accepted (see |
@@ -285,9 +284,8 @@ program before they are accepted (see | |||
285 | for details). | 284 | for details). |
286 | If the | 285 | If the |
287 | .Cm ControlPath | 286 | .Cm ControlPath |
288 | can not be opened, | 287 | cannot be opened, |
289 | .Nm ssh | 288 | ssh will continue without connecting to a master instance. |
290 | will continue without connecting to a master instance. | ||
291 | .Pp | 289 | .Pp |
292 | X11 and | 290 | X11 and |
293 | .Xr ssh-agent 1 | 291 | .Xr ssh-agent 1 |
@@ -313,16 +311,18 @@ section above or the string | |||
313 | .Dq none | 311 | .Dq none |
314 | to disable connection sharing. | 312 | to disable connection sharing. |
315 | In the path, | 313 | In the path, |
314 | .Ql %l | ||
315 | will be substituted by the local host name, | ||
316 | .Ql %h | 316 | .Ql %h |
317 | will be substituted by the target host name, | 317 | will be substituted by the target host name, |
318 | .Ql %p | 318 | .Ql %p |
319 | the port and | 319 | the port, and |
320 | .Ql %r | 320 | .Ql %r |
321 | by the remote login username. | 321 | by the remote login username. |
322 | It is recommended that any | 322 | It is recommended that any |
323 | .Cm ControlPath | 323 | .Cm ControlPath |
324 | used for opportunistic connection sharing include | 324 | used for opportunistic connection sharing include |
325 | all three of these escape sequences. | 325 | at least %h, %p, and %r. |
326 | This ensures that shared connections are uniquely identified. | 326 | This ensures that shared connections are uniquely identified. |
327 | .It Cm DynamicForward | 327 | .It Cm DynamicForward |
328 | Specifies that a TCP port on the local machine be forwarded | 328 | Specifies that a TCP port on the local machine be forwarded |
@@ -353,7 +353,7 @@ empty address or | |||
353 | indicates that the port should be available from all interfaces. | 353 | indicates that the port should be available from all interfaces. |
354 | .Pp | 354 | .Pp |
355 | Currently the SOCKS4 and SOCKS5 protocols are supported, and | 355 | Currently the SOCKS4 and SOCKS5 protocols are supported, and |
356 | .Nm ssh | 356 | .Xr ssh 1 |
357 | will act as a SOCKS server. | 357 | will act as a SOCKS server. |
358 | Multiple forwardings may be specified, and | 358 | Multiple forwardings may be specified, and |
359 | additional forwardings can be given on the command line. | 359 | additional forwardings can be given on the command line. |
@@ -389,6 +389,17 @@ followed by a letter, or | |||
389 | to disable the escape | 389 | to disable the escape |
390 | character entirely (making the connection transparent for binary | 390 | character entirely (making the connection transparent for binary |
391 | data). | 391 | data). |
392 | .It Cm ExitOnForwardFailure | ||
393 | Specifies whether | ||
394 | .Xr ssh 1 | ||
395 | should terminate the connection if it cannot set up all requested | ||
396 | dynamic, local, and remote port forwardings. | ||
397 | The argument must be | ||
398 | .Dq yes | ||
399 | or | ||
400 | .Dq no . | ||
401 | The default is | ||
402 | .Dq no . | ||
392 | .It Cm ForwardAgent | 403 | .It Cm ForwardAgent |
393 | Specifies whether the connection to the authentication agent (if any) | 404 | Specifies whether the connection to the authentication agent (if any) |
394 | will be forwarded to the remote machine. | 405 | will be forwarded to the remote machine. |
@@ -428,12 +439,12 @@ if the | |||
428 | option is also enabled. | 439 | option is also enabled. |
429 | .It Cm ForwardX11Trusted | 440 | .It Cm ForwardX11Trusted |
430 | If this option is set to | 441 | If this option is set to |
431 | .Dq yes | 442 | .Dq yes , |
432 | then remote X11 clients will have full access to the original X11 display. | 443 | remote X11 clients will have full access to the original X11 display. |
433 | .Pp | 444 | .Pp |
434 | If this option is set to | 445 | If this option is set to |
435 | .Dq no | 446 | .Dq no , |
436 | then remote X11 clients will be considered untrusted and prevented | 447 | remote X11 clients will be considered untrusted and prevented |
437 | from stealing or tampering with data belonging to trusted X11 | 448 | from stealing or tampering with data belonging to trusted X11 |
438 | clients. | 449 | clients. |
439 | Furthermore, the | 450 | Furthermore, the |
@@ -451,12 +462,11 @@ the restrictions imposed on untrusted clients. | |||
451 | Specifies whether remote hosts are allowed to connect to local | 462 | Specifies whether remote hosts are allowed to connect to local |
452 | forwarded ports. | 463 | forwarded ports. |
453 | By default, | 464 | By default, |
454 | .Nm ssh | 465 | .Xr ssh 1 |
455 | binds local port forwardings to the loopback address. | 466 | binds local port forwardings to the loopback address. |
456 | This prevents other remote hosts from connecting to forwarded ports. | 467 | This prevents other remote hosts from connecting to forwarded ports. |
457 | .Cm GatewayPorts | 468 | .Cm GatewayPorts |
458 | can be used to specify that | 469 | can be used to specify that ssh |
459 | .Nm ssh | ||
460 | should bind local port forwardings to the wildcard address, | 470 | should bind local port forwardings to the wildcard address, |
461 | thus allowing remote hosts to connect to forwarded ports. | 471 | thus allowing remote hosts to connect to forwarded ports. |
462 | The argument must be | 472 | The argument must be |
@@ -474,6 +484,12 @@ Specifies whether user authentication based on GSSAPI is allowed. | |||
474 | The default is | 484 | The default is |
475 | .Dq no . | 485 | .Dq no . |
476 | Note that this option applies to protocol version 2 only. | 486 | Note that this option applies to protocol version 2 only. |
487 | .It Cm GSSAPIKeyExchange | ||
488 | Specifies whether key exchange based on GSSAPI may be used. When using | ||
489 | GSSAPI key exchange the server need not have a host key. | ||
490 | The default is | ||
491 | .Dq no . | ||
492 | Note that this option applies to protocol version 2 only. | ||
477 | .It Cm GSSAPIDelegateCredentials | 493 | .It Cm GSSAPIDelegateCredentials |
478 | Forward (delegate) credentials to the server. | 494 | Forward (delegate) credentials to the server. |
479 | The default is | 495 | The default is |
@@ -481,29 +497,31 @@ The default is | |||
481 | Note that this option applies to protocol version 2 only. | 497 | Note that this option applies to protocol version 2 only. |
482 | .It Cm GSSAPITrustDns | 498 | .It Cm GSSAPITrustDns |
483 | Set to | 499 | Set to |
484 | .Dq yes to indicate that the DNS is trusted to securely canonicalize | 500 | .Dq yes |
501 | to indicate that the DNS is trusted to securely canonicalize | ||
485 | the name of the host being connected to. If | 502 | the name of the host being connected to. If |
486 | .Dq no, the hostname entered on the | 503 | .Dq no , |
504 | the hostname entered on the | ||
487 | command line will be passed untouched to the GSSAPI library. | 505 | command line will be passed untouched to the GSSAPI library. |
488 | The default is | 506 | The default is |
489 | .Dq no . | 507 | .Dq no . |
490 | This option only applies to protocol version 2 connections using GSSAPI | 508 | This option only applies to protocol version 2 connections using GSSAPI. |
491 | key exchange. | ||
492 | .It Cm HashKnownHosts | 509 | .It Cm HashKnownHosts |
493 | Indicates that | 510 | Indicates that |
494 | .Nm ssh | 511 | .Xr ssh 1 |
495 | should hash host names and addresses when they are added to | 512 | should hash host names and addresses when they are added to |
496 | .Pa ~/.ssh/known_hosts . | 513 | .Pa ~/.ssh/known_hosts . |
497 | These hashed names may be used normally by | 514 | These hashed names may be used normally by |
498 | .Nm ssh | 515 | .Xr ssh 1 |
499 | and | 516 | and |
500 | .Nm sshd , | 517 | .Xr sshd 8 , |
501 | but they do not reveal identifying information should the file's contents | 518 | but they do not reveal identifying information should the file's contents |
502 | be disclosed. | 519 | be disclosed. |
503 | The default is | 520 | The default is |
504 | .Dq no . | 521 | .Dq no . |
505 | Note that hashing of names and addresses will not be retrospectively applied | 522 | Note that existing names and addresses in known hosts files |
506 | to existing known hosts files, but these may be manually hashed using | 523 | will not be converted automatically, |
524 | but may be manually hashed using | ||
507 | .Xr ssh-keygen 1 . | 525 | .Xr ssh-keygen 1 . |
508 | .It Cm HostbasedAuthentication | 526 | .It Cm HostbasedAuthentication |
509 | Specifies whether to try rhosts based authentication with public key | 527 | Specifies whether to try rhosts based authentication with public key |
@@ -526,30 +544,29 @@ The default for this option is: | |||
526 | Specifies an alias that should be used instead of the | 544 | Specifies an alias that should be used instead of the |
527 | real host name when looking up or saving the host key | 545 | real host name when looking up or saving the host key |
528 | in the host key database files. | 546 | in the host key database files. |
529 | This option is useful for tunneling ssh connections | 547 | This option is useful for tunneling SSH connections |
530 | or for multiple servers running on a single host. | 548 | or for multiple servers running on a single host. |
531 | .It Cm HostName | 549 | .It Cm HostName |
532 | Specifies the real host name to log into. | 550 | Specifies the real host name to log into. |
533 | This can be used to specify nicknames or abbreviations for hosts. | 551 | This can be used to specify nicknames or abbreviations for hosts. |
534 | Default is the name given on the command line. | 552 | The default is the name given on the command line. |
535 | Numeric IP addresses are also permitted (both on the command line and in | 553 | Numeric IP addresses are also permitted (both on the command line and in |
536 | .Cm HostName | 554 | .Cm HostName |
537 | specifications). | 555 | specifications). |
538 | .It Cm IdentitiesOnly | 556 | .It Cm IdentitiesOnly |
539 | Specifies that | 557 | Specifies that |
540 | .Nm ssh | 558 | .Xr ssh 1 |
541 | should only use the authentication identity files configured in the | 559 | should only use the authentication identity files configured in the |
542 | .Nm | 560 | .Nm |
543 | files, | 561 | files, |
544 | even if the | 562 | even if |
545 | .Nm ssh-agent | 563 | .Xr ssh-agent 1 |
546 | offers more identities. | 564 | offers more identities. |
547 | The argument to this keyword must be | 565 | The argument to this keyword must be |
548 | .Dq yes | 566 | .Dq yes |
549 | or | 567 | or |
550 | .Dq no . | 568 | .Dq no . |
551 | This option is intended for situations where | 569 | This option is intended for situations where ssh-agent |
552 | .Nm ssh-agent | ||
553 | offers many different identities. | 570 | offers many different identities. |
554 | The default is | 571 | The default is |
555 | .Dq no . | 572 | .Dq no . |
@@ -565,8 +582,21 @@ and | |||
565 | for protocol version 2. | 582 | for protocol version 2. |
566 | Additionally, any identities represented by the authentication agent | 583 | Additionally, any identities represented by the authentication agent |
567 | will be used for authentication. | 584 | will be used for authentication. |
585 | .Pp | ||
568 | The file name may use the tilde | 586 | The file name may use the tilde |
569 | syntax to refer to a user's home directory. | 587 | syntax to refer to a user's home directory or one of the following |
588 | escape characters: | ||
589 | .Ql %d | ||
590 | (local user's home directory), | ||
591 | .Ql %u | ||
592 | (local user name), | ||
593 | .Ql %l | ||
594 | (local host name), | ||
595 | .Ql %h | ||
596 | (remote host name) or | ||
597 | .Ql %r | ||
598 | (remote user name). | ||
599 | .Pp | ||
570 | It is possible to have | 600 | It is possible to have |
571 | multiple identity files specified in configuration files; all these | 601 | multiple identity files specified in configuration files; all these |
572 | identities will be tried in sequence. | 602 | identities will be tried in sequence. |
@@ -574,6 +604,13 @@ identities will be tried in sequence. | |||
574 | Specifies the list of methods to use in keyboard-interactive authentication. | 604 | Specifies the list of methods to use in keyboard-interactive authentication. |
575 | Multiple method names must be comma-separated. | 605 | Multiple method names must be comma-separated. |
576 | The default is to use the server specified list. | 606 | The default is to use the server specified list. |
607 | The methods available vary depending on what the server supports. | ||
608 | For an OpenSSH server, | ||
609 | it may be zero or more of: | ||
610 | .Dq bsdauth , | ||
611 | .Dq pam , | ||
612 | and | ||
613 | .Dq skey . | ||
577 | .It Cm LocalCommand | 614 | .It Cm LocalCommand |
578 | Specifies a command to execute on the local machine after successfully | 615 | Specifies a command to execute on the local machine after successfully |
579 | connecting to the server. | 616 | connecting to the server. |
@@ -615,9 +652,9 @@ empty address or | |||
615 | indicates that the port should be available from all interfaces. | 652 | indicates that the port should be available from all interfaces. |
616 | .It Cm LogLevel | 653 | .It Cm LogLevel |
617 | Gives the verbosity level that is used when logging messages from | 654 | Gives the verbosity level that is used when logging messages from |
618 | .Nm ssh . | 655 | .Xr ssh 1 . |
619 | The possible values are: | 656 | The possible values are: |
620 | QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2 and DEBUG3. | 657 | QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3. |
621 | The default is INFO. | 658 | The default is INFO. |
622 | DEBUG and DEBUG1 are equivalent. | 659 | DEBUG and DEBUG1 are equivalent. |
623 | DEBUG2 and DEBUG3 each specify higher levels of verbose output. | 660 | DEBUG2 and DEBUG3 each specify higher levels of verbose output. |
@@ -627,7 +664,7 @@ in order of preference. | |||
627 | The MAC algorithm is used in protocol version 2 | 664 | The MAC algorithm is used in protocol version 2 |
628 | for data integrity protection. | 665 | for data integrity protection. |
629 | Multiple algorithms must be comma-separated. | 666 | Multiple algorithms must be comma-separated. |
630 | The default is | 667 | The default is: |
631 | .Dq hmac-md5,hmac-sha1,hmac-ripemd160,hmac-sha1-96,hmac-md5-96 . | 668 | .Dq hmac-md5,hmac-sha1,hmac-ripemd160,hmac-sha1-96,hmac-md5-96 . |
632 | .It Cm NoHostAuthenticationForLocalhost | 669 | .It Cm NoHostAuthenticationForLocalhost |
633 | This option can be used if the home directory is shared across machines. | 670 | This option can be used if the home directory is shared across machines. |
@@ -642,7 +679,7 @@ The default is to check the host key for localhost. | |||
642 | .It Cm NumberOfPasswordPrompts | 679 | .It Cm NumberOfPasswordPrompts |
643 | Specifies the number of password prompts before giving up. | 680 | Specifies the number of password prompts before giving up. |
644 | The argument to this keyword must be an integer. | 681 | The argument to this keyword must be an integer. |
645 | Default is 3. | 682 | The default is 3. |
646 | .It Cm PasswordAuthentication | 683 | .It Cm PasswordAuthentication |
647 | Specifies whether to use password authentication. | 684 | Specifies whether to use password authentication. |
648 | The argument to this keyword must be | 685 | The argument to this keyword must be |
@@ -666,7 +703,7 @@ The default is | |||
666 | .Dq no . | 703 | .Dq no . |
667 | .It Cm Port | 704 | .It Cm Port |
668 | Specifies the port number to connect on the remote host. | 705 | Specifies the port number to connect on the remote host. |
669 | Default is 22. | 706 | The default is 22. |
670 | .It Cm PreferredAuthentications | 707 | .It Cm PreferredAuthentications |
671 | Specifies the order in which the client should try protocol 2 | 708 | Specifies the order in which the client should try protocol 2 |
672 | authentication methods. | 709 | authentication methods. |
@@ -675,20 +712,24 @@ This allows a client to prefer one method (e.g.\& | |||
675 | over another method (e.g.\& | 712 | over another method (e.g.\& |
676 | .Cm password ) | 713 | .Cm password ) |
677 | The default for this option is: | 714 | The default for this option is: |
678 | .Dq hostbased,publickey,keyboard-interactive,password . | 715 | .Do gssapi-with-mic , |
716 | hostbased, | ||
717 | publickey, | ||
718 | keyboard-interactive, | ||
719 | password | ||
720 | .Dc . | ||
679 | .It Cm Protocol | 721 | .It Cm Protocol |
680 | Specifies the protocol versions | 722 | Specifies the protocol versions |
681 | .Nm ssh | 723 | .Xr ssh 1 |
682 | should support in order of preference. | 724 | should support in order of preference. |
683 | The possible values are | 725 | The possible values are |
684 | .Dq 1 | 726 | .Sq 1 |
685 | and | 727 | and |
686 | .Dq 2 . | 728 | .Sq 2 . |
687 | Multiple versions must be comma-separated. | 729 | Multiple versions must be comma-separated. |
688 | The default is | 730 | The default is |
689 | .Dq 2,1 . | 731 | .Dq 2,1 . |
690 | This means that | 732 | This means that ssh |
691 | .Nm ssh | ||
692 | tries version 2 and falls back to version 1 | 733 | tries version 2 and falls back to version 1 |
693 | if version 2 is not available. | 734 | if version 2 is not available. |
694 | .It Cm ProxyCommand | 735 | .It Cm ProxyCommand |
@@ -746,9 +787,9 @@ or | |||
746 | .Sq G | 787 | .Sq G |
747 | to indicate Kilobytes, Megabytes, or Gigabytes, respectively. | 788 | to indicate Kilobytes, Megabytes, or Gigabytes, respectively. |
748 | The default is between | 789 | The default is between |
749 | .Dq 1G | 790 | .Sq 1G |
750 | and | 791 | and |
751 | .Dq 4G , | 792 | .Sq 4G , |
752 | depending on the cipher. | 793 | depending on the cipher. |
753 | This option applies to protocol version 2 only. | 794 | This option applies to protocol version 2 only. |
754 | .It Cm RemoteForward | 795 | .It Cm RemoteForward |
@@ -794,7 +835,7 @@ or | |||
794 | The default is | 835 | The default is |
795 | .Dq no . | 836 | .Dq no . |
796 | This option applies to protocol version 1 only and requires | 837 | This option applies to protocol version 1 only and requires |
797 | .Nm ssh | 838 | .Xr ssh 1 |
798 | to be setuid root. | 839 | to be setuid root. |
799 | .It Cm RSAAuthentication | 840 | .It Cm RSAAuthentication |
800 | Specifies whether to try RSA authentication. | 841 | Specifies whether to try RSA authentication. |
@@ -812,31 +853,31 @@ Note that this option applies to protocol version 1 only. | |||
812 | Specifies what variables from the local | 853 | Specifies what variables from the local |
813 | .Xr environ 7 | 854 | .Xr environ 7 |
814 | should be sent to the server. | 855 | should be sent to the server. |
815 | Note that environment passing is only supported for protocol 2, the | 856 | Note that environment passing is only supported for protocol 2. |
816 | server must also support it, and the server must be configured to | 857 | The server must also support it, and the server must be configured to |
817 | accept these environment variables. | 858 | accept these environment variables. |
818 | Refer to | 859 | Refer to |
819 | .Cm AcceptEnv | 860 | .Cm AcceptEnv |
820 | in | 861 | in |
821 | .Xr sshd_config 5 | 862 | .Xr sshd_config 5 |
822 | for how to configure the server. | 863 | for how to configure the server. |
823 | Variables are specified by name, which may contain the wildcard characters | 864 | Variables are specified by name, which may contain wildcard characters. |
824 | .Ql \&* | ||
825 | and | ||
826 | .Ql \&? . | ||
827 | Multiple environment variables may be separated by whitespace or spread | 865 | Multiple environment variables may be separated by whitespace or spread |
828 | across multiple | 866 | across multiple |
829 | .Cm SendEnv | 867 | .Cm SendEnv |
830 | directives. | 868 | directives. |
831 | The default is not to send any environment variables. | 869 | The default is not to send any environment variables. |
870 | .Pp | ||
871 | See | ||
872 | .Sx PATTERNS | ||
873 | for more information on patterns. | ||
832 | .It Cm ServerAliveCountMax | 874 | .It Cm ServerAliveCountMax |
833 | Sets the number of server alive messages (see below) which may be | 875 | Sets the number of server alive messages (see below) which may be |
834 | sent without | 876 | sent without |
835 | .Nm ssh | 877 | .Xr ssh 1 |
836 | receiving any messages back from the server. | 878 | receiving any messages back from the server. |
837 | If this threshold is reached while server alive messages are being sent, | 879 | If this threshold is reached while server alive messages are being sent, |
838 | .Nm ssh | 880 | ssh will disconnect from the server, terminating the session. |
839 | will disconnect from the server, terminating the session. | ||
840 | It is important to note that the use of server alive messages is very | 881 | It is important to note that the use of server alive messages is very |
841 | different from | 882 | different from |
842 | .Cm TCPKeepAlive | 883 | .Cm TCPKeepAlive |
@@ -852,18 +893,18 @@ server depend on knowing when a connection has become inactive. | |||
852 | The default value is 3. | 893 | The default value is 3. |
853 | If, for example, | 894 | If, for example, |
854 | .Cm ServerAliveInterval | 895 | .Cm ServerAliveInterval |
855 | (see below) is set to 15, and | 896 | (see below) is set to 15 and |
856 | .Cm ServerAliveCountMax | 897 | .Cm ServerAliveCountMax |
857 | is left at the default, if the server becomes unresponsive ssh | 898 | is left at the default, if the server becomes unresponsive, |
858 | will disconnect after approximately 45 seconds. | 899 | ssh will disconnect after approximately 45 seconds. |
859 | This option works when using protocol version 2 only; in protocol version | 900 | This option applies to protocol version 2 only; in protocol version |
860 | 1 there is no mechanism to request a response from the server to the | 901 | 1 there is no mechanism to request a response from the server to the |
861 | server alive messages, so disconnection is the responsibility of the TCP | 902 | server alive messages, so disconnection is the responsibility of the TCP |
862 | stack. | 903 | stack. |
863 | .It Cm ServerAliveInterval | 904 | .It Cm ServerAliveInterval |
864 | Sets a timeout interval in seconds after which if no data has been received | 905 | Sets a timeout interval in seconds after which if no data has been received |
865 | from the server, | 906 | from the server, |
866 | .Nm ssh | 907 | .Xr ssh 1 |
867 | will send a message through the encrypted | 908 | will send a message through the encrypted |
868 | channel to request a response from the server. | 909 | channel to request a response from the server. |
869 | The default | 910 | The default |
@@ -894,41 +935,39 @@ This is a Debian-specific option. | |||
894 | .It Cm SmartcardDevice | 935 | .It Cm SmartcardDevice |
895 | Specifies which smartcard device to use. | 936 | Specifies which smartcard device to use. |
896 | The argument to this keyword is the device | 937 | The argument to this keyword is the device |
897 | .Nm ssh | 938 | .Xr ssh 1 |
898 | should use to communicate with a smartcard used for storing the user's | 939 | should use to communicate with a smartcard used for storing the user's |
899 | private RSA key. | 940 | private RSA key. |
900 | By default, no device is specified and smartcard support is not activated. | 941 | By default, no device is specified and smartcard support is not activated. |
901 | .It Cm StrictHostKeyChecking | 942 | .It Cm StrictHostKeyChecking |
902 | If this flag is set to | 943 | If this flag is set to |
903 | .Dq yes , | 944 | .Dq yes , |
904 | .Nm ssh | 945 | .Xr ssh 1 |
905 | will never automatically add host keys to the | 946 | will never automatically add host keys to the |
906 | .Pa ~/.ssh/known_hosts | 947 | .Pa ~/.ssh/known_hosts |
907 | file, and refuses to connect to hosts whose host key has changed. | 948 | file, and refuses to connect to hosts whose host key has changed. |
908 | This provides maximum protection against trojan horse attacks, | 949 | This provides maximum protection against trojan horse attacks, |
909 | however, can be annoying when the | 950 | though it can be annoying when the |
910 | .Pa /etc/ssh/ssh_known_hosts | 951 | .Pa /etc/ssh/ssh_known_hosts |
911 | file is poorly maintained, or connections to new hosts are | 952 | file is poorly maintained or when connections to new hosts are |
912 | frequently made. | 953 | frequently made. |
913 | This option forces the user to manually | 954 | This option forces the user to manually |
914 | add all new hosts. | 955 | add all new hosts. |
915 | If this flag is set to | 956 | If this flag is set to |
916 | .Dq no , | 957 | .Dq no , |
917 | .Nm ssh | 958 | ssh will automatically add new host keys to the |
918 | will automatically add new host keys to the | ||
919 | user known hosts files. | 959 | user known hosts files. |
920 | If this flag is set to | 960 | If this flag is set to |
921 | .Dq ask , | 961 | .Dq ask , |
922 | new host keys | 962 | new host keys |
923 | will be added to the user known host files only after the user | 963 | will be added to the user known host files only after the user |
924 | has confirmed that is what they really want to do, and | 964 | has confirmed that is what they really want to do, and |
925 | .Nm ssh | 965 | ssh will refuse to connect to hosts whose host key has changed. |
926 | will refuse to connect to hosts whose host key has changed. | ||
927 | The host keys of | 966 | The host keys of |
928 | known hosts will be verified automatically in all cases. | 967 | known hosts will be verified automatically in all cases. |
929 | The argument must be | 968 | The argument must be |
930 | .Dq yes , | 969 | .Dq yes , |
931 | .Dq no | 970 | .Dq no , |
932 | or | 971 | or |
933 | .Dq ask . | 972 | .Dq ask . |
934 | The default is | 973 | The default is |
@@ -957,24 +996,44 @@ This is important in scripts, and many users want it too. | |||
957 | To disable TCP keepalive messages, the value should be set to | 996 | To disable TCP keepalive messages, the value should be set to |
958 | .Dq no . | 997 | .Dq no . |
959 | .It Cm Tunnel | 998 | .It Cm Tunnel |
960 | Request starting | 999 | Request |
961 | .Xr tun 4 | 1000 | .Xr tun 4 |
962 | device forwarding between the client and the server. | 1001 | device forwarding between the client and the server. |
963 | This option also allows requesting layer 2 (ethernet) | ||
964 | instead of layer 3 (point-to-point) tunneling from the server. | ||
965 | The argument must be | 1002 | The argument must be |
966 | .Dq yes , | 1003 | .Dq yes , |
967 | .Dq point-to-point , | 1004 | .Dq point-to-point |
1005 | (layer 3), | ||
968 | .Dq ethernet | 1006 | .Dq ethernet |
1007 | (layer 2), | ||
969 | or | 1008 | or |
970 | .Dq no . | 1009 | .Dq no . |
1010 | Specifying | ||
1011 | .Dq yes | ||
1012 | requests the default tunnel mode, which is | ||
1013 | .Dq point-to-point . | ||
971 | The default is | 1014 | The default is |
972 | .Dq no . | 1015 | .Dq no . |
973 | .It Cm TunnelDevice | 1016 | .It Cm TunnelDevice |
974 | Force a specified | 1017 | Specifies the |
975 | .Xr tun 4 | 1018 | .Xr tun 4 |
976 | device on the client. | 1019 | devices to open on the client |
977 | Without this option, the next available device will be used. | 1020 | .Pq Ar local_tun |
1021 | and the server | ||
1022 | .Pq Ar remote_tun . | ||
1023 | .Pp | ||
1024 | The argument must be | ||
1025 | .Sm off | ||
1026 | .Ar local_tun Op : Ar remote_tun . | ||
1027 | .Sm on | ||
1028 | The devices may be specified by numerical ID or the keyword | ||
1029 | .Dq any , | ||
1030 | which uses the next available tunnel device. | ||
1031 | If | ||
1032 | .Ar remote_tun | ||
1033 | is not specified, it defaults to | ||
1034 | .Dq any . | ||
1035 | The default is | ||
1036 | .Dq any:any . | ||
978 | .It Cm UsePrivilegedPort | 1037 | .It Cm UsePrivilegedPort |
979 | Specifies whether to use a privileged port for outgoing connections. | 1038 | Specifies whether to use a privileged port for outgoing connections. |
980 | The argument must be | 1039 | The argument must be |
@@ -984,8 +1043,8 @@ or | |||
984 | The default is | 1043 | The default is |
985 | .Dq no . | 1044 | .Dq no . |
986 | If set to | 1045 | If set to |
987 | .Dq yes | 1046 | .Dq yes , |
988 | .Nm ssh | 1047 | .Xr ssh 1 |
989 | must be setuid root. | 1048 | must be setuid root. |
990 | Note that this option must be set to | 1049 | Note that this option must be set to |
991 | .Dq yes | 1050 | .Dq yes |
@@ -1018,12 +1077,17 @@ need to confirm new host keys according to the | |||
1018 | option. | 1077 | option. |
1019 | The argument must be | 1078 | The argument must be |
1020 | .Dq yes , | 1079 | .Dq yes , |
1021 | .Dq no | 1080 | .Dq no , |
1022 | or | 1081 | or |
1023 | .Dq ask . | 1082 | .Dq ask . |
1024 | The default is | 1083 | The default is |
1025 | .Dq no . | 1084 | .Dq no . |
1026 | Note that this option applies to protocol version 2 only. | 1085 | Note that this option applies to protocol version 2 only. |
1086 | .Pp | ||
1087 | See also | ||
1088 | .Sx VERIFYING HOST KEYS | ||
1089 | in | ||
1090 | .Xr ssh 1 . | ||
1027 | .It Cm XAuthLocation | 1091 | .It Cm XAuthLocation |
1028 | Specifies the full pathname of the | 1092 | Specifies the full pathname of the |
1029 | .Xr xauth 1 | 1093 | .Xr xauth 1 |
@@ -1031,14 +1095,47 @@ program. | |||
1031 | The default is | 1095 | The default is |
1032 | .Pa /usr/X11R6/bin/xauth . | 1096 | .Pa /usr/X11R6/bin/xauth . |
1033 | .El | 1097 | .El |
1098 | .Sh PATTERNS | ||
1099 | A | ||
1100 | .Em pattern | ||
1101 | consists of zero or more non-whitespace characters, | ||
1102 | .Sq * | ||
1103 | (a wildcard that matches zero or more characters), | ||
1104 | or | ||
1105 | .Sq ?\& | ||
1106 | (a wildcard that matches exactly one character). | ||
1107 | For example, to specify a set of declarations for any host in the | ||
1108 | .Dq .co.uk | ||
1109 | set of domains, | ||
1110 | the following pattern could be used: | ||
1111 | .Pp | ||
1112 | .Dl Host *.co.uk | ||
1113 | .Pp | ||
1114 | The following pattern | ||
1115 | would match any host in the 192.168.0.[0-9] network range: | ||
1116 | .Pp | ||
1117 | .Dl Host 192.168.0.? | ||
1118 | .Pp | ||
1119 | A | ||
1120 | .Em pattern-list | ||
1121 | is a comma-separated list of patterns. | ||
1122 | Patterns within pattern-lists may be negated | ||
1123 | by preceding them with an exclamation mark | ||
1124 | .Pq Sq !\& . | ||
1125 | For example, | ||
1126 | to allow a key to be used from anywhere within an organisation | ||
1127 | except from the | ||
1128 | .Dq dialup | ||
1129 | pool, | ||
1130 | the following entry (in authorized_keys) could be used: | ||
1131 | .Pp | ||
1132 | .Dl from=\&"!*.dialup.example.com,*.example.com\&" | ||
1034 | .Sh FILES | 1133 | .Sh FILES |
1035 | .Bl -tag -width Ds | 1134 | .Bl -tag -width Ds |
1036 | .It Pa ~/.ssh/config | 1135 | .It Pa ~/.ssh/config |
1037 | This is the per-user configuration file. | 1136 | This is the per-user configuration file. |
1038 | The format of this file is described above. | 1137 | The format of this file is described above. |
1039 | This file is used by the | 1138 | This file is used by the SSH client. |
1040 | .Nm ssh | ||
1041 | client. | ||
1042 | Because of the potential for abuse, this file must have strict permissions: | 1139 | Because of the potential for abuse, this file must have strict permissions: |
1043 | read/write for the user, and not accessible by others. | 1140 | read/write for the user, and not accessible by others. |
1044 | It may be group-writable provided that the group in question contains only | 1141 | It may be group-writable provided that the group in question contains only |
diff --git a/sshconnect.c b/sshconnect.c index 8a63ef22b..3c888e36a 100644 --- a/sshconnect.c +++ b/sshconnect.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: sshconnect.c,v 1.200 2006/10/10 10:12:45 markus Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -13,12 +14,35 @@ | |||
13 | */ | 14 | */ |
14 | 15 | ||
15 | #include "includes.h" | 16 | #include "includes.h" |
16 | RCSID("$OpenBSD: sshconnect.c,v 1.171 2005/12/06 22:38:27 reyk Exp $"); | ||
17 | 17 | ||
18 | #include <openssl/bn.h> | 18 | #include <sys/types.h> |
19 | #include <sys/wait.h> | ||
20 | #include <sys/stat.h> | ||
21 | #include <sys/socket.h> | ||
22 | #ifdef HAVE_SYS_TIME_H | ||
23 | # include <sys/time.h> | ||
24 | #endif | ||
25 | |||
26 | #include <netinet/in.h> | ||
27 | #include <arpa/inet.h> | ||
28 | |||
29 | #include <ctype.h> | ||
30 | #include <errno.h> | ||
31 | #include <netdb.h> | ||
32 | #ifdef HAVE_PATHS_H | ||
33 | #include <paths.h> | ||
34 | #endif | ||
35 | #include <pwd.h> | ||
36 | #include <stdarg.h> | ||
37 | #include <stdio.h> | ||
38 | #include <stdlib.h> | ||
39 | #include <string.h> | ||
40 | #include <unistd.h> | ||
19 | 41 | ||
20 | #include "ssh.h" | ||
21 | #include "xmalloc.h" | 42 | #include "xmalloc.h" |
43 | #include "key.h" | ||
44 | #include "hostfile.h" | ||
45 | #include "ssh.h" | ||
22 | #include "rsa.h" | 46 | #include "rsa.h" |
23 | #include "buffer.h" | 47 | #include "buffer.h" |
24 | #include "packet.h" | 48 | #include "packet.h" |
@@ -32,6 +56,7 @@ RCSID("$OpenBSD: sshconnect.c,v 1.171 2005/12/06 22:38:27 reyk Exp $"); | |||
32 | #include "atomicio.h" | 56 | #include "atomicio.h" |
33 | #include "misc.h" | 57 | #include "misc.h" |
34 | #include "dns.h" | 58 | #include "dns.h" |
59 | #include "version.h" | ||
35 | 60 | ||
36 | char *client_version_string = NULL; | 61 | char *client_version_string = NULL; |
37 | char *server_version_string = NULL; | 62 | char *server_version_string = NULL; |
@@ -69,7 +94,6 @@ ssh_proxy_connect(const char *host, u_short port, const char *proxy_command) | |||
69 | int pin[2], pout[2]; | 94 | int pin[2], pout[2]; |
70 | pid_t pid; | 95 | pid_t pid; |
71 | char strport[NI_MAXSERV]; | 96 | char strport[NI_MAXSERV]; |
72 | size_t len; | ||
73 | 97 | ||
74 | /* Convert the port number into a string. */ | 98 | /* Convert the port number into a string. */ |
75 | snprintf(strport, sizeof strport, "%hu", port); | 99 | snprintf(strport, sizeof strport, "%hu", port); |
@@ -81,10 +105,7 @@ ssh_proxy_connect(const char *host, u_short port, const char *proxy_command) | |||
81 | * Use "exec" to avoid "sh -c" processes on some platforms | 105 | * Use "exec" to avoid "sh -c" processes on some platforms |
82 | * (e.g. Solaris) | 106 | * (e.g. Solaris) |
83 | */ | 107 | */ |
84 | len = strlen(proxy_command) + 6; | 108 | xasprintf(&tmp, "exec %s", proxy_command); |
85 | tmp = xmalloc(len); | ||
86 | strlcpy(tmp, "exec ", len); | ||
87 | strlcat(tmp, proxy_command, len); | ||
88 | command_string = percent_expand(tmp, "h", host, | 109 | command_string = percent_expand(tmp, "h", host, |
89 | "p", strport, (char *)NULL); | 110 | "p", strport, (char *)NULL); |
90 | xfree(tmp); | 111 | xfree(tmp); |
@@ -101,8 +122,7 @@ ssh_proxy_connect(const char *host, u_short port, const char *proxy_command) | |||
101 | char *argv[10]; | 122 | char *argv[10]; |
102 | 123 | ||
103 | /* Child. Permanently give up superuser privileges. */ | 124 | /* Child. Permanently give up superuser privileges. */ |
104 | seteuid(original_real_uid); | 125 | permanently_drop_suid(original_real_uid); |
105 | setuid(original_real_uid); | ||
106 | 126 | ||
107 | /* Redirect stdin and stdout. */ | 127 | /* Redirect stdin and stdout. */ |
108 | close(pin[1]); | 128 | close(pin[1]); |
@@ -212,7 +232,7 @@ timeout_connect(int sockfd, const struct sockaddr *serv_addr, | |||
212 | fd_set *fdset; | 232 | fd_set *fdset; |
213 | struct timeval tv; | 233 | struct timeval tv; |
214 | socklen_t optlen; | 234 | socklen_t optlen; |
215 | int fdsetsz, optval, rc, result = -1; | 235 | int optval, rc, result = -1; |
216 | 236 | ||
217 | if (timeout <= 0) | 237 | if (timeout <= 0) |
218 | return (connect(sockfd, serv_addr, addrlen)); | 238 | return (connect(sockfd, serv_addr, addrlen)); |
@@ -226,10 +246,8 @@ timeout_connect(int sockfd, const struct sockaddr *serv_addr, | |||
226 | if (errno != EINPROGRESS) | 246 | if (errno != EINPROGRESS) |
227 | return (-1); | 247 | return (-1); |
228 | 248 | ||
229 | fdsetsz = howmany(sockfd + 1, NFDBITS) * sizeof(fd_mask); | 249 | fdset = (fd_set *)xcalloc(howmany(sockfd + 1, NFDBITS), |
230 | fdset = (fd_set *)xmalloc(fdsetsz); | 250 | sizeof(fd_mask)); |
231 | |||
232 | memset(fdset, 0, fdsetsz); | ||
233 | FD_SET(sockfd, fdset); | 251 | FD_SET(sockfd, fdset); |
234 | tv.tv_sec = timeout; | 252 | tv.tv_sec = timeout; |
235 | tv.tv_usec = 0; | 253 | tv.tv_usec = 0; |
@@ -312,17 +330,16 @@ ssh_connect(const char *host, struct sockaddr_storage * hostaddr, | |||
312 | fatal("%s: %.100s: %s", __progname, host, | 330 | fatal("%s: %.100s: %s", __progname, host, |
313 | gai_strerror(gaierr)); | 331 | gai_strerror(gaierr)); |
314 | 332 | ||
315 | /* | 333 | for (attempt = 0; attempt < connection_attempts; attempt++) { |
316 | * Try to connect several times. On some machines, the first time | 334 | if (attempt > 0) { |
317 | * will sometimes fail. In general socket code appears to behave | 335 | /* Sleep a moment before retrying. */ |
318 | * quite magically on many machines. | 336 | sleep(1); |
319 | */ | ||
320 | for (attempt = 0; ;) { | ||
321 | if (attempt > 0) | ||
322 | debug("Trying again..."); | 337 | debug("Trying again..."); |
323 | 338 | } | |
324 | /* Loop through addresses for this host, and try each one in | 339 | /* |
325 | sequence until the connection succeeds. */ | 340 | * Loop through addresses for this host, and try each one in |
341 | * sequence until the connection succeeds. | ||
342 | */ | ||
326 | for (ai = aitop; ai; ai = ai->ai_next) { | 343 | for (ai = aitop; ai; ai = ai->ai_next) { |
327 | if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6) | 344 | if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6) |
328 | continue; | 345 | continue; |
@@ -349,29 +366,18 @@ ssh_connect(const char *host, struct sockaddr_storage * hostaddr, | |||
349 | } else { | 366 | } else { |
350 | debug("connect to address %s port %s: %s", | 367 | debug("connect to address %s port %s: %s", |
351 | ntop, strport, strerror(errno)); | 368 | ntop, strport, strerror(errno)); |
352 | /* | ||
353 | * Close the failed socket; there appear to | ||
354 | * be some problems when reusing a socket for | ||
355 | * which connect() has already returned an | ||
356 | * error. | ||
357 | */ | ||
358 | close(sock); | 369 | close(sock); |
370 | sock = -1; | ||
359 | } | 371 | } |
360 | } | 372 | } |
361 | if (ai) | 373 | if (sock != -1) |
362 | break; /* Successful connection. */ | 374 | break; /* Successful connection. */ |
363 | |||
364 | attempt++; | ||
365 | if (attempt >= connection_attempts) | ||
366 | break; | ||
367 | /* Sleep a moment before retrying. */ | ||
368 | sleep(1); | ||
369 | } | 375 | } |
370 | 376 | ||
371 | freeaddrinfo(aitop); | 377 | freeaddrinfo(aitop); |
372 | 378 | ||
373 | /* Return failure if we didn't get a successful connection. */ | 379 | /* Return failure if we didn't get a successful connection. */ |
374 | if (attempt >= connection_attempts) { | 380 | if (sock == -1) { |
375 | error("ssh: connect to host %s port %s: %s", | 381 | error("ssh: connect to host %s port %s: %s", |
376 | host, strport, strerror(errno)); | 382 | host, strport, strerror(errno)); |
377 | return (-1); | 383 | return (-1); |
@@ -403,22 +409,23 @@ ssh_exchange_identification(void) | |||
403 | int connection_in = packet_get_connection_in(); | 409 | int connection_in = packet_get_connection_in(); |
404 | int connection_out = packet_get_connection_out(); | 410 | int connection_out = packet_get_connection_out(); |
405 | int minor1 = PROTOCOL_MINOR_1; | 411 | int minor1 = PROTOCOL_MINOR_1; |
406 | u_int i; | 412 | u_int i, n; |
407 | struct sigaction sa, osa; | 413 | struct sigaction sa, osa; |
408 | 414 | ||
409 | /* Read other side's version identification. | 415 | /* Read other side's version identification. |
410 | * If SetupTimeOut has been set, give up after | 416 | * If SetupTimeOut has been set, give up after the specified amount |
411 | * the specified amount of time | 417 | * of time. |
412 | */ | 418 | */ |
413 | if(options.setuptimeout > 0){ | 419 | if (options.setuptimeout > 0) { |
414 | memset(&sa, 0, sizeof(sa)); | 420 | memset(&sa, 0, sizeof(sa)); |
415 | sa.sa_handler = banner_alarm_catch; | 421 | sa.sa_handler = banner_alarm_catch; |
416 | /*throw away any pending alarms, since we'd block otherwise*/ | 422 | /* throw away any pending alarms, since we'd block otherwise */ |
417 | alarm(0); | 423 | alarm(0); |
418 | sigaction(SIGALRM, &sa, &osa); | 424 | sigaction(SIGALRM, &sa, &osa); |
419 | alarm(options.setuptimeout); | 425 | alarm(options.setuptimeout); |
420 | } | 426 | } |
421 | for (;;) { | 427 | /* Read other side's version identification. */ |
428 | for (n = 0;;) { | ||
422 | for (i = 0; i < sizeof(buf) - 1; ) { | 429 | for (i = 0; i < sizeof(buf) - 1; ) { |
423 | ssize_t len = read(connection_in, &buf[i], 1); | 430 | ssize_t len = read(connection_in, &buf[i], 1); |
424 | if (banner_timedout) | 431 | if (banner_timedout) |
@@ -450,6 +457,8 @@ ssh_exchange_identification(void) | |||
450 | buf[i] = '\n'; | 457 | buf[i] = '\n'; |
451 | buf[i + 1] = 0; /**XXX wait for \n */ | 458 | buf[i + 1] = 0; /**XXX wait for \n */ |
452 | } | 459 | } |
460 | if (++n > 65536) | ||
461 | fatal("ssh_exchange_identification: No banner received"); | ||
453 | i++; | 462 | i++; |
454 | } | 463 | } |
455 | buf[sizeof(buf) - 1] = 0; | 464 | buf[sizeof(buf) - 1] = 0; |
@@ -464,7 +473,7 @@ ssh_exchange_identification(void) | |||
464 | */ | 473 | */ |
465 | if (options.setuptimeout > 0) { | 474 | if (options.setuptimeout > 0) { |
466 | alarm(0); | 475 | alarm(0); |
467 | sigaction(SIGALRM,&osa,NULL); | 476 | sigaction(SIGALRM, &osa, NULL); |
468 | } | 477 | } |
469 | 478 | ||
470 | /* | 479 | /* |
@@ -560,13 +569,17 @@ confirm(const char *prompt) | |||
560 | * check whether the supplied host key is valid, return -1 if the key | 569 | * check whether the supplied host key is valid, return -1 if the key |
561 | * is not valid. the user_hostfile will not be updated if 'readonly' is true. | 570 | * is not valid. the user_hostfile will not be updated if 'readonly' is true. |
562 | */ | 571 | */ |
572 | #define RDRW 0 | ||
573 | #define RDONLY 1 | ||
574 | #define ROQUIET 2 | ||
563 | static int | 575 | static int |
564 | check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key, | 576 | check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port, |
565 | int readonly, const char *user_hostfile, const char *system_hostfile) | 577 | Key *host_key, int readonly, const char *user_hostfile, |
578 | const char *system_hostfile) | ||
566 | { | 579 | { |
567 | Key *file_key; | 580 | Key *file_key; |
568 | const char *type = key_type(host_key); | 581 | const char *type = key_type(host_key); |
569 | char *ip = NULL; | 582 | char *ip = NULL, *host = NULL; |
570 | char hostline[1000], *hostp, *fp; | 583 | char hostline[1000], *hostp, *fp; |
571 | HostStatus host_status; | 584 | HostStatus host_status; |
572 | HostStatus ip_status; | 585 | HostStatus ip_status; |
@@ -617,7 +630,7 @@ check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key, | |||
617 | if (getnameinfo(hostaddr, salen, ntop, sizeof(ntop), | 630 | if (getnameinfo(hostaddr, salen, ntop, sizeof(ntop), |
618 | NULL, 0, NI_NUMERICHOST) != 0) | 631 | NULL, 0, NI_NUMERICHOST) != 0) |
619 | fatal("check_host_key: getnameinfo failed"); | 632 | fatal("check_host_key: getnameinfo failed"); |
620 | ip = xstrdup(ntop); | 633 | ip = put_host_port(ntop, port); |
621 | } else { | 634 | } else { |
622 | ip = xstrdup("<no hostip for proxy command>"); | 635 | ip = xstrdup("<no hostip for proxy command>"); |
623 | } | 636 | } |
@@ -625,18 +638,21 @@ check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key, | |||
625 | * Turn off check_host_ip if the connection is to localhost, via proxy | 638 | * Turn off check_host_ip if the connection is to localhost, via proxy |
626 | * command or if we don't have a hostname to compare with | 639 | * command or if we don't have a hostname to compare with |
627 | */ | 640 | */ |
628 | if (options.check_host_ip && | 641 | if (options.check_host_ip && (local || |
629 | (local || strcmp(host, ip) == 0 || options.proxy_command != NULL)) | 642 | strcmp(hostname, ip) == 0 || options.proxy_command != NULL)) |
630 | options.check_host_ip = 0; | 643 | options.check_host_ip = 0; |
631 | 644 | ||
632 | /* | 645 | /* |
633 | * Allow the user to record the key under a different name. This is | 646 | * Allow the user to record the key under a different name or |
634 | * useful for ssh tunneling over forwarded connections or if you run | 647 | * differentiate a non-standard port. This is useful for ssh |
635 | * multiple sshd's on different ports on the same machine. | 648 | * tunneling over forwarded connections or if you run multiple |
649 | * sshd's on different ports on the same machine. | ||
636 | */ | 650 | */ |
637 | if (options.host_key_alias != NULL) { | 651 | if (options.host_key_alias != NULL) { |
638 | host = options.host_key_alias; | 652 | host = xstrdup(options.host_key_alias); |
639 | debug("using hostkeyalias: %s", host); | 653 | debug("using hostkeyalias: %s", host); |
654 | } else { | ||
655 | host = put_host_port(hostname, port); | ||
640 | } | 656 | } |
641 | 657 | ||
642 | /* | 658 | /* |
@@ -705,6 +721,15 @@ check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key, | |||
705 | } | 721 | } |
706 | break; | 722 | break; |
707 | case HOST_NEW: | 723 | case HOST_NEW: |
724 | if (options.host_key_alias == NULL && port != 0 && | ||
725 | port != SSH_DEFAULT_PORT) { | ||
726 | debug("checking without port identifier"); | ||
727 | if (check_host_key(hostname, hostaddr, 0, host_key, 2, | ||
728 | user_hostfile, system_hostfile) == 0) { | ||
729 | debug("found matching key w/out port"); | ||
730 | break; | ||
731 | } | ||
732 | } | ||
708 | if (readonly) | 733 | if (readonly) |
709 | goto fail; | 734 | goto fail; |
710 | /* The host is new. */ | 735 | /* The host is new. */ |
@@ -784,6 +809,8 @@ check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key, | |||
784 | "list of known hosts.", hostp, type); | 809 | "list of known hosts.", hostp, type); |
785 | break; | 810 | break; |
786 | case HOST_CHANGED: | 811 | case HOST_CHANGED: |
812 | if (readonly == ROQUIET) | ||
813 | goto fail; | ||
787 | if (options.check_host_ip && host_ip_differ) { | 814 | if (options.check_host_ip && host_ip_differ) { |
788 | char *key_msg; | 815 | char *key_msg; |
789 | if (ip_status == HOST_NEW) | 816 | if (ip_status == HOST_NEW) |
@@ -822,7 +849,7 @@ check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key, | |||
822 | /* | 849 | /* |
823 | * If strict host key checking has not been requested, allow | 850 | * If strict host key checking has not been requested, allow |
824 | * the connection but without MITM-able authentication or | 851 | * the connection but without MITM-able authentication or |
825 | * agent forwarding. | 852 | * forwarding. |
826 | */ | 853 | */ |
827 | if (options.password_authentication) { | 854 | if (options.password_authentication) { |
828 | error("Password authentication is disabled to avoid " | 855 | error("Password authentication is disabled to avoid " |
@@ -857,6 +884,11 @@ check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key, | |||
857 | options.num_local_forwards = | 884 | options.num_local_forwards = |
858 | options.num_remote_forwards = 0; | 885 | options.num_remote_forwards = 0; |
859 | } | 886 | } |
887 | if (options.tun_open != SSH_TUNMODE_NO) { | ||
888 | error("Tunnel forwarding is disabled to avoid " | ||
889 | "man-in-the-middle attacks."); | ||
890 | options.tun_open = SSH_TUNMODE_NO; | ||
891 | } | ||
860 | /* | 892 | /* |
861 | * XXX Should permit the user to change to use the new id. | 893 | * XXX Should permit the user to change to use the new id. |
862 | * This could be done by converting the host key to an | 894 | * This could be done by converting the host key to an |
@@ -898,10 +930,12 @@ check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key, | |||
898 | } | 930 | } |
899 | 931 | ||
900 | xfree(ip); | 932 | xfree(ip); |
933 | xfree(host); | ||
901 | return 0; | 934 | return 0; |
902 | 935 | ||
903 | fail: | 936 | fail: |
904 | xfree(ip); | 937 | xfree(ip); |
938 | xfree(host); | ||
905 | return -1; | 939 | return -1; |
906 | } | 940 | } |
907 | 941 | ||
@@ -935,12 +969,13 @@ verify_host_key(char *host, struct sockaddr *hostaddr, Key *host_key) | |||
935 | /* return ok if the key can be found in an old keyfile */ | 969 | /* return ok if the key can be found in an old keyfile */ |
936 | if (stat(options.system_hostfile2, &st) == 0 || | 970 | if (stat(options.system_hostfile2, &st) == 0 || |
937 | stat(options.user_hostfile2, &st) == 0) { | 971 | stat(options.user_hostfile2, &st) == 0) { |
938 | if (check_host_key(host, hostaddr, host_key, /*readonly*/ 1, | 972 | if (check_host_key(host, hostaddr, options.port, host_key, |
939 | options.user_hostfile2, options.system_hostfile2) == 0) | 973 | RDONLY, options.user_hostfile2, |
974 | options.system_hostfile2) == 0) | ||
940 | return 0; | 975 | return 0; |
941 | } | 976 | } |
942 | return check_host_key(host, hostaddr, host_key, /*readonly*/ 0, | 977 | return check_host_key(host, hostaddr, options.port, host_key, |
943 | options.user_hostfile, options.system_hostfile); | 978 | RDRW, options.user_hostfile, options.system_hostfile); |
944 | } | 979 | } |
945 | 980 | ||
946 | /* | 981 | /* |
@@ -964,7 +999,7 @@ ssh_login(Sensitive *sensitive, const char *orighost, | |||
964 | host = xstrdup(orighost); | 999 | host = xstrdup(orighost); |
965 | for (cp = host; *cp; cp++) | 1000 | for (cp = host; *cp; cp++) |
966 | if (isupper(*cp)) | 1001 | if (isupper(*cp)) |
967 | *cp = tolower(*cp); | 1002 | *cp = (char)tolower(*cp); |
968 | 1003 | ||
969 | /* Exchange protocol version identification strings with the server. */ | 1004 | /* Exchange protocol version identification strings with the server. */ |
970 | ssh_exchange_identification(); | 1005 | ssh_exchange_identification(); |
@@ -981,6 +1016,7 @@ ssh_login(Sensitive *sensitive, const char *orighost, | |||
981 | ssh_kex(host, hostaddr); | 1016 | ssh_kex(host, hostaddr); |
982 | ssh_userauth1(local_user, server_user, host, sensitive); | 1017 | ssh_userauth1(local_user, server_user, host, sensitive); |
983 | } | 1018 | } |
1019 | xfree(local_user); | ||
984 | } | 1020 | } |
985 | 1021 | ||
986 | void | 1022 | void |
@@ -994,8 +1030,7 @@ ssh_put_password(char *password) | |||
994 | return; | 1030 | return; |
995 | } | 1031 | } |
996 | size = roundup(strlen(password) + 1, 32); | 1032 | size = roundup(strlen(password) + 1, 32); |
997 | padded = xmalloc(size); | 1033 | padded = xcalloc(1, size); |
998 | memset(padded, 0, size); | ||
999 | strlcpy(padded, password, size); | 1034 | strlcpy(padded, password, size); |
1000 | packet_put_string(padded, size); | 1035 | packet_put_string(padded, size); |
1001 | memset(padded, 0, size); | 1036 | memset(padded, 0, size); |
diff --git a/sshconnect.h b/sshconnect.h index e7c7a2b34..4e66bbffc 100644 --- a/sshconnect.h +++ b/sshconnect.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshconnect.h,v 1.18 2005/12/06 22:38:28 reyk Exp $ */ | 1 | /* $OpenBSD: sshconnect.h,v 1.23 2006/08/03 03:34:42 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
@@ -23,8 +23,6 @@ | |||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 | */ | 25 | */ |
26 | #ifndef SSHCONNECT_H | ||
27 | #define SSHCONNECT_H | ||
28 | 26 | ||
29 | typedef struct Sensitive Sensitive; | 27 | typedef struct Sensitive Sensitive; |
30 | struct Sensitive { | 28 | struct Sensitive { |
@@ -54,16 +52,18 @@ int ssh_local_cmd(const char *); | |||
54 | /* | 52 | /* |
55 | * Macros to raise/lower permissions. | 53 | * Macros to raise/lower permissions. |
56 | */ | 54 | */ |
57 | #define PRIV_START do { \ | 55 | #define PRIV_START do { \ |
58 | int save_errno = errno; \ | 56 | int save_errno = errno; \ |
59 | (void)seteuid(original_effective_uid); \ | 57 | if (seteuid(original_effective_uid) != 0) \ |
60 | errno = save_errno; \ | 58 | fatal("PRIV_START: seteuid: %s", \ |
59 | strerror(errno)); \ | ||
60 | errno = save_errno; \ | ||
61 | } while (0) | 61 | } while (0) |
62 | 62 | ||
63 | #define PRIV_END do { \ | 63 | #define PRIV_END do { \ |
64 | int save_errno = errno; \ | 64 | int save_errno = errno; \ |
65 | (void)seteuid(original_real_uid); \ | 65 | if (seteuid(original_real_uid) != 0) \ |
66 | errno = save_errno; \ | 66 | fatal("PRIV_END: seteuid: %s", \ |
67 | strerror(errno)); \ | ||
68 | errno = save_errno; \ | ||
67 | } while (0) | 69 | } while (0) |
68 | |||
69 | #endif | ||
diff --git a/sshconnect1.c b/sshconnect1.c index 440d7c5bd..fd07bbf74 100644 --- a/sshconnect1.c +++ b/sshconnect1.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: sshconnect1.c,v 1.70 2006/11/06 21:25:28 markus Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -13,28 +14,38 @@ | |||
13 | */ | 14 | */ |
14 | 15 | ||
15 | #include "includes.h" | 16 | #include "includes.h" |
16 | RCSID("$OpenBSD: sshconnect1.c,v 1.62 2005/10/30 08:52:18 djm Exp $"); | 17 | |
18 | #include <sys/types.h> | ||
19 | #include <sys/socket.h> | ||
17 | 20 | ||
18 | #include <openssl/bn.h> | 21 | #include <openssl/bn.h> |
19 | #include <openssl/md5.h> | 22 | #include <openssl/md5.h> |
20 | 23 | ||
24 | #include <stdarg.h> | ||
25 | #include <stdio.h> | ||
26 | #include <stdlib.h> | ||
27 | #include <string.h> | ||
28 | #include <signal.h> | ||
29 | #include <pwd.h> | ||
30 | |||
31 | #include "xmalloc.h" | ||
21 | #include "ssh.h" | 32 | #include "ssh.h" |
22 | #include "ssh1.h" | 33 | #include "ssh1.h" |
23 | #include "xmalloc.h" | ||
24 | #include "rsa.h" | 34 | #include "rsa.h" |
25 | #include "buffer.h" | 35 | #include "buffer.h" |
26 | #include "packet.h" | 36 | #include "packet.h" |
37 | #include "key.h" | ||
38 | #include "cipher.h" | ||
27 | #include "kex.h" | 39 | #include "kex.h" |
28 | #include "uidswap.h" | 40 | #include "uidswap.h" |
29 | #include "log.h" | 41 | #include "log.h" |
30 | #include "readconf.h" | 42 | #include "readconf.h" |
31 | #include "key.h" | ||
32 | #include "authfd.h" | 43 | #include "authfd.h" |
33 | #include "sshconnect.h" | 44 | #include "sshconnect.h" |
34 | #include "authfile.h" | 45 | #include "authfile.h" |
35 | #include "misc.h" | 46 | #include "misc.h" |
36 | #include "cipher.h" | ||
37 | #include "canohost.h" | 47 | #include "canohost.h" |
48 | #include "hostfile.h" | ||
38 | #include "auth.h" | 49 | #include "auth.h" |
39 | 50 | ||
40 | /* Session id for the current session. */ | 51 | /* Session id for the current session. */ |
@@ -197,7 +208,7 @@ try_rsa_authentication(int idx) | |||
197 | BIGNUM *challenge; | 208 | BIGNUM *challenge; |
198 | Key *public, *private; | 209 | Key *public, *private; |
199 | char buf[300], *passphrase, *comment, *authfile; | 210 | char buf[300], *passphrase, *comment, *authfile; |
200 | int i, type, quit; | 211 | int i, perm_ok = 1, type, quit; |
201 | 212 | ||
202 | public = options.identity_keys[idx]; | 213 | public = options.identity_keys[idx]; |
203 | authfile = options.identity_files[idx]; | 214 | authfile = options.identity_files[idx]; |
@@ -243,15 +254,16 @@ try_rsa_authentication(int idx) | |||
243 | if (public->flags & KEY_FLAG_EXT) | 254 | if (public->flags & KEY_FLAG_EXT) |
244 | private = public; | 255 | private = public; |
245 | else | 256 | else |
246 | private = key_load_private_type(KEY_RSA1, authfile, "", NULL); | 257 | private = key_load_private_type(KEY_RSA1, authfile, "", NULL, |
247 | if (private == NULL && !options.batch_mode) { | 258 | &perm_ok); |
259 | if (private == NULL && !options.batch_mode && perm_ok) { | ||
248 | snprintf(buf, sizeof(buf), | 260 | snprintf(buf, sizeof(buf), |
249 | "Enter passphrase for RSA key '%.100s': ", comment); | 261 | "Enter passphrase for RSA key '%.100s': ", comment); |
250 | for (i = 0; i < options.number_of_password_prompts; i++) { | 262 | for (i = 0; i < options.number_of_password_prompts; i++) { |
251 | passphrase = read_passphrase(buf, 0); | 263 | passphrase = read_passphrase(buf, 0); |
252 | if (strcmp(passphrase, "") != 0) { | 264 | if (strcmp(passphrase, "") != 0) { |
253 | private = key_load_private_type(KEY_RSA1, | 265 | private = key_load_private_type(KEY_RSA1, |
254 | authfile, passphrase, NULL); | 266 | authfile, passphrase, NULL, NULL); |
255 | quit = 0; | 267 | quit = 0; |
256 | } else { | 268 | } else { |
257 | debug2("no passphrase given, try next key"); | 269 | debug2("no passphrase given, try next key"); |
@@ -268,7 +280,7 @@ try_rsa_authentication(int idx) | |||
268 | xfree(comment); | 280 | xfree(comment); |
269 | 281 | ||
270 | if (private == NULL) { | 282 | if (private == NULL) { |
271 | if (!options.batch_mode) | 283 | if (!options.batch_mode && perm_ok) |
272 | error("Bad passphrase."); | 284 | error("Bad passphrase."); |
273 | 285 | ||
274 | /* Send a dummy response packet to avoid protocol error. */ | 286 | /* Send a dummy response packet to avoid protocol error. */ |
@@ -551,14 +563,20 @@ ssh_kex(char *host, struct sockaddr *hostaddr) | |||
551 | * the first 16 bytes of the session id. | 563 | * the first 16 bytes of the session id. |
552 | */ | 564 | */ |
553 | if ((key = BN_new()) == NULL) | 565 | if ((key = BN_new()) == NULL) |
554 | fatal("respond_to_rsa_challenge: BN_new failed"); | 566 | fatal("ssh_kex: BN_new failed"); |
555 | BN_set_word(key, 0); | 567 | if (BN_set_word(key, 0) == 0) |
568 | fatal("ssh_kex: BN_set_word failed"); | ||
556 | for (i = 0; i < SSH_SESSION_KEY_LENGTH; i++) { | 569 | for (i = 0; i < SSH_SESSION_KEY_LENGTH; i++) { |
557 | BN_lshift(key, key, 8); | 570 | if (BN_lshift(key, key, 8) == 0) |
558 | if (i < 16) | 571 | fatal("ssh_kex: BN_lshift failed"); |
559 | BN_add_word(key, session_key[i] ^ session_id[i]); | 572 | if (i < 16) { |
560 | else | 573 | if (BN_add_word(key, session_key[i] ^ session_id[i]) |
561 | BN_add_word(key, session_key[i]); | 574 | == 0) |
575 | fatal("ssh_kex: BN_add_word failed"); | ||
576 | } else { | ||
577 | if (BN_add_word(key, session_key[i]) == 0) | ||
578 | fatal("ssh_kex: BN_add_word failed"); | ||
579 | } | ||
562 | } | 580 | } |
563 | 581 | ||
564 | /* | 582 | /* |
diff --git a/sshconnect2.c b/sshconnect2.c index 566571ae9..63e9369b1 100644 --- a/sshconnect2.c +++ b/sshconnect2.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: sshconnect2.c,v 1.162 2006/08/30 00:06:51 dtucker Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
3 | * | 4 | * |
@@ -23,18 +24,30 @@ | |||
23 | */ | 24 | */ |
24 | 25 | ||
25 | #include "includes.h" | 26 | #include "includes.h" |
26 | RCSID("$OpenBSD: sshconnect2.c,v 1.143 2005/10/14 02:17:59 stevesk Exp $"); | 27 | |
28 | #include <sys/types.h> | ||
29 | #include <sys/socket.h> | ||
30 | #include <sys/wait.h> | ||
31 | #include <sys/stat.h> | ||
32 | |||
33 | #include <errno.h> | ||
34 | #include <pwd.h> | ||
35 | #include <signal.h> | ||
36 | #include <stdarg.h> | ||
37 | #include <stdio.h> | ||
38 | #include <string.h> | ||
39 | #include <unistd.h> | ||
27 | 40 | ||
28 | #include "openbsd-compat/sys-queue.h" | 41 | #include "openbsd-compat/sys-queue.h" |
29 | 42 | ||
43 | #include "xmalloc.h" | ||
30 | #include "ssh.h" | 44 | #include "ssh.h" |
31 | #include "ssh2.h" | 45 | #include "ssh2.h" |
32 | #include "xmalloc.h" | ||
33 | #include "buffer.h" | 46 | #include "buffer.h" |
34 | #include "packet.h" | 47 | #include "packet.h" |
35 | #include "compat.h" | 48 | #include "compat.h" |
36 | #include "bufaux.h" | ||
37 | #include "cipher.h" | 49 | #include "cipher.h" |
50 | #include "key.h" | ||
38 | #include "kex.h" | 51 | #include "kex.h" |
39 | #include "myproposal.h" | 52 | #include "myproposal.h" |
40 | #include "sshconnect.h" | 53 | #include "sshconnect.h" |
@@ -49,6 +62,7 @@ RCSID("$OpenBSD: sshconnect2.c,v 1.143 2005/10/14 02:17:59 stevesk Exp $"); | |||
49 | #include "canohost.h" | 62 | #include "canohost.h" |
50 | #include "msg.h" | 63 | #include "msg.h" |
51 | #include "pathnames.h" | 64 | #include "pathnames.h" |
65 | #include "uidswap.h" | ||
52 | 66 | ||
53 | #ifdef GSSAPI | 67 | #ifdef GSSAPI |
54 | #include "ssh-gss.h" | 68 | #include "ssh-gss.h" |
@@ -85,19 +99,19 @@ ssh_kex2(char *host, struct sockaddr *hostaddr) | |||
85 | Kex *kex; | 99 | Kex *kex; |
86 | 100 | ||
87 | #ifdef GSSAPI | 101 | #ifdef GSSAPI |
88 | char *orig, *gss = NULL; | 102 | char *orig = NULL, *gss = NULL; |
89 | int len; | 103 | char *gss_host = NULL; |
90 | char *gss_host = NULL; | ||
91 | #endif | 104 | #endif |
92 | 105 | ||
93 | xxx_host = host; | 106 | xxx_host = host; |
94 | xxx_hostaddr = hostaddr; | 107 | xxx_hostaddr = hostaddr; |
95 | 108 | ||
96 | #ifdef GSSAPI | 109 | #ifdef GSSAPI |
97 | if (options.gss_authentication) { | 110 | if (options.gss_keyex) { |
98 | /* Add the GSSAPI mechanisms currently supported on this | 111 | /* Add the GSSAPI mechanisms currently supported on this |
99 | * client to the key exchange algorithm proposal */ | 112 | * client to the key exchange algorithm proposal */ |
100 | orig = myproposal[PROPOSAL_KEX_ALGS]; | 113 | orig = myproposal[PROPOSAL_KEX_ALGS]; |
114 | |||
101 | if (options.gss_trust_dns) | 115 | if (options.gss_trust_dns) |
102 | gss_host = (char *)get_canonical_hostname(1); | 116 | gss_host = (char *)get_canonical_hostname(1); |
103 | else | 117 | else |
@@ -106,10 +120,8 @@ ssh_kex2(char *host, struct sockaddr *hostaddr) | |||
106 | gss = ssh_gssapi_client_mechanisms(gss_host); | 120 | gss = ssh_gssapi_client_mechanisms(gss_host); |
107 | if (gss) { | 121 | if (gss) { |
108 | debug("Offering GSSAPI proposal: %s", gss); | 122 | debug("Offering GSSAPI proposal: %s", gss); |
109 | len = strlen(orig) + strlen(gss) + 2; | 123 | xasprintf(&myproposal[PROPOSAL_KEX_ALGS], |
110 | myproposal[PROPOSAL_KEX_ALGS] = xmalloc(len); | 124 | "%s,%s", gss, orig); |
111 | snprintf(myproposal[PROPOSAL_KEX_ALGS], len, "%s,%s", | ||
112 | gss, orig); | ||
113 | } | 125 | } |
114 | } | 126 | } |
115 | #endif | 127 | #endif |
@@ -144,11 +156,9 @@ ssh_kex2(char *host, struct sockaddr *hostaddr) | |||
144 | #ifdef GSSAPI | 156 | #ifdef GSSAPI |
145 | /* If we've got GSSAPI algorithms, then we also support the | 157 | /* If we've got GSSAPI algorithms, then we also support the |
146 | * 'null' hostkey, as a last resort */ | 158 | * 'null' hostkey, as a last resort */ |
147 | if (gss) { | 159 | if (options.gss_keyex && gss) { |
148 | orig = myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS]; | 160 | orig = myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS]; |
149 | len = strlen(orig) + sizeof(",null"); | 161 | xasprintf(&myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS], |
150 | myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = xmalloc(len); | ||
151 | snprintf(myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS], len, | ||
152 | "%s,null", orig); | 162 | "%s,null", orig); |
153 | } | 163 | } |
154 | #endif | 164 | #endif |
@@ -161,9 +171,11 @@ ssh_kex2(char *host, struct sockaddr *hostaddr) | |||
161 | kex->kex[KEX_DH_GRP1_SHA1] = kexdh_client; | 171 | kex->kex[KEX_DH_GRP1_SHA1] = kexdh_client; |
162 | kex->kex[KEX_DH_GRP14_SHA1] = kexdh_client; | 172 | kex->kex[KEX_DH_GRP14_SHA1] = kexdh_client; |
163 | kex->kex[KEX_DH_GEX_SHA1] = kexgex_client; | 173 | kex->kex[KEX_DH_GEX_SHA1] = kexgex_client; |
174 | kex->kex[KEX_DH_GEX_SHA256] = kexgex_client; | ||
164 | #ifdef GSSAPI | 175 | #ifdef GSSAPI |
165 | if (options.gss_authentication) { | 176 | if (options.gss_keyex) { |
166 | kex->kex[KEX_GSS_GRP1_SHA1] = kexgss_client; | 177 | kex->kex[KEX_GSS_GRP1_SHA1] = kexgss_client; |
178 | kex->kex[KEX_GSS_GRP14_SHA1] = kexgss_client; | ||
167 | kex->kex[KEX_GSS_GEX_SHA1] = kexgss_client; | 179 | kex->kex[KEX_GSS_GEX_SHA1] = kexgss_client; |
168 | } | 180 | } |
169 | #endif | 181 | #endif |
@@ -423,7 +435,7 @@ input_userauth_banner(int type, u_int32_t seq, void *ctxt) | |||
423 | debug3("input_userauth_banner"); | 435 | debug3("input_userauth_banner"); |
424 | msg = packet_get_string(NULL); | 436 | msg = packet_get_string(NULL); |
425 | lang = packet_get_string(NULL); | 437 | lang = packet_get_string(NULL); |
426 | if (options.log_level > SYSLOG_LEVEL_QUIET) | 438 | if (options.log_level >= SYSLOG_LEVEL_INFO) |
427 | fprintf(stderr, "%s", msg); | 439 | fprintf(stderr, "%s", msg); |
428 | xfree(msg); | 440 | xfree(msg); |
429 | xfree(lang); | 441 | xfree(lang); |
@@ -545,8 +557,14 @@ userauth_gssapi(Authctxt *authctxt) | |||
545 | static u_int mech = 0; | 557 | static u_int mech = 0; |
546 | OM_uint32 min; | 558 | OM_uint32 min; |
547 | int ok = 0; | 559 | int ok = 0; |
560 | char *gss_host = NULL; | ||
548 | int old_gssapi_method; | 561 | int old_gssapi_method; |
549 | 562 | ||
563 | if (options.gss_trust_dns) | ||
564 | gss_host = (char *)get_canonical_hostname(1); | ||
565 | else | ||
566 | gss_host = (char *)authctxt->host; | ||
567 | |||
550 | /* Try one GSSAPI method at a time, rather than sending them all at | 568 | /* Try one GSSAPI method at a time, rather than sending them all at |
551 | * once. */ | 569 | * once. */ |
552 | 570 | ||
@@ -555,15 +573,10 @@ userauth_gssapi(Authctxt *authctxt) | |||
555 | 573 | ||
556 | /* Check to see if the mechanism is usable before we offer it */ | 574 | /* Check to see if the mechanism is usable before we offer it */ |
557 | while (mech < gss_supported->count && !ok) { | 575 | while (mech < gss_supported->count && !ok) { |
558 | if (gssctxt) | ||
559 | ssh_gssapi_delete_ctx(&gssctxt); | ||
560 | ssh_gssapi_build_ctx(&gssctxt); | ||
561 | ssh_gssapi_set_oid(gssctxt, &gss_supported->elements[mech]); | ||
562 | |||
563 | /* My DER encoding requires length<128 */ | 576 | /* My DER encoding requires length<128 */ |
564 | if (gss_supported->elements[mech].length < 128 && | 577 | if (gss_supported->elements[mech].length < 128 && |
565 | !GSS_ERROR(ssh_gssapi_import_name(gssctxt, | 578 | ssh_gssapi_check_mechanism(&gssctxt, |
566 | authctxt->host))) { | 579 | &gss_supported->elements[mech], gss_host)) { |
567 | ok = 1; /* Mechanism works */ | 580 | ok = 1; /* Mechanism works */ |
568 | } else { | 581 | } else { |
569 | mech++; | 582 | mech++; |
@@ -587,7 +600,7 @@ userauth_gssapi(Authctxt *authctxt) | |||
587 | * for the old gssapi method. | 600 | * for the old gssapi method. |
588 | * We only include tagged oids for the new gssapi-with-mic method. | 601 | * We only include tagged oids for the new gssapi-with-mic method. |
589 | */ | 602 | */ |
590 | packet_put_int(old_gssapi_method?2:1); | 603 | packet_put_int(old_gssapi_method ? 2 : 1); |
591 | 604 | ||
592 | packet_put_int((gss_supported->elements[mech].length) + 2); | 605 | packet_put_int((gss_supported->elements[mech].length) + 2); |
593 | packet_put_char(SSH_GSS_OIDTYPE); | 606 | packet_put_char(SSH_GSS_OIDTYPE); |
@@ -595,7 +608,7 @@ userauth_gssapi(Authctxt *authctxt) | |||
595 | packet_put_raw(gss_supported->elements[mech].elements, | 608 | packet_put_raw(gss_supported->elements[mech].elements, |
596 | gss_supported->elements[mech].length); | 609 | gss_supported->elements[mech].length); |
597 | if (old_gssapi_method) { | 610 | if (old_gssapi_method) { |
598 | packet_put_int((gss_supported->elements[mech].length)); | 611 | packet_put_int(gss_supported->elements[mech].length); |
599 | packet_put_raw(gss_supported->elements[mech].elements, | 612 | packet_put_raw(gss_supported->elements[mech].elements, |
600 | gss_supported->elements[mech].length); | 613 | gss_supported->elements[mech].length); |
601 | } | 614 | } |
@@ -673,8 +686,8 @@ input_gssapi_response(int type, u_int32_t plen, void *ctxt) | |||
673 | { | 686 | { |
674 | Authctxt *authctxt = ctxt; | 687 | Authctxt *authctxt = ctxt; |
675 | Gssctxt *gssctxt; | 688 | Gssctxt *gssctxt; |
676 | int oidlen; | 689 | u_int oidlen; |
677 | char *oidv, *oidv_free; | 690 | u_char *oidv, *oidv_free; |
678 | 691 | ||
679 | if (authctxt == NULL) | 692 | if (authctxt == NULL) |
680 | fatal("input_gssapi_response: no authentication context"); | 693 | fatal("input_gssapi_response: no authentication context"); |
@@ -1086,14 +1099,16 @@ load_identity_file(char *filename) | |||
1086 | { | 1099 | { |
1087 | Key *private; | 1100 | Key *private; |
1088 | char prompt[300], *passphrase; | 1101 | char prompt[300], *passphrase; |
1089 | int quit, i; | 1102 | int perm_ok, quit, i; |
1090 | struct stat st; | 1103 | struct stat st; |
1091 | 1104 | ||
1092 | if (stat(filename, &st) < 0) { | 1105 | if (stat(filename, &st) < 0) { |
1093 | debug3("no such identity: %s", filename); | 1106 | debug3("no such identity: %s", filename); |
1094 | return NULL; | 1107 | return NULL; |
1095 | } | 1108 | } |
1096 | private = key_load_private_type(KEY_UNSPEC, filename, "", NULL); | 1109 | private = key_load_private_type(KEY_UNSPEC, filename, "", NULL, &perm_ok); |
1110 | if (!perm_ok) | ||
1111 | return NULL; | ||
1097 | if (private == NULL) { | 1112 | if (private == NULL) { |
1098 | if (options.batch_mode) | 1113 | if (options.batch_mode) |
1099 | return NULL; | 1114 | return NULL; |
@@ -1102,8 +1117,8 @@ load_identity_file(char *filename) | |||
1102 | for (i = 0; i < options.number_of_password_prompts; i++) { | 1117 | for (i = 0; i < options.number_of_password_prompts; i++) { |
1103 | passphrase = read_passphrase(prompt, 0); | 1118 | passphrase = read_passphrase(prompt, 0); |
1104 | if (strcmp(passphrase, "") != 0) { | 1119 | if (strcmp(passphrase, "") != 0) { |
1105 | private = key_load_private_type(KEY_UNSPEC, filename, | 1120 | private = key_load_private_type(KEY_UNSPEC, |
1106 | passphrase, NULL); | 1121 | filename, passphrase, NULL, NULL); |
1107 | quit = 0; | 1122 | quit = 0; |
1108 | } else { | 1123 | } else { |
1109 | debug2("no passphrase given, try next key"); | 1124 | debug2("no passphrase given, try next key"); |
@@ -1146,8 +1161,7 @@ pubkey_prepare(Authctxt *authctxt) | |||
1146 | if (key && key->type == KEY_RSA1) | 1161 | if (key && key->type == KEY_RSA1) |
1147 | continue; | 1162 | continue; |
1148 | options.identity_keys[i] = NULL; | 1163 | options.identity_keys[i] = NULL; |
1149 | id = xmalloc(sizeof(*id)); | 1164 | id = xcalloc(1, sizeof(*id)); |
1150 | memset(id, 0, sizeof(*id)); | ||
1151 | id->key = key; | 1165 | id->key = key; |
1152 | id->filename = xstrdup(options.identity_files[i]); | 1166 | id->filename = xstrdup(options.identity_files[i]); |
1153 | TAILQ_INSERT_TAIL(&files, id, next); | 1167 | TAILQ_INSERT_TAIL(&files, id, next); |
@@ -1171,8 +1185,7 @@ pubkey_prepare(Authctxt *authctxt) | |||
1171 | } | 1185 | } |
1172 | } | 1186 | } |
1173 | if (!found && !options.identities_only) { | 1187 | if (!found && !options.identities_only) { |
1174 | id = xmalloc(sizeof(*id)); | 1188 | id = xcalloc(1, sizeof(*id)); |
1175 | memset(id, 0, sizeof(*id)); | ||
1176 | id->key = key; | 1189 | id->key = key; |
1177 | id->filename = comment; | 1190 | id->filename = comment; |
1178 | id->ac = ac; | 1191 | id->ac = ac; |
@@ -1368,8 +1381,7 @@ ssh_keysign(Key *key, u_char **sigp, u_int *lenp, | |||
1368 | return -1; | 1381 | return -1; |
1369 | } | 1382 | } |
1370 | if (pid == 0) { | 1383 | if (pid == 0) { |
1371 | seteuid(getuid()); | 1384 | permanently_drop_suid(getuid()); |
1372 | setuid(getuid()); | ||
1373 | close(from[0]); | 1385 | close(from[0]); |
1374 | if (dup2(from[1], STDOUT_FILENO) < 0) | 1386 | if (dup2(from[1], STDOUT_FILENO) < 0) |
1375 | fatal("ssh_keysign: dup2: %s", strerror(errno)); | 1387 | fatal("ssh_keysign: dup2: %s", strerror(errno)); |
@@ -1449,12 +1461,11 @@ userauth_hostbased(Authctxt *authctxt) | |||
1449 | if (p == NULL) { | 1461 | if (p == NULL) { |
1450 | error("userauth_hostbased: cannot get local ipaddr/name"); | 1462 | error("userauth_hostbased: cannot get local ipaddr/name"); |
1451 | key_free(private); | 1463 | key_free(private); |
1464 | xfree(blob); | ||
1452 | return 0; | 1465 | return 0; |
1453 | } | 1466 | } |
1454 | len = strlen(p) + 2; | 1467 | len = strlen(p) + 2; |
1455 | chost = xmalloc(len); | 1468 | xasprintf(&chost, "%s.", p); |
1456 | strlcpy(chost, p, len); | ||
1457 | strlcat(chost, ".", len); | ||
1458 | debug2("userauth_hostbased: chost %s", chost); | 1469 | debug2("userauth_hostbased: chost %s", chost); |
1459 | xfree(p); | 1470 | xfree(p); |
1460 | 1471 | ||
@@ -1487,6 +1498,7 @@ userauth_hostbased(Authctxt *authctxt) | |||
1487 | error("key_sign failed"); | 1498 | error("key_sign failed"); |
1488 | xfree(chost); | 1499 | xfree(chost); |
1489 | xfree(pkalg); | 1500 | xfree(pkalg); |
1501 | xfree(blob); | ||
1490 | return 0; | 1502 | return 0; |
1491 | } | 1503 | } |
1492 | packet_start(SSH2_MSG_USERAUTH_REQUEST); | 1504 | packet_start(SSH2_MSG_USERAUTH_REQUEST); |
@@ -1502,6 +1514,7 @@ userauth_hostbased(Authctxt *authctxt) | |||
1502 | xfree(signature); | 1514 | xfree(signature); |
1503 | xfree(chost); | 1515 | xfree(chost); |
1504 | xfree(pkalg); | 1516 | xfree(pkalg); |
1517 | xfree(blob); | ||
1505 | 1518 | ||
1506 | packet_send(); | 1519 | packet_send(); |
1507 | return 1; | 1520 | return 1; |
@@ -21,7 +21,7 @@ DESCRIPTION | |||
21 | (by default sshd_config(5)); command-line options override values speci- | 21 | (by default sshd_config(5)); command-line options override values speci- |
22 | fied in the configuration file. sshd rereads its configuration file when | 22 | fied in the configuration file. sshd rereads its configuration file when |
23 | it receives a hangup signal, SIGHUP, by executing itself with the name | 23 | it receives a hangup signal, SIGHUP, by executing itself with the name |
24 | and options it was started with, e.g., /usr/sbin/sshd. | 24 | and options it was started with, e.g. /usr/sbin/sshd. |
25 | 25 | ||
26 | The options are as follows: | 26 | The options are as follows: |
27 | 27 | ||
@@ -69,7 +69,7 @@ DESCRIPTION | |||
69 | not run from inetd because it needs to generate the server key | 69 | not run from inetd because it needs to generate the server key |
70 | before it can respond to the client, and this may take tens of | 70 | before it can respond to the client, and this may take tens of |
71 | seconds. Clients would have to wait too long if the key was re- | 71 | seconds. Clients would have to wait too long if the key was re- |
72 | generated every time. However, with small key sizes (e.g., 512) | 72 | generated every time. However, with small key sizes (e.g. 512) |
73 | using sshd from inetd may be feasible. | 73 | using sshd from inetd may be feasible. |
74 | 74 | ||
75 | -k key_gen_time | 75 | -k key_gen_time |
@@ -161,17 +161,13 @@ AUTHENTICATION | |||
161 | allowing still public-key, then the passwd field should be set to some- | 161 | allowing still public-key, then the passwd field should be set to some- |
162 | thing other than these values (eg `NP' or `*NP*' ). | 162 | thing other than these values (eg `NP' or `*NP*' ). |
163 | 163 | ||
164 | System security is not improved unless rshd, rlogind, and rexecd are dis- | ||
165 | abled (thus completely disabling rlogin and rsh into the machine). | ||
166 | |||
167 | COMMAND EXECUTION AND DATA FORWARDING | ||
168 | If the client successfully authenticates itself, a dialog for preparing | 164 | If the client successfully authenticates itself, a dialog for preparing |
169 | the session is entered. At this time the client may request things like | 165 | the session is entered. At this time the client may request things like |
170 | allocating a pseudo-tty, forwarding X11 connections, forwarding TCP con- | 166 | allocating a pseudo-tty, forwarding X11 connections, forwarding TCP con- |
171 | nections, or forwarding the authentication agent connection over the se- | 167 | nections, or forwarding the authentication agent connection over the se- |
172 | cure channel. | 168 | cure channel. |
173 | 169 | ||
174 | Finally, the client either requests a shell or execution of a command. | 170 | After this, the client either requests a shell or execution of a command. |
175 | The sides then enter session mode. In this mode, either side may send | 171 | The sides then enter session mode. In this mode, either side may send |
176 | data at any time, and such data is forwarded to/from the shell or command | 172 | data at any time, and such data is forwarded to/from the shell or command |
177 | on the server side, and the user terminal in the client side. | 173 | on the server side, and the user terminal in the client side. |
@@ -204,33 +200,60 @@ LOGIN PROCESS | |||
204 | 200 | ||
205 | 8. If ~/.ssh/rc exists, runs it; else if /etc/ssh/sshrc exists, | 201 | 8. If ~/.ssh/rc exists, runs it; else if /etc/ssh/sshrc exists, |
206 | runs it; otherwise runs xauth. The ``rc'' files are given the | 202 | runs it; otherwise runs xauth. The ``rc'' files are given the |
207 | X11 authentication protocol and cookie in standard input. | 203 | X11 authentication protocol and cookie in standard input. See |
204 | SSHRC, below. | ||
208 | 205 | ||
209 | 9. Runs user's shell or command. | 206 | 9. Runs user's shell or command. |
210 | 207 | ||
208 | SSHRC | ||
209 | If the file ~/.ssh/rc exists, sh(1) runs it after reading the environment | ||
210 | files but before starting the user's shell or command. It must not pro- | ||
211 | duce any output on stdout; stderr must be used instead. If X11 forward- | ||
212 | ing is in use, it will receive the "proto cookie" pair in its standard | ||
213 | input (and DISPLAY in its environment). The script must call xauth(1) | ||
214 | because sshd will not run xauth automatically to add X11 cookies. | ||
215 | |||
216 | The primary purpose of this file is to run any initialization routines | ||
217 | which may be needed before the user's home directory becomes accessible; | ||
218 | AFS is a particular example of such an environment. | ||
219 | |||
220 | This file will probably contain some initialization code followed by | ||
221 | something similar to: | ||
222 | |||
223 | if read proto cookie && [ -n "$DISPLAY" ]; then | ||
224 | if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then | ||
225 | # X11UseLocalhost=yes | ||
226 | echo add unix:`echo $DISPLAY | | ||
227 | cut -c11-` $proto $cookie | ||
228 | else | ||
229 | # X11UseLocalhost=no | ||
230 | echo add $DISPLAY $proto $cookie | ||
231 | fi | xauth -q - | ||
232 | fi | ||
233 | |||
234 | If this file does not exist, /etc/ssh/sshrc is run, and if that does not | ||
235 | exist either, xauth is used to add the cookie. | ||
236 | |||
211 | AUTHORIZED_KEYS FILE FORMAT | 237 | AUTHORIZED_KEYS FILE FORMAT |
212 | ~/.ssh/authorized_keys is the default file that lists the public keys | 238 | AuthorizedKeysFile specifies the file containing public keys for public |
213 | that are permitted for RSA authentication in protocol version 1 and for | 239 | key authentication; if none is specified, the default is |
214 | public key authentication (PubkeyAuthentication) in protocol version 2. | 240 | ~/.ssh/authorized_keys. Each line of the file contains one key (empty |
215 | AuthorizedKeysFile may be used to specify an alternative file. | 241 | lines and lines starting with a `#' are ignored as comments). Protocol 1 |
216 | 242 | public keys consist of the following space-separated fields: options, | |
217 | Each line of the file contains one key (empty lines and lines starting | 243 | bits, exponent, modulus, comment. Protocol 2 public key consist of: op- |
218 | with a `#' are ignored as comments). Each RSA public key consists of the | 244 | tions, keytype, base64-encoded key, comment. The options field is op- |
219 | following fields, separated by spaces: options, bits, exponent, modulus, | 245 | tional; its presence is determined by whether the line starts with a num- |
220 | comment. Each protocol version 2 public key consists of: options, key- | 246 | ber or not (the options field never starts with a number). The bits, ex- |
221 | type, base64 encoded key, comment. The options field is optional; its | 247 | ponent, modulus, and comment fields give the RSA key for protocol version |
222 | presence is determined by whether the line starts with a number or not | 248 | 1; the comment field is not used for anything (but may be convenient for |
223 | (the options field never starts with a number). The bits, exponent, mod- | 249 | the user to identify the key). For protocol version 2 the keytype is |
224 | ulus and comment fields give the RSA key for protocol version 1; the com- | 250 | ``ssh-dss'' or ``ssh-rsa''. |
225 | ment field is not used for anything (but may be convenient for the user | ||
226 | to identify the key). For protocol version 2 the keytype is ``ssh-dss'' | ||
227 | or ``ssh-rsa''. | ||
228 | 251 | ||
229 | Note that lines in this file are usually several hundred bytes long (be- | 252 | Note that lines in this file are usually several hundred bytes long (be- |
230 | cause of the size of the public key encoding) up to a limit of 8 kilo- | 253 | cause of the size of the public key encoding) up to a limit of 8 kilo- |
231 | bytes, which permits DSA keys up to 8 kilobits and RSA keys up to 16 | 254 | bytes, which permits DSA keys up to 8 kilobits and RSA keys up to 16 |
232 | kilobits. You don't want to type them in; instead, copy the | 255 | kilobits. You don't want to type them in; instead, copy the |
233 | identity.pub, id_dsa.pub or the id_rsa.pub file and edit it. | 256 | identity.pub, id_dsa.pub, or the id_rsa.pub file and edit it. |
234 | 257 | ||
235 | sshd enforces a minimum RSA key modulus size for protocol 1 and protocol | 258 | sshd enforces a minimum RSA key modulus size for protocol 1 and protocol |
236 | 2 keys of 768 bits. | 259 | 2 keys of 768 bits. |
@@ -240,21 +263,6 @@ AUTHORIZED_KEYS FILE FORMAT | |||
240 | lowing option specifications are supported (note that option keywords are | 263 | lowing option specifications are supported (note that option keywords are |
241 | case-insensitive): | 264 | case-insensitive): |
242 | 265 | ||
243 | from="pattern-list" | ||
244 | Specifies that in addition to public key authentication, the | ||
245 | canonical name of the remote host must be present in the comma- | ||
246 | separated list of patterns (`*' and `?' serve as wildcards). The | ||
247 | list may also contain patterns negated by prefixing them with | ||
248 | `!'; if the canonical host name matches a negated pattern, the | ||
249 | key is not accepted. The purpose of this option is to optionally | ||
250 | increase security: public key authentication by itself does not | ||
251 | trust the network or name servers or anything (but the key); how- | ||
252 | ever, if somebody somehow steals the key, the key permits an in- | ||
253 | truder to log in from anywhere in the world. This additional op- | ||
254 | tion makes using a stolen key more difficult (name servers and/or | ||
255 | routers would have to be compromised in addition to just the | ||
256 | key). | ||
257 | |||
258 | command="command" | 266 | command="command" |
259 | Specifies that the command is executed whenever this key is used | 267 | Specifies that the command is executed whenever this key is used |
260 | for authentication. The command supplied by the user (if any) is | 268 | for authentication. The command supplied by the user (if any) is |
@@ -266,8 +274,10 @@ AUTHORIZED_KEYS FILE FORMAT | |||
266 | lic keys to perform just a specific operation. An example might | 274 | lic keys to perform just a specific operation. An example might |
267 | be a key that permits remote backups but nothing else. Note that | 275 | be a key that permits remote backups but nothing else. Note that |
268 | the client may specify TCP and/or X11 forwarding unless they are | 276 | the client may specify TCP and/or X11 forwarding unless they are |
269 | explicitly prohibited. Note that this option applies to shell, | 277 | explicitly prohibited. The command originally supplied by the |
270 | command or subsystem execution. | 278 | client is available in the SSH_ORIGINAL_COMMAND environment vari- |
279 | able. Note that this option applies to shell, command or subsys- | ||
280 | tem execution. | ||
271 | 281 | ||
272 | environment="NAME=value" | 282 | environment="NAME=value" |
273 | Specifies that the string is to be added to the environment when | 283 | Specifies that the string is to be added to the environment when |
@@ -277,21 +287,35 @@ AUTHORIZED_KEYS FILE FORMAT | |||
277 | default and is controlled via the PermitUserEnvironment option. | 287 | default and is controlled via the PermitUserEnvironment option. |
278 | This option is automatically disabled if UseLogin is enabled. | 288 | This option is automatically disabled if UseLogin is enabled. |
279 | 289 | ||
280 | no-port-forwarding | 290 | from="pattern-list" |
281 | Forbids TCP forwarding when this key is used for authentication. | 291 | Specifies that in addition to public key authentication, the |
282 | Any port forward requests by the client will return an error. | 292 | canonical name of the remote host must be present in the comma- |
283 | This might be used, e.g., in connection with the command option. | 293 | separated list of patterns. The purpose of this option is to op- |
294 | tionally increase security: public key authentication by itself | ||
295 | does not trust the network or name servers or anything (but the | ||
296 | key); however, if somebody somehow steals the key, the key per- | ||
297 | mits an intruder to log in from anywhere in the world. This ad- | ||
298 | ditional option makes using a stolen key more difficult (name | ||
299 | servers and/or routers would have to be compromised in addition | ||
300 | to just the key). | ||
284 | 301 | ||
285 | no-X11-forwarding | 302 | See PATTERNS in ssh_config(5) for more information on patterns. |
286 | Forbids X11 forwarding when this key is used for authentication. | ||
287 | Any X11 forward requests by the client will return an error. | ||
288 | 303 | ||
289 | no-agent-forwarding | 304 | no-agent-forwarding |
290 | Forbids authentication agent forwarding when this key is used for | 305 | Forbids authentication agent forwarding when this key is used for |
291 | authentication. | 306 | authentication. |
292 | 307 | ||
308 | no-port-forwarding | ||
309 | Forbids TCP forwarding when this key is used for authentication. | ||
310 | Any port forward requests by the client will return an error. | ||
311 | This might be used, e.g. in connection with the command option. | ||
312 | |||
293 | no-pty Prevents tty allocation (a request to allocate a pty will fail). | 313 | no-pty Prevents tty allocation (a request to allocate a pty will fail). |
294 | 314 | ||
315 | no-X11-forwarding | ||
316 | Forbids X11 forwarding when this key is used for authentication. | ||
317 | Any X11 forward requests by the client will return an error. | ||
318 | |||
295 | permitopen="host:port" | 319 | permitopen="host:port" |
296 | Limit local ``ssh -L'' port forwarding such that it may only con- | 320 | Limit local ``ssh -L'' port forwarding such that it may only con- |
297 | nect to the specified host and port. IPv6 addresses can be spec- | 321 | nect to the specified host and port. IPv6 addresses can be spec- |
@@ -305,24 +329,24 @@ AUTHORIZED_KEYS FILE FORMAT | |||
305 | next available device will be used if the client requests a tun- | 329 | next available device will be used if the client requests a tun- |
306 | nel. | 330 | nel. |
307 | 331 | ||
308 | Examples | 332 | An example authorized_keys file: |
309 | 1024 33 12121...312314325 ylo@foo.bar | ||
310 | 333 | ||
311 | from="*.niksula.hut.fi,!pc.niksula.hut.fi" 1024 35 23...2334 ylo@niksula | 334 | # Comments allowed at start of line |
312 | 335 | ssh-rsa AAAAB3Nza...LiPk== user@example.net | |
313 | command="dump /home",no-pty,no-port-forwarding 1024 33 23...2323 back- | 336 | from="*.sales.example.net,!pc.sales.example.net" ssh-rsa |
314 | up.hut.fi | 337 | AAAAB2...19Q== john@example.net |
315 | 338 | command="dump /home",no-pty,no-port-forwarding ssh-dss | |
316 | permitopen="10.2.1.55:80",permitopen="10.2.1.56:25" 1024 33 23...2323 | 339 | AAAAC3...51R== example.net |
317 | 340 | permitopen="192.0.2.1:80",permitopen="192.0.2.2:25" ssh-dss | |
318 | tunnel="0",command="sh /etc/netstart tun0" ssh-rsa AAAA...== reyk@openb- | 341 | AAAAB5...21S== |
319 | sd.org | 342 | tunnel="0",command="sh /etc/netstart tun0" ssh-rsa AAAA...== |
343 | jane@example.net | ||
320 | 344 | ||
321 | SSH_KNOWN_HOSTS FILE FORMAT | 345 | SSH_KNOWN_HOSTS FILE FORMAT |
322 | The /etc/ssh/ssh_known_hosts and ~/.ssh/known_hosts files contain host | 346 | The /etc/ssh/ssh_known_hosts and ~/.ssh/known_hosts files contain host |
323 | public keys for all known hosts. The global file should be prepared by | 347 | public keys for all known hosts. The global file should be prepared by |
324 | the administrator (optional), and the per-user file is maintained auto- | 348 | the administrator (optional), and the per-user file is maintained auto- |
325 | matically: whenever the user connects from an unknown host its key is | 349 | matically: whenever the user connects from an unknown host, its key is |
326 | added to the per-user file. | 350 | added to the per-user file. |
327 | 351 | ||
328 | Each line in these files contains the following fields: hostnames, bits, | 352 | Each line in these files contains the following fields: hostnames, bits, |
@@ -333,7 +357,9 @@ SSH_KNOWN_HOSTS FILE FORMAT | |||
333 | (when authenticating a client) or against the user-supplied name (when | 357 | (when authenticating a client) or against the user-supplied name (when |
334 | authenticating a server). A pattern may also be preceded by `!' to indi- | 358 | authenticating a server). A pattern may also be preceded by `!' to indi- |
335 | cate negation: if the host name matches a negated pattern, it is not ac- | 359 | cate negation: if the host name matches a negated pattern, it is not ac- |
336 | cepted (by that line) even if it matched another pattern on the line. | 360 | cepted (by that line) even if it matched another pattern on the line. A |
361 | hostname or address may optionally be enclosed within `[' and `]' brack- | ||
362 | ets then followed by `:' and a non-standard port number. | ||
337 | 363 | ||
338 | Alternately, hostnames may be stored in a hashed form which hides host | 364 | Alternately, hostnames may be stored in a hashed form which hides host |
339 | names and addresses should the file's contents be disclosed. Hashed | 365 | names and addresses should the file's contents be disclosed. Hashed |
@@ -342,8 +368,8 @@ SSH_KNOWN_HOSTS FILE FORMAT | |||
342 | tors may be applied. | 368 | tors may be applied. |
343 | 369 | ||
344 | Bits, exponent, and modulus are taken directly from the RSA host key; | 370 | Bits, exponent, and modulus are taken directly from the RSA host key; |
345 | they can be obtained, e.g., from /etc/ssh/ssh_host_key.pub. The optional | 371 | they can be obtained, for example, from /etc/ssh/ssh_host_key.pub. The |
346 | comment field continues to the end of the line, and is not used. | 372 | optional comment field continues to the end of the line, and is not used. |
347 | 373 | ||
348 | Lines starting with `#' and empty lines are ignored as comments. | 374 | Lines starting with `#' and empty lines are ignored as comments. |
349 | 375 | ||
@@ -360,29 +386,115 @@ SSH_KNOWN_HOSTS FILE FORMAT | |||
360 | Rather, generate them by a script or by taking /etc/ssh/ssh_host_key.pub | 386 | Rather, generate them by a script or by taking /etc/ssh/ssh_host_key.pub |
361 | and adding the host names at the front. | 387 | and adding the host names at the front. |
362 | 388 | ||
363 | Examples | 389 | An example ssh_known_hosts file: |
364 | |||
365 | closenet,...,130.233.208.41 1024 37 159...93 closenet.hut.fi | ||
366 | cvs.openbsd.org,199.185.137.3 ssh-rsa AAAA1234.....= | ||
367 | 390 | ||
368 | # A hashed hostname | 391 | # Comments allowed at start of line |
369 | |1|JfKTdBh7rNbXkVAQCRp4OQoPfmI=|USECr3SWf1JUPsms5AqfD5QfxkM= ssh-rsa | 392 | closenet,...,192.0.2.53 1024 37 159...93 closenet.example.net |
370 | AAAA1234.....= | 393 | cvs.example.net,192.0.2.10 ssh-rsa AAAA1234.....= |
394 | # A hashed hostname | ||
395 | |1|JfKTdBh7rNbXkVAQCRp4OQoPfmI=|USECr3SWf1JUPsms5AqfD5QfxkM= ssh-rsa | ||
396 | AAAA1234.....= | ||
371 | 397 | ||
372 | FILES | 398 | FILES |
373 | /etc/ssh/sshd_config | 399 | ~/.hushlogin |
374 | Contains configuration data for sshd. The file format and con- | 400 | This file is used to suppress printing the last login time and |
375 | figuration options are described in sshd_config(5). | 401 | /etc/motd, if PrintLastLog and PrintMotd, respectively, are en- |
402 | abled. It does not suppress printing of the banner specified by | ||
403 | Banner. | ||
404 | |||
405 | ~/.rhosts | ||
406 | This file is used for host-based authentication (see ssh(1) for | ||
407 | more information). On some machines this file may need to be | ||
408 | world-readable if the user's home directory is on an NFS parti- | ||
409 | tion, because sshd reads it as root. Additionally, this file | ||
410 | must be owned by the user, and must not have write permissions | ||
411 | for anyone else. The recommended permission for most machines is | ||
412 | read/write for the user, and not accessible by others. | ||
413 | |||
414 | ~/.shosts | ||
415 | This file is used in exactly the same way as .rhosts, but allows | ||
416 | host-based authentication without permitting login with | ||
417 | rlogin/rsh. | ||
418 | |||
419 | ~/.ssh/authorized_keys | ||
420 | Lists the public keys (RSA/DSA) that can be used for logging in | ||
421 | as this user. The format of this file is described above. The | ||
422 | content of the file is not highly sensitive, but the recommended | ||
423 | permissions are read/write for the user, and not accessible by | ||
424 | others. | ||
425 | |||
426 | If this file, the ~/.ssh directory, or the user's home directory | ||
427 | are writable by other users, then the file could be modified or | ||
428 | replaced by unauthorized users. In this case, sshd will not al- | ||
429 | low it to be used unless the StrictModes option has been set to | ||
430 | ``no''. The recommended permissions can be set by executing | ||
431 | ``chmod go-w ~/ ~/.ssh ~/.ssh/authorized_keys''. | ||
432 | |||
433 | ~/.ssh/environment | ||
434 | This file is read into the environment at login (if it exists). | ||
435 | It can only contain empty lines, comment lines (that start with | ||
436 | `#'), and assignment lines of the form name=value. The file | ||
437 | should be writable only by the user; it need not be readable by | ||
438 | anyone else. Environment processing is disabled by default and | ||
439 | is controlled via the PermitUserEnvironment option. | ||
440 | |||
441 | ~/.ssh/known_hosts | ||
442 | Contains a list of host keys for all hosts the user has logged | ||
443 | into that are not already in the systemwide list of known host | ||
444 | keys. The format of this file is described above. This file | ||
445 | should be writable only by root/the owner and can, but need not | ||
446 | be, world-readable. | ||
447 | |||
448 | ~/.ssh/rc | ||
449 | Contains initialization routines to be run before the user's home | ||
450 | directory becomes accessible. This file should be writable only | ||
451 | by the user, and need not be readable by anyone else. | ||
452 | |||
453 | /etc/hosts.allow | ||
454 | /etc/hosts.deny | ||
455 | Access controls that should be enforced by tcp-wrappers are de- | ||
456 | fined here. Further details are described in hosts_access(5). | ||
457 | |||
458 | /etc/hosts.equiv | ||
459 | This file is for host-based authentication (see ssh(1)). It | ||
460 | should only be writable by root. | ||
461 | |||
462 | /etc/moduli | ||
463 | Contains Diffie-Hellman groups used for the "Diffie-Hellman Group | ||
464 | Exchange". The file format is described in moduli(5). | ||
376 | 465 | ||
377 | /etc/ssh/ssh_host_key, /etc/ssh/ssh_host_dsa_key, | 466 | /etc/motd |
378 | /etc/ssh/ssh_host_rsa_key | 467 | See motd(5). |
468 | |||
469 | /etc/nologin | ||
470 | If this file exists, sshd refuses to let anyone except root log | ||
471 | in. The contents of the file are displayed to anyone trying to | ||
472 | log in, and non-root connections are refused. The file should be | ||
473 | world-readable. | ||
474 | |||
475 | /etc/shosts.equiv | ||
476 | This file is used in exactly the same way as hosts.equiv, but al- | ||
477 | lows host-based authentication without permitting login with | ||
478 | rlogin/rsh. | ||
479 | |||
480 | /etc/ssh/ssh_known_hosts | ||
481 | Systemwide list of known host keys. This file should be prepared | ||
482 | by the system administrator to contain the public host keys of | ||
483 | all machines in the organization. The format of this file is de- | ||
484 | scribed above. This file should be writable only by root/the | ||
485 | owner and should be world-readable. | ||
486 | |||
487 | /etc/ssh/ssh_host_key | ||
488 | /etc/ssh/ssh_host_dsa_key | ||
489 | /etc/ssh/ssh_host_rsa_key | ||
379 | These three files contain the private parts of the host keys. | 490 | These three files contain the private parts of the host keys. |
380 | These files should only be owned by root, readable only by root, | 491 | These files should only be owned by root, readable only by root, |
381 | and not accessible to others. Note that sshd does not start if | 492 | and not accessible to others. Note that sshd does not start if |
382 | this file is group/world-accessible. | 493 | these files are group/world-accessible. |
383 | 494 | ||
384 | /etc/ssh/ssh_host_key.pub, /etc/ssh/ssh_host_dsa_key.pub, | 495 | /etc/ssh/ssh_host_key.pub |
385 | /etc/ssh/ssh_host_rsa_key.pub | 496 | /etc/ssh/ssh_host_dsa_key.pub |
497 | /etc/ssh/ssh_host_rsa_key.pub | ||
386 | These three files contain the public parts of the host keys. | 498 | These three files contain the public parts of the host keys. |
387 | These files should be world-readable but writable only by root. | 499 | These files should be world-readable but writable only by root. |
388 | Their contents should match the respective private parts. These | 500 | Their contents should match the respective private parts. These |
@@ -390,9 +502,14 @@ FILES | |||
390 | convenience of the user so their contents can be copied to known | 502 | convenience of the user so their contents can be copied to known |
391 | hosts files. These files are created using ssh-keygen(1). | 503 | hosts files. These files are created using ssh-keygen(1). |
392 | 504 | ||
393 | /etc/moduli | 505 | /etc/ssh/sshd_config |
394 | Contains Diffie-Hellman groups used for the "Diffie-Hellman Group | 506 | Contains configuration data for sshd. The file format and con- |
395 | Exchange". The file format is described in moduli(5). | 507 | figuration options are described in sshd_config(5). |
508 | |||
509 | /etc/ssh/sshrc | ||
510 | Similar to ~/.ssh/rc, it can be used to specify machine-specific | ||
511 | login-time initializations globally. This file should be | ||
512 | writable only by root, and should be world-readable. | ||
396 | 513 | ||
397 | /var/empty | 514 | /var/empty |
398 | chroot(2) directory used by sshd during privilege separation in | 515 | chroot(2) directory used by sshd during privilege separation in |
@@ -407,160 +524,21 @@ FILES | |||
407 | The content of this file is not sensitive; it can be world-read- | 524 | The content of this file is not sensitive; it can be world-read- |
408 | able. | 525 | able. |
409 | 526 | ||
410 | ~/.ssh/authorized_keys | ||
411 | Lists the public keys (RSA or DSA) that can be used to log into | ||
412 | the user's account. This file must be readable by root (which | ||
413 | may on some machines imply it being world-readable if the user's | ||
414 | home directory resides on an NFS volume). It is recommended that | ||
415 | it not be accessible by others. The format of this file is de- | ||
416 | scribed above. Users will place the contents of their | ||
417 | identity.pub, id_dsa.pub and/or id_rsa.pub files into this file, | ||
418 | as described in ssh-keygen(1). | ||
419 | |||
420 | /etc/ssh/ssh_known_hosts, ~/.ssh/known_hosts | ||
421 | These files are consulted when using rhosts with RSA host authen- | ||
422 | tication or protocol version 2 hostbased authentication to check | ||
423 | the public key of the host. The key must be listed in one of | ||
424 | these files to be accepted. The client uses the same files to | ||
425 | verify that it is connecting to the correct remote host. These | ||
426 | files should be writable only by root/the owner. | ||
427 | /etc/ssh/ssh_known_hosts should be world-readable, and | ||
428 | ~/.ssh/known_hosts can, but need not be, world-readable. | ||
429 | |||
430 | /etc/motd | ||
431 | See motd(5). | ||
432 | |||
433 | ~/.hushlogin | ||
434 | This file is used to suppress printing the last login time and | ||
435 | /etc/motd, if PrintLastLog and PrintMotd, respectively, are en- | ||
436 | abled. It does not suppress printing of the banner specified by | ||
437 | Banner. | ||
438 | |||
439 | /etc/nologin | ||
440 | If this file exists, sshd refuses to let anyone except root log | ||
441 | in. The contents of the file are displayed to anyone trying to | ||
442 | log in, and non-root connections are refused. The file should be | ||
443 | world-readable. | ||
444 | |||
445 | /etc/hosts.allow, /etc/hosts.deny | ||
446 | Access controls that should be enforced by tcp-wrappers are de- | ||
447 | fined here. Further details are described in hosts_access(5). | ||
448 | |||
449 | ~/.rhosts | ||
450 | This file is used during RhostsRSAAuthentication and | ||
451 | HostbasedAuthentication and contains host-username pairs, sepa- | ||
452 | rated by a space, one per line. The given user on the corre- | ||
453 | sponding host is permitted to log in without a password. The | ||
454 | same file is used by rlogind and rshd. The file must be writable | ||
455 | only by the user; it is recommended that it not be accessible by | ||
456 | others. | ||
457 | |||
458 | It is also possible to use netgroups in the file. Either host or | ||
459 | user name may be of the form +@groupname to specify all hosts or | ||
460 | all users in the group. | ||
461 | |||
462 | ~/.shosts | ||
463 | For ssh, this file is exactly the same as for .rhosts. However, | ||
464 | this file is not used by rlogin and rshd, so using this permits | ||
465 | access using SSH only. | ||
466 | |||
467 | /etc/hosts.equiv | ||
468 | This file is used during RhostsRSAAuthentication and | ||
469 | HostbasedAuthentication authentication. In the simplest form, | ||
470 | this file contains host names, one per line. Users on those | ||
471 | hosts are permitted to log in without a password, provided they | ||
472 | have the same user name on both machines. The host name may also | ||
473 | be followed by a user name; such users are permitted to log in as | ||
474 | any user on this machine (except root). Additionally, the syntax | ||
475 | ``+@group'' can be used to specify netgroups. Negated entries | ||
476 | start with `-'. | ||
477 | |||
478 | If the client host/user is successfully matched in this file, lo- | ||
479 | gin is automatically permitted provided the client and server us- | ||
480 | er names are the same. Additionally, successful client host key | ||
481 | authentication is required. This file must be writable only by | ||
482 | root; it is recommended that it be world-readable. | ||
483 | |||
484 | Warning: It is almost never a good idea to use user names in | ||
485 | hosts.equiv. Beware that it really means that the named user(s) | ||
486 | can log in as anybody, which includes bin, daemon, adm, and other | ||
487 | accounts that own critical binaries and directories. Using a us- | ||
488 | er name practically grants the user root access. The only valid | ||
489 | use for user names that I can think of is in negative entries. | ||
490 | |||
491 | Note that this warning also applies to rsh/rlogin. | ||
492 | |||
493 | /etc/shosts.equiv | ||
494 | This is processed exactly as /etc/hosts.equiv. However, this | ||
495 | file may be useful in environments that want to run both | ||
496 | rsh/rlogin and ssh. | ||
497 | |||
498 | ~/.ssh/environment | ||
499 | This file is read into the environment at login (if it exists). | ||
500 | It can only contain empty lines, comment lines (that start with | ||
501 | `#'), and assignment lines of the form name=value. The file | ||
502 | should be writable only by the user; it need not be readable by | ||
503 | anyone else. Environment processing is disabled by default and | ||
504 | is controlled via the PermitUserEnvironment option. | ||
505 | |||
506 | ~/.ssh/rc | ||
507 | If this file exists, it is run with /bin/sh after reading the en- | ||
508 | vironment files but before starting the user's shell or command. | ||
509 | It must not produce any output on stdout; stderr must be used in- | ||
510 | stead. If X11 forwarding is in use, it will receive the "proto | ||
511 | cookie" pair in its standard input (and DISPLAY in its environ- | ||
512 | ment). The script must call xauth(1) because sshd will not run | ||
513 | xauth automatically to add X11 cookies. | ||
514 | |||
515 | The primary purpose of this file is to run any initialization | ||
516 | routines which may be needed before the user's home directory be- | ||
517 | comes accessible; AFS is a particular example of such an environ- | ||
518 | ment. | ||
519 | |||
520 | This file will probably contain some initialization code followed | ||
521 | by something similar to: | ||
522 | |||
523 | if read proto cookie && [ -n "$DISPLAY" ]; then | ||
524 | if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then | ||
525 | # X11UseLocalhost=yes | ||
526 | echo add unix:`echo $DISPLAY | | ||
527 | cut -c11-` $proto $cookie | ||
528 | else | ||
529 | # X11UseLocalhost=no | ||
530 | echo add $DISPLAY $proto $cookie | ||
531 | fi | xauth -q - | ||
532 | fi | ||
533 | |||
534 | If this file does not exist, /etc/ssh/sshrc is run, and if that | ||
535 | does not exist either, xauth is used to add the cookie. | ||
536 | |||
537 | This file should be writable only by the user, and need not be | ||
538 | readable by anyone else. | ||
539 | |||
540 | /etc/ssh/sshrc | ||
541 | Like ~/.ssh/rc. This can be used to specify machine-specific lo- | ||
542 | gin-time initializations globally. This file should be writable | ||
543 | only by root, and should be world-readable. | ||
544 | |||
545 | SEE ALSO | 527 | SEE ALSO |
546 | scp(1), sftp(1), ssh(1), ssh-add(1), ssh-agent(1), ssh-keygen(1), | 528 | scp(1), sftp(1), ssh(1), ssh-add(1), ssh-agent(1), ssh-keygen(1), |
547 | chroot(2), hosts_access(5), login.conf(5), moduli(5), sshd_config(5), | 529 | chroot(2), hosts_access(5), login.conf(5), moduli(5), sshd_config(5), |
548 | inetd(8), sftp-server(8) | 530 | inetd(8), sftp-server(8) |
549 | 531 | ||
550 | T. Ylonen, T. Kivinen, M. Saarinen, T. Rinne, and S. Lehtinen, SSH | ||
551 | Protocol Architecture, draft-ietf-secsh-architecture-12.txt, January | ||
552 | 2002, work in progress material. | ||
553 | |||
554 | M. Friedl, N. Provos, and W. A. Simpson, Diffie-Hellman Group Exchange | ||
555 | for the SSH Transport Layer Protocol, draft-ietf-secsh-dh-group- | ||
556 | exchange-02.txt, January 2002, work in progress material. | ||
557 | |||
558 | AUTHORS | 532 | AUTHORS |
559 | OpenSSH is a derivative of the original and free ssh 1.2.12 release by | 533 | OpenSSH is a derivative of the original and free ssh 1.2.12 release by |
560 | Tatu Ylonen. Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, Theo | 534 | Tatu Ylonen. Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, Theo |
561 | de Raadt and Dug Song removed many bugs, re-added newer features and | 535 | de Raadt and Dug Song removed many bugs, re-added newer features and cre- |
562 | created OpenSSH. Markus Friedl contributed the support for SSH protocol | 536 | ated OpenSSH. Markus Friedl contributed the support for SSH protocol |
563 | versions 1.5 and 2.0. Niels Provos and Markus Friedl contributed support | 537 | versions 1.5 and 2.0. Niels Provos and Markus Friedl contributed support |
564 | for privilege separation. | 538 | for privilege separation. |
565 | 539 | ||
566 | OpenBSD 3.9 September 25, 1999 9 | 540 | CAVEATS |
541 | System security is not improved unless rshd, rlogind, and rexecd are dis- | ||
542 | abled (thus completely disabling rlogin and rsh into the machine). | ||
543 | |||
544 | OpenBSD 4.1 September 25, 1999 9 | ||
@@ -34,7 +34,7 @@ | |||
34 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 34 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
35 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 35 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
36 | .\" | 36 | .\" |
37 | .\" $OpenBSD: sshd.8,v 1.215 2006/02/01 09:11:41 jmc Exp $ | 37 | .\" $OpenBSD: sshd.8,v 1.234 2006/08/21 08:15:57 dtucker Exp $ |
38 | .Dd September 25, 1999 | 38 | .Dd September 25, 1999 |
39 | .Dt SSHD 8 | 39 | .Dt SSHD 8 |
40 | .Os | 40 | .Os |
@@ -81,7 +81,7 @@ configuration file. | |||
81 | .Nm | 81 | .Nm |
82 | rereads its configuration file when it receives a hangup signal, | 82 | rereads its configuration file when it receives a hangup signal, |
83 | .Dv SIGHUP , | 83 | .Dv SIGHUP , |
84 | by executing itself with the name and options it was started with, e.g., | 84 | by executing itself with the name and options it was started with, e.g.\& |
85 | .Pa /usr/sbin/sshd . | 85 | .Pa /usr/sbin/sshd . |
86 | .Pp | 86 | .Pp |
87 | The options are as follows: | 87 | The options are as follows: |
@@ -154,7 +154,7 @@ is normally not run | |||
154 | from inetd because it needs to generate the server key before it can | 154 | from inetd because it needs to generate the server key before it can |
155 | respond to the client, and this may take tens of seconds. | 155 | respond to the client, and this may take tens of seconds. |
156 | Clients would have to wait too long if the key was regenerated every time. | 156 | Clients would have to wait too long if the key was regenerated every time. |
157 | However, with small key sizes (e.g., 512) using | 157 | However, with small key sizes (e.g. 512) using |
158 | .Nm | 158 | .Nm |
159 | from inetd may | 159 | from inetd may |
160 | be feasible. | 160 | be feasible. |
@@ -311,17 +311,6 @@ or | |||
311 | .Ql \&*NP\&* | 311 | .Ql \&*NP\&* |
312 | ). | 312 | ). |
313 | .Pp | 313 | .Pp |
314 | System security is not improved unless | ||
315 | .Nm rshd , | ||
316 | .Nm rlogind , | ||
317 | and | ||
318 | .Nm rexecd | ||
319 | are disabled (thus completely disabling | ||
320 | .Xr rlogin | ||
321 | and | ||
322 | .Xr rsh | ||
323 | into the machine). | ||
324 | .Sh COMMAND EXECUTION AND DATA FORWARDING | ||
325 | If the client successfully authenticates itself, a dialog for | 314 | If the client successfully authenticates itself, a dialog for |
326 | preparing the session is entered. | 315 | preparing the session is entered. |
327 | At this time the client may request | 316 | At this time the client may request |
@@ -329,7 +318,7 @@ things like allocating a pseudo-tty, forwarding X11 connections, | |||
329 | forwarding TCP connections, or forwarding the authentication agent | 318 | forwarding TCP connections, or forwarding the authentication agent |
330 | connection over the secure channel. | 319 | connection over the secure channel. |
331 | .Pp | 320 | .Pp |
332 | Finally, the client either requests a shell or execution of a command. | 321 | After this, the client either requests a shell or execution of a command. |
333 | The sides then enter session mode. | 322 | The sides then enter session mode. |
334 | In this mode, either side may send | 323 | In this mode, either side may send |
335 | data at any time, and such data is forwarded to/from the shell or | 324 | data at any time, and such data is forwarded to/from the shell or |
@@ -384,31 +373,73 @@ The | |||
384 | .Dq rc | 373 | .Dq rc |
385 | files are given the X11 | 374 | files are given the X11 |
386 | authentication protocol and cookie in standard input. | 375 | authentication protocol and cookie in standard input. |
376 | See | ||
377 | .Sx SSHRC , | ||
378 | below. | ||
387 | .It | 379 | .It |
388 | Runs user's shell or command. | 380 | Runs user's shell or command. |
389 | .El | 381 | .El |
382 | .Sh SSHRC | ||
383 | If the file | ||
384 | .Pa ~/.ssh/rc | ||
385 | exists, | ||
386 | .Xr sh 1 | ||
387 | runs it after reading the | ||
388 | environment files but before starting the user's shell or command. | ||
389 | It must not produce any output on stdout; stderr must be used | ||
390 | instead. | ||
391 | If X11 forwarding is in use, it will receive the "proto cookie" pair in | ||
392 | its standard input (and | ||
393 | .Ev DISPLAY | ||
394 | in its environment). | ||
395 | The script must call | ||
396 | .Xr xauth 1 | ||
397 | because | ||
398 | .Nm | ||
399 | will not run xauth automatically to add X11 cookies. | ||
400 | .Pp | ||
401 | The primary purpose of this file is to run any initialization routines | ||
402 | which may be needed before the user's home directory becomes | ||
403 | accessible; AFS is a particular example of such an environment. | ||
404 | .Pp | ||
405 | This file will probably contain some initialization code followed by | ||
406 | something similar to: | ||
407 | .Bd -literal -offset 3n | ||
408 | if read proto cookie && [ -n "$DISPLAY" ]; then | ||
409 | if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then | ||
410 | # X11UseLocalhost=yes | ||
411 | echo add unix:`echo $DISPLAY | | ||
412 | cut -c11-` $proto $cookie | ||
413 | else | ||
414 | # X11UseLocalhost=no | ||
415 | echo add $DISPLAY $proto $cookie | ||
416 | fi | xauth -q - | ||
417 | fi | ||
418 | .Ed | ||
419 | .Pp | ||
420 | If this file does not exist, | ||
421 | .Pa /etc/ssh/sshrc | ||
422 | is run, and if that | ||
423 | does not exist either, xauth is used to add the cookie. | ||
390 | .Sh AUTHORIZED_KEYS FILE FORMAT | 424 | .Sh AUTHORIZED_KEYS FILE FORMAT |
391 | .Pa ~/.ssh/authorized_keys | ||
392 | is the default file that lists the public keys that are | ||
393 | permitted for RSA authentication in protocol version 1 | ||
394 | and for public key authentication (PubkeyAuthentication) | ||
395 | in protocol version 2. | ||
396 | .Cm AuthorizedKeysFile | 425 | .Cm AuthorizedKeysFile |
397 | may be used to specify an alternative file. | 426 | specifies the file containing public keys for |
398 | .Pp | 427 | public key authentication; |
428 | if none is specified, the default is | ||
429 | .Pa ~/.ssh/authorized_keys . | ||
399 | Each line of the file contains one | 430 | Each line of the file contains one |
400 | key (empty lines and lines starting with a | 431 | key (empty lines and lines starting with a |
401 | .Ql # | 432 | .Ql # |
402 | are ignored as | 433 | are ignored as |
403 | comments). | 434 | comments). |
404 | Each RSA public key consists of the following fields, separated by | 435 | Protocol 1 public keys consist of the following space-separated fields: |
405 | spaces: options, bits, exponent, modulus, comment. | 436 | options, bits, exponent, modulus, comment. |
406 | Each protocol version 2 public key consists of: | 437 | Protocol 2 public key consist of: |
407 | options, keytype, base64 encoded key, comment. | 438 | options, keytype, base64-encoded key, comment. |
408 | The options field | 439 | The options field is optional; |
409 | is optional; its presence is determined by whether the line starts | 440 | its presence is determined by whether the line starts |
410 | with a number or not (the options field never starts with a number). | 441 | with a number or not (the options field never starts with a number). |
411 | The bits, exponent, modulus and comment fields give the RSA key for | 442 | The bits, exponent, modulus, and comment fields give the RSA key for |
412 | protocol version 1; the | 443 | protocol version 1; the |
413 | comment field is not used for anything (but may be convenient for the | 444 | comment field is not used for anything (but may be convenient for the |
414 | user to identify the key). | 445 | user to identify the key). |
@@ -423,7 +454,7 @@ Note that lines in this file are usually several hundred bytes long | |||
423 | keys up to 16 kilobits. | 454 | keys up to 16 kilobits. |
424 | You don't want to type them in; instead, copy the | 455 | You don't want to type them in; instead, copy the |
425 | .Pa identity.pub , | 456 | .Pa identity.pub , |
426 | .Pa id_dsa.pub | 457 | .Pa id_dsa.pub , |
427 | or the | 458 | or the |
428 | .Pa id_rsa.pub | 459 | .Pa id_rsa.pub |
429 | file and edit it. | 460 | file and edit it. |
@@ -438,26 +469,6 @@ No spaces are permitted, except within double quotes. | |||
438 | The following option specifications are supported (note | 469 | The following option specifications are supported (note |
439 | that option keywords are case-insensitive): | 470 | that option keywords are case-insensitive): |
440 | .Bl -tag -width Ds | 471 | .Bl -tag -width Ds |
441 | .It Cm from="pattern-list" | ||
442 | Specifies that in addition to public key authentication, the canonical name | ||
443 | of the remote host must be present in the comma-separated list of | ||
444 | patterns | ||
445 | .Pf ( Ql \&* | ||
446 | and | ||
447 | .Ql \&? | ||
448 | serve as wildcards). | ||
449 | The list may also contain | ||
450 | patterns negated by prefixing them with | ||
451 | .Ql \&! ; | ||
452 | if the canonical host name matches a negated pattern, the key is not accepted. | ||
453 | The purpose | ||
454 | of this option is to optionally increase security: public key authentication | ||
455 | by itself does not trust the network or name servers or anything (but | ||
456 | the key); however, if somebody somehow steals the key, the key | ||
457 | permits an intruder to log in from anywhere in the world. | ||
458 | This additional option makes using a stolen key more difficult (name | ||
459 | servers and/or routers would have to be compromised in addition to | ||
460 | just the key). | ||
461 | .It Cm command="command" | 472 | .It Cm command="command" |
462 | Specifies that the command is executed whenever this key is used for | 473 | Specifies that the command is executed whenever this key is used for |
463 | authentication. | 474 | authentication. |
@@ -473,6 +484,9 @@ to restrict certain public keys to perform just a specific operation. | |||
473 | An example might be a key that permits remote backups but nothing else. | 484 | An example might be a key that permits remote backups but nothing else. |
474 | Note that the client may specify TCP and/or X11 | 485 | Note that the client may specify TCP and/or X11 |
475 | forwarding unless they are explicitly prohibited. | 486 | forwarding unless they are explicitly prohibited. |
487 | The command originally supplied by the client is available in the | ||
488 | .Ev SSH_ORIGINAL_COMMAND | ||
489 | environment variable. | ||
476 | Note that this option applies to shell, command or subsystem execution. | 490 | Note that this option applies to shell, command or subsystem execution. |
477 | .It Cm environment="NAME=value" | 491 | .It Cm environment="NAME=value" |
478 | Specifies that the string is to be added to the environment when | 492 | Specifies that the string is to be added to the environment when |
@@ -487,20 +501,38 @@ option. | |||
487 | This option is automatically disabled if | 501 | This option is automatically disabled if |
488 | .Cm UseLogin | 502 | .Cm UseLogin |
489 | is enabled. | 503 | is enabled. |
504 | .It Cm from="pattern-list" | ||
505 | Specifies that in addition to public key authentication, the canonical name | ||
506 | of the remote host must be present in the comma-separated list of | ||
507 | patterns. | ||
508 | The purpose | ||
509 | of this option is to optionally increase security: public key authentication | ||
510 | by itself does not trust the network or name servers or anything (but | ||
511 | the key); however, if somebody somehow steals the key, the key | ||
512 | permits an intruder to log in from anywhere in the world. | ||
513 | This additional option makes using a stolen key more difficult (name | ||
514 | servers and/or routers would have to be compromised in addition to | ||
515 | just the key). | ||
516 | .Pp | ||
517 | See | ||
518 | .Sx PATTERNS | ||
519 | in | ||
520 | .Xr ssh_config 5 | ||
521 | for more information on patterns. | ||
522 | .It Cm no-agent-forwarding | ||
523 | Forbids authentication agent forwarding when this key is used for | ||
524 | authentication. | ||
490 | .It Cm no-port-forwarding | 525 | .It Cm no-port-forwarding |
491 | Forbids TCP forwarding when this key is used for authentication. | 526 | Forbids TCP forwarding when this key is used for authentication. |
492 | Any port forward requests by the client will return an error. | 527 | Any port forward requests by the client will return an error. |
493 | This might be used, e.g., in connection with the | 528 | This might be used, e.g. in connection with the |
494 | .Cm command | 529 | .Cm command |
495 | option. | 530 | option. |
531 | .It Cm no-pty | ||
532 | Prevents tty allocation (a request to allocate a pty will fail). | ||
496 | .It Cm no-X11-forwarding | 533 | .It Cm no-X11-forwarding |
497 | Forbids X11 forwarding when this key is used for authentication. | 534 | Forbids X11 forwarding when this key is used for authentication. |
498 | Any X11 forward requests by the client will return an error. | 535 | Any X11 forward requests by the client will return an error. |
499 | .It Cm no-agent-forwarding | ||
500 | Forbids authentication agent forwarding when this key is used for | ||
501 | authentication. | ||
502 | .It Cm no-pty | ||
503 | Prevents tty allocation (a request to allocate a pty will fail). | ||
504 | .It Cm permitopen="host:port" | 536 | .It Cm permitopen="host:port" |
505 | Limit local | 537 | Limit local |
506 | .Li ``ssh -L'' | 538 | .Li ``ssh -L'' |
@@ -520,16 +552,20 @@ device on the server. | |||
520 | Without this option, the next available device will be used if | 552 | Without this option, the next available device will be used if |
521 | the client requests a tunnel. | 553 | the client requests a tunnel. |
522 | .El | 554 | .El |
523 | .Ss Examples | ||
524 | 1024 33 12121...312314325 ylo@foo.bar | ||
525 | .Pp | 555 | .Pp |
526 | from="*.niksula.hut.fi,!pc.niksula.hut.fi" 1024 35 23...2334 ylo@niksula | 556 | An example authorized_keys file: |
527 | .Pp | 557 | .Bd -literal -offset 3n |
528 | command="dump /home",no-pty,no-port-forwarding 1024 33 23...2323 backup.hut.fi | 558 | # Comments allowed at start of line |
529 | .Pp | 559 | ssh-rsa AAAAB3Nza...LiPk== user@example.net |
530 | permitopen="10.2.1.55:80",permitopen="10.2.1.56:25" 1024 33 23...2323 | 560 | from="*.sales.example.net,!pc.sales.example.net" ssh-rsa |
531 | .Pp | 561 | AAAAB2...19Q== john@example.net |
532 | tunnel="0",command="sh /etc/netstart tun0" ssh-rsa AAAA...== reyk@openbsd.org | 562 | command="dump /home",no-pty,no-port-forwarding ssh-dss |
563 | AAAAC3...51R== example.net | ||
564 | permitopen="192.0.2.1:80",permitopen="192.0.2.2:25" ssh-dss | ||
565 | AAAAB5...21S== | ||
566 | tunnel="0",command="sh /etc/netstart tun0" ssh-rsa AAAA...== | ||
567 | jane@example.net | ||
568 | .Ed | ||
533 | .Sh SSH_KNOWN_HOSTS FILE FORMAT | 569 | .Sh SSH_KNOWN_HOSTS FILE FORMAT |
534 | The | 570 | The |
535 | .Pa /etc/ssh/ssh_known_hosts | 571 | .Pa /etc/ssh/ssh_known_hosts |
@@ -538,7 +574,7 @@ and | |||
538 | files contain host public keys for all known hosts. | 574 | files contain host public keys for all known hosts. |
539 | The global file should | 575 | The global file should |
540 | be prepared by the administrator (optional), and the per-user file is | 576 | be prepared by the administrator (optional), and the per-user file is |
541 | maintained automatically: whenever the user connects from an unknown host | 577 | maintained automatically: whenever the user connects from an unknown host, |
542 | its key is added to the per-user file. | 578 | its key is added to the per-user file. |
543 | .Pp | 579 | .Pp |
544 | Each line in these files contains the following fields: hostnames, | 580 | Each line in these files contains the following fields: hostnames, |
@@ -546,7 +582,7 @@ bits, exponent, modulus, comment. | |||
546 | The fields are separated by spaces. | 582 | The fields are separated by spaces. |
547 | .Pp | 583 | .Pp |
548 | Hostnames is a comma-separated list of patterns | 584 | Hostnames is a comma-separated list of patterns |
549 | .Pf ( Ql \&* | 585 | .Pf ( Ql * |
550 | and | 586 | and |
551 | .Ql \&? | 587 | .Ql \&? |
552 | act as | 588 | act as |
@@ -558,6 +594,13 @@ A pattern may also be preceded by | |||
558 | to indicate negation: if the host name matches a negated | 594 | to indicate negation: if the host name matches a negated |
559 | pattern, it is not accepted (by that line) even if it matched another | 595 | pattern, it is not accepted (by that line) even if it matched another |
560 | pattern on the line. | 596 | pattern on the line. |
597 | A hostname or address may optionally be enclosed within | ||
598 | .Ql \&[ | ||
599 | and | ||
600 | .Ql \&] | ||
601 | brackets then followed by | ||
602 | .Ql \&: | ||
603 | and a non-standard port number. | ||
561 | .Pp | 604 | .Pp |
562 | Alternately, hostnames may be stored in a hashed form which hides host names | 605 | Alternately, hostnames may be stored in a hashed form which hides host names |
563 | and addresses should the file's contents be disclosed. | 606 | and addresses should the file's contents be disclosed. |
@@ -568,7 +611,7 @@ Only one hashed hostname may appear on a single line and none of the above | |||
568 | negation or wildcard operators may be applied. | 611 | negation or wildcard operators may be applied. |
569 | .Pp | 612 | .Pp |
570 | Bits, exponent, and modulus are taken directly from the RSA host key; they | 613 | Bits, exponent, and modulus are taken directly from the RSA host key; they |
571 | can be obtained, e.g., from | 614 | can be obtained, for example, from |
572 | .Pa /etc/ssh/ssh_host_key.pub . | 615 | .Pa /etc/ssh/ssh_host_key.pub . |
573 | The optional comment field continues to the end of the line, and is not used. | 616 | The optional comment field continues to the end of the line, and is not used. |
574 | .Pp | 617 | .Pp |
@@ -593,88 +636,19 @@ Rather, generate them by a script | |||
593 | or by taking | 636 | or by taking |
594 | .Pa /etc/ssh/ssh_host_key.pub | 637 | .Pa /etc/ssh/ssh_host_key.pub |
595 | and adding the host names at the front. | 638 | and adding the host names at the front. |
596 | .Ss Examples | 639 | .Pp |
597 | .Bd -literal | 640 | An example ssh_known_hosts file: |
598 | closenet,...,130.233.208.41 1024 37 159...93 closenet.hut.fi | 641 | .Bd -literal -offset 3n |
599 | cvs.openbsd.org,199.185.137.3 ssh-rsa AAAA1234.....= | 642 | # Comments allowed at start of line |
600 | .Ed | 643 | closenet,...,192.0.2.53 1024 37 159...93 closenet.example.net |
601 | .Bd -literal | 644 | cvs.example.net,192.0.2.10 ssh-rsa AAAA1234.....= |
602 | # A hashed hostname | 645 | # A hashed hostname |
603 | |1|JfKTdBh7rNbXkVAQCRp4OQoPfmI=|USECr3SWf1JUPsms5AqfD5QfxkM= ssh-rsa | 646 | |1|JfKTdBh7rNbXkVAQCRp4OQoPfmI=|USECr3SWf1JUPsms5AqfD5QfxkM= ssh-rsa |
604 | AAAA1234.....= | 647 | AAAA1234.....= |
605 | .Ed | 648 | .Ed |
606 | .Sh FILES | 649 | .Sh FILES |
607 | .Bl -tag -width Ds | 650 | .Bl -tag -width Ds -compact |
608 | .It Pa /etc/ssh/sshd_config | 651 | .It ~/.hushlogin |
609 | Contains configuration data for | ||
610 | .Nm sshd . | ||
611 | The file format and configuration options are described in | ||
612 | .Xr sshd_config 5 . | ||
613 | .It Pa /etc/ssh/ssh_host_key, /etc/ssh/ssh_host_dsa_key, /etc/ssh/ssh_host_rsa_key | ||
614 | These three files contain the private parts of the host keys. | ||
615 | These files should only be owned by root, readable only by root, and not | ||
616 | accessible to others. | ||
617 | Note that | ||
618 | .Nm | ||
619 | does not start if this file is group/world-accessible. | ||
620 | .It Pa /etc/ssh/ssh_host_key.pub, /etc/ssh/ssh_host_dsa_key.pub, /etc/ssh/ssh_host_rsa_key.pub | ||
621 | These three files contain the public parts of the host keys. | ||
622 | These files should be world-readable but writable only by | ||
623 | root. | ||
624 | Their contents should match the respective private parts. | ||
625 | These files are not | ||
626 | really used for anything; they are provided for the convenience of | ||
627 | the user so their contents can be copied to known hosts files. | ||
628 | These files are created using | ||
629 | .Xr ssh-keygen 1 . | ||
630 | .It Pa /etc/ssh/moduli | ||
631 | Contains Diffie-Hellman groups used for the "Diffie-Hellman Group Exchange". | ||
632 | The file format is described in | ||
633 | .Xr moduli 5 . | ||
634 | .It Pa /var/empty | ||
635 | .Xr chroot 2 | ||
636 | directory used by | ||
637 | .Nm | ||
638 | during privilege separation in the pre-authentication phase. | ||
639 | The directory should not contain any files and must be owned by root | ||
640 | and not group or world-writable. | ||
641 | .It Pa /var/run/sshd.pid | ||
642 | Contains the process ID of the | ||
643 | .Nm | ||
644 | listening for connections (if there are several daemons running | ||
645 | concurrently for different ports, this contains the process ID of the one | ||
646 | started last). | ||
647 | The content of this file is not sensitive; it can be world-readable. | ||
648 | .It Pa ~/.ssh/authorized_keys | ||
649 | Lists the public keys (RSA or DSA) that can be used to log into the user's account. | ||
650 | This file must be readable by root (which may on some machines imply | ||
651 | it being world-readable if the user's home directory resides on an NFS | ||
652 | volume). | ||
653 | It is recommended that it not be accessible by others. | ||
654 | The format of this file is described above. | ||
655 | Users will place the contents of their | ||
656 | .Pa identity.pub , | ||
657 | .Pa id_dsa.pub | ||
658 | and/or | ||
659 | .Pa id_rsa.pub | ||
660 | files into this file, as described in | ||
661 | .Xr ssh-keygen 1 . | ||
662 | .It Pa "/etc/ssh/ssh_known_hosts", "~/.ssh/known_hosts" | ||
663 | These files are consulted when using rhosts with RSA host | ||
664 | authentication or protocol version 2 hostbased authentication | ||
665 | to check the public key of the host. | ||
666 | The key must be listed in one of these files to be accepted. | ||
667 | The client uses the same files | ||
668 | to verify that it is connecting to the correct remote host. | ||
669 | These files should be writable only by root/the owner. | ||
670 | .Pa /etc/ssh/ssh_known_hosts | ||
671 | should be world-readable, and | ||
672 | .Pa ~/.ssh/known_hosts | ||
673 | can, but need not be, world-readable. | ||
674 | .It Pa /etc/motd | ||
675 | See | ||
676 | .Xr motd 5 . | ||
677 | .It Pa ~/.hushlogin | ||
678 | This file is used to suppress printing the last login time and | 652 | This file is used to suppress printing the last login time and |
679 | .Pa /etc/motd , | 653 | .Pa /etc/motd , |
680 | if | 654 | if |
@@ -685,86 +659,49 @@ respectively, | |||
685 | are enabled. | 659 | are enabled. |
686 | It does not suppress printing of the banner specified by | 660 | It does not suppress printing of the banner specified by |
687 | .Cm Banner . | 661 | .Cm Banner . |
688 | .It Pa /etc/nologin | 662 | .Pp |
689 | If this file exists, | 663 | .It ~/.rhosts |
664 | This file is used for host-based authentication (see | ||
665 | .Xr ssh 1 | ||
666 | for more information). | ||
667 | On some machines this file may need to be | ||
668 | world-readable if the user's home directory is on an NFS partition, | ||
669 | because | ||
690 | .Nm | 670 | .Nm |
691 | refuses to let anyone except root log in. | 671 | reads it as root. |
692 | The contents of the file | 672 | Additionally, this file must be owned by the user, |
693 | are displayed to anyone trying to log in, and non-root connections are | 673 | and must not have write permissions for anyone else. |
694 | refused. | 674 | The recommended |
695 | The file should be world-readable. | 675 | permission for most machines is read/write for the user, and not |
696 | .It Pa /etc/hosts.allow, /etc/hosts.deny | ||
697 | Access controls that should be enforced by tcp-wrappers are defined here. | ||
698 | Further details are described in | ||
699 | .Xr hosts_access 5 . | ||
700 | .It Pa ~/.rhosts | ||
701 | This file is used during | ||
702 | .Cm RhostsRSAAuthentication | ||
703 | and | ||
704 | .Cm HostbasedAuthentication | ||
705 | and contains host-username pairs, separated by a space, one per | ||
706 | line. | ||
707 | The given user on the corresponding host is permitted to log in | ||
708 | without a password. | ||
709 | The same file is used by rlogind and rshd. | ||
710 | The file must | ||
711 | be writable only by the user; it is recommended that it not be | ||
712 | accessible by others. | 676 | accessible by others. |
713 | .Pp | 677 | .Pp |
714 | It is also possible to use netgroups in the file. | 678 | .It ~/.shosts |
715 | Either host or user | 679 | This file is used in exactly the same way as |
716 | name may be of the form +@groupname to specify all hosts or all users | 680 | .Pa .rhosts , |
717 | in the group. | 681 | but allows host-based authentication without permitting login with |
718 | .It Pa ~/.shosts | 682 | rlogin/rsh. |
719 | For ssh, | 683 | .Pp |
720 | this file is exactly the same as for | 684 | .It ~/.ssh/authorized_keys |
721 | .Pa .rhosts . | 685 | Lists the public keys (RSA/DSA) that can be used for logging in as this user. |
722 | However, this file is | 686 | The format of this file is described above. |
723 | not used by rlogin and rshd, so using this permits access using SSH only. | 687 | The content of the file is not highly sensitive, but the recommended |
724 | .It Pa /etc/hosts.equiv | 688 | permissions are read/write for the user, and not accessible by others. |
725 | This file is used during | 689 | .Pp |
726 | .Cm RhostsRSAAuthentication | 690 | If this file, the |
727 | and | 691 | .Pa ~/.ssh |
728 | .Cm HostbasedAuthentication | 692 | directory, or the user's home directory are writable |
729 | authentication. | 693 | by other users, then the file could be modified or replaced by unauthorized |
730 | In the simplest form, this file contains host names, one per line. | 694 | users. |
731 | Users on | 695 | In this case, |
732 | those hosts are permitted to log in without a password, provided they | 696 | .Nm |
733 | have the same user name on both machines. | 697 | will not allow it to be used unless the |
734 | The host name may also be | 698 | .Cm StrictModes |
735 | followed by a user name; such users are permitted to log in as | 699 | option has been set to |
736 | .Em any | 700 | .Dq no . |
737 | user on this machine (except root). | 701 | The recommended permissions can be set by executing |
738 | Additionally, the syntax | 702 | .Dq chmod go-w ~/ ~/.ssh ~/.ssh/authorized_keys . |
739 | .Dq +@group | 703 | .Pp |
740 | can be used to specify netgroups. | 704 | .It ~/.ssh/environment |
741 | Negated entries start with | ||
742 | .Ql \&- . | ||
743 | .Pp | ||
744 | If the client host/user is successfully matched in this file, login is | ||
745 | automatically permitted provided the client and server user names are the | ||
746 | same. | ||
747 | Additionally, successful client host key authentication is required. | ||
748 | This file must be writable only by root; it is recommended | ||
749 | that it be world-readable. | ||
750 | .Pp | ||
751 | .Sy "Warning: It is almost never a good idea to use user names in" | ||
752 | .Pa hosts.equiv . | ||
753 | Beware that it really means that the named user(s) can log in as | ||
754 | .Em anybody , | ||
755 | which includes bin, daemon, adm, and other accounts that own critical | ||
756 | binaries and directories. | ||
757 | Using a user name practically grants the user root access. | ||
758 | The only valid use for user names that I can think | ||
759 | of is in negative entries. | ||
760 | .Pp | ||
761 | Note that this warning also applies to rsh/rlogin. | ||
762 | .It Pa /etc/shosts.equiv | ||
763 | This is processed exactly as | ||
764 | .Pa /etc/hosts.equiv . | ||
765 | However, this file may be useful in environments that want to run both | ||
766 | rsh/rlogin and ssh. | ||
767 | .It Pa ~/.ssh/environment | ||
768 | This file is read into the environment at login (if it exists). | 705 | This file is read into the environment at login (if it exists). |
769 | It can only contain empty lines, comment lines (that start with | 706 | It can only contain empty lines, comment lines (that start with |
770 | .Ql # ) , | 707 | .Ql # ) , |
@@ -775,55 +712,115 @@ Environment processing is disabled by default and is | |||
775 | controlled via the | 712 | controlled via the |
776 | .Cm PermitUserEnvironment | 713 | .Cm PermitUserEnvironment |
777 | option. | 714 | option. |
778 | .It Pa ~/.ssh/rc | 715 | .Pp |
779 | If this file exists, it is run with | 716 | .It ~/.ssh/known_hosts |
780 | .Pa /bin/sh | 717 | Contains a list of host keys for all hosts the user has logged into |
781 | after reading the | 718 | that are not already in the systemwide list of known host keys. |
782 | environment files but before starting the user's shell or command. | 719 | The format of this file is described above. |
783 | It must not produce any output on stdout; stderr must be used | 720 | This file should be writable only by root/the owner and |
784 | instead. | 721 | can, but need not be, world-readable. |
785 | If X11 forwarding is in use, it will receive the "proto cookie" pair in | 722 | .Pp |
786 | its standard input (and | 723 | .It ~/.ssh/rc |
787 | .Ev DISPLAY | 724 | Contains initialization routines to be run before |
788 | in its environment). | 725 | the user's home directory becomes accessible. |
789 | The script must call | 726 | This file should be writable only by the user, and need not be |
790 | .Xr xauth 1 | 727 | readable by anyone else. |
791 | because | 728 | .Pp |
729 | .It /etc/hosts.allow | ||
730 | .It /etc/hosts.deny | ||
731 | Access controls that should be enforced by tcp-wrappers are defined here. | ||
732 | Further details are described in | ||
733 | .Xr hosts_access 5 . | ||
734 | .Pp | ||
735 | .It /etc/hosts.equiv | ||
736 | This file is for host-based authentication (see | ||
737 | .Xr ssh 1 ) . | ||
738 | It should only be writable by root. | ||
739 | .Pp | ||
740 | .It /etc/ssh/moduli | ||
741 | Contains Diffie-Hellman groups used for the "Diffie-Hellman Group Exchange". | ||
742 | The file format is described in | ||
743 | .Xr moduli 5 . | ||
744 | .Pp | ||
745 | .It /etc/motd | ||
746 | See | ||
747 | .Xr motd 5 . | ||
748 | .Pp | ||
749 | .It /etc/nologin | ||
750 | If this file exists, | ||
792 | .Nm | 751 | .Nm |
793 | will not run xauth automatically to add X11 cookies. | 752 | refuses to let anyone except root log in. |
753 | The contents of the file | ||
754 | are displayed to anyone trying to log in, and non-root connections are | ||
755 | refused. | ||
756 | The file should be world-readable. | ||
794 | .Pp | 757 | .Pp |
795 | The primary purpose of this file is to run any initialization routines | 758 | .It /etc/shosts.equiv |
796 | which may be needed before the user's home directory becomes | 759 | This file is used in exactly the same way as |
797 | accessible; AFS is a particular example of such an environment. | 760 | .Pa hosts.equiv , |
761 | but allows host-based authentication without permitting login with | ||
762 | rlogin/rsh. | ||
763 | .Pp | ||
764 | .It /etc/ssh/ssh_known_hosts | ||
765 | Systemwide list of known host keys. | ||
766 | This file should be prepared by the | ||
767 | system administrator to contain the public host keys of all machines in the | ||
768 | organization. | ||
769 | The format of this file is described above. | ||
770 | This file should be writable only by root/the owner and | ||
771 | should be world-readable. | ||
798 | .Pp | 772 | .Pp |
799 | This file will probably contain some initialization code followed by | 773 | .It /etc/ssh/ssh_host_key |
800 | something similar to: | 774 | .It /etc/ssh/ssh_host_dsa_key |
801 | .Bd -literal | 775 | .It /etc/ssh/ssh_host_rsa_key |
802 | if read proto cookie && [ -n "$DISPLAY" ]; then | 776 | These three files contain the private parts of the host keys. |
803 | if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then | 777 | These files should only be owned by root, readable only by root, and not |
804 | # X11UseLocalhost=yes | 778 | accessible to others. |
805 | echo add unix:`echo $DISPLAY | | 779 | Note that |
806 | cut -c11-` $proto $cookie | 780 | .Nm |
807 | else | 781 | does not start if these files are group/world-accessible. |
808 | # X11UseLocalhost=no | ||
809 | echo add $DISPLAY $proto $cookie | ||
810 | fi | xauth -q - | ||
811 | fi | ||
812 | .Ed | ||
813 | .Pp | 782 | .Pp |
814 | If this file does not exist, | 783 | .It /etc/ssh/ssh_host_key.pub |
815 | .Pa /etc/ssh/sshrc | 784 | .It /etc/ssh/ssh_host_dsa_key.pub |
816 | is run, and if that | 785 | .It /etc/ssh/ssh_host_rsa_key.pub |
817 | does not exist either, xauth is used to add the cookie. | 786 | These three files contain the public parts of the host keys. |
787 | These files should be world-readable but writable only by | ||
788 | root. | ||
789 | Their contents should match the respective private parts. | ||
790 | These files are not | ||
791 | really used for anything; they are provided for the convenience of | ||
792 | the user so their contents can be copied to known hosts files. | ||
793 | These files are created using | ||
794 | .Xr ssh-keygen 1 . | ||
818 | .Pp | 795 | .Pp |
819 | This file should be writable only by the user, and need not be | 796 | .It /etc/ssh/sshd_config |
820 | readable by anyone else. | 797 | Contains configuration data for |
821 | .It Pa /etc/ssh/sshrc | 798 | .Nm sshd . |
822 | Like | 799 | The file format and configuration options are described in |
823 | .Pa ~/.ssh/rc . | 800 | .Xr sshd_config 5 . |
824 | This can be used to specify | 801 | .Pp |
802 | .It /etc/ssh/sshrc | ||
803 | Similar to | ||
804 | .Pa ~/.ssh/rc , | ||
805 | it can be used to specify | ||
825 | machine-specific login-time initializations globally. | 806 | machine-specific login-time initializations globally. |
826 | This file should be writable only by root, and should be world-readable. | 807 | This file should be writable only by root, and should be world-readable. |
808 | .Pp | ||
809 | .It /var/empty | ||
810 | .Xr chroot 2 | ||
811 | directory used by | ||
812 | .Nm | ||
813 | during privilege separation in the pre-authentication phase. | ||
814 | The directory should not contain any files and must be owned by root | ||
815 | and not group or world-writable. | ||
816 | .Pp | ||
817 | .It /var/run/sshd.pid | ||
818 | Contains the process ID of the | ||
819 | .Nm | ||
820 | listening for connections (if there are several daemons running | ||
821 | concurrently for different ports, this contains the process ID of the one | ||
822 | started last). | ||
823 | The content of this file is not sensitive; it can be world-readable. | ||
827 | .El | 824 | .El |
828 | .Sh SEE ALSO | 825 | .Sh SEE ALSO |
829 | .Xr scp 1 , | 826 | .Xr scp 1 , |
@@ -839,26 +836,6 @@ This file should be writable only by root, and should be world-readable. | |||
839 | .Xr sshd_config 5 , | 836 | .Xr sshd_config 5 , |
840 | .Xr inetd 8 , | 837 | .Xr inetd 8 , |
841 | .Xr sftp-server 8 | 838 | .Xr sftp-server 8 |
842 | .Rs | ||
843 | .%A T. Ylonen | ||
844 | .%A T. Kivinen | ||
845 | .%A M. Saarinen | ||
846 | .%A T. Rinne | ||
847 | .%A S. Lehtinen | ||
848 | .%T "SSH Protocol Architecture" | ||
849 | .%N draft-ietf-secsh-architecture-12.txt | ||
850 | .%D January 2002 | ||
851 | .%O work in progress material | ||
852 | .Re | ||
853 | .Rs | ||
854 | .%A M. Friedl | ||
855 | .%A N. Provos | ||
856 | .%A W. A. Simpson | ||
857 | .%T "Diffie-Hellman Group Exchange for the SSH Transport Layer Protocol" | ||
858 | .%N draft-ietf-secsh-dh-group-exchange-02.txt | ||
859 | .%D January 2002 | ||
860 | .%O work in progress material | ||
861 | .Re | ||
862 | .Sh AUTHORS | 839 | .Sh AUTHORS |
863 | OpenSSH is a derivative of the original and free | 840 | OpenSSH is a derivative of the original and free |
864 | ssh 1.2.12 release by Tatu Ylonen. | 841 | ssh 1.2.12 release by Tatu Ylonen. |
@@ -870,3 +847,14 @@ Markus Friedl contributed the support for SSH | |||
870 | protocol versions 1.5 and 2.0. | 847 | protocol versions 1.5 and 2.0. |
871 | Niels Provos and Markus Friedl contributed support | 848 | Niels Provos and Markus Friedl contributed support |
872 | for privilege separation. | 849 | for privilege separation. |
850 | .Sh CAVEATS | ||
851 | System security is not improved unless | ||
852 | .Nm rshd , | ||
853 | .Nm rlogind , | ||
854 | and | ||
855 | .Nm rexecd | ||
856 | are disabled (thus completely disabling | ||
857 | .Xr rlogin | ||
858 | and | ||
859 | .Xr rsh | ||
860 | into the machine). | ||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: sshd.c,v 1.349 2007/02/21 11:00:05 dtucker Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -42,7 +43,33 @@ | |||
42 | */ | 43 | */ |
43 | 44 | ||
44 | #include "includes.h" | 45 | #include "includes.h" |
45 | RCSID("$OpenBSD: sshd.c,v 1.318 2005/12/24 02:27:41 djm Exp $"); | 46 | |
47 | #include <sys/types.h> | ||
48 | #include <sys/ioctl.h> | ||
49 | #include <sys/socket.h> | ||
50 | #ifdef HAVE_SYS_STAT_H | ||
51 | # include <sys/stat.h> | ||
52 | #endif | ||
53 | #ifdef HAVE_SYS_TIME_H | ||
54 | # include <sys/time.h> | ||
55 | #endif | ||
56 | #include "openbsd-compat/sys-tree.h" | ||
57 | #include <sys/wait.h> | ||
58 | |||
59 | #include <errno.h> | ||
60 | #include <fcntl.h> | ||
61 | #include <netdb.h> | ||
62 | #ifdef HAVE_PATHS_H | ||
63 | #include <paths.h> | ||
64 | #endif | ||
65 | #include <grp.h> | ||
66 | #include <pwd.h> | ||
67 | #include <signal.h> | ||
68 | #include <stdarg.h> | ||
69 | #include <stdio.h> | ||
70 | #include <stdlib.h> | ||
71 | #include <string.h> | ||
72 | #include <unistd.h> | ||
46 | 73 | ||
47 | #include <openssl/dh.h> | 74 | #include <openssl/dh.h> |
48 | #include <openssl/bn.h> | 75 | #include <openssl/bn.h> |
@@ -53,28 +80,28 @@ RCSID("$OpenBSD: sshd.c,v 1.318 2005/12/24 02:27:41 djm Exp $"); | |||
53 | #include <prot.h> | 80 | #include <prot.h> |
54 | #endif | 81 | #endif |
55 | 82 | ||
83 | #include "xmalloc.h" | ||
56 | #include "ssh.h" | 84 | #include "ssh.h" |
57 | #include "ssh1.h" | 85 | #include "ssh1.h" |
58 | #include "ssh2.h" | 86 | #include "ssh2.h" |
59 | #include "xmalloc.h" | ||
60 | #include "rsa.h" | 87 | #include "rsa.h" |
61 | #include "sshpty.h" | 88 | #include "sshpty.h" |
62 | #include "packet.h" | 89 | #include "packet.h" |
63 | #include "log.h" | 90 | #include "log.h" |
91 | #include "buffer.h" | ||
64 | #include "servconf.h" | 92 | #include "servconf.h" |
65 | #include "uidswap.h" | 93 | #include "uidswap.h" |
66 | #include "compat.h" | 94 | #include "compat.h" |
67 | #include "buffer.h" | ||
68 | #include "bufaux.h" | ||
69 | #include "cipher.h" | 95 | #include "cipher.h" |
70 | #include "kex.h" | ||
71 | #include "key.h" | 96 | #include "key.h" |
97 | #include "kex.h" | ||
72 | #include "dh.h" | 98 | #include "dh.h" |
73 | #include "myproposal.h" | 99 | #include "myproposal.h" |
74 | #include "authfile.h" | 100 | #include "authfile.h" |
75 | #include "pathnames.h" | 101 | #include "pathnames.h" |
76 | #include "atomicio.h" | 102 | #include "atomicio.h" |
77 | #include "canohost.h" | 103 | #include "canohost.h" |
104 | #include "hostfile.h" | ||
78 | #include "auth.h" | 105 | #include "auth.h" |
79 | #include "misc.h" | 106 | #include "misc.h" |
80 | #include "msg.h" | 107 | #include "msg.h" |
@@ -83,8 +110,12 @@ RCSID("$OpenBSD: sshd.c,v 1.318 2005/12/24 02:27:41 djm Exp $"); | |||
83 | #include "session.h" | 110 | #include "session.h" |
84 | #include "monitor_mm.h" | 111 | #include "monitor_mm.h" |
85 | #include "monitor.h" | 112 | #include "monitor.h" |
113 | #ifdef GSSAPI | ||
114 | #include "ssh-gss.h" | ||
115 | #endif | ||
86 | #include "monitor_wrap.h" | 116 | #include "monitor_wrap.h" |
87 | #include "monitor_fdpass.h" | 117 | #include "monitor_fdpass.h" |
118 | #include "version.h" | ||
88 | 119 | ||
89 | #ifdef USE_SECURITY_SESSION_API | 120 | #ifdef USE_SECURITY_SESSION_API |
90 | #include <Security/AuthSession.h> | 121 | #include <Security/AuthSession.h> |
@@ -205,15 +236,21 @@ int *startup_pipes = NULL; | |||
205 | int startup_pipe; /* in child */ | 236 | int startup_pipe; /* in child */ |
206 | 237 | ||
207 | /* variables used for privilege separation */ | 238 | /* variables used for privilege separation */ |
208 | int use_privsep; | 239 | int use_privsep = -1; |
209 | struct monitor *pmonitor = NULL; | 240 | struct monitor *pmonitor = NULL; |
210 | 241 | ||
211 | /* global authentication context */ | 242 | /* global authentication context */ |
212 | Authctxt *the_authctxt = NULL; | 243 | Authctxt *the_authctxt = NULL; |
213 | 244 | ||
245 | /* sshd_config buffer */ | ||
246 | Buffer cfg; | ||
247 | |||
214 | /* message to be displayed after login */ | 248 | /* message to be displayed after login */ |
215 | Buffer loginmsg; | 249 | Buffer loginmsg; |
216 | 250 | ||
251 | /* Unprivileged user */ | ||
252 | struct passwd *privsep_pw = NULL; | ||
253 | |||
217 | /* Prototypes for various functions defined later in this file. */ | 254 | /* Prototypes for various functions defined later in this file. */ |
218 | void destroy_sensitive_data(void); | 255 | void destroy_sensitive_data(void); |
219 | void demote_sensitive_data(void); | 256 | void demote_sensitive_data(void); |
@@ -250,6 +287,8 @@ close_startup_pipes(void) | |||
250 | * the effect is to reread the configuration file (and to regenerate | 287 | * the effect is to reread the configuration file (and to regenerate |
251 | * the server key). | 288 | * the server key). |
252 | */ | 289 | */ |
290 | |||
291 | /*ARGSUSED*/ | ||
253 | static void | 292 | static void |
254 | sighup_handler(int sig) | 293 | sighup_handler(int sig) |
255 | { | 294 | { |
@@ -270,6 +309,7 @@ sighup_restart(void) | |||
270 | logit("Received SIGHUP; restarting."); | 309 | logit("Received SIGHUP; restarting."); |
271 | close_listen_socks(); | 310 | close_listen_socks(); |
272 | close_startup_pipes(); | 311 | close_startup_pipes(); |
312 | alarm(0); /* alarm timer persists across exec */ | ||
273 | execv(saved_argv[0], saved_argv); | 313 | execv(saved_argv[0], saved_argv); |
274 | logit("RESTART FAILED: av[0]='%.100s', error: %.100s.", saved_argv[0], | 314 | logit("RESTART FAILED: av[0]='%.100s', error: %.100s.", saved_argv[0], |
275 | strerror(errno)); | 315 | strerror(errno)); |
@@ -279,6 +319,7 @@ sighup_restart(void) | |||
279 | /* | 319 | /* |
280 | * Generic signal handler for terminating signals in the master daemon. | 320 | * Generic signal handler for terminating signals in the master daemon. |
281 | */ | 321 | */ |
322 | /*ARGSUSED*/ | ||
282 | static void | 323 | static void |
283 | sigterm_handler(int sig) | 324 | sigterm_handler(int sig) |
284 | { | 325 | { |
@@ -289,6 +330,7 @@ sigterm_handler(int sig) | |||
289 | * SIGCHLD handler. This is called whenever a child dies. This will then | 330 | * SIGCHLD handler. This is called whenever a child dies. This will then |
290 | * reap any zombies left by exited children. | 331 | * reap any zombies left by exited children. |
291 | */ | 332 | */ |
333 | /*ARGSUSED*/ | ||
292 | static void | 334 | static void |
293 | main_sigchld_handler(int sig) | 335 | main_sigchld_handler(int sig) |
294 | { | 336 | { |
@@ -307,6 +349,7 @@ main_sigchld_handler(int sig) | |||
307 | /* | 349 | /* |
308 | * Signal handler for the alarm after the login grace period has expired. | 350 | * Signal handler for the alarm after the login grace period has expired. |
309 | */ | 351 | */ |
352 | /*ARGSUSED*/ | ||
310 | static void | 353 | static void |
311 | grace_alarm_handler(int sig) | 354 | grace_alarm_handler(int sig) |
312 | { | 355 | { |
@@ -347,6 +390,7 @@ generate_ephemeral_server_key(void) | |||
347 | arc4random_stir(); | 390 | arc4random_stir(); |
348 | } | 391 | } |
349 | 392 | ||
393 | /*ARGSUSED*/ | ||
350 | static void | 394 | static void |
351 | key_regeneration_alarm(int sig) | 395 | key_regeneration_alarm(int sig) |
352 | { | 396 | { |
@@ -543,7 +587,6 @@ privsep_preauth_child(void) | |||
543 | { | 587 | { |
544 | u_int32_t rnd[256]; | 588 | u_int32_t rnd[256]; |
545 | gid_t gidset[1]; | 589 | gid_t gidset[1]; |
546 | struct passwd *pw; | ||
547 | int i; | 590 | int i; |
548 | 591 | ||
549 | /* Enable challenge-response authentication for privilege separation */ | 592 | /* Enable challenge-response authentication for privilege separation */ |
@@ -556,12 +599,6 @@ privsep_preauth_child(void) | |||
556 | /* Demote the private keys to public keys. */ | 599 | /* Demote the private keys to public keys. */ |
557 | demote_sensitive_data(); | 600 | demote_sensitive_data(); |
558 | 601 | ||
559 | if ((pw = getpwnam(SSH_PRIVSEP_USER)) == NULL) | ||
560 | fatal("Privilege separation user %s does not exist", | ||
561 | SSH_PRIVSEP_USER); | ||
562 | memset(pw->pw_passwd, 0, strlen(pw->pw_passwd)); | ||
563 | endpwent(); | ||
564 | |||
565 | /* Change our root directory */ | 602 | /* Change our root directory */ |
566 | if (chroot(_PATH_PRIVSEP_CHROOT_DIR) == -1) | 603 | if (chroot(_PATH_PRIVSEP_CHROOT_DIR) == -1) |
567 | fatal("chroot(\"%s\"): %s", _PATH_PRIVSEP_CHROOT_DIR, | 604 | fatal("chroot(\"%s\"): %s", _PATH_PRIVSEP_CHROOT_DIR, |
@@ -570,16 +607,16 @@ privsep_preauth_child(void) | |||
570 | fatal("chdir(\"/\"): %s", strerror(errno)); | 607 | fatal("chdir(\"/\"): %s", strerror(errno)); |
571 | 608 | ||
572 | /* Drop our privileges */ | 609 | /* Drop our privileges */ |
573 | debug3("privsep user:group %u:%u", (u_int)pw->pw_uid, | 610 | debug3("privsep user:group %u:%u", (u_int)privsep_pw->pw_uid, |
574 | (u_int)pw->pw_gid); | 611 | (u_int)privsep_pw->pw_gid); |
575 | #if 0 | 612 | #if 0 |
576 | /* XXX not ready, too heavy after chroot */ | 613 | /* XXX not ready, too heavy after chroot */ |
577 | do_setusercontext(pw); | 614 | do_setusercontext(privsep_pw); |
578 | #else | 615 | #else |
579 | gidset[0] = pw->pw_gid; | 616 | gidset[0] = privsep_pw->pw_gid; |
580 | if (setgroups(1, gidset) < 0) | 617 | if (setgroups(1, gidset) < 0) |
581 | fatal("setgroups: %.100s", strerror(errno)); | 618 | fatal("setgroups: %.100s", strerror(errno)); |
582 | permanently_set_uid(pw); | 619 | permanently_set_uid(privsep_pw); |
583 | #endif | 620 | #endif |
584 | } | 621 | } |
585 | 622 | ||
@@ -868,6 +905,325 @@ recv_rexec_state(int fd, Buffer *conf) | |||
868 | debug3("%s: done", __func__); | 905 | debug3("%s: done", __func__); |
869 | } | 906 | } |
870 | 907 | ||
908 | /* Accept a connection from inetd */ | ||
909 | static void | ||
910 | server_accept_inetd(int *sock_in, int *sock_out) | ||
911 | { | ||
912 | int fd; | ||
913 | |||
914 | startup_pipe = -1; | ||
915 | if (rexeced_flag) { | ||
916 | close(REEXEC_CONFIG_PASS_FD); | ||
917 | *sock_in = *sock_out = dup(STDIN_FILENO); | ||
918 | if (!debug_flag) { | ||
919 | startup_pipe = dup(REEXEC_STARTUP_PIPE_FD); | ||
920 | close(REEXEC_STARTUP_PIPE_FD); | ||
921 | } | ||
922 | } else { | ||
923 | *sock_in = dup(STDIN_FILENO); | ||
924 | *sock_out = dup(STDOUT_FILENO); | ||
925 | } | ||
926 | /* | ||
927 | * We intentionally do not close the descriptors 0, 1, and 2 | ||
928 | * as our code for setting the descriptors won't work if | ||
929 | * ttyfd happens to be one of those. | ||
930 | */ | ||
931 | if ((fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { | ||
932 | dup2(fd, STDIN_FILENO); | ||
933 | dup2(fd, STDOUT_FILENO); | ||
934 | if (fd > STDOUT_FILENO) | ||
935 | close(fd); | ||
936 | } | ||
937 | debug("inetd sockets after dupping: %d, %d", *sock_in, *sock_out); | ||
938 | } | ||
939 | |||
940 | /* | ||
941 | * Listen for TCP connections | ||
942 | */ | ||
943 | static void | ||
944 | server_listen(void) | ||
945 | { | ||
946 | int ret, listen_sock, on = 1; | ||
947 | struct addrinfo *ai; | ||
948 | char ntop[NI_MAXHOST], strport[NI_MAXSERV]; | ||
949 | |||
950 | for (ai = options.listen_addrs; ai; ai = ai->ai_next) { | ||
951 | if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6) | ||
952 | continue; | ||
953 | if (num_listen_socks >= MAX_LISTEN_SOCKS) | ||
954 | fatal("Too many listen sockets. " | ||
955 | "Enlarge MAX_LISTEN_SOCKS"); | ||
956 | if ((ret = getnameinfo(ai->ai_addr, ai->ai_addrlen, | ||
957 | ntop, sizeof(ntop), strport, sizeof(strport), | ||
958 | NI_NUMERICHOST|NI_NUMERICSERV)) != 0) { | ||
959 | error("getnameinfo failed: %.100s", | ||
960 | (ret != EAI_SYSTEM) ? gai_strerror(ret) : | ||
961 | strerror(errno)); | ||
962 | continue; | ||
963 | } | ||
964 | /* Create socket for listening. */ | ||
965 | listen_sock = socket(ai->ai_family, ai->ai_socktype, | ||
966 | ai->ai_protocol); | ||
967 | if (listen_sock < 0) { | ||
968 | /* kernel may not support ipv6 */ | ||
969 | verbose("socket: %.100s", strerror(errno)); | ||
970 | continue; | ||
971 | } | ||
972 | if (set_nonblock(listen_sock) == -1) { | ||
973 | close(listen_sock); | ||
974 | continue; | ||
975 | } | ||
976 | /* | ||
977 | * Set socket options. | ||
978 | * Allow local port reuse in TIME_WAIT. | ||
979 | */ | ||
980 | if (setsockopt(listen_sock, SOL_SOCKET, SO_REUSEADDR, | ||
981 | &on, sizeof(on)) == -1) | ||
982 | error("setsockopt SO_REUSEADDR: %s", strerror(errno)); | ||
983 | |||
984 | debug("Bind to port %s on %s.", strport, ntop); | ||
985 | |||
986 | /* Bind the socket to the desired port. */ | ||
987 | if (bind(listen_sock, ai->ai_addr, ai->ai_addrlen) < 0) { | ||
988 | error("Bind to port %s on %s failed: %.200s.", | ||
989 | strport, ntop, strerror(errno)); | ||
990 | close(listen_sock); | ||
991 | continue; | ||
992 | } | ||
993 | listen_socks[num_listen_socks] = listen_sock; | ||
994 | num_listen_socks++; | ||
995 | |||
996 | /* Start listening on the port. */ | ||
997 | if (listen(listen_sock, SSH_LISTEN_BACKLOG) < 0) | ||
998 | fatal("listen on [%s]:%s: %.100s", | ||
999 | ntop, strport, strerror(errno)); | ||
1000 | logit("Server listening on %s port %s.", ntop, strport); | ||
1001 | } | ||
1002 | freeaddrinfo(options.listen_addrs); | ||
1003 | |||
1004 | if (!num_listen_socks) | ||
1005 | fatal("Cannot bind any address."); | ||
1006 | } | ||
1007 | |||
1008 | /* | ||
1009 | * The main TCP accept loop. Note that, for the non-debug case, returns | ||
1010 | * from this function are in a forked subprocess. | ||
1011 | */ | ||
1012 | static void | ||
1013 | server_accept_loop(int *sock_in, int *sock_out, int *newsock, int *config_s) | ||
1014 | { | ||
1015 | fd_set *fdset; | ||
1016 | int i, j, ret, maxfd; | ||
1017 | int key_used = 0, startups = 0; | ||
1018 | int startup_p[2] = { -1 , -1 }; | ||
1019 | struct sockaddr_storage from; | ||
1020 | socklen_t fromlen; | ||
1021 | pid_t pid; | ||
1022 | |||
1023 | /* setup fd set for accept */ | ||
1024 | fdset = NULL; | ||
1025 | maxfd = 0; | ||
1026 | for (i = 0; i < num_listen_socks; i++) | ||
1027 | if (listen_socks[i] > maxfd) | ||
1028 | maxfd = listen_socks[i]; | ||
1029 | /* pipes connected to unauthenticated childs */ | ||
1030 | startup_pipes = xcalloc(options.max_startups, sizeof(int)); | ||
1031 | for (i = 0; i < options.max_startups; i++) | ||
1032 | startup_pipes[i] = -1; | ||
1033 | |||
1034 | /* | ||
1035 | * Stay listening for connections until the system crashes or | ||
1036 | * the daemon is killed with a signal. | ||
1037 | */ | ||
1038 | for (;;) { | ||
1039 | if (received_sighup) | ||
1040 | sighup_restart(); | ||
1041 | if (fdset != NULL) | ||
1042 | xfree(fdset); | ||
1043 | fdset = (fd_set *)xcalloc(howmany(maxfd + 1, NFDBITS), | ||
1044 | sizeof(fd_mask)); | ||
1045 | |||
1046 | for (i = 0; i < num_listen_socks; i++) | ||
1047 | FD_SET(listen_socks[i], fdset); | ||
1048 | for (i = 0; i < options.max_startups; i++) | ||
1049 | if (startup_pipes[i] != -1) | ||
1050 | FD_SET(startup_pipes[i], fdset); | ||
1051 | |||
1052 | /* Wait in select until there is a connection. */ | ||
1053 | ret = select(maxfd+1, fdset, NULL, NULL, NULL); | ||
1054 | if (ret < 0 && errno != EINTR) | ||
1055 | error("select: %.100s", strerror(errno)); | ||
1056 | if (received_sigterm) { | ||
1057 | logit("Received signal %d; terminating.", | ||
1058 | (int) received_sigterm); | ||
1059 | close_listen_socks(); | ||
1060 | unlink(options.pid_file); | ||
1061 | exit(255); | ||
1062 | } | ||
1063 | if (key_used && key_do_regen) { | ||
1064 | generate_ephemeral_server_key(); | ||
1065 | key_used = 0; | ||
1066 | key_do_regen = 0; | ||
1067 | } | ||
1068 | if (ret < 0) | ||
1069 | continue; | ||
1070 | |||
1071 | for (i = 0; i < options.max_startups; i++) | ||
1072 | if (startup_pipes[i] != -1 && | ||
1073 | FD_ISSET(startup_pipes[i], fdset)) { | ||
1074 | /* | ||
1075 | * the read end of the pipe is ready | ||
1076 | * if the child has closed the pipe | ||
1077 | * after successful authentication | ||
1078 | * or if the child has died | ||
1079 | */ | ||
1080 | close(startup_pipes[i]); | ||
1081 | startup_pipes[i] = -1; | ||
1082 | startups--; | ||
1083 | } | ||
1084 | for (i = 0; i < num_listen_socks; i++) { | ||
1085 | if (!FD_ISSET(listen_socks[i], fdset)) | ||
1086 | continue; | ||
1087 | fromlen = sizeof(from); | ||
1088 | *newsock = accept(listen_socks[i], | ||
1089 | (struct sockaddr *)&from, &fromlen); | ||
1090 | if (*newsock < 0) { | ||
1091 | if (errno != EINTR && errno != EWOULDBLOCK) | ||
1092 | error("accept: %.100s", strerror(errno)); | ||
1093 | continue; | ||
1094 | } | ||
1095 | if (unset_nonblock(*newsock) == -1) { | ||
1096 | close(*newsock); | ||
1097 | continue; | ||
1098 | } | ||
1099 | if (drop_connection(startups) == 1) { | ||
1100 | debug("drop connection #%d", startups); | ||
1101 | close(*newsock); | ||
1102 | continue; | ||
1103 | } | ||
1104 | if (pipe(startup_p) == -1) { | ||
1105 | close(*newsock); | ||
1106 | continue; | ||
1107 | } | ||
1108 | |||
1109 | if (rexec_flag && socketpair(AF_UNIX, | ||
1110 | SOCK_STREAM, 0, config_s) == -1) { | ||
1111 | error("reexec socketpair: %s", | ||
1112 | strerror(errno)); | ||
1113 | close(*newsock); | ||
1114 | close(startup_p[0]); | ||
1115 | close(startup_p[1]); | ||
1116 | continue; | ||
1117 | } | ||
1118 | |||
1119 | for (j = 0; j < options.max_startups; j++) | ||
1120 | if (startup_pipes[j] == -1) { | ||
1121 | startup_pipes[j] = startup_p[0]; | ||
1122 | if (maxfd < startup_p[0]) | ||
1123 | maxfd = startup_p[0]; | ||
1124 | startups++; | ||
1125 | break; | ||
1126 | } | ||
1127 | |||
1128 | /* | ||
1129 | * Got connection. Fork a child to handle it, unless | ||
1130 | * we are in debugging mode. | ||
1131 | */ | ||
1132 | if (debug_flag) { | ||
1133 | /* | ||
1134 | * In debugging mode. Close the listening | ||
1135 | * socket, and start processing the | ||
1136 | * connection without forking. | ||
1137 | */ | ||
1138 | debug("Server will not fork when running in debugging mode."); | ||
1139 | close_listen_socks(); | ||
1140 | *sock_in = *newsock; | ||
1141 | *sock_out = *newsock; | ||
1142 | close(startup_p[0]); | ||
1143 | close(startup_p[1]); | ||
1144 | startup_pipe = -1; | ||
1145 | pid = getpid(); | ||
1146 | if (rexec_flag) { | ||
1147 | send_rexec_state(config_s[0], | ||
1148 | &cfg); | ||
1149 | close(config_s[0]); | ||
1150 | } | ||
1151 | break; | ||
1152 | } | ||
1153 | |||
1154 | /* | ||
1155 | * Normal production daemon. Fork, and have | ||
1156 | * the child process the connection. The | ||
1157 | * parent continues listening. | ||
1158 | */ | ||
1159 | platform_pre_fork(); | ||
1160 | if ((pid = fork()) == 0) { | ||
1161 | /* | ||
1162 | * Child. Close the listening and | ||
1163 | * max_startup sockets. Start using | ||
1164 | * the accepted socket. Reinitialize | ||
1165 | * logging (since our pid has changed). | ||
1166 | * We break out of the loop to handle | ||
1167 | * the connection. | ||
1168 | */ | ||
1169 | platform_post_fork_child(); | ||
1170 | startup_pipe = startup_p[1]; | ||
1171 | close_startup_pipes(); | ||
1172 | close_listen_socks(); | ||
1173 | *sock_in = *newsock; | ||
1174 | *sock_out = *newsock; | ||
1175 | log_init(__progname, | ||
1176 | options.log_level, | ||
1177 | options.log_facility, | ||
1178 | log_stderr); | ||
1179 | if (rexec_flag) | ||
1180 | close(config_s[0]); | ||
1181 | break; | ||
1182 | } | ||
1183 | |||
1184 | /* Parent. Stay in the loop. */ | ||
1185 | platform_post_fork_parent(pid); | ||
1186 | if (pid < 0) | ||
1187 | error("fork: %.100s", strerror(errno)); | ||
1188 | else | ||
1189 | debug("Forked child %ld.", (long)pid); | ||
1190 | |||
1191 | close(startup_p[1]); | ||
1192 | |||
1193 | if (rexec_flag) { | ||
1194 | send_rexec_state(config_s[0], &cfg); | ||
1195 | close(config_s[0]); | ||
1196 | close(config_s[1]); | ||
1197 | } | ||
1198 | |||
1199 | /* | ||
1200 | * Mark that the key has been used (it | ||
1201 | * was "given" to the child). | ||
1202 | */ | ||
1203 | if ((options.protocol & SSH_PROTO_1) && | ||
1204 | key_used == 0) { | ||
1205 | /* Schedule server key regeneration alarm. */ | ||
1206 | signal(SIGALRM, key_regeneration_alarm); | ||
1207 | alarm(options.key_regeneration_time); | ||
1208 | key_used = 1; | ||
1209 | } | ||
1210 | |||
1211 | close(*newsock); | ||
1212 | |||
1213 | /* | ||
1214 | * Ensure that our random state differs | ||
1215 | * from that of the child | ||
1216 | */ | ||
1217 | arc4random_stir(); | ||
1218 | } | ||
1219 | |||
1220 | /* child process check (or debug mode) */ | ||
1221 | if (num_listen_socks < 0) | ||
1222 | break; | ||
1223 | } | ||
1224 | } | ||
1225 | |||
1226 | |||
871 | /* | 1227 | /* |
872 | * Main program for the daemon. | 1228 | * Main program for the daemon. |
873 | */ | 1229 | */ |
@@ -876,25 +1232,14 @@ main(int ac, char **av) | |||
876 | { | 1232 | { |
877 | extern char *optarg; | 1233 | extern char *optarg; |
878 | extern int optind; | 1234 | extern int optind; |
879 | int opt, j, i, fdsetsz, on = 1; | 1235 | int opt, i, on = 1; |
880 | int sock_in = -1, sock_out = -1, newsock = -1; | 1236 | int sock_in = -1, sock_out = -1, newsock = -1; |
881 | pid_t pid; | ||
882 | socklen_t fromlen; | ||
883 | fd_set *fdset; | ||
884 | struct sockaddr_storage from; | ||
885 | const char *remote_ip; | 1237 | const char *remote_ip; |
886 | int remote_port; | 1238 | int remote_port; |
887 | FILE *f; | ||
888 | struct addrinfo *ai; | ||
889 | char ntop[NI_MAXHOST], strport[NI_MAXSERV]; | ||
890 | char *line; | 1239 | char *line; |
891 | int listen_sock, maxfd; | 1240 | int config_s[2] = { -1 , -1 }; |
892 | int startup_p[2] = { -1 , -1 }, config_s[2] = { -1 , -1 }; | ||
893 | int startups = 0; | ||
894 | Key *key; | 1241 | Key *key; |
895 | Authctxt *authctxt; | 1242 | Authctxt *authctxt; |
896 | int ret, key_used = 0; | ||
897 | Buffer cfg; | ||
898 | 1243 | ||
899 | #ifdef HAVE_SECUREWARE | 1244 | #ifdef HAVE_SECUREWARE |
900 | (void)set_auth_parameters(ac, av); | 1245 | (void)set_auth_parameters(ac, av); |
@@ -905,7 +1250,7 @@ main(int ac, char **av) | |||
905 | /* Save argv. Duplicate so setproctitle emulation doesn't clobber it */ | 1250 | /* Save argv. Duplicate so setproctitle emulation doesn't clobber it */ |
906 | saved_argc = ac; | 1251 | saved_argc = ac; |
907 | rexec_argc = ac; | 1252 | rexec_argc = ac; |
908 | saved_argv = xmalloc(sizeof(*saved_argv) * (ac + 1)); | 1253 | saved_argv = xcalloc(ac + 1, sizeof(*saved_argv)); |
909 | for (i = 0; i < ac; i++) | 1254 | for (i = 0; i < ac; i++) |
910 | saved_argv[i] = xstrdup(av[i]); | 1255 | saved_argv[i] = xstrdup(av[i]); |
911 | saved_argv[i] = NULL; | 1256 | saved_argv[i] = NULL; |
@@ -972,7 +1317,8 @@ main(int ac, char **av) | |||
972 | } | 1317 | } |
973 | break; | 1318 | break; |
974 | case 'b': | 1319 | case 'b': |
975 | options.server_key_bits = atoi(optarg); | 1320 | options.server_key_bits = (int)strtonum(optarg, 256, |
1321 | 32768, NULL); | ||
976 | break; | 1322 | break; |
977 | case 'p': | 1323 | case 'p': |
978 | options.ports_from_cmdline = 1; | 1324 | options.ports_from_cmdline = 1; |
@@ -1009,7 +1355,7 @@ main(int ac, char **av) | |||
1009 | test_flag = 1; | 1355 | test_flag = 1; |
1010 | break; | 1356 | break; |
1011 | case 'u': | 1357 | case 'u': |
1012 | utmp_len = atoi(optarg); | 1358 | utmp_len = (u_int)strtonum(optarg, 0, MAXHOSTNAMELEN+1, NULL); |
1013 | if (utmp_len > MAXHOSTNAMELEN) { | 1359 | if (utmp_len > MAXHOSTNAMELEN) { |
1014 | fprintf(stderr, "Invalid utmp length.\n"); | 1360 | fprintf(stderr, "Invalid utmp length.\n"); |
1015 | exit(1); | 1361 | exit(1); |
@@ -1018,7 +1364,7 @@ main(int ac, char **av) | |||
1018 | case 'o': | 1364 | case 'o': |
1019 | line = xstrdup(optarg); | 1365 | line = xstrdup(optarg); |
1020 | if (process_server_config_line(&options, line, | 1366 | if (process_server_config_line(&options, line, |
1021 | "command-line", 0) != 0) | 1367 | "command-line", 0, NULL, NULL, NULL, NULL) != 0) |
1022 | exit(1); | 1368 | exit(1); |
1023 | xfree(line); | 1369 | xfree(line); |
1024 | break; | 1370 | break; |
@@ -1076,11 +1422,8 @@ main(int ac, char **av) | |||
1076 | else | 1422 | else |
1077 | load_server_config(config_file_name, &cfg); | 1423 | load_server_config(config_file_name, &cfg); |
1078 | 1424 | ||
1079 | parse_server_config(&options, | 1425 | parse_server_config(&options, rexeced_flag ? "rexec" : config_file_name, |
1080 | rexeced_flag ? "rexec" : config_file_name, &cfg); | 1426 | &cfg, NULL, NULL, NULL); |
1081 | |||
1082 | if (!rexec_flag) | ||
1083 | buffer_free(&cfg); | ||
1084 | 1427 | ||
1085 | seed_rng(); | 1428 | seed_rng(); |
1086 | 1429 | ||
@@ -1098,8 +1441,21 @@ main(int ac, char **av) | |||
1098 | 1441 | ||
1099 | debug("sshd version %.100s", SSH_RELEASE); | 1442 | debug("sshd version %.100s", SSH_RELEASE); |
1100 | 1443 | ||
1444 | /* Store privilege separation user for later use if required. */ | ||
1445 | if ((privsep_pw = getpwnam(SSH_PRIVSEP_USER)) == NULL) { | ||
1446 | if (use_privsep || options.kerberos_authentication) | ||
1447 | fatal("Privilege separation user %s does not exist", | ||
1448 | SSH_PRIVSEP_USER); | ||
1449 | } else { | ||
1450 | memset(privsep_pw->pw_passwd, 0, strlen(privsep_pw->pw_passwd)); | ||
1451 | privsep_pw = pwcopy(privsep_pw); | ||
1452 | xfree(privsep_pw->pw_passwd); | ||
1453 | privsep_pw->pw_passwd = xstrdup("*"); | ||
1454 | } | ||
1455 | endpwent(); | ||
1456 | |||
1101 | /* load private host keys */ | 1457 | /* load private host keys */ |
1102 | sensitive_data.host_keys = xmalloc(options.num_host_key_files * | 1458 | sensitive_data.host_keys = xcalloc(options.num_host_key_files, |
1103 | sizeof(Key *)); | 1459 | sizeof(Key *)); |
1104 | for (i = 0; i < options.num_host_key_files; i++) | 1460 | for (i = 0; i < options.num_host_key_files; i++) |
1105 | sensitive_data.host_keys[i] = NULL; | 1461 | sensitive_data.host_keys[i] = NULL; |
@@ -1168,12 +1524,8 @@ main(int ac, char **av) | |||
1168 | } | 1524 | } |
1169 | 1525 | ||
1170 | if (use_privsep) { | 1526 | if (use_privsep) { |
1171 | struct passwd *pw; | ||
1172 | struct stat st; | 1527 | struct stat st; |
1173 | 1528 | ||
1174 | if ((pw = getpwnam(SSH_PRIVSEP_USER)) == NULL) | ||
1175 | fatal("Privilege separation user %s does not exist", | ||
1176 | SSH_PRIVSEP_USER); | ||
1177 | if ((stat(_PATH_PRIVSEP_CHROOT_DIR, &st) == -1) || | 1529 | if ((stat(_PATH_PRIVSEP_CHROOT_DIR, &st) == -1) || |
1178 | (S_ISDIR(st.st_mode) == 0)) | 1530 | (S_ISDIR(st.st_mode) == 0)) |
1179 | fatal("Missing privilege separation directory: %s", | 1531 | fatal("Missing privilege separation directory: %s", |
@@ -1205,7 +1557,7 @@ main(int ac, char **av) | |||
1205 | debug("setgroups() failed: %.200s", strerror(errno)); | 1557 | debug("setgroups() failed: %.200s", strerror(errno)); |
1206 | 1558 | ||
1207 | if (rexec_flag) { | 1559 | if (rexec_flag) { |
1208 | rexec_argv = xmalloc(sizeof(char *) * (rexec_argc + 2)); | 1560 | rexec_argv = xcalloc(rexec_argc + 2, sizeof(char *)); |
1209 | for (i = 0; i < rexec_argc; i++) { | 1561 | for (i = 0; i < rexec_argc; i++) { |
1210 | debug("rexec_argv[%d]='%s'", i, saved_argv[i]); | 1562 | debug("rexec_argv[%d]='%s'", i, saved_argv[i]); |
1211 | rexec_argv[i] = saved_argv[i]; | 1563 | rexec_argv[i] = saved_argv[i]; |
@@ -1253,121 +1605,31 @@ main(int ac, char **av) | |||
1253 | /* ignore SIGPIPE */ | 1605 | /* ignore SIGPIPE */ |
1254 | signal(SIGPIPE, SIG_IGN); | 1606 | signal(SIGPIPE, SIG_IGN); |
1255 | 1607 | ||
1256 | /* Start listening for a socket, unless started from inetd. */ | 1608 | /* Get a connection, either from inetd or a listening TCP socket */ |
1257 | if (inetd_flag) { | 1609 | if (inetd_flag) { |
1258 | int fd; | 1610 | server_accept_inetd(&sock_in, &sock_out); |
1259 | 1611 | ||
1260 | startup_pipe = -1; | ||
1261 | if (rexeced_flag) { | ||
1262 | close(REEXEC_CONFIG_PASS_FD); | ||
1263 | sock_in = sock_out = dup(STDIN_FILENO); | ||
1264 | if (!debug_flag) { | ||
1265 | startup_pipe = dup(REEXEC_STARTUP_PIPE_FD); | ||
1266 | close(REEXEC_STARTUP_PIPE_FD); | ||
1267 | } | ||
1268 | } else { | ||
1269 | sock_in = dup(STDIN_FILENO); | ||
1270 | sock_out = dup(STDOUT_FILENO); | ||
1271 | } | ||
1272 | /* | ||
1273 | * We intentionally do not close the descriptors 0, 1, and 2 | ||
1274 | * as our code for setting the descriptors won't work if | ||
1275 | * ttyfd happens to be one of those. | ||
1276 | */ | ||
1277 | if ((fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { | ||
1278 | dup2(fd, STDIN_FILENO); | ||
1279 | dup2(fd, STDOUT_FILENO); | ||
1280 | if (fd > STDOUT_FILENO) | ||
1281 | close(fd); | ||
1282 | } | ||
1283 | debug("inetd sockets after dupping: %d, %d", sock_in, sock_out); | ||
1284 | if ((options.protocol & SSH_PROTO_1) && | 1612 | if ((options.protocol & SSH_PROTO_1) && |
1285 | sensitive_data.server_key == NULL) | 1613 | sensitive_data.server_key == NULL) |
1286 | generate_ephemeral_server_key(); | 1614 | generate_ephemeral_server_key(); |
1287 | } else { | 1615 | } else { |
1288 | for (ai = options.listen_addrs; ai; ai = ai->ai_next) { | 1616 | server_listen(); |
1289 | if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6) | ||
1290 | continue; | ||
1291 | if (num_listen_socks >= MAX_LISTEN_SOCKS) | ||
1292 | fatal("Too many listen sockets. " | ||
1293 | "Enlarge MAX_LISTEN_SOCKS"); | ||
1294 | if ((ret = getnameinfo(ai->ai_addr, ai->ai_addrlen, | ||
1295 | ntop, sizeof(ntop), strport, sizeof(strport), | ||
1296 | NI_NUMERICHOST|NI_NUMERICSERV)) != 0) { | ||
1297 | error("getnameinfo failed: %.100s", | ||
1298 | (ret != EAI_SYSTEM) ? gai_strerror(ret) : | ||
1299 | strerror(errno)); | ||
1300 | continue; | ||
1301 | } | ||
1302 | /* Create socket for listening. */ | ||
1303 | listen_sock = socket(ai->ai_family, ai->ai_socktype, | ||
1304 | ai->ai_protocol); | ||
1305 | if (listen_sock < 0) { | ||
1306 | /* kernel may not support ipv6 */ | ||
1307 | verbose("socket: %.100s", strerror(errno)); | ||
1308 | continue; | ||
1309 | } | ||
1310 | if (set_nonblock(listen_sock) == -1) { | ||
1311 | close(listen_sock); | ||
1312 | continue; | ||
1313 | } | ||
1314 | /* | ||
1315 | * Set socket options. | ||
1316 | * Allow local port reuse in TIME_WAIT. | ||
1317 | */ | ||
1318 | if (setsockopt(listen_sock, SOL_SOCKET, SO_REUSEADDR, | ||
1319 | &on, sizeof(on)) == -1) | ||
1320 | error("setsockopt SO_REUSEADDR: %s", strerror(errno)); | ||
1321 | |||
1322 | debug("Bind to port %s on %s.", strport, ntop); | ||
1323 | |||
1324 | /* Bind the socket to the desired port. */ | ||
1325 | if (bind(listen_sock, ai->ai_addr, ai->ai_addrlen) < 0) { | ||
1326 | if (!num_listen_socks && !ai->ai_next) | ||
1327 | error("Bind to port %s on %s failed: %.200s.", | ||
1328 | strport, ntop, strerror(errno)); | ||
1329 | close(listen_sock); | ||
1330 | continue; | ||
1331 | } | ||
1332 | listen_socks[num_listen_socks] = listen_sock; | ||
1333 | num_listen_socks++; | ||
1334 | |||
1335 | /* Start listening on the port. */ | ||
1336 | logit("Server listening on %s port %s.", ntop, strport); | ||
1337 | if (listen(listen_sock, SSH_LISTEN_BACKLOG) < 0) | ||
1338 | fatal("listen: %.100s", strerror(errno)); | ||
1339 | |||
1340 | } | ||
1341 | freeaddrinfo(options.listen_addrs); | ||
1342 | |||
1343 | if (!num_listen_socks) | ||
1344 | fatal("Cannot bind any address."); | ||
1345 | 1617 | ||
1346 | if (options.protocol & SSH_PROTO_1) | 1618 | if (options.protocol & SSH_PROTO_1) |
1347 | generate_ephemeral_server_key(); | 1619 | generate_ephemeral_server_key(); |
1348 | 1620 | ||
1349 | /* | ||
1350 | * Arrange to restart on SIGHUP. The handler needs | ||
1351 | * listen_sock. | ||
1352 | */ | ||
1353 | signal(SIGHUP, sighup_handler); | 1621 | signal(SIGHUP, sighup_handler); |
1354 | 1622 | signal(SIGCHLD, main_sigchld_handler); | |
1355 | signal(SIGTERM, sigterm_handler); | 1623 | signal(SIGTERM, sigterm_handler); |
1356 | signal(SIGQUIT, sigterm_handler); | 1624 | signal(SIGQUIT, sigterm_handler); |
1357 | 1625 | ||
1358 | /* Arrange SIGCHLD to be caught. */ | 1626 | /* |
1359 | signal(SIGCHLD, main_sigchld_handler); | 1627 | * Write out the pid file after the sigterm handler |
1360 | 1628 | * is setup and the listen sockets are bound | |
1361 | /* Write out the pid file after the sigterm handler is setup */ | 1629 | */ |
1362 | if (!debug_flag) { | 1630 | if (!debug_flag) { |
1363 | /* | 1631 | FILE *f = fopen(options.pid_file, "w"); |
1364 | * Record our pid in /var/run/sshd.pid to make it | 1632 | |
1365 | * easier to kill the correct sshd. We don't want to | ||
1366 | * do this before the bind above because the bind will | ||
1367 | * fail if there already is a daemon, and this will | ||
1368 | * overwrite any old pid in the file. | ||
1369 | */ | ||
1370 | f = fopen(options.pid_file, "wb"); | ||
1371 | if (f == NULL) { | 1633 | if (f == NULL) { |
1372 | error("Couldn't create pid file \"%s\": %s", | 1634 | error("Couldn't create pid file \"%s\": %s", |
1373 | options.pid_file, strerror(errno)); | 1635 | options.pid_file, strerror(errno)); |
@@ -1377,194 +1639,9 @@ main(int ac, char **av) | |||
1377 | } | 1639 | } |
1378 | } | 1640 | } |
1379 | 1641 | ||
1380 | /* setup fd set for listen */ | 1642 | /* Accept a connection and return in a forked child */ |
1381 | fdset = NULL; | 1643 | server_accept_loop(&sock_in, &sock_out, |
1382 | maxfd = 0; | 1644 | &newsock, config_s); |
1383 | for (i = 0; i < num_listen_socks; i++) | ||
1384 | if (listen_socks[i] > maxfd) | ||
1385 | maxfd = listen_socks[i]; | ||
1386 | /* pipes connected to unauthenticated childs */ | ||
1387 | startup_pipes = xmalloc(options.max_startups * sizeof(int)); | ||
1388 | for (i = 0; i < options.max_startups; i++) | ||
1389 | startup_pipes[i] = -1; | ||
1390 | |||
1391 | /* | ||
1392 | * Stay listening for connections until the system crashes or | ||
1393 | * the daemon is killed with a signal. | ||
1394 | */ | ||
1395 | for (;;) { | ||
1396 | if (received_sighup) | ||
1397 | sighup_restart(); | ||
1398 | if (fdset != NULL) | ||
1399 | xfree(fdset); | ||
1400 | fdsetsz = howmany(maxfd+1, NFDBITS) * sizeof(fd_mask); | ||
1401 | fdset = (fd_set *)xmalloc(fdsetsz); | ||
1402 | memset(fdset, 0, fdsetsz); | ||
1403 | |||
1404 | for (i = 0; i < num_listen_socks; i++) | ||
1405 | FD_SET(listen_socks[i], fdset); | ||
1406 | for (i = 0; i < options.max_startups; i++) | ||
1407 | if (startup_pipes[i] != -1) | ||
1408 | FD_SET(startup_pipes[i], fdset); | ||
1409 | |||
1410 | /* Wait in select until there is a connection. */ | ||
1411 | ret = select(maxfd+1, fdset, NULL, NULL, NULL); | ||
1412 | if (ret < 0 && errno != EINTR) | ||
1413 | error("select: %.100s", strerror(errno)); | ||
1414 | if (received_sigterm) { | ||
1415 | logit("Received signal %d; terminating.", | ||
1416 | (int) received_sigterm); | ||
1417 | close_listen_socks(); | ||
1418 | unlink(options.pid_file); | ||
1419 | exit(255); | ||
1420 | } | ||
1421 | if (key_used && key_do_regen) { | ||
1422 | generate_ephemeral_server_key(); | ||
1423 | key_used = 0; | ||
1424 | key_do_regen = 0; | ||
1425 | } | ||
1426 | if (ret < 0) | ||
1427 | continue; | ||
1428 | |||
1429 | for (i = 0; i < options.max_startups; i++) | ||
1430 | if (startup_pipes[i] != -1 && | ||
1431 | FD_ISSET(startup_pipes[i], fdset)) { | ||
1432 | /* | ||
1433 | * the read end of the pipe is ready | ||
1434 | * if the child has closed the pipe | ||
1435 | * after successful authentication | ||
1436 | * or if the child has died | ||
1437 | */ | ||
1438 | close(startup_pipes[i]); | ||
1439 | startup_pipes[i] = -1; | ||
1440 | startups--; | ||
1441 | } | ||
1442 | for (i = 0; i < num_listen_socks; i++) { | ||
1443 | if (!FD_ISSET(listen_socks[i], fdset)) | ||
1444 | continue; | ||
1445 | fromlen = sizeof(from); | ||
1446 | newsock = accept(listen_socks[i], (struct sockaddr *)&from, | ||
1447 | &fromlen); | ||
1448 | if (newsock < 0) { | ||
1449 | if (errno != EINTR && errno != EWOULDBLOCK) | ||
1450 | error("accept: %.100s", strerror(errno)); | ||
1451 | continue; | ||
1452 | } | ||
1453 | if (unset_nonblock(newsock) == -1) { | ||
1454 | close(newsock); | ||
1455 | continue; | ||
1456 | } | ||
1457 | if (drop_connection(startups) == 1) { | ||
1458 | debug("drop connection #%d", startups); | ||
1459 | close(newsock); | ||
1460 | continue; | ||
1461 | } | ||
1462 | if (pipe(startup_p) == -1) { | ||
1463 | close(newsock); | ||
1464 | continue; | ||
1465 | } | ||
1466 | |||
1467 | if (rexec_flag && socketpair(AF_UNIX, | ||
1468 | SOCK_STREAM, 0, config_s) == -1) { | ||
1469 | error("reexec socketpair: %s", | ||
1470 | strerror(errno)); | ||
1471 | close(newsock); | ||
1472 | close(startup_p[0]); | ||
1473 | close(startup_p[1]); | ||
1474 | continue; | ||
1475 | } | ||
1476 | |||
1477 | for (j = 0; j < options.max_startups; j++) | ||
1478 | if (startup_pipes[j] == -1) { | ||
1479 | startup_pipes[j] = startup_p[0]; | ||
1480 | if (maxfd < startup_p[0]) | ||
1481 | maxfd = startup_p[0]; | ||
1482 | startups++; | ||
1483 | break; | ||
1484 | } | ||
1485 | |||
1486 | /* | ||
1487 | * Got connection. Fork a child to handle it, unless | ||
1488 | * we are in debugging mode. | ||
1489 | */ | ||
1490 | if (debug_flag) { | ||
1491 | /* | ||
1492 | * In debugging mode. Close the listening | ||
1493 | * socket, and start processing the | ||
1494 | * connection without forking. | ||
1495 | */ | ||
1496 | debug("Server will not fork when running in debugging mode."); | ||
1497 | close_listen_socks(); | ||
1498 | sock_in = newsock; | ||
1499 | sock_out = newsock; | ||
1500 | close(startup_p[0]); | ||
1501 | close(startup_p[1]); | ||
1502 | startup_pipe = -1; | ||
1503 | pid = getpid(); | ||
1504 | if (rexec_flag) { | ||
1505 | send_rexec_state(config_s[0], | ||
1506 | &cfg); | ||
1507 | close(config_s[0]); | ||
1508 | } | ||
1509 | break; | ||
1510 | } else { | ||
1511 | /* | ||
1512 | * Normal production daemon. Fork, and have | ||
1513 | * the child process the connection. The | ||
1514 | * parent continues listening. | ||
1515 | */ | ||
1516 | if ((pid = fork()) == 0) { | ||
1517 | /* | ||
1518 | * Child. Close the listening and max_startup | ||
1519 | * sockets. Start using the accepted socket. | ||
1520 | * Reinitialize logging (since our pid has | ||
1521 | * changed). We break out of the loop to handle | ||
1522 | * the connection. | ||
1523 | */ | ||
1524 | startup_pipe = startup_p[1]; | ||
1525 | close_startup_pipes(); | ||
1526 | close_listen_socks(); | ||
1527 | sock_in = newsock; | ||
1528 | sock_out = newsock; | ||
1529 | log_init(__progname, options.log_level, options.log_facility, log_stderr); | ||
1530 | if (rexec_flag) | ||
1531 | close(config_s[0]); | ||
1532 | break; | ||
1533 | } | ||
1534 | } | ||
1535 | |||
1536 | /* Parent. Stay in the loop. */ | ||
1537 | if (pid < 0) | ||
1538 | error("fork: %.100s", strerror(errno)); | ||
1539 | else | ||
1540 | debug("Forked child %ld.", (long)pid); | ||
1541 | |||
1542 | close(startup_p[1]); | ||
1543 | |||
1544 | if (rexec_flag) { | ||
1545 | send_rexec_state(config_s[0], &cfg); | ||
1546 | close(config_s[0]); | ||
1547 | close(config_s[1]); | ||
1548 | } | ||
1549 | |||
1550 | /* Mark that the key has been used (it was "given" to the child). */ | ||
1551 | if ((options.protocol & SSH_PROTO_1) && | ||
1552 | key_used == 0) { | ||
1553 | /* Schedule server key regeneration alarm. */ | ||
1554 | signal(SIGALRM, key_regeneration_alarm); | ||
1555 | alarm(options.key_regeneration_time); | ||
1556 | key_used = 1; | ||
1557 | } | ||
1558 | |||
1559 | arc4random_stir(); | ||
1560 | |||
1561 | /* Close the new socket (the child is now taking care of it). */ | ||
1562 | close(newsock); | ||
1563 | } | ||
1564 | /* child process check (or debug mode) */ | ||
1565 | if (num_listen_socks < 0) | ||
1566 | break; | ||
1567 | } | ||
1568 | } | 1645 | } |
1569 | 1646 | ||
1570 | /* This is the child processing a new connection. */ | 1647 | /* This is the child processing a new connection. */ |
@@ -1659,7 +1736,13 @@ main(int ac, char **av) | |||
1659 | * We use get_canonical_hostname with usedns = 0 instead of | 1736 | * We use get_canonical_hostname with usedns = 0 instead of |
1660 | * get_remote_ipaddr here so IP options will be checked. | 1737 | * get_remote_ipaddr here so IP options will be checked. |
1661 | */ | 1738 | */ |
1662 | remote_ip = get_canonical_hostname(0); | 1739 | (void) get_canonical_hostname(0); |
1740 | /* | ||
1741 | * The rest of the code depends on the fact that | ||
1742 | * get_remote_ipaddr() caches the remote ip, even if | ||
1743 | * the socket goes away. | ||
1744 | */ | ||
1745 | remote_ip = get_remote_ipaddr(); | ||
1663 | 1746 | ||
1664 | #ifdef SSH_AUDIT_EVENTS | 1747 | #ifdef SSH_AUDIT_EVENTS |
1665 | audit_connection_from(remote_ip, remote_port); | 1748 | audit_connection_from(remote_ip, remote_port); |
@@ -1755,8 +1838,7 @@ main(int ac, char **av) | |||
1755 | packet_set_nonblocking(); | 1838 | packet_set_nonblocking(); |
1756 | 1839 | ||
1757 | /* allocate authentication context */ | 1840 | /* allocate authentication context */ |
1758 | authctxt = xmalloc(sizeof(*authctxt)); | 1841 | authctxt = xcalloc(1, sizeof(*authctxt)); |
1759 | memset(authctxt, 0, sizeof(*authctxt)); | ||
1760 | 1842 | ||
1761 | authctxt->loginmsg = &loginmsg; | 1843 | authctxt->loginmsg = &loginmsg; |
1762 | 1844 | ||
@@ -1848,11 +1930,14 @@ ssh1_session_key(BIGNUM *session_key_int) | |||
1848 | { | 1930 | { |
1849 | int rsafail = 0; | 1931 | int rsafail = 0; |
1850 | 1932 | ||
1851 | if (BN_cmp(sensitive_data.server_key->rsa->n, sensitive_data.ssh1_host_key->rsa->n) > 0) { | 1933 | if (BN_cmp(sensitive_data.server_key->rsa->n, |
1934 | sensitive_data.ssh1_host_key->rsa->n) > 0) { | ||
1852 | /* Server key has bigger modulus. */ | 1935 | /* Server key has bigger modulus. */ |
1853 | if (BN_num_bits(sensitive_data.server_key->rsa->n) < | 1936 | if (BN_num_bits(sensitive_data.server_key->rsa->n) < |
1854 | BN_num_bits(sensitive_data.ssh1_host_key->rsa->n) + SSH_KEY_BITS_RESERVED) { | 1937 | BN_num_bits(sensitive_data.ssh1_host_key->rsa->n) + |
1855 | fatal("do_connection: %s: server_key %d < host_key %d + SSH_KEY_BITS_RESERVED %d", | 1938 | SSH_KEY_BITS_RESERVED) { |
1939 | fatal("do_connection: %s: " | ||
1940 | "server_key %d < host_key %d + SSH_KEY_BITS_RESERVED %d", | ||
1856 | get_remote_ipaddr(), | 1941 | get_remote_ipaddr(), |
1857 | BN_num_bits(sensitive_data.server_key->rsa->n), | 1942 | BN_num_bits(sensitive_data.server_key->rsa->n), |
1858 | BN_num_bits(sensitive_data.ssh1_host_key->rsa->n), | 1943 | BN_num_bits(sensitive_data.ssh1_host_key->rsa->n), |
@@ -1867,8 +1952,10 @@ ssh1_session_key(BIGNUM *session_key_int) | |||
1867 | } else { | 1952 | } else { |
1868 | /* Host key has bigger modulus (or they are equal). */ | 1953 | /* Host key has bigger modulus (or they are equal). */ |
1869 | if (BN_num_bits(sensitive_data.ssh1_host_key->rsa->n) < | 1954 | if (BN_num_bits(sensitive_data.ssh1_host_key->rsa->n) < |
1870 | BN_num_bits(sensitive_data.server_key->rsa->n) + SSH_KEY_BITS_RESERVED) { | 1955 | BN_num_bits(sensitive_data.server_key->rsa->n) + |
1871 | fatal("do_connection: %s: host_key %d < server_key %d + SSH_KEY_BITS_RESERVED %d", | 1956 | SSH_KEY_BITS_RESERVED) { |
1957 | fatal("do_connection: %s: " | ||
1958 | "host_key %d < server_key %d + SSH_KEY_BITS_RESERVED %d", | ||
1872 | get_remote_ipaddr(), | 1959 | get_remote_ipaddr(), |
1873 | BN_num_bits(sensitive_data.ssh1_host_key->rsa->n), | 1960 | BN_num_bits(sensitive_data.ssh1_host_key->rsa->n), |
1874 | BN_num_bits(sensitive_data.server_key->rsa->n), | 1961 | BN_num_bits(sensitive_data.server_key->rsa->n), |
@@ -1993,10 +2080,10 @@ do_ssh1_kex(void) | |||
1993 | * key is in the highest bits. | 2080 | * key is in the highest bits. |
1994 | */ | 2081 | */ |
1995 | if (!rsafail) { | 2082 | if (!rsafail) { |
1996 | BN_mask_bits(session_key_int, sizeof(session_key) * 8); | 2083 | (void) BN_mask_bits(session_key_int, sizeof(session_key) * 8); |
1997 | len = BN_num_bytes(session_key_int); | 2084 | len = BN_num_bytes(session_key_int); |
1998 | if (len < 0 || (u_int)len > sizeof(session_key)) { | 2085 | if (len < 0 || (u_int)len > sizeof(session_key)) { |
1999 | error("do_connection: bad session key len from %s: " | 2086 | error("do_ssh1_kex: bad session key len from %s: " |
2000 | "session_key_int %d > sizeof(session_key) %lu", | 2087 | "session_key_int %d > sizeof(session_key) %lu", |
2001 | get_remote_ipaddr(), len, (u_long)sizeof(session_key)); | 2088 | get_remote_ipaddr(), len, (u_long)sizeof(session_key)); |
2002 | rsafail++; | 2089 | rsafail++; |
@@ -2089,11 +2176,9 @@ do_ssh2_kex(void) | |||
2089 | myproposal[PROPOSAL_COMP_ALGS_CTOS] = | 2176 | myproposal[PROPOSAL_COMP_ALGS_CTOS] = |
2090 | myproposal[PROPOSAL_COMP_ALGS_STOC] = "none,zlib@openssh.com"; | 2177 | myproposal[PROPOSAL_COMP_ALGS_STOC] = "none,zlib@openssh.com"; |
2091 | } | 2178 | } |
2092 | 2179 | ||
2093 | myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = list_hostkey_types(); | 2180 | myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = list_hostkey_types(); |
2094 | 2181 | ||
2095 | /* start key exchange */ | ||
2096 | |||
2097 | #ifdef GSSAPI | 2182 | #ifdef GSSAPI |
2098 | { | 2183 | { |
2099 | char *orig; | 2184 | char *orig; |
@@ -2102,8 +2187,8 @@ do_ssh2_kex(void) | |||
2102 | orig = myproposal[PROPOSAL_KEX_ALGS]; | 2187 | orig = myproposal[PROPOSAL_KEX_ALGS]; |
2103 | 2188 | ||
2104 | /* | 2189 | /* |
2105 | * If we don't have a host key, then there's no point advertising | 2190 | * If we don't have a host key, then there's no point advertising |
2106 | * the other key exchange algorithms | 2191 | * the other key exchange algorithms |
2107 | */ | 2192 | */ |
2108 | 2193 | ||
2109 | if (strlen(myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS]) == 0) | 2194 | if (strlen(myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS]) == 0) |
@@ -2114,15 +2199,13 @@ do_ssh2_kex(void) | |||
2114 | else | 2199 | else |
2115 | gss = NULL; | 2200 | gss = NULL; |
2116 | 2201 | ||
2117 | if (gss && orig) { | 2202 | if (gss && orig) |
2118 | int len = strlen(orig) + strlen(gss) + 2; | 2203 | xasprintf(&newstr, "%s,%s", gss, orig); |
2119 | newstr = xmalloc(len); | 2204 | else if (gss) |
2120 | snprintf(newstr, len, "%s,%s", gss, orig); | ||
2121 | } else if (gss) { | ||
2122 | newstr = gss; | 2205 | newstr = gss; |
2123 | } else if (orig) { | 2206 | else if (orig) |
2124 | newstr = orig; | 2207 | newstr = orig; |
2125 | } | 2208 | |
2126 | /* | 2209 | /* |
2127 | * If we've got GSSAPI mechanisms, then we've got the 'null' host | 2210 | * If we've got GSSAPI mechanisms, then we've got the 'null' host |
2128 | * key alg, but we can't tell people about it unless its the only | 2211 | * key alg, but we can't tell people about it unless its the only |
@@ -2138,18 +2221,20 @@ do_ssh2_kex(void) | |||
2138 | } | 2221 | } |
2139 | #endif | 2222 | #endif |
2140 | 2223 | ||
2141 | /* start key exchange */ | 2224 | /* start key exchange */ |
2142 | kex = kex_setup(myproposal); | 2225 | kex = kex_setup(myproposal); |
2143 | kex->kex[KEX_DH_GRP1_SHA1] = kexdh_server; | 2226 | kex->kex[KEX_DH_GRP1_SHA1] = kexdh_server; |
2144 | kex->kex[KEX_DH_GRP14_SHA1] = kexdh_server; | 2227 | kex->kex[KEX_DH_GRP14_SHA1] = kexdh_server; |
2145 | kex->kex[KEX_DH_GEX_SHA1] = kexgex_server; | 2228 | kex->kex[KEX_DH_GEX_SHA1] = kexgex_server; |
2229 | kex->kex[KEX_DH_GEX_SHA256] = kexgex_server; | ||
2146 | #ifdef GSSAPI | 2230 | #ifdef GSSAPI |
2147 | kex->kex[KEX_GSS_GRP1_SHA1] = kexgss_server; | 2231 | kex->kex[KEX_GSS_GRP1_SHA1] = kexgss_server; |
2232 | kex->kex[KEX_GSS_GRP14_SHA1] = kexgss_server; | ||
2148 | kex->kex[KEX_GSS_GEX_SHA1] = kexgss_server; | 2233 | kex->kex[KEX_GSS_GEX_SHA1] = kexgss_server; |
2149 | #endif | 2234 | #endif |
2150 | kex->server = 1; | 2235 | kex->server = 1; |
2151 | kex->client_version_string=client_version_string; | 2236 | kex->client_version_string=client_version_string; |
2152 | kex->server_version_string=server_version_string; | 2237 | kex->server_version_string=server_version_string; |
2153 | kex->load_host_key=&get_hostkey_by_type; | 2238 | kex->load_host_key=&get_hostkey_by_type; |
2154 | kex->host_key_index=&get_hostkey_index; | 2239 | kex->host_key_index=&get_hostkey_index; |
2155 | 2240 | ||
diff --git a/sshd_config b/sshd_config index 4957dd1a6..68c8752c0 100644 --- a/sshd_config +++ b/sshd_config | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: sshd_config,v 1.73 2005/12/06 22:38:28 reyk Exp $ | 1 | # $OpenBSD: sshd_config,v 1.74 2006/07/19 13:07:10 dtucker Exp $ |
2 | 2 | ||
3 | # This is the sshd server system-wide configuration file. See | 3 | # This is the sshd server system-wide configuration file. See |
4 | # sshd_config(5) for more information. | 4 | # sshd_config(5) for more information. |
@@ -68,15 +68,18 @@ | |||
68 | # GSSAPI options | 68 | # GSSAPI options |
69 | #GSSAPIAuthentication no | 69 | #GSSAPIAuthentication no |
70 | #GSSAPICleanupCredentials yes | 70 | #GSSAPICleanupCredentials yes |
71 | #GSSAPIStrictAcceptorCheck yes | ||
72 | #GSSAPIKeyExchange no | ||
71 | 73 | ||
72 | # Set this to 'yes' to enable PAM authentication, account processing, | 74 | # Set this to 'yes' to enable PAM authentication, account processing, |
73 | # and session processing. If this is enabled, PAM authentication will | 75 | # and session processing. If this is enabled, PAM authentication will |
74 | # be allowed through the ChallengeResponseAuthentication mechanism. | 76 | # be allowed through the ChallengeResponseAuthentication and |
75 | # Depending on your PAM configuration, this may bypass the setting of | 77 | # PasswordAuthentication. Depending on your PAM configuration, |
76 | # PasswordAuthentication, PermitEmptyPasswords, and | 78 | # PAM authentication via ChallengeResponseAuthentication may bypass |
77 | # "PermitRootLogin without-password". If you just want the PAM account and | 79 | # the setting of "PermitRootLogin without-password". |
78 | # session checks to run without PAM authentication, then enable this but set | 80 | # If you just want the PAM account and session checks to run without |
79 | # ChallengeResponseAuthentication=no | 81 | # PAM authentication, then enable this but set PasswordAuthentication |
82 | # and ChallengeResponseAuthentication to 'no'. | ||
80 | #UsePAM no | 83 | #UsePAM no |
81 | 84 | ||
82 | #AllowTcpForwarding yes | 85 | #AllowTcpForwarding yes |
@@ -103,3 +106,9 @@ | |||
103 | 106 | ||
104 | # override default of no subsystems | 107 | # override default of no subsystems |
105 | Subsystem sftp /usr/libexec/sftp-server | 108 | Subsystem sftp /usr/libexec/sftp-server |
109 | |||
110 | # Example of overriding settings on a per-user basis | ||
111 | #Match User anoncvs | ||
112 | # X11Forwarding no | ||
113 | # AllowTcpForwarding no | ||
114 | # ForceCommand cvs server | ||
diff --git a/sshd_config.0 b/sshd_config.0 index d2c5454e1..c9a09a4ff 100644 --- a/sshd_config.0 +++ b/sshd_config.0 | |||
@@ -7,10 +7,11 @@ SYNOPSIS | |||
7 | /etc/ssh/sshd_config | 7 | /etc/ssh/sshd_config |
8 | 8 | ||
9 | DESCRIPTION | 9 | DESCRIPTION |
10 | sshd reads configuration data from /etc/ssh/sshd_config (or the file | 10 | sshd(8) reads configuration data from /etc/ssh/sshd_config (or the file |
11 | specified with -f on the command line). The file contains keyword-argu- | 11 | specified with -f on the command line). The file contains keyword-argu- |
12 | ment pairs, one per line. Lines starting with `#' and empty lines are | 12 | ment pairs, one per line. Lines starting with `#' and empty lines are |
13 | interpreted as comments. | 13 | interpreted as comments. Arguments may optionally be enclosed in double |
14 | quotes (") in order to represent arguments containing spaces. | ||
14 | 15 | ||
15 | The possible keywords and their meanings are as follows (note that key- | 16 | The possible keywords and their meanings are as follows (note that key- |
16 | words are case-insensitive and arguments are case-sensitive): | 17 | words are case-insensitive and arguments are case-sensitive): |
@@ -29,17 +30,21 @@ DESCRIPTION | |||
29 | any environment variables. | 30 | any environment variables. |
30 | 31 | ||
31 | AddressFamily | 32 | AddressFamily |
32 | Specifies which address family should be used by sshd. Valid ar- | 33 | Specifies which address family should be used by sshd(8). Valid |
33 | guments are ``any'', ``inet'' (use IPv4 only) or ``inet6'' (use | 34 | arguments are ``any'', ``inet'' (use IPv4 only), or ``inet6'' |
34 | IPv6 only). The default is ``any''. | 35 | (use IPv6 only). The default is ``any''. |
35 | 36 | ||
36 | AllowGroups | 37 | AllowGroups |
37 | This keyword can be followed by a list of group name patterns, | 38 | This keyword can be followed by a list of group name patterns, |
38 | separated by spaces. If specified, login is allowed only for | 39 | separated by spaces. If specified, login is allowed only for |
39 | users whose primary group or supplementary group list matches one | 40 | users whose primary group or supplementary group list matches one |
40 | of the patterns. `*' and `?' can be used as wildcards in the | 41 | of the patterns. Only group names are valid; a numerical group |
41 | patterns. Only group names are valid; a numerical group ID is | 42 | ID is not recognized. By default, login is allowed for all |
42 | not recognized. By default, login is allowed for all groups. | 43 | groups. The allow/deny directives are processed in the following |
44 | order: DenyUsers, AllowUsers, DenyGroups, and finally | ||
45 | AllowGroups. | ||
46 | |||
47 | See PATTERNS in ssh_config(5) for more information on patterns. | ||
43 | 48 | ||
44 | AllowTcpForwarding | 49 | AllowTcpForwarding |
45 | Specifies whether TCP forwarding is permitted. The default is | 50 | Specifies whether TCP forwarding is permitted. The default is |
@@ -50,23 +55,26 @@ DESCRIPTION | |||
50 | AllowUsers | 55 | AllowUsers |
51 | This keyword can be followed by a list of user name patterns, | 56 | This keyword can be followed by a list of user name patterns, |
52 | separated by spaces. If specified, login is allowed only for us- | 57 | separated by spaces. If specified, login is allowed only for us- |
53 | er names that match one of the patterns. `*' and `?' can be used | 58 | er names that match one of the patterns. Only user names are |
54 | as wildcards in the patterns. Only user names are valid; a nu- | 59 | valid; a numerical user ID is not recognized. By default, login |
55 | merical user ID is not recognized. By default, login is allowed | 60 | is allowed for all users. If the pattern takes the form US- |
56 | for all users. If the pattern takes the form USER@HOST then USER | 61 | ER@HOST then USER and HOST are separately checked, restricting |
57 | and HOST are separately checked, restricting logins to particular | 62 | logins to particular users from particular hosts. The allow/deny |
58 | users from particular hosts. | 63 | directives are processed in the following order: DenyUsers, |
64 | AllowUsers, DenyGroups, and finally AllowGroups. | ||
65 | |||
66 | See PATTERNS in ssh_config(5) for more information on patterns. | ||
59 | 67 | ||
60 | AuthorizedKeysFile | 68 | AuthorizedKeysFile |
61 | Specifies the file that contains the public keys that can be used | 69 | Specifies the file that contains the public keys that can be used |
62 | for user authentication. AuthorizedKeysFile may contain tokens | 70 | for user authentication. AuthorizedKeysFile may contain tokens |
63 | of the form %T which are substituted during connection set-up. | 71 | of the form %T which are substituted during connection setup. |
64 | The following tokens are defined: %% is replaced by a literal | 72 | The following tokens are defined: %% is replaced by a literal |
65 | '%', %h is replaced by the home directory of the user being au- | 73 | '%', %h is replaced by the home directory of the user being au- |
66 | thenticated and %u is replaced by the username of that user. Af- | 74 | thenticated, and %u is replaced by the username of that user. |
67 | ter expansion, AuthorizedKeysFile is taken to be an absolute path | 75 | After expansion, AuthorizedKeysFile is taken to be an absolute |
68 | or one relative to the user's home directory. The default is | 76 | path or one relative to the user's home directory. The default |
69 | ``.ssh/authorized_keys''. | 77 | is ``.ssh/authorized_keys''. |
70 | 78 | ||
71 | Banner In some jurisdictions, sending a warning message before authenti- | 79 | Banner In some jurisdictions, sending a warning message before authenti- |
72 | cation may be relevant for getting legal protection. The con- | 80 | cation may be relevant for getting legal protection. The con- |
@@ -75,7 +83,7 @@ DESCRIPTION | |||
75 | protocol version 2. By default, no banner is displayed. | 83 | protocol version 2. By default, no banner is displayed. |
76 | 84 | ||
77 | ChallengeResponseAuthentication | 85 | ChallengeResponseAuthentication |
78 | Specifies whether challenge response authentication is allowed. | 86 | Specifies whether challenge-response authentication is allowed. |
79 | All authentication styles from login.conf(5) are supported. The | 87 | All authentication styles from login.conf(5) are supported. The |
80 | default is ``yes''. | 88 | default is ``yes''. |
81 | 89 | ||
@@ -85,15 +93,15 @@ DESCRIPTION | |||
85 | ``3des-cbc'', ``aes128-cbc'', ``aes192-cbc'', ``aes256-cbc'', | 93 | ``3des-cbc'', ``aes128-cbc'', ``aes192-cbc'', ``aes256-cbc'', |
86 | ``aes128-ctr'', ``aes192-ctr'', ``aes256-ctr'', ``arcfour128'', | 94 | ``aes128-ctr'', ``aes192-ctr'', ``aes256-ctr'', ``arcfour128'', |
87 | ``arcfour256'', ``arcfour'', ``blowfish-cbc'', and | 95 | ``arcfour256'', ``arcfour'', ``blowfish-cbc'', and |
88 | ``cast128-cbc''. The default is | 96 | ``cast128-cbc''. The default is: |
89 | 97 | ||
90 | ``aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128, | 98 | aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128, |
91 | arcfour256,arcfour,aes192-cbc,aes256-cbc,aes128-ctr, | 99 | arcfour256,arcfour,aes192-cbc,aes256-cbc,aes128-ctr, |
92 | aes192-ctr,aes256-ctr'' | 100 | aes192-ctr,aes256-ctr |
93 | 101 | ||
94 | ClientAliveCountMax | 102 | ClientAliveCountMax |
95 | Sets the number of client alive messages (see below) which may be | 103 | Sets the number of client alive messages (see below) which may be |
96 | sent without sshd receiving any messages back from the client. | 104 | sent without sshd(8) receiving any messages back from the client. |
97 | If this threshold is reached while client alive messages are be- | 105 | If this threshold is reached while client alive messages are be- |
98 | ing sent, sshd will disconnect the client, terminating the ses- | 106 | ing sent, sshd will disconnect the client, terminating the ses- |
99 | sion. It is important to note that the use of client alive mes- | 107 | sion. It is important to note that the use of client alive mes- |
@@ -106,15 +114,16 @@ DESCRIPTION | |||
106 | 114 | ||
107 | The default value is 3. If ClientAliveInterval (see below) is | 115 | The default value is 3. If ClientAliveInterval (see below) is |
108 | set to 15, and ClientAliveCountMax is left at the default, unre- | 116 | set to 15, and ClientAliveCountMax is left at the default, unre- |
109 | sponsive ssh clients will be disconnected after approximately 45 | 117 | sponsive SSH clients will be disconnected after approximately 45 |
110 | seconds. | 118 | seconds. This option applies to protocol version 2 only. |
111 | 119 | ||
112 | ClientAliveInterval | 120 | ClientAliveInterval |
113 | Sets a timeout interval in seconds after which if no data has | 121 | Sets a timeout interval in seconds after which if no data has |
114 | been received from the client, sshd will send a message through | 122 | been received from the client, sshd(8) will send a message |
115 | the encrypted channel to request a response from the client. The | 123 | through the encrypted channel to request a response from the |
116 | default is 0, indicating that these messages will not be sent to | 124 | client. The default is 0, indicating that these messages will |
117 | the client. This option applies to protocol version 2 only. | 125 | not be sent to the client. This option applies to protocol ver- |
126 | sion 2 only. | ||
118 | 127 | ||
119 | Compression | 128 | Compression |
120 | Specifies whether compression is allowed, or delayed until the | 129 | Specifies whether compression is allowed, or delayed until the |
@@ -125,23 +134,38 @@ DESCRIPTION | |||
125 | This keyword can be followed by a list of group name patterns, | 134 | This keyword can be followed by a list of group name patterns, |
126 | separated by spaces. Login is disallowed for users whose primary | 135 | separated by spaces. Login is disallowed for users whose primary |
127 | group or supplementary group list matches one of the patterns. | 136 | group or supplementary group list matches one of the patterns. |
128 | `*' and `?' can be used as wildcards in the patterns. Only group | 137 | Only group names are valid; a numerical group ID is not recog- |
129 | names are valid; a numerical group ID is not recognized. By de- | 138 | nized. By default, login is allowed for all groups. The al- |
130 | fault, login is allowed for all groups. | 139 | low/deny directives are processed in the following order: |
140 | DenyUsers, AllowUsers, DenyGroups, and finally AllowGroups. | ||
141 | |||
142 | See PATTERNS in ssh_config(5) for more information on patterns. | ||
131 | 143 | ||
132 | DenyUsers | 144 | DenyUsers |
133 | This keyword can be followed by a list of user name patterns, | 145 | This keyword can be followed by a list of user name patterns, |
134 | separated by spaces. Login is disallowed for user names that | 146 | separated by spaces. Login is disallowed for user names that |
135 | match one of the patterns. `*' and `?' can be used as wildcards | 147 | match one of the patterns. Only user names are valid; a numeri- |
136 | in the patterns. Only user names are valid; a numerical user ID | 148 | cal user ID is not recognized. By default, login is allowed for |
137 | is not recognized. By default, login is allowed for all users. | 149 | all users. If the pattern takes the form USER@HOST then USER and |
138 | If the pattern takes the form USER@HOST then USER and HOST are | 150 | HOST are separately checked, restricting logins to particular |
139 | separately checked, restricting logins to particular users from | 151 | users from particular hosts. The allow/deny directives are pro- |
140 | particular hosts. | 152 | cessed in the following order: DenyUsers, AllowUsers, DenyGroups, |
153 | and finally AllowGroups. | ||
154 | |||
155 | See PATTERNS in ssh_config(5) for more information on patterns. | ||
156 | |||
157 | ForceCommand | ||
158 | Forces the execution of the command specified by ForceCommand, | ||
159 | ignoring any command supplied by the client. The command is in- | ||
160 | voked by using the user's login shell with the -c option. This | ||
161 | applies to shell, command, or subsystem execution. It is most | ||
162 | useful inside a Match block. The command originally supplied by | ||
163 | the client is available in the SSH_ORIGINAL_COMMAND environment | ||
164 | variable. | ||
141 | 165 | ||
142 | GatewayPorts | 166 | GatewayPorts |
143 | Specifies whether remote hosts are allowed to connect to ports | 167 | Specifies whether remote hosts are allowed to connect to ports |
144 | forwarded for the client. By default, sshd binds remote port | 168 | forwarded for the client. By default, sshd(8) binds remote port |
145 | forwardings to the loopback address. This prevents other remote | 169 | forwardings to the loopback address. This prevents other remote |
146 | hosts from connecting to forwarded ports. GatewayPorts can be | 170 | hosts from connecting to forwarded ports. GatewayPorts can be |
147 | used to specify that sshd should allow remote port forwardings to | 171 | used to specify that sshd should allow remote port forwardings to |
@@ -165,18 +189,27 @@ DESCRIPTION | |||
165 | HostbasedAuthentication | 189 | HostbasedAuthentication |
166 | Specifies whether rhosts or /etc/hosts.equiv authentication to- | 190 | Specifies whether rhosts or /etc/hosts.equiv authentication to- |
167 | gether with successful public key client host authentication is | 191 | gether with successful public key client host authentication is |
168 | allowed (hostbased authentication). This option is similar to | 192 | allowed (host-based authentication). This option is similar to |
169 | RhostsRSAAuthentication and applies to protocol version 2 only. | 193 | RhostsRSAAuthentication and applies to protocol version 2 only. |
170 | The default is ``no''. | 194 | The default is ``no''. |
171 | 195 | ||
196 | HostbasedUsesNameFromPacketOnly | ||
197 | Specifies whether or not the server will attempt to perform a re- | ||
198 | verse name lookup when matching the name in the ~/.shosts, | ||
199 | ~/.rhosts, and /etc/hosts.equiv files during | ||
200 | HostbasedAuthentication. A setting of ``yes'' means that sshd(8) | ||
201 | uses the name supplied by the client rather than attempting to | ||
202 | resolve the name from the TCP connection itself. The default is | ||
203 | ``no''. | ||
204 | |||
172 | HostKey | 205 | HostKey |
173 | Specifies a file containing a private host key used by SSH. The | 206 | Specifies a file containing a private host key used by SSH. The |
174 | default is /etc/ssh/ssh_host_key for protocol version 1, and | 207 | default is /etc/ssh/ssh_host_key for protocol version 1, and |
175 | /etc/ssh/ssh_host_rsa_key and /etc/ssh/ssh_host_dsa_key for pro- | 208 | /etc/ssh/ssh_host_rsa_key and /etc/ssh/ssh_host_dsa_key for pro- |
176 | tocol version 2. Note that sshd will refuse to use a file if it | 209 | tocol version 2. Note that sshd(8) will refuse to use a file if |
177 | is group/world-accessible. It is possible to have multiple host | 210 | it is group/world-accessible. It is possible to have multiple |
178 | key files. ``rsa1'' keys are used for version 1 and ``dsa'' or | 211 | host key files. ``rsa1'' keys are used for version 1 and ``dsa'' |
179 | ``rsa'' are used for version 2 of the SSH protocol. | 212 | or ``rsa'' are used for version 2 of the SSH protocol. |
180 | 213 | ||
181 | IgnoreRhosts | 214 | IgnoreRhosts |
182 | Specifies that .rhosts and .shosts files will not be used in | 215 | Specifies that .rhosts and .shosts files will not be used in |
@@ -186,7 +219,7 @@ DESCRIPTION | |||
186 | fault is ``yes''. | 219 | fault is ``yes''. |
187 | 220 | ||
188 | IgnoreUserKnownHosts | 221 | IgnoreUserKnownHosts |
189 | Specifies whether sshd should ignore the user's | 222 | Specifies whether sshd(8) should ignore the user's |
190 | ~/.ssh/known_hosts during RhostsRSAAuthentication or | 223 | ~/.ssh/known_hosts during RhostsRSAAuthentication or |
191 | HostbasedAuthentication. The default is ``no''. | 224 | HostbasedAuthentication. The default is ``no''. |
192 | 225 | ||
@@ -194,22 +227,22 @@ DESCRIPTION | |||
194 | Specifies whether the password provided by the user for | 227 | Specifies whether the password provided by the user for |
195 | PasswordAuthentication will be validated through the Kerberos | 228 | PasswordAuthentication will be validated through the Kerberos |
196 | KDC. To use this option, the server needs a Kerberos servtab | 229 | KDC. To use this option, the server needs a Kerberos servtab |
197 | which allows the verification of the KDC's identity. Default is | 230 | which allows the verification of the KDC's identity. The default |
198 | ``no''. | 231 | is ``no''. |
199 | 232 | ||
200 | KerberosGetAFSToken | 233 | KerberosGetAFSToken |
201 | If AFS is active and the user has a Kerberos 5 TGT, attempt to | 234 | If AFS is active and the user has a Kerberos 5 TGT, attempt to |
202 | acquire an AFS token before accessing the user's home directory. | 235 | acquire an AFS token before accessing the user's home directory. |
203 | Default is ``no''. | 236 | The default is ``no''. |
204 | 237 | ||
205 | KerberosOrLocalPasswd | 238 | KerberosOrLocalPasswd |
206 | If set then if password authentication through Kerberos fails | 239 | If password authentication through Kerberos fails then the pass- |
207 | then the password will be validated via any additional local | 240 | word will be validated via any additional local mechanism such as |
208 | mechanism such as /etc/passwd. Default is ``yes''. | 241 | /etc/passwd. The default is ``yes''. |
209 | 242 | ||
210 | KerberosTicketCleanup | 243 | KerberosTicketCleanup |
211 | Specifies whether to automatically destroy the user's ticket | 244 | Specifies whether to automatically destroy the user's ticket |
212 | cache file on logout. Default is ``yes''. | 245 | cache file on logout. The default is ``yes''. |
213 | 246 | ||
214 | KeyRegenerationInterval | 247 | KeyRegenerationInterval |
215 | In protocol version 1, the ephemeral server key is automatically | 248 | In protocol version 1, the ephemeral server key is automatically |
@@ -220,8 +253,8 @@ DESCRIPTION | |||
220 | never regenerated. The default is 3600 (seconds). | 253 | never regenerated. The default is 3600 (seconds). |
221 | 254 | ||
222 | ListenAddress | 255 | ListenAddress |
223 | Specifies the local addresses sshd should listen on. The follow- | 256 | Specifies the local addresses sshd(8) should listen on. The fol- |
224 | ing forms may be used: | 257 | lowing forms may be used: |
225 | 258 | ||
226 | ListenAddress host|IPv4_addr|IPv6_addr | 259 | ListenAddress host|IPv4_addr|IPv6_addr |
227 | ListenAddress host|IPv4_addr:port | 260 | ListenAddress host|IPv4_addr:port |
@@ -230,7 +263,7 @@ DESCRIPTION | |||
230 | If port is not specified, sshd will listen on the address and all | 263 | If port is not specified, sshd will listen on the address and all |
231 | prior Port options specified. The default is to listen on all | 264 | prior Port options specified. The default is to listen on all |
232 | local addresses. Multiple ListenAddress options are permitted. | 265 | local addresses. Multiple ListenAddress options are permitted. |
233 | Additionally, any Port options must precede this option for non | 266 | Additionally, any Port options must precede this option for non- |
234 | port qualified addresses. | 267 | port qualified addresses. |
235 | 268 | ||
236 | LoginGraceTime | 269 | LoginGraceTime |
@@ -240,8 +273,8 @@ DESCRIPTION | |||
240 | 273 | ||
241 | LogLevel | 274 | LogLevel |
242 | Gives the verbosity level that is used when logging messages from | 275 | Gives the verbosity level that is used when logging messages from |
243 | sshd. The possible values are: QUIET, FATAL, ERROR, INFO, VER- | 276 | sshd(8). The possible values are: QUIET, FATAL, ERROR, INFO, |
244 | BOSE, DEBUG, DEBUG1, DEBUG2 and DEBUG3. The default is INFO. | 277 | VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3. The default is INFO. |
245 | DEBUG and DEBUG1 are equivalent. DEBUG2 and DEBUG3 each specify | 278 | DEBUG and DEBUG1 are equivalent. DEBUG2 and DEBUG3 each specify |
246 | higher levels of debugging output. Logging with a DEBUG level | 279 | higher levels of debugging output. Logging with a DEBUG level |
247 | violates the privacy of users and is not recommended. | 280 | violates the privacy of users and is not recommended. |
@@ -249,9 +282,23 @@ DESCRIPTION | |||
249 | MACs Specifies the available MAC (message authentication code) algo- | 282 | MACs Specifies the available MAC (message authentication code) algo- |
250 | rithms. The MAC algorithm is used in protocol version 2 for data | 283 | rithms. The MAC algorithm is used in protocol version 2 for data |
251 | integrity protection. Multiple algorithms must be comma-separat- | 284 | integrity protection. Multiple algorithms must be comma-separat- |
252 | ed. The default is ``hmac-md5,hmac-sha1,hmac-ripemd160,hmac- | 285 | ed. The default is: ``hmac-md5,hmac-sha1,hmac-ripemd160,hmac- |
253 | sha1-96,hmac-md5-96''. | 286 | sha1-96,hmac-md5-96''. |
254 | 287 | ||
288 | Match Introduces a conditional block. If all of the criteria on the | ||
289 | Match line are satisfied, the keywords on the following lines | ||
290 | override those set in the global section of the config file, un- | ||
291 | til either another Match line or the end of the file. The argu- | ||
292 | ments to Match are one or more criteria-pattern pairs. The | ||
293 | available criteria are User, Group, Host, and Address. Only a | ||
294 | subset of keywords may be used on the lines following a Match | ||
295 | keyword. Available keywords are AllowTcpForwarding, Banner, | ||
296 | ForceCommand, GatewayPorts, GSSApiAuthentication, | ||
297 | KbdInteractiveAuthentication, KerberosAuthentication, | ||
298 | PasswordAuthentication, PermitOpen, RhostsRSAAuthentication, | ||
299 | RSAAuthentication, X11DisplayOffset, X11Forwarding, and | ||
300 | X11UseLocalHost. | ||
301 | |||
255 | MaxAuthTries | 302 | MaxAuthTries |
256 | Specifies the maximum number of authentication attempts permitted | 303 | Specifies the maximum number of authentication attempts permitted |
257 | per connection. Once the number of failures reaches half this | 304 | per connection. Once the number of failures reaches half this |
@@ -259,17 +306,17 @@ DESCRIPTION | |||
259 | 306 | ||
260 | MaxStartups | 307 | MaxStartups |
261 | Specifies the maximum number of concurrent unauthenticated con- | 308 | Specifies the maximum number of concurrent unauthenticated con- |
262 | nections to the sshd daemon. Additional connections will be | 309 | nections to the SSH daemon. Additional connections will be |
263 | dropped until authentication succeeds or the LoginGraceTime ex- | 310 | dropped until authentication succeeds or the LoginGraceTime ex- |
264 | pires for a connection. The default is 10. | 311 | pires for a connection. The default is 10. |
265 | 312 | ||
266 | Alternatively, random early drop can be enabled by specifying the | 313 | Alternatively, random early drop can be enabled by specifying the |
267 | three colon separated values ``start:rate:full'' (e.g., | 314 | three colon separated values ``start:rate:full'' (e.g. |
268 | "10:30:60"). sshd will refuse connection attempts with a proba- | 315 | "10:30:60"). sshd(8) will refuse connection attempts with a |
269 | bility of ``rate/100'' (30%) if there are currently ``start'' | 316 | probability of ``rate/100'' (30%) if there are currently |
270 | (10) unauthenticated connections. The probability increases lin- | 317 | ``start'' (10) unauthenticated connections. The probability in- |
271 | early and all connection attempts are refused if the number of | 318 | creases linearly and all connection attempts are refused if the |
272 | unauthenticated connections reaches ``full'' (60). | 319 | number of unauthenticated connections reaches ``full'' (60). |
273 | 320 | ||
274 | PasswordAuthentication | 321 | PasswordAuthentication |
275 | Specifies whether password authentication is allowed. The de- | 322 | Specifies whether password authentication is allowed. The de- |
@@ -280,59 +327,74 @@ DESCRIPTION | |||
280 | server allows login to accounts with empty password strings. The | 327 | server allows login to accounts with empty password strings. The |
281 | default is ``no''. | 328 | default is ``no''. |
282 | 329 | ||
330 | PermitOpen | ||
331 | Specifies the destinations to which TCP port forwarding is per- | ||
332 | mitted. The forwarding specification must be one of the follow- | ||
333 | ing forms: | ||
334 | |||
335 | PermitOpen host:port | ||
336 | PermitOpen IPv4_addr:port | ||
337 | PermitOpen [IPv6_addr]:port | ||
338 | |||
339 | Multiple forwards may be specified by separating them with | ||
340 | whitespace. An argument of ``any'' can be used to remove all re- | ||
341 | strictions and permit any forwarding requests. By default all | ||
342 | port forwarding requests are permitted. | ||
343 | |||
283 | PermitRootLogin | 344 | PermitRootLogin |
284 | Specifies whether root can log in using ssh(1). The argument | 345 | Specifies whether root can log in using ssh(1). The argument |
285 | must be ``yes'', ``without-password'', ``forced-commands-only'' | 346 | must be ``yes'', ``without-password'', ``forced-commands-only'', |
286 | or ``no''. The default is ``yes''. | 347 | or ``no''. The default is ``yes''. |
287 | 348 | ||
288 | If this option is set to ``without-password'' password authenti- | 349 | If this option is set to ``without-password'', password authenti- |
289 | cation is disabled for root. | 350 | cation is disabled for root. |
290 | 351 | ||
291 | If this option is set to ``forced-commands-only'' root login with | 352 | If this option is set to ``forced-commands-only'', root login |
292 | public key authentication will be allowed, but only if the | 353 | with public key authentication will be allowed, but only if the |
293 | command option has been specified (which may be useful for taking | 354 | command option has been specified (which may be useful for taking |
294 | remote backups even if root login is normally not allowed). All | 355 | remote backups even if root login is normally not allowed). All |
295 | other authentication methods are disabled for root. | 356 | other authentication methods are disabled for root. |
296 | 357 | ||
297 | If this option is set to ``no'' root is not allowed to log in. | 358 | If this option is set to ``no'', root is not allowed to log in. |
298 | 359 | ||
299 | PermitTunnel | 360 | PermitTunnel |
300 | Specifies whether tun(4) device forwarding is allowed. The argu- | 361 | Specifies whether tun(4) device forwarding is allowed. The argu- |
301 | ment must be ``yes'', ``point-to-point'', ``ethernet'' or ``no''. | 362 | ment must be ``yes'', ``point-to-point'' (layer 3), ``ethernet'' |
302 | The default is ``no''. | 363 | (layer 2), or ``no''. Specifying ``yes'' permits both ``point- |
364 | to-point'' and ``ethernet''. The default is ``no''. | ||
303 | 365 | ||
304 | PermitUserEnvironment | 366 | PermitUserEnvironment |
305 | Specifies whether ~/.ssh/environment and environment= options in | 367 | Specifies whether ~/.ssh/environment and environment= options in |
306 | ~/.ssh/authorized_keys are processed by sshd. The default is | 368 | ~/.ssh/authorized_keys are processed by sshd(8). The default is |
307 | ``no''. Enabling environment processing may enable users to by- | 369 | ``no''. Enabling environment processing may enable users to by- |
308 | pass access restrictions in some configurations using mechanisms | 370 | pass access restrictions in some configurations using mechanisms |
309 | such as LD_PRELOAD. | 371 | such as LD_PRELOAD. |
310 | 372 | ||
311 | PidFile | 373 | PidFile |
312 | Specifies the file that contains the process ID of the sshd dae- | 374 | Specifies the file that contains the process ID of the SSH dae- |
313 | mon. The default is /var/run/sshd.pid. | 375 | mon. The default is /var/run/sshd.pid. |
314 | 376 | ||
315 | Port Specifies the port number that sshd listens on. The default is | 377 | Port Specifies the port number that sshd(8) listens on. The default |
316 | 22. Multiple options of this type are permitted. See also | 378 | is 22. Multiple options of this type are permitted. See also |
317 | ListenAddress. | 379 | ListenAddress. |
318 | 380 | ||
319 | PrintLastLog | 381 | PrintLastLog |
320 | Specifies whether sshd should print the date and time of the last | 382 | Specifies whether sshd(8) should print the date and time of the |
321 | user login when a user logs in interactively. The default is | 383 | last user login when a user logs in interactively. The default |
322 | ``yes''. | 384 | is ``yes''. |
323 | 385 | ||
324 | PrintMotd | 386 | PrintMotd |
325 | Specifies whether sshd should print /etc/motd when a user logs in | 387 | Specifies whether sshd(8) should print /etc/motd when a user logs |
326 | interactively. (On some systems it is also printed by the shell, | 388 | in interactively. (On some systems it is also printed by the |
327 | /etc/profile, or equivalent.) The default is ``yes''. | 389 | shell, /etc/profile, or equivalent.) The default is ``yes''. |
328 | 390 | ||
329 | Protocol | 391 | Protocol |
330 | Specifies the protocol versions sshd supports. The possible val- | 392 | Specifies the protocol versions sshd(8) supports. The possible |
331 | ues are ``1'' and ``2''. Multiple versions must be comma-sepa- | 393 | values are `1' and `2'. Multiple versions must be comma-separat- |
332 | rated. The default is ``2,1''. Note that the order of the pro- | 394 | ed. The default is ``2,1''. Note that the order of the protocol |
333 | tocol list does not indicate preference, because the client se- | 395 | list does not indicate preference, because the client selects |
334 | lects among multiple protocol versions offered by the server. | 396 | among multiple protocol versions offered by the server. Specify- |
335 | Specifying ``2,1'' is identical to ``1,2''. | 397 | ing ``2,1'' is identical to ``1,2''. |
336 | 398 | ||
337 | PubkeyAuthentication | 399 | PubkeyAuthentication |
338 | Specifies whether public key authentication is allowed. The de- | 400 | Specifies whether public key authentication is allowed. The de- |
@@ -355,24 +417,24 @@ DESCRIPTION | |||
355 | server key. The minimum value is 512, and the default is 768. | 417 | server key. The minimum value is 512, and the default is 768. |
356 | 418 | ||
357 | StrictModes | 419 | StrictModes |
358 | Specifies whether sshd should check file modes and ownership of | 420 | Specifies whether sshd(8) should check file modes and ownership |
359 | the user's files and home directory before accepting login. This | 421 | of the user's files and home directory before accepting login. |
360 | is normally desirable because novices sometimes accidentally | 422 | This is normally desirable because novices sometimes accidentally |
361 | leave their directory or files world-writable. The default is | 423 | leave their directory or files world-writable. The default is |
362 | ``yes''. | 424 | ``yes''. |
363 | 425 | ||
364 | Subsystem | 426 | Subsystem |
365 | Configures an external subsystem (e.g., file transfer daemon). | 427 | Configures an external subsystem (e.g. file transfer daemon). |
366 | Arguments should be a subsystem name and a command to execute up- | 428 | Arguments should be a subsystem name and a command (with optional |
367 | on subsystem request. The command sftp-server(8) implements the | 429 | arguments) to execute upon subsystem request. The command |
368 | ``sftp'' file transfer subsystem. By default no subsystems are | 430 | sftp-server(8) implements the ``sftp'' file transfer subsystem. |
369 | defined. Note that this option applies to protocol version 2 on- | 431 | By default no subsystems are defined. Note that this option ap- |
370 | ly. | 432 | plies to protocol version 2 only. |
371 | 433 | ||
372 | SyslogFacility | 434 | SyslogFacility |
373 | Gives the facility code that is used when logging messages from | 435 | Gives the facility code that is used when logging messages from |
374 | sshd. The possible values are: DAEMON, USER, AUTH, LOCAL0, LO- | 436 | sshd(8). The possible values are: DAEMON, USER, AUTH, LOCAL0, |
375 | CAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7. The de- | 437 | LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7. The de- |
376 | fault is AUTH. | 438 | fault is AUTH. |
377 | 439 | ||
378 | TCPKeepAlive | 440 | TCPKeepAlive |
@@ -392,7 +454,7 @@ DESCRIPTION | |||
392 | To disable TCP keepalive messages, the value should be set to | 454 | To disable TCP keepalive messages, the value should be set to |
393 | ``no''. | 455 | ``no''. |
394 | 456 | ||
395 | UseDNS Specifies whether sshd should look up the remote host name and | 457 | UseDNS Specifies whether sshd(8) should look up the remote host name and |
396 | check that the resolved host name for the remote IP address maps | 458 | check that the resolved host name for the remote IP address maps |
397 | back to the very same IP address. The default is ``yes''. | 459 | back to the very same IP address. The default is ``yes''. |
398 | 460 | ||
@@ -406,8 +468,9 @@ DESCRIPTION | |||
406 | 468 | ||
407 | UsePAM Enables the Pluggable Authentication Module interface. If set to | 469 | UsePAM Enables the Pluggable Authentication Module interface. If set to |
408 | ``yes'' this will enable PAM authentication using | 470 | ``yes'' this will enable PAM authentication using |
409 | ChallengeResponseAuthentication and PAM account and session mod- | 471 | ChallengeResponseAuthentication and PasswordAuthentication in ad- |
410 | ule processing for all authentication types. | 472 | dition to PAM account and session module processing for all au- |
473 | thentication types. | ||
411 | 474 | ||
412 | Because PAM challenge-response authentication usually serves an | 475 | Because PAM challenge-response authentication usually serves an |
413 | equivalent role to password authentication, you should disable | 476 | equivalent role to password authentication, you should disable |
@@ -417,7 +480,7 @@ DESCRIPTION | |||
417 | non-root user. The default is ``no''. | 480 | non-root user. The default is ``no''. |
418 | 481 | ||
419 | UsePrivilegeSeparation | 482 | UsePrivilegeSeparation |
420 | Specifies whether sshd separates privileges by creating an un- | 483 | Specifies whether sshd(8) separates privileges by creating an un- |
421 | privileged child process to deal with incoming network traffic. | 484 | privileged child process to deal with incoming network traffic. |
422 | After successful authentication, another process will be created | 485 | After successful authentication, another process will be created |
423 | that has the privilege of the authenticated user. The goal of | 486 | that has the privilege of the authenticated user. The goal of |
@@ -426,8 +489,8 @@ DESCRIPTION | |||
426 | default is ``yes''. | 489 | default is ``yes''. |
427 | 490 | ||
428 | X11DisplayOffset | 491 | X11DisplayOffset |
429 | Specifies the first display number available for sshd's X11 for- | 492 | Specifies the first display number available for sshd(8)'s X11 |
430 | warding. This prevents sshd from interfering with real X11 | 493 | forwarding. This prevents sshd from interfering with real X11 |
431 | servers. The default is 10. | 494 | servers. The default is 10. |
432 | 495 | ||
433 | X11Forwarding | 496 | X11Forwarding |
@@ -435,17 +498,17 @@ DESCRIPTION | |||
435 | be ``yes'' or ``no''. The default is ``no''. | 498 | be ``yes'' or ``no''. The default is ``no''. |
436 | 499 | ||
437 | When X11 forwarding is enabled, there may be additional exposure | 500 | When X11 forwarding is enabled, there may be additional exposure |
438 | to the server and to client displays if the sshd proxy display is | 501 | to the server and to client displays if the sshd(8) proxy display |
439 | configured to listen on the wildcard address (see X11UseLocalhost | 502 | is configured to listen on the wildcard address (see |
440 | below), however this is not the default. Additionally, the au- | 503 | X11UseLocalhost below), though this is not the default. Addi- |
441 | thentication spoofing and authentication data verification and | 504 | tionally, the authentication spoofing and authentication data |
442 | substitution occur on the client side. The security risk of us- | 505 | verification and substitution occur on the client side. The se- |
443 | ing X11 forwarding is that the client's X11 display server may be | 506 | curity risk of using X11 forwarding is that the client's X11 dis- |
444 | exposed to attack when the ssh client requests forwarding (see | 507 | play server may be exposed to attack when the SSH client requests |
445 | the warnings for ForwardX11 in ssh_config(5)). A system adminis- | 508 | forwarding (see the warnings for ForwardX11 in ssh_config(5)). A |
446 | trator may have a stance in which they want to protect clients | 509 | system administrator may have a stance in which they want to pro- |
447 | that may expose themselves to attack by unwittingly requesting | 510 | tect clients that may expose themselves to attack by unwittingly |
448 | X11 forwarding, which can warrant a ``no'' setting. | 511 | requesting X11 forwarding, which can warrant a ``no'' setting. |
449 | 512 | ||
450 | Note that disabling X11 forwarding does not prevent users from | 513 | Note that disabling X11 forwarding does not prevent users from |
451 | forwarding X11 traffic, as users can always install their own | 514 | forwarding X11 traffic, as users can always install their own |
@@ -453,8 +516,8 @@ DESCRIPTION | |||
453 | is enabled. | 516 | is enabled. |
454 | 517 | ||
455 | X11UseLocalhost | 518 | X11UseLocalhost |
456 | Specifies whether sshd should bind the X11 forwarding server to | 519 | Specifies whether sshd(8) should bind the X11 forwarding server |
457 | the loopback address or to the wildcard address. By default, | 520 | to the loopback address or to the wildcard address. By default, |
458 | sshd binds the forwarding server to the loopback address and sets | 521 | sshd binds the forwarding server to the loopback address and sets |
459 | the hostname part of the DISPLAY environment variable to | 522 | the hostname part of the DISPLAY environment variable to |
460 | ``localhost''. This prevents remote hosts from connecting to the | 523 | ``localhost''. This prevents remote hosts from connecting to the |
@@ -468,9 +531,9 @@ DESCRIPTION | |||
468 | Specifies the full pathname of the xauth(1) program. The default | 531 | Specifies the full pathname of the xauth(1) program. The default |
469 | is /usr/X11R6/bin/xauth. | 532 | is /usr/X11R6/bin/xauth. |
470 | 533 | ||
471 | Time Formats | 534 | TIME FORMATS |
472 | sshd command-line arguments and configuration file options that specify | 535 | sshd(8) command-line arguments and configuration file options that speci- |
473 | time may be expressed using a sequence of the form: time[qualifier], | 536 | fy time may be expressed using a sequence of the form: time[qualifier], |
474 | where time is a positive integer value and qualifier is one of the fol- | 537 | where time is a positive integer value and qualifier is one of the fol- |
475 | lowing: | 538 | lowing: |
476 | 539 | ||
@@ -492,7 +555,7 @@ DESCRIPTION | |||
492 | 555 | ||
493 | FILES | 556 | FILES |
494 | /etc/ssh/sshd_config | 557 | /etc/ssh/sshd_config |
495 | Contains configuration data for sshd. This file should be | 558 | Contains configuration data for sshd(8). This file should be |
496 | writable by root only, but it is recommended (though not neces- | 559 | writable by root only, but it is recommended (though not neces- |
497 | sary) that it be world-readable. | 560 | sary) that it be world-readable. |
498 | 561 | ||
@@ -507,4 +570,4 @@ AUTHORS | |||
507 | versions 1.5 and 2.0. Niels Provos and Markus Friedl contributed support | 570 | versions 1.5 and 2.0. Niels Provos and Markus Friedl contributed support |
508 | for privilege separation. | 571 | for privilege separation. |
509 | 572 | ||
510 | OpenBSD 3.9 September 25, 1999 8 | 573 | OpenBSD 4.1 September 25, 1999 9 |
diff --git a/sshd_config.5 b/sshd_config.5 index 999e14a07..c75e0bf55 100644 --- a/sshd_config.5 +++ b/sshd_config.5 | |||
@@ -34,7 +34,7 @@ | |||
34 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 34 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
35 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 35 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
36 | .\" | 36 | .\" |
37 | .\" $OpenBSD: sshd_config.5,v 1.48 2006/01/02 17:09:49 jmc Exp $ | 37 | .\" $OpenBSD: sshd_config.5,v 1.74 2007/03/01 16:19:33 jmc Exp $ |
38 | .Dd September 25, 1999 | 38 | .Dd September 25, 1999 |
39 | .Dt SSHD_CONFIG 5 | 39 | .Dt SSHD_CONFIG 5 |
40 | .Os | 40 | .Os |
@@ -42,11 +42,9 @@ | |||
42 | .Nm sshd_config | 42 | .Nm sshd_config |
43 | .Nd OpenSSH SSH daemon configuration file | 43 | .Nd OpenSSH SSH daemon configuration file |
44 | .Sh SYNOPSIS | 44 | .Sh SYNOPSIS |
45 | .Bl -tag -width Ds -compact | 45 | .Nm /etc/ssh/sshd_config |
46 | .It Pa /etc/ssh/sshd_config | ||
47 | .El | ||
48 | .Sh DESCRIPTION | 46 | .Sh DESCRIPTION |
49 | .Nm sshd | 47 | .Xr sshd 8 |
50 | reads configuration data from | 48 | reads configuration data from |
51 | .Pa /etc/ssh/sshd_config | 49 | .Pa /etc/ssh/sshd_config |
52 | (or the file specified with | 50 | (or the file specified with |
@@ -56,6 +54,9 @@ The file contains keyword-argument pairs, one per line. | |||
56 | Lines starting with | 54 | Lines starting with |
57 | .Ql # | 55 | .Ql # |
58 | and empty lines are interpreted as comments. | 56 | and empty lines are interpreted as comments. |
57 | Arguments may optionally be enclosed in double quotes | ||
58 | .Pq \&" | ||
59 | in order to represent arguments containing spaces. | ||
59 | .Pp | 60 | .Pp |
60 | The possible | 61 | The possible |
61 | keywords and their meanings are as follows (note that | 62 | keywords and their meanings are as follows (note that |
@@ -72,7 +73,7 @@ in | |||
72 | for how to configure the client. | 73 | for how to configure the client. |
73 | Note that environment passing is only supported for protocol 2. | 74 | Note that environment passing is only supported for protocol 2. |
74 | Variables are specified by name, which may contain the wildcard characters | 75 | Variables are specified by name, which may contain the wildcard characters |
75 | .Ql \&* | 76 | .Ql * |
76 | and | 77 | and |
77 | .Ql \&? . | 78 | .Ql \&? . |
78 | Multiple environment variables may be separated by whitespace or spread | 79 | Multiple environment variables may be separated by whitespace or spread |
@@ -85,11 +86,11 @@ For this reason, care should be taken in the use of this directive. | |||
85 | The default is not to accept any environment variables. | 86 | The default is not to accept any environment variables. |
86 | .It Cm AddressFamily | 87 | .It Cm AddressFamily |
87 | Specifies which address family should be used by | 88 | Specifies which address family should be used by |
88 | .Nm sshd . | 89 | .Xr sshd 8 . |
89 | Valid arguments are | 90 | Valid arguments are |
90 | .Dq any , | 91 | .Dq any , |
91 | .Dq inet | 92 | .Dq inet |
92 | (use IPv4 only) or | 93 | (use IPv4 only), or |
93 | .Dq inet6 | 94 | .Dq inet6 |
94 | (use IPv6 only). | 95 | (use IPv6 only). |
95 | The default is | 96 | The default is |
@@ -99,13 +100,20 @@ This keyword can be followed by a list of group name patterns, separated | |||
99 | by spaces. | 100 | by spaces. |
100 | If specified, login is allowed only for users whose primary | 101 | If specified, login is allowed only for users whose primary |
101 | group or supplementary group list matches one of the patterns. | 102 | group or supplementary group list matches one of the patterns. |
102 | .Ql \&* | ||
103 | and | ||
104 | .Ql \&? | ||
105 | can be used as | ||
106 | wildcards in the patterns. | ||
107 | Only group names are valid; a numerical group ID is not recognized. | 103 | Only group names are valid; a numerical group ID is not recognized. |
108 | By default, login is allowed for all groups. | 104 | By default, login is allowed for all groups. |
105 | The allow/deny directives are processed in the following order: | ||
106 | .Cm DenyUsers , | ||
107 | .Cm AllowUsers , | ||
108 | .Cm DenyGroups , | ||
109 | and finally | ||
110 | .Cm AllowGroups . | ||
111 | .Pp | ||
112 | See | ||
113 | .Sx PATTERNS | ||
114 | in | ||
115 | .Xr ssh_config 5 | ||
116 | for more information on patterns. | ||
109 | .It Cm AllowTcpForwarding | 117 | .It Cm AllowTcpForwarding |
110 | Specifies whether TCP forwarding is permitted. | 118 | Specifies whether TCP forwarding is permitted. |
111 | The default is | 119 | The default is |
@@ -118,24 +126,31 @@ This keyword can be followed by a list of user name patterns, separated | |||
118 | by spaces. | 126 | by spaces. |
119 | If specified, login is allowed only for user names that | 127 | If specified, login is allowed only for user names that |
120 | match one of the patterns. | 128 | match one of the patterns. |
121 | .Ql \&* | ||
122 | and | ||
123 | .Ql \&? | ||
124 | can be used as | ||
125 | wildcards in the patterns. | ||
126 | Only user names are valid; a numerical user ID is not recognized. | 129 | Only user names are valid; a numerical user ID is not recognized. |
127 | By default, login is allowed for all users. | 130 | By default, login is allowed for all users. |
128 | If the pattern takes the form USER@HOST then USER and HOST | 131 | If the pattern takes the form USER@HOST then USER and HOST |
129 | are separately checked, restricting logins to particular | 132 | are separately checked, restricting logins to particular |
130 | users from particular hosts. | 133 | users from particular hosts. |
134 | The allow/deny directives are processed in the following order: | ||
135 | .Cm DenyUsers , | ||
136 | .Cm AllowUsers , | ||
137 | .Cm DenyGroups , | ||
138 | and finally | ||
139 | .Cm AllowGroups . | ||
140 | .Pp | ||
141 | See | ||
142 | .Sx PATTERNS | ||
143 | in | ||
144 | .Xr ssh_config 5 | ||
145 | for more information on patterns. | ||
131 | .It Cm AuthorizedKeysFile | 146 | .It Cm AuthorizedKeysFile |
132 | Specifies the file that contains the public keys that can be used | 147 | Specifies the file that contains the public keys that can be used |
133 | for user authentication. | 148 | for user authentication. |
134 | .Cm AuthorizedKeysFile | 149 | .Cm AuthorizedKeysFile |
135 | may contain tokens of the form %T which are substituted during connection | 150 | may contain tokens of the form %T which are substituted during connection |
136 | set-up. | 151 | setup. |
137 | The following tokens are defined: %% is replaced by a literal '%', | 152 | The following tokens are defined: %% is replaced by a literal '%', |
138 | %h is replaced by the home directory of the user being authenticated and | 153 | %h is replaced by the home directory of the user being authenticated, and |
139 | %u is replaced by the username of that user. | 154 | %u is replaced by the username of that user. |
140 | After expansion, | 155 | After expansion, |
141 | .Cm AuthorizedKeysFile | 156 | .Cm AuthorizedKeysFile |
@@ -151,7 +166,7 @@ authentication is allowed. | |||
151 | This option is only available for protocol version 2. | 166 | This option is only available for protocol version 2. |
152 | By default, no banner is displayed. | 167 | By default, no banner is displayed. |
153 | .It Cm ChallengeResponseAuthentication | 168 | .It Cm ChallengeResponseAuthentication |
154 | Specifies whether challenge response authentication is allowed. | 169 | Specifies whether challenge-response authentication is allowed. |
155 | All authentication styles from | 170 | All authentication styles from |
156 | .Xr login.conf 5 | 171 | .Xr login.conf 5 |
157 | are supported. | 172 | are supported. |
@@ -174,20 +189,19 @@ The supported ciphers are | |||
174 | .Dq blowfish-cbc , | 189 | .Dq blowfish-cbc , |
175 | and | 190 | and |
176 | .Dq cast128-cbc . | 191 | .Dq cast128-cbc . |
177 | The default is | 192 | The default is: |
178 | .Bd -literal | 193 | .Bd -literal -offset 3n |
179 | ``aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128, | 194 | aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128, |
180 | arcfour256,arcfour,aes192-cbc,aes256-cbc,aes128-ctr, | 195 | arcfour256,arcfour,aes192-cbc,aes256-cbc,aes128-ctr, |
181 | aes192-ctr,aes256-ctr'' | 196 | aes192-ctr,aes256-ctr |
182 | .Ed | 197 | .Ed |
183 | .It Cm ClientAliveCountMax | 198 | .It Cm ClientAliveCountMax |
184 | Sets the number of client alive messages (see below) which may be | 199 | Sets the number of client alive messages (see below) which may be |
185 | sent without | 200 | sent without |
186 | .Nm sshd | 201 | .Xr sshd 8 |
187 | receiving any messages back from the client. | 202 | receiving any messages back from the client. |
188 | If this threshold is reached while client alive messages are being sent, | 203 | If this threshold is reached while client alive messages are being sent, |
189 | .Nm sshd | 204 | sshd will disconnect the client, terminating the session. |
190 | will disconnect the client, terminating the session. | ||
191 | It is important to note that the use of client alive messages is very | 205 | It is important to note that the use of client alive messages is very |
192 | different from | 206 | different from |
193 | .Cm TCPKeepAlive | 207 | .Cm TCPKeepAlive |
@@ -205,12 +219,13 @@ If | |||
205 | .Cm ClientAliveInterval | 219 | .Cm ClientAliveInterval |
206 | (see below) is set to 15, and | 220 | (see below) is set to 15, and |
207 | .Cm ClientAliveCountMax | 221 | .Cm ClientAliveCountMax |
208 | is left at the default, unresponsive ssh clients | 222 | is left at the default, unresponsive SSH clients |
209 | will be disconnected after approximately 45 seconds. | 223 | will be disconnected after approximately 45 seconds. |
224 | This option applies to protocol version 2 only. | ||
210 | .It Cm ClientAliveInterval | 225 | .It Cm ClientAliveInterval |
211 | Sets a timeout interval in seconds after which if no data has been received | 226 | Sets a timeout interval in seconds after which if no data has been received |
212 | from the client, | 227 | from the client, |
213 | .Nm sshd | 228 | .Xr sshd 8 |
214 | will send a message through the encrypted | 229 | will send a message through the encrypted |
215 | channel to request a response from the client. | 230 | channel to request a response from the client. |
216 | The default | 231 | The default |
@@ -231,36 +246,62 @@ This keyword can be followed by a list of group name patterns, separated | |||
231 | by spaces. | 246 | by spaces. |
232 | Login is disallowed for users whose primary group or supplementary | 247 | Login is disallowed for users whose primary group or supplementary |
233 | group list matches one of the patterns. | 248 | group list matches one of the patterns. |
234 | .Ql \&* | ||
235 | and | ||
236 | .Ql \&? | ||
237 | can be used as | ||
238 | wildcards in the patterns. | ||
239 | Only group names are valid; a numerical group ID is not recognized. | 249 | Only group names are valid; a numerical group ID is not recognized. |
240 | By default, login is allowed for all groups. | 250 | By default, login is allowed for all groups. |
251 | The allow/deny directives are processed in the following order: | ||
252 | .Cm DenyUsers , | ||
253 | .Cm AllowUsers , | ||
254 | .Cm DenyGroups , | ||
255 | and finally | ||
256 | .Cm AllowGroups . | ||
257 | .Pp | ||
258 | See | ||
259 | .Sx PATTERNS | ||
260 | in | ||
261 | .Xr ssh_config 5 | ||
262 | for more information on patterns. | ||
241 | .It Cm DenyUsers | 263 | .It Cm DenyUsers |
242 | This keyword can be followed by a list of user name patterns, separated | 264 | This keyword can be followed by a list of user name patterns, separated |
243 | by spaces. | 265 | by spaces. |
244 | Login is disallowed for user names that match one of the patterns. | 266 | Login is disallowed for user names that match one of the patterns. |
245 | .Ql \&* | ||
246 | and | ||
247 | .Ql \&? | ||
248 | can be used as wildcards in the patterns. | ||
249 | Only user names are valid; a numerical user ID is not recognized. | 267 | Only user names are valid; a numerical user ID is not recognized. |
250 | By default, login is allowed for all users. | 268 | By default, login is allowed for all users. |
251 | If the pattern takes the form USER@HOST then USER and HOST | 269 | If the pattern takes the form USER@HOST then USER and HOST |
252 | are separately checked, restricting logins to particular | 270 | are separately checked, restricting logins to particular |
253 | users from particular hosts. | 271 | users from particular hosts. |
272 | The allow/deny directives are processed in the following order: | ||
273 | .Cm DenyUsers , | ||
274 | .Cm AllowUsers , | ||
275 | .Cm DenyGroups , | ||
276 | and finally | ||
277 | .Cm AllowGroups . | ||
278 | .Pp | ||
279 | See | ||
280 | .Sx PATTERNS | ||
281 | in | ||
282 | .Xr ssh_config 5 | ||
283 | for more information on patterns. | ||
284 | .It Cm ForceCommand | ||
285 | Forces the execution of the command specified by | ||
286 | .Cm ForceCommand , | ||
287 | ignoring any command supplied by the client. | ||
288 | The command is invoked by using the user's login shell with the -c option. | ||
289 | This applies to shell, command, or subsystem execution. | ||
290 | It is most useful inside a | ||
291 | .Cm Match | ||
292 | block. | ||
293 | The command originally supplied by the client is available in the | ||
294 | .Ev SSH_ORIGINAL_COMMAND | ||
295 | environment variable. | ||
254 | .It Cm GatewayPorts | 296 | .It Cm GatewayPorts |
255 | Specifies whether remote hosts are allowed to connect to ports | 297 | Specifies whether remote hosts are allowed to connect to ports |
256 | forwarded for the client. | 298 | forwarded for the client. |
257 | By default, | 299 | By default, |
258 | .Nm sshd | 300 | .Xr sshd 8 |
259 | binds remote port forwardings to the loopback address. | 301 | binds remote port forwardings to the loopback address. |
260 | This prevents other remote hosts from connecting to forwarded ports. | 302 | This prevents other remote hosts from connecting to forwarded ports. |
261 | .Cm GatewayPorts | 303 | .Cm GatewayPorts |
262 | can be used to specify that | 304 | can be used to specify that sshd |
263 | .Nm sshd | ||
264 | should allow remote port forwardings to bind to non-loopback addresses, thus | 305 | should allow remote port forwardings to bind to non-loopback addresses, thus |
265 | allowing other hosts to connect. | 306 | allowing other hosts to connect. |
266 | The argument may be | 307 | The argument may be |
@@ -289,15 +330,49 @@ on logout. | |||
289 | The default is | 330 | The default is |
290 | .Dq yes . | 331 | .Dq yes . |
291 | Note that this option applies to protocol version 2 only. | 332 | Note that this option applies to protocol version 2 only. |
333 | .It Cm GSSAPIStrictAcceptorCheck | ||
334 | Determines whether to be strict about the identity of the GSSAPI acceptor | ||
335 | a client authenticates against. If | ||
336 | .Dq yes | ||
337 | then the client must authenticate against the | ||
338 | .Pa host | ||
339 | service on the current hostname. If | ||
340 | .Dq no | ||
341 | then the client may authenticate against any service key stored in the | ||
342 | machine's default store. This facility is provided to assist with operation | ||
343 | on multi homed machines. | ||
344 | The default is | ||
345 | .Dq yes . | ||
346 | Note that this option applies only to protocol version 2 GSSAPI connections, | ||
347 | and setting it to | ||
348 | .Dq no | ||
349 | may only work with recent Kerberos GSSAPI libraries. | ||
292 | .It Cm HostbasedAuthentication | 350 | .It Cm HostbasedAuthentication |
293 | Specifies whether rhosts or /etc/hosts.equiv authentication together | 351 | Specifies whether rhosts or /etc/hosts.equiv authentication together |
294 | with successful public key client host authentication is allowed | 352 | with successful public key client host authentication is allowed |
295 | (hostbased authentication). | 353 | (host-based authentication). |
296 | This option is similar to | 354 | This option is similar to |
297 | .Cm RhostsRSAAuthentication | 355 | .Cm RhostsRSAAuthentication |
298 | and applies to protocol version 2 only. | 356 | and applies to protocol version 2 only. |
299 | The default is | 357 | The default is |
300 | .Dq no . | 358 | .Dq no . |
359 | .It Cm HostbasedUsesNameFromPacketOnly | ||
360 | Specifies whether or not the server will attempt to perform a reverse | ||
361 | name lookup when matching the name in the | ||
362 | .Pa ~/.shosts , | ||
363 | .Pa ~/.rhosts , | ||
364 | and | ||
365 | .Pa /etc/hosts.equiv | ||
366 | files during | ||
367 | .Cm HostbasedAuthentication . | ||
368 | A setting of | ||
369 | .Dq yes | ||
370 | means that | ||
371 | .Xr sshd 8 | ||
372 | uses the name supplied by the client rather than | ||
373 | attempting to resolve the name from the TCP connection itself. | ||
374 | The default is | ||
375 | .Dq no . | ||
301 | .It Cm HostKey | 376 | .It Cm HostKey |
302 | Specifies a file containing a private host key | 377 | Specifies a file containing a private host key |
303 | used by SSH. | 378 | used by SSH. |
@@ -309,7 +384,7 @@ and | |||
309 | .Pa /etc/ssh/ssh_host_dsa_key | 384 | .Pa /etc/ssh/ssh_host_dsa_key |
310 | for protocol version 2. | 385 | for protocol version 2. |
311 | Note that | 386 | Note that |
312 | .Nm sshd | 387 | .Xr sshd 8 |
313 | will refuse to use a file if it is group/world-accessible. | 388 | will refuse to use a file if it is group/world-accessible. |
314 | It is possible to have multiple host key files. | 389 | It is possible to have multiple host key files. |
315 | .Dq rsa1 | 390 | .Dq rsa1 |
@@ -336,7 +411,7 @@ The default is | |||
336 | .Dq yes . | 411 | .Dq yes . |
337 | .It Cm IgnoreUserKnownHosts | 412 | .It Cm IgnoreUserKnownHosts |
338 | Specifies whether | 413 | Specifies whether |
339 | .Nm sshd | 414 | .Xr sshd 8 |
340 | should ignore the user's | 415 | should ignore the user's |
341 | .Pa ~/.ssh/known_hosts | 416 | .Pa ~/.ssh/known_hosts |
342 | during | 417 | during |
@@ -351,24 +426,24 @@ Specifies whether the password provided by the user for | |||
351 | will be validated through the Kerberos KDC. | 426 | will be validated through the Kerberos KDC. |
352 | To use this option, the server needs a | 427 | To use this option, the server needs a |
353 | Kerberos servtab which allows the verification of the KDC's identity. | 428 | Kerberos servtab which allows the verification of the KDC's identity. |
354 | Default is | 429 | The default is |
355 | .Dq no . | 430 | .Dq no . |
356 | .It Cm KerberosGetAFSToken | 431 | .It Cm KerberosGetAFSToken |
357 | If AFS is active and the user has a Kerberos 5 TGT, attempt to acquire | 432 | If AFS is active and the user has a Kerberos 5 TGT, attempt to acquire |
358 | an AFS token before accessing the user's home directory. | 433 | an AFS token before accessing the user's home directory. |
359 | Default is | 434 | The default is |
360 | .Dq no . | 435 | .Dq no . |
361 | .It Cm KerberosOrLocalPasswd | 436 | .It Cm KerberosOrLocalPasswd |
362 | If set then if password authentication through Kerberos fails then | 437 | If password authentication through Kerberos fails then |
363 | the password will be validated via any additional local mechanism | 438 | the password will be validated via any additional local mechanism |
364 | such as | 439 | such as |
365 | .Pa /etc/passwd . | 440 | .Pa /etc/passwd . |
366 | Default is | 441 | The default is |
367 | .Dq yes . | 442 | .Dq yes . |
368 | .It Cm KerberosTicketCleanup | 443 | .It Cm KerberosTicketCleanup |
369 | Specifies whether to automatically destroy the user's ticket cache | 444 | Specifies whether to automatically destroy the user's ticket cache |
370 | file on logout. | 445 | file on logout. |
371 | Default is | 446 | The default is |
372 | .Dq yes . | 447 | .Dq yes . |
373 | .It Cm KeyRegenerationInterval | 448 | .It Cm KeyRegenerationInterval |
374 | In protocol version 1, the ephemeral server key is automatically regenerated | 449 | In protocol version 1, the ephemeral server key is automatically regenerated |
@@ -381,7 +456,7 @@ If the value is 0, the key is never regenerated. | |||
381 | The default is 3600 (seconds). | 456 | The default is 3600 (seconds). |
382 | .It Cm ListenAddress | 457 | .It Cm ListenAddress |
383 | Specifies the local addresses | 458 | Specifies the local addresses |
384 | .Nm sshd | 459 | .Xr sshd 8 |
385 | should listen on. | 460 | should listen on. |
386 | The following forms may be used: | 461 | The following forms may be used: |
387 | .Pp | 462 | .Pp |
@@ -407,8 +482,7 @@ The following forms may be used: | |||
407 | If | 482 | If |
408 | .Ar port | 483 | .Ar port |
409 | is not specified, | 484 | is not specified, |
410 | .Nm sshd | 485 | sshd will listen on the address and all prior |
411 | will listen on the address and all prior | ||
412 | .Cm Port | 486 | .Cm Port |
413 | options specified. | 487 | options specified. |
414 | The default is to listen on all local addresses. | 488 | The default is to listen on all local addresses. |
@@ -417,7 +491,7 @@ Multiple | |||
417 | options are permitted. | 491 | options are permitted. |
418 | Additionally, any | 492 | Additionally, any |
419 | .Cm Port | 493 | .Cm Port |
420 | options must precede this option for non port qualified addresses. | 494 | options must precede this option for non-port qualified addresses. |
421 | .It Cm LoginGraceTime | 495 | .It Cm LoginGraceTime |
422 | The server disconnects after this time if the user has not | 496 | The server disconnects after this time if the user has not |
423 | successfully logged in. | 497 | successfully logged in. |
@@ -425,9 +499,9 @@ If the value is 0, there is no time limit. | |||
425 | The default is 120 seconds. | 499 | The default is 120 seconds. |
426 | .It Cm LogLevel | 500 | .It Cm LogLevel |
427 | Gives the verbosity level that is used when logging messages from | 501 | Gives the verbosity level that is used when logging messages from |
428 | .Nm sshd . | 502 | .Xr sshd 8 . |
429 | The possible values are: | 503 | The possible values are: |
430 | QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2 and DEBUG3. | 504 | QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3. |
431 | The default is INFO. | 505 | The default is INFO. |
432 | DEBUG and DEBUG1 are equivalent. | 506 | DEBUG and DEBUG1 are equivalent. |
433 | DEBUG2 and DEBUG3 each specify higher levels of debugging output. | 507 | DEBUG2 and DEBUG3 each specify higher levels of debugging output. |
@@ -437,8 +511,44 @@ Specifies the available MAC (message authentication code) algorithms. | |||
437 | The MAC algorithm is used in protocol version 2 | 511 | The MAC algorithm is used in protocol version 2 |
438 | for data integrity protection. | 512 | for data integrity protection. |
439 | Multiple algorithms must be comma-separated. | 513 | Multiple algorithms must be comma-separated. |
440 | The default is | 514 | The default is: |
441 | .Dq hmac-md5,hmac-sha1,hmac-ripemd160,hmac-sha1-96,hmac-md5-96 . | 515 | .Dq hmac-md5,hmac-sha1,hmac-ripemd160,hmac-sha1-96,hmac-md5-96 . |
516 | .It Cm Match | ||
517 | Introduces a conditional block. | ||
518 | If all of the criteria on the | ||
519 | .Cm Match | ||
520 | line are satisfied, the keywords on the following lines override those | ||
521 | set in the global section of the config file, until either another | ||
522 | .Cm Match | ||
523 | line or the end of the file. | ||
524 | The arguments to | ||
525 | .Cm Match | ||
526 | are one or more criteria-pattern pairs. | ||
527 | The available criteria are | ||
528 | .Cm User , | ||
529 | .Cm Group , | ||
530 | .Cm Host , | ||
531 | and | ||
532 | .Cm Address . | ||
533 | Only a subset of keywords may be used on the lines following a | ||
534 | .Cm Match | ||
535 | keyword. | ||
536 | Available keywords are | ||
537 | .Cm AllowTcpForwarding , | ||
538 | .Cm Banner , | ||
539 | .Cm ForceCommand , | ||
540 | .Cm GatewayPorts , | ||
541 | .Cm GSSApiAuthentication , | ||
542 | .Cm KbdInteractiveAuthentication , | ||
543 | .Cm KerberosAuthentication , | ||
544 | .Cm PasswordAuthentication , | ||
545 | .Cm PermitOpen , | ||
546 | .Cm RhostsRSAAuthentication , | ||
547 | .Cm RSAAuthentication , | ||
548 | .Cm X11DisplayOffset , | ||
549 | .Cm X11Forwarding , | ||
550 | and | ||
551 | .Cm X11UseLocalHost . | ||
442 | .It Cm MaxAuthTries | 552 | .It Cm MaxAuthTries |
443 | Specifies the maximum number of authentication attempts permitted per | 553 | Specifies the maximum number of authentication attempts permitted per |
444 | connection. | 554 | connection. |
@@ -447,8 +557,7 @@ additional failures are logged. | |||
447 | The default is 6. | 557 | The default is 6. |
448 | .It Cm MaxStartups | 558 | .It Cm MaxStartups |
449 | Specifies the maximum number of concurrent unauthenticated connections to the | 559 | Specifies the maximum number of concurrent unauthenticated connections to the |
450 | .Nm sshd | 560 | SSH daemon. |
451 | daemon. | ||
452 | Additional connections will be dropped until authentication succeeds or the | 561 | Additional connections will be dropped until authentication succeeds or the |
453 | .Cm LoginGraceTime | 562 | .Cm LoginGraceTime |
454 | expires for a connection. | 563 | expires for a connection. |
@@ -457,8 +566,8 @@ The default is 10. | |||
457 | Alternatively, random early drop can be enabled by specifying | 566 | Alternatively, random early drop can be enabled by specifying |
458 | the three colon separated values | 567 | the three colon separated values |
459 | .Dq start:rate:full | 568 | .Dq start:rate:full |
460 | (e.g., "10:30:60"). | 569 | (e.g. "10:30:60"). |
461 | .Nm sshd | 570 | .Xr sshd 8 |
462 | will refuse connection attempts with a probability of | 571 | will refuse connection attempts with a probability of |
463 | .Dq rate/100 | 572 | .Dq rate/100 |
464 | (30%) | 573 | (30%) |
@@ -479,24 +588,51 @@ When password authentication is allowed, it specifies whether the | |||
479 | server allows login to accounts with empty password strings. | 588 | server allows login to accounts with empty password strings. |
480 | The default is | 589 | The default is |
481 | .Dq no . | 590 | .Dq no . |
591 | .It Cm PermitOpen | ||
592 | Specifies the destinations to which TCP port forwarding is permitted. | ||
593 | The forwarding specification must be one of the following forms: | ||
594 | .Pp | ||
595 | .Bl -item -offset indent -compact | ||
596 | .It | ||
597 | .Cm PermitOpen | ||
598 | .Sm off | ||
599 | .Ar host : port | ||
600 | .Sm on | ||
601 | .It | ||
602 | .Cm PermitOpen | ||
603 | .Sm off | ||
604 | .Ar IPv4_addr : port | ||
605 | .Sm on | ||
606 | .It | ||
607 | .Cm PermitOpen | ||
608 | .Sm off | ||
609 | .Ar \&[ IPv6_addr \&] : port | ||
610 | .Sm on | ||
611 | .El | ||
612 | .Pp | ||
613 | Multiple forwards may be specified by separating them with whitespace. | ||
614 | An argument of | ||
615 | .Dq any | ||
616 | can be used to remove all restrictions and permit any forwarding requests. | ||
617 | By default all port forwarding requests are permitted. | ||
482 | .It Cm PermitRootLogin | 618 | .It Cm PermitRootLogin |
483 | Specifies whether root can log in using | 619 | Specifies whether root can log in using |
484 | .Xr ssh 1 . | 620 | .Xr ssh 1 . |
485 | The argument must be | 621 | The argument must be |
486 | .Dq yes , | 622 | .Dq yes , |
487 | .Dq without-password , | 623 | .Dq without-password , |
488 | .Dq forced-commands-only | 624 | .Dq forced-commands-only , |
489 | or | 625 | or |
490 | .Dq no . | 626 | .Dq no . |
491 | The default is | 627 | The default is |
492 | .Dq yes . | 628 | .Dq yes . |
493 | .Pp | 629 | .Pp |
494 | If this option is set to | 630 | If this option is set to |
495 | .Dq without-password | 631 | .Dq without-password , |
496 | password authentication is disabled for root. | 632 | password authentication is disabled for root. |
497 | .Pp | 633 | .Pp |
498 | If this option is set to | 634 | If this option is set to |
499 | .Dq forced-commands-only | 635 | .Dq forced-commands-only , |
500 | root login with public key authentication will be allowed, | 636 | root login with public key authentication will be allowed, |
501 | but only if the | 637 | but only if the |
502 | .Ar command | 638 | .Ar command |
@@ -506,7 +642,7 @@ normally not allowed). | |||
506 | All other authentication methods are disabled for root. | 642 | All other authentication methods are disabled for root. |
507 | .Pp | 643 | .Pp |
508 | If this option is set to | 644 | If this option is set to |
509 | .Dq no | 645 | .Dq no , |
510 | root is not allowed to log in. | 646 | root is not allowed to log in. |
511 | .It Cm PermitTunnel | 647 | .It Cm PermitTunnel |
512 | Specifies whether | 648 | Specifies whether |
@@ -514,10 +650,17 @@ Specifies whether | |||
514 | device forwarding is allowed. | 650 | device forwarding is allowed. |
515 | The argument must be | 651 | The argument must be |
516 | .Dq yes , | 652 | .Dq yes , |
517 | .Dq point-to-point , | 653 | .Dq point-to-point |
654 | (layer 3), | ||
518 | .Dq ethernet | 655 | .Dq ethernet |
519 | or | 656 | (layer 2), or |
520 | .Dq no . | 657 | .Dq no . |
658 | Specifying | ||
659 | .Dq yes | ||
660 | permits both | ||
661 | .Dq point-to-point | ||
662 | and | ||
663 | .Dq ethernet . | ||
521 | The default is | 664 | The default is |
522 | .Dq no . | 665 | .Dq no . |
523 | .It Cm PermitUserEnvironment | 666 | .It Cm PermitUserEnvironment |
@@ -528,7 +671,7 @@ and | |||
528 | options in | 671 | options in |
529 | .Pa ~/.ssh/authorized_keys | 672 | .Pa ~/.ssh/authorized_keys |
530 | are processed by | 673 | are processed by |
531 | .Nm sshd . | 674 | .Xr sshd 8 . |
532 | The default is | 675 | The default is |
533 | .Dq no . | 676 | .Dq no . |
534 | Enabling environment processing may enable users to bypass access | 677 | Enabling environment processing may enable users to bypass access |
@@ -536,13 +679,12 @@ restrictions in some configurations using mechanisms such as | |||
536 | .Ev LD_PRELOAD . | 679 | .Ev LD_PRELOAD . |
537 | .It Cm PidFile | 680 | .It Cm PidFile |
538 | Specifies the file that contains the process ID of the | 681 | Specifies the file that contains the process ID of the |
539 | .Nm sshd | 682 | SSH daemon. |
540 | daemon. | ||
541 | The default is | 683 | The default is |
542 | .Pa /var/run/sshd.pid . | 684 | .Pa /var/run/sshd.pid . |
543 | .It Cm Port | 685 | .It Cm Port |
544 | Specifies the port number that | 686 | Specifies the port number that |
545 | .Nm sshd | 687 | .Xr sshd 8 |
546 | listens on. | 688 | listens on. |
547 | The default is 22. | 689 | The default is 22. |
548 | Multiple options of this type are permitted. | 690 | Multiple options of this type are permitted. |
@@ -550,14 +692,14 @@ See also | |||
550 | .Cm ListenAddress . | 692 | .Cm ListenAddress . |
551 | .It Cm PrintLastLog | 693 | .It Cm PrintLastLog |
552 | Specifies whether | 694 | Specifies whether |
553 | .Nm sshd | 695 | .Xr sshd 8 |
554 | should print the date and time of the last user login when a user logs | 696 | should print the date and time of the last user login when a user logs |
555 | in interactively. | 697 | in interactively. |
556 | The default is | 698 | The default is |
557 | .Dq yes . | 699 | .Dq yes . |
558 | .It Cm PrintMotd | 700 | .It Cm PrintMotd |
559 | Specifies whether | 701 | Specifies whether |
560 | .Nm sshd | 702 | .Xr sshd 8 |
561 | should print | 703 | should print |
562 | .Pa /etc/motd | 704 | .Pa /etc/motd |
563 | when a user logs in interactively. | 705 | when a user logs in interactively. |
@@ -568,12 +710,12 @@ The default is | |||
568 | .Dq yes . | 710 | .Dq yes . |
569 | .It Cm Protocol | 711 | .It Cm Protocol |
570 | Specifies the protocol versions | 712 | Specifies the protocol versions |
571 | .Nm sshd | 713 | .Xr sshd 8 |
572 | supports. | 714 | supports. |
573 | The possible values are | 715 | The possible values are |
574 | .Dq 1 | 716 | .Sq 1 |
575 | and | 717 | and |
576 | .Dq 2 . | 718 | .Sq 2 . |
577 | Multiple versions must be comma-separated. | 719 | Multiple versions must be comma-separated. |
578 | The default is | 720 | The default is |
579 | .Dq 2,1 . | 721 | .Dq 2,1 . |
@@ -605,7 +747,7 @@ Defines the number of bits in the ephemeral protocol version 1 server key. | |||
605 | The minimum value is 512, and the default is 768. | 747 | The minimum value is 512, and the default is 768. |
606 | .It Cm StrictModes | 748 | .It Cm StrictModes |
607 | Specifies whether | 749 | Specifies whether |
608 | .Nm sshd | 750 | .Xr sshd 8 |
609 | should check file modes and ownership of the | 751 | should check file modes and ownership of the |
610 | user's files and home directory before accepting login. | 752 | user's files and home directory before accepting login. |
611 | This is normally desirable because novices sometimes accidentally leave their | 753 | This is normally desirable because novices sometimes accidentally leave their |
@@ -613,9 +755,9 @@ directory or files world-writable. | |||
613 | The default is | 755 | The default is |
614 | .Dq yes . | 756 | .Dq yes . |
615 | .It Cm Subsystem | 757 | .It Cm Subsystem |
616 | Configures an external subsystem (e.g., file transfer daemon). | 758 | Configures an external subsystem (e.g. file transfer daemon). |
617 | Arguments should be a subsystem name and a command to execute upon subsystem | 759 | Arguments should be a subsystem name and a command (with optional arguments) |
618 | request. | 760 | to execute upon subsystem request. |
619 | The command | 761 | The command |
620 | .Xr sftp-server 8 | 762 | .Xr sftp-server 8 |
621 | implements the | 763 | implements the |
@@ -625,7 +767,7 @@ By default no subsystems are defined. | |||
625 | Note that this option applies to protocol version 2 only. | 767 | Note that this option applies to protocol version 2 only. |
626 | .It Cm SyslogFacility | 768 | .It Cm SyslogFacility |
627 | Gives the facility code that is used when logging messages from | 769 | Gives the facility code that is used when logging messages from |
628 | .Nm sshd . | 770 | .Xr sshd 8 . |
629 | The possible values are: DAEMON, USER, AUTH, LOCAL0, LOCAL1, LOCAL2, | 771 | The possible values are: DAEMON, USER, AUTH, LOCAL0, LOCAL1, LOCAL2, |
630 | LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7. | 772 | LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7. |
631 | The default is AUTH. | 773 | The default is AUTH. |
@@ -655,7 +797,7 @@ This option was formerly called | |||
655 | .Cm KeepAlive . | 797 | .Cm KeepAlive . |
656 | .It Cm UseDNS | 798 | .It Cm UseDNS |
657 | Specifies whether | 799 | Specifies whether |
658 | .Nm sshd | 800 | .Xr sshd 8 |
659 | should look up the remote host name and check that | 801 | should look up the remote host name and check that |
660 | the resolved host name for the remote IP address maps back to the | 802 | the resolved host name for the remote IP address maps back to the |
661 | very same IP address. | 803 | very same IP address. |
@@ -686,7 +828,10 @@ If set to | |||
686 | .Dq yes | 828 | .Dq yes |
687 | this will enable PAM authentication using | 829 | this will enable PAM authentication using |
688 | .Cm ChallengeResponseAuthentication | 830 | .Cm ChallengeResponseAuthentication |
689 | and PAM account and session module processing for all authentication types. | 831 | and |
832 | .Cm PasswordAuthentication | ||
833 | in addition to PAM account and session module processing for all | ||
834 | authentication types. | ||
690 | .Pp | 835 | .Pp |
691 | Because PAM challenge-response authentication usually serves an equivalent | 836 | Because PAM challenge-response authentication usually serves an equivalent |
692 | role to password authentication, you should disable either | 837 | role to password authentication, you should disable either |
@@ -703,7 +848,7 @@ The default is | |||
703 | .Dq no . | 848 | .Dq no . |
704 | .It Cm UsePrivilegeSeparation | 849 | .It Cm UsePrivilegeSeparation |
705 | Specifies whether | 850 | Specifies whether |
706 | .Nm sshd | 851 | .Xr sshd 8 |
707 | separates privileges by creating an unprivileged child process | 852 | separates privileges by creating an unprivileged child process |
708 | to deal with incoming network traffic. | 853 | to deal with incoming network traffic. |
709 | After successful authentication, another process will be created that has | 854 | After successful authentication, another process will be created that has |
@@ -714,11 +859,9 @@ The default is | |||
714 | .Dq yes . | 859 | .Dq yes . |
715 | .It Cm X11DisplayOffset | 860 | .It Cm X11DisplayOffset |
716 | Specifies the first display number available for | 861 | Specifies the first display number available for |
717 | .Nm sshd Ns 's | 862 | .Xr sshd 8 Ns 's |
718 | X11 forwarding. | 863 | X11 forwarding. |
719 | This prevents | 864 | This prevents sshd from interfering with real X11 servers. |
720 | .Nm sshd | ||
721 | from interfering with real X11 servers. | ||
722 | The default is 10. | 865 | The default is 10. |
723 | .It Cm X11Forwarding | 866 | .It Cm X11Forwarding |
724 | Specifies whether X11 forwarding is permitted. | 867 | Specifies whether X11 forwarding is permitted. |
@@ -731,14 +874,14 @@ The default is | |||
731 | .Pp | 874 | .Pp |
732 | When X11 forwarding is enabled, there may be additional exposure to | 875 | When X11 forwarding is enabled, there may be additional exposure to |
733 | the server and to client displays if the | 876 | the server and to client displays if the |
734 | .Nm sshd | 877 | .Xr sshd 8 |
735 | proxy display is configured to listen on the wildcard address (see | 878 | proxy display is configured to listen on the wildcard address (see |
736 | .Cm X11UseLocalhost | 879 | .Cm X11UseLocalhost |
737 | below), however this is not the default. | 880 | below), though this is not the default. |
738 | Additionally, the authentication spoofing and authentication data | 881 | Additionally, the authentication spoofing and authentication data |
739 | verification and substitution occur on the client side. | 882 | verification and substitution occur on the client side. |
740 | The security risk of using X11 forwarding is that the client's X11 | 883 | The security risk of using X11 forwarding is that the client's X11 |
741 | display server may be exposed to attack when the ssh client requests | 884 | display server may be exposed to attack when the SSH client requests |
742 | forwarding (see the warnings for | 885 | forwarding (see the warnings for |
743 | .Cm ForwardX11 | 886 | .Cm ForwardX11 |
744 | in | 887 | in |
@@ -756,12 +899,11 @@ X11 forwarding is automatically disabled if | |||
756 | is enabled. | 899 | is enabled. |
757 | .It Cm X11UseLocalhost | 900 | .It Cm X11UseLocalhost |
758 | Specifies whether | 901 | Specifies whether |
759 | .Nm sshd | 902 | .Xr sshd 8 |
760 | should bind the X11 forwarding server to the loopback address or to | 903 | should bind the X11 forwarding server to the loopback address or to |
761 | the wildcard address. | 904 | the wildcard address. |
762 | By default, | 905 | By default, |
763 | .Nm sshd | 906 | sshd binds the forwarding server to the loopback address and sets the |
764 | binds the forwarding server to the loopback address and sets the | ||
765 | hostname part of the | 907 | hostname part of the |
766 | .Ev DISPLAY | 908 | .Ev DISPLAY |
767 | environment variable to | 909 | environment variable to |
@@ -787,8 +929,8 @@ program. | |||
787 | The default is | 929 | The default is |
788 | .Pa /usr/X11R6/bin/xauth . | 930 | .Pa /usr/X11R6/bin/xauth . |
789 | .El | 931 | .El |
790 | .Ss Time Formats | 932 | .Sh TIME FORMATS |
791 | .Nm sshd | 933 | .Xr sshd 8 |
792 | command-line arguments and configuration file options that specify time | 934 | command-line arguments and configuration file options that specify time |
793 | may be expressed using a sequence of the form: | 935 | may be expressed using a sequence of the form: |
794 | .Sm off | 936 | .Sm off |
@@ -801,7 +943,7 @@ is a positive integer value and | |||
801 | is one of the following: | 943 | is one of the following: |
802 | .Pp | 944 | .Pp |
803 | .Bl -tag -width Ds -compact -offset indent | 945 | .Bl -tag -width Ds -compact -offset indent |
804 | .It Cm <none> | 946 | .It Aq Cm none |
805 | seconds | 947 | seconds |
806 | .It Cm s | Cm S | 948 | .It Cm s | Cm S |
807 | seconds | 949 | seconds |
@@ -832,7 +974,7 @@ Time format examples: | |||
832 | .Bl -tag -width Ds | 974 | .Bl -tag -width Ds |
833 | .It Pa /etc/ssh/sshd_config | 975 | .It Pa /etc/ssh/sshd_config |
834 | Contains configuration data for | 976 | Contains configuration data for |
835 | .Nm sshd . | 977 | .Xr sshd 8 . |
836 | This file should be writable by root only, but it is recommended | 978 | This file should be writable by root only, but it is recommended |
837 | (though not necessary) that it be world-readable. | 979 | (though not necessary) that it be world-readable. |
838 | .El | 980 | .El |
diff --git a/sshlogin.c b/sshlogin.c index 15eb916d1..0059ff8d0 100644 --- a/sshlogin.c +++ b/sshlogin.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: sshlogin.c,v 1.25 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -39,7 +40,20 @@ | |||
39 | */ | 40 | */ |
40 | 41 | ||
41 | #include "includes.h" | 42 | #include "includes.h" |
42 | RCSID("$OpenBSD: sshlogin.c,v 1.13 2004/08/12 09:18:24 djm Exp $"); | 43 | |
44 | #include <sys/types.h> | ||
45 | #include <sys/param.h> | ||
46 | #include <sys/socket.h> | ||
47 | |||
48 | #include <netinet/in.h> | ||
49 | |||
50 | #include <errno.h> | ||
51 | #include <fcntl.h> | ||
52 | #include <stdarg.h> | ||
53 | #include <stdio.h> | ||
54 | #include <string.h> | ||
55 | #include <time.h> | ||
56 | #include <unistd.h> | ||
43 | 57 | ||
44 | #include "loginrec.h" | 58 | #include "loginrec.h" |
45 | #include "log.h" | 59 | #include "log.h" |
@@ -54,15 +68,15 @@ extern ServerOptions options; | |||
54 | * information is not available. This must be called before record_login. | 68 | * information is not available. This must be called before record_login. |
55 | * The host the user logged in from will be returned in buf. | 69 | * The host the user logged in from will be returned in buf. |
56 | */ | 70 | */ |
57 | u_long | 71 | time_t |
58 | get_last_login_time(uid_t uid, const char *logname, | 72 | get_last_login_time(uid_t uid, const char *logname, |
59 | char *buf, u_int bufsize) | 73 | char *buf, size_t bufsize) |
60 | { | 74 | { |
61 | struct logininfo li; | 75 | struct logininfo li; |
62 | 76 | ||
63 | login_get_lastlog(&li, uid); | 77 | login_get_lastlog(&li, uid); |
64 | strlcpy(buf, li.hostname, bufsize); | 78 | strlcpy(buf, li.hostname, bufsize); |
65 | return li.tv_sec; | 79 | return (time_t)li.tv_sec; |
66 | } | 80 | } |
67 | 81 | ||
68 | /* | 82 | /* |
@@ -103,7 +117,7 @@ store_lastlog_message(const char *user, uid_t uid) | |||
103 | */ | 117 | */ |
104 | void | 118 | void |
105 | record_login(pid_t pid, const char *tty, const char *user, uid_t uid, | 119 | record_login(pid_t pid, const char *tty, const char *user, uid_t uid, |
106 | const char *host, struct sockaddr * addr, socklen_t addrlen) | 120 | const char *host, struct sockaddr *addr, socklen_t addrlen) |
107 | { | 121 | { |
108 | struct logininfo *li; | 122 | struct logininfo *li; |
109 | 123 | ||
@@ -119,7 +133,7 @@ record_login(pid_t pid, const char *tty, const char *user, uid_t uid, | |||
119 | #ifdef LOGIN_NEEDS_UTMPX | 133 | #ifdef LOGIN_NEEDS_UTMPX |
120 | void | 134 | void |
121 | record_utmp_only(pid_t pid, const char *ttyname, const char *user, | 135 | record_utmp_only(pid_t pid, const char *ttyname, const char *user, |
122 | const char *host, struct sockaddr * addr, socklen_t addrlen) | 136 | const char *host, struct sockaddr *addr, socklen_t addrlen) |
123 | { | 137 | { |
124 | struct logininfo *li; | 138 | struct logininfo *li; |
125 | 139 | ||
diff --git a/sshlogin.h b/sshlogin.h index 1c8bfad32..500d3fefd 100644 --- a/sshlogin.h +++ b/sshlogin.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshlogin.h,v 1.4 2002/08/29 15:57:25 stevesk Exp $ */ | 1 | /* $OpenBSD: sshlogin.h,v 1.8 2006/08/03 03:34:42 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -11,18 +11,13 @@ | |||
11 | * incompatible with the protocol description in the RFC file, it must be | 11 | * incompatible with the protocol description in the RFC file, it must be |
12 | * called by a name other than "ssh" or "Secure Shell". | 12 | * called by a name other than "ssh" or "Secure Shell". |
13 | */ | 13 | */ |
14 | #ifndef SSHLOGIN_H | ||
15 | #define SSHLOGIN_H | ||
16 | 14 | ||
17 | void | 15 | void record_login(pid_t, const char *, const char *, uid_t, |
18 | record_login(pid_t, const char *, const char *, uid_t, | ||
19 | const char *, struct sockaddr *, socklen_t); | 16 | const char *, struct sockaddr *, socklen_t); |
20 | void record_logout(pid_t, const char *, const char *); | 17 | void record_logout(pid_t, const char *, const char *); |
21 | u_long get_last_login_time(uid_t, const char *, char *, u_int); | 18 | time_t get_last_login_time(uid_t, const char *, char *, u_int); |
22 | 19 | ||
23 | #ifdef LOGIN_NEEDS_UTMPX | 20 | #ifdef LOGIN_NEEDS_UTMPX |
24 | void record_utmp_only(pid_t, const char *, const char *, const char *, | 21 | void record_utmp_only(pid_t, const char *, const char *, const char *, |
25 | struct sockaddr *, socklen_t); | 22 | struct sockaddr *, socklen_t); |
26 | #endif | 23 | #endif |
27 | |||
28 | #endif | ||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: sshpty.c,v 1.26 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -12,18 +13,31 @@ | |||
12 | */ | 13 | */ |
13 | 14 | ||
14 | #include "includes.h" | 15 | #include "includes.h" |
15 | RCSID("$OpenBSD: sshpty.c,v 1.12 2004/06/21 17:36:31 avsm Exp $"); | ||
16 | 16 | ||
17 | #include <sys/types.h> | ||
18 | #include <sys/ioctl.h> | ||
19 | #include <sys/stat.h> | ||
20 | #include <signal.h> | ||
21 | |||
22 | #include <errno.h> | ||
23 | #include <fcntl.h> | ||
24 | #include <grp.h> | ||
25 | #ifdef HAVE_PATHS_H | ||
26 | # include <paths.h> | ||
27 | #endif | ||
28 | #include <pwd.h> | ||
29 | #include <stdarg.h> | ||
30 | #include <string.h> | ||
31 | #include <termios.h> | ||
17 | #ifdef HAVE_UTIL_H | 32 | #ifdef HAVE_UTIL_H |
18 | # include <util.h> | 33 | # include <util.h> |
19 | #endif /* HAVE_UTIL_H */ | 34 | #endif |
35 | #include <unistd.h> | ||
20 | 36 | ||
21 | #include "sshpty.h" | 37 | #include "sshpty.h" |
22 | #include "log.h" | 38 | #include "log.h" |
23 | #include "misc.h" | 39 | #include "misc.h" |
24 | 40 | ||
25 | #include "selinux.h" | ||
26 | |||
27 | #ifdef HAVE_PTY_H | 41 | #ifdef HAVE_PTY_H |
28 | # include <pty.h> | 42 | # include <pty.h> |
29 | #endif | 43 | #endif |
@@ -40,7 +54,7 @@ RCSID("$OpenBSD: sshpty.c,v 1.12 2004/06/21 17:36:31 avsm Exp $"); | |||
40 | */ | 54 | */ |
41 | 55 | ||
42 | int | 56 | int |
43 | pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen) | 57 | pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, size_t namebuflen) |
44 | { | 58 | { |
45 | /* openpty(3) exists in OSF/1 and some other os'es */ | 59 | /* openpty(3) exists in OSF/1 and some other os'es */ |
46 | char *name; | 60 | char *name; |
@@ -163,11 +177,12 @@ pty_make_controlling_tty(int *ttyfd, const char *tty) | |||
163 | /* Changes the window size associated with the pty. */ | 177 | /* Changes the window size associated with the pty. */ |
164 | 178 | ||
165 | void | 179 | void |
166 | pty_change_window_size(int ptyfd, int row, int col, | 180 | pty_change_window_size(int ptyfd, u_int row, u_int col, |
167 | int xpixel, int ypixel) | 181 | u_int xpixel, u_int ypixel) |
168 | { | 182 | { |
169 | struct winsize w; | 183 | struct winsize w; |
170 | 184 | ||
185 | /* may truncate u_int -> u_short */ | ||
171 | w.ws_row = row; | 186 | w.ws_row = row; |
172 | w.ws_col = col; | 187 | w.ws_col = col; |
173 | w.ws_xpixel = xpixel; | 188 | w.ws_xpixel = xpixel; |
@@ -202,7 +217,9 @@ pty_setowner(struct passwd *pw, const char *tty) | |||
202 | fatal("stat(%.100s) failed: %.100s", tty, | 217 | fatal("stat(%.100s) failed: %.100s", tty, |
203 | strerror(errno)); | 218 | strerror(errno)); |
204 | 219 | ||
205 | setup_selinux_pty(pw->pw_name, tty); | 220 | #ifdef WITH_SELINUX |
221 | ssh_selinux_setup_pty(pw->pw_name, tty); | ||
222 | #endif | ||
206 | 223 | ||
207 | if (st.st_uid != pw->pw_uid || st.st_gid != gid) { | 224 | if (st.st_uid != pw->pw_uid || st.st_gid != gid) { |
208 | if (chown(tty, pw->pw_uid, gid) < 0) { | 225 | if (chown(tty, pw->pw_uid, gid) < 0) { |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshpty.h,v 1.5 2004/05/08 00:01:37 deraadt Exp $ */ | 1 | /* $OpenBSD: sshpty.h,v 1.10 2006/08/03 03:34:42 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -14,17 +14,14 @@ | |||
14 | * called by a name other than "ssh" or "Secure Shell". | 14 | * called by a name other than "ssh" or "Secure Shell". |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #ifndef SSHPTY_H | 17 | #include <termios.h> |
18 | #define SSHPTY_H | ||
19 | 18 | ||
20 | struct termios get_saved_tio(void); | 19 | struct termios get_saved_tio(void); |
21 | void leave_raw_mode(void); | 20 | void leave_raw_mode(void); |
22 | void enter_raw_mode(void); | 21 | void enter_raw_mode(void); |
23 | 22 | ||
24 | int pty_allocate(int *, int *, char *, int); | 23 | int pty_allocate(int *, int *, char *, size_t); |
25 | void pty_release(const char *); | 24 | void pty_release(const char *); |
26 | void pty_make_controlling_tty(int *, const char *); | 25 | void pty_make_controlling_tty(int *, const char *); |
27 | void pty_change_window_size(int, int, int, int, int); | 26 | void pty_change_window_size(int, u_int, u_int, u_int, u_int); |
28 | void pty_setowner(struct passwd *, const char *); | 27 | void pty_setowner(struct passwd *, const char *); |
29 | |||
30 | #endif /* SSHPTY_H */ | ||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: sshtty.c,v 1.12 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -35,10 +36,13 @@ | |||
35 | */ | 36 | */ |
36 | 37 | ||
37 | #include "includes.h" | 38 | #include "includes.h" |
38 | RCSID("$OpenBSD: sshtty.c,v 1.6 2004/05/08 00:01:37 deraadt Exp $"); | 39 | |
40 | #include <sys/types.h> | ||
41 | #include <stdio.h> | ||
42 | #include <termios.h> | ||
43 | #include <pwd.h> | ||
39 | 44 | ||
40 | #include "sshpty.h" | 45 | #include "sshpty.h" |
41 | #include "log.h" | ||
42 | 46 | ||
43 | static struct termios _saved_tio; | 47 | static struct termios _saved_tio; |
44 | static int _in_raw_mode = 0; | 48 | static int _in_raw_mode = 0; |
diff --git a/ttymodes.c b/ttymodes.c index cf4c7d5c6..d8e2c553a 100644 --- a/ttymodes.c +++ b/ttymodes.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: ttymodes.c,v 1.26 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -43,14 +44,19 @@ | |||
43 | */ | 44 | */ |
44 | 45 | ||
45 | #include "includes.h" | 46 | #include "includes.h" |
46 | RCSID("$OpenBSD: ttymodes.c,v 1.19 2003/04/08 20:21:29 itojun Exp $"); | 47 | |
48 | #include <sys/types.h> | ||
49 | |||
50 | #include <errno.h> | ||
51 | #include <string.h> | ||
52 | #include <termios.h> | ||
53 | #include <stdarg.h> | ||
47 | 54 | ||
48 | #include "packet.h" | 55 | #include "packet.h" |
49 | #include "log.h" | 56 | #include "log.h" |
50 | #include "ssh1.h" | 57 | #include "ssh1.h" |
51 | #include "compat.h" | 58 | #include "compat.h" |
52 | #include "buffer.h" | 59 | #include "buffer.h" |
53 | #include "bufaux.h" | ||
54 | 60 | ||
55 | #define TTY_OP_END 0 | 61 | #define TTY_OP_END 0 |
56 | /* | 62 | /* |
@@ -384,7 +390,8 @@ tty_parse_modes(int fd, int *n_bytes_ptr) | |||
384 | n_bytes += 4; | 390 | n_bytes += 4; |
385 | baud = packet_get_int(); | 391 | baud = packet_get_int(); |
386 | debug3("tty_parse_modes: ispeed %d", baud); | 392 | debug3("tty_parse_modes: ispeed %d", baud); |
387 | if (failure != -1 && cfsetispeed(&tio, baud_to_speed(baud)) == -1) | 393 | if (failure != -1 && |
394 | cfsetispeed(&tio, baud_to_speed(baud)) == -1) | ||
388 | error("cfsetispeed failed for %d", baud); | 395 | error("cfsetispeed failed for %d", baud); |
389 | break; | 396 | break; |
390 | 397 | ||
@@ -394,7 +401,8 @@ tty_parse_modes(int fd, int *n_bytes_ptr) | |||
394 | n_bytes += 4; | 401 | n_bytes += 4; |
395 | baud = packet_get_int(); | 402 | baud = packet_get_int(); |
396 | debug3("tty_parse_modes: ospeed %d", baud); | 403 | debug3("tty_parse_modes: ospeed %d", baud); |
397 | if (failure != -1 && cfsetospeed(&tio, baud_to_speed(baud)) == -1) | 404 | if (failure != -1 && |
405 | cfsetospeed(&tio, baud_to_speed(baud)) == -1) | ||
398 | error("cfsetospeed failed for %d", baud); | 406 | error("cfsetospeed failed for %d", baud); |
399 | break; | 407 | break; |
400 | 408 | ||
@@ -442,11 +450,12 @@ tty_parse_modes(int fd, int *n_bytes_ptr) | |||
442 | /* | 450 | /* |
443 | * It is a truly undefined opcode (160 to 255). | 451 | * It is a truly undefined opcode (160 to 255). |
444 | * We have no idea about its arguments. So we | 452 | * We have no idea about its arguments. So we |
445 | * must stop parsing. Note that some data may be | 453 | * must stop parsing. Note that some data |
446 | * left in the packet; hopefully there is nothing | 454 | * may be left in the packet; hopefully there |
447 | * more coming after the mode data. | 455 | * is nothing more coming after the mode data. |
448 | */ | 456 | */ |
449 | logit("parse_tty_modes: unknown opcode %d", opcode); | 457 | logit("parse_tty_modes: unknown opcode %d", |
458 | opcode); | ||
450 | goto set; | 459 | goto set; |
451 | } | 460 | } |
452 | } else { | 461 | } else { |
@@ -462,7 +471,8 @@ tty_parse_modes(int fd, int *n_bytes_ptr) | |||
462 | (void) packet_get_int(); | 471 | (void) packet_get_int(); |
463 | break; | 472 | break; |
464 | } else { | 473 | } else { |
465 | logit("parse_tty_modes: unknown opcode %d", opcode); | 474 | logit("parse_tty_modes: unknown opcode %d", |
475 | opcode); | ||
466 | goto set; | 476 | goto set; |
467 | } | 477 | } |
468 | } | 478 | } |
diff --git a/ttymodes.h b/ttymodes.h index 481282cd7..4d848fe3a 100644 --- a/ttymodes.h +++ b/ttymodes.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ttymodes.h,v 1.13 2004/07/11 17:48:47 deraadt Exp $ */ | 1 | /* $OpenBSD: ttymodes.h,v 1.14 2006/03/25 22:22:43 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: uidswap.c,v 1.35 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -12,7 +13,15 @@ | |||
12 | */ | 13 | */ |
13 | 14 | ||
14 | #include "includes.h" | 15 | #include "includes.h" |
15 | RCSID("$OpenBSD: uidswap.c,v 1.24 2003/05/29 16:58:45 deraadt Exp $"); | 16 | |
17 | #include <sys/param.h> | ||
18 | #include <errno.h> | ||
19 | #include <pwd.h> | ||
20 | #include <string.h> | ||
21 | #include <unistd.h> | ||
22 | #include <stdarg.h> | ||
23 | |||
24 | #include <grp.h> | ||
16 | 25 | ||
17 | #include "log.h" | 26 | #include "log.h" |
18 | #include "uidswap.h" | 27 | #include "uidswap.h" |
@@ -77,7 +86,7 @@ temporarily_use_uid(struct passwd *pw) | |||
77 | fatal("getgroups: %.100s", strerror(errno)); | 86 | fatal("getgroups: %.100s", strerror(errno)); |
78 | if (saved_egroupslen > 0) { | 87 | if (saved_egroupslen > 0) { |
79 | saved_egroups = xrealloc(saved_egroups, | 88 | saved_egroups = xrealloc(saved_egroups, |
80 | saved_egroupslen * sizeof(gid_t)); | 89 | saved_egroupslen, sizeof(gid_t)); |
81 | if (getgroups(saved_egroupslen, saved_egroups) < 0) | 90 | if (getgroups(saved_egroupslen, saved_egroups) < 0) |
82 | fatal("getgroups: %.100s", strerror(errno)); | 91 | fatal("getgroups: %.100s", strerror(errno)); |
83 | } else { /* saved_egroupslen == 0 */ | 92 | } else { /* saved_egroupslen == 0 */ |
@@ -96,7 +105,7 @@ temporarily_use_uid(struct passwd *pw) | |||
96 | fatal("getgroups: %.100s", strerror(errno)); | 105 | fatal("getgroups: %.100s", strerror(errno)); |
97 | if (user_groupslen > 0) { | 106 | if (user_groupslen > 0) { |
98 | user_groups = xrealloc(user_groups, | 107 | user_groups = xrealloc(user_groups, |
99 | user_groupslen * sizeof(gid_t)); | 108 | user_groupslen, sizeof(gid_t)); |
100 | if (getgroups(user_groupslen, user_groups) < 0) | 109 | if (getgroups(user_groupslen, user_groups) < 0) |
101 | fatal("getgroups: %.100s", strerror(errno)); | 110 | fatal("getgroups: %.100s", strerror(errno)); |
102 | } else { /* user_groupslen == 0 */ | 111 | } else { /* user_groupslen == 0 */ |
@@ -123,6 +132,41 @@ temporarily_use_uid(struct passwd *pw) | |||
123 | strerror(errno)); | 132 | strerror(errno)); |
124 | } | 133 | } |
125 | 134 | ||
135 | void | ||
136 | permanently_drop_suid(uid_t uid) | ||
137 | { | ||
138 | uid_t old_uid = getuid(); | ||
139 | |||
140 | debug("permanently_drop_suid: %u", (u_int)uid); | ||
141 | #if defined(HAVE_SETRESUID) && !defined(BROKEN_SETRESUID) | ||
142 | if (setresuid(uid, uid, uid) < 0) | ||
143 | fatal("setresuid %u: %.100s", (u_int)uid, strerror(errno)); | ||
144 | #elif defined(HAVE_SETREUID) && !defined(BROKEN_SETREUID) | ||
145 | if (setreuid(uid, uid) < 0) | ||
146 | fatal("setreuid %u: %.100s", (u_int)uid, strerror(errno)); | ||
147 | #else | ||
148 | # ifndef SETEUID_BREAKS_SETUID | ||
149 | if (seteuid(uid) < 0) | ||
150 | fatal("seteuid %u: %.100s", (u_int)uid, strerror(errno)); | ||
151 | # endif | ||
152 | if (setuid(uid) < 0) | ||
153 | fatal("setuid %u: %.100s", (u_int)uid, strerror(errno)); | ||
154 | #endif | ||
155 | |||
156 | #ifndef HAVE_CYGWIN | ||
157 | /* Try restoration of UID if changed (test clearing of saved uid) */ | ||
158 | if (old_uid != uid && | ||
159 | (setuid(old_uid) != -1 || seteuid(old_uid) != -1)) | ||
160 | fatal("%s: was able to restore old [e]uid", __func__); | ||
161 | #endif | ||
162 | |||
163 | /* Verify UID drop was successful */ | ||
164 | if (getuid() != uid || geteuid() != uid) { | ||
165 | fatal("%s: euid incorrect uid:%u euid:%u (should be %u)", | ||
166 | __func__, (u_int)getuid(), (u_int)geteuid(), (u_int)uid); | ||
167 | } | ||
168 | } | ||
169 | |||
126 | /* | 170 | /* |
127 | * Restores to the original (privileged) uid. | 171 | * Restores to the original (privileged) uid. |
128 | */ | 172 | */ |
@@ -169,6 +213,8 @@ permanently_set_uid(struct passwd *pw) | |||
169 | uid_t old_uid = getuid(); | 213 | uid_t old_uid = getuid(); |
170 | gid_t old_gid = getgid(); | 214 | gid_t old_gid = getgid(); |
171 | 215 | ||
216 | if (pw == NULL) | ||
217 | fatal("permanently_set_uid: no user given"); | ||
172 | if (temporarily_use_uid_effective) | 218 | if (temporarily_use_uid_effective) |
173 | fatal("permanently_set_uid: temporarily_use_uid effective"); | 219 | fatal("permanently_set_uid: temporarily_use_uid effective"); |
174 | debug("permanently_set_uid: %u/%u", (u_int)pw->pw_uid, | 220 | debug("permanently_set_uid: %u/%u", (u_int)pw->pw_uid, |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: uidswap.h,v 1.9 2001/06/26 17:27:25 markus Exp $ */ | 1 | /* $OpenBSD: uidswap.h,v 1.13 2006/08/03 03:34:42 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -12,11 +12,7 @@ | |||
12 | * called by a name other than "ssh" or "Secure Shell". | 12 | * called by a name other than "ssh" or "Secure Shell". |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #ifndef UIDSWAP_H | ||
16 | #define UIDSWAP_H | ||
17 | |||
18 | void temporarily_use_uid(struct passwd *); | 15 | void temporarily_use_uid(struct passwd *); |
19 | void restore_uid(void); | 16 | void restore_uid(void); |
20 | void permanently_set_uid(struct passwd *); | 17 | void permanently_set_uid(struct passwd *); |
21 | 18 | void permanently_drop_suid(uid_t); | |
22 | #endif /* UIDSWAP_H */ | ||
diff --git a/uuencode.c b/uuencode.c index 0a7c8d16a..a13949585 100644 --- a/uuencode.c +++ b/uuencode.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: uuencode.c,v 1.24 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
3 | * | 4 | * |
@@ -23,7 +24,11 @@ | |||
23 | */ | 24 | */ |
24 | 25 | ||
25 | #include "includes.h" | 26 | #include "includes.h" |
26 | RCSID("$OpenBSD: uuencode.c,v 1.17 2003/11/10 16:23:41 jakob Exp $"); | 27 | |
28 | #include <sys/types.h> | ||
29 | #include <netinet/in.h> | ||
30 | #include <resolv.h> | ||
31 | #include <stdio.h> | ||
27 | 32 | ||
28 | #include "xmalloc.h" | 33 | #include "xmalloc.h" |
29 | #include "uuencode.h" | 34 | #include "uuencode.h" |
@@ -58,9 +63,14 @@ uudecode(const char *src, u_char *target, size_t targsize) | |||
58 | void | 63 | void |
59 | dump_base64(FILE *fp, u_char *data, u_int len) | 64 | dump_base64(FILE *fp, u_char *data, u_int len) |
60 | { | 65 | { |
61 | char *buf = xmalloc(2*len); | 66 | char *buf; |
62 | int i, n; | 67 | int i, n; |
63 | 68 | ||
69 | if (len > 65536) { | ||
70 | fprintf(fp, "dump_base64: len > 65536\n"); | ||
71 | return; | ||
72 | } | ||
73 | buf = xmalloc(2*len); | ||
64 | n = uuencode(data, len, buf, 2*len); | 74 | n = uuencode(data, len, buf, 2*len); |
65 | for (i = 0; i < n; i++) { | 75 | for (i = 0; i < n; i++) { |
66 | fprintf(fp, "%c", buf[i]); | 76 | fprintf(fp, "%c", buf[i]); |
diff --git a/uuencode.h b/uuencode.h index 08e87c4bc..fec55b491 100644 --- a/uuencode.h +++ b/uuencode.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: uuencode.h,v 1.10 2003/11/10 16:23:41 jakob Exp $ */ | 1 | /* $OpenBSD: uuencode.h,v 1.13 2006/08/03 03:34:42 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
@@ -24,9 +24,6 @@ | |||
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #ifndef UUENCODE_H | ||
28 | #define UUENCODE_H | ||
29 | int uuencode(const u_char *, u_int, char *, size_t); | 27 | int uuencode(const u_char *, u_int, char *, size_t); |
30 | int uudecode(const char *, u_char *, size_t); | 28 | int uudecode(const char *, u_char *, size_t); |
31 | void dump_base64(FILE *, u_char *, u_int); | 29 | void dump_base64(FILE *, u_char *, u_int); |
32 | #endif | ||
@@ -1,8 +1,8 @@ | |||
1 | /* $OpenBSD: version.h,v 1.46 2006/02/01 11:27:22 markus Exp $ */ | 1 | /* $OpenBSD: version.h,v 1.49 2007/03/06 10:13:14 djm Exp $ */ |
2 | 2 | ||
3 | #define SSH_VERSION "OpenSSH_4.3" | 3 | #define SSH_VERSION "OpenSSH_4.6" |
4 | 4 | ||
5 | #define SSH_PORTABLE "p2" | 5 | #define SSH_PORTABLE "p1" |
6 | #ifndef SSH_EXTRAVERSION | 6 | #ifndef SSH_EXTRAVERSION |
7 | #define SSH_EXTRAVERSION | 7 | #define SSH_EXTRAVERSION |
8 | #endif | 8 | #endif |
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: xmalloc.c,v 1.27 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -13,7 +14,12 @@ | |||
13 | */ | 14 | */ |
14 | 15 | ||
15 | #include "includes.h" | 16 | #include "includes.h" |
16 | RCSID("$OpenBSD: xmalloc.c,v 1.16 2001/07/23 18:21:46 stevesk Exp $"); | 17 | |
18 | #include <sys/param.h> | ||
19 | #include <stdarg.h> | ||
20 | #include <stdio.h> | ||
21 | #include <stdlib.h> | ||
22 | #include <string.h> | ||
17 | 23 | ||
18 | #include "xmalloc.h" | 24 | #include "xmalloc.h" |
19 | #include "log.h" | 25 | #include "log.h" |
@@ -32,18 +38,38 @@ xmalloc(size_t size) | |||
32 | } | 38 | } |
33 | 39 | ||
34 | void * | 40 | void * |
35 | xrealloc(void *ptr, size_t new_size) | 41 | xcalloc(size_t nmemb, size_t size) |
42 | { | ||
43 | void *ptr; | ||
44 | |||
45 | if (size == 0 || nmemb == 0) | ||
46 | fatal("xcalloc: zero size"); | ||
47 | if (SIZE_T_MAX / nmemb < size) | ||
48 | fatal("xcalloc: nmemb * size > SIZE_T_MAX"); | ||
49 | ptr = calloc(nmemb, size); | ||
50 | if (ptr == NULL) | ||
51 | fatal("xcalloc: out of memory (allocating %lu bytes)", | ||
52 | (u_long)(size * nmemb)); | ||
53 | return ptr; | ||
54 | } | ||
55 | |||
56 | void * | ||
57 | xrealloc(void *ptr, size_t nmemb, size_t size) | ||
36 | { | 58 | { |
37 | void *new_ptr; | 59 | void *new_ptr; |
60 | size_t new_size = nmemb * size; | ||
38 | 61 | ||
39 | if (new_size == 0) | 62 | if (new_size == 0) |
40 | fatal("xrealloc: zero size"); | 63 | fatal("xrealloc: zero size"); |
64 | if (SIZE_T_MAX / nmemb < size) | ||
65 | fatal("xrealloc: nmemb * size > SIZE_T_MAX"); | ||
41 | if (ptr == NULL) | 66 | if (ptr == NULL) |
42 | new_ptr = malloc(new_size); | 67 | new_ptr = malloc(new_size); |
43 | else | 68 | else |
44 | new_ptr = realloc(ptr, new_size); | 69 | new_ptr = realloc(ptr, new_size); |
45 | if (new_ptr == NULL) | 70 | if (new_ptr == NULL) |
46 | fatal("xrealloc: out of memory (new_size %lu bytes)", (u_long) new_size); | 71 | fatal("xrealloc: out of memory (new_size %lu bytes)", |
72 | (u_long) new_size); | ||
47 | return new_ptr; | 73 | return new_ptr; |
48 | } | 74 | } |
49 | 75 | ||
@@ -66,3 +92,19 @@ xstrdup(const char *str) | |||
66 | strlcpy(cp, str, len); | 92 | strlcpy(cp, str, len); |
67 | return cp; | 93 | return cp; |
68 | } | 94 | } |
95 | |||
96 | int | ||
97 | xasprintf(char **ret, const char *fmt, ...) | ||
98 | { | ||
99 | va_list ap; | ||
100 | int i; | ||
101 | |||
102 | va_start(ap, fmt); | ||
103 | i = vasprintf(ret, fmt, ap); | ||
104 | va_end(ap); | ||
105 | |||
106 | if (i < 0 || *ret == NULL) | ||
107 | fatal("xasprintf: could not allocate memory"); | ||
108 | |||
109 | return (i); | ||
110 | } | ||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: xmalloc.h,v 1.9 2002/06/19 00:27:55 deraadt Exp $ */ | 1 | /* $OpenBSD: xmalloc.h,v 1.13 2006/08/03 03:34:42 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -16,12 +16,11 @@ | |||
16 | * called by a name other than "ssh" or "Secure Shell". | 16 | * called by a name other than "ssh" or "Secure Shell". |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #ifndef XMALLOC_H | ||
20 | #define XMALLOC_H | ||
21 | |||
22 | void *xmalloc(size_t); | 19 | void *xmalloc(size_t); |
23 | void *xrealloc(void *, size_t); | 20 | void *xcalloc(size_t, size_t); |
21 | void *xrealloc(void *, size_t, size_t); | ||
24 | void xfree(void *); | 22 | void xfree(void *); |
25 | char *xstrdup(const char *); | 23 | char *xstrdup(const char *); |
26 | 24 | int xasprintf(char **, const char *, ...) | |
27 | #endif /* XMALLOC_H */ | 25 | __attribute__((__format__ (printf, 2, 3))) |
26 | __attribute__((__nonnull__ (2))); | ||