diff options
author | Damien Miller <djm@mindrot.org> | 2000-04-16 11:18:38 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2000-04-16 11:18:38 +1000 |
commit | 4af51306d9a51459a5bef922df1037f876ae51fe (patch) | |
tree | 09ecfc215fce82345a3259f8a0f384b9a67906f0 | |
parent | 5d1705ecf9bd3216dc99a84242bcdf2e7297d307 (diff) |
- OpenBSD CVS updates.
[ssh.1 ssh.c]
- ssh -2
[auth.c channels.c clientloop.c packet.c packet.h serverloop.c]
[session.c sshconnect.c]
- check payload for (illegal) extra data
[ALL]
- whitespace cleanup
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | auth-krb4.c | 10 | ||||
-rw-r--r-- | auth-passwd.c | 4 | ||||
-rw-r--r-- | auth-rh-rsa.c | 14 | ||||
-rw-r--r-- | auth-rhosts.c | 18 | ||||
-rw-r--r-- | auth-rsa.c | 16 | ||||
-rw-r--r-- | auth-skey.c | 18 | ||||
-rw-r--r-- | auth.c | 62 | ||||
-rw-r--r-- | authfd.c | 24 | ||||
-rw-r--r-- | authfd.h | 22 | ||||
-rw-r--r-- | authfile.c | 14 | ||||
-rw-r--r-- | bufaux.c | 12 | ||||
-rw-r--r-- | bufaux.h | 12 | ||||
-rw-r--r-- | buffer.c | 34 | ||||
-rw-r--r-- | canohost.c | 20 | ||||
-rw-r--r-- | channels.c | 94 | ||||
-rw-r--r-- | channels.h | 6 | ||||
-rw-r--r-- | cipher.c | 34 | ||||
-rw-r--r-- | cipher.h | 24 | ||||
-rw-r--r-- | clientloop.c | 59 | ||||
-rw-r--r-- | compat.c | 6 | ||||
-rw-r--r-- | compress.c | 22 | ||||
-rw-r--r-- | compress.h | 14 | ||||
-rw-r--r-- | crc32.h | 14 | ||||
-rw-r--r-- | dispatch.c | 78 | ||||
-rw-r--r-- | dsa.c | 10 | ||||
-rw-r--r-- | getput.h | 16 | ||||
-rw-r--r-- | hostfile.c | 14 | ||||
-rw-r--r-- | hostfile.h | 2 | ||||
-rw-r--r-- | includes.h | 12 | ||||
-rw-r--r-- | kex.c | 12 | ||||
-rw-r--r-- | log-client.c | 14 | ||||
-rw-r--r-- | log-server.c | 16 | ||||
-rw-r--r-- | login.c | 20 | ||||
-rw-r--r-- | match.c | 16 | ||||
-rw-r--r-- | mpaux.c | 14 | ||||
-rw-r--r-- | mpaux.h | 14 | ||||
-rw-r--r-- | nchan.c | 6 | ||||
-rw-r--r-- | packet.c | 32 | ||||
-rw-r--r-- | packet.h | 29 | ||||
-rw-r--r-- | pty.c | 22 | ||||
-rw-r--r-- | pty.h | 14 | ||||
-rw-r--r-- | radix.c | 12 | ||||
-rw-r--r-- | readconf.c | 26 | ||||
-rw-r--r-- | readconf.h | 22 | ||||
-rw-r--r-- | readpass.c | 4 | ||||
-rw-r--r-- | rsa.c | 30 | ||||
-rw-r--r-- | rsa.h | 14 | ||||
-rw-r--r-- | scp.c | 20 | ||||
-rw-r--r-- | servconf.c | 24 | ||||
-rw-r--r-- | servconf.h | 14 | ||||
-rw-r--r-- | serverloop.c | 46 | ||||
-rw-r--r-- | session.c | 25 | ||||
-rw-r--r-- | ssh-agent.c | 10 | ||||
-rw-r--r-- | ssh-keygen.c | 4 | ||||
-rw-r--r-- | ssh.1 | 8 | ||||
-rw-r--r-- | ssh.c | 42 | ||||
-rw-r--r-- | ssh.h | 30 | ||||
-rw-r--r-- | ssh2.h | 20 | ||||
-rw-r--r-- | sshconnect.c | 56 | ||||
-rw-r--r-- | sshd.c | 54 | ||||
-rw-r--r-- | ttymodes.c | 10 | ||||
-rw-r--r-- | ttymodes.h | 12 | ||||
-rw-r--r-- | uidswap.c | 8 | ||||
-rw-r--r-- | uidswap.h | 10 | ||||
-rw-r--r-- | xmalloc.c | 4 | ||||
-rw-r--r-- | xmalloc.h | 14 |
67 files changed, 779 insertions, 646 deletions
@@ -1,7 +1,17 @@ | |||
1 | 20000415 | ||
2 | - OpenBSD CVS updates. | ||
3 | [ssh.1 ssh.c] | ||
4 | - ssh -2 | ||
5 | [auth.c channels.c clientloop.c packet.c packet.h serverloop.c] | ||
6 | [session.c sshconnect.c] | ||
7 | - check payload for (illegal) extra data | ||
8 | [ALL] | ||
9 | whitespace cleanup | ||
10 | |||
1 | 20000413 | 11 | 20000413 |
2 | - INSTALL doc updates | 12 | - INSTALL doc updates |
3 | - Merged OpenBSD updates to include paths. | 13 | - Merged OpenBSD updates to include paths. |
4 | 14 | ||
5 | 20000412 | 15 | 20000412 |
6 | - OpenBSD CVS updates: | 16 | - OpenBSD CVS updates: |
7 | - [channels.c] | 17 | - [channels.c] |
diff --git a/auth-krb4.c b/auth-krb4.c index 7e30646f8..a26842713 100644 --- a/auth-krb4.c +++ b/auth-krb4.c | |||
@@ -19,7 +19,7 @@ extern ServerOptions options; | |||
19 | * return 1 on success, 0 on failure, -1 if krb4 is not available | 19 | * return 1 on success, 0 on failure, -1 if krb4 is not available |
20 | */ | 20 | */ |
21 | 21 | ||
22 | int | 22 | int |
23 | auth_krb4_password(struct passwd * pw, const char *password) | 23 | auth_krb4_password(struct passwd * pw, const char *password) |
24 | { | 24 | { |
25 | AUTH_DAT adata; | 25 | AUTH_DAT adata; |
@@ -135,7 +135,7 @@ krb4_cleanup_proc(void *ignore) | |||
135 | } | 135 | } |
136 | } | 136 | } |
137 | 137 | ||
138 | int | 138 | int |
139 | krb4_init(uid_t uid) | 139 | krb4_init(uid_t uid) |
140 | { | 140 | { |
141 | static int cleanup_registered = 0; | 141 | static int cleanup_registered = 0; |
@@ -179,7 +179,7 @@ krb4_init(uid_t uid) | |||
179 | return 0; | 179 | return 0; |
180 | } | 180 | } |
181 | 181 | ||
182 | int | 182 | int |
183 | auth_krb4(const char *server_user, KTEXT auth, char **client) | 183 | auth_krb4(const char *server_user, KTEXT auth, char **client) |
184 | { | 184 | { |
185 | AUTH_DAT adat = {0}; | 185 | AUTH_DAT adat = {0}; |
@@ -252,7 +252,7 @@ auth_krb4(const char *server_user, KTEXT auth, char **client) | |||
252 | #endif /* KRB4 */ | 252 | #endif /* KRB4 */ |
253 | 253 | ||
254 | #ifdef AFS | 254 | #ifdef AFS |
255 | int | 255 | int |
256 | auth_kerberos_tgt(struct passwd *pw, const char *string) | 256 | auth_kerberos_tgt(struct passwd *pw, const char *string) |
257 | { | 257 | { |
258 | CREDENTIALS creds; | 258 | CREDENTIALS creds; |
@@ -307,7 +307,7 @@ auth_kerberos_tgt_failure: | |||
307 | return 0; | 307 | return 0; |
308 | } | 308 | } |
309 | 309 | ||
310 | int | 310 | int |
311 | auth_afs_token(struct passwd *pw, const char *token_string) | 311 | auth_afs_token(struct passwd *pw, const char *token_string) |
312 | { | 312 | { |
313 | CREDENTIALS creds; | 313 | CREDENTIALS creds; |
diff --git a/auth-passwd.c b/auth-passwd.c index 278212aa5..d2c2ea876 100644 --- a/auth-passwd.c +++ b/auth-passwd.c | |||
@@ -11,7 +11,7 @@ | |||
11 | 11 | ||
12 | #ifndef USE_PAM | 12 | #ifndef USE_PAM |
13 | 13 | ||
14 | RCSID("$Id: auth-passwd.c,v 1.16 2000/01/22 23:32:03 damien Exp $"); | 14 | RCSID("$Id: auth-passwd.c,v 1.17 2000/04/16 01:18:39 damien Exp $"); |
15 | 15 | ||
16 | #include "packet.h" | 16 | #include "packet.h" |
17 | #include "ssh.h" | 17 | #include "ssh.h" |
@@ -33,7 +33,7 @@ RCSID("$Id: auth-passwd.c,v 1.16 2000/01/22 23:32:03 damien Exp $"); | |||
33 | * Tries to authenticate the user using password. Returns true if | 33 | * Tries to authenticate the user using password. Returns true if |
34 | * authentication succeeds. | 34 | * authentication succeeds. |
35 | */ | 35 | */ |
36 | int | 36 | int |
37 | auth_password(struct passwd * pw, const char *password) | 37 | auth_password(struct passwd * pw, const char *password) |
38 | { | 38 | { |
39 | extern ServerOptions options; | 39 | extern ServerOptions options; |
diff --git a/auth-rh-rsa.c b/auth-rh-rsa.c index d3d90246c..150132fb4 100644 --- a/auth-rh-rsa.c +++ b/auth-rh-rsa.c | |||
@@ -1,21 +1,21 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * auth-rh-rsa.c | 3 | * auth-rh-rsa.c |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Sun May 7 03:08:06 1995 ylo | 10 | * Created: Sun May 7 03:08:06 1995 ylo |
11 | * | 11 | * |
12 | * Rhosts or /etc/hosts.equiv authentication combined with RSA host | 12 | * Rhosts or /etc/hosts.equiv authentication combined with RSA host |
13 | * authentication. | 13 | * authentication. |
14 | * | 14 | * |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "includes.h" | 17 | #include "includes.h" |
18 | RCSID("$Id: auth-rh-rsa.c,v 1.9 2000/04/13 02:26:35 damien Exp $"); | 18 | RCSID("$Id: auth-rh-rsa.c,v 1.10 2000/04/16 01:18:39 damien Exp $"); |
19 | 19 | ||
20 | #ifdef HAVE_OPENSSL | 20 | #ifdef HAVE_OPENSSL |
21 | #include <openssl/bn.h> | 21 | #include <openssl/bn.h> |
@@ -42,7 +42,7 @@ RCSID("$Id: auth-rh-rsa.c,v 1.9 2000/04/13 02:26:35 damien Exp $"); | |||
42 | * its host key. Returns true if authentication succeeds. | 42 | * its host key. Returns true if authentication succeeds. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | int | 45 | int |
46 | auth_rhosts_rsa(struct passwd *pw, const char *client_user, RSA *client_host_key) | 46 | auth_rhosts_rsa(struct passwd *pw, const char *client_user, RSA *client_host_key) |
47 | { | 47 | { |
48 | extern ServerOptions options; | 48 | extern ServerOptions options; |
diff --git a/auth-rhosts.c b/auth-rhosts.c index 318bcfefe..6a5c13e43 100644 --- a/auth-rhosts.c +++ b/auth-rhosts.c | |||
@@ -1,22 +1,22 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * auth-rhosts.c | 3 | * auth-rhosts.c |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Fri Mar 17 05:12:18 1995 ylo | 10 | * Created: Fri Mar 17 05:12:18 1995 ylo |
11 | * | 11 | * |
12 | * Rhosts authentication. This file contains code to check whether to admit | 12 | * Rhosts authentication. This file contains code to check whether to admit |
13 | * the login based on rhosts authentication. This file also processes | 13 | * the login based on rhosts authentication. This file also processes |
14 | * /etc/hosts.equiv. | 14 | * /etc/hosts.equiv. |
15 | * | 15 | * |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include "includes.h" | 18 | #include "includes.h" |
19 | RCSID("$Id: auth-rhosts.c,v 1.7 1999/12/27 12:54:55 damien Exp $"); | 19 | RCSID("$Id: auth-rhosts.c,v 1.8 2000/04/16 01:18:39 damien Exp $"); |
20 | 20 | ||
21 | #include "packet.h" | 21 | #include "packet.h" |
22 | #include "ssh.h" | 22 | #include "ssh.h" |
@@ -30,7 +30,7 @@ RCSID("$Id: auth-rhosts.c,v 1.7 1999/12/27 12:54:55 damien Exp $"); | |||
30 | * based on the file, and returns zero otherwise. | 30 | * based on the file, and returns zero otherwise. |
31 | */ | 31 | */ |
32 | 32 | ||
33 | int | 33 | int |
34 | check_rhosts_file(const char *filename, const char *hostname, | 34 | check_rhosts_file(const char *filename, const char *hostname, |
35 | const char *ipaddr, const char *client_user, | 35 | const char *ipaddr, const char *client_user, |
36 | const char *server_user) | 36 | const char *server_user) |
@@ -146,7 +146,7 @@ check_rhosts_file(const char *filename, const char *hostname, | |||
146 | * /etc/hosts.equiv will be considered (.rhosts and .shosts are ignored). | 146 | * /etc/hosts.equiv will be considered (.rhosts and .shosts are ignored). |
147 | */ | 147 | */ |
148 | 148 | ||
149 | int | 149 | int |
150 | auth_rhosts(struct passwd *pw, const char *client_user) | 150 | auth_rhosts(struct passwd *pw, const char *client_user) |
151 | { | 151 | { |
152 | extern ServerOptions options; | 152 | extern ServerOptions options; |
diff --git a/auth-rsa.c b/auth-rsa.c index fff524949..e9d61f69b 100644 --- a/auth-rsa.c +++ b/auth-rsa.c | |||
@@ -1,22 +1,22 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * auth-rsa.c | 3 | * auth-rsa.c |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Mon Mar 27 01:46:52 1995 ylo | 10 | * Created: Mon Mar 27 01:46:52 1995 ylo |
11 | * | 11 | * |
12 | * RSA-based authentication. This code determines whether to admit a login | 12 | * RSA-based authentication. This code determines whether to admit a login |
13 | * based on RSA authentication. This file also contains functions to check | 13 | * based on RSA authentication. This file also contains functions to check |
14 | * validity of the host key. | 14 | * validity of the host key. |
15 | * | 15 | * |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include "includes.h" | 18 | #include "includes.h" |
19 | RCSID("$Id: auth-rsa.c,v 1.15 2000/04/13 02:26:35 damien Exp $"); | 19 | RCSID("$Id: auth-rsa.c,v 1.16 2000/04/16 01:18:39 damien Exp $"); |
20 | 20 | ||
21 | #include "rsa.h" | 21 | #include "rsa.h" |
22 | #include "packet.h" | 22 | #include "packet.h" |
@@ -244,7 +244,7 @@ auth_rsa(struct passwd *pw, BIGNUM *client_n) | |||
244 | debug("%.100s, line %lu: bad key syntax", | 244 | debug("%.100s, line %lu: bad key syntax", |
245 | SSH_USER_PERMITTED_KEYS, linenum); | 245 | SSH_USER_PERMITTED_KEYS, linenum); |
246 | packet_send_debug("%.100s, line %lu: bad key syntax", | 246 | packet_send_debug("%.100s, line %lu: bad key syntax", |
247 | SSH_USER_PERMITTED_KEYS, linenum); | 247 | SSH_USER_PERMITTED_KEYS, linenum); |
248 | continue; | 248 | continue; |
249 | } | 249 | } |
250 | /* cp now points to the comment part. */ | 250 | /* cp now points to the comment part. */ |
diff --git a/auth-skey.c b/auth-skey.c index f403a1962..056efeb9b 100644 --- a/auth-skey.c +++ b/auth-skey.c | |||
@@ -1,7 +1,7 @@ | |||
1 | #include "includes.h" | 1 | #include "includes.h" |
2 | 2 | ||
3 | #ifdef SKEY | 3 | #ifdef SKEY |
4 | RCSID("$Id: auth-skey.c,v 1.5 1999/12/06 19:04:57 deraadt Exp $"); | 4 | RCSID("$Id: auth-skey.c,v 1.6 2000/04/14 10:30:29 markus Exp $"); |
5 | 5 | ||
6 | #include "ssh.h" | 6 | #include "ssh.h" |
7 | #include "packet.h" | 7 | #include "packet.h" |
@@ -15,12 +15,12 @@ RCSID("$Id: auth-skey.c,v 1.5 1999/12/06 19:04:57 deraadt Exp $"); | |||
15 | 15 | ||
16 | /* from %OpenBSD: skeylogin.c,v 1.32 1999/08/16 14:46:56 millert Exp % */ | 16 | /* from %OpenBSD: skeylogin.c,v 1.32 1999/08/16 14:46:56 millert Exp % */ |
17 | 17 | ||
18 | /* | 18 | /* |
19 | * try skey authentication, | 19 | * try skey authentication, |
20 | * return 1 on success, 0 on failure, -1 if skey is not available | 20 | * return 1 on success, 0 on failure, -1 if skey is not available |
21 | */ | 21 | */ |
22 | 22 | ||
23 | int | 23 | int |
24 | auth_skey_password(struct passwd * pw, const char *password) | 24 | auth_skey_password(struct passwd * pw, const char *password) |
25 | { | 25 | { |
26 | if (strncasecmp(password, "s/key", 5) == 0) { | 26 | if (strncasecmp(password, "s/key", 5) == 0) { |
@@ -53,18 +53,18 @@ auth_skey_password(struct passwd * pw, const char *password) | |||
53 | */ | 53 | */ |
54 | static u_int32_t | 54 | static u_int32_t |
55 | hash_collapse(s) | 55 | hash_collapse(s) |
56 | u_char *s; | 56 | u_char *s; |
57 | { | 57 | { |
58 | int len, target; | 58 | int len, target; |
59 | u_int32_t i; | 59 | u_int32_t i; |
60 | 60 | ||
61 | if ((strlen(s) % sizeof(u_int32_t)) == 0) | 61 | if ((strlen(s) % sizeof(u_int32_t)) == 0) |
62 | target = strlen(s); /* Multiple of 4 */ | 62 | target = strlen(s); /* Multiple of 4 */ |
63 | else | 63 | else |
64 | target = strlen(s) - (strlen(s) % sizeof(u_int32_t)); | 64 | target = strlen(s) - (strlen(s) % sizeof(u_int32_t)); |
65 | 65 | ||
66 | for (i = 0, len = 0; len < target; len += 4) | 66 | for (i = 0, len = 0; len < target; len += 4) |
67 | i ^= ROUND(s + len); | 67 | i ^= ROUND(s + len); |
68 | 68 | ||
69 | return i; | 69 | return i; |
70 | } | 70 | } |
@@ -5,7 +5,7 @@ | |||
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include "includes.h" | 7 | #include "includes.h" |
8 | RCSID("$OpenBSD: auth.c,v 1.2 2000/04/06 08:55:22 markus Exp $"); | 8 | RCSID("$OpenBSD: auth.c,v 1.4 2000/04/14 10:30:29 markus Exp $"); |
9 | 9 | ||
10 | #include "xmalloc.h" | 10 | #include "xmalloc.h" |
11 | #include "rsa.h" | 11 | #include "rsa.h" |
@@ -36,9 +36,9 @@ extern char *forced_command; | |||
36 | * DenyUsers or user's primary group is listed in DenyGroups, false will | 36 | * DenyUsers or user's primary group is listed in DenyGroups, false will |
37 | * be returned. If AllowUsers isn't empty and user isn't listed there, or | 37 | * be returned. If AllowUsers isn't empty and user isn't listed there, or |
38 | * if AllowGroups isn't empty and user isn't listed there, false will be | 38 | * if AllowGroups isn't empty and user isn't listed there, false will be |
39 | * returned. | 39 | * returned. |
40 | * If the user's shell is not executable, false will be returned. | 40 | * If the user's shell is not executable, false will be returned. |
41 | * Otherwise true is returned. | 41 | * Otherwise true is returned. |
42 | */ | 42 | */ |
43 | static int | 43 | static int |
44 | allowed_user(struct passwd * pw) | 44 | allowed_user(struct passwd * pw) |
@@ -201,10 +201,10 @@ do_fake_authloop1(char *user) | |||
201 | packet_write_wait(); | 201 | packet_write_wait(); |
202 | continue; | 202 | continue; |
203 | } else if (type == SSH_CMSG_AUTH_PASSWORD && | 203 | } else if (type == SSH_CMSG_AUTH_PASSWORD && |
204 | options.password_authentication && | 204 | options.password_authentication && |
205 | (password = packet_get_string(&dlen)) != NULL && | 205 | (password = packet_get_string(&dlen)) != NULL && |
206 | dlen == 5 && | 206 | dlen == 5 && |
207 | strncasecmp(password, "s/key", 5) == 0 ) { | 207 | strncasecmp(password, "s/key", 5) == 0 ) { |
208 | packet_send_debug(skeyinfo); | 208 | packet_send_debug(skeyinfo); |
209 | } | 209 | } |
210 | if (password != NULL) | 210 | if (password != NULL) |
@@ -457,20 +457,20 @@ do_authloop(struct passwd * pw) | |||
457 | break; | 457 | break; |
458 | } | 458 | } |
459 | 459 | ||
460 | /* | 460 | /* |
461 | * Check if the user is logging in as root and root logins | 461 | * Check if the user is logging in as root and root logins |
462 | * are disallowed. | 462 | * are disallowed. |
463 | * Note that root login is allowed for forced commands. | 463 | * Note that root login is allowed for forced commands. |
464 | */ | 464 | */ |
465 | if (authenticated && pw->pw_uid == 0 && !options.permit_root_login) { | 465 | if (authenticated && pw->pw_uid == 0 && !options.permit_root_login) { |
466 | if (forced_command) { | 466 | if (forced_command) { |
467 | log("Root login accepted for forced command."); | 467 | log("Root login accepted for forced command."); |
468 | } else { | 468 | } else { |
469 | authenticated = 0; | 469 | authenticated = 0; |
470 | log("ROOT LOGIN REFUSED FROM %.200s", | 470 | log("ROOT LOGIN REFUSED FROM %.200s", |
471 | get_canonical_hostname()); | 471 | get_canonical_hostname()); |
472 | } | 472 | } |
473 | } | 473 | } |
474 | 474 | ||
475 | /* Raise logging level */ | 475 | /* Raise logging level */ |
476 | if (authenticated || | 476 | if (authenticated || |
@@ -685,6 +685,7 @@ input_service_request(int type, int plen) | |||
685 | unsigned int len; | 685 | unsigned int len; |
686 | int accept = 0; | 686 | int accept = 0; |
687 | char *service = packet_get_string(&len); | 687 | char *service = packet_get_string(&len); |
688 | packet_done(); | ||
688 | 689 | ||
689 | if (strcmp(service, "ssh-userauth") == 0) { | 690 | if (strcmp(service, "ssh-userauth") == 0) { |
690 | if (!userauth_success) { | 691 | if (!userauth_success) { |
@@ -727,6 +728,7 @@ input_userauth_request(int type, int plen) | |||
727 | pw = auth_set_user(user, service); | 728 | pw = auth_set_user(user, service); |
728 | if (pw && strcmp(service, "ssh-connection")==0) { | 729 | if (pw && strcmp(service, "ssh-connection")==0) { |
729 | if (strcmp(method, "none") == 0 && try == 1) { | 730 | if (strcmp(method, "none") == 0 && try == 1) { |
731 | packet_done(); | ||
730 | #ifdef USE_PAM | 732 | #ifdef USE_PAM |
731 | /* Do PAM auth with password */ | 733 | /* Do PAM auth with password */ |
732 | authenticated = auth_pam_password(pw, ""); | 734 | authenticated = auth_pam_password(pw, ""); |
@@ -740,6 +742,7 @@ input_userauth_request(int type, int plen) | |||
740 | if (c) | 742 | if (c) |
741 | debug("password change not supported"); | 743 | debug("password change not supported"); |
742 | password = packet_get_string(&len); | 744 | password = packet_get_string(&len); |
745 | packet_done(); | ||
743 | #ifdef USE_PAM | 746 | #ifdef USE_PAM |
744 | /* Do PAM auth with password */ | 747 | /* Do PAM auth with password */ |
745 | authenticated = auth_pam_password(pw, password); | 748 | authenticated = auth_pam_password(pw, password); |
@@ -751,11 +754,19 @@ input_userauth_request(int type, int plen) | |||
751 | xfree(password); | 754 | xfree(password); |
752 | } else if (strcmp(method, "publickey") == 0) { | 755 | } else if (strcmp(method, "publickey") == 0) { |
753 | /* XXX TODO */ | 756 | /* XXX TODO */ |
754 | char *pkalg; | 757 | char *pkalg, *pkblob, *sig; |
755 | char *pkblob; | 758 | int have_sig = packet_get_char(); |
756 | c = packet_get_char(); | ||
757 | pkalg = packet_get_string(&len); | 759 | pkalg = packet_get_string(&len); |
758 | pkblob = packet_get_string(&len); | 760 | pkblob = packet_get_string(&len); |
761 | if (have_sig) { | ||
762 | sig = packet_get_string(&len); | ||
763 | /* test for correct signature */ | ||
764 | packet_done(); | ||
765 | xfree(sig); | ||
766 | } else { | ||
767 | packet_done(); | ||
768 | /* test whether pkalg/pkblob are acceptable */ | ||
769 | } | ||
759 | xfree(pkalg); | 770 | xfree(pkalg); |
760 | xfree(pkblob); | 771 | xfree(pkblob); |
761 | } | 772 | } |
@@ -764,7 +775,6 @@ input_userauth_request(int type, int plen) | |||
764 | if (authenticated) { | 775 | if (authenticated) { |
765 | /* turn off userauth */ | 776 | /* turn off userauth */ |
766 | dispatch_set(SSH2_MSG_USERAUTH_REQUEST, &protocol_error); | 777 | dispatch_set(SSH2_MSG_USERAUTH_REQUEST, &protocol_error); |
767 | /* success! */ | ||
768 | packet_start(SSH2_MSG_USERAUTH_SUCCESS); | 778 | packet_start(SSH2_MSG_USERAUTH_SUCCESS); |
769 | packet_send(); | 779 | packet_send(); |
770 | packet_write_wait(); | 780 | packet_write_wait(); |
@@ -782,7 +792,7 @@ input_userauth_request(int type, int plen) | |||
782 | xfree(user); | 792 | xfree(user); |
783 | xfree(method); | 793 | xfree(method); |
784 | } | 794 | } |
785 | void | 795 | void |
786 | do_authentication2() | 796 | do_authentication2() |
787 | { | 797 | { |
788 | dispatch_init(&protocol_error); | 798 | dispatch_init(&protocol_error); |
@@ -1,20 +1,20 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * authfd.c | 3 | * authfd.c |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Wed Mar 29 01:30:28 1995 ylo | 10 | * Created: Wed Mar 29 01:30:28 1995 ylo |
11 | * | 11 | * |
12 | * Functions for connecting the local authentication agent. | 12 | * Functions for connecting the local authentication agent. |
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include "includes.h" | 16 | #include "includes.h" |
17 | RCSID("$Id: authfd.c,v 1.11 2000/04/13 02:26:35 damien Exp $"); | 17 | RCSID("$Id: authfd.c,v 1.12 2000/04/16 01:18:40 damien Exp $"); |
18 | 18 | ||
19 | #include "ssh.h" | 19 | #include "ssh.h" |
20 | #include "rsa.h" | 20 | #include "rsa.h" |
@@ -69,7 +69,7 @@ ssh_get_authentication_socket() | |||
69 | * ssh_get_authentication_socket(). | 69 | * ssh_get_authentication_socket(). |
70 | */ | 70 | */ |
71 | 71 | ||
72 | void | 72 | void |
73 | ssh_close_authentication_socket(int sock) | 73 | ssh_close_authentication_socket(int sock) |
74 | { | 74 | { |
75 | if (getenv(SSH_AUTHSOCKET_ENV_NAME)) | 75 | if (getenv(SSH_AUTHSOCKET_ENV_NAME)) |
@@ -113,7 +113,7 @@ ssh_get_authentication_connection() | |||
113 | * memory. | 113 | * memory. |
114 | */ | 114 | */ |
115 | 115 | ||
116 | void | 116 | void |
117 | ssh_close_authentication_connection(AuthenticationConnection *ac) | 117 | ssh_close_authentication_connection(AuthenticationConnection *ac) |
118 | { | 118 | { |
119 | buffer_free(&ac->packet); | 119 | buffer_free(&ac->packet); |
@@ -343,7 +343,7 @@ error_cleanup: | |||
343 | * be used by normal applications. | 343 | * be used by normal applications. |
344 | */ | 344 | */ |
345 | 345 | ||
346 | int | 346 | int |
347 | ssh_add_identity(AuthenticationConnection *auth, | 347 | ssh_add_identity(AuthenticationConnection *auth, |
348 | RSA * key, const char *comment) | 348 | RSA * key, const char *comment) |
349 | { | 349 | { |
@@ -431,7 +431,7 @@ error_cleanup: | |||
431 | * meant to be used by normal applications. | 431 | * meant to be used by normal applications. |
432 | */ | 432 | */ |
433 | 433 | ||
434 | int | 434 | int |
435 | ssh_remove_identity(AuthenticationConnection *auth, RSA *key) | 435 | ssh_remove_identity(AuthenticationConnection *auth, RSA *key) |
436 | { | 436 | { |
437 | Buffer buffer; | 437 | Buffer buffer; |
@@ -514,7 +514,7 @@ error_cleanup: | |||
514 | * by normal applications. | 514 | * by normal applications. |
515 | */ | 515 | */ |
516 | 516 | ||
517 | int | 517 | int |
518 | ssh_remove_all_identities(AuthenticationConnection *auth) | 518 | ssh_remove_all_identities(AuthenticationConnection *auth) |
519 | { | 519 | { |
520 | Buffer buffer; | 520 | Buffer buffer; |
@@ -1,19 +1,19 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * authfd.h | 3 | * authfd.h |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Wed Mar 29 01:17:41 1995 ylo | 10 | * Created: Wed Mar 29 01:17:41 1995 ylo |
11 | * | 11 | * |
12 | * Functions to interface with the SSH_AUTHENTICATION_FD socket. | 12 | * Functions to interface with the SSH_AUTHENTICATION_FD socket. |
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | /* RCSID("$Id: authfd.h,v 1.4 1999/11/25 00:54:58 damien Exp $"); */ | 16 | /* RCSID("$Id: authfd.h,v 1.5 2000/04/16 01:18:40 damien Exp $"); */ |
17 | 17 | ||
18 | #ifndef AUTHFD_H | 18 | #ifndef AUTHFD_H |
19 | #define AUTHFD_H | 19 | #define AUTHFD_H |
@@ -67,7 +67,7 @@ void ssh_close_authentication_connection(AuthenticationConnection * ac); | |||
67 | * integers before the call, and free the comment after a successful call | 67 | * integers before the call, and free the comment after a successful call |
68 | * (before calling ssh_get_next_identity). | 68 | * (before calling ssh_get_next_identity). |
69 | */ | 69 | */ |
70 | int | 70 | int |
71 | ssh_get_first_identity(AuthenticationConnection * connection, | 71 | ssh_get_first_identity(AuthenticationConnection * connection, |
72 | BIGNUM * e, BIGNUM * n, char **comment); | 72 | BIGNUM * e, BIGNUM * n, char **comment); |
73 | 73 | ||
@@ -77,13 +77,13 @@ ssh_get_first_identity(AuthenticationConnection * connection, | |||
77 | * function. This returns 0 if there are no more identities. The caller | 77 | * function. This returns 0 if there are no more identities. The caller |
78 | * must free comment after a successful return. | 78 | * must free comment after a successful return. |
79 | */ | 79 | */ |
80 | int | 80 | int |
81 | ssh_get_next_identity(AuthenticationConnection * connection, | 81 | ssh_get_next_identity(AuthenticationConnection * connection, |
82 | BIGNUM * e, BIGNUM * n, char **comment); | 82 | BIGNUM * e, BIGNUM * n, char **comment); |
83 | 83 | ||
84 | /* Requests the agent to decrypt the given challenge. Returns true if | 84 | /* Requests the agent to decrypt the given challenge. Returns true if |
85 | the agent claims it was able to decrypt it. */ | 85 | the agent claims it was able to decrypt it. */ |
86 | int | 86 | int |
87 | ssh_decrypt_challenge(AuthenticationConnection * auth, | 87 | ssh_decrypt_challenge(AuthenticationConnection * auth, |
88 | BIGNUM * e, BIGNUM * n, BIGNUM * challenge, | 88 | BIGNUM * e, BIGNUM * n, BIGNUM * challenge, |
89 | unsigned char session_id[16], | 89 | unsigned char session_id[16], |
@@ -95,7 +95,7 @@ ssh_decrypt_challenge(AuthenticationConnection * auth, | |||
95 | * be used by normal applications. This returns true if the identity was | 95 | * be used by normal applications. This returns true if the identity was |
96 | * successfully added. | 96 | * successfully added. |
97 | */ | 97 | */ |
98 | int | 98 | int |
99 | ssh_add_identity(AuthenticationConnection * connection, RSA * key, | 99 | ssh_add_identity(AuthenticationConnection * connection, RSA * key, |
100 | const char *comment); | 100 | const char *comment); |
101 | 101 | ||
diff --git a/authfile.c b/authfile.c index 6113ddd87..d7912d0da 100644 --- a/authfile.c +++ b/authfile.c | |||
@@ -1,21 +1,21 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * authfile.c | 3 | * authfile.c |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Mon Mar 27 03:52:05 1995 ylo | 10 | * Created: Mon Mar 27 03:52:05 1995 ylo |
11 | * | 11 | * |
12 | * This file contains functions for reading and writing identity files, and | 12 | * This file contains functions for reading and writing identity files, and |
13 | * for reading the passphrase from the user. | 13 | * for reading the passphrase from the user. |
14 | * | 14 | * |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "includes.h" | 17 | #include "includes.h" |
18 | RCSID("$Id: authfile.c,v 1.9 2000/04/13 02:26:36 damien Exp $"); | 18 | RCSID("$Id: authfile.c,v 1.10 2000/04/16 01:18:40 damien Exp $"); |
19 | 19 | ||
20 | #ifdef HAVE_OPENSSL | 20 | #ifdef HAVE_OPENSSL |
21 | #include <openssl/bn.h> | 21 | #include <openssl/bn.h> |
@@ -1,14 +1,14 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * bufaux.c | 3 | * bufaux.c |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Wed Mar 29 02:24:47 1995 ylo | 10 | * Created: Wed Mar 29 02:24:47 1995 ylo |
11 | * | 11 | * |
12 | * Auxiliary functions for storing and retrieving various data types to/from | 12 | * Auxiliary functions for storing and retrieving various data types to/from |
13 | * Buffers. | 13 | * Buffers. |
14 | * | 14 | * |
@@ -17,7 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include "includes.h" | 19 | #include "includes.h" |
20 | RCSID("$Id: bufaux.c,v 1.10 2000/04/13 02:26:36 damien Exp $"); | 20 | RCSID("$Id: bufaux.c,v 1.11 2000/04/16 01:18:40 damien Exp $"); |
21 | 21 | ||
22 | #include "ssh.h" | 22 | #include "ssh.h" |
23 | 23 | ||
@@ -1,17 +1,17 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * bufaux.h | 3 | * bufaux.h |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Wed Mar 29 02:18:23 1995 ylo | 10 | * Created: Wed Mar 29 02:18:23 1995 ylo |
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
14 | /* RCSID("$Id: bufaux.h,v 1.4 2000/04/01 01:09:23 damien Exp $"); */ | 14 | /* RCSID("$Id: bufaux.h,v 1.5 2000/04/16 01:18:40 damien Exp $"); */ |
15 | 15 | ||
16 | #ifndef BUFAUX_H | 16 | #ifndef BUFAUX_H |
17 | #define BUFAUX_H | 17 | #define BUFAUX_H |
@@ -1,20 +1,20 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * buffer.c | 3 | * buffer.c |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Sat Mar 18 04:15:33 1995 ylo | 10 | * Created: Sat Mar 18 04:15:33 1995 ylo |
11 | * | 11 | * |
12 | * Functions for manipulating fifo buffers (that can grow if needed). | 12 | * Functions for manipulating fifo buffers (that can grow if needed). |
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include "includes.h" | 16 | #include "includes.h" |
17 | RCSID("$Id: buffer.c,v 1.4 2000/04/13 02:26:36 damien Exp $"); | 17 | RCSID("$Id: buffer.c,v 1.5 2000/04/16 01:18:40 damien Exp $"); |
18 | 18 | ||
19 | #include "xmalloc.h" | 19 | #include "xmalloc.h" |
20 | #include "buffer.h" | 20 | #include "buffer.h" |
@@ -22,7 +22,7 @@ RCSID("$Id: buffer.c,v 1.4 2000/04/13 02:26:36 damien Exp $"); | |||
22 | 22 | ||
23 | /* Initializes the buffer structure. */ | 23 | /* Initializes the buffer structure. */ |
24 | 24 | ||
25 | void | 25 | void |
26 | buffer_init(Buffer *buffer) | 26 | buffer_init(Buffer *buffer) |
27 | { | 27 | { |
28 | buffer->alloc = 4096; | 28 | buffer->alloc = 4096; |
@@ -33,7 +33,7 @@ buffer_init(Buffer *buffer) | |||
33 | 33 | ||
34 | /* Frees any memory used for the buffer. */ | 34 | /* Frees any memory used for the buffer. */ |
35 | 35 | ||
36 | void | 36 | void |
37 | buffer_free(Buffer *buffer) | 37 | buffer_free(Buffer *buffer) |
38 | { | 38 | { |
39 | memset(buffer->buf, 0, buffer->alloc); | 39 | memset(buffer->buf, 0, buffer->alloc); |
@@ -45,7 +45,7 @@ buffer_free(Buffer *buffer) | |||
45 | * zero the memory. | 45 | * zero the memory. |
46 | */ | 46 | */ |
47 | 47 | ||
48 | void | 48 | void |
49 | buffer_clear(Buffer *buffer) | 49 | buffer_clear(Buffer *buffer) |
50 | { | 50 | { |
51 | buffer->offset = 0; | 51 | buffer->offset = 0; |
@@ -54,7 +54,7 @@ buffer_clear(Buffer *buffer) | |||
54 | 54 | ||
55 | /* Appends data to the buffer, expanding it if necessary. */ | 55 | /* Appends data to the buffer, expanding it if necessary. */ |
56 | 56 | ||
57 | void | 57 | void |
58 | buffer_append(Buffer *buffer, const char *data, unsigned int len) | 58 | buffer_append(Buffer *buffer, const char *data, unsigned int len) |
59 | { | 59 | { |
60 | char *cp; | 60 | char *cp; |
@@ -68,7 +68,7 @@ buffer_append(Buffer *buffer, const char *data, unsigned int len) | |||
68 | * to the allocated region. | 68 | * to the allocated region. |
69 | */ | 69 | */ |
70 | 70 | ||
71 | void | 71 | void |
72 | buffer_append_space(Buffer *buffer, char **datap, unsigned int len) | 72 | buffer_append_space(Buffer *buffer, char **datap, unsigned int len) |
73 | { | 73 | { |
74 | /* If the buffer is empty, start using it from the beginning. */ | 74 | /* If the buffer is empty, start using it from the beginning. */ |
@@ -102,7 +102,7 @@ restart: | |||
102 | 102 | ||
103 | /* Returns the number of bytes of data in the buffer. */ | 103 | /* Returns the number of bytes of data in the buffer. */ |
104 | 104 | ||
105 | unsigned int | 105 | unsigned int |
106 | buffer_len(Buffer *buffer) | 106 | buffer_len(Buffer *buffer) |
107 | { | 107 | { |
108 | return buffer->end - buffer->offset; | 108 | return buffer->end - buffer->offset; |
@@ -110,7 +110,7 @@ buffer_len(Buffer *buffer) | |||
110 | 110 | ||
111 | /* Gets data from the beginning of the buffer. */ | 111 | /* Gets data from the beginning of the buffer. */ |
112 | 112 | ||
113 | void | 113 | void |
114 | buffer_get(Buffer *buffer, char *buf, unsigned int len) | 114 | buffer_get(Buffer *buffer, char *buf, unsigned int len) |
115 | { | 115 | { |
116 | if (len > buffer->end - buffer->offset) | 116 | if (len > buffer->end - buffer->offset) |
@@ -121,7 +121,7 @@ buffer_get(Buffer *buffer, char *buf, unsigned int len) | |||
121 | 121 | ||
122 | /* Consumes the given number of bytes from the beginning of the buffer. */ | 122 | /* Consumes the given number of bytes from the beginning of the buffer. */ |
123 | 123 | ||
124 | void | 124 | void |
125 | buffer_consume(Buffer *buffer, unsigned int bytes) | 125 | buffer_consume(Buffer *buffer, unsigned int bytes) |
126 | { | 126 | { |
127 | if (bytes > buffer->end - buffer->offset) | 127 | if (bytes > buffer->end - buffer->offset) |
@@ -131,7 +131,7 @@ buffer_consume(Buffer *buffer, unsigned int bytes) | |||
131 | 131 | ||
132 | /* Consumes the given number of bytes from the end of the buffer. */ | 132 | /* Consumes the given number of bytes from the end of the buffer. */ |
133 | 133 | ||
134 | void | 134 | void |
135 | buffer_consume_end(Buffer *buffer, unsigned int bytes) | 135 | buffer_consume_end(Buffer *buffer, unsigned int bytes) |
136 | { | 136 | { |
137 | if (bytes > buffer->end - buffer->offset) | 137 | if (bytes > buffer->end - buffer->offset) |
@@ -149,7 +149,7 @@ buffer_ptr(Buffer *buffer) | |||
149 | 149 | ||
150 | /* Dumps the contents of the buffer to stderr. */ | 150 | /* Dumps the contents of the buffer to stderr. */ |
151 | 151 | ||
152 | void | 152 | void |
153 | buffer_dump(Buffer *buffer) | 153 | buffer_dump(Buffer *buffer) |
154 | { | 154 | { |
155 | int i; | 155 | int i; |
diff --git a/canohost.c b/canohost.c index a11d66392..1b5790929 100644 --- a/canohost.c +++ b/canohost.c | |||
@@ -1,20 +1,20 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * canohost.c | 3 | * canohost.c |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Sun Jul 2 17:52:22 1995 ylo | 10 | * Created: Sun Jul 2 17:52:22 1995 ylo |
11 | * | 11 | * |
12 | * Functions for returning the canonical host name of the remote site. | 12 | * Functions for returning the canonical host name of the remote site. |
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include "includes.h" | 16 | #include "includes.h" |
17 | RCSID("$Id: canohost.c,v 1.8 2000/03/11 09:45:41 damien Exp $"); | 17 | RCSID("$Id: canohost.c,v 1.9 2000/04/16 01:18:40 damien Exp $"); |
18 | 18 | ||
19 | #include "packet.h" | 19 | #include "packet.h" |
20 | #include "xmalloc.h" | 20 | #include "xmalloc.h" |
@@ -265,7 +265,7 @@ get_sock_port(int sock, int local) | |||
265 | 265 | ||
266 | /* Returns remote/local port number for the current connection. */ | 266 | /* Returns remote/local port number for the current connection. */ |
267 | 267 | ||
268 | int | 268 | int |
269 | get_port(int local) | 269 | get_port(int local) |
270 | { | 270 | { |
271 | /* | 271 | /* |
@@ -279,13 +279,13 @@ get_port(int local) | |||
279 | return get_sock_port(packet_get_connection_in(), local); | 279 | return get_sock_port(packet_get_connection_in(), local); |
280 | } | 280 | } |
281 | 281 | ||
282 | int | 282 | int |
283 | get_peer_port(int sock) | 283 | get_peer_port(int sock) |
284 | { | 284 | { |
285 | return get_sock_port(sock, 0); | 285 | return get_sock_port(sock, 0); |
286 | } | 286 | } |
287 | 287 | ||
288 | int | 288 | int |
289 | get_remote_port() | 289 | get_remote_port() |
290 | { | 290 | { |
291 | return get_port(0); | 291 | return get_port(0); |
diff --git a/channels.c b/channels.c index 957b4a428..5f3b0d113 100644 --- a/channels.c +++ b/channels.c | |||
@@ -1,23 +1,23 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * channels.c | 3 | * channels.c |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Fri Mar 24 16:35:24 1995 ylo | 10 | * Created: Fri Mar 24 16:35:24 1995 ylo |
11 | * | 11 | * |
12 | * This file contains functions for generic socket connection forwarding. | 12 | * This file contains functions for generic socket connection forwarding. |
13 | * There is also code for initiating connection forwarding for X11 connections, | 13 | * There is also code for initiating connection forwarding for X11 connections, |
14 | * arbitrary tcp/ip connections, and the authentication agent connection. | 14 | * arbitrary tcp/ip connections, and the authentication agent connection. |
15 | * | 15 | * |
16 | * SSH2 support added by Markus Friedl. | 16 | * SSH2 support added by Markus Friedl. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include "includes.h" | 19 | #include "includes.h" |
20 | RCSID("$Id: channels.c,v 1.24 2000/04/12 10:17:38 damien Exp $"); | 20 | RCSID("$Id: channels.c,v 1.25 2000/04/16 01:18:41 damien Exp $"); |
21 | 21 | ||
22 | #include "ssh.h" | 22 | #include "ssh.h" |
23 | #include "packet.h" | 23 | #include "packet.h" |
@@ -109,7 +109,7 @@ static int have_hostname_in_open = 0; | |||
109 | 109 | ||
110 | /* Sets specific protocol options. */ | 110 | /* Sets specific protocol options. */ |
111 | 111 | ||
112 | void | 112 | void |
113 | channel_set_options(int hostname_in_open) | 113 | channel_set_options(int hostname_in_open) |
114 | { | 114 | { |
115 | have_hostname_in_open = hostname_in_open; | 115 | have_hostname_in_open = hostname_in_open; |
@@ -121,7 +121,7 @@ channel_set_options(int hostname_in_open) | |||
121 | * and the server has no way to know but to trust the client anyway. | 121 | * and the server has no way to know but to trust the client anyway. |
122 | */ | 122 | */ |
123 | 123 | ||
124 | void | 124 | void |
125 | channel_permit_all_opens() | 125 | channel_permit_all_opens() |
126 | { | 126 | { |
127 | all_opens_permitted = 1; | 127 | all_opens_permitted = 1; |
@@ -150,7 +150,7 @@ channel_lookup(int id) | |||
150 | * remote_name to be freed. | 150 | * remote_name to be freed. |
151 | */ | 151 | */ |
152 | 152 | ||
153 | int | 153 | int |
154 | channel_new(char *ctype, int type, int rfd, int wfd, int efd, | 154 | channel_new(char *ctype, int type, int rfd, int wfd, int efd, |
155 | int window, int maxpack, int extended_usage, char *remote_name) | 155 | int window, int maxpack, int extended_usage, char *remote_name) |
156 | { | 156 | { |
@@ -226,7 +226,7 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd, | |||
226 | debug("channel %d: new [%s]", found, remote_name); | 226 | debug("channel %d: new [%s]", found, remote_name); |
227 | return found; | 227 | return found; |
228 | } | 228 | } |
229 | int | 229 | int |
230 | channel_allocate(int type, int sock, char *remote_name) | 230 | channel_allocate(int type, int sock, char *remote_name) |
231 | { | 231 | { |
232 | return channel_new("", type, sock, sock, -1, 0, 0, 0, remote_name); | 232 | return channel_new("", type, sock, sock, -1, 0, 0, 0, remote_name); |
@@ -234,7 +234,7 @@ channel_allocate(int type, int sock, char *remote_name) | |||
234 | 234 | ||
235 | /* Free the channel and close its socket. */ | 235 | /* Free the channel and close its socket. */ |
236 | 236 | ||
237 | void | 237 | void |
238 | channel_free(int id) | 238 | channel_free(int id) |
239 | { | 239 | { |
240 | Channel *c = channel_lookup(id); | 240 | Channel *c = channel_lookup(id); |
@@ -361,7 +361,7 @@ channel_pre_output_draining(Channel *c, fd_set * readset, fd_set * writeset) | |||
361 | { | 361 | { |
362 | if (buffer_len(&c->output) == 0) | 362 | if (buffer_len(&c->output) == 0) |
363 | channel_free(c->self); | 363 | channel_free(c->self); |
364 | else | 364 | else |
365 | FD_SET(c->sock, writeset); | 365 | FD_SET(c->sock, writeset); |
366 | } | 366 | } |
367 | 367 | ||
@@ -540,8 +540,10 @@ channel_post_port_listener(Channel *c, fd_set * readset, fd_set * writeset) | |||
540 | packet_put_int(newch); | 540 | packet_put_int(newch); |
541 | packet_put_int(c->local_window_max); | 541 | packet_put_int(c->local_window_max); |
542 | packet_put_int(c->local_maxpacket); | 542 | packet_put_int(c->local_maxpacket); |
543 | /* target host and port */ | ||
543 | packet_put_string(c->path, strlen(c->path)); | 544 | packet_put_string(c->path, strlen(c->path)); |
544 | packet_put_int(c->host_port); | 545 | packet_put_int(c->host_port); |
546 | /* originator host and port */ | ||
545 | packet_put_cstring(remote_hostname); | 547 | packet_put_cstring(remote_hostname); |
546 | packet_put_int(remote_port); | 548 | packet_put_int(remote_port); |
547 | packet_send(); | 549 | packet_send(); |
@@ -782,7 +784,7 @@ channel_handler_init(void) | |||
782 | channel_handler_init_15(); | 784 | channel_handler_init_15(); |
783 | } | 785 | } |
784 | 786 | ||
785 | void | 787 | void |
786 | channel_handler(chan_fn *ftab[], fd_set * readset, fd_set * writeset) | 788 | channel_handler(chan_fn *ftab[], fd_set * readset, fd_set * writeset) |
787 | { | 789 | { |
788 | static int did_init = 0; | 790 | static int did_init = 0; |
@@ -804,13 +806,13 @@ channel_handler(chan_fn *ftab[], fd_set * readset, fd_set * writeset) | |||
804 | } | 806 | } |
805 | } | 807 | } |
806 | 808 | ||
807 | void | 809 | void |
808 | channel_prepare_select(fd_set * readset, fd_set * writeset) | 810 | channel_prepare_select(fd_set * readset, fd_set * writeset) |
809 | { | 811 | { |
810 | channel_handler(channel_pre, readset, writeset); | 812 | channel_handler(channel_pre, readset, writeset); |
811 | } | 813 | } |
812 | 814 | ||
813 | void | 815 | void |
814 | channel_after_select(fd_set * readset, fd_set * writeset) | 816 | channel_after_select(fd_set * readset, fd_set * writeset) |
815 | { | 817 | { |
816 | channel_handler(channel_post, readset, writeset); | 818 | channel_handler(channel_post, readset, writeset); |
@@ -818,7 +820,7 @@ channel_after_select(fd_set * readset, fd_set * writeset) | |||
818 | 820 | ||
819 | /* If there is data to send to the connection, send some of it now. */ | 821 | /* If there is data to send to the connection, send some of it now. */ |
820 | 822 | ||
821 | void | 823 | void |
822 | channel_output_poll() | 824 | channel_output_poll() |
823 | { | 825 | { |
824 | int len, i; | 826 | int len, i; |
@@ -909,7 +911,7 @@ channel_output_poll() | |||
909 | * still there. | 911 | * still there. |
910 | */ | 912 | */ |
911 | 913 | ||
912 | void | 914 | void |
913 | channel_input_data(int type, int plen) | 915 | channel_input_data(int type, int plen) |
914 | { | 916 | { |
915 | int id; | 917 | int id; |
@@ -934,6 +936,7 @@ channel_input_data(int type, int plen) | |||
934 | 936 | ||
935 | /* Get the data. */ | 937 | /* Get the data. */ |
936 | data = packet_get_string(&data_len); | 938 | data = packet_get_string(&data_len); |
939 | packet_done(); | ||
937 | 940 | ||
938 | if (compat20){ | 941 | if (compat20){ |
939 | if (data_len > c->local_maxpacket) { | 942 | if (data_len > c->local_maxpacket) { |
@@ -953,7 +956,7 @@ channel_input_data(int type, int plen) | |||
953 | buffer_append(&c->output, data, data_len); | 956 | buffer_append(&c->output, data, data_len); |
954 | xfree(data); | 957 | xfree(data); |
955 | } | 958 | } |
956 | void | 959 | void |
957 | channel_input_extended_data(int type, int plen) | 960 | channel_input_extended_data(int type, int plen) |
958 | { | 961 | { |
959 | int id; | 962 | int id; |
@@ -980,6 +983,7 @@ channel_input_extended_data(int type, int plen) | |||
980 | return; | 983 | return; |
981 | } | 984 | } |
982 | data = packet_get_string(&data_len); | 985 | data = packet_get_string(&data_len); |
986 | packet_done(); | ||
983 | if (data_len > c->local_window) { | 987 | if (data_len > c->local_window) { |
984 | log("channel %d: rcvd too much extended_data %d, win %d", | 988 | log("channel %d: rcvd too much extended_data %d, win %d", |
985 | c->self, data_len, c->local_window); | 989 | c->self, data_len, c->local_window); |
@@ -998,7 +1002,7 @@ channel_input_extended_data(int type, int plen) | |||
998 | * more channel is overfull. | 1002 | * more channel is overfull. |
999 | */ | 1003 | */ |
1000 | 1004 | ||
1001 | int | 1005 | int |
1002 | channel_not_very_much_buffered_data() | 1006 | channel_not_very_much_buffered_data() |
1003 | { | 1007 | { |
1004 | unsigned int i; | 1008 | unsigned int i; |
@@ -1022,7 +1026,7 @@ channel_not_very_much_buffered_data() | |||
1022 | return 1; | 1026 | return 1; |
1023 | } | 1027 | } |
1024 | 1028 | ||
1025 | void | 1029 | void |
1026 | channel_input_ieof(int type, int plen) | 1030 | channel_input_ieof(int type, int plen) |
1027 | { | 1031 | { |
1028 | int id; | 1032 | int id; |
@@ -1037,7 +1041,7 @@ channel_input_ieof(int type, int plen) | |||
1037 | chan_rcvd_ieof(c); | 1041 | chan_rcvd_ieof(c); |
1038 | } | 1042 | } |
1039 | 1043 | ||
1040 | void | 1044 | void |
1041 | channel_input_close(int type, int plen) | 1045 | channel_input_close(int type, int plen) |
1042 | { | 1046 | { |
1043 | int id; | 1047 | int id; |
@@ -1076,7 +1080,7 @@ channel_input_close(int type, int plen) | |||
1076 | } | 1080 | } |
1077 | 1081 | ||
1078 | /* proto version 1.5 overloads CLOSE_CONFIRMATION with OCLOSE */ | 1082 | /* proto version 1.5 overloads CLOSE_CONFIRMATION with OCLOSE */ |
1079 | void | 1083 | void |
1080 | channel_input_oclose(int type, int plen) | 1084 | channel_input_oclose(int type, int plen) |
1081 | { | 1085 | { |
1082 | int id = packet_get_int(); | 1086 | int id = packet_get_int(); |
@@ -1087,12 +1091,13 @@ channel_input_oclose(int type, int plen) | |||
1087 | chan_rcvd_oclose(c); | 1091 | chan_rcvd_oclose(c); |
1088 | } | 1092 | } |
1089 | 1093 | ||
1090 | void | 1094 | void |
1091 | channel_input_close_confirmation(int type, int plen) | 1095 | channel_input_close_confirmation(int type, int plen) |
1092 | { | 1096 | { |
1093 | int id = packet_get_int(); | 1097 | int id = packet_get_int(); |
1094 | Channel *c = channel_lookup(id); | 1098 | Channel *c = channel_lookup(id); |
1095 | 1099 | ||
1100 | packet_done(); | ||
1096 | if (c == NULL) | 1101 | if (c == NULL) |
1097 | packet_disconnect("Received close confirmation for " | 1102 | packet_disconnect("Received close confirmation for " |
1098 | "out-of-range channel %d.", id); | 1103 | "out-of-range channel %d.", id); |
@@ -1102,7 +1107,7 @@ channel_input_close_confirmation(int type, int plen) | |||
1102 | channel_free(c->self); | 1107 | channel_free(c->self); |
1103 | } | 1108 | } |
1104 | 1109 | ||
1105 | void | 1110 | void |
1106 | channel_input_open_confirmation(int type, int plen) | 1111 | channel_input_open_confirmation(int type, int plen) |
1107 | { | 1112 | { |
1108 | int id, remote_id; | 1113 | int id, remote_id; |
@@ -1125,6 +1130,7 @@ channel_input_open_confirmation(int type, int plen) | |||
1125 | if (compat20) { | 1130 | if (compat20) { |
1126 | c->remote_window = packet_get_int(); | 1131 | c->remote_window = packet_get_int(); |
1127 | c->remote_maxpacket = packet_get_int(); | 1132 | c->remote_maxpacket = packet_get_int(); |
1133 | packet_done(); | ||
1128 | if (c->cb_fn != NULL && c->cb_event == type) { | 1134 | if (c->cb_fn != NULL && c->cb_event == type) { |
1129 | debug("callback start"); | 1135 | debug("callback start"); |
1130 | c->cb_fn(c->self, c->cb_arg); | 1136 | c->cb_fn(c->self, c->cb_arg); |
@@ -1135,7 +1141,7 @@ channel_input_open_confirmation(int type, int plen) | |||
1135 | } | 1141 | } |
1136 | } | 1142 | } |
1137 | 1143 | ||
1138 | void | 1144 | void |
1139 | channel_input_open_failure(int type, int plen) | 1145 | channel_input_open_failure(int type, int plen) |
1140 | { | 1146 | { |
1141 | int id; | 1147 | int id; |
@@ -1153,8 +1159,11 @@ channel_input_open_failure(int type, int plen) | |||
1153 | if (compat20) { | 1159 | if (compat20) { |
1154 | int reason = packet_get_int(); | 1160 | int reason = packet_get_int(); |
1155 | char *msg = packet_get_string(NULL); | 1161 | char *msg = packet_get_string(NULL); |
1162 | char *lang = packet_get_string(NULL); | ||
1156 | log("channel_open_failure: %d: reason %d: %s", id, reason, msg); | 1163 | log("channel_open_failure: %d: reason %d: %s", id, reason, msg); |
1164 | packet_done(); | ||
1157 | xfree(msg); | 1165 | xfree(msg); |
1166 | xfree(lang); | ||
1158 | } | 1167 | } |
1159 | /* Free the channel. This will also close the socket. */ | 1168 | /* Free the channel. This will also close the socket. */ |
1160 | channel_free(id); | 1169 | channel_free(id); |
@@ -1185,7 +1194,7 @@ debug("cb_fn %p cb_event %d", c->cb_fn , c->cb_event); | |||
1185 | } | 1194 | } |
1186 | } | 1195 | } |
1187 | 1196 | ||
1188 | void | 1197 | void |
1189 | channel_input_window_adjust(int type, int plen) | 1198 | channel_input_window_adjust(int type, int plen) |
1190 | { | 1199 | { |
1191 | Channel *c; | 1200 | Channel *c; |
@@ -1204,6 +1213,7 @@ channel_input_window_adjust(int type, int plen) | |||
1204 | return; | 1213 | return; |
1205 | } | 1214 | } |
1206 | adjust = packet_get_int(); | 1215 | adjust = packet_get_int(); |
1216 | packet_done(); | ||
1207 | debug("channel %d: rcvd adjust %d", id, adjust); | 1217 | debug("channel %d: rcvd adjust %d", id, adjust); |
1208 | c->remote_window += adjust; | 1218 | c->remote_window += adjust; |
1209 | } | 1219 | } |
@@ -1213,7 +1223,7 @@ channel_input_window_adjust(int type, int plen) | |||
1213 | * might have. | 1223 | * might have. |
1214 | */ | 1224 | */ |
1215 | 1225 | ||
1216 | void | 1226 | void |
1217 | channel_stop_listening() | 1227 | channel_stop_listening() |
1218 | { | 1228 | { |
1219 | int i; | 1229 | int i; |
@@ -1240,7 +1250,7 @@ channel_stop_listening() | |||
1240 | * descriptors after a fork. | 1250 | * descriptors after a fork. |
1241 | */ | 1251 | */ |
1242 | 1252 | ||
1243 | void | 1253 | void |
1244 | channel_close_all() | 1254 | channel_close_all() |
1245 | { | 1255 | { |
1246 | int i; | 1256 | int i; |
@@ -1252,7 +1262,7 @@ channel_close_all() | |||
1252 | 1262 | ||
1253 | /* Returns the maximum file descriptor number used by the channels. */ | 1263 | /* Returns the maximum file descriptor number used by the channels. */ |
1254 | 1264 | ||
1255 | int | 1265 | int |
1256 | channel_max_fd() | 1266 | channel_max_fd() |
1257 | { | 1267 | { |
1258 | return channel_max_fd_value; | 1268 | return channel_max_fd_value; |
@@ -1260,7 +1270,7 @@ channel_max_fd() | |||
1260 | 1270 | ||
1261 | /* Returns true if any channel is still open. */ | 1271 | /* Returns true if any channel is still open. */ |
1262 | 1272 | ||
1263 | int | 1273 | int |
1264 | channel_still_open() | 1274 | channel_still_open() |
1265 | { | 1275 | { |
1266 | unsigned int i; | 1276 | unsigned int i; |
@@ -1347,7 +1357,7 @@ channel_open_message() | |||
1347 | * channel to host:port from remote side. | 1357 | * channel to host:port from remote side. |
1348 | */ | 1358 | */ |
1349 | 1359 | ||
1350 | void | 1360 | void |
1351 | channel_request_local_forwarding(u_short port, const char *host, | 1361 | channel_request_local_forwarding(u_short port, const char *host, |
1352 | u_short host_port, int gateway_ports) | 1362 | u_short host_port, int gateway_ports) |
1353 | { | 1363 | { |
@@ -1435,7 +1445,7 @@ channel_request_local_forwarding(u_short port, const char *host, | |||
1435 | * the secure channel to host:port from local side. | 1445 | * the secure channel to host:port from local side. |
1436 | */ | 1446 | */ |
1437 | 1447 | ||
1438 | void | 1448 | void |
1439 | channel_request_remote_forwarding(u_short listen_port, const char *host_to_connect, | 1449 | channel_request_remote_forwarding(u_short listen_port, const char *host_to_connect, |
1440 | u_short port_to_connect) | 1450 | u_short port_to_connect) |
1441 | { | 1451 | { |
@@ -1478,7 +1488,7 @@ channel_request_remote_forwarding(u_short listen_port, const char *host_to_conne | |||
1478 | * message if there was an error). This never returns if there was an error. | 1488 | * message if there was an error). This never returns if there was an error. |
1479 | */ | 1489 | */ |
1480 | 1490 | ||
1481 | void | 1491 | void |
1482 | channel_input_port_forward_request(int is_root) | 1492 | channel_input_port_forward_request(int is_root) |
1483 | { | 1493 | { |
1484 | u_short port, host_port; | 1494 | u_short port, host_port; |
@@ -1562,7 +1572,7 @@ channel_connect_to(const char *host, u_short host_port) | |||
1562 | * or CHANNEL_OPEN_FAILURE. | 1572 | * or CHANNEL_OPEN_FAILURE. |
1563 | */ | 1573 | */ |
1564 | 1574 | ||
1565 | void | 1575 | void |
1566 | channel_input_port_open(int type, int plen) | 1576 | channel_input_port_open(int type, int plen) |
1567 | { | 1577 | { |
1568 | u_short host_port; | 1578 | u_short host_port; |
@@ -1807,7 +1817,7 @@ connect_local_xsocket(unsigned int dnr) | |||
1807 | * with either SSH_MSG_OPEN_CONFIRMATION or SSH_MSG_OPEN_FAILURE. | 1817 | * with either SSH_MSG_OPEN_CONFIRMATION or SSH_MSG_OPEN_FAILURE. |
1808 | */ | 1818 | */ |
1809 | 1819 | ||
1810 | void | 1820 | void |
1811 | x11_input_open(int type, int plen) | 1821 | x11_input_open(int type, int plen) |
1812 | { | 1822 | { |
1813 | int remote_channel, display_number, sock = 0, newch; | 1823 | int remote_channel, display_number, sock = 0, newch; |
@@ -1911,7 +1921,7 @@ x11_input_open(int type, int plen) | |||
1911 | } | 1921 | } |
1912 | freeaddrinfo(aitop); | 1922 | freeaddrinfo(aitop); |
1913 | if (!ai) { | 1923 | if (!ai) { |
1914 | error("connect %.100s port %d: %.100s", buf, 6000 + display_number, | 1924 | error("connect %.100s port %d: %.100s", buf, 6000 + display_number, |
1915 | strerror(errno)); | 1925 | strerror(errno)); |
1916 | goto fail; | 1926 | goto fail; |
1917 | } | 1927 | } |
@@ -1945,7 +1955,7 @@ fail: | |||
1945 | * data, and enables authentication spoofing. | 1955 | * data, and enables authentication spoofing. |
1946 | */ | 1956 | */ |
1947 | 1957 | ||
1948 | void | 1958 | void |
1949 | x11_request_forwarding_with_spoofing(const char *proto, const char *data) | 1959 | x11_request_forwarding_with_spoofing(const char *proto, const char *data) |
1950 | { | 1960 | { |
1951 | unsigned int data_len = (unsigned int) strlen(data) / 2; | 1961 | unsigned int data_len = (unsigned int) strlen(data) / 2; |
@@ -2003,7 +2013,7 @@ x11_request_forwarding_with_spoofing(const char *proto, const char *data) | |||
2003 | 2013 | ||
2004 | /* Sends a message to the server to request authentication fd forwarding. */ | 2014 | /* Sends a message to the server to request authentication fd forwarding. */ |
2005 | 2015 | ||
2006 | void | 2016 | void |
2007 | auth_request_forwarding() | 2017 | auth_request_forwarding() |
2008 | { | 2018 | { |
2009 | packet_start(SSH_CMSG_AGENT_REQUEST_FORWARDING); | 2019 | packet_start(SSH_CMSG_AGENT_REQUEST_FORWARDING); |
@@ -2025,7 +2035,7 @@ auth_get_socket_name() | |||
2025 | 2035 | ||
2026 | /* removes the agent forwarding socket */ | 2036 | /* removes the agent forwarding socket */ |
2027 | 2037 | ||
2028 | void | 2038 | void |
2029 | cleanup_socket(void) | 2039 | cleanup_socket(void) |
2030 | { | 2040 | { |
2031 | remove(channel_forwarded_auth_socket_name); | 2041 | remove(channel_forwarded_auth_socket_name); |
@@ -2037,7 +2047,7 @@ cleanup_socket(void) | |||
2037 | * This starts forwarding authentication requests. | 2047 | * This starts forwarding authentication requests. |
2038 | */ | 2048 | */ |
2039 | 2049 | ||
2040 | void | 2050 | void |
2041 | auth_input_request_forwarding(struct passwd * pw) | 2051 | auth_input_request_forwarding(struct passwd * pw) |
2042 | { | 2052 | { |
2043 | int sock, newch; | 2053 | int sock, newch; |
@@ -2095,7 +2105,7 @@ auth_input_request_forwarding(struct passwd * pw) | |||
2095 | 2105 | ||
2096 | /* This is called to process an SSH_SMSG_AGENT_OPEN message. */ | 2106 | /* This is called to process an SSH_SMSG_AGENT_OPEN message. */ |
2097 | 2107 | ||
2098 | void | 2108 | void |
2099 | auth_input_open_request(int type, int plen) | 2109 | auth_input_open_request(int type, int plen) |
2100 | { | 2110 | { |
2101 | int remch, sock, newch; | 2111 | int remch, sock, newch; |
diff --git a/channels.h b/channels.h index 33af09d9d..cab796440 100644 --- a/channels.h +++ b/channels.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* RCSID("$Id: channels.h,v 1.6 2000/04/04 04:39:01 damien Exp $"); */ | 1 | /* RCSID("$Id: channels.h,v 1.7 2000/04/16 01:18:41 damien Exp $"); */ |
2 | 2 | ||
3 | #ifndef CHANNELS_H | 3 | #ifndef CHANNELS_H |
4 | #define CHANNELS_H | 4 | #define CHANNELS_H |
@@ -149,7 +149,7 @@ char *channel_open_message(void); | |||
149 | * channel to host:port from remote side. This never returns if there was an | 149 | * channel to host:port from remote side. This never returns if there was an |
150 | * error. | 150 | * error. |
151 | */ | 151 | */ |
152 | void | 152 | void |
153 | channel_request_local_forwarding(u_short port, const char *host, | 153 | channel_request_local_forwarding(u_short port, const char *host, |
154 | u_short remote_port, int gateway_ports); | 154 | u_short remote_port, int gateway_ports); |
155 | 155 | ||
@@ -159,7 +159,7 @@ channel_request_local_forwarding(u_short port, const char *host, | |||
159 | * there was an error. This registers that open requests for that port are | 159 | * there was an error. This registers that open requests for that port are |
160 | * permitted. | 160 | * permitted. |
161 | */ | 161 | */ |
162 | void | 162 | void |
163 | channel_request_remote_forwarding(u_short port, const char *host, | 163 | channel_request_remote_forwarding(u_short port, const char *host, |
164 | u_short remote_port); | 164 | u_short remote_port); |
165 | 165 | ||
@@ -1,18 +1,18 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * cipher.c | 3 | * cipher.c |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Wed Apr 19 17:41:39 1995 ylo | 10 | * Created: Wed Apr 19 17:41:39 1995 ylo |
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include "includes.h" | 14 | #include "includes.h" |
15 | RCSID("$Id: cipher.c,v 1.18 2000/04/13 02:26:36 damien Exp $"); | 15 | RCSID("$Id: cipher.c,v 1.19 2000/04/16 01:18:41 damien Exp $"); |
16 | 16 | ||
17 | #include "ssh.h" | 17 | #include "ssh.h" |
18 | #include "cipher.h" | 18 | #include "cipher.h" |
@@ -138,7 +138,7 @@ static char *cipher_names[] = | |||
138 | * supported cipher. | 138 | * supported cipher. |
139 | */ | 139 | */ |
140 | 140 | ||
141 | unsigned int | 141 | unsigned int |
142 | cipher_mask1() | 142 | cipher_mask1() |
143 | { | 143 | { |
144 | unsigned int mask = 0; | 144 | unsigned int mask = 0; |
@@ -146,7 +146,7 @@ cipher_mask1() | |||
146 | mask |= 1 << SSH_CIPHER_BLOWFISH; | 146 | mask |= 1 << SSH_CIPHER_BLOWFISH; |
147 | return mask; | 147 | return mask; |
148 | } | 148 | } |
149 | unsigned int | 149 | unsigned int |
150 | cipher_mask2() | 150 | cipher_mask2() |
151 | { | 151 | { |
152 | unsigned int mask = 0; | 152 | unsigned int mask = 0; |
@@ -156,7 +156,7 @@ cipher_mask2() | |||
156 | mask |= 1 << SSH_CIPHER_CAST128_CBC; | 156 | mask |= 1 << SSH_CIPHER_CAST128_CBC; |
157 | return mask; | 157 | return mask; |
158 | } | 158 | } |
159 | unsigned int | 159 | unsigned int |
160 | cipher_mask() | 160 | cipher_mask() |
161 | { | 161 | { |
162 | return cipher_mask1() | cipher_mask2(); | 162 | return cipher_mask1() | cipher_mask2(); |
@@ -218,7 +218,7 @@ cipher_number(const char *name) | |||
218 | * passphrase and using the resulting 16 bytes as the key. | 218 | * passphrase and using the resulting 16 bytes as the key. |
219 | */ | 219 | */ |
220 | 220 | ||
221 | void | 221 | void |
222 | cipher_set_key_string(CipherContext *context, int cipher, const char *passphrase) | 222 | cipher_set_key_string(CipherContext *context, int cipher, const char *passphrase) |
223 | { | 223 | { |
224 | MD5_CTX md; | 224 | MD5_CTX md; |
@@ -236,7 +236,7 @@ cipher_set_key_string(CipherContext *context, int cipher, const char *passphrase | |||
236 | 236 | ||
237 | /* Selects the cipher to use and sets the key. */ | 237 | /* Selects the cipher to use and sets the key. */ |
238 | 238 | ||
239 | void | 239 | void |
240 | cipher_set_key(CipherContext *context, int cipher, const unsigned char *key, | 240 | cipher_set_key(CipherContext *context, int cipher, const unsigned char *key, |
241 | int keylen) | 241 | int keylen) |
242 | { | 242 | { |
@@ -297,9 +297,9 @@ cipher_set_key(CipherContext *context, int cipher, const unsigned char *key, | |||
297 | memset(padded, 0, sizeof(padded)); | 297 | memset(padded, 0, sizeof(padded)); |
298 | } | 298 | } |
299 | 299 | ||
300 | void | 300 | void |
301 | cipher_set_key_iv(CipherContext * context, int cipher, | 301 | cipher_set_key_iv(CipherContext * context, int cipher, |
302 | const unsigned char *key, int keylen, | 302 | const unsigned char *key, int keylen, |
303 | const unsigned char *iv, int ivlen) | 303 | const unsigned char *iv, int ivlen) |
304 | { | 304 | { |
305 | /* Set cipher type. */ | 305 | /* Set cipher type. */ |
@@ -357,7 +357,7 @@ cipher_set_key_iv(CipherContext * context, int cipher, | |||
357 | 357 | ||
358 | /* Encrypts data using the cipher. */ | 358 | /* Encrypts data using the cipher. */ |
359 | 359 | ||
360 | void | 360 | void |
361 | cipher_encrypt(CipherContext *context, unsigned char *dest, | 361 | cipher_encrypt(CipherContext *context, unsigned char *dest, |
362 | const unsigned char *src, unsigned int len) | 362 | const unsigned char *src, unsigned int len) |
363 | { | 363 | { |
@@ -379,14 +379,14 @@ cipher_encrypt(CipherContext *context, unsigned char *dest, | |||
379 | case SSH_CIPHER_BLOWFISH: | 379 | case SSH_CIPHER_BLOWFISH: |
380 | swap_bytes(src, dest, len); | 380 | swap_bytes(src, dest, len); |
381 | BF_cbc_encrypt(dest, dest, len, | 381 | BF_cbc_encrypt(dest, dest, len, |
382 | &context->u.bf.key, context->u.bf.iv, | 382 | &context->u.bf.key, context->u.bf.iv, |
383 | BF_ENCRYPT); | 383 | BF_ENCRYPT); |
384 | swap_bytes(dest, dest, len); | 384 | swap_bytes(dest, dest, len); |
385 | break; | 385 | break; |
386 | 386 | ||
387 | case SSH_CIPHER_BLOWFISH_CBC: | 387 | case SSH_CIPHER_BLOWFISH_CBC: |
388 | BF_cbc_encrypt((void *)src, dest, len, | 388 | BF_cbc_encrypt((void *)src, dest, len, |
389 | &context->u.bf.key, context->u.bf.iv, | 389 | &context->u.bf.key, context->u.bf.iv, |
390 | BF_ENCRYPT); | 390 | BF_ENCRYPT); |
391 | break; | 391 | break; |
392 | 392 | ||
@@ -412,7 +412,7 @@ cipher_encrypt(CipherContext *context, unsigned char *dest, | |||
412 | 412 | ||
413 | /* Decrypts data using the cipher. */ | 413 | /* Decrypts data using the cipher. */ |
414 | 414 | ||
415 | void | 415 | void |
416 | cipher_decrypt(CipherContext *context, unsigned char *dest, | 416 | cipher_decrypt(CipherContext *context, unsigned char *dest, |
417 | const unsigned char *src, unsigned int len) | 417 | const unsigned char *src, unsigned int len) |
418 | { | 418 | { |
@@ -1,17 +1,17 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * cipher.h | 3 | * cipher.h |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Wed Apr 19 16:50:42 1995 ylo | 10 | * Created: Wed Apr 19 16:50:42 1995 ylo |
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
14 | /* RCSID("$Id: cipher.h,v 1.10 2000/04/13 02:26:36 damien Exp $"); */ | 14 | /* RCSID("$Id: cipher.h,v 1.11 2000/04/16 01:18:41 damien Exp $"); */ |
15 | 15 | ||
16 | #ifndef CIPHER_H | 16 | #ifndef CIPHER_H |
17 | #define CIPHER_H | 17 | #define CIPHER_H |
@@ -95,29 +95,29 @@ int ciphers_valid(const char *names); | |||
95 | * Selects the cipher to use and sets the key. If for_encryption is true, | 95 | * Selects the cipher to use and sets the key. If for_encryption is true, |
96 | * the key is setup for encryption; otherwise it is setup for decryption. | 96 | * the key is setup for encryption; otherwise it is setup for decryption. |
97 | */ | 97 | */ |
98 | void | 98 | void |
99 | cipher_set_key(CipherContext * context, int cipher, | 99 | cipher_set_key(CipherContext * context, int cipher, |
100 | const unsigned char *key, int keylen); | 100 | const unsigned char *key, int keylen); |
101 | void | 101 | void |
102 | cipher_set_key_iv(CipherContext * context, int cipher, | 102 | cipher_set_key_iv(CipherContext * context, int cipher, |
103 | const unsigned char *key, int keylen, | 103 | const unsigned char *key, int keylen, |
104 | const unsigned char *iv, int ivlen); | 104 | const unsigned char *iv, int ivlen); |
105 | 105 | ||
106 | /* | 106 | /* |
107 | * Sets key for the cipher by computing the MD5 checksum of the passphrase, | 107 | * Sets key for the cipher by computing the MD5 checksum of the passphrase, |
108 | * and using the resulting 16 bytes as the key. | 108 | * and using the resulting 16 bytes as the key. |
109 | */ | 109 | */ |
110 | void | 110 | void |
111 | cipher_set_key_string(CipherContext * context, int cipher, | 111 | cipher_set_key_string(CipherContext * context, int cipher, |
112 | const char *passphrase); | 112 | const char *passphrase); |
113 | 113 | ||
114 | /* Encrypts data using the cipher. */ | 114 | /* Encrypts data using the cipher. */ |
115 | void | 115 | void |
116 | cipher_encrypt(CipherContext * context, unsigned char *dest, | 116 | cipher_encrypt(CipherContext * context, unsigned char *dest, |
117 | const unsigned char *src, unsigned int len); | 117 | const unsigned char *src, unsigned int len); |
118 | 118 | ||
119 | /* Decrypts data using the cipher. */ | 119 | /* Decrypts data using the cipher. */ |
120 | void | 120 | void |
121 | cipher_decrypt(CipherContext * context, unsigned char *dest, | 121 | cipher_decrypt(CipherContext * context, unsigned char *dest, |
122 | const unsigned char *src, unsigned int len); | 122 | const unsigned char *src, unsigned int len); |
123 | 123 | ||
diff --git a/clientloop.c b/clientloop.c index 91a200663..cc25ca550 100644 --- a/clientloop.c +++ b/clientloop.c | |||
@@ -1,22 +1,22 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * clientloop.c | 3 | * clientloop.c |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * | 10 | * |
11 | * Created: Sat Sep 23 12:23:57 1995 ylo | 11 | * Created: Sat Sep 23 12:23:57 1995 ylo |
12 | * | 12 | * |
13 | * The main loop for the interactive session (client side). | 13 | * The main loop for the interactive session (client side). |
14 | * | 14 | * |
15 | * SSH2 support added by Markus Friedl. | 15 | * SSH2 support added by Markus Friedl. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include "includes.h" | 18 | #include "includes.h" |
19 | RCSID("$Id: clientloop.c,v 1.10 2000/04/12 10:17:39 damien Exp $"); | 19 | RCSID("$Id: clientloop.c,v 1.11 2000/04/16 01:18:41 damien Exp $"); |
20 | 20 | ||
21 | #include "xmalloc.h" | 21 | #include "xmalloc.h" |
22 | #include "ssh.h" | 22 | #include "ssh.h" |
@@ -83,7 +83,7 @@ int session_ident = -1; | |||
83 | 83 | ||
84 | /* Returns the user\'s terminal to normal mode if it had been put in raw mode. */ | 84 | /* Returns the user\'s terminal to normal mode if it had been put in raw mode. */ |
85 | 85 | ||
86 | void | 86 | void |
87 | leave_raw_mode() | 87 | leave_raw_mode() |
88 | { | 88 | { |
89 | if (!in_raw_mode) | 89 | if (!in_raw_mode) |
@@ -97,7 +97,7 @@ leave_raw_mode() | |||
97 | 97 | ||
98 | /* Puts the user\'s terminal in raw mode. */ | 98 | /* Puts the user\'s terminal in raw mode. */ |
99 | 99 | ||
100 | void | 100 | void |
101 | enter_raw_mode() | 101 | enter_raw_mode() |
102 | { | 102 | { |
103 | struct termios tio; | 103 | struct termios tio; |
@@ -123,7 +123,7 @@ enter_raw_mode() | |||
123 | 123 | ||
124 | /* Restores stdin to blocking mode. */ | 124 | /* Restores stdin to blocking mode. */ |
125 | 125 | ||
126 | void | 126 | void |
127 | leave_non_blocking() | 127 | leave_non_blocking() |
128 | { | 128 | { |
129 | if (in_non_blocking_mode) { | 129 | if (in_non_blocking_mode) { |
@@ -135,7 +135,7 @@ leave_non_blocking() | |||
135 | 135 | ||
136 | /* Puts stdin terminal in non-blocking mode. */ | 136 | /* Puts stdin terminal in non-blocking mode. */ |
137 | 137 | ||
138 | void | 138 | void |
139 | enter_non_blocking() | 139 | enter_non_blocking() |
140 | { | 140 | { |
141 | in_non_blocking_mode = 1; | 141 | in_non_blocking_mode = 1; |
@@ -148,7 +148,7 @@ enter_non_blocking() | |||
148 | * flag indicating that the window has changed. | 148 | * flag indicating that the window has changed. |
149 | */ | 149 | */ |
150 | 150 | ||
151 | void | 151 | void |
152 | window_change_handler(int sig) | 152 | window_change_handler(int sig) |
153 | { | 153 | { |
154 | received_window_change_signal = 1; | 154 | received_window_change_signal = 1; |
@@ -160,7 +160,7 @@ window_change_handler(int sig) | |||
160 | * signals must be trapped to restore terminal modes. | 160 | * signals must be trapped to restore terminal modes. |
161 | */ | 161 | */ |
162 | 162 | ||
163 | void | 163 | void |
164 | signal_handler(int sig) | 164 | signal_handler(int sig) |
165 | { | 165 | { |
166 | if (in_raw_mode) | 166 | if (in_raw_mode) |
@@ -177,7 +177,7 @@ signal_handler(int sig) | |||
177 | * available resolution. | 177 | * available resolution. |
178 | */ | 178 | */ |
179 | 179 | ||
180 | double | 180 | double |
181 | get_current_time() | 181 | get_current_time() |
182 | { | 182 | { |
183 | struct timeval tv; | 183 | struct timeval tv; |
@@ -191,7 +191,7 @@ get_current_time() | |||
191 | * not appear to wake up when redirecting from /dev/null. | 191 | * not appear to wake up when redirecting from /dev/null. |
192 | */ | 192 | */ |
193 | 193 | ||
194 | void | 194 | void |
195 | client_check_initial_eof_on_stdin() | 195 | client_check_initial_eof_on_stdin() |
196 | { | 196 | { |
197 | int len; | 197 | int len; |
@@ -245,7 +245,7 @@ client_check_initial_eof_on_stdin() | |||
245 | * connection. | 245 | * connection. |
246 | */ | 246 | */ |
247 | 247 | ||
248 | void | 248 | void |
249 | client_make_packets_from_stdin_data() | 249 | client_make_packets_from_stdin_data() |
250 | { | 250 | { |
251 | unsigned int len; | 251 | unsigned int len; |
@@ -276,7 +276,7 @@ client_make_packets_from_stdin_data() | |||
276 | * appropriate. | 276 | * appropriate. |
277 | */ | 277 | */ |
278 | 278 | ||
279 | void | 279 | void |
280 | client_check_window_change() | 280 | client_check_window_change() |
281 | { | 281 | { |
282 | struct winsize ws; | 282 | struct winsize ws; |
@@ -313,7 +313,7 @@ client_check_window_change() | |||
313 | * one of the file descriptors). | 313 | * one of the file descriptors). |
314 | */ | 314 | */ |
315 | 315 | ||
316 | void | 316 | void |
317 | client_wait_until_can_do_something(fd_set * readset, fd_set * writeset) | 317 | client_wait_until_can_do_something(fd_set * readset, fd_set * writeset) |
318 | { | 318 | { |
319 | /*debug("client_wait_until_can_do_something"); */ | 319 | /*debug("client_wait_until_can_do_something"); */ |
@@ -380,7 +380,7 @@ client_wait_until_can_do_something(fd_set * readset, fd_set * writeset) | |||
380 | } | 380 | } |
381 | } | 381 | } |
382 | 382 | ||
383 | void | 383 | void |
384 | client_suspend_self() | 384 | client_suspend_self() |
385 | { | 385 | { |
386 | struct winsize oldws, newws; | 386 | struct winsize oldws, newws; |
@@ -425,7 +425,7 @@ client_suspend_self() | |||
425 | enter_raw_mode(); | 425 | enter_raw_mode(); |
426 | } | 426 | } |
427 | 427 | ||
428 | void | 428 | void |
429 | client_process_net_input(fd_set * readset) | 429 | client_process_net_input(fd_set * readset) |
430 | { | 430 | { |
431 | int len; | 431 | int len; |
@@ -468,7 +468,7 @@ client_process_net_input(fd_set * readset) | |||
468 | } | 468 | } |
469 | } | 469 | } |
470 | 470 | ||
471 | void | 471 | void |
472 | client_process_input(fd_set * readset) | 472 | client_process_input(fd_set * readset) |
473 | { | 473 | { |
474 | int len, pid; | 474 | int len, pid; |
@@ -657,7 +657,7 @@ Supported escape sequences:\r\n\ | |||
657 | } | 657 | } |
658 | } | 658 | } |
659 | 659 | ||
660 | void | 660 | void |
661 | client_process_output(fd_set * writeset) | 661 | client_process_output(fd_set * writeset) |
662 | { | 662 | { |
663 | int len; | 663 | int len; |
@@ -717,7 +717,7 @@ client_process_output(fd_set * writeset) | |||
717 | * preparatory phase. | 717 | * preparatory phase. |
718 | */ | 718 | */ |
719 | 719 | ||
720 | void | 720 | void |
721 | client_process_buffered_input_packets() | 721 | client_process_buffered_input_packets() |
722 | { | 722 | { |
723 | dispatch_run(DISPATCH_NONBLOCK, &quit_pending); | 723 | dispatch_run(DISPATCH_NONBLOCK, &quit_pending); |
@@ -730,7 +730,7 @@ client_process_buffered_input_packets() | |||
730 | * character for terminating or suspending the session. | 730 | * character for terminating or suspending the session. |
731 | */ | 731 | */ |
732 | 732 | ||
733 | int | 733 | int |
734 | client_loop(int have_pty, int escape_char_arg) | 734 | client_loop(int have_pty, int escape_char_arg) |
735 | { | 735 | { |
736 | extern Options options; | 736 | extern Options options; |
@@ -953,7 +953,7 @@ client_input_exit_status(int type, int plen) | |||
953 | quit_pending = 1; | 953 | quit_pending = 1; |
954 | } | 954 | } |
955 | 955 | ||
956 | void | 956 | void |
957 | client_init_dispatch_20() | 957 | client_init_dispatch_20() |
958 | { | 958 | { |
959 | dispatch_init(&dispatch_protocol_error); | 959 | dispatch_init(&dispatch_protocol_error); |
@@ -966,7 +966,7 @@ client_init_dispatch_20() | |||
966 | dispatch_set(SSH2_MSG_CHANNEL_REQUEST, &channel_input_channel_request); | 966 | dispatch_set(SSH2_MSG_CHANNEL_REQUEST, &channel_input_channel_request); |
967 | dispatch_set(SSH2_MSG_CHANNEL_WINDOW_ADJUST, &channel_input_window_adjust); | 967 | dispatch_set(SSH2_MSG_CHANNEL_WINDOW_ADJUST, &channel_input_window_adjust); |
968 | } | 968 | } |
969 | void | 969 | void |
970 | client_init_dispatch_13() | 970 | client_init_dispatch_13() |
971 | { | 971 | { |
972 | dispatch_init(NULL); | 972 | dispatch_init(NULL); |
@@ -983,14 +983,14 @@ client_init_dispatch_13() | |||
983 | dispatch_set(SSH_SMSG_STDOUT_DATA, &client_input_stdout_data); | 983 | dispatch_set(SSH_SMSG_STDOUT_DATA, &client_input_stdout_data); |
984 | dispatch_set(SSH_SMSG_X11_OPEN, &x11_input_open); | 984 | dispatch_set(SSH_SMSG_X11_OPEN, &x11_input_open); |
985 | } | 985 | } |
986 | void | 986 | void |
987 | client_init_dispatch_15() | 987 | client_init_dispatch_15() |
988 | { | 988 | { |
989 | client_init_dispatch_13(); | 989 | client_init_dispatch_13(); |
990 | dispatch_set(SSH_MSG_CHANNEL_CLOSE, &channel_input_ieof); | 990 | dispatch_set(SSH_MSG_CHANNEL_CLOSE, &channel_input_ieof); |
991 | dispatch_set(SSH_MSG_CHANNEL_CLOSE_CONFIRMATION, & channel_input_oclose); | 991 | dispatch_set(SSH_MSG_CHANNEL_CLOSE_CONFIRMATION, & channel_input_oclose); |
992 | } | 992 | } |
993 | void | 993 | void |
994 | client_init_dispatch() | 994 | client_init_dispatch() |
995 | { | 995 | { |
996 | if (compat20) | 996 | if (compat20) |
@@ -1027,6 +1027,7 @@ client_input_channel_req(int id, void *arg) | |||
1027 | } else if (strcmp(rtype, "exit-status") == 0) { | 1027 | } else if (strcmp(rtype, "exit-status") == 0) { |
1028 | success = 1; | 1028 | success = 1; |
1029 | exit_status = packet_get_int(); | 1029 | exit_status = packet_get_int(); |
1030 | packet_done(); | ||
1030 | } | 1031 | } |
1031 | if (reply) { | 1032 | if (reply) { |
1032 | packet_start(success ? | 1033 | packet_start(success ? |
@@ -28,7 +28,7 @@ | |||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "includes.h" | 30 | #include "includes.h" |
31 | RCSID("$Id: compat.c,v 1.7 2000/04/12 10:17:39 damien Exp $"); | 31 | RCSID("$Id: compat.c,v 1.8 2000/04/16 01:18:42 damien Exp $"); |
32 | 32 | ||
33 | #include "ssh.h" | 33 | #include "ssh.h" |
34 | #include "packet.h" | 34 | #include "packet.h" |
@@ -39,14 +39,14 @@ int compat13 = 0; | |||
39 | int compat20 = 0; | 39 | int compat20 = 0; |
40 | int datafellows = 0; | 40 | int datafellows = 0; |
41 | 41 | ||
42 | void | 42 | void |
43 | enable_compat20(void) | 43 | enable_compat20(void) |
44 | { | 44 | { |
45 | verbose("Enabling compatibility mode for protocol 2.0"); | 45 | verbose("Enabling compatibility mode for protocol 2.0"); |
46 | compat20 = 1; | 46 | compat20 = 1; |
47 | packet_set_ssh2_format(); | 47 | packet_set_ssh2_format(); |
48 | } | 48 | } |
49 | void | 49 | void |
50 | enable_compat13(void) | 50 | enable_compat13(void) |
51 | { | 51 | { |
52 | verbose("Enabling compatibility mode for protocol 1.3"); | 52 | verbose("Enabling compatibility mode for protocol 1.3"); |
diff --git a/compress.c b/compress.c index ee5cdccb5..610aaf7e6 100644 --- a/compress.c +++ b/compress.c | |||
@@ -1,20 +1,20 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * compress.c | 3 | * compress.c |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Wed Oct 25 22:12:46 1995 ylo | 10 | * Created: Wed Oct 25 22:12:46 1995 ylo |
11 | * | 11 | * |
12 | * Interface to packet compression for ssh. | 12 | * Interface to packet compression for ssh. |
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include "includes.h" | 16 | #include "includes.h" |
17 | RCSID("$Id: compress.c,v 1.5 2000/04/01 01:09:24 damien Exp $"); | 17 | RCSID("$Id: compress.c,v 1.6 2000/04/16 01:18:42 damien Exp $"); |
18 | 18 | ||
19 | #include "ssh.h" | 19 | #include "ssh.h" |
20 | #include "buffer.h" | 20 | #include "buffer.h" |
@@ -28,7 +28,7 @@ static z_stream outgoing_stream; | |||
28 | * (as in gzip). | 28 | * (as in gzip). |
29 | */ | 29 | */ |
30 | 30 | ||
31 | void | 31 | void |
32 | buffer_compress_init(int level) | 32 | buffer_compress_init(int level) |
33 | { | 33 | { |
34 | debug("Enabling compression at level %d.", level); | 34 | debug("Enabling compression at level %d.", level); |
@@ -40,7 +40,7 @@ buffer_compress_init(int level) | |||
40 | 40 | ||
41 | /* Frees any data structures allocated for compression. */ | 41 | /* Frees any data structures allocated for compression. */ |
42 | 42 | ||
43 | void | 43 | void |
44 | buffer_compress_uninit() | 44 | buffer_compress_uninit() |
45 | { | 45 | { |
46 | debug("compress outgoing: raw data %lu, compressed %lu, factor %.2f", | 46 | debug("compress outgoing: raw data %lu, compressed %lu, factor %.2f", |
@@ -64,7 +64,7 @@ buffer_compress_uninit() | |||
64 | * receiver. This appends the compressed data to the output buffer. | 64 | * receiver. This appends the compressed data to the output buffer. |
65 | */ | 65 | */ |
66 | 66 | ||
67 | void | 67 | void |
68 | buffer_compress(Buffer * input_buffer, Buffer * output_buffer) | 68 | buffer_compress(Buffer * input_buffer, Buffer * output_buffer) |
69 | { | 69 | { |
70 | char buf[4096]; | 70 | char buf[4096]; |
@@ -108,7 +108,7 @@ buffer_compress(Buffer * input_buffer, Buffer * output_buffer) | |||
108 | * with that. This appends the uncompressed data to the output buffer. | 108 | * with that. This appends the uncompressed data to the output buffer. |
109 | */ | 109 | */ |
110 | 110 | ||
111 | void | 111 | void |
112 | buffer_uncompress(Buffer * input_buffer, Buffer * output_buffer) | 112 | buffer_uncompress(Buffer * input_buffer, Buffer * output_buffer) |
113 | { | 113 | { |
114 | char buf[4096]; | 114 | char buf[4096]; |
diff --git a/compress.h b/compress.h index 41279a0bd..f13183324 100644 --- a/compress.h +++ b/compress.h | |||
@@ -1,19 +1,19 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * compress.h | 3 | * compress.h |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Wed Oct 25 22:12:46 1995 ylo | 10 | * Created: Wed Oct 25 22:12:46 1995 ylo |
11 | * | 11 | * |
12 | * Interface to packet compression for ssh. | 12 | * Interface to packet compression for ssh. |
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | /* RCSID("$Id: compress.h,v 1.3 1999/11/25 00:54:59 damien Exp $"); */ | 16 | /* RCSID("$Id: compress.h,v 1.4 2000/04/16 01:18:42 damien Exp $"); */ |
17 | 17 | ||
18 | #ifndef COMPRESS_H | 18 | #ifndef COMPRESS_H |
19 | #define COMPRESS_H | 19 | #define COMPRESS_H |
@@ -1,19 +1,19 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * crc32.h | 3 | * crc32.h |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1992 Tatu Ylonen, Espoo, Finland | 7 | * Copyright (c) 1992 Tatu Ylonen, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Tue Feb 11 14:37:27 1992 ylo | 10 | * Created: Tue Feb 11 14:37:27 1992 ylo |
11 | * | 11 | * |
12 | * Functions for computing 32-bit CRC. | 12 | * Functions for computing 32-bit CRC. |
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | /* RCSID("$Id: crc32.h,v 1.3 1999/11/25 00:54:59 damien Exp $"); */ | 16 | /* RCSID("$Id: crc32.h,v 1.4 2000/04/16 01:18:42 damien Exp $"); */ |
17 | 17 | ||
18 | #ifndef CRC32_H | 18 | #ifndef CRC32_H |
19 | #define CRC32_H | 19 | #define CRC32_H |
diff --git a/dispatch.c b/dispatch.c new file mode 100644 index 000000000..50f11f3cc --- /dev/null +++ b/dispatch.c | |||
@@ -0,0 +1,78 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions | ||
6 | * are met: | ||
7 | * 1. Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * 2. Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * 3. All advertising materials mentioning features or use of this software | ||
13 | * must display the following acknowledgement: | ||
14 | * This product includes software developed by Markus Friedl. | ||
15 | * 4. The name of the author may not be used to endorse or promote products | ||
16 | * derived from this software without specific prior written permission. | ||
17 | * | ||
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
28 | */ | ||
29 | #include "includes.h" | ||
30 | RCSID("$Id: dispatch.c,v 1.3 2000/04/16 01:18:42 damien Exp $"); | ||
31 | #include "ssh.h" | ||
32 | #include "dispatch.h" | ||
33 | #include "packet.h" | ||
34 | |||
35 | #define DISPATCH_MIN 0 | ||
36 | #define DISPATCH_MAX 255 | ||
37 | |||
38 | dispatch_fn *dispatch[DISPATCH_MAX]; | ||
39 | |||
40 | void | ||
41 | dispatch_protocol_error(int type, int plen) | ||
42 | { | ||
43 | error("Hm, dispatch protocol error: type %d plen %d", type, plen); | ||
44 | } | ||
45 | void | ||
46 | dispatch_init(dispatch_fn *dflt) | ||
47 | { | ||
48 | int i; | ||
49 | for (i = 0; i < DISPATCH_MAX; i++) | ||
50 | dispatch[i] = dflt; | ||
51 | } | ||
52 | void | ||
53 | dispatch_set(int type, dispatch_fn *fn) | ||
54 | { | ||
55 | dispatch[type] = fn; | ||
56 | } | ||
57 | void | ||
58 | dispatch_run(int mode, int *done) | ||
59 | { | ||
60 | for (;;) { | ||
61 | int plen; | ||
62 | int type; | ||
63 | |||
64 | if (mode == DISPATCH_BLOCK) { | ||
65 | type = packet_read(&plen); | ||
66 | } else { | ||
67 | type = packet_read_poll(&plen); | ||
68 | if (type == SSH_MSG_NONE) | ||
69 | return; | ||
70 | } | ||
71 | if (type > 0 && type < DISPATCH_MAX && dispatch[type] != NULL) | ||
72 | (*dispatch[type])(type, plen); | ||
73 | else | ||
74 | packet_disconnect("protocol error: rcvd type %d", type); | ||
75 | if (done != NULL && *done) | ||
76 | return; | ||
77 | } | ||
78 | } | ||
@@ -28,7 +28,7 @@ | |||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "includes.h" | 30 | #include "includes.h" |
31 | RCSID("$Id: dsa.c,v 1.3 2000/04/12 09:39:10 markus Exp $"); | 31 | RCSID("$Id: dsa.c,v 1.4 2000/04/14 10:30:31 markus Exp $"); |
32 | 32 | ||
33 | #include "ssh.h" | 33 | #include "ssh.h" |
34 | #include "xmalloc.h" | 34 | #include "xmalloc.h" |
@@ -108,7 +108,7 @@ dsa_load_private(char *filename) | |||
108 | in = BIO_new(BIO_s_file()); | 108 | in = BIO_new(BIO_s_file()); |
109 | if (in == NULL) | 109 | if (in == NULL) |
110 | fatal("BIO_new failed"); | 110 | fatal("BIO_new failed"); |
111 | if (BIO_read_filename(in, filename) <= 0) | 111 | if (BIO_read_filename(in, filename) <= 0) |
112 | fatal("BIO_read failed %s: %s", filename, strerror(errno)); | 112 | fatal("BIO_read failed %s: %s", filename, strerror(errno)); |
113 | fprintf(stderr, "read DSA private key\n"); | 113 | fprintf(stderr, "read DSA private key\n"); |
114 | dsa = PEM_read_bio_DSAPrivateKey(in,NULL,NULL,NULL); | 114 | dsa = PEM_read_bio_DSAPrivateKey(in,NULL,NULL,NULL); |
@@ -182,9 +182,9 @@ dsa_sign( | |||
182 | 182 | ||
183 | sig = DSA_do_sign(digest, evp_md->md_size, key->dsa); | 183 | sig = DSA_do_sign(digest, evp_md->md_size, key->dsa); |
184 | 184 | ||
185 | rlen = BN_num_bytes(sig->r); | 185 | rlen = BN_num_bytes(sig->r); |
186 | slen = BN_num_bytes(sig->s); | 186 | slen = BN_num_bytes(sig->s); |
187 | if (rlen > INTBLOB_LEN || slen > INTBLOB_LEN) { | 187 | if (rlen > INTBLOB_LEN || slen > INTBLOB_LEN) { |
188 | error("bad sig size %d %d", rlen, slen); | 188 | error("bad sig size %d %d", rlen, slen); |
189 | DSA_SIG_free(sig); | 189 | DSA_SIG_free(sig); |
190 | return -1; | 190 | return -1; |
@@ -1,19 +1,19 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * getput.h | 3 | * getput.h |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Wed Jun 28 22:36:30 1995 ylo | 10 | * Created: Wed Jun 28 22:36:30 1995 ylo |
11 | * | 11 | * |
12 | * Macros for storing and retrieving data in msb first and lsb first order. | 12 | * Macros for storing and retrieving data in msb first and lsb first order. |
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | /* RCSID("$Id: getput.h,v 1.2 1999/11/24 13:26:22 damien Exp $"); */ | 16 | /* RCSID("$Id: getput.h,v 1.3 2000/04/16 01:18:42 damien Exp $"); */ |
17 | 17 | ||
18 | #ifndef GETPUT_H | 18 | #ifndef GETPUT_H |
19 | #define GETPUT_H | 19 | #define GETPUT_H |
@@ -21,7 +21,7 @@ | |||
21 | /*------------ macros for storing/extracting msb first words -------------*/ | 21 | /*------------ macros for storing/extracting msb first words -------------*/ |
22 | 22 | ||
23 | #define GET_32BIT(cp) (((unsigned long)(unsigned char)(cp)[0] << 24) | \ | 23 | #define GET_32BIT(cp) (((unsigned long)(unsigned char)(cp)[0] << 24) | \ |
24 | ((unsigned long)(unsigned char)(cp)[1] << 16) | \ | 24 | ((unsigned long)(unsigned char)(cp)[1] << 16) | \ |
25 | ((unsigned long)(unsigned char)(cp)[2] << 8) | \ | 25 | ((unsigned long)(unsigned char)(cp)[2] << 8) | \ |
26 | ((unsigned long)(unsigned char)(cp)[3])) | 26 | ((unsigned long)(unsigned char)(cp)[3])) |
27 | 27 | ||
diff --git a/hostfile.c b/hostfile.c index c594c29aa..b027075af 100644 --- a/hostfile.c +++ b/hostfile.c | |||
@@ -1,20 +1,20 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * hostfile.c | 3 | * hostfile.c |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Thu Jun 29 07:10:56 1995 ylo | 10 | * Created: Thu Jun 29 07:10:56 1995 ylo |
11 | * | 11 | * |
12 | * Functions for manipulating the known hosts files. | 12 | * Functions for manipulating the known hosts files. |
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include "includes.h" | 16 | #include "includes.h" |
17 | RCSID("$OpenBSD: hostfile.c,v 1.15 2000/04/12 09:39:10 markus Exp $"); | 17 | RCSID("$OpenBSD: hostfile.c,v 1.16 2000/04/14 10:30:31 markus Exp $"); |
18 | 18 | ||
19 | #ifdef HAVE_OPENSSL | 19 | #ifdef HAVE_OPENSSL |
20 | #include <openssl/bn.h> | 20 | #include <openssl/bn.h> |
diff --git a/hostfile.h b/hostfile.h index 64fe185da..c9bdd7f2e 100644 --- a/hostfile.h +++ b/hostfile.h | |||
@@ -10,7 +10,7 @@ | |||
10 | typedef enum { | 10 | typedef enum { |
11 | HOST_OK, HOST_NEW, HOST_CHANGED | 11 | HOST_OK, HOST_NEW, HOST_CHANGED |
12 | } HostStatus; | 12 | } HostStatus; |
13 | HostStatus | 13 | HostStatus |
14 | check_host_in_hostfile(const char *filename, const char *host, Key *key, Key *found); | 14 | check_host_in_hostfile(const char *filename, const char *host, Key *key, Key *found); |
15 | 15 | ||
16 | /* | 16 | /* |
diff --git a/includes.h b/includes.h index 746e76e58..512266762 100644 --- a/includes.h +++ b/includes.h | |||
@@ -1,16 +1,16 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * includes.h | 3 | * includes.h |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Thu Mar 23 16:29:37 1995 ylo | 10 | * Created: Thu Mar 23 16:29:37 1995 ylo |
11 | * | 11 | * |
12 | * This file includes most of the needed system headers. | 12 | * This file includes most of the needed system headers. |
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #ifndef INCLUDES_H | 16 | #ifndef INCLUDES_H |
@@ -28,7 +28,7 @@ | |||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "includes.h" | 30 | #include "includes.h" |
31 | RCSID("$Id: kex.c,v 1.4 2000/04/13 02:26:36 damien Exp $"); | 31 | RCSID("$Id: kex.c,v 1.5 2000/04/16 01:18:43 damien Exp $"); |
32 | 32 | ||
33 | #include "ssh.h" | 33 | #include "ssh.h" |
34 | #include "ssh2.h" | 34 | #include "ssh2.h" |
@@ -149,12 +149,12 @@ void | |||
149 | dump_digest(unsigned char *digest, int len) | 149 | dump_digest(unsigned char *digest, int len) |
150 | { | 150 | { |
151 | int i; | 151 | int i; |
152 | for (i = 0; i< len; i++){ | 152 | for (i = 0; i< len; i++){ |
153 | fprintf(stderr, "%02x", digest[i]); | 153 | fprintf(stderr, "%02x", digest[i]); |
154 | if(i%2!=0) | 154 | if(i%2!=0) |
155 | fprintf(stderr, " "); | 155 | fprintf(stderr, " "); |
156 | } | 156 | } |
157 | fprintf(stderr, "\n"); | 157 | fprintf(stderr, "\n"); |
158 | } | 158 | } |
159 | 159 | ||
160 | unsigned char * | 160 | unsigned char * |
@@ -201,7 +201,7 @@ kex_hash( | |||
201 | buffer_free(&b); | 201 | buffer_free(&b); |
202 | 202 | ||
203 | #ifdef DEBUG_KEX | 203 | #ifdef DEBUG_KEX |
204 | dump_digest(digest, evp_md->md_size); | 204 | dump_digest(digest, evp_md->md_size); |
205 | #endif | 205 | #endif |
206 | return digest; | 206 | return digest; |
207 | } | 207 | } |
@@ -345,7 +345,7 @@ choose_kex(Kex *k, char *client, char *server) | |||
345 | k->name = get_match(client, server); | 345 | k->name = get_match(client, server); |
346 | if (k->name == NULL) | 346 | if (k->name == NULL) |
347 | fatal("no kex alg"); | 347 | fatal("no kex alg"); |
348 | if (strcmp(k->name, KEX_DH1) != 0) | 348 | if (strcmp(k->name, KEX_DH1) != 0) |
349 | fatal("bad kex alg %s", k->name); | 349 | fatal("bad kex alg %s", k->name); |
350 | } | 350 | } |
351 | void | 351 | void |
diff --git a/log-client.c b/log-client.c index 11ac45d7a..e86a2e330 100644 --- a/log-client.c +++ b/log-client.c | |||
@@ -1,21 +1,21 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * log-client.c | 3 | * log-client.c |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Mon Mar 20 21:13:40 1995 ylo | 10 | * Created: Mon Mar 20 21:13:40 1995 ylo |
11 | * | 11 | * |
12 | * Client-side versions of debug(), log(), etc. These print to stderr. | 12 | * Client-side versions of debug(), log(), etc. These print to stderr. |
13 | * This is a stripped down version of log-server.c. | 13 | * This is a stripped down version of log-server.c. |
14 | * | 14 | * |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "includes.h" | 17 | #include "includes.h" |
18 | RCSID("$Id: log-client.c,v 1.5 2000/03/09 10:27:50 damien Exp $"); | 18 | RCSID("$Id: log-client.c,v 1.6 2000/04/16 01:18:43 damien Exp $"); |
19 | 19 | ||
20 | #include "xmalloc.h" | 20 | #include "xmalloc.h" |
21 | #include "ssh.h" | 21 | #include "ssh.h" |
diff --git a/log-server.c b/log-server.c index 476e49f80..9070b6530 100644 --- a/log-server.c +++ b/log-server.c | |||
@@ -1,21 +1,21 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * log-server.c | 3 | * log-server.c |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Mon Mar 20 21:19:30 1995 ylo | 10 | * Created: Mon Mar 20 21:19:30 1995 ylo |
11 | * | 11 | * |
12 | * Server-side versions of debug(), log(), etc. These normally send the output | 12 | * Server-side versions of debug(), log(), etc. These normally send the output |
13 | * to the system log. | 13 | * to the system log. |
14 | * | 14 | * |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "includes.h" | 17 | #include "includes.h" |
18 | RCSID("$Id: log-server.c,v 1.8 2000/04/01 01:09:24 damien Exp $"); | 18 | RCSID("$Id: log-server.c,v 1.9 2000/04/16 01:18:43 damien Exp $"); |
19 | 19 | ||
20 | #include <syslog.h> | 20 | #include <syslog.h> |
21 | #include "packet.h" | 21 | #include "packet.h" |
@@ -38,7 +38,7 @@ static int log_facility = LOG_AUTH; | |||
38 | * level logging level | 38 | * level logging level |
39 | */ | 39 | */ |
40 | 40 | ||
41 | void | 41 | void |
42 | log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr) | 42 | log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr) |
43 | { | 43 | { |
44 | switch (level) { | 44 | switch (level) { |
@@ -1,24 +1,24 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * login.c | 3 | * login.c |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Fri Mar 24 14:51:08 1995 ylo | 10 | * Created: Fri Mar 24 14:51:08 1995 ylo |
11 | * | 11 | * |
12 | * This file performs some of the things login(1) normally does. We cannot | 12 | * This file performs some of the things login(1) normally does. We cannot |
13 | * easily use something like login -p -h host -f user, because there are | 13 | * easily use something like login -p -h host -f user, because there are |
14 | * several different logins around, and it is hard to determined what kind of | 14 | * several different logins around, and it is hard to determined what kind of |
15 | * login the current system has. Also, we want to be able to execute commands | 15 | * login the current system has. Also, we want to be able to execute commands |
16 | * on a tty. | 16 | * on a tty. |
17 | * | 17 | * |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include "includes.h" | 20 | #include "includes.h" |
21 | RCSID("$Id: login.c,v 1.22 2000/02/02 08:17:41 damien Exp $"); | 21 | RCSID("$Id: login.c,v 1.23 2000/04/16 01:18:43 damien Exp $"); |
22 | 22 | ||
23 | #if defined(HAVE_UTMPX_H) && defined(USE_UTMPX) | 23 | #if defined(HAVE_UTMPX_H) && defined(USE_UTMPX) |
24 | # include <utmpx.h> | 24 | # include <utmpx.h> |
@@ -49,7 +49,7 @@ RCSID("$Id: login.c,v 1.22 2000/02/02 08:17:41 damien Exp $"); | |||
49 | * is found). The name of the host used last time is returned in buf. | 49 | * is found). The name of the host used last time is returned in buf. |
50 | */ | 50 | */ |
51 | 51 | ||
52 | unsigned long | 52 | unsigned long |
53 | get_last_login_time(uid_t uid, const char *logname, | 53 | get_last_login_time(uid_t uid, const char *logname, |
54 | char *buf, unsigned int bufsize) | 54 | char *buf, unsigned int bufsize) |
55 | { | 55 | { |
@@ -135,7 +135,7 @@ get_last_login_time(uid_t uid, const char *logname, | |||
135 | * were more standardized. | 135 | * were more standardized. |
136 | */ | 136 | */ |
137 | 137 | ||
138 | void | 138 | void |
139 | record_login(int pid, const char *ttyname, const char *user, uid_t uid, | 139 | record_login(int pid, const char *ttyname, const char *user, uid_t uid, |
140 | const char *host, struct sockaddr * addr) | 140 | const char *host, struct sockaddr * addr) |
141 | { | 141 | { |
@@ -273,7 +273,7 @@ record_login(int pid, const char *ttyname, const char *user, uid_t uid, | |||
273 | 273 | ||
274 | /* Records that the user has logged out. */ | 274 | /* Records that the user has logged out. */ |
275 | 275 | ||
276 | void | 276 | void |
277 | record_logout(int pid, const char *ttyname) | 277 | record_logout(int pid, const char *ttyname) |
278 | { | 278 | { |
279 | #ifdef HAVE_LIBUTIL_LOGIN | 279 | #ifdef HAVE_LIBUTIL_LOGIN |
@@ -1,20 +1,20 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * match.c | 3 | * match.c |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Thu Jun 22 01:17:50 1995 ylo | 10 | * Created: Thu Jun 22 01:17:50 1995 ylo |
11 | * | 11 | * |
12 | * Simple pattern matching, with '*' and '?' as wildcards. | 12 | * Simple pattern matching, with '*' and '?' as wildcards. |
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include "includes.h" | 16 | #include "includes.h" |
17 | RCSID("$Id: match.c,v 1.4 2000/03/26 03:04:53 damien Exp $"); | 17 | RCSID("$Id: match.c,v 1.5 2000/04/16 01:18:43 damien Exp $"); |
18 | 18 | ||
19 | #include "ssh.h" | 19 | #include "ssh.h" |
20 | 20 | ||
@@ -23,7 +23,7 @@ RCSID("$Id: match.c,v 1.4 2000/03/26 03:04:53 damien Exp $"); | |||
23 | * and * as wildcards), and zero if it does not match. | 23 | * and * as wildcards), and zero if it does not match. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | int | 26 | int |
27 | match_pattern(const char *s, const char *pattern) | 27 | match_pattern(const char *s, const char *pattern) |
28 | { | 28 | { |
29 | for (;;) { | 29 | for (;;) { |
@@ -1,21 +1,21 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * mpaux.c | 3 | * mpaux.c |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Sun Jul 16 04:29:30 1995 ylo | 10 | * Created: Sun Jul 16 04:29:30 1995 ylo |
11 | * | 11 | * |
12 | * This file contains various auxiliary functions related to multiple | 12 | * This file contains various auxiliary functions related to multiple |
13 | * precision integers. | 13 | * precision integers. |
14 | * | 14 | * |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "includes.h" | 17 | #include "includes.h" |
18 | RCSID("$Id: mpaux.c,v 1.10 2000/04/13 02:26:36 damien Exp $"); | 18 | RCSID("$Id: mpaux.c,v 1.11 2000/04/16 01:18:43 damien Exp $"); |
19 | 19 | ||
20 | #include "getput.h" | 20 | #include "getput.h" |
21 | #include "xmalloc.h" | 21 | #include "xmalloc.h" |
@@ -1,19 +1,19 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * mpaux.h | 3 | * mpaux.h |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Sun Jul 16 04:29:30 1995 ylo | 10 | * Created: Sun Jul 16 04:29:30 1995 ylo |
11 | * | 11 | * |
12 | * This file contains various auxiliary functions related to multiple | 12 | * This file contains various auxiliary functions related to multiple |
13 | * precision integers. | 13 | * precision integers. |
14 | */ | 14 | */ |
15 | 15 | ||
16 | /* RCSID("$Id: mpaux.h,v 1.4 1999/11/25 00:54:59 damien Exp $"); */ | 16 | /* RCSID("$Id: mpaux.h,v 1.5 2000/04/16 01:18:43 damien Exp $"); */ |
17 | 17 | ||
18 | #ifndef MPAUX_H | 18 | #ifndef MPAUX_H |
19 | #define MPAUX_H | 19 | #define MPAUX_H |
@@ -23,7 +23,7 @@ | |||
23 | * session id is computed by concatenating the linearized, msb first | 23 | * session id is computed by concatenating the linearized, msb first |
24 | * representations of host_key_n, session_key_n, and the cookie. | 24 | * representations of host_key_n, session_key_n, and the cookie. |
25 | */ | 25 | */ |
26 | void | 26 | void |
27 | compute_session_id(unsigned char session_id[16], | 27 | compute_session_id(unsigned char session_id[16], |
28 | unsigned char cookie[8], | 28 | unsigned char cookie[8], |
29 | BIGNUM * host_key_n, | 29 | BIGNUM * host_key_n, |
@@ -28,7 +28,7 @@ | |||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "includes.h" | 30 | #include "includes.h" |
31 | RCSID("$Id: nchan.c,v 1.7 2000/04/04 04:39:02 damien Exp $"); | 31 | RCSID("$Id: nchan.c,v 1.8 2000/04/16 01:18:43 damien Exp $"); |
32 | 32 | ||
33 | #include "ssh.h" | 33 | #include "ssh.h" |
34 | 34 | ||
@@ -389,11 +389,11 @@ chan_delete_if_full_closed2(Channel *c) | |||
389 | if (!(c->flags & CHAN_CLOSE_SENT)) { | 389 | if (!(c->flags & CHAN_CLOSE_SENT)) { |
390 | chan_send_close2(c); | 390 | chan_send_close2(c); |
391 | } | 391 | } |
392 | if ((c->flags & CHAN_CLOSE_SENT) && | 392 | if ((c->flags & CHAN_CLOSE_SENT) && |
393 | (c->flags & CHAN_CLOSE_RCVD)) { | 393 | (c->flags & CHAN_CLOSE_RCVD)) { |
394 | debug("channel %d: full closed2", c->self); | 394 | debug("channel %d: full closed2", c->self); |
395 | channel_free(c->self); | 395 | channel_free(c->self); |
396 | } | 396 | } |
397 | } | 397 | } |
398 | } | 398 | } |
399 | 399 | ||
@@ -1,14 +1,14 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * packet.c | 3 | * packet.c |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Sat Mar 18 02:40:40 1995 ylo | 10 | * Created: Sat Mar 18 02:40:40 1995 ylo |
11 | * | 11 | * |
12 | * This file contains code implementing the packet protocol and communication | 12 | * This file contains code implementing the packet protocol and communication |
13 | * with the other side. This same code is used both on client and server side. | 13 | * with the other side. This same code is used both on client and server side. |
14 | * | 14 | * |
@@ -17,7 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include "includes.h" | 19 | #include "includes.h" |
20 | RCSID("$Id: packet.c,v 1.17 2000/04/13 02:26:37 damien Exp $"); | 20 | RCSID("$Id: packet.c,v 1.18 2000/04/16 01:18:43 damien Exp $"); |
21 | 21 | ||
22 | #ifdef HAVE_OPENSSL | 22 | #ifdef HAVE_OPENSSL |
23 | # include <openssl/bn.h> | 23 | # include <openssl/bn.h> |
@@ -529,7 +529,7 @@ packet_send2() | |||
529 | unsigned int packet_length = 0; | 529 | unsigned int packet_length = 0; |
530 | unsigned int i, padlen, len; | 530 | unsigned int i, padlen, len; |
531 | u_int32_t rand = 0; | 531 | u_int32_t rand = 0; |
532 | static unsigned int seqnr = 0; | 532 | static unsigned int seqnr = 0; |
533 | int type; | 533 | int type; |
534 | Enc *enc = NULL; | 534 | Enc *enc = NULL; |
535 | Mac *mac = NULL; | 535 | Mac *mac = NULL; |
@@ -611,9 +611,9 @@ packet_send2() | |||
611 | fprintf(stderr, "encrypted: "); | 611 | fprintf(stderr, "encrypted: "); |
612 | buffer_dump(&output); | 612 | buffer_dump(&output); |
613 | #endif | 613 | #endif |
614 | /* increment sequence number for outgoing packets */ | 614 | /* increment sequence number for outgoing packets */ |
615 | if (++seqnr == 0) | 615 | if (++seqnr == 0) |
616 | log("outgoing seqnr wraps around"); | 616 | log("outgoing seqnr wraps around"); |
617 | buffer_clear(&outgoing_packet); | 617 | buffer_clear(&outgoing_packet); |
618 | 618 | ||
619 | if (type == SSH2_MSG_NEWKEYS) { | 619 | if (type == SSH2_MSG_NEWKEYS) { |
@@ -877,7 +877,7 @@ packet_read_poll2(int *payload_len_ptr) | |||
877 | * compute MAC over seqnr and packet, | 877 | * compute MAC over seqnr and packet, |
878 | * increment sequence number for incoming packet | 878 | * increment sequence number for incoming packet |
879 | */ | 879 | */ |
880 | if (mac && mac->enabled) { | 880 | if (mac && mac->enabled) { |
881 | macbuf = hmac( mac->md, seqnr, | 881 | macbuf = hmac( mac->md, seqnr, |
882 | (unsigned char *) buffer_ptr(&incoming_packet), | 882 | (unsigned char *) buffer_ptr(&incoming_packet), |
883 | buffer_len(&incoming_packet), | 883 | buffer_len(&incoming_packet), |
@@ -888,8 +888,8 @@ packet_read_poll2(int *payload_len_ptr) | |||
888 | DBG(debug("HMAC #%d ok", seqnr)); | 888 | DBG(debug("HMAC #%d ok", seqnr)); |
889 | buffer_consume(&input, mac->mac_len); | 889 | buffer_consume(&input, mac->mac_len); |
890 | } | 890 | } |
891 | if (++seqnr == 0) | 891 | if (++seqnr == 0) |
892 | log("incoming seqnr wraps around"); | 892 | log("incoming seqnr wraps around"); |
893 | 893 | ||
894 | /* get padlen */ | 894 | /* get padlen */ |
895 | cp = buffer_ptr(&incoming_packet) + 4; | 895 | cp = buffer_ptr(&incoming_packet) + 4; |
@@ -1063,6 +1063,12 @@ packet_get_raw(int *length_ptr) | |||
1063 | return buffer_ptr(&incoming_packet); | 1063 | return buffer_ptr(&incoming_packet); |
1064 | } | 1064 | } |
1065 | 1065 | ||
1066 | int | ||
1067 | packet_remaining(void) | ||
1068 | { | ||
1069 | return buffer_len(&incoming_packet); | ||
1070 | } | ||
1071 | |||
1066 | /* | 1072 | /* |
1067 | * Returns a string from the packet data. The string is allocated using | 1073 | * Returns a string from the packet data. The string is allocated using |
1068 | * xmalloc; it is the responsibility of the calling program to free it when | 1074 | * xmalloc; it is the responsibility of the calling program to free it when |
@@ -1,19 +1,19 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * packet.h | 3 | * packet.h |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Sat Mar 18 02:02:14 1995 ylo | 10 | * Created: Sat Mar 18 02:02:14 1995 ylo |
11 | * | 11 | * |
12 | * Interface for the packet protocol functions. | 12 | * Interface for the packet protocol functions. |
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | /* RCSID("$Id: packet.h,v 1.13 2000/04/13 02:26:37 damien Exp $"); */ | 16 | /* RCSID("$Id: packet.h,v 1.14 2000/04/16 01:18:44 damien Exp $"); */ |
17 | 17 | ||
18 | #ifndef PACKET_H | 18 | #ifndef PACKET_H |
19 | #define PACKET_H | 19 | #define PACKET_H |
@@ -52,7 +52,7 @@ void packet_close(void); | |||
52 | * key is used for both sending and reception. However, both directions are | 52 | * key is used for both sending and reception. However, both directions are |
53 | * encrypted independently of each other. Cipher types are defined in ssh.h. | 53 | * encrypted independently of each other. Cipher types are defined in ssh.h. |
54 | */ | 54 | */ |
55 | void | 55 | void |
56 | packet_set_encryption_key(const unsigned char *key, unsigned int keylen, | 56 | packet_set_encryption_key(const unsigned char *key, unsigned int keylen, |
57 | int cipher_type); | 57 | int cipher_type); |
58 | 58 | ||
@@ -201,6 +201,16 @@ do { \ | |||
201 | } \ | 201 | } \ |
202 | } while (0) | 202 | } while (0) |
203 | 203 | ||
204 | #define packet_done() \ | ||
205 | do { \ | ||
206 | int _len = packet_remaining(); \ | ||
207 | if (_len > 0) { \ | ||
208 | log("Packet integrity error (%d bytes remaining) at %s:%d", \ | ||
209 | _len ,__FILE__, __LINE__); \ | ||
210 | packet_disconnect("Packet integrity error."); \ | ||
211 | } \ | ||
212 | } while (0) | ||
213 | |||
204 | /* remote host is connected via a socket/ipv4 */ | 214 | /* remote host is connected via a socket/ipv4 */ |
205 | int packet_connection_is_on_socket(void); | 215 | int packet_connection_is_on_socket(void); |
206 | int packet_connection_is_ipv4(void); | 216 | int packet_connection_is_ipv4(void); |
@@ -208,4 +218,7 @@ int packet_connection_is_ipv4(void); | |||
208 | /* enable SSH2 packet format */ | 218 | /* enable SSH2 packet format */ |
209 | void packet_set_ssh2_format(void); | 219 | void packet_set_ssh2_format(void); |
210 | 220 | ||
221 | /* returns remaining payload bytes */ | ||
222 | int packet_remaining(void); | ||
223 | |||
211 | #endif /* PACKET_H */ | 224 | #endif /* PACKET_H */ |
@@ -1,20 +1,20 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * pty.c | 3 | * pty.c |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Fri Mar 17 04:37:25 1995 ylo | 10 | * Created: Fri Mar 17 04:37:25 1995 ylo |
11 | * | 11 | * |
12 | * Allocating a pseudo-terminal, and making it the controlling tty. | 12 | * Allocating a pseudo-terminal, and making it the controlling tty. |
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include "includes.h" | 16 | #include "includes.h" |
17 | RCSID("$Id: pty.c,v 1.17 2000/03/17 12:58:59 damien Exp $"); | 17 | RCSID("$Id: pty.c,v 1.18 2000/04/16 01:18:44 damien Exp $"); |
18 | 18 | ||
19 | #ifdef HAVE_UTIL_H | 19 | #ifdef HAVE_UTIL_H |
20 | # include <util.h> | 20 | # include <util.h> |
@@ -46,7 +46,7 @@ RCSID("$Id: pty.c,v 1.17 2000/03/17 12:58:59 damien Exp $"); | |||
46 | * returned (the buffer must be able to hold at least 64 characters). | 46 | * returned (the buffer must be able to hold at least 64 characters). |
47 | */ | 47 | */ |
48 | 48 | ||
49 | int | 49 | int |
50 | pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen) | 50 | pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen) |
51 | { | 51 | { |
52 | #if defined(HAVE_OPENPTY) || defined(BSD4_4) | 52 | #if defined(HAVE_OPENPTY) || defined(BSD4_4) |
@@ -186,7 +186,7 @@ pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen) | |||
186 | 186 | ||
187 | /* Releases the tty. Its ownership is returned to root, and permissions to 0666. */ | 187 | /* Releases the tty. Its ownership is returned to root, and permissions to 0666. */ |
188 | 188 | ||
189 | void | 189 | void |
190 | pty_release(const char *ttyname) | 190 | pty_release(const char *ttyname) |
191 | { | 191 | { |
192 | if (chown(ttyname, (uid_t) 0, (gid_t) 0) < 0) | 192 | if (chown(ttyname, (uid_t) 0, (gid_t) 0) < 0) |
@@ -197,7 +197,7 @@ pty_release(const char *ttyname) | |||
197 | 197 | ||
198 | /* Makes the tty the processes controlling tty and sets it to sane modes. */ | 198 | /* Makes the tty the processes controlling tty and sets it to sane modes. */ |
199 | 199 | ||
200 | void | 200 | void |
201 | pty_make_controlling_tty(int *ttyfd, const char *ttyname) | 201 | pty_make_controlling_tty(int *ttyfd, const char *ttyname) |
202 | { | 202 | { |
203 | int fd; | 203 | int fd; |
@@ -250,7 +250,7 @@ pty_make_controlling_tty(int *ttyfd, const char *ttyname) | |||
250 | 250 | ||
251 | /* Changes the window size associated with the pty. */ | 251 | /* Changes the window size associated with the pty. */ |
252 | 252 | ||
253 | void | 253 | void |
254 | pty_change_window_size(int ptyfd, int row, int col, | 254 | pty_change_window_size(int ptyfd, int row, int col, |
255 | int xpixel, int ypixel) | 255 | int xpixel, int ypixel) |
256 | { | 256 | { |
@@ -1,19 +1,19 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * pty.h | 3 | * pty.h |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Fri Mar 17 05:03:28 1995 ylo | 10 | * Created: Fri Mar 17 05:03:28 1995 ylo |
11 | * | 11 | * |
12 | * Functions for allocating a pseudo-terminal and making it the controlling | 12 | * Functions for allocating a pseudo-terminal and making it the controlling |
13 | * tty. | 13 | * tty. |
14 | */ | 14 | */ |
15 | 15 | ||
16 | /* RCSID("$Id: pty.h,v 1.7 2000/04/01 01:09:25 damien Exp $"); */ | 16 | /* RCSID("$Id: pty.h,v 1.8 2000/04/16 01:18:44 damien Exp $"); */ |
17 | 17 | ||
18 | #ifndef PTY_H | 18 | #ifndef PTY_H |
19 | #define PTY_H | 19 | #define PTY_H |
@@ -39,7 +39,7 @@ void pty_release(const char *ttyname); | |||
39 | void pty_make_controlling_tty(int *ttyfd, const char *ttyname); | 39 | void pty_make_controlling_tty(int *ttyfd, const char *ttyname); |
40 | 40 | ||
41 | /* Changes the window size associated with the pty. */ | 41 | /* Changes the window size associated with the pty. */ |
42 | void | 42 | void |
43 | pty_change_window_size(int ptyfd, int row, int col, | 43 | pty_change_window_size(int ptyfd, int row, int col, |
44 | int xpixel, int ypixel); | 44 | int xpixel, int ypixel); |
45 | 45 | ||
@@ -1,10 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | * radix.c | 2 | * radix.c |
3 | * | 3 | * |
4 | * base-64 encoding pinched from lynx2-7-2, who pinched it from rpem. | 4 | * base-64 encoding pinched from lynx2-7-2, who pinched it from rpem. |
5 | * Originally written by Mark Riordan 12 August 1990 and 17 Feb 1991 | 5 | * Originally written by Mark Riordan 12 August 1990 and 17 Feb 1991 |
6 | * and placed in the public domain. | 6 | * and placed in the public domain. |
7 | * | 7 | * |
8 | * Dug Song <dugsong@UMICH.EDU> | 8 | * Dug Song <dugsong@UMICH.EDU> |
9 | */ | 9 | */ |
10 | 10 | ||
@@ -23,7 +23,7 @@ char six2pr[64] = { | |||
23 | 23 | ||
24 | unsigned char pr2six[256]; | 24 | unsigned char pr2six[256]; |
25 | 25 | ||
26 | int | 26 | int |
27 | uuencode(unsigned char *bufin, unsigned int nbytes, char *bufcoded) | 27 | uuencode(unsigned char *bufin, unsigned int nbytes, char *bufcoded) |
28 | { | 28 | { |
29 | /* ENC is the basic 1 character encoding function to make a char printing */ | 29 | /* ENC is the basic 1 character encoding function to make a char printing */ |
@@ -49,7 +49,7 @@ uuencode(unsigned char *bufin, unsigned int nbytes, char *bufcoded) | |||
49 | return (outptr - bufcoded); | 49 | return (outptr - bufcoded); |
50 | } | 50 | } |
51 | 51 | ||
52 | int | 52 | int |
53 | uudecode(const char *bufcoded, unsigned char *bufplain, int outbufsize) | 53 | uudecode(const char *bufcoded, unsigned char *bufplain, int outbufsize) |
54 | { | 54 | { |
55 | /* single character decode */ | 55 | /* single character decode */ |
@@ -162,7 +162,7 @@ typedef unsigned short my_u_short; | |||
162 | } | 162 | } |
163 | 163 | ||
164 | 164 | ||
165 | int | 165 | int |
166 | creds_to_radix(CREDENTIALS *creds, unsigned char *buf) | 166 | creds_to_radix(CREDENTIALS *creds, unsigned char *buf) |
167 | { | 167 | { |
168 | char *p, *s; | 168 | char *p, *s; |
@@ -216,7 +216,7 @@ creds_to_radix(CREDENTIALS *creds, unsigned char *buf) | |||
216 | return (uuencode((unsigned char *)temp, len, (char *)buf)); | 216 | return (uuencode((unsigned char *)temp, len, (char *)buf)); |
217 | } | 217 | } |
218 | 218 | ||
219 | int | 219 | int |
220 | radix_to_creds(const char *buf, CREDENTIALS *creds) | 220 | radix_to_creds(const char *buf, CREDENTIALS *creds) |
221 | { | 221 | { |
222 | 222 | ||
diff --git a/readconf.c b/readconf.c index 1ba70c36a..3b75290f3 100644 --- a/readconf.c +++ b/readconf.c | |||
@@ -1,20 +1,20 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * readconf.c | 3 | * readconf.c |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Sat Apr 22 00:03:10 1995 ylo | 10 | * Created: Sat Apr 22 00:03:10 1995 ylo |
11 | * | 11 | * |
12 | * Functions for reading the configuration files. | 12 | * Functions for reading the configuration files. |
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include "includes.h" | 16 | #include "includes.h" |
17 | RCSID("$Id: readconf.c,v 1.10 2000/04/12 10:17:40 damien Exp $"); | 17 | RCSID("$Id: readconf.c,v 1.11 2000/04/16 01:18:44 damien Exp $"); |
18 | 18 | ||
19 | #include "ssh.h" | 19 | #include "ssh.h" |
20 | #include "cipher.h" | 20 | #include "cipher.h" |
@@ -167,7 +167,7 @@ static struct { | |||
167 | * error. | 167 | * error. |
168 | */ | 168 | */ |
169 | 169 | ||
170 | void | 170 | void |
171 | add_local_forward(Options *options, u_short port, const char *host, | 171 | add_local_forward(Options *options, u_short port, const char *host, |
172 | u_short host_port) | 172 | u_short host_port) |
173 | { | 173 | { |
@@ -188,7 +188,7 @@ add_local_forward(Options *options, u_short port, const char *host, | |||
188 | * an error. | 188 | * an error. |
189 | */ | 189 | */ |
190 | 190 | ||
191 | void | 191 | void |
192 | add_remote_forward(Options *options, u_short port, const char *host, | 192 | add_remote_forward(Options *options, u_short port, const char *host, |
193 | u_short host_port) | 193 | u_short host_port) |
194 | { | 194 | { |
@@ -207,7 +207,7 @@ add_remote_forward(Options *options, u_short port, const char *host, | |||
207 | * returns if the token is not known. | 207 | * returns if the token is not known. |
208 | */ | 208 | */ |
209 | 209 | ||
210 | static OpCodes | 210 | static OpCodes |
211 | parse_token(const char *cp, const char *filename, int linenum) | 211 | parse_token(const char *cp, const char *filename, int linenum) |
212 | { | 212 | { |
213 | unsigned int i; | 213 | unsigned int i; |
@@ -567,7 +567,7 @@ parse_int: | |||
567 | * there is an error. If the file does not exist, this returns immediately. | 567 | * there is an error. If the file does not exist, this returns immediately. |
568 | */ | 568 | */ |
569 | 569 | ||
570 | void | 570 | void |
571 | read_config_file(const char *filename, const char *host, Options *options) | 571 | read_config_file(const char *filename, const char *host, Options *options) |
572 | { | 572 | { |
573 | FILE *f; | 573 | FILE *f; |
@@ -607,7 +607,7 @@ read_config_file(const char *filename, const char *host, Options *options) | |||
607 | * system config file. Last, fill_default_options is called. | 607 | * system config file. Last, fill_default_options is called. |
608 | */ | 608 | */ |
609 | 609 | ||
610 | void | 610 | void |
611 | initialize_options(Options * options) | 611 | initialize_options(Options * options) |
612 | { | 612 | { |
613 | memset(options, 'X', sizeof(*options)); | 613 | memset(options, 'X', sizeof(*options)); |
@@ -658,7 +658,7 @@ initialize_options(Options * options) | |||
658 | * options for which no value has been specified with their default values. | 658 | * options for which no value has been specified with their default values. |
659 | */ | 659 | */ |
660 | 660 | ||
661 | void | 661 | void |
662 | fill_default_options(Options * options) | 662 | fill_default_options(Options * options) |
663 | { | 663 | { |
664 | if (options->forward_agent == -1) | 664 | if (options->forward_agent == -1) |
diff --git a/readconf.h b/readconf.h index 86f342d37..0582a8f2e 100644 --- a/readconf.h +++ b/readconf.h | |||
@@ -1,19 +1,19 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * readconf.h | 3 | * readconf.h |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Sat Apr 22 00:25:29 1995 ylo | 10 | * Created: Sat Apr 22 00:25:29 1995 ylo |
11 | * | 11 | * |
12 | * Functions for reading the configuration file. | 12 | * Functions for reading the configuration file. |
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | /* RCSID("$Id: readconf.h,v 1.7 2000/04/12 10:17:40 damien Exp $"); */ | 16 | /* RCSID("$Id: readconf.h,v 1.8 2000/04/16 01:18:44 damien Exp $"); */ |
17 | 17 | ||
18 | #ifndef READCONF_H | 18 | #ifndef READCONF_H |
19 | #define READCONF_H | 19 | #define READCONF_H |
@@ -106,7 +106,7 @@ void fill_default_options(Options * options); | |||
106 | * only sets those values that have not already been set. Returns 0 for legal | 106 | * only sets those values that have not already been set. Returns 0 for legal |
107 | * options | 107 | * options |
108 | */ | 108 | */ |
109 | int | 109 | int |
110 | process_config_line(Options * options, const char *host, | 110 | process_config_line(Options * options, const char *host, |
111 | char *line, const char *filename, int linenum, | 111 | char *line, const char *filename, int linenum, |
112 | int *activep); | 112 | int *activep); |
@@ -116,7 +116,7 @@ process_config_line(Options * options, const char *host, | |||
116 | * should already be initialized before this call. This never returns if | 116 | * should already be initialized before this call. This never returns if |
117 | * there is an error. If the file does not exist, this returns immediately. | 117 | * there is an error. If the file does not exist, this returns immediately. |
118 | */ | 118 | */ |
119 | void | 119 | void |
120 | read_config_file(const char *filename, const char *host, | 120 | read_config_file(const char *filename, const char *host, |
121 | Options * options); | 121 | Options * options); |
122 | 122 | ||
@@ -124,7 +124,7 @@ read_config_file(const char *filename, const char *host, | |||
124 | * Adds a local TCP/IP port forward to options. Never returns if there is an | 124 | * Adds a local TCP/IP port forward to options. Never returns if there is an |
125 | * error. | 125 | * error. |
126 | */ | 126 | */ |
127 | void | 127 | void |
128 | add_local_forward(Options * options, u_short port, const char *host, | 128 | add_local_forward(Options * options, u_short port, const char *host, |
129 | u_short host_port); | 129 | u_short host_port); |
130 | 130 | ||
@@ -132,7 +132,7 @@ add_local_forward(Options * options, u_short port, const char *host, | |||
132 | * Adds a remote TCP/IP port forward to options. Never returns if there is | 132 | * Adds a remote TCP/IP port forward to options. Never returns if there is |
133 | * an error. | 133 | * an error. |
134 | */ | 134 | */ |
135 | void | 135 | void |
136 | add_remote_forward(Options * options, u_short port, const char *host, | 136 | add_remote_forward(Options * options, u_short port, const char *host, |
137 | u_short host_port); | 137 | u_short host_port); |
138 | 138 | ||
diff --git a/readpass.c b/readpass.c index edeb23864..e3402b480 100644 --- a/readpass.c +++ b/readpass.c | |||
@@ -32,7 +32,7 @@ | |||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include "includes.h" | 34 | #include "includes.h" |
35 | RCSID("$Id: readpass.c,v 1.5 2000/01/22 08:47:21 damien Exp $"); | 35 | RCSID("$Id: readpass.c,v 1.6 2000/04/16 01:18:44 damien Exp $"); |
36 | 36 | ||
37 | #include "xmalloc.h" | 37 | #include "xmalloc.h" |
38 | #include "ssh.h" | 38 | #include "ssh.h" |
@@ -58,7 +58,7 @@ read_passphrase(const char *prompt, int from_stdin) | |||
58 | sigset_t oset, nset; | 58 | sigset_t oset, nset; |
59 | struct sigaction sa, osa; | 59 | struct sigaction sa, osa; |
60 | int input, output, echo = 0; | 60 | int input, output, echo = 0; |
61 | 61 | ||
62 | if (from_stdin) { | 62 | if (from_stdin) { |
63 | input = STDIN_FILENO; | 63 | input = STDIN_FILENO; |
64 | output = STDERR_FILENO; | 64 | output = STDERR_FILENO; |
@@ -1,41 +1,41 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * rsa.c | 3 | * rsa.c |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Fri Mar 3 22:07:06 1995 ylo | 10 | * Created: Fri Mar 3 22:07:06 1995 ylo |
11 | * | 11 | * |
12 | * Description of the RSA algorithm can be found e.g. from the following sources: | 12 | * Description of the RSA algorithm can be found e.g. from the following sources: |
13 | * | 13 | * |
14 | * Bruce Schneier: Applied Cryptography. John Wiley & Sons, 1994. | 14 | * Bruce Schneier: Applied Cryptography. John Wiley & Sons, 1994. |
15 | * | 15 | * |
16 | * Jennifer Seberry and Josed Pieprzyk: Cryptography: An Introduction to | 16 | * Jennifer Seberry and Josed Pieprzyk: Cryptography: An Introduction to |
17 | * Computer Security. Prentice-Hall, 1989. | 17 | * Computer Security. Prentice-Hall, 1989. |
18 | * | 18 | * |
19 | * Man Young Rhee: Cryptography and Secure Data Communications. McGraw-Hill, | 19 | * Man Young Rhee: Cryptography and Secure Data Communications. McGraw-Hill, |
20 | * 1994. | 20 | * 1994. |
21 | * | 21 | * |
22 | * R. Rivest, A. Shamir, and L. M. Adleman: Cryptographic Communications | 22 | * R. Rivest, A. Shamir, and L. M. Adleman: Cryptographic Communications |
23 | * System and Method. US Patent 4,405,829, 1983. | 23 | * System and Method. US Patent 4,405,829, 1983. |
24 | * | 24 | * |
25 | * Hans Riesel: Prime Numbers and Computer Methods for Factorization. | 25 | * Hans Riesel: Prime Numbers and Computer Methods for Factorization. |
26 | * Birkhauser, 1994. | 26 | * Birkhauser, 1994. |
27 | * | 27 | * |
28 | * The RSA Frequently Asked Questions document by RSA Data Security, Inc., 1995. | 28 | * The RSA Frequently Asked Questions document by RSA Data Security, Inc., 1995. |
29 | * | 29 | * |
30 | * RSA in 3 lines of perl by Adam Back <aba@atlax.ex.ac.uk>, 1995, as included | 30 | * RSA in 3 lines of perl by Adam Back <aba@atlax.ex.ac.uk>, 1995, as included |
31 | * below: | 31 | * below: |
32 | * | 32 | * |
33 | * [gone - had to be deleted - what a pity] | 33 | * [gone - had to be deleted - what a pity] |
34 | * | 34 | * |
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include "includes.h" | 37 | #include "includes.h" |
38 | RCSID("$Id: rsa.c,v 1.13 2000/04/04 04:57:08 damien Exp $"); | 38 | RCSID("$Id: rsa.c,v 1.14 2000/04/16 01:18:45 damien Exp $"); |
39 | 39 | ||
40 | #include "rsa.h" | 40 | #include "rsa.h" |
41 | #include "ssh.h" | 41 | #include "ssh.h" |
@@ -1,19 +1,19 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * rsa.h | 3 | * rsa.h |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Fri Mar 3 22:01:06 1995 ylo | 10 | * Created: Fri Mar 3 22:01:06 1995 ylo |
11 | * | 11 | * |
12 | * RSA key generation, encryption and decryption. | 12 | * RSA key generation, encryption and decryption. |
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | /* RCSID("$Id: rsa.h,v 1.7 2000/04/13 02:26:37 damien Exp $"); */ | 16 | /* RCSID("$Id: rsa.h,v 1.8 2000/04/16 01:18:45 damien Exp $"); */ |
17 | 17 | ||
18 | #ifndef RSA_H | 18 | #ifndef RSA_H |
19 | #define RSA_H | 19 | #define RSA_H |
@@ -1,13 +1,13 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * scp - secure remote copy. This is basically patched BSD rcp which uses ssh | 3 | * scp - secure remote copy. This is basically patched BSD rcp which uses ssh |
4 | * to do the data transfer (instead of using rcmd). | 4 | * to do the data transfer (instead of using rcmd). |
5 | * | 5 | * |
6 | * NOTE: This version should NOT be suid root. (This uses ssh to do the transfer | 6 | * NOTE: This version should NOT be suid root. (This uses ssh to do the transfer |
7 | * and ssh has the necessary privileges.) | 7 | * and ssh has the necessary privileges.) |
8 | * | 8 | * |
9 | * 1995 Timo Rinne <tri@iki.fi>, Tatu Ylonen <ylo@cs.hut.fi> | 9 | * 1995 Timo Rinne <tri@iki.fi>, Tatu Ylonen <ylo@cs.hut.fi> |
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | 12 | ||
13 | /* | 13 | /* |
@@ -45,7 +45,7 @@ | |||
45 | */ | 45 | */ |
46 | 46 | ||
47 | #include "includes.h" | 47 | #include "includes.h" |
48 | RCSID("$Id: scp.c,v 1.18 2000/03/17 12:40:16 damien Exp $"); | 48 | RCSID("$Id: scp.c,v 1.19 2000/04/16 01:18:45 damien Exp $"); |
49 | 49 | ||
50 | #include "ssh.h" | 50 | #include "ssh.h" |
51 | #include "xmalloc.h" | 51 | #include "xmalloc.h" |
@@ -109,7 +109,7 @@ char *port = NULL; | |||
109 | * assigns the input and output file descriptors on success. | 109 | * assigns the input and output file descriptors on success. |
110 | */ | 110 | */ |
111 | 111 | ||
112 | int | 112 | int |
113 | do_cmd(char *host, char *remuser, char *cmd, int *fdin, int *fdout) | 113 | do_cmd(char *host, char *remuser, char *cmd, int *fdin, int *fdout) |
114 | { | 114 | { |
115 | int pin[2], pout[2], reserved[2]; | 115 | int pin[2], pout[2], reserved[2]; |
@@ -194,7 +194,7 @@ do_cmd(char *host, char *remuser, char *cmd, int *fdin, int *fdout) | |||
194 | return 0; | 194 | return 0; |
195 | } | 195 | } |
196 | 196 | ||
197 | void | 197 | void |
198 | fatal(const char *fmt,...) | 198 | fatal(const char *fmt,...) |
199 | { | 199 | { |
200 | va_list ap; | 200 | va_list ap; |
@@ -257,10 +257,10 @@ main(argc, argv) | |||
257 | switch (ch) { | 257 | switch (ch) { |
258 | /* User-visible flags. */ | 258 | /* User-visible flags. */ |
259 | case '4': | 259 | case '4': |
260 | IPv4 = 1; | 260 | IPv4 = 1; |
261 | break; | 261 | break; |
262 | case '6': | 262 | case '6': |
263 | IPv6 = 1; | 263 | IPv6 = 1; |
264 | break; | 264 | break; |
265 | case 'p': | 265 | case 'p': |
266 | pflag = 1; | 266 | pflag = 1; |
@@ -1008,7 +1008,7 @@ run_err(const char *fmt,...) | |||
1008 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 1008 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
1009 | * SUCH DAMAGE. | 1009 | * SUCH DAMAGE. |
1010 | * | 1010 | * |
1011 | * $Id: scp.c,v 1.18 2000/03/17 12:40:16 damien Exp $ | 1011 | * $Id: scp.c,v 1.19 2000/04/16 01:18:45 damien Exp $ |
1012 | */ | 1012 | */ |
1013 | 1013 | ||
1014 | char * | 1014 | char * |
diff --git a/servconf.c b/servconf.c index 918fb8ed2..fe72d2757 100644 --- a/servconf.c +++ b/servconf.c | |||
@@ -1,18 +1,18 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * servconf.c | 3 | * servconf.c |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Mon Aug 21 15:48:58 1995 ylo | 10 | * Created: Mon Aug 21 15:48:58 1995 ylo |
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include "includes.h" | 14 | #include "includes.h" |
15 | RCSID("$Id: servconf.c,v 1.11 2000/04/12 10:17:40 damien Exp $"); | 15 | RCSID("$Id: servconf.c,v 1.12 2000/04/16 01:18:45 damien Exp $"); |
16 | 16 | ||
17 | #include "ssh.h" | 17 | #include "ssh.h" |
18 | #include "servconf.h" | 18 | #include "servconf.h" |
@@ -24,7 +24,7 @@ void add_listen_addr(ServerOptions *options, char *addr); | |||
24 | 24 | ||
25 | /* Initializes the server options to their default values. */ | 25 | /* Initializes the server options to their default values. */ |
26 | 26 | ||
27 | void | 27 | void |
28 | initialize_server_options(ServerOptions *options) | 28 | initialize_server_options(ServerOptions *options) |
29 | { | 29 | { |
30 | memset(options, 0, sizeof(*options)); | 30 | memset(options, 0, sizeof(*options)); |
@@ -73,7 +73,7 @@ initialize_server_options(ServerOptions *options) | |||
73 | options->protocol = SSH_PROTO_UNKNOWN; | 73 | options->protocol = SSH_PROTO_UNKNOWN; |
74 | } | 74 | } |
75 | 75 | ||
76 | void | 76 | void |
77 | fill_default_server_options(ServerOptions *options) | 77 | fill_default_server_options(ServerOptions *options) |
78 | { | 78 | { |
79 | if (options->num_ports == 0) | 79 | if (options->num_ports == 0) |
@@ -226,7 +226,7 @@ static struct { | |||
226 | * returns if the token is not known. | 226 | * returns if the token is not known. |
227 | */ | 227 | */ |
228 | 228 | ||
229 | static ServerOpCodes | 229 | static ServerOpCodes |
230 | parse_token(const char *cp, const char *filename, | 230 | parse_token(const char *cp, const char *filename, |
231 | int linenum) | 231 | int linenum) |
232 | { | 232 | { |
@@ -244,7 +244,7 @@ parse_token(const char *cp, const char *filename, | |||
244 | /* | 244 | /* |
245 | * add listen address | 245 | * add listen address |
246 | */ | 246 | */ |
247 | void | 247 | void |
248 | add_listen_addr(ServerOptions *options, char *addr) | 248 | add_listen_addr(ServerOptions *options, char *addr) |
249 | { | 249 | { |
250 | extern int IPv4or6; | 250 | extern int IPv4or6; |
@@ -274,7 +274,7 @@ add_listen_addr(ServerOptions *options, char *addr) | |||
274 | 274 | ||
275 | /* Reads the server configuration file. */ | 275 | /* Reads the server configuration file. */ |
276 | 276 | ||
277 | void | 277 | void |
278 | read_server_config(ServerOptions *options, const char *filename) | 278 | read_server_config(ServerOptions *options, const char *filename) |
279 | { | 279 | { |
280 | FILE *f; | 280 | FILE *f; |
@@ -310,7 +310,7 @@ read_server_config(ServerOptions *options, const char *filename) | |||
310 | "ListenAdress.\n", filename, linenum); | 310 | "ListenAdress.\n", filename, linenum); |
311 | if (options->num_ports >= MAX_PORTS) | 311 | if (options->num_ports >= MAX_PORTS) |
312 | fatal("%s line %d: too many ports.\n", | 312 | fatal("%s line %d: too many ports.\n", |
313 | filename, linenum); | 313 | filename, linenum); |
314 | cp = strtok(NULL, WHITESPACE); | 314 | cp = strtok(NULL, WHITESPACE); |
315 | if (!cp) | 315 | if (!cp) |
316 | fatal("%s line %d: missing port number.\n", | 316 | fatal("%s line %d: missing port number.\n", |
diff --git a/servconf.h b/servconf.h index 2a3686245..b8e8163dd 100644 --- a/servconf.h +++ b/servconf.h | |||
@@ -1,19 +1,19 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * servconf.h | 3 | * servconf.h |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Mon Aug 21 15:35:03 1995 ylo | 10 | * Created: Mon Aug 21 15:35:03 1995 ylo |
11 | * | 11 | * |
12 | * Definitions for server configuration data and for the functions reading it. | 12 | * Definitions for server configuration data and for the functions reading it. |
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | /* RCSID("$Id: servconf.h,v 1.8 2000/04/12 10:17:40 damien Exp $"); */ | 16 | /* RCSID("$Id: servconf.h,v 1.9 2000/04/16 01:18:45 damien Exp $"); */ |
17 | 17 | ||
18 | #ifndef SERVCONF_H | 18 | #ifndef SERVCONF_H |
19 | #define SERVCONF_H | 19 | #define SERVCONF_H |
diff --git a/serverloop.c b/serverloop.c index 0ea57faa0..a7abbe404 100644 --- a/serverloop.c +++ b/serverloop.c | |||
@@ -59,7 +59,7 @@ static volatile int child_wait_status; /* Status from wait(). */ | |||
59 | 59 | ||
60 | void server_init_dispatch(void); | 60 | void server_init_dispatch(void); |
61 | 61 | ||
62 | void | 62 | void |
63 | sigchld_handler(int sig) | 63 | sigchld_handler(int sig) |
64 | { | 64 | { |
65 | int save_errno = errno; | 65 | int save_errno = errno; |
@@ -78,7 +78,7 @@ sigchld_handler(int sig) | |||
78 | signal(SIGCHLD, sigchld_handler); | 78 | signal(SIGCHLD, sigchld_handler); |
79 | errno = save_errno; | 79 | errno = save_errno; |
80 | } | 80 | } |
81 | void | 81 | void |
82 | sigchld_handler2(int sig) | 82 | sigchld_handler2(int sig) |
83 | { | 83 | { |
84 | int save_errno = errno; | 84 | int save_errno = errno; |
@@ -92,7 +92,7 @@ sigchld_handler2(int sig) | |||
92 | * Make packets from buffered stderr data, and buffer it for sending | 92 | * Make packets from buffered stderr data, and buffer it for sending |
93 | * to the client. | 93 | * to the client. |
94 | */ | 94 | */ |
95 | void | 95 | void |
96 | make_packets_from_stderr_data() | 96 | make_packets_from_stderr_data() |
97 | { | 97 | { |
98 | int len; | 98 | int len; |
@@ -121,7 +121,7 @@ make_packets_from_stderr_data() | |||
121 | * Make packets from buffered stdout data, and buffer it for sending to the | 121 | * Make packets from buffered stdout data, and buffer it for sending to the |
122 | * client. | 122 | * client. |
123 | */ | 123 | */ |
124 | void | 124 | void |
125 | make_packets_from_stdout_data() | 125 | make_packets_from_stdout_data() |
126 | { | 126 | { |
127 | int len; | 127 | int len; |
@@ -152,7 +152,7 @@ make_packets_from_stdout_data() | |||
152 | * have data or can accept data. Optionally, a maximum time can be specified | 152 | * have data or can accept data. Optionally, a maximum time can be specified |
153 | * for the duration of the wait (0 = infinite). | 153 | * for the duration of the wait (0 = infinite). |
154 | */ | 154 | */ |
155 | void | 155 | void |
156 | wait_until_can_do_something(fd_set * readset, fd_set * writeset, | 156 | wait_until_can_do_something(fd_set * readset, fd_set * writeset, |
157 | unsigned int max_time_milliseconds) | 157 | unsigned int max_time_milliseconds) |
158 | { | 158 | { |
@@ -246,7 +246,7 @@ retry_select: | |||
246 | * Processes input from the client and the program. Input data is stored | 246 | * Processes input from the client and the program. Input data is stored |
247 | * in buffers and processed later. | 247 | * in buffers and processed later. |
248 | */ | 248 | */ |
249 | void | 249 | void |
250 | process_input(fd_set * readset) | 250 | process_input(fd_set * readset) |
251 | { | 251 | { |
252 | int len; | 252 | int len; |
@@ -299,7 +299,7 @@ process_input(fd_set * readset) | |||
299 | /* | 299 | /* |
300 | * Sends data from internal buffers to client program stdin. | 300 | * Sends data from internal buffers to client program stdin. |
301 | */ | 301 | */ |
302 | void | 302 | void |
303 | process_output(fd_set * writeset) | 303 | process_output(fd_set * writeset) |
304 | { | 304 | { |
305 | int len; | 305 | int len; |
@@ -334,7 +334,7 @@ process_output(fd_set * writeset) | |||
334 | * Wait until all buffered output has been sent to the client. | 334 | * Wait until all buffered output has been sent to the client. |
335 | * This is used when the program terminates. | 335 | * This is used when the program terminates. |
336 | */ | 336 | */ |
337 | void | 337 | void |
338 | drain_output() | 338 | drain_output() |
339 | { | 339 | { |
340 | /* Send any buffered stdout data to the client. */ | 340 | /* Send any buffered stdout data to the client. */ |
@@ -359,7 +359,7 @@ drain_output() | |||
359 | packet_write_wait(); | 359 | packet_write_wait(); |
360 | } | 360 | } |
361 | 361 | ||
362 | void | 362 | void |
363 | process_buffered_input_packets() | 363 | process_buffered_input_packets() |
364 | { | 364 | { |
365 | dispatch_run(DISPATCH_NONBLOCK, NULL); | 365 | dispatch_run(DISPATCH_NONBLOCK, NULL); |
@@ -372,7 +372,7 @@ process_buffered_input_packets() | |||
372 | * stdin (of the child program), and reads from stdout and stderr (of the | 372 | * stdin (of the child program), and reads from stdout and stderr (of the |
373 | * child program). | 373 | * child program). |
374 | */ | 374 | */ |
375 | void | 375 | void |
376 | server_loop(int pid, int fdin_arg, int fdout_arg, int fderr_arg) | 376 | server_loop(int pid, int fdin_arg, int fdout_arg, int fderr_arg) |
377 | { | 377 | { |
378 | int wait_status, wait_pid; /* Status and pid returned by wait(). */ | 378 | int wait_status, wait_pid; /* Status and pid returned by wait(). */ |
@@ -604,7 +604,7 @@ server_loop(int pid, int fdin_arg, int fdout_arg, int fderr_arg) | |||
604 | /* NOTREACHED */ | 604 | /* NOTREACHED */ |
605 | } | 605 | } |
606 | 606 | ||
607 | void | 607 | void |
608 | server_loop2(void) | 608 | server_loop2(void) |
609 | { | 609 | { |
610 | fd_set readset, writeset; | 610 | fd_set readset, writeset; |
@@ -697,16 +697,17 @@ int | |||
697 | input_direct_tcpip(void) | 697 | input_direct_tcpip(void) |
698 | { | 698 | { |
699 | int sock; | 699 | int sock; |
700 | char *host, *originator; | 700 | char *target, *originator; |
701 | int host_port, originator_port; | 701 | int target_port, originator_port; |
702 | 702 | ||
703 | host = packet_get_string(NULL); | 703 | target = packet_get_string(NULL); |
704 | host_port = packet_get_int(); | 704 | target_port = packet_get_int(); |
705 | originator = packet_get_string(NULL); | 705 | originator = packet_get_string(NULL); |
706 | originator_port = packet_get_int(); | 706 | originator_port = packet_get_int(); |
707 | packet_done(); | ||
707 | /* XXX check permission */ | 708 | /* XXX check permission */ |
708 | sock = channel_connect_to(host, host_port); | 709 | sock = channel_connect_to(target, target_port); |
709 | xfree(host); | 710 | xfree(target); |
710 | xfree(originator); | 711 | xfree(originator); |
711 | if (sock < 0) | 712 | if (sock < 0) |
712 | return -1; | 713 | return -1; |
@@ -714,7 +715,7 @@ input_direct_tcpip(void) | |||
714 | sock, sock, -1, 4*1024, 32*1024, 0, xstrdup("direct-tcpip")); | 715 | sock, sock, -1, 4*1024, 32*1024, 0, xstrdup("direct-tcpip")); |
715 | } | 716 | } |
716 | 717 | ||
717 | void | 718 | void |
718 | server_input_channel_open(int type, int plen) | 719 | server_input_channel_open(int type, int plen) |
719 | { | 720 | { |
720 | Channel *c = NULL; | 721 | Channel *c = NULL; |
@@ -735,6 +736,7 @@ server_input_channel_open(int type, int plen) | |||
735 | 736 | ||
736 | if (strcmp(ctype, "session") == 0) { | 737 | if (strcmp(ctype, "session") == 0) { |
737 | debug("open session"); | 738 | debug("open session"); |
739 | packet_done(); | ||
738 | /* | 740 | /* |
739 | * A server session has no fd to read or write | 741 | * A server session has no fd to read or write |
740 | * until a CHANNEL_REQUEST for a shell is made, | 742 | * until a CHANNEL_REQUEST for a shell is made, |
@@ -783,7 +785,7 @@ server_input_channel_open(int type, int plen) | |||
783 | xfree(ctype); | 785 | xfree(ctype); |
784 | } | 786 | } |
785 | 787 | ||
786 | void | 788 | void |
787 | server_init_dispatch_20() | 789 | server_init_dispatch_20() |
788 | { | 790 | { |
789 | debug("server_init_dispatch_20"); | 791 | debug("server_init_dispatch_20"); |
@@ -798,7 +800,7 @@ server_init_dispatch_20() | |||
798 | dispatch_set(SSH2_MSG_CHANNEL_REQUEST, &channel_input_channel_request); | 800 | dispatch_set(SSH2_MSG_CHANNEL_REQUEST, &channel_input_channel_request); |
799 | dispatch_set(SSH2_MSG_CHANNEL_WINDOW_ADJUST, &channel_input_window_adjust); | 801 | dispatch_set(SSH2_MSG_CHANNEL_WINDOW_ADJUST, &channel_input_window_adjust); |
800 | } | 802 | } |
801 | void | 803 | void |
802 | server_init_dispatch_13() | 804 | server_init_dispatch_13() |
803 | { | 805 | { |
804 | debug("server_init_dispatch_13"); | 806 | debug("server_init_dispatch_13"); |
@@ -813,7 +815,7 @@ server_init_dispatch_13() | |||
813 | dispatch_set(SSH_MSG_CHANNEL_OPEN_FAILURE, &channel_input_open_failure); | 815 | dispatch_set(SSH_MSG_CHANNEL_OPEN_FAILURE, &channel_input_open_failure); |
814 | dispatch_set(SSH_MSG_PORT_OPEN, &channel_input_port_open); | 816 | dispatch_set(SSH_MSG_PORT_OPEN, &channel_input_port_open); |
815 | } | 817 | } |
816 | void | 818 | void |
817 | server_init_dispatch_15() | 819 | server_init_dispatch_15() |
818 | { | 820 | { |
819 | server_init_dispatch_13(); | 821 | server_init_dispatch_13(); |
@@ -821,7 +823,7 @@ server_init_dispatch_15() | |||
821 | dispatch_set(SSH_MSG_CHANNEL_CLOSE, &channel_input_ieof); | 823 | dispatch_set(SSH_MSG_CHANNEL_CLOSE, &channel_input_ieof); |
822 | dispatch_set(SSH_MSG_CHANNEL_CLOSE_CONFIRMATION, &channel_input_oclose); | 824 | dispatch_set(SSH_MSG_CHANNEL_CLOSE_CONFIRMATION, &channel_input_oclose); |
823 | } | 825 | } |
824 | void | 826 | void |
825 | server_init_dispatch() | 827 | server_init_dispatch() |
826 | { | 828 | { |
827 | if (compat20) | 829 | if (compat20) |
@@ -8,7 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include "includes.h" | 10 | #include "includes.h" |
11 | RCSID("$OpenBSD: session.c,v 1.2 2000/04/06 08:55:22 markus Exp $"); | 11 | RCSID("$OpenBSD: session.c,v 1.4 2000/04/14 10:30:33 markus Exp $"); |
12 | 12 | ||
13 | #include "xmalloc.h" | 13 | #include "xmalloc.h" |
14 | #include "ssh.h" | 14 | #include "ssh.h" |
@@ -113,7 +113,7 @@ xauthfile_cleanup_proc(void *ignore) | |||
113 | * Function to perform cleanup if we get aborted abnormally (e.g., due to a | 113 | * Function to perform cleanup if we get aborted abnormally (e.g., due to a |
114 | * dropped connection). | 114 | * dropped connection). |
115 | */ | 115 | */ |
116 | void | 116 | void |
117 | pty_cleanup_proc(void *session) | 117 | pty_cleanup_proc(void *session) |
118 | { | 118 | { |
119 | Session *s=session; | 119 | Session *s=session; |
@@ -136,7 +136,7 @@ pty_cleanup_proc(void *session) | |||
136 | * terminals are allocated, X11, TCP/IP, and authentication agent forwardings | 136 | * terminals are allocated, X11, TCP/IP, and authentication agent forwardings |
137 | * are requested, etc. | 137 | * are requested, etc. |
138 | */ | 138 | */ |
139 | void | 139 | void |
140 | do_authenticated(struct passwd * pw) | 140 | do_authenticated(struct passwd * pw) |
141 | { | 141 | { |
142 | Session *s; | 142 | Session *s; |
@@ -366,7 +366,7 @@ do_authenticated(struct passwd * pw) | |||
366 | * will call do_child from the child, and server_loop from the parent after | 366 | * will call do_child from the child, and server_loop from the parent after |
367 | * setting up file descriptors and such. | 367 | * setting up file descriptors and such. |
368 | */ | 368 | */ |
369 | void | 369 | void |
370 | do_exec_no_pty(Session *s, const char *command, struct passwd * pw) | 370 | do_exec_no_pty(Session *s, const char *command, struct passwd * pw) |
371 | { | 371 | { |
372 | int pid; | 372 | int pid; |
@@ -487,7 +487,7 @@ do_exec_no_pty(Session *s, const char *command, struct passwd * pw) | |||
487 | * setting up file descriptors, controlling tty, updating wtmp, utmp, | 487 | * setting up file descriptors, controlling tty, updating wtmp, utmp, |
488 | * lastlog, and other such operations. | 488 | * lastlog, and other such operations. |
489 | */ | 489 | */ |
490 | void | 490 | void |
491 | do_exec_pty(Session *s, const char *command, struct passwd * pw) | 491 | do_exec_pty(Session *s, const char *command, struct passwd * pw) |
492 | { | 492 | { |
493 | FILE *f; | 493 | FILE *f; |
@@ -660,7 +660,7 @@ do_exec_pty(Session *s, const char *command, struct passwd * pw) | |||
660 | * Sets the value of the given variable in the environment. If the variable | 660 | * Sets the value of the given variable in the environment. If the variable |
661 | * already exists, its value is overriden. | 661 | * already exists, its value is overriden. |
662 | */ | 662 | */ |
663 | void | 663 | void |
664 | child_set_env(char ***envp, unsigned int *envsizep, const char *name, | 664 | child_set_env(char ***envp, unsigned int *envsizep, const char *name, |
665 | const char *value) | 665 | const char *value) |
666 | { | 666 | { |
@@ -701,7 +701,7 @@ child_set_env(char ***envp, unsigned int *envsizep, const char *name, | |||
701 | * Otherwise, it must consist of empty lines, comments (line starts with '#') | 701 | * Otherwise, it must consist of empty lines, comments (line starts with '#') |
702 | * and assignments of the form name=value. No other forms are allowed. | 702 | * and assignments of the form name=value. No other forms are allowed. |
703 | */ | 703 | */ |
704 | void | 704 | void |
705 | read_environment_file(char ***env, unsigned int *envsize, | 705 | read_environment_file(char ***env, unsigned int *envsize, |
706 | const char *filename) | 706 | const char *filename) |
707 | { | 707 | { |
@@ -770,7 +770,7 @@ void do_pam_environment(char ***env, int *envsize) | |||
770 | * environment, closing extra file descriptors, setting the user and group | 770 | * environment, closing extra file descriptors, setting the user and group |
771 | * ids, and executing the command or shell. | 771 | * ids, and executing the command or shell. |
772 | */ | 772 | */ |
773 | void | 773 | void |
774 | do_child(const char *command, struct passwd * pw, const char *term, | 774 | do_child(const char *command, struct passwd * pw, const char *term, |
775 | const char *display, const char *auth_proto, | 775 | const char *display, const char *auth_proto, |
776 | const char *auth_data, const char *ttyname) | 776 | const char *auth_data, const char *ttyname) |
@@ -1202,6 +1202,7 @@ session_window_change_req(Session *s) | |||
1202 | s->row = packet_get_int(); | 1202 | s->row = packet_get_int(); |
1203 | s->xpixel = packet_get_int(); | 1203 | s->xpixel = packet_get_int(); |
1204 | s->ypixel = packet_get_int(); | 1204 | s->ypixel = packet_get_int(); |
1205 | packet_done(); | ||
1205 | pty_change_window_size(s->ptyfd, s->row, s->col, s->xpixel, s->ypixel); | 1206 | pty_change_window_size(s->ptyfd, s->row, s->col, s->xpixel, s->ypixel); |
1206 | return 1; | 1207 | return 1; |
1207 | } | 1208 | } |
@@ -1210,14 +1211,17 @@ int | |||
1210 | session_pty_req(Session *s) | 1211 | session_pty_req(Session *s) |
1211 | { | 1212 | { |
1212 | unsigned int len; | 1213 | unsigned int len; |
1214 | char *term_modes; /* encoded terminal modes */ | ||
1213 | 1215 | ||
1214 | if (s->ttyfd != -1) | 1216 | if (s->ttyfd != -1) |
1215 | return -1; | 1217 | return 0; |
1216 | s->term = packet_get_string(&len); | 1218 | s->term = packet_get_string(&len); |
1217 | s->col = packet_get_int(); | 1219 | s->col = packet_get_int(); |
1218 | s->row = packet_get_int(); | 1220 | s->row = packet_get_int(); |
1219 | s->xpixel = packet_get_int(); | 1221 | s->xpixel = packet_get_int(); |
1220 | s->ypixel = packet_get_int(); | 1222 | s->ypixel = packet_get_int(); |
1223 | term_modes = packet_get_string(&len); | ||
1224 | packet_done(); | ||
1221 | 1225 | ||
1222 | if (strcmp(s->term, "") == 0) { | 1226 | if (strcmp(s->term, "") == 0) { |
1223 | xfree(s->term); | 1227 | xfree(s->term); |
@@ -1230,7 +1234,8 @@ session_pty_req(Session *s) | |||
1230 | s->ptyfd = -1; | 1234 | s->ptyfd = -1; |
1231 | s->ttyfd = -1; | 1235 | s->ttyfd = -1; |
1232 | error("session_pty_req: session %d alloc failed", s->self); | 1236 | error("session_pty_req: session %d alloc failed", s->self); |
1233 | return -1; | 1237 | xfree(term_modes); |
1238 | return 0; | ||
1234 | } | 1239 | } |
1235 | debug("session_pty_req: session %d alloc %s", s->self, s->tty); | 1240 | debug("session_pty_req: session %d alloc %s", s->self, s->tty); |
1236 | /* | 1241 | /* |
diff --git a/ssh-agent.c b/ssh-agent.c index ecb44a229..66439461e 100644 --- a/ssh-agent.c +++ b/ssh-agent.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-agent.c,v 1.27 2000/04/12 09:39:10 markus Exp $ */ | 1 | /* $OpenBSD: ssh-agent.c,v 1.28 2000/04/14 10:30:33 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -9,7 +9,7 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include "includes.h" | 11 | #include "includes.h" |
12 | RCSID("$OpenBSD: ssh-agent.c,v 1.27 2000/04/12 09:39:10 markus Exp $"); | 12 | RCSID("$OpenBSD: ssh-agent.c,v 1.28 2000/04/14 10:30:33 markus Exp $"); |
13 | 13 | ||
14 | #include "ssh.h" | 14 | #include "ssh.h" |
15 | #include "rsa.h" | 15 | #include "rsa.h" |
@@ -412,7 +412,7 @@ prepare_select(fd_set *readset, fd_set *writeset) | |||
412 | } | 412 | } |
413 | } | 413 | } |
414 | 414 | ||
415 | void | 415 | void |
416 | after_select(fd_set *readset, fd_set *writeset) | 416 | after_select(fd_set *readset, fd_set *writeset) |
417 | { | 417 | { |
418 | unsigned int i; | 418 | unsigned int i; |
@@ -646,8 +646,8 @@ main(int ac, char **av) | |||
646 | } | 646 | } |
647 | signal(SIGINT, SIG_IGN); | 647 | signal(SIGINT, SIG_IGN); |
648 | signal(SIGPIPE, SIG_IGN); | 648 | signal(SIGPIPE, SIG_IGN); |
649 | signal(SIGHUP, cleanup_exit); | 649 | signal(SIGHUP, cleanup_exit); |
650 | signal(SIGTERM, cleanup_exit); | 650 | signal(SIGTERM, cleanup_exit); |
651 | while (1) { | 651 | while (1) { |
652 | FD_ZERO(&readset); | 652 | FD_ZERO(&readset); |
653 | FD_ZERO(&writeset); | 653 | FD_ZERO(&writeset); |
diff --git a/ssh-keygen.c b/ssh-keygen.c index 81070d2ef..f2484a4b1 100644 --- a/ssh-keygen.c +++ b/ssh-keygen.c | |||
@@ -7,7 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include "includes.h" | 9 | #include "includes.h" |
10 | RCSID("$Id: ssh-keygen.c,v 1.12 2000/03/17 12:40:17 damien Exp $"); | 10 | RCSID("$Id: ssh-keygen.c,v 1.13 2000/04/16 01:18:46 damien Exp $"); |
11 | 11 | ||
12 | #include "rsa.h" | 12 | #include "rsa.h" |
13 | #include "ssh.h" | 13 | #include "ssh.h" |
@@ -508,7 +508,7 @@ passphrase_again: | |||
508 | if (identity_comment) { | 508 | if (identity_comment) { |
509 | strlcpy(comment, identity_comment, sizeof(comment)); | 509 | strlcpy(comment, identity_comment, sizeof(comment)); |
510 | } else { | 510 | } else { |
511 | /* Create default commend field for the passphrase. */ | 511 | /* Create default commend field for the passphrase. */ |
512 | if (gethostname(hostname, sizeof(hostname)) < 0) { | 512 | if (gethostname(hostname, sizeof(hostname)) < 0) { |
513 | perror("gethostname"); | 513 | perror("gethostname"); |
514 | exit(1); | 514 | exit(1); |
@@ -9,7 +9,7 @@ | |||
9 | .\" | 9 | .\" |
10 | .\" Created: Sat Apr 22 21:55:14 1995 ylo | 10 | .\" Created: Sat Apr 22 21:55:14 1995 ylo |
11 | .\" | 11 | .\" |
12 | .\" $Id: ssh.1,v 1.21 2000/04/13 02:26:37 damien Exp $ | 12 | .\" $Id: ssh.1,v 1.22 2000/04/16 01:18:46 damien Exp $ |
13 | .\" | 13 | .\" |
14 | .Dd September 25, 1999 | 14 | .Dd September 25, 1999 |
15 | .Dt SSH 1 | 15 | .Dt SSH 1 |
@@ -24,7 +24,7 @@ | |||
24 | .Op Ar command | 24 | .Op Ar command |
25 | .Pp | 25 | .Pp |
26 | .Nm ssh | 26 | .Nm ssh |
27 | .Op Fl afgknqtvxCPX46 | 27 | .Op Fl afgknqtvxCPX246 |
28 | .Op Fl c Ar blowfish | 3des | 28 | .Op Fl c Ar blowfish | 3des |
29 | .Op Fl e Ar escape_char | 29 | .Op Fl e Ar escape_char |
30 | .Op Fl i Ar identity_file | 30 | .Op Fl i Ar identity_file |
@@ -455,6 +455,10 @@ from the local machine. | |||
455 | Port forwardings can also be specified in the configuration file. | 455 | Port forwardings can also be specified in the configuration file. |
456 | Privileged ports can be forwarded only when | 456 | Privileged ports can be forwarded only when |
457 | logging in as root on the remote machine. | 457 | logging in as root on the remote machine. |
458 | .It Fl 2 | ||
459 | Forces | ||
460 | .Nm | ||
461 | to use protocol version 2 only. | ||
458 | .It Fl 4 | 462 | .It Fl 4 |
459 | Forces | 463 | Forces |
460 | .Nm | 464 | .Nm |
@@ -11,7 +11,7 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include "includes.h" | 13 | #include "includes.h" |
14 | RCSID("$Id: ssh.c,v 1.25 2000/04/12 10:17:40 damien Exp $"); | 14 | RCSID("$Id: ssh.c,v 1.26 2000/04/16 01:18:46 damien Exp $"); |
15 | 15 | ||
16 | #include "xmalloc.h" | 16 | #include "xmalloc.h" |
17 | #include "ssh.h" | 17 | #include "ssh.h" |
@@ -138,6 +138,7 @@ usage() | |||
138 | fprintf(stderr, " -g Allow remote hosts to connect to forwarded ports.\n"); | 138 | fprintf(stderr, " -g Allow remote hosts to connect to forwarded ports.\n"); |
139 | fprintf(stderr, " -4 Use IPv4 only.\n"); | 139 | fprintf(stderr, " -4 Use IPv4 only.\n"); |
140 | fprintf(stderr, " -6 Use IPv6 only.\n"); | 140 | fprintf(stderr, " -6 Use IPv6 only.\n"); |
141 | fprintf(stderr, " -2 Force protocol version 2.\n"); | ||
141 | fprintf(stderr, " -o 'option' Process the option as if it was read from a configuration file.\n"); | 142 | fprintf(stderr, " -o 'option' Process the option as if it was read from a configuration file.\n"); |
142 | exit(1); | 143 | exit(1); |
143 | } | 144 | } |
@@ -251,8 +252,8 @@ main(int ac, char **av) | |||
251 | if (host) | 252 | if (host) |
252 | break; | 253 | break; |
253 | if ((cp = strchr(av[optind], '@'))) { | 254 | if ((cp = strchr(av[optind], '@'))) { |
254 | if(cp == av[optind]) | 255 | if(cp == av[optind]) |
255 | usage(); | 256 | usage(); |
256 | options.user = av[optind]; | 257 | options.user = av[optind]; |
257 | *cp = '\0'; | 258 | *cp = '\0'; |
258 | host = ++cp; | 259 | host = ++cp; |
@@ -276,39 +277,34 @@ main(int ac, char **av) | |||
276 | optarg = NULL; | 277 | optarg = NULL; |
277 | } | 278 | } |
278 | switch (opt) { | 279 | switch (opt) { |
280 | case '2': | ||
281 | options.protocol = SSH_PROTO_2; | ||
282 | break; | ||
279 | case '4': | 283 | case '4': |
280 | IPv4or6 = AF_INET; | 284 | IPv4or6 = AF_INET; |
281 | break; | 285 | break; |
282 | |||
283 | case '6': | 286 | case '6': |
284 | IPv4or6 = AF_INET6; | 287 | IPv4or6 = AF_INET6; |
285 | break; | 288 | break; |
286 | |||
287 | case 'n': | 289 | case 'n': |
288 | stdin_null_flag = 1; | 290 | stdin_null_flag = 1; |
289 | break; | 291 | break; |
290 | |||
291 | case 'f': | 292 | case 'f': |
292 | fork_after_authentication_flag = 1; | 293 | fork_after_authentication_flag = 1; |
293 | stdin_null_flag = 1; | 294 | stdin_null_flag = 1; |
294 | break; | 295 | break; |
295 | |||
296 | case 'x': | 296 | case 'x': |
297 | options.forward_x11 = 0; | 297 | options.forward_x11 = 0; |
298 | break; | 298 | break; |
299 | |||
300 | case 'X': | 299 | case 'X': |
301 | options.forward_x11 = 1; | 300 | options.forward_x11 = 1; |
302 | break; | 301 | break; |
303 | |||
304 | case 'g': | 302 | case 'g': |
305 | options.gateway_ports = 1; | 303 | options.gateway_ports = 1; |
306 | break; | 304 | break; |
307 | |||
308 | case 'P': | 305 | case 'P': |
309 | options.use_privileged_port = 0; | 306 | options.use_privileged_port = 0; |
310 | break; | 307 | break; |
311 | |||
312 | case 'a': | 308 | case 'a': |
313 | options.forward_agent = 0; | 309 | options.forward_agent = 0; |
314 | break; | 310 | break; |
@@ -330,11 +326,9 @@ main(int ac, char **av) | |||
330 | options.identity_files[options.num_identity_files++] = | 326 | options.identity_files[options.num_identity_files++] = |
331 | xstrdup(optarg); | 327 | xstrdup(optarg); |
332 | break; | 328 | break; |
333 | |||
334 | case 't': | 329 | case 't': |
335 | tty_flag = 1; | 330 | tty_flag = 1; |
336 | break; | 331 | break; |
337 | |||
338 | case 'v': | 332 | case 'v': |
339 | case 'V': | 333 | case 'V': |
340 | fprintf(stderr, "SSH Version %s, protocol versions %d.%d/%d.%d.\n", | 334 | fprintf(stderr, "SSH Version %s, protocol versions %d.%d/%d.%d.\n", |
@@ -347,11 +341,9 @@ main(int ac, char **av) | |||
347 | debug_flag = 1; | 341 | debug_flag = 1; |
348 | options.log_level = SYSLOG_LEVEL_DEBUG; | 342 | options.log_level = SYSLOG_LEVEL_DEBUG; |
349 | break; | 343 | break; |
350 | |||
351 | case 'q': | 344 | case 'q': |
352 | options.log_level = SYSLOG_LEVEL_QUIET; | 345 | options.log_level = SYSLOG_LEVEL_QUIET; |
353 | break; | 346 | break; |
354 | |||
355 | case 'e': | 347 | case 'e': |
356 | if (optarg[0] == '^' && optarg[2] == 0 && | 348 | if (optarg[0] == '^' && optarg[2] == 0 && |
357 | (unsigned char) optarg[1] >= 64 && (unsigned char) optarg[1] < 128) | 349 | (unsigned char) optarg[1] >= 64 && (unsigned char) optarg[1] < 128) |
@@ -365,7 +357,6 @@ main(int ac, char **av) | |||
365 | exit(1); | 357 | exit(1); |
366 | } | 358 | } |
367 | break; | 359 | break; |
368 | |||
369 | case 'c': | 360 | case 'c': |
370 | options.cipher = cipher_number(optarg); | 361 | options.cipher = cipher_number(optarg); |
371 | if (options.cipher == -1) { | 362 | if (options.cipher == -1) { |
@@ -373,15 +364,12 @@ main(int ac, char **av) | |||
373 | exit(1); | 364 | exit(1); |
374 | } | 365 | } |
375 | break; | 366 | break; |
376 | |||
377 | case 'p': | 367 | case 'p': |
378 | options.port = atoi(optarg); | 368 | options.port = atoi(optarg); |
379 | break; | 369 | break; |
380 | |||
381 | case 'l': | 370 | case 'l': |
382 | options.user = optarg; | 371 | options.user = optarg; |
383 | break; | 372 | break; |
384 | |||
385 | case 'R': | 373 | case 'R': |
386 | if (sscanf(optarg, "%hu/%255[^/]/%hu", &fwd_port, buf, | 374 | if (sscanf(optarg, "%hu/%255[^/]/%hu", &fwd_port, buf, |
387 | &fwd_host_port) != 3 && | 375 | &fwd_host_port) != 3 && |
@@ -393,7 +381,6 @@ main(int ac, char **av) | |||
393 | } | 381 | } |
394 | add_remote_forward(&options, fwd_port, buf, fwd_host_port); | 382 | add_remote_forward(&options, fwd_port, buf, fwd_host_port); |
395 | break; | 383 | break; |
396 | |||
397 | case 'L': | 384 | case 'L': |
398 | if (sscanf(optarg, "%hu/%255[^/]/%hu", &fwd_port, buf, | 385 | if (sscanf(optarg, "%hu/%255[^/]/%hu", &fwd_port, buf, |
399 | &fwd_host_port) != 3 && | 386 | &fwd_host_port) != 3 && |
@@ -405,27 +392,22 @@ main(int ac, char **av) | |||
405 | } | 392 | } |
406 | add_local_forward(&options, fwd_port, buf, fwd_host_port); | 393 | add_local_forward(&options, fwd_port, buf, fwd_host_port); |
407 | break; | 394 | break; |
408 | |||
409 | case 'C': | 395 | case 'C': |
410 | options.compression = 1; | 396 | options.compression = 1; |
411 | break; | 397 | break; |
412 | |||
413 | case 'N': | 398 | case 'N': |
414 | no_shell_flag = 1; | 399 | no_shell_flag = 1; |
415 | no_tty_flag = 1; | 400 | no_tty_flag = 1; |
416 | break; | 401 | break; |
417 | |||
418 | case 'T': | 402 | case 'T': |
419 | no_tty_flag = 1; | 403 | no_tty_flag = 1; |
420 | break; | 404 | break; |
421 | |||
422 | case 'o': | 405 | case 'o': |
423 | dummy = 1; | 406 | dummy = 1; |
424 | if (process_config_line(&options, host ? host : "", optarg, | 407 | if (process_config_line(&options, host ? host : "", optarg, |
425 | "command-line", 0, &dummy) != 0) | 408 | "command-line", 0, &dummy) != 0) |
426 | exit(1); | 409 | exit(1); |
427 | break; | 410 | break; |
428 | |||
429 | default: | 411 | default: |
430 | usage(); | 412 | usage(); |
431 | } | 413 | } |
@@ -634,7 +616,7 @@ main(int ac, char **av) | |||
634 | 616 | ||
635 | /* Expand ~ in known host file names. */ | 617 | /* Expand ~ in known host file names. */ |
636 | options.system_hostfile = tilde_expand_filename(options.system_hostfile, | 618 | options.system_hostfile = tilde_expand_filename(options.system_hostfile, |
637 | original_real_uid); | 619 | original_real_uid); |
638 | options.user_hostfile = tilde_expand_filename(options.user_hostfile, | 620 | options.user_hostfile = tilde_expand_filename(options.user_hostfile, |
639 | original_real_uid); | 621 | original_real_uid); |
640 | 622 | ||
@@ -803,7 +785,7 @@ ssh_session(void) | |||
803 | options.local_forwards[i].host, | 785 | options.local_forwards[i].host, |
804 | options.local_forwards[i].host_port); | 786 | options.local_forwards[i].host_port); |
805 | channel_request_local_forwarding(options.local_forwards[i].port, | 787 | channel_request_local_forwarding(options.local_forwards[i].port, |
806 | options.local_forwards[i].host, | 788 | options.local_forwards[i].host, |
807 | options.local_forwards[i].host_port, | 789 | options.local_forwards[i].host_port, |
808 | options.gateway_ports); | 790 | options.gateway_ports); |
809 | } | 791 | } |
@@ -816,11 +798,11 @@ ssh_session(void) | |||
816 | options.remote_forwards[i].host_port); | 798 | options.remote_forwards[i].host_port); |
817 | channel_request_remote_forwarding(options.remote_forwards[i].port, | 799 | channel_request_remote_forwarding(options.remote_forwards[i].port, |
818 | options.remote_forwards[i].host, | 800 | options.remote_forwards[i].host, |
819 | options.remote_forwards[i].host_port); | 801 | options.remote_forwards[i].host_port); |
820 | } | 802 | } |
821 | 803 | ||
822 | /* If requested, let ssh continue in the background. */ | 804 | /* If requested, let ssh continue in the background. */ |
823 | if (fork_after_authentication_flag) | 805 | if (fork_after_authentication_flag) |
824 | if (daemon(1, 1) < 0) | 806 | if (daemon(1, 1) < 0) |
825 | fatal("daemon() failed: %.200s", strerror(errno)); | 807 | fatal("daemon() failed: %.200s", strerror(errno)); |
826 | 808 | ||
@@ -859,7 +841,7 @@ init_local_fwd(void) | |||
859 | options.local_forwards[i].host, | 841 | options.local_forwards[i].host, |
860 | options.local_forwards[i].host_port); | 842 | options.local_forwards[i].host_port); |
861 | channel_request_local_forwarding(options.local_forwards[i].port, | 843 | channel_request_local_forwarding(options.local_forwards[i].port, |
862 | options.local_forwards[i].host, | 844 | options.local_forwards[i].host, |
863 | options.local_forwards[i].host_port, | 845 | options.local_forwards[i].host_port, |
864 | options.gateway_ports); | 846 | options.gateway_ports); |
865 | } | 847 | } |
@@ -1,19 +1,19 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * ssh.h | 3 | * ssh.h |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Fri Mar 17 17:09:37 1995 ylo | 10 | * Created: Fri Mar 17 17:09:37 1995 ylo |
11 | * | 11 | * |
12 | * Generic header file for ssh. | 12 | * Generic header file for ssh. |
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | /* RCSID("$Id: ssh.h,v 1.31 2000/04/12 10:17:41 damien Exp $"); */ | 16 | /* RCSID("$Id: ssh.h,v 1.32 2000/04/16 01:18:47 damien Exp $"); */ |
17 | 17 | ||
18 | #ifndef SSH_H | 18 | #ifndef SSH_H |
19 | #define SSH_H | 19 | #define SSH_H |
@@ -279,7 +279,7 @@ | |||
279 | * information is not available. This must be called before record_login. | 279 | * information is not available. This must be called before record_login. |
280 | * The host from which the user logged in is stored in buf. | 280 | * The host from which the user logged in is stored in buf. |
281 | */ | 281 | */ |
282 | unsigned long | 282 | unsigned long |
283 | get_last_login_time(uid_t uid, const char *logname, | 283 | get_last_login_time(uid_t uid, const char *logname, |
284 | char *buf, unsigned int bufsize); | 284 | char *buf, unsigned int bufsize); |
285 | 285 | ||
@@ -287,7 +287,7 @@ get_last_login_time(uid_t uid, const char *logname, | |||
287 | * Records that the user has logged in. This does many things normally done | 287 | * Records that the user has logged in. This does many things normally done |
288 | * by login(1). | 288 | * by login(1). |
289 | */ | 289 | */ |
290 | void | 290 | void |
291 | record_login(int pid, const char *ttyname, const char *user, uid_t uid, | 291 | record_login(int pid, const char *ttyname, const char *user, uid_t uid, |
292 | const char *host, struct sockaddr *addr); | 292 | const char *host, struct sockaddr *addr); |
293 | 293 | ||
@@ -308,7 +308,7 @@ void record_logout(int pid, const char *ttyname); | |||
308 | * and zero on failure. If the connection is successful, this calls | 308 | * and zero on failure. If the connection is successful, this calls |
309 | * packet_set_connection for the connection. | 309 | * packet_set_connection for the connection. |
310 | */ | 310 | */ |
311 | int | 311 | int |
312 | ssh_connect(const char *host, struct sockaddr_storage * hostaddr, | 312 | ssh_connect(const char *host, struct sockaddr_storage * hostaddr, |
313 | u_short port, int connection_attempts, | 313 | u_short port, int connection_attempts, |
314 | int anonymous, uid_t original_real_uid, | 314 | int anonymous, uid_t original_real_uid, |
@@ -323,7 +323,7 @@ ssh_connect(const char *host, struct sockaddr_storage * hostaddr, | |||
323 | * references from the packet module). | 323 | * references from the packet module). |
324 | */ | 324 | */ |
325 | 325 | ||
326 | void | 326 | void |
327 | ssh_login(int host_key_valid, RSA * host_key, const char *host, | 327 | ssh_login(int host_key_valid, RSA * host_key, const char *host, |
328 | struct sockaddr * hostaddr, uid_t original_real_uid); | 328 | struct sockaddr * hostaddr, uid_t original_real_uid); |
329 | 329 | ||
@@ -340,7 +340,7 @@ int auth_rhosts(struct passwd * pw, const char *client_user); | |||
340 | * Tries to authenticate the user using the .rhosts file and the host using | 340 | * Tries to authenticate the user using the .rhosts file and the host using |
341 | * its host key. Returns true if authentication succeeds. | 341 | * its host key. Returns true if authentication succeeds. |
342 | */ | 342 | */ |
343 | int | 343 | int |
344 | auth_rhosts_rsa(struct passwd * pw, const char *client_user, RSA* client_host_key); | 344 | auth_rhosts_rsa(struct passwd * pw, const char *client_user, RSA* client_host_key); |
345 | 345 | ||
346 | /* | 346 | /* |
@@ -409,7 +409,7 @@ char *read_passphrase(const char *prompt, int from_stdin); | |||
409 | * precede the key to provide identification of the key without needing a | 409 | * precede the key to provide identification of the key without needing a |
410 | * passphrase. | 410 | * passphrase. |
411 | */ | 411 | */ |
412 | int | 412 | int |
413 | save_private_key(const char *filename, const char *passphrase, | 413 | save_private_key(const char *filename, const char *passphrase, |
414 | RSA * private_key, const char *comment); | 414 | RSA * private_key, const char *comment); |
415 | 415 | ||
@@ -419,7 +419,7 @@ save_private_key(const char *filename, const char *passphrase, | |||
419 | * comment of the key is returned in comment_return if it is non-NULL; the | 419 | * comment of the key is returned in comment_return if it is non-NULL; the |
420 | * caller must free the value with xfree. | 420 | * caller must free the value with xfree. |
421 | */ | 421 | */ |
422 | int | 422 | int |
423 | load_public_key(const char *filename, RSA * pub, | 423 | load_public_key(const char *filename, RSA * pub, |
424 | char **comment_return); | 424 | char **comment_return); |
425 | 425 | ||
@@ -430,7 +430,7 @@ load_public_key(const char *filename, RSA * pub, | |||
430 | * comment_return if it is non-NULL; the caller must free the value with | 430 | * comment_return if it is non-NULL; the caller must free the value with |
431 | * xfree. | 431 | * xfree. |
432 | */ | 432 | */ |
433 | int | 433 | int |
434 | load_private_key(const char *filename, const char *passphrase, | 434 | load_private_key(const char *filename, const char *passphrase, |
435 | RSA * private_key, char **comment_return); | 435 | RSA * private_key, char **comment_return); |
436 | 436 | ||
@@ -1,31 +1,31 @@ | |||
1 | /* | 1 | /* |
2 | * draft-ietf-secsh-architecture-04.txt | 2 | * draft-ietf-secsh-architecture-04.txt |
3 | * | 3 | * |
4 | * Transport layer protocol: | 4 | * Transport layer protocol: |
5 | * | 5 | * |
6 | * 1-19 Transport layer generic (e.g. disconnect, ignore, debug, | 6 | * 1-19 Transport layer generic (e.g. disconnect, ignore, debug, |
7 | * etc) | 7 | * etc) |
8 | * 20-29 Algorithm negotiation | 8 | * 20-29 Algorithm negotiation |
9 | * 30-49 Key exchange method specific (numbers can be reused for | 9 | * 30-49 Key exchange method specific (numbers can be reused for |
10 | * different authentication methods) | 10 | * different authentication methods) |
11 | * | 11 | * |
12 | * User authentication protocol: | 12 | * User authentication protocol: |
13 | * | 13 | * |
14 | * 50-59 User authentication generic | 14 | * 50-59 User authentication generic |
15 | * 60-79 User authentication method specific (numbers can be reused | 15 | * 60-79 User authentication method specific (numbers can be reused |
16 | * for different authentication methods) | 16 | * for different authentication methods) |
17 | * | 17 | * |
18 | * Connection protocol: | 18 | * Connection protocol: |
19 | * | 19 | * |
20 | * 80-89 Connection protocol generic | 20 | * 80-89 Connection protocol generic |
21 | * 90-127 Channel related messages | 21 | * 90-127 Channel related messages |
22 | * | 22 | * |
23 | * Reserved for client protocols: | 23 | * Reserved for client protocols: |
24 | * | 24 | * |
25 | * 128-191 Reserved | 25 | * 128-191 Reserved |
26 | * | 26 | * |
27 | * Local extensions: | 27 | * Local extensions: |
28 | * | 28 | * |
29 | * 192-255 Local extensions | 29 | * 192-255 Local extensions |
30 | */ | 30 | */ |
31 | 31 | ||
diff --git a/sshconnect.c b/sshconnect.c index 675de6102..bca0bf43a 100644 --- a/sshconnect.c +++ b/sshconnect.c | |||
@@ -10,7 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include "includes.h" | 12 | #include "includes.h" |
13 | RCSID("$OpenBSD: sshconnect.c,v 1.66 2000/04/12 09:39:10 markus Exp $"); | 13 | RCSID("$OpenBSD: sshconnect.c,v 1.68 2000/04/14 10:30:33 markus Exp $"); |
14 | 14 | ||
15 | #ifdef HAVE_OPENSSL | 15 | #ifdef HAVE_OPENSSL |
16 | #include <openssl/bn.h> | 16 | #include <openssl/bn.h> |
@@ -250,7 +250,7 @@ ssh_connect(const char *host, struct sockaddr_storage * hostaddr, | |||
250 | debug("Trying again..."); | 250 | debug("Trying again..."); |
251 | 251 | ||
252 | /* Loop through addresses for this host, and try each one in | 252 | /* Loop through addresses for this host, and try each one in |
253 | sequence until the connection succeeds. */ | 253 | sequence until the connection succeeds. */ |
254 | for (ai = aitop; ai; ai = ai->ai_next) { | 254 | for (ai = aitop; ai; ai = ai->ai_next) { |
255 | if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6) | 255 | if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6) |
256 | continue; | 256 | continue; |
@@ -264,7 +264,7 @@ ssh_connect(const char *host, struct sockaddr_storage * hostaddr, | |||
264 | host, ntop, strport); | 264 | host, ntop, strport); |
265 | 265 | ||
266 | /* Create a socket for connecting. */ | 266 | /* Create a socket for connecting. */ |
267 | sock = ssh_create_socket(original_real_uid, | 267 | sock = ssh_create_socket(original_real_uid, |
268 | !anonymous && geteuid() == 0 && port < IPPORT_RESERVED, | 268 | !anonymous && geteuid() == 0 && port < IPPORT_RESERVED, |
269 | ai->ai_family); | 269 | ai->ai_family); |
270 | if (sock < 0) | 270 | if (sock < 0) |
@@ -1059,7 +1059,7 @@ ssh_exchange_identification() | |||
1059 | break; | 1059 | break; |
1060 | } | 1060 | } |
1061 | /* FALLTHROUGH */ | 1061 | /* FALLTHROUGH */ |
1062 | default: | 1062 | default: |
1063 | mismatch = 1; | 1063 | mismatch = 1; |
1064 | break; | 1064 | break; |
1065 | } | 1065 | } |
@@ -1363,13 +1363,13 @@ ssh_kex2(char *host, struct sockaddr *hostaddr) | |||
1363 | 1363 | ||
1364 | debug("Sending KEX init."); | 1364 | debug("Sending KEX init."); |
1365 | if (options.ciphers != NULL) { | 1365 | if (options.ciphers != NULL) { |
1366 | myproposal[PROPOSAL_ENC_ALGS_CTOS] = | 1366 | myproposal[PROPOSAL_ENC_ALGS_CTOS] = |
1367 | myproposal[PROPOSAL_ENC_ALGS_STOC] = options.ciphers; | 1367 | myproposal[PROPOSAL_ENC_ALGS_STOC] = options.ciphers; |
1368 | } else if ( | 1368 | } else if ( |
1369 | options.cipher == SSH_CIPHER_ARCFOUR || | 1369 | options.cipher == SSH_CIPHER_ARCFOUR || |
1370 | options.cipher == SSH_CIPHER_3DES_CBC || | 1370 | options.cipher == SSH_CIPHER_3DES_CBC || |
1371 | options.cipher == SSH_CIPHER_CAST128_CBC || | 1371 | options.cipher == SSH_CIPHER_CAST128_CBC || |
1372 | options.cipher == SSH_CIPHER_BLOWFISH_CBC) { | 1372 | options.cipher == SSH_CIPHER_BLOWFISH_CBC) { |
1373 | myproposal[PROPOSAL_ENC_ALGS_CTOS] = | 1373 | myproposal[PROPOSAL_ENC_ALGS_CTOS] = |
1374 | myproposal[PROPOSAL_ENC_ALGS_STOC] = cipher_name(options.cipher); | 1374 | myproposal[PROPOSAL_ENC_ALGS_STOC] = cipher_name(options.cipher); |
1375 | } | 1375 | } |
@@ -1411,6 +1411,7 @@ ssh_kex2(char *host, struct sockaddr *hostaddr) | |||
1411 | debug("first kex follow == %d", i); | 1411 | debug("first kex follow == %d", i); |
1412 | i = packet_get_int(); | 1412 | i = packet_get_int(); |
1413 | debug("reserved == %d", i); | 1413 | debug("reserved == %d", i); |
1414 | packet_done(); | ||
1414 | 1415 | ||
1415 | debug("done read kexinit"); | 1416 | debug("done read kexinit"); |
1416 | kex = kex_choose_conf(cprop, sprop, 0); | 1417 | kex = kex_choose_conf(cprop, sprop, 0); |
@@ -1434,7 +1435,7 @@ ssh_kex2(char *host, struct sockaddr *hostaddr) | |||
1434 | fprintf(stderr, "\npub= "); | 1435 | fprintf(stderr, "\npub= "); |
1435 | bignum_print(dh->pub_key); | 1436 | bignum_print(dh->pub_key); |
1436 | fprintf(stderr, "\n"); | 1437 | fprintf(stderr, "\n"); |
1437 | DHparams_print_fp(stderr, dh); | 1438 | DHparams_print_fp(stderr, dh); |
1438 | #endif | 1439 | #endif |
1439 | 1440 | ||
1440 | debug("Wait SSH2_MSG_KEXDH_REPLY."); | 1441 | debug("Wait SSH2_MSG_KEXDH_REPLY."); |
@@ -1466,6 +1467,7 @@ ssh_kex2(char *host, struct sockaddr *hostaddr) | |||
1466 | 1467 | ||
1467 | /* signed H */ | 1468 | /* signed H */ |
1468 | signature = packet_get_string(&slen); | 1469 | signature = packet_get_string(&slen); |
1470 | packet_done(); | ||
1469 | 1471 | ||
1470 | if (!dh_pub_is_valid(dh, dh_server_pub)) | 1472 | if (!dh_pub_is_valid(dh, dh_server_pub)) |
1471 | packet_disconnect("bad server public DH value"); | 1473 | packet_disconnect("bad server public DH value"); |
@@ -1475,14 +1477,14 @@ ssh_kex2(char *host, struct sockaddr *hostaddr) | |||
1475 | kout = DH_compute_key(kbuf, dh_server_pub, dh); | 1477 | kout = DH_compute_key(kbuf, dh_server_pub, dh); |
1476 | #ifdef DEBUG_KEXDH | 1478 | #ifdef DEBUG_KEXDH |
1477 | debug("shared secret: len %d/%d", klen, kout); | 1479 | debug("shared secret: len %d/%d", klen, kout); |
1478 | fprintf(stderr, "shared secret == "); | 1480 | fprintf(stderr, "shared secret == "); |
1479 | for (i = 0; i< kout; i++) | 1481 | for (i = 0; i< kout; i++) |
1480 | fprintf(stderr, "%02x", (kbuf[i])&0xff); | 1482 | fprintf(stderr, "%02x", (kbuf[i])&0xff); |
1481 | fprintf(stderr, "\n"); | 1483 | fprintf(stderr, "\n"); |
1482 | #endif | 1484 | #endif |
1483 | shared_secret = BN_new(); | 1485 | shared_secret = BN_new(); |
1484 | 1486 | ||
1485 | BN_bin2bn(kbuf, kout, shared_secret); | 1487 | BN_bin2bn(kbuf, kout, shared_secret); |
1486 | memset(kbuf, 0, klen); | 1488 | memset(kbuf, 0, klen); |
1487 | xfree(kbuf); | 1489 | xfree(kbuf); |
1488 | 1490 | ||
@@ -1502,10 +1504,10 @@ ssh_kex2(char *host, struct sockaddr *hostaddr) | |||
1502 | xfree(client_kexinit); | 1504 | xfree(client_kexinit); |
1503 | xfree(server_kexinit); | 1505 | xfree(server_kexinit); |
1504 | #ifdef DEBUG_KEXDH | 1506 | #ifdef DEBUG_KEXDH |
1505 | fprintf(stderr, "hash == "); | 1507 | fprintf(stderr, "hash == "); |
1506 | for (i = 0; i< 20; i++) | 1508 | for (i = 0; i< 20; i++) |
1507 | fprintf(stderr, "%02x", (hash[i])&0xff); | 1509 | fprintf(stderr, "%02x", (hash[i])&0xff); |
1508 | fprintf(stderr, "\n"); | 1510 | fprintf(stderr, "\n"); |
1509 | #endif | 1511 | #endif |
1510 | dsa_verify(server_host_key, (unsigned char *)signature, slen, hash, 20); | 1512 | dsa_verify(server_host_key, (unsigned char *)signature, slen, hash, 20); |
1511 | key_free(server_host_key); | 1513 | key_free(server_host_key); |
@@ -1518,6 +1520,7 @@ ssh_kex2(char *host, struct sockaddr *hostaddr) | |||
1518 | 1520 | ||
1519 | debug("Wait SSH2_MSG_NEWKEYS."); | 1521 | debug("Wait SSH2_MSG_NEWKEYS."); |
1520 | packet_read_expect(&payload_len, SSH2_MSG_NEWKEYS); | 1522 | packet_read_expect(&payload_len, SSH2_MSG_NEWKEYS); |
1523 | packet_done(); | ||
1521 | debug("GOT SSH2_MSG_NEWKEYS."); | 1524 | debug("GOT SSH2_MSG_NEWKEYS."); |
1522 | 1525 | ||
1523 | debug("send SSH2_MSG_NEWKEYS."); | 1526 | debug("send SSH2_MSG_NEWKEYS."); |
@@ -1551,7 +1554,7 @@ ssh_userauth2(int host_key_valid, RSA *own_host_key, | |||
1551 | char *server_user, *local_user; | 1554 | char *server_user, *local_user; |
1552 | char *auths; | 1555 | char *auths; |
1553 | char *password; | 1556 | char *password; |
1554 | char *service = "ssh-connection"; // service name | 1557 | char *service = "ssh-connection"; /* service name */ |
1555 | 1558 | ||
1556 | debug("send SSH2_MSG_SERVICE_REQUEST"); | 1559 | debug("send SSH2_MSG_SERVICE_REQUEST"); |
1557 | packet_start(SSH2_MSG_SERVICE_REQUEST); | 1560 | packet_start(SSH2_MSG_SERVICE_REQUEST); |
@@ -1563,8 +1566,15 @@ ssh_userauth2(int host_key_valid, RSA *own_host_key, | |||
1563 | if (type != SSH2_MSG_SERVICE_ACCEPT) { | 1566 | if (type != SSH2_MSG_SERVICE_ACCEPT) { |
1564 | fatal("denied SSH2_MSG_SERVICE_ACCEPT: %d", type); | 1567 | fatal("denied SSH2_MSG_SERVICE_ACCEPT: %d", type); |
1565 | } | 1568 | } |
1566 | /* payload empty for ssh-2.0.13 ?? */ | 1569 | if (packet_remaining() > 0) { |
1567 | /* reply = packet_get_string(&payload_len); */ | 1570 | char *reply = packet_get_string(&plen); |
1571 | debug("service_accept: %s", reply); | ||
1572 | xfree(reply); | ||
1573 | } else { | ||
1574 | /* payload empty for ssh-2.0.13 ?? */ | ||
1575 | log("buggy server: service_accept w/o service"); | ||
1576 | } | ||
1577 | packet_done(); | ||
1568 | debug("got SSH2_MSG_SERVICE_ACCEPT"); | 1578 | debug("got SSH2_MSG_SERVICE_ACCEPT"); |
1569 | 1579 | ||
1570 | /*XX COMMONCODE: */ | 1580 | /*XX COMMONCODE: */ |
@@ -1593,6 +1603,7 @@ ssh_userauth2(int host_key_valid, RSA *own_host_key, | |||
1593 | auths = packet_get_string(&dlen); | 1603 | auths = packet_get_string(&dlen); |
1594 | debug("authentications that can continue: %s", auths); | 1604 | debug("authentications that can continue: %s", auths); |
1595 | partial = packet_get_char(); | 1605 | partial = packet_get_char(); |
1606 | packet_done(); | ||
1596 | if (partial) | 1607 | if (partial) |
1597 | debug("partial success"); | 1608 | debug("partial success"); |
1598 | if (strstr(auths, "password") == NULL) | 1609 | if (strstr(auths, "password") == NULL) |
@@ -1613,6 +1624,7 @@ ssh_userauth2(int host_key_valid, RSA *own_host_key, | |||
1613 | packet_send(); | 1624 | packet_send(); |
1614 | packet_write_wait(); | 1625 | packet_write_wait(); |
1615 | } | 1626 | } |
1627 | packet_done(); | ||
1616 | debug("ssh-userauth2 successfull"); | 1628 | debug("ssh-userauth2 successfull"); |
1617 | } | 1629 | } |
1618 | 1630 | ||
@@ -14,7 +14,7 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include "includes.h" | 16 | #include "includes.h" |
17 | RCSID("$OpenBSD: sshd.c,v 1.104 2000/04/12 09:39:10 markus Exp $"); | 17 | RCSID("$OpenBSD: sshd.c,v 1.105 2000/04/14 10:30:33 markus Exp $"); |
18 | 18 | ||
19 | #include "xmalloc.h" | 19 | #include "xmalloc.h" |
20 | #include "rsa.h" | 20 | #include "rsa.h" |
@@ -67,7 +67,7 @@ ServerOptions options; | |||
67 | /* Name of the server configuration file. */ | 67 | /* Name of the server configuration file. */ |
68 | char *config_file_name = SERVER_CONFIG_FILE; | 68 | char *config_file_name = SERVER_CONFIG_FILE; |
69 | 69 | ||
70 | /* | 70 | /* |
71 | * Flag indicating whether IPv4 or IPv6. This can be set on the command line. | 71 | * Flag indicating whether IPv4 or IPv6. This can be set on the command line. |
72 | * Default value is AF_UNSPEC means both IPv4 and IPv6. | 72 | * Default value is AF_UNSPEC means both IPv4 and IPv6. |
73 | */ | 73 | */ |
@@ -162,7 +162,7 @@ close_listen_socks(void) | |||
162 | * the effect is to reread the configuration file (and to regenerate | 162 | * the effect is to reread the configuration file (and to regenerate |
163 | * the server key). | 163 | * the server key). |
164 | */ | 164 | */ |
165 | void | 165 | void |
166 | sighup_handler(int sig) | 166 | sighup_handler(int sig) |
167 | { | 167 | { |
168 | received_sighup = 1; | 168 | received_sighup = 1; |
@@ -173,7 +173,7 @@ sighup_handler(int sig) | |||
173 | * Called from the main program after receiving SIGHUP. | 173 | * Called from the main program after receiving SIGHUP. |
174 | * Restarts the server. | 174 | * Restarts the server. |
175 | */ | 175 | */ |
176 | void | 176 | void |
177 | sighup_restart() | 177 | sighup_restart() |
178 | { | 178 | { |
179 | log("Received SIGHUP; restarting."); | 179 | log("Received SIGHUP; restarting."); |
@@ -188,7 +188,7 @@ sighup_restart() | |||
188 | * These close the listen socket; not closing it seems to cause "Address | 188 | * These close the listen socket; not closing it seems to cause "Address |
189 | * already in use" problems on some machines, which is inconvenient. | 189 | * already in use" problems on some machines, which is inconvenient. |
190 | */ | 190 | */ |
191 | void | 191 | void |
192 | sigterm_handler(int sig) | 192 | sigterm_handler(int sig) |
193 | { | 193 | { |
194 | log("Received signal %d; terminating.", sig); | 194 | log("Received signal %d; terminating.", sig); |
@@ -200,7 +200,7 @@ sigterm_handler(int sig) | |||
200 | * SIGCHLD handler. This is called whenever a child dies. This will then | 200 | * SIGCHLD handler. This is called whenever a child dies. This will then |
201 | * reap any zombies left by exited c. | 201 | * reap any zombies left by exited c. |
202 | */ | 202 | */ |
203 | void | 203 | void |
204 | main_sigchld_handler(int sig) | 204 | main_sigchld_handler(int sig) |
205 | { | 205 | { |
206 | int save_errno = errno; | 206 | int save_errno = errno; |
@@ -216,7 +216,7 @@ main_sigchld_handler(int sig) | |||
216 | /* | 216 | /* |
217 | * Signal handler for the alarm after the login grace period has expired. | 217 | * Signal handler for the alarm after the login grace period has expired. |
218 | */ | 218 | */ |
219 | void | 219 | void |
220 | grace_alarm_handler(int sig) | 220 | grace_alarm_handler(int sig) |
221 | { | 221 | { |
222 | /* Close the connection. */ | 222 | /* Close the connection. */ |
@@ -233,7 +233,7 @@ grace_alarm_handler(int sig) | |||
233 | * Thus there should be no concurrency control/asynchronous execution | 233 | * Thus there should be no concurrency control/asynchronous execution |
234 | * problems. | 234 | * problems. |
235 | */ | 235 | */ |
236 | void | 236 | void |
237 | key_regeneration_alarm(int sig) | 237 | key_regeneration_alarm(int sig) |
238 | { | 238 | { |
239 | int save_errno = errno; | 239 | int save_errno = errno; |
@@ -266,15 +266,15 @@ key_regeneration_alarm(int sig) | |||
266 | char * | 266 | char * |
267 | chop(char *s) | 267 | chop(char *s) |
268 | { | 268 | { |
269 | char *t = s; | 269 | char *t = s; |
270 | while (*t) { | 270 | while (*t) { |
271 | if(*t == '\n' || *t == '\r') { | 271 | if(*t == '\n' || *t == '\r') { |
272 | *t = '\0'; | 272 | *t = '\0'; |
273 | return s; | 273 | return s; |
274 | } | 274 | } |
275 | t++; | 275 | t++; |
276 | } | 276 | } |
277 | return s; | 277 | return s; |
278 | 278 | ||
279 | } | 279 | } |
280 | 280 | ||
@@ -337,7 +337,7 @@ sshd_exchange_identification(int sock_in, int sock_out) | |||
337 | */ | 337 | */ |
338 | if (sscanf(client_version_string, "SSH-%d.%d-%[^\n]\n", | 338 | if (sscanf(client_version_string, "SSH-%d.%d-%[^\n]\n", |
339 | &remote_major, &remote_minor, remote_version) != 3) { | 339 | &remote_major, &remote_minor, remote_version) != 3) { |
340 | s = "Protocol mismatch.\n"; | 340 | s = "Protocol mismatch.\n"; |
341 | (void) atomicio(write, sock_out, s, strlen(s)); | 341 | (void) atomicio(write, sock_out, s, strlen(s)); |
342 | close(sock_in); | 342 | close(sock_in); |
343 | close(sock_out); | 343 | close(sock_out); |
@@ -377,7 +377,7 @@ sshd_exchange_identification(int sock_in, int sock_out) | |||
377 | break; | 377 | break; |
378 | } | 378 | } |
379 | /* FALLTHROUGH */ | 379 | /* FALLTHROUGH */ |
380 | default: | 380 | default: |
381 | mismatch = 1; | 381 | mismatch = 1; |
382 | break; | 382 | break; |
383 | } | 383 | } |
@@ -719,8 +719,8 @@ main(int ac, char **av) | |||
719 | for (i = 0; i < num_listen_socks; i++) | 719 | for (i = 0; i < num_listen_socks; i++) |
720 | if (listen_socks[i] > maxfd) | 720 | if (listen_socks[i] > maxfd) |
721 | maxfd = listen_socks[i]; | 721 | maxfd = listen_socks[i]; |
722 | fdsetsz = howmany(maxfd, NFDBITS) * sizeof(fd_mask); | 722 | fdsetsz = howmany(maxfd, NFDBITS) * sizeof(fd_mask); |
723 | fdset = (fd_set *)xmalloc(fdsetsz); | 723 | fdset = (fd_set *)xmalloc(fdsetsz); |
724 | 724 | ||
725 | /* | 725 | /* |
726 | * Stay listening for connections until the system crashes or | 726 | * Stay listening for connections until the system crashes or |
@@ -1018,7 +1018,7 @@ do_ssh1_kex() | |||
1018 | /* Get cipher type and check whether we accept this. */ | 1018 | /* Get cipher type and check whether we accept this. */ |
1019 | cipher_type = packet_get_char(); | 1019 | cipher_type = packet_get_char(); |
1020 | 1020 | ||
1021 | if (!(cipher_mask() & (1 << cipher_type))) | 1021 | if (!(cipher_mask() & (1 << cipher_type))) |
1022 | packet_disconnect("Warning: client selects unsupported cipher."); | 1022 | packet_disconnect("Warning: client selects unsupported cipher."); |
1023 | 1023 | ||
1024 | /* Get check bytes from the packet. These must match those we | 1024 | /* Get check bytes from the packet. These must match those we |
@@ -1145,7 +1145,7 @@ do_ssh2_kex() | |||
1145 | /* KEXINIT */ | 1145 | /* KEXINIT */ |
1146 | 1146 | ||
1147 | if (options.ciphers != NULL) { | 1147 | if (options.ciphers != NULL) { |
1148 | myproposal[PROPOSAL_ENC_ALGS_CTOS] = | 1148 | myproposal[PROPOSAL_ENC_ALGS_CTOS] = |
1149 | myproposal[PROPOSAL_ENC_ALGS_STOC] = options.ciphers; | 1149 | myproposal[PROPOSAL_ENC_ALGS_STOC] = options.ciphers; |
1150 | } | 1150 | } |
1151 | 1151 | ||
@@ -1258,10 +1258,10 @@ do_ssh2_kex() | |||
1258 | xfree(client_kexinit); | 1258 | xfree(client_kexinit); |
1259 | xfree(server_kexinit); | 1259 | xfree(server_kexinit); |
1260 | #ifdef DEBUG_KEXDH | 1260 | #ifdef DEBUG_KEXDH |
1261 | fprintf(stderr, "hash == "); | 1261 | fprintf(stderr, "hash == "); |
1262 | for (i = 0; i< 20; i++) | 1262 | for (i = 0; i< 20; i++) |
1263 | fprintf(stderr, "%02x", (hash[i])&0xff); | 1263 | fprintf(stderr, "%02x", (hash[i])&0xff); |
1264 | fprintf(stderr, "\n"); | 1264 | fprintf(stderr, "\n"); |
1265 | #endif | 1265 | #endif |
1266 | /* sign H */ | 1266 | /* sign H */ |
1267 | dsa_sign(server_host_key, &signature, &slen, hash, 20); | 1267 | dsa_sign(server_host_key, &signature, &slen, hash, 20); |
diff --git a/ttymodes.c b/ttymodes.c index fffc6d5bf..647c66035 100644 --- a/ttymodes.c +++ b/ttymodes.c | |||
@@ -10,7 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include "includes.h" | 12 | #include "includes.h" |
13 | RCSID("$Id: ttymodes.c,v 1.3 1999/11/25 00:54:59 damien Exp $"); | 13 | RCSID("$Id: ttymodes.c,v 1.4 2000/04/16 01:18:49 damien Exp $"); |
14 | 14 | ||
15 | #include "packet.h" | 15 | #include "packet.h" |
16 | #include "ssh.h" | 16 | #include "ssh.h" |
@@ -23,7 +23,7 @@ RCSID("$Id: ttymodes.c,v 1.3 1999/11/25 00:54:59 damien Exp $"); | |||
23 | * Converts POSIX speed_t to a baud rate. The values of the | 23 | * Converts POSIX speed_t to a baud rate. The values of the |
24 | * constants for speed_t are not themselves portable. | 24 | * constants for speed_t are not themselves portable. |
25 | */ | 25 | */ |
26 | static int | 26 | static int |
27 | speed_to_baud(speed_t speed) | 27 | speed_to_baud(speed_t speed) |
28 | { | 28 | { |
29 | switch (speed) { | 29 | switch (speed) { |
@@ -112,7 +112,7 @@ speed_to_baud(speed_t speed) | |||
112 | /* | 112 | /* |
113 | * Converts a numeric baud rate to a POSIX speed_t. | 113 | * Converts a numeric baud rate to a POSIX speed_t. |
114 | */ | 114 | */ |
115 | static speed_t | 115 | static speed_t |
116 | baud_to_speed(int baud) | 116 | baud_to_speed(int baud) |
117 | { | 117 | { |
118 | switch (baud) { | 118 | switch (baud) { |
@@ -203,7 +203,7 @@ baud_to_speed(int baud) | |||
203 | * in a portable manner, and appends the modes to a packet | 203 | * in a portable manner, and appends the modes to a packet |
204 | * being constructed. | 204 | * being constructed. |
205 | */ | 205 | */ |
206 | void | 206 | void |
207 | tty_make_modes(int fd) | 207 | tty_make_modes(int fd) |
208 | { | 208 | { |
209 | struct termios tio; | 209 | struct termios tio; |
@@ -247,7 +247,7 @@ tty_make_modes(int fd) | |||
247 | * Decodes terminal modes for the terminal referenced by fd in a portable | 247 | * Decodes terminal modes for the terminal referenced by fd in a portable |
248 | * manner from a packet being read. | 248 | * manner from a packet being read. |
249 | */ | 249 | */ |
250 | void | 250 | void |
251 | tty_parse_modes(int fd, int *n_bytes_ptr) | 251 | tty_parse_modes(int fd, int *n_bytes_ptr) |
252 | { | 252 | { |
253 | struct termios tio; | 253 | struct termios tio; |
diff --git a/ttymodes.h b/ttymodes.h index 79726aa47..41aad79d6 100644 --- a/ttymodes.h +++ b/ttymodes.h | |||
@@ -1,18 +1,18 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * ttymodes.h | 3 | * ttymodes.h |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * SGTTY stuff contributed by Janne Snabb <snabb@niksula.hut.fi> | 6 | * SGTTY stuff contributed by Janne Snabb <snabb@niksula.hut.fi> |
7 | * | 7 | * |
8 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 8 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
9 | * All rights reserved | 9 | * All rights reserved |
10 | * | 10 | * |
11 | * Created: Tue Mar 21 15:42:09 1995 ylo | 11 | * Created: Tue Mar 21 15:42:09 1995 ylo |
12 | * | 12 | * |
13 | */ | 13 | */ |
14 | 14 | ||
15 | /* RCSID("$Id: ttymodes.h,v 1.3 1999/11/25 00:54:59 damien Exp $"); */ | 15 | /* RCSID("$Id: ttymodes.h,v 1.4 2000/04/16 01:18:49 damien Exp $"); */ |
16 | 16 | ||
17 | /* The tty mode description is a stream of bytes. The stream consists of | 17 | /* The tty mode description is a stream of bytes. The stream consists of |
18 | * opcode-arguments pairs. It is terminated by opcode TTY_OP_END (0). | 18 | * opcode-arguments pairs. It is terminated by opcode TTY_OP_END (0). |
@@ -7,7 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include "includes.h" | 9 | #include "includes.h" |
10 | RCSID("$Id: uidswap.c,v 1.4 2000/01/20 13:18:16 damien Exp $"); | 10 | RCSID("$Id: uidswap.c,v 1.5 2000/04/16 01:18:49 damien Exp $"); |
11 | 11 | ||
12 | #include "ssh.h" | 12 | #include "ssh.h" |
13 | #include "uidswap.h" | 13 | #include "uidswap.h" |
@@ -35,7 +35,7 @@ static uid_t saved_euid = 0; | |||
35 | * Temporarily changes to the given uid. If the effective user | 35 | * Temporarily changes to the given uid. If the effective user |
36 | * id is not root, this does nothing. This call cannot be nested. | 36 | * id is not root, this does nothing. This call cannot be nested. |
37 | */ | 37 | */ |
38 | void | 38 | void |
39 | temporarily_use_uid(uid_t uid) | 39 | temporarily_use_uid(uid_t uid) |
40 | { | 40 | { |
41 | #ifdef SAVED_IDS_WORK_WITH_SETEUID | 41 | #ifdef SAVED_IDS_WORK_WITH_SETEUID |
@@ -59,7 +59,7 @@ temporarily_use_uid(uid_t uid) | |||
59 | /* | 59 | /* |
60 | * Restores to the original uid. | 60 | * Restores to the original uid. |
61 | */ | 61 | */ |
62 | void | 62 | void |
63 | restore_uid() | 63 | restore_uid() |
64 | { | 64 | { |
65 | #ifdef SAVED_IDS_WORK_WITH_SETEUID | 65 | #ifdef SAVED_IDS_WORK_WITH_SETEUID |
@@ -80,7 +80,7 @@ restore_uid() | |||
80 | * Permanently sets all uids to the given uid. This cannot be | 80 | * Permanently sets all uids to the given uid. This cannot be |
81 | * called while temporarily_use_uid is effective. | 81 | * called while temporarily_use_uid is effective. |
82 | */ | 82 | */ |
83 | void | 83 | void |
84 | permanently_set_uid(uid_t uid) | 84 | permanently_set_uid(uid_t uid) |
85 | { | 85 | { |
86 | if (setuid(uid) < 0) | 86 | if (setuid(uid) < 0) |
@@ -1,15 +1,15 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * uidswap.h | 3 | * uidswap.h |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Sat Sep 9 01:43:15 1995 ylo | 10 | * Created: Sat Sep 9 01:43:15 1995 ylo |
11 | * Last modified: Sat Sep 9 02:34:04 1995 ylo | 11 | * Last modified: Sat Sep 9 02:34:04 1995 ylo |
12 | * | 12 | * |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #ifndef UIDSWAP_H | 15 | #ifndef UIDSWAP_H |
@@ -8,7 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include "includes.h" | 10 | #include "includes.h" |
11 | RCSID("$Id: xmalloc.c,v 1.2 1999/11/24 13:26:23 damien Exp $"); | 11 | RCSID("$Id: xmalloc.c,v 1.3 2000/04/16 01:18:49 damien Exp $"); |
12 | 12 | ||
13 | #include "ssh.h" | 13 | #include "ssh.h" |
14 | 14 | ||
@@ -34,7 +34,7 @@ xrealloc(void *ptr, size_t new_size) | |||
34 | return new_ptr; | 34 | return new_ptr; |
35 | } | 35 | } |
36 | 36 | ||
37 | void | 37 | void |
38 | xfree(void *ptr) | 38 | xfree(void *ptr) |
39 | { | 39 | { |
40 | if (ptr == NULL) | 40 | if (ptr == NULL) |
@@ -1,20 +1,20 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * xmalloc.h | 3 | * xmalloc.h |
4 | * | 4 | * |
5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | * | 6 | * |
7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | * All rights reserved | 8 | * All rights reserved |
9 | * | 9 | * |
10 | * Created: Mon Mar 20 22:09:17 1995 ylo | 10 | * Created: Mon Mar 20 22:09:17 1995 ylo |
11 | * | 11 | * |
12 | * Versions of malloc and friends that check their results, and never return | 12 | * Versions of malloc and friends that check their results, and never return |
13 | * failure (they call fatal if they encounter an error). | 13 | * failure (they call fatal if they encounter an error). |
14 | * | 14 | * |
15 | */ | 15 | */ |
16 | 16 | ||
17 | /* RCSID("$Id: xmalloc.h,v 1.2 1999/11/24 13:26:23 damien Exp $"); */ | 17 | /* RCSID("$Id: xmalloc.h,v 1.3 2000/04/16 01:18:49 damien Exp $"); */ |
18 | 18 | ||
19 | #ifndef XMALLOC_H | 19 | #ifndef XMALLOC_H |
20 | #define XMALLOC_H | 20 | #define XMALLOC_H |