summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--auth-rsa.c10
-rw-r--r--auth2-gss.c12
-rw-r--r--auth2-pubkey.c8
-rw-r--r--authfile.c10
-rw-r--r--canohost.c30
-rw-r--r--channels.c10
-rw-r--r--cipher.c18
-rw-r--r--dns.c8
-rw-r--r--kex.c10
-rw-r--r--monitor.c110
-rw-r--r--monitor_fdpass.c10
-rw-r--r--monitor_wrap.c28
-rw-r--r--monitor_wrap.h8
-rw-r--r--nchan.c6
-rw-r--r--packet.c34
-rw-r--r--progressmeter.c6
-rw-r--r--scp.c10
-rw-r--r--sftp-server.c18
-rw-r--r--sftp.c8
-rw-r--r--ssh-gss.h40
-rw-r--r--ssh-keygen.c10
-rw-r--r--ssh.c10
-rw-r--r--sshconnect.c12
-rw-r--r--sshconnect1.c10
-rw-r--r--sshlogin.c10
-rw-r--r--sshpty.c40
27 files changed, 252 insertions, 244 deletions
diff --git a/ChangeLog b/ChangeLog
index 21dd96798..fae8d6c6d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,14 @@
10 - djm@cvs.openbsd.org 2004/06/20 19:28:12 10 - djm@cvs.openbsd.org 2004/06/20 19:28:12
11 [sftp.1] 11 [sftp.1]
12 mention new -n flag 12 mention new -n flag
13 - avsm@cvs.openbsd.org 2004/06/21 17:36:31
14 [auth-rsa.c auth2-gss.c auth2-pubkey.c authfile.c canohost.c channels.c
15 cipher.c dns.c kex.c monitor.c monitor_fdpass.c monitor_wrap.c
16 monitor_wrap.h nchan.c packet.c progressmeter.c scp.c sftp-server.c sftp.c
17 ssh-gss.h ssh-keygen.c ssh.c sshconnect.c sshconnect1.c sshlogin.c
18 sshpty.c]
19 make ssh -Wshadow clean, no functional changes
20 markus@ ok
13 21
1420040620 2220040620
15 - (tim) [configure.ac Makefile.in] Only change TEST_SHELL on broken platforms. 23 - (tim) [configure.ac Makefile.in] Only change TEST_SHELL on broken platforms.
@@ -1332,4 +1340,4 @@
1332 - (djm) Trim deprecated options from INSTALL. Mention UsePAM 1340 - (djm) Trim deprecated options from INSTALL. Mention UsePAM
1333 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu 1341 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
1334 1342
1335$Id: ChangeLog,v 1.3420 2004/06/22 02:31:23 dtucker Exp $ 1343$Id: ChangeLog,v 1.3421 2004/06/22 02:56:01 dtucker Exp $
diff --git a/auth-rsa.c b/auth-rsa.c
index 8a02b8a8f..16369d47c 100644
--- a/auth-rsa.c
+++ b/auth-rsa.c
@@ -14,7 +14,7 @@
14 */ 14 */
15 15
16#include "includes.h" 16#include "includes.h"
17RCSID("$OpenBSD: auth-rsa.c,v 1.59 2004/05/09 01:19:27 djm Exp $"); 17RCSID("$OpenBSD: auth-rsa.c,v 1.60 2004/06/21 17:36:31 avsm Exp $");
18 18
19#include <openssl/rsa.h> 19#include <openssl/rsa.h>
20#include <openssl/md5.h> 20#include <openssl/md5.h>
@@ -203,7 +203,7 @@ auth_rsa_key_allowed(struct passwd *pw, BIGNUM *client_n, Key **rkey)
203 */ 203 */
204 while (fgets(line, sizeof(line), f)) { 204 while (fgets(line, sizeof(line), f)) {
205 char *cp; 205 char *cp;
206 char *options; 206 char *key_options;
207 207
208 linenum++; 208 linenum++;
209 209
@@ -221,7 +221,7 @@ auth_rsa_key_allowed(struct passwd *pw, BIGNUM *client_n, Key **rkey)
221 */ 221 */
222 if (*cp < '0' || *cp > '9') { 222 if (*cp < '0' || *cp > '9') {
223 int quoted = 0; 223 int quoted = 0;
224 options = cp; 224 key_options = cp;
225 for (; *cp && (quoted || (*cp != ' ' && *cp != '\t')); cp++) { 225 for (; *cp && (quoted || (*cp != ' ' && *cp != '\t')); cp++) {
226 if (*cp == '\\' && cp[1] == '"') 226 if (*cp == '\\' && cp[1] == '"')
227 cp++; /* Skip both */ 227 cp++; /* Skip both */
@@ -229,7 +229,7 @@ auth_rsa_key_allowed(struct passwd *pw, BIGNUM *client_n, Key **rkey)
229 quoted = !quoted; 229 quoted = !quoted;
230 } 230 }
231 } else 231 } else
232 options = NULL; 232 key_options = NULL;
233 233
234 /* Parse the key from the line. */ 234 /* Parse the key from the line. */
235 if (hostfile_read_key(&cp, &bits, key) == 0) { 235 if (hostfile_read_key(&cp, &bits, key) == 0) {
@@ -254,7 +254,7 @@ auth_rsa_key_allowed(struct passwd *pw, BIGNUM *client_n, Key **rkey)
254 * If our options do not allow this key to be used, 254 * If our options do not allow this key to be used,
255 * do not send challenge. 255 * do not send challenge.
256 */ 256 */
257 if (!auth_parse_options(pw, options, file, linenum)) 257 if (!auth_parse_options(pw, key_options, file, linenum))
258 continue; 258 continue;
259 259
260 /* break out, this key is allowed */ 260 /* break out, this key is allowed */
diff --git a/auth2-gss.c b/auth2-gss.c
index 9249988d3..3289ba18e 100644
--- a/auth2-gss.c
+++ b/auth2-gss.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth2-gss.c,v 1.7 2003/11/21 11:57:03 djm Exp $ */ 1/* $OpenBSD: auth2-gss.c,v 1.8 2004/06/21 17:36:31 avsm Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. 4 * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved.
@@ -54,7 +54,7 @@ static void input_gssapi_errtok(int, u_int32_t, void *);
54static int 54static int
55userauth_gssapi(Authctxt *authctxt) 55userauth_gssapi(Authctxt *authctxt)
56{ 56{
57 gss_OID_desc oid = {0, NULL}; 57 gss_OID_desc goid = {0, NULL};
58 Gssctxt *ctxt = NULL; 58 Gssctxt *ctxt = NULL;
59 int mechs; 59 int mechs;
60 gss_OID_set supported; 60 gss_OID_set supported;
@@ -85,9 +85,9 @@ userauth_gssapi(Authctxt *authctxt)
85 if (len > 2 && 85 if (len > 2 &&
86 doid[0] == SSH_GSS_OIDTYPE && 86 doid[0] == SSH_GSS_OIDTYPE &&
87 doid[1] == len - 2) { 87 doid[1] == len - 2) {
88 oid.elements = doid + 2; 88 goid.elements = doid + 2;
89 oid.length = len - 2; 89 goid.length = len - 2;
90 gss_test_oid_set_member(&ms, &oid, supported, 90 gss_test_oid_set_member(&ms, &goid, supported,
91 &present); 91 &present);
92 } else { 92 } else {
93 logit("Badly formed OID received"); 93 logit("Badly formed OID received");
@@ -101,7 +101,7 @@ userauth_gssapi(Authctxt *authctxt)
101 return (0); 101 return (0);
102 } 102 }
103 103
104 if (GSS_ERROR(PRIVSEP(ssh_gssapi_server_ctx(&ctxt, &oid)))) { 104 if (GSS_ERROR(PRIVSEP(ssh_gssapi_server_ctx(&ctxt, &goid)))) {
105 xfree(doid); 105 xfree(doid);
106 return (0); 106 return (0);
107 } 107 }
diff --git a/auth2-pubkey.c b/auth2-pubkey.c
index 3063eecc3..9898d4a63 100644
--- a/auth2-pubkey.c
+++ b/auth2-pubkey.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: auth2-pubkey.c,v 1.6 2004/01/19 21:25:15 markus Exp $"); 26RCSID("$OpenBSD: auth2-pubkey.c,v 1.7 2004/06/21 17:36:31 avsm Exp $");
27 27
28#include "ssh2.h" 28#include "ssh2.h"
29#include "xmalloc.h" 29#include "xmalloc.h"
@@ -205,7 +205,7 @@ user_key_allowed2(struct passwd *pw, Key *key, char *file)
205 found = key_new(key->type); 205 found = key_new(key->type);
206 206
207 while (fgets(line, sizeof(line), f)) { 207 while (fgets(line, sizeof(line), f)) {
208 char *cp, *options = NULL; 208 char *cp, *key_options = NULL;
209 linenum++; 209 linenum++;
210 /* Skip leading whitespace, empty and comment lines. */ 210 /* Skip leading whitespace, empty and comment lines. */
211 for (cp = line; *cp == ' ' || *cp == '\t'; cp++) 211 for (cp = line; *cp == ' ' || *cp == '\t'; cp++)
@@ -217,7 +217,7 @@ user_key_allowed2(struct passwd *pw, Key *key, char *file)
217 /* no key? check if there are options for this key */ 217 /* no key? check if there are options for this key */
218 int quoted = 0; 218 int quoted = 0;
219 debug2("user_key_allowed: check options: '%s'", cp); 219 debug2("user_key_allowed: check options: '%s'", cp);
220 options = cp; 220 key_options = cp;
221 for (; *cp && (quoted || (*cp != ' ' && *cp != '\t')); cp++) { 221 for (; *cp && (quoted || (*cp != ' ' && *cp != '\t')); cp++) {
222 if (*cp == '\\' && cp[1] == '"') 222 if (*cp == '\\' && cp[1] == '"')
223 cp++; /* Skip both */ 223 cp++; /* Skip both */
@@ -234,7 +234,7 @@ user_key_allowed2(struct passwd *pw, Key *key, char *file)
234 } 234 }
235 } 235 }
236 if (key_equal(found, key) && 236 if (key_equal(found, key) &&
237 auth_parse_options(pw, options, file, linenum) == 1) { 237 auth_parse_options(pw, key_options, file, linenum) == 1) {
238 found_key = 1; 238 found_key = 1;
239 debug("matching key found: file %s, line %lu", 239 debug("matching key found: file %s, line %lu",
240 file, linenum); 240 file, linenum);
diff --git a/authfile.c b/authfile.c
index 305e9473b..76a60d020 100644
--- a/authfile.c
+++ b/authfile.c
@@ -36,7 +36,7 @@
36 */ 36 */
37 37
38#include "includes.h" 38#include "includes.h"
39RCSID("$OpenBSD: authfile.c,v 1.56 2004/05/11 19:01:43 deraadt Exp $"); 39RCSID("$OpenBSD: authfile.c,v 1.57 2004/06/21 17:36:31 avsm Exp $");
40 40
41#include <openssl/err.h> 41#include <openssl/err.h>
42#include <openssl/evp.h> 42#include <openssl/evp.h>
@@ -72,7 +72,7 @@ key_save_private_rsa1(Key *key, const char *filename, const char *passphrase,
72 int fd, i, cipher_num; 72 int fd, i, cipher_num;
73 CipherContext ciphercontext; 73 CipherContext ciphercontext;
74 Cipher *cipher; 74 Cipher *cipher;
75 u_int32_t rand; 75 u_int32_t rnd;
76 76
77 /* 77 /*
78 * If the passphrase is empty, use SSH_CIPHER_NONE to ease converting 78 * If the passphrase is empty, use SSH_CIPHER_NONE to ease converting
@@ -87,9 +87,9 @@ key_save_private_rsa1(Key *key, const char *filename, const char *passphrase,
87 buffer_init(&buffer); 87 buffer_init(&buffer);
88 88
89 /* Put checkbytes for checking passphrase validity. */ 89 /* Put checkbytes for checking passphrase validity. */
90 rand = arc4random(); 90 rnd = arc4random();
91 buf[0] = rand & 0xff; 91 buf[0] = rnd & 0xff;
92 buf[1] = (rand >> 8) & 0xff; 92 buf[1] = (rnd >> 8) & 0xff;
93 buf[2] = buf[0]; 93 buf[2] = buf[0];
94 buf[3] = buf[1]; 94 buf[3] = buf[1];
95 buffer_append(&buffer, buf, 4); 95 buffer_append(&buffer, buf, 4);
diff --git a/canohost.c b/canohost.c
index 54369d49b..057f061b6 100644
--- a/canohost.c
+++ b/canohost.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: canohost.c,v 1.39 2004/03/31 21:58:47 djm Exp $"); 15RCSID("$OpenBSD: canohost.c,v 1.40 2004/06/21 17:36:31 avsm Exp $");
16 16
17#include "packet.h" 17#include "packet.h"
18#include "xmalloc.h" 18#include "xmalloc.h"
@@ -28,7 +28,7 @@ static void ipv64_normalise_mapped(struct sockaddr_storage *, socklen_t *);
28 */ 28 */
29 29
30static char * 30static char *
31get_remote_hostname(int socket, int use_dns) 31get_remote_hostname(int sock, int use_dns)
32{ 32{
33 struct sockaddr_storage from; 33 struct sockaddr_storage from;
34 int i; 34 int i;
@@ -39,13 +39,13 @@ get_remote_hostname(int socket, int use_dns)
39 /* Get IP address of client. */ 39 /* Get IP address of client. */
40 fromlen = sizeof(from); 40 fromlen = sizeof(from);
41 memset(&from, 0, sizeof(from)); 41 memset(&from, 0, sizeof(from));
42 if (getpeername(socket, (struct sockaddr *)&from, &fromlen) < 0) { 42 if (getpeername(sock, (struct sockaddr *)&from, &fromlen) < 0) {
43 debug("getpeername failed: %.100s", strerror(errno)); 43 debug("getpeername failed: %.100s", strerror(errno));
44 cleanup_exit(255); 44 cleanup_exit(255);
45 } 45 }
46 46
47 if (from.ss_family == AF_INET) 47 if (from.ss_family == AF_INET)
48 check_ip_options(socket, ntop); 48 check_ip_options(sock, ntop);
49 49
50 ipv64_normalise_mapped(&from, &fromlen); 50 ipv64_normalise_mapped(&from, &fromlen);
51 51
@@ -138,7 +138,7 @@ get_remote_hostname(int socket, int use_dns)
138 */ 138 */
139/* IPv4 only */ 139/* IPv4 only */
140static void 140static void
141check_ip_options(int socket, char *ipaddr) 141check_ip_options(int sock, char *ipaddr)
142{ 142{
143#ifdef IP_OPTIONS 143#ifdef IP_OPTIONS
144 u_char options[200]; 144 u_char options[200];
@@ -152,7 +152,7 @@ check_ip_options(int socket, char *ipaddr)
152 else 152 else
153 ipproto = IPPROTO_IP; 153 ipproto = IPPROTO_IP;
154 option_size = sizeof(options); 154 option_size = sizeof(options);
155 if (getsockopt(socket, ipproto, IP_OPTIONS, options, 155 if (getsockopt(sock, ipproto, IP_OPTIONS, options,
156 &option_size) >= 0 && option_size != 0) { 156 &option_size) >= 0 && option_size != 0) {
157 text[0] = '\0'; 157 text[0] = '\0';
158 for (i = 0; i < option_size; i++) 158 for (i = 0; i < option_size; i++)
@@ -227,7 +227,7 @@ get_canonical_hostname(int use_dns)
227 * The returned string must be freed. 227 * The returned string must be freed.
228 */ 228 */
229static char * 229static char *
230get_socket_address(int socket, int remote, int flags) 230get_socket_address(int sock, int remote, int flags)
231{ 231{
232 struct sockaddr_storage addr; 232 struct sockaddr_storage addr;
233 socklen_t addrlen; 233 socklen_t addrlen;
@@ -238,11 +238,11 @@ get_socket_address(int socket, int remote, int flags)
238 memset(&addr, 0, sizeof(addr)); 238 memset(&addr, 0, sizeof(addr));
239 239
240 if (remote) { 240 if (remote) {
241 if (getpeername(socket, (struct sockaddr *)&addr, &addrlen) 241 if (getpeername(sock, (struct sockaddr *)&addr, &addrlen)
242 < 0) 242 < 0)
243 return NULL; 243 return NULL;
244 } else { 244 } else {
245 if (getsockname(socket, (struct sockaddr *)&addr, &addrlen) 245 if (getsockname(sock, (struct sockaddr *)&addr, &addrlen)
246 < 0) 246 < 0)
247 return NULL; 247 return NULL;
248 } 248 }
@@ -261,29 +261,29 @@ get_socket_address(int socket, int remote, int flags)
261} 261}
262 262
263char * 263char *
264get_peer_ipaddr(int socket) 264get_peer_ipaddr(int sock)
265{ 265{
266 char *p; 266 char *p;
267 267
268 if ((p = get_socket_address(socket, 1, NI_NUMERICHOST)) != NULL) 268 if ((p = get_socket_address(sock, 1, NI_NUMERICHOST)) != NULL)
269 return p; 269 return p;
270 return xstrdup("UNKNOWN"); 270 return xstrdup("UNKNOWN");
271} 271}
272 272
273char * 273char *
274get_local_ipaddr(int socket) 274get_local_ipaddr(int sock)
275{ 275{
276 char *p; 276 char *p;
277 277
278 if ((p = get_socket_address(socket, 0, NI_NUMERICHOST)) != NULL) 278 if ((p = get_socket_address(sock, 0, NI_NUMERICHOST)) != NULL)
279 return p; 279 return p;
280 return xstrdup("UNKNOWN"); 280 return xstrdup("UNKNOWN");
281} 281}
282 282
283char * 283char *
284get_local_name(int socket) 284get_local_name(int sock)
285{ 285{
286 return get_socket_address(socket, 0, NI_NAMEREQD); 286 return get_socket_address(sock, 0, NI_NAMEREQD);
287} 287}
288 288
289/* 289/*
diff --git a/channels.c b/channels.c
index 68d854388..a72d9b93d 100644
--- a/channels.c
+++ b/channels.c
@@ -39,7 +39,7 @@
39 */ 39 */
40 40
41#include "includes.h" 41#include "includes.h"
42RCSID("$OpenBSD: channels.c,v 1.206 2004/06/18 11:11:54 djm Exp $"); 42RCSID("$OpenBSD: channels.c,v 1.207 2004/06/21 17:36:31 avsm Exp $");
43 43
44#include "ssh.h" 44#include "ssh.h"
45#include "ssh1.h" 45#include "ssh1.h"
@@ -2903,7 +2903,7 @@ x11_request_forwarding_with_spoofing(int client_session_id,
2903 char *new_data; 2903 char *new_data;
2904 int screen_number; 2904 int screen_number;
2905 const char *cp; 2905 const char *cp;
2906 u_int32_t rand = 0; 2906 u_int32_t rnd = 0;
2907 2907
2908 cp = getenv("DISPLAY"); 2908 cp = getenv("DISPLAY");
2909 if (cp) 2909 if (cp)
@@ -2928,10 +2928,10 @@ x11_request_forwarding_with_spoofing(int client_session_id,
2928 if (sscanf(data + 2 * i, "%2x", &value) != 1) 2928 if (sscanf(data + 2 * i, "%2x", &value) != 1)
2929 fatal("x11_request_forwarding: bad authentication data: %.100s", data); 2929 fatal("x11_request_forwarding: bad authentication data: %.100s", data);
2930 if (i % 4 == 0) 2930 if (i % 4 == 0)
2931 rand = arc4random(); 2931 rnd = arc4random();
2932 x11_saved_data[i] = value; 2932 x11_saved_data[i] = value;
2933 x11_fake_data[i] = rand & 0xff; 2933 x11_fake_data[i] = rnd & 0xff;
2934 rand >>= 8; 2934 rnd >>= 8;
2935 } 2935 }
2936 x11_saved_data_len = data_len; 2936 x11_saved_data_len = data_len;
2937 x11_fake_data_len = data_len; 2937 x11_fake_data_len = data_len;
diff --git a/cipher.c b/cipher.c
index c13ff5862..255f840a3 100644
--- a/cipher.c
+++ b/cipher.c
@@ -35,7 +35,7 @@
35 */ 35 */
36 36
37#include "includes.h" 37#include "includes.h"
38RCSID("$OpenBSD: cipher.c,v 1.68 2004/01/23 19:26:33 hshoexer Exp $"); 38RCSID("$OpenBSD: cipher.c,v 1.69 2004/06/21 17:36:31 avsm Exp $");
39 39
40#include "xmalloc.h" 40#include "xmalloc.h"
41#include "log.h" 41#include "log.h"
@@ -166,25 +166,25 @@ int
166ciphers_valid(const char *names) 166ciphers_valid(const char *names)
167{ 167{
168 Cipher *c; 168 Cipher *c;
169 char *ciphers, *cp; 169 char *cipher_list, *cp;
170 char *p; 170 char *p;
171 171
172 if (names == NULL || strcmp(names, "") == 0) 172 if (names == NULL || strcmp(names, "") == 0)
173 return 0; 173 return 0;
174 ciphers = cp = xstrdup(names); 174 cipher_list = cp = xstrdup(names);
175 for ((p = strsep(&cp, CIPHER_SEP)); p && *p != '\0'; 175 for ((p = strsep(&cp, CIPHER_SEP)); p && *p != '\0';
176 (p = strsep(&cp, CIPHER_SEP))) { 176 (p = strsep(&cp, CIPHER_SEP))) {
177 c = cipher_by_name(p); 177 c = cipher_by_name(p);
178 if (c == NULL || c->number != SSH_CIPHER_SSH2) { 178 if (c == NULL || c->number != SSH_CIPHER_SSH2) {
179 debug("bad cipher %s [%s]", p, names); 179 debug("bad cipher %s [%s]", p, names);
180 xfree(ciphers); 180 xfree(cipher_list);
181 return 0; 181 return 0;
182 } else { 182 } else {
183 debug3("cipher ok: %s [%s]", p, names); 183 debug3("cipher ok: %s [%s]", p, names);
184 } 184 }
185 } 185 }
186 debug3("ciphers ok: [%s]", names); 186 debug3("ciphers ok: [%s]", names);
187 xfree(ciphers); 187 xfree(cipher_list);
188 return 1; 188 return 1;
189} 189}
190 190
@@ -213,7 +213,7 @@ cipher_name(int id)
213void 213void
214cipher_init(CipherContext *cc, Cipher *cipher, 214cipher_init(CipherContext *cc, Cipher *cipher,
215 const u_char *key, u_int keylen, const u_char *iv, u_int ivlen, 215 const u_char *key, u_int keylen, const u_char *iv, u_int ivlen,
216 int encrypt) 216 int do_encrypt)
217{ 217{
218 static int dowarn = 1; 218 static int dowarn = 1;
219#ifdef SSH_OLD_EVP 219#ifdef SSH_OLD_EVP
@@ -255,7 +255,7 @@ cipher_init(CipherContext *cc, Cipher *cipher,
255 (encrypt == CIPHER_ENCRYPT)); 255 (encrypt == CIPHER_ENCRYPT));
256#else 256#else
257 if (EVP_CipherInit(&cc->evp, type, NULL, (u_char *)iv, 257 if (EVP_CipherInit(&cc->evp, type, NULL, (u_char *)iv,
258 (encrypt == CIPHER_ENCRYPT)) == 0) 258 (do_encrypt == CIPHER_ENCRYPT)) == 0)
259 fatal("cipher_init: EVP_CipherInit failed for %s", 259 fatal("cipher_init: EVP_CipherInit failed for %s",
260 cipher->name); 260 cipher->name);
261 klen = EVP_CIPHER_CTX_key_length(&cc->evp); 261 klen = EVP_CIPHER_CTX_key_length(&cc->evp);
@@ -302,7 +302,7 @@ cipher_cleanup(CipherContext *cc)
302 302
303void 303void
304cipher_set_key_string(CipherContext *cc, Cipher *cipher, 304cipher_set_key_string(CipherContext *cc, Cipher *cipher,
305 const char *passphrase, int encrypt) 305 const char *passphrase, int do_encrypt)
306{ 306{
307 MD5_CTX md; 307 MD5_CTX md;
308 u_char digest[16]; 308 u_char digest[16];
@@ -311,7 +311,7 @@ cipher_set_key_string(CipherContext *cc, Cipher *cipher,
311 MD5_Update(&md, (const u_char *)passphrase, strlen(passphrase)); 311 MD5_Update(&md, (const u_char *)passphrase, strlen(passphrase));
312 MD5_Final(digest, &md); 312 MD5_Final(digest, &md);
313 313
314 cipher_init(cc, cipher, digest, 16, NULL, 0, encrypt); 314 cipher_init(cc, cipher, digest, 16, NULL, 0, do_encrypt);
315 315
316 memset(digest, 0, sizeof(digest)); 316 memset(digest, 0, sizeof(digest));
317 memset(&md, 0, sizeof(md)); 317 memset(&md, 0, sizeof(md));
diff --git a/dns.c b/dns.c
index ad634f1f7..140ab6042 100644
--- a/dns.c
+++ b/dns.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dns.c,v 1.9 2003/11/21 11:57:03 djm Exp $ */ 1/* $OpenBSD: dns.c,v 1.10 2004/06/21 17:36:31 avsm Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2003 Wesley Griffin. All rights reserved. 4 * Copyright (c) 2003 Wesley Griffin. All rights reserved.
@@ -43,7 +43,7 @@
43#include "uuencode.h" 43#include "uuencode.h"
44 44
45extern char *__progname; 45extern char *__progname;
46RCSID("$OpenBSD: dns.c,v 1.9 2003/11/21 11:57:03 djm Exp $"); 46RCSID("$OpenBSD: dns.c,v 1.10 2004/06/21 17:36:31 avsm Exp $");
47 47
48#ifndef LWRES 48#ifndef LWRES
49static const char *errset_text[] = { 49static const char *errset_text[] = {
@@ -56,9 +56,9 @@ static const char *errset_text[] = {
56}; 56};
57 57
58static const char * 58static const char *
59dns_result_totext(unsigned int error) 59dns_result_totext(unsigned int res)
60{ 60{
61 switch (error) { 61 switch (res) {
62 case ERRSET_SUCCESS: 62 case ERRSET_SUCCESS:
63 return errset_text[ERRSET_SUCCESS]; 63 return errset_text[ERRSET_SUCCESS];
64 case ERRSET_NOMEMORY: 64 case ERRSET_NOMEMORY:
diff --git a/kex.c b/kex.c
index cda8bf9b7..a668346c3 100644
--- a/kex.c
+++ b/kex.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: kex.c,v 1.59 2004/06/13 12:53:24 djm Exp $"); 26RCSID("$OpenBSD: kex.c,v 1.60 2004/06/21 17:36:31 avsm Exp $");
27 27
28#include <openssl/crypto.h> 28#include <openssl/crypto.h>
29 29
@@ -148,7 +148,7 @@ kex_finish(Kex *kex)
148void 148void
149kex_send_kexinit(Kex *kex) 149kex_send_kexinit(Kex *kex)
150{ 150{
151 u_int32_t rand = 0; 151 u_int32_t rnd = 0;
152 u_char *cookie; 152 u_char *cookie;
153 int i; 153 int i;
154 154
@@ -168,9 +168,9 @@ kex_send_kexinit(Kex *kex)
168 cookie = buffer_ptr(&kex->my); 168 cookie = buffer_ptr(&kex->my);
169 for (i = 0; i < KEX_COOKIE_LEN; i++) { 169 for (i = 0; i < KEX_COOKIE_LEN; i++) {
170 if (i % 4 == 0) 170 if (i % 4 == 0)
171 rand = arc4random(); 171 rnd = arc4random();
172 cookie[i] = rand; 172 cookie[i] = rnd;
173 rand >>= 8; 173 rnd >>= 8;
174 } 174 }
175 packet_start(SSH2_MSG_KEXINIT); 175 packet_start(SSH2_MSG_KEXINIT);
176 packet_put_raw(buffer_ptr(&kex->my), buffer_len(&kex->my)); 176 packet_put_raw(buffer_ptr(&kex->my), buffer_len(&kex->my));
diff --git a/monitor.c b/monitor.c
index c287a2da1..288727554 100644
--- a/monitor.c
+++ b/monitor.c
@@ -25,7 +25,7 @@
25 */ 25 */
26 26
27#include "includes.h" 27#include "includes.h"
28RCSID("$OpenBSD: monitor.c,v 1.58 2004/06/13 12:53:24 djm Exp $"); 28RCSID("$OpenBSD: monitor.c,v 1.59 2004/06/21 17:36:31 avsm Exp $");
29 29
30#include <openssl/dh.h> 30#include <openssl/dh.h>
31 31
@@ -350,9 +350,9 @@ monitor_set_child_handler(pid_t pid)
350} 350}
351 351
352static void 352static void
353monitor_child_handler(int signal) 353monitor_child_handler(int sig)
354{ 354{
355 kill(monitor_child_pid, signal); 355 kill(monitor_child_pid, sig);
356} 356}
357 357
358void 358void
@@ -467,7 +467,7 @@ monitor_reset_key_state(void)
467} 467}
468 468
469int 469int
470mm_answer_moduli(int socket, Buffer *m) 470mm_answer_moduli(int sock, Buffer *m)
471{ 471{
472 DH *dh; 472 DH *dh;
473 int min, want, max; 473 int min, want, max;
@@ -497,12 +497,12 @@ mm_answer_moduli(int socket, Buffer *m)
497 497
498 DH_free(dh); 498 DH_free(dh);
499 } 499 }
500 mm_request_send(socket, MONITOR_ANS_MODULI, m); 500 mm_request_send(sock, MONITOR_ANS_MODULI, m);
501 return (0); 501 return (0);
502} 502}
503 503
504int 504int
505mm_answer_sign(int socket, Buffer *m) 505mm_answer_sign(int sock, Buffer *m)
506{ 506{
507 Key *key; 507 Key *key;
508 u_char *p; 508 u_char *p;
@@ -538,7 +538,7 @@ mm_answer_sign(int socket, Buffer *m)
538 xfree(p); 538 xfree(p);
539 xfree(signature); 539 xfree(signature);
540 540
541 mm_request_send(socket, MONITOR_ANS_SIGN, m); 541 mm_request_send(sock, MONITOR_ANS_SIGN, m);
542 542
543 /* Turn on permissions for getpwnam */ 543 /* Turn on permissions for getpwnam */
544 monitor_permit(mon_dispatch, MONITOR_REQ_PWNAM, 1); 544 monitor_permit(mon_dispatch, MONITOR_REQ_PWNAM, 1);
@@ -549,7 +549,7 @@ mm_answer_sign(int socket, Buffer *m)
549/* Retrieves the password entry and also checks if the user is permitted */ 549/* Retrieves the password entry and also checks if the user is permitted */
550 550
551int 551int
552mm_answer_pwnamallow(int socket, Buffer *m) 552mm_answer_pwnamallow(int sock, Buffer *m)
553{ 553{
554 char *login; 554 char *login;
555 struct passwd *pwent; 555 struct passwd *pwent;
@@ -593,7 +593,7 @@ mm_answer_pwnamallow(int socket, Buffer *m)
593 593
594 out: 594 out:
595 debug3("%s: sending MONITOR_ANS_PWNAM: %d", __func__, allowed); 595 debug3("%s: sending MONITOR_ANS_PWNAM: %d", __func__, allowed);
596 mm_request_send(socket, MONITOR_ANS_PWNAM, m); 596 mm_request_send(sock, MONITOR_ANS_PWNAM, m);
597 597
598 /* For SSHv1 allow authentication now */ 598 /* For SSHv1 allow authentication now */
599 if (!compat20) 599 if (!compat20)
@@ -612,14 +612,14 @@ mm_answer_pwnamallow(int socket, Buffer *m)
612 return (0); 612 return (0);
613} 613}
614 614
615int mm_answer_auth2_read_banner(int socket, Buffer *m) 615int mm_answer_auth2_read_banner(int sock, Buffer *m)
616{ 616{
617 char *banner; 617 char *banner;
618 618
619 buffer_clear(m); 619 buffer_clear(m);
620 banner = auth2_read_banner(); 620 banner = auth2_read_banner();
621 buffer_put_cstring(m, banner != NULL ? banner : ""); 621 buffer_put_cstring(m, banner != NULL ? banner : "");
622 mm_request_send(socket, MONITOR_ANS_AUTH2_READ_BANNER, m); 622 mm_request_send(sock, MONITOR_ANS_AUTH2_READ_BANNER, m);
623 623
624 if (banner != NULL) 624 if (banner != NULL)
625 xfree(banner); 625 xfree(banner);
@@ -628,7 +628,7 @@ int mm_answer_auth2_read_banner(int socket, Buffer *m)
628} 628}
629 629
630int 630int
631mm_answer_authserv(int socket, Buffer *m) 631mm_answer_authserv(int sock, Buffer *m)
632{ 632{
633 monitor_permit_authentications(1); 633 monitor_permit_authentications(1);
634 634
@@ -646,7 +646,7 @@ mm_answer_authserv(int socket, Buffer *m)
646} 646}
647 647
648int 648int
649mm_answer_authpassword(int socket, Buffer *m) 649mm_answer_authpassword(int sock, Buffer *m)
650{ 650{
651 static int call_count; 651 static int call_count;
652 char *passwd; 652 char *passwd;
@@ -664,7 +664,7 @@ mm_answer_authpassword(int socket, Buffer *m)
664 buffer_put_int(m, authenticated); 664 buffer_put_int(m, authenticated);
665 665
666 debug3("%s: sending result %d", __func__, authenticated); 666 debug3("%s: sending result %d", __func__, authenticated);
667 mm_request_send(socket, MONITOR_ANS_AUTHPASSWORD, m); 667 mm_request_send(sock, MONITOR_ANS_AUTHPASSWORD, m);
668 668
669 call_count++; 669 call_count++;
670 if (plen == 0 && call_count == 1) 670 if (plen == 0 && call_count == 1)
@@ -678,7 +678,7 @@ mm_answer_authpassword(int socket, Buffer *m)
678 678
679#ifdef BSD_AUTH 679#ifdef BSD_AUTH
680int 680int
681mm_answer_bsdauthquery(int socket, Buffer *m) 681mm_answer_bsdauthquery(int sock, Buffer *m)
682{ 682{
683 char *name, *infotxt; 683 char *name, *infotxt;
684 u_int numprompts; 684 u_int numprompts;
@@ -695,7 +695,7 @@ mm_answer_bsdauthquery(int socket, Buffer *m)
695 buffer_put_cstring(m, prompts[0]); 695 buffer_put_cstring(m, prompts[0]);
696 696
697 debug3("%s: sending challenge success: %u", __func__, success); 697 debug3("%s: sending challenge success: %u", __func__, success);
698 mm_request_send(socket, MONITOR_ANS_BSDAUTHQUERY, m); 698 mm_request_send(sock, MONITOR_ANS_BSDAUTHQUERY, m);
699 699
700 if (success) { 700 if (success) {
701 xfree(name); 701 xfree(name);
@@ -708,7 +708,7 @@ mm_answer_bsdauthquery(int socket, Buffer *m)
708} 708}
709 709
710int 710int
711mm_answer_bsdauthrespond(int socket, Buffer *m) 711mm_answer_bsdauthrespond(int sock, Buffer *m)
712{ 712{
713 char *response; 713 char *response;
714 int authok; 714 int authok;
@@ -727,7 +727,7 @@ mm_answer_bsdauthrespond(int socket, Buffer *m)
727 buffer_put_int(m, authok); 727 buffer_put_int(m, authok);
728 728
729 debug3("%s: sending authenticated: %d", __func__, authok); 729 debug3("%s: sending authenticated: %d", __func__, authok);
730 mm_request_send(socket, MONITOR_ANS_BSDAUTHRESPOND, m); 730 mm_request_send(sock, MONITOR_ANS_BSDAUTHRESPOND, m);
731 731
732 auth_method = "bsdauth"; 732 auth_method = "bsdauth";
733 733
@@ -737,7 +737,7 @@ mm_answer_bsdauthrespond(int socket, Buffer *m)
737 737
738#ifdef SKEY 738#ifdef SKEY
739int 739int
740mm_answer_skeyquery(int socket, Buffer *m) 740mm_answer_skeyquery(int sock, Buffer *m)
741{ 741{
742 struct skey skey; 742 struct skey skey;
743 char challenge[1024]; 743 char challenge[1024];
@@ -752,13 +752,13 @@ mm_answer_skeyquery(int socket, Buffer *m)
752 buffer_put_cstring(m, challenge); 752 buffer_put_cstring(m, challenge);
753 753
754 debug3("%s: sending challenge success: %u", __func__, success); 754 debug3("%s: sending challenge success: %u", __func__, success);
755 mm_request_send(socket, MONITOR_ANS_SKEYQUERY, m); 755 mm_request_send(sock, MONITOR_ANS_SKEYQUERY, m);
756 756
757 return (0); 757 return (0);
758} 758}
759 759
760int 760int
761mm_answer_skeyrespond(int socket, Buffer *m) 761mm_answer_skeyrespond(int sock, Buffer *m)
762{ 762{
763 char *response; 763 char *response;
764 int authok; 764 int authok;
@@ -776,7 +776,7 @@ mm_answer_skeyrespond(int socket, Buffer *m)
776 buffer_put_int(m, authok); 776 buffer_put_int(m, authok);
777 777
778 debug3("%s: sending authenticated: %d", __func__, authok); 778 debug3("%s: sending authenticated: %d", __func__, authok);
779 mm_request_send(socket, MONITOR_ANS_SKEYRESPOND, m); 779 mm_request_send(sock, MONITOR_ANS_SKEYRESPOND, m);
780 780
781 auth_method = "skey"; 781 auth_method = "skey";
782 782
@@ -925,7 +925,7 @@ mm_append_debug(Buffer *m)
925} 925}
926 926
927int 927int
928mm_answer_keyallowed(int socket, Buffer *m) 928mm_answer_keyallowed(int sock, Buffer *m)
929{ 929{
930 Key *key; 930 Key *key;
931 char *cuser, *chost; 931 char *cuser, *chost;
@@ -995,7 +995,7 @@ mm_answer_keyallowed(int socket, Buffer *m)
995 995
996 mm_append_debug(m); 996 mm_append_debug(m);
997 997
998 mm_request_send(socket, MONITOR_ANS_KEYALLOWED, m); 998 mm_request_send(sock, MONITOR_ANS_KEYALLOWED, m);
999 999
1000 if (type == MM_RSAHOSTKEY) 1000 if (type == MM_RSAHOSTKEY)
1001 monitor_permit(mon_dispatch, MONITOR_REQ_RSACHALLENGE, allowed); 1001 monitor_permit(mon_dispatch, MONITOR_REQ_RSACHALLENGE, allowed);
@@ -1116,7 +1116,7 @@ monitor_valid_hostbasedblob(u_char *data, u_int datalen, char *cuser,
1116} 1116}
1117 1117
1118int 1118int
1119mm_answer_keyverify(int socket, Buffer *m) 1119mm_answer_keyverify(int sock, Buffer *m)
1120{ 1120{
1121 Key *key; 1121 Key *key;
1122 u_char *signature, *data, *blob; 1122 u_char *signature, *data, *blob;
@@ -1166,7 +1166,7 @@ mm_answer_keyverify(int socket, Buffer *m)
1166 1166
1167 buffer_clear(m); 1167 buffer_clear(m);
1168 buffer_put_int(m, verified); 1168 buffer_put_int(m, verified);
1169 mm_request_send(socket, MONITOR_ANS_KEYVERIFY, m); 1169 mm_request_send(sock, MONITOR_ANS_KEYVERIFY, m);
1170 1170
1171 return (verified); 1171 return (verified);
1172} 1172}
@@ -1208,7 +1208,7 @@ mm_session_close(Session *s)
1208} 1208}
1209 1209
1210int 1210int
1211mm_answer_pty(int socket, Buffer *m) 1211mm_answer_pty(int sock, Buffer *m)
1212{ 1212{
1213 extern struct monitor *pmonitor; 1213 extern struct monitor *pmonitor;
1214 Session *s; 1214 Session *s;
@@ -1230,10 +1230,10 @@ mm_answer_pty(int socket, Buffer *m)
1230 1230
1231 buffer_put_int(m, 1); 1231 buffer_put_int(m, 1);
1232 buffer_put_cstring(m, s->tty); 1232 buffer_put_cstring(m, s->tty);
1233 mm_request_send(socket, MONITOR_ANS_PTY, m); 1233 mm_request_send(sock, MONITOR_ANS_PTY, m);
1234 1234
1235 mm_send_fd(socket, s->ptyfd); 1235 mm_send_fd(sock, s->ptyfd);
1236 mm_send_fd(socket, s->ttyfd); 1236 mm_send_fd(sock, s->ttyfd);
1237 1237
1238 /* We need to trick ttyslot */ 1238 /* We need to trick ttyslot */
1239 if (dup2(s->ttyfd, 0) == -1) 1239 if (dup2(s->ttyfd, 0) == -1)
@@ -1264,12 +1264,12 @@ mm_answer_pty(int socket, Buffer *m)
1264 if (s != NULL) 1264 if (s != NULL)
1265 mm_session_close(s); 1265 mm_session_close(s);
1266 buffer_put_int(m, 0); 1266 buffer_put_int(m, 0);
1267 mm_request_send(socket, MONITOR_ANS_PTY, m); 1267 mm_request_send(sock, MONITOR_ANS_PTY, m);
1268 return (0); 1268 return (0);
1269} 1269}
1270 1270
1271int 1271int
1272mm_answer_pty_cleanup(int socket, Buffer *m) 1272mm_answer_pty_cleanup(int sock, Buffer *m)
1273{ 1273{
1274 Session *s; 1274 Session *s;
1275 char *tty; 1275 char *tty;
@@ -1285,7 +1285,7 @@ mm_answer_pty_cleanup(int socket, Buffer *m)
1285} 1285}
1286 1286
1287int 1287int
1288mm_answer_sesskey(int socket, Buffer *m) 1288mm_answer_sesskey(int sock, Buffer *m)
1289{ 1289{
1290 BIGNUM *p; 1290 BIGNUM *p;
1291 int rsafail; 1291 int rsafail;
@@ -1306,7 +1306,7 @@ mm_answer_sesskey(int socket, Buffer *m)
1306 1306
1307 BN_clear_free(p); 1307 BN_clear_free(p);
1308 1308
1309 mm_request_send(socket, MONITOR_ANS_SESSKEY, m); 1309 mm_request_send(sock, MONITOR_ANS_SESSKEY, m);
1310 1310
1311 /* Turn on permissions for sessid passing */ 1311 /* Turn on permissions for sessid passing */
1312 monitor_permit(mon_dispatch, MONITOR_REQ_SESSID, 1); 1312 monitor_permit(mon_dispatch, MONITOR_REQ_SESSID, 1);
@@ -1315,7 +1315,7 @@ mm_answer_sesskey(int socket, Buffer *m)
1315} 1315}
1316 1316
1317int 1317int
1318mm_answer_sessid(int socket, Buffer *m) 1318mm_answer_sessid(int sock, Buffer *m)
1319{ 1319{
1320 int i; 1320 int i;
1321 1321
@@ -1333,7 +1333,7 @@ mm_answer_sessid(int socket, Buffer *m)
1333} 1333}
1334 1334
1335int 1335int
1336mm_answer_rsa_keyallowed(int socket, Buffer *m) 1336mm_answer_rsa_keyallowed(int sock, Buffer *m)
1337{ 1337{
1338 BIGNUM *client_n; 1338 BIGNUM *client_n;
1339 Key *key = NULL; 1339 Key *key = NULL;
@@ -1373,7 +1373,7 @@ mm_answer_rsa_keyallowed(int socket, Buffer *m)
1373 1373
1374 mm_append_debug(m); 1374 mm_append_debug(m);
1375 1375
1376 mm_request_send(socket, MONITOR_ANS_RSAKEYALLOWED, m); 1376 mm_request_send(sock, MONITOR_ANS_RSAKEYALLOWED, m);
1377 1377
1378 monitor_permit(mon_dispatch, MONITOR_REQ_RSACHALLENGE, allowed); 1378 monitor_permit(mon_dispatch, MONITOR_REQ_RSACHALLENGE, allowed);
1379 monitor_permit(mon_dispatch, MONITOR_REQ_RSARESPONSE, 0); 1379 monitor_permit(mon_dispatch, MONITOR_REQ_RSARESPONSE, 0);
@@ -1381,7 +1381,7 @@ mm_answer_rsa_keyallowed(int socket, Buffer *m)
1381} 1381}
1382 1382
1383int 1383int
1384mm_answer_rsa_challenge(int socket, Buffer *m) 1384mm_answer_rsa_challenge(int sock, Buffer *m)
1385{ 1385{
1386 Key *key = NULL; 1386 Key *key = NULL;
1387 u_char *blob; 1387 u_char *blob;
@@ -1407,7 +1407,7 @@ mm_answer_rsa_challenge(int socket, Buffer *m)
1407 buffer_put_bignum2(m, ssh1_challenge); 1407 buffer_put_bignum2(m, ssh1_challenge);
1408 1408
1409 debug3("%s sending reply", __func__); 1409 debug3("%s sending reply", __func__);
1410 mm_request_send(socket, MONITOR_ANS_RSACHALLENGE, m); 1410 mm_request_send(sock, MONITOR_ANS_RSACHALLENGE, m);
1411 1411
1412 monitor_permit(mon_dispatch, MONITOR_REQ_RSARESPONSE, 1); 1412 monitor_permit(mon_dispatch, MONITOR_REQ_RSARESPONSE, 1);
1413 1413
@@ -1417,7 +1417,7 @@ mm_answer_rsa_challenge(int socket, Buffer *m)
1417} 1417}
1418 1418
1419int 1419int
1420mm_answer_rsa_response(int socket, Buffer *m) 1420mm_answer_rsa_response(int sock, Buffer *m)
1421{ 1421{
1422 Key *key = NULL; 1422 Key *key = NULL;
1423 u_char *blob, *response; 1423 u_char *blob, *response;
@@ -1456,13 +1456,13 @@ mm_answer_rsa_response(int socket, Buffer *m)
1456 1456
1457 buffer_clear(m); 1457 buffer_clear(m);
1458 buffer_put_int(m, success); 1458 buffer_put_int(m, success);
1459 mm_request_send(socket, MONITOR_ANS_RSARESPONSE, m); 1459 mm_request_send(sock, MONITOR_ANS_RSARESPONSE, m);
1460 1460
1461 return (success); 1461 return (success);
1462} 1462}
1463 1463
1464int 1464int
1465mm_answer_term(int socket, Buffer *req) 1465mm_answer_term(int sock, Buffer *req)
1466{ 1466{
1467 extern struct monitor *pmonitor; 1467 extern struct monitor *pmonitor;
1468 int res, status; 1468 int res, status;
@@ -1740,23 +1740,23 @@ monitor_reinit(struct monitor *mon)
1740 1740
1741#ifdef GSSAPI 1741#ifdef GSSAPI
1742int 1742int
1743mm_answer_gss_setup_ctx(int socket, Buffer *m) 1743mm_answer_gss_setup_ctx(int sock, Buffer *m)
1744{ 1744{
1745 gss_OID_desc oid; 1745 gss_OID_desc goid;
1746 OM_uint32 major; 1746 OM_uint32 major;
1747 u_int len; 1747 u_int len;
1748 1748
1749 oid.elements = buffer_get_string(m, &len); 1749 goid.elements = buffer_get_string(m, &len);
1750 oid.length = len; 1750 goid.length = len;
1751 1751
1752 major = ssh_gssapi_server_ctx(&gsscontext, &oid); 1752 major = ssh_gssapi_server_ctx(&gsscontext, &goid);
1753 1753
1754 xfree(oid.elements); 1754 xfree(goid.elements);
1755 1755
1756 buffer_clear(m); 1756 buffer_clear(m);
1757 buffer_put_int(m, major); 1757 buffer_put_int(m, major);
1758 1758
1759 mm_request_send(socket,MONITOR_ANS_GSSSETUP, m); 1759 mm_request_send(sock,MONITOR_ANS_GSSSETUP, m);
1760 1760
1761 /* Now we have a context, enable the step */ 1761 /* Now we have a context, enable the step */
1762 monitor_permit(mon_dispatch, MONITOR_REQ_GSSSTEP, 1); 1762 monitor_permit(mon_dispatch, MONITOR_REQ_GSSSTEP, 1);
@@ -1765,7 +1765,7 @@ mm_answer_gss_setup_ctx(int socket, Buffer *m)
1765} 1765}
1766 1766
1767int 1767int
1768mm_answer_gss_accept_ctx(int socket, Buffer *m) 1768mm_answer_gss_accept_ctx(int sock, Buffer *m)
1769{ 1769{
1770 gss_buffer_desc in; 1770 gss_buffer_desc in;
1771 gss_buffer_desc out = GSS_C_EMPTY_BUFFER; 1771 gss_buffer_desc out = GSS_C_EMPTY_BUFFER;
@@ -1782,7 +1782,7 @@ mm_answer_gss_accept_ctx(int socket, Buffer *m)
1782 buffer_put_int(m, major); 1782 buffer_put_int(m, major);
1783 buffer_put_string(m, out.value, out.length); 1783 buffer_put_string(m, out.value, out.length);
1784 buffer_put_int(m, flags); 1784 buffer_put_int(m, flags);
1785 mm_request_send(socket, MONITOR_ANS_GSSSTEP, m); 1785 mm_request_send(sock, MONITOR_ANS_GSSSTEP, m);
1786 1786
1787 gss_release_buffer(&minor, &out); 1787 gss_release_buffer(&minor, &out);
1788 1788
@@ -1795,7 +1795,7 @@ mm_answer_gss_accept_ctx(int socket, Buffer *m)
1795} 1795}
1796 1796
1797int 1797int
1798mm_answer_gss_checkmic(int socket, Buffer *m) 1798mm_answer_gss_checkmic(int sock, Buffer *m)
1799{ 1799{
1800 gss_buffer_desc gssbuf, mic; 1800 gss_buffer_desc gssbuf, mic;
1801 OM_uint32 ret; 1801 OM_uint32 ret;
@@ -1814,7 +1814,7 @@ mm_answer_gss_checkmic(int socket, Buffer *m)
1814 buffer_clear(m); 1814 buffer_clear(m);
1815 buffer_put_int(m, ret); 1815 buffer_put_int(m, ret);
1816 1816
1817 mm_request_send(socket, MONITOR_ANS_GSSCHECKMIC, m); 1817 mm_request_send(sock, MONITOR_ANS_GSSCHECKMIC, m);
1818 1818
1819 if (!GSS_ERROR(ret)) 1819 if (!GSS_ERROR(ret))
1820 monitor_permit(mon_dispatch, MONITOR_REQ_GSSUSEROK, 1); 1820 monitor_permit(mon_dispatch, MONITOR_REQ_GSSUSEROK, 1);
@@ -1823,7 +1823,7 @@ mm_answer_gss_checkmic(int socket, Buffer *m)
1823} 1823}
1824 1824
1825int 1825int
1826mm_answer_gss_userok(int socket, Buffer *m) 1826mm_answer_gss_userok(int sock, Buffer *m)
1827{ 1827{
1828 int authenticated; 1828 int authenticated;
1829 1829
@@ -1833,7 +1833,7 @@ mm_answer_gss_userok(int socket, Buffer *m)
1833 buffer_put_int(m, authenticated); 1833 buffer_put_int(m, authenticated);
1834 1834
1835 debug3("%s: sending result %d", __func__, authenticated); 1835 debug3("%s: sending result %d", __func__, authenticated);
1836 mm_request_send(socket, MONITOR_ANS_GSSUSEROK, m); 1836 mm_request_send(sock, MONITOR_ANS_GSSUSEROK, m);
1837 1837
1838 auth_method="gssapi-with-mic"; 1838 auth_method="gssapi-with-mic";
1839 1839
diff --git a/monitor_fdpass.c b/monitor_fdpass.c
index 22b7882bd..f0dd88e7e 100644
--- a/monitor_fdpass.c
+++ b/monitor_fdpass.c
@@ -24,7 +24,7 @@
24 */ 24 */
25 25
26#include "includes.h" 26#include "includes.h"
27RCSID("$OpenBSD: monitor_fdpass.c,v 1.4 2002/06/26 14:50:04 deraadt Exp $"); 27RCSID("$OpenBSD: monitor_fdpass.c,v 1.5 2004/06/21 17:36:31 avsm Exp $");
28 28
29#include <sys/uio.h> 29#include <sys/uio.h>
30 30
@@ -32,7 +32,7 @@ RCSID("$OpenBSD: monitor_fdpass.c,v 1.4 2002/06/26 14:50:04 deraadt Exp $");
32#include "monitor_fdpass.h" 32#include "monitor_fdpass.h"
33 33
34void 34void
35mm_send_fd(int socket, int fd) 35mm_send_fd(int sock, int fd)
36{ 36{
37#if defined(HAVE_SENDMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) || defined(HAVE_CONTROL_IN_MSGHDR)) 37#if defined(HAVE_SENDMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) || defined(HAVE_CONTROL_IN_MSGHDR))
38 struct msghdr msg; 38 struct msghdr msg;
@@ -63,7 +63,7 @@ mm_send_fd(int socket, int fd)
63 msg.msg_iov = &vec; 63 msg.msg_iov = &vec;
64 msg.msg_iovlen = 1; 64 msg.msg_iovlen = 1;
65 65
66 if ((n = sendmsg(socket, &msg, 0)) == -1) 66 if ((n = sendmsg(sock, &msg, 0)) == -1)
67 fatal("%s: sendmsg(%d): %s", __func__, fd, 67 fatal("%s: sendmsg(%d): %s", __func__, fd,
68 strerror(errno)); 68 strerror(errno));
69 if (n != 1) 69 if (n != 1)
@@ -76,7 +76,7 @@ mm_send_fd(int socket, int fd)
76} 76}
77 77
78int 78int
79mm_receive_fd(int socket) 79mm_receive_fd(int sock)
80{ 80{
81#if defined(HAVE_RECVMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) || defined(HAVE_CONTROL_IN_MSGHDR)) 81#if defined(HAVE_RECVMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) || defined(HAVE_CONTROL_IN_MSGHDR))
82 struct msghdr msg; 82 struct msghdr msg;
@@ -102,7 +102,7 @@ mm_receive_fd(int socket)
102 msg.msg_controllen = sizeof(tmp); 102 msg.msg_controllen = sizeof(tmp);
103#endif 103#endif
104 104
105 if ((n = recvmsg(socket, &msg, 0)) == -1) 105 if ((n = recvmsg(sock, &msg, 0)) == -1)
106 fatal("%s: recvmsg: %s", __func__, strerror(errno)); 106 fatal("%s: recvmsg: %s", __func__, strerror(errno));
107 if (n != 1) 107 if (n != 1)
108 fatal("%s: recvmsg: expected received 1 got %ld", 108 fatal("%s: recvmsg: expected received 1 got %ld",
diff --git a/monitor_wrap.c b/monitor_wrap.c
index ee2dc2027..d9cbd9e32 100644
--- a/monitor_wrap.c
+++ b/monitor_wrap.c
@@ -25,7 +25,7 @@
25 */ 25 */
26 26
27#include "includes.h" 27#include "includes.h"
28RCSID("$OpenBSD: monitor_wrap.c,v 1.35 2003/11/17 11:06:07 markus Exp $"); 28RCSID("$OpenBSD: monitor_wrap.c,v 1.36 2004/06/21 17:36:31 avsm Exp $");
29 29
30#include <openssl/bn.h> 30#include <openssl/bn.h>
31#include <openssl/dh.h> 31#include <openssl/dh.h>
@@ -83,7 +83,7 @@ mm_is_monitor(void)
83} 83}
84 84
85void 85void
86mm_request_send(int socket, enum monitor_reqtype type, Buffer *m) 86mm_request_send(int sock, enum monitor_reqtype type, Buffer *m)
87{ 87{
88 u_int mlen = buffer_len(m); 88 u_int mlen = buffer_len(m);
89 u_char buf[5]; 89 u_char buf[5];
@@ -92,14 +92,14 @@ mm_request_send(int socket, enum monitor_reqtype type, Buffer *m)
92 92
93 PUT_32BIT(buf, mlen + 1); 93 PUT_32BIT(buf, mlen + 1);
94 buf[4] = (u_char) type; /* 1st byte of payload is mesg-type */ 94 buf[4] = (u_char) type; /* 1st byte of payload is mesg-type */
95 if (atomicio(vwrite, socket, buf, sizeof(buf)) != sizeof(buf)) 95 if (atomicio(vwrite, sock, buf, sizeof(buf)) != sizeof(buf))
96 fatal("%s: write", __func__); 96 fatal("%s: write", __func__);
97 if (atomicio(vwrite, socket, buffer_ptr(m), mlen) != mlen) 97 if (atomicio(vwrite, sock, buffer_ptr(m), mlen) != mlen)
98 fatal("%s: write", __func__); 98 fatal("%s: write", __func__);
99} 99}
100 100
101void 101void
102mm_request_receive(int socket, Buffer *m) 102mm_request_receive(int sock, Buffer *m)
103{ 103{
104 u_char buf[4]; 104 u_char buf[4];
105 u_int msg_len; 105 u_int msg_len;
@@ -107,7 +107,7 @@ mm_request_receive(int socket, Buffer *m)
107 107
108 debug3("%s entering", __func__); 108 debug3("%s entering", __func__);
109 109
110 res = atomicio(read, socket, buf, sizeof(buf)); 110 res = atomicio(read, sock, buf, sizeof(buf));
111 if (res != sizeof(buf)) { 111 if (res != sizeof(buf)) {
112 if (res == 0) 112 if (res == 0)
113 cleanup_exit(255); 113 cleanup_exit(255);
@@ -118,19 +118,19 @@ mm_request_receive(int socket, Buffer *m)
118 fatal("%s: read: bad msg_len %d", __func__, msg_len); 118 fatal("%s: read: bad msg_len %d", __func__, msg_len);
119 buffer_clear(m); 119 buffer_clear(m);
120 buffer_append_space(m, msg_len); 120 buffer_append_space(m, msg_len);
121 res = atomicio(read, socket, buffer_ptr(m), msg_len); 121 res = atomicio(read, sock, buffer_ptr(m), msg_len);
122 if (res != msg_len) 122 if (res != msg_len)
123 fatal("%s: read: %ld != msg_len", __func__, (long)res); 123 fatal("%s: read: %ld != msg_len", __func__, (long)res);
124} 124}
125 125
126void 126void
127mm_request_receive_expect(int socket, enum monitor_reqtype type, Buffer *m) 127mm_request_receive_expect(int sock, enum monitor_reqtype type, Buffer *m)
128{ 128{
129 u_char rtype; 129 u_char rtype;
130 130
131 debug3("%s entering: type %d", __func__, type); 131 debug3("%s entering: type %d", __func__, type);
132 132
133 mm_request_receive(socket, m); 133 mm_request_receive(sock, m);
134 rtype = buffer_get_char(m); 134 rtype = buffer_get_char(m);
135 if (rtype != type) 135 if (rtype != type)
136 fatal("%s: read: rtype %d != type %d", __func__, 136 fatal("%s: read: rtype %d != type %d", __func__,
@@ -544,7 +544,7 @@ mm_send_kex(Buffer *m, Kex *kex)
544} 544}
545 545
546void 546void
547mm_send_keystate(struct monitor *pmonitor) 547mm_send_keystate(struct monitor *monitor)
548{ 548{
549 Buffer m; 549 Buffer m;
550 u_char *blob, *p; 550 u_char *blob, *p;
@@ -580,7 +580,7 @@ mm_send_keystate(struct monitor *pmonitor)
580 goto skip; 580 goto skip;
581 } else { 581 } else {
582 /* Kex for rekeying */ 582 /* Kex for rekeying */
583 mm_send_kex(&m, *pmonitor->m_pkex); 583 mm_send_kex(&m, *monitor->m_pkex);
584 } 584 }
585 585
586 debug3("%s: Sending new keys: %p %p", 586 debug3("%s: Sending new keys: %p %p",
@@ -632,7 +632,7 @@ mm_send_keystate(struct monitor *pmonitor)
632 buffer_put_string(&m, buffer_ptr(&input), buffer_len(&input)); 632 buffer_put_string(&m, buffer_ptr(&input), buffer_len(&input));
633 buffer_put_string(&m, buffer_ptr(&output), buffer_len(&output)); 633 buffer_put_string(&m, buffer_ptr(&output), buffer_len(&output));
634 634
635 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_KEYEXPORT, &m); 635 mm_request_send(monitor->m_recvfd, MONITOR_REQ_KEYEXPORT, &m);
636 debug3("%s: Finished sending state", __func__); 636 debug3("%s: Finished sending state", __func__);
637 637
638 buffer_free(&m); 638 buffer_free(&m);
@@ -1093,7 +1093,7 @@ mm_auth_rsa_verify_response(Key *key, BIGNUM *p, u_char response[16])
1093 1093
1094#ifdef GSSAPI 1094#ifdef GSSAPI
1095OM_uint32 1095OM_uint32
1096mm_ssh_gssapi_server_ctx(Gssctxt **ctx, gss_OID oid) 1096mm_ssh_gssapi_server_ctx(Gssctxt **ctx, gss_OID goid)
1097{ 1097{
1098 Buffer m; 1098 Buffer m;
1099 OM_uint32 major; 1099 OM_uint32 major;
@@ -1102,7 +1102,7 @@ mm_ssh_gssapi_server_ctx(Gssctxt **ctx, gss_OID oid)
1102 *ctx = NULL; 1102 *ctx = NULL;
1103 1103
1104 buffer_init(&m); 1104 buffer_init(&m);
1105 buffer_put_string(&m, oid->elements, oid->length); 1105 buffer_put_string(&m, goid->elements, goid->length);
1106 1106
1107 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_GSSSETUP, &m); 1107 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_GSSSETUP, &m);
1108 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_GSSSETUP, &m); 1108 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_GSSSETUP, &m);
diff --git a/monitor_wrap.h b/monitor_wrap.h
index 2170b1324..e5cf5718c 100644
--- a/monitor_wrap.h
+++ b/monitor_wrap.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: monitor_wrap.h,v 1.13 2003/11/17 11:06:07 markus Exp $ */ 1/* $OpenBSD: monitor_wrap.h,v 1.14 2004/06/21 17:36:31 avsm Exp $ */
2 2
3/* 3/*
4 * Copyright 2002 Niels Provos <provos@citi.umich.edu> 4 * Copyright 2002 Niels Provos <provos@citi.umich.edu>
@@ -58,9 +58,9 @@ BIGNUM *mm_auth_rsa_generate_challenge(Key *);
58 58
59#ifdef GSSAPI 59#ifdef GSSAPI
60#include "ssh-gss.h" 60#include "ssh-gss.h"
61OM_uint32 mm_ssh_gssapi_server_ctx(Gssctxt **ctxt, gss_OID oid); 61OM_uint32 mm_ssh_gssapi_server_ctx(Gssctxt **, gss_OID);
62OM_uint32 mm_ssh_gssapi_accept_ctx(Gssctxt *ctxt, 62OM_uint32 mm_ssh_gssapi_accept_ctx(Gssctxt *,
63 gss_buffer_desc *recv, gss_buffer_desc *send, OM_uint32 *flags); 63 gss_buffer_desc *, gss_buffer_desc *, OM_uint32 *);
64int mm_ssh_gssapi_userok(char *user); 64int mm_ssh_gssapi_userok(char *user);
65OM_uint32 mm_ssh_gssapi_checkmic(Gssctxt *, gss_buffer_t, gss_buffer_t); 65OM_uint32 mm_ssh_gssapi_checkmic(Gssctxt *, gss_buffer_t, gss_buffer_t);
66#endif 66#endif
diff --git a/nchan.c b/nchan.c
index 3138cdd19..ecf59c5db 100644
--- a/nchan.c
+++ b/nchan.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: nchan.c,v 1.49 2003/08/29 10:04:36 markus Exp $"); 26RCSID("$OpenBSD: nchan.c,v 1.50 2004/06/21 17:36:31 avsm Exp $");
27 27
28#include "ssh1.h" 28#include "ssh1.h"
29#include "ssh2.h" 29#include "ssh2.h"
@@ -395,7 +395,7 @@ chan_mark_dead(Channel *c)
395} 395}
396 396
397int 397int
398chan_is_dead(Channel *c, int send) 398chan_is_dead(Channel *c, int do_send)
399{ 399{
400 if (c->type == SSH_CHANNEL_ZOMBIE) { 400 if (c->type == SSH_CHANNEL_ZOMBIE) {
401 debug2("channel %d: zombie", c->self); 401 debug2("channel %d: zombie", c->self);
@@ -416,7 +416,7 @@ chan_is_dead(Channel *c, int send)
416 return 0; 416 return 0;
417 } 417 }
418 if (!(c->flags & CHAN_CLOSE_SENT)) { 418 if (!(c->flags & CHAN_CLOSE_SENT)) {
419 if (send) { 419 if (do_send) {
420 chan_send_close2(c); 420 chan_send_close2(c);
421 } else { 421 } else {
422 /* channel would be dead if we sent a close */ 422 /* channel would be dead if we sent a close */
diff --git a/packet.c b/packet.c
index fca0075e7..82a569404 100644
--- a/packet.c
+++ b/packet.c
@@ -37,7 +37,7 @@
37 */ 37 */
38 38
39#include "includes.h" 39#include "includes.h"
40RCSID("$OpenBSD: packet.c,v 1.114 2004/06/14 01:44:39 djm Exp $"); 40RCSID("$OpenBSD: packet.c,v 1.115 2004/06/21 17:36:31 avsm Exp $");
41 41
42#include "openbsd-compat/sys-queue.h" 42#include "openbsd-compat/sys-queue.h"
43 43
@@ -507,7 +507,7 @@ packet_send1(void)
507 u_char buf[8], *cp; 507 u_char buf[8], *cp;
508 int i, padding, len; 508 int i, padding, len;
509 u_int checksum; 509 u_int checksum;
510 u_int32_t rand = 0; 510 u_int32_t rnd = 0;
511 511
512 /* 512 /*
513 * If using packet compression, compress the payload of the outgoing 513 * If using packet compression, compress the payload of the outgoing
@@ -533,9 +533,9 @@ packet_send1(void)
533 cp = buffer_ptr(&outgoing_packet); 533 cp = buffer_ptr(&outgoing_packet);
534 for (i = 0; i < padding; i++) { 534 for (i = 0; i < padding; i++) {
535 if (i % 4 == 0) 535 if (i % 4 == 0)
536 rand = arc4random(); 536 rnd = arc4random();
537 cp[7 - i] = rand & 0xff; 537 cp[7 - i] = rnd & 0xff;
538 rand >>= 8; 538 rnd >>= 8;
539 } 539 }
540 } 540 }
541 buffer_consume(&outgoing_packet, 8 - padding); 541 buffer_consume(&outgoing_packet, 8 - padding);
@@ -580,18 +580,18 @@ set_newkeys(int mode)
580 Comp *comp; 580 Comp *comp;
581 CipherContext *cc; 581 CipherContext *cc;
582 u_int64_t *max_blocks; 582 u_int64_t *max_blocks;
583 int encrypt; 583 int crypt_type;
584 584
585 debug2("set_newkeys: mode %d", mode); 585 debug2("set_newkeys: mode %d", mode);
586 586
587 if (mode == MODE_OUT) { 587 if (mode == MODE_OUT) {
588 cc = &send_context; 588 cc = &send_context;
589 encrypt = CIPHER_ENCRYPT; 589 crypt_type = CIPHER_ENCRYPT;
590 p_send.packets = p_send.blocks = 0; 590 p_send.packets = p_send.blocks = 0;
591 max_blocks = &max_blocks_out; 591 max_blocks = &max_blocks_out;
592 } else { 592 } else {
593 cc = &receive_context; 593 cc = &receive_context;
594 encrypt = CIPHER_DECRYPT; 594 crypt_type = CIPHER_DECRYPT;
595 p_read.packets = p_read.blocks = 0; 595 p_read.packets = p_read.blocks = 0;
596 max_blocks = &max_blocks_in; 596 max_blocks = &max_blocks_in;
597 } 597 }
@@ -620,7 +620,7 @@ set_newkeys(int mode)
620 mac->enabled = 1; 620 mac->enabled = 1;
621 DBG(debug("cipher_init_context: %d", mode)); 621 DBG(debug("cipher_init_context: %d", mode));
622 cipher_init(cc, enc->cipher, enc->key, enc->key_len, 622 cipher_init(cc, enc->cipher, enc->key, enc->key_len,
623 enc->iv, enc->block_size, encrypt); 623 enc->iv, enc->block_size, crypt_type);
624 /* Deleting the keys does not gain extra security */ 624 /* Deleting the keys does not gain extra security */
625 /* memset(enc->iv, 0, enc->block_size); 625 /* memset(enc->iv, 0, enc->block_size);
626 memset(enc->key, 0, enc->key_len); */ 626 memset(enc->key, 0, enc->key_len); */
@@ -654,7 +654,7 @@ packet_send2_wrapped(void)
654 u_char padlen, pad; 654 u_char padlen, pad;
655 u_int packet_length = 0; 655 u_int packet_length = 0;
656 u_int i, len; 656 u_int i, len;
657 u_int32_t rand = 0; 657 u_int32_t rnd = 0;
658 Enc *enc = NULL; 658 Enc *enc = NULL;
659 Mac *mac = NULL; 659 Mac *mac = NULL;
660 Comp *comp = NULL; 660 Comp *comp = NULL;
@@ -713,9 +713,9 @@ packet_send2_wrapped(void)
713 /* random padding */ 713 /* random padding */
714 for (i = 0; i < padlen; i++) { 714 for (i = 0; i < padlen; i++) {
715 if (i % 4 == 0) 715 if (i % 4 == 0)
716 rand = arc4random(); 716 rnd = arc4random();
717 cp[i] = rand & 0xff; 717 cp[i] = rnd & 0xff;
718 rand >>= 8; 718 rnd >>= 8;
719 } 719 }
720 } else { 720 } else {
721 /* clear padding */ 721 /* clear padding */
@@ -1489,16 +1489,16 @@ packet_add_padding(u_char pad)
1489void 1489void
1490packet_send_ignore(int nbytes) 1490packet_send_ignore(int nbytes)
1491{ 1491{
1492 u_int32_t rand = 0; 1492 u_int32_t rnd = 0;
1493 int i; 1493 int i;
1494 1494
1495 packet_start(compat20 ? SSH2_MSG_IGNORE : SSH_MSG_IGNORE); 1495 packet_start(compat20 ? SSH2_MSG_IGNORE : SSH_MSG_IGNORE);
1496 packet_put_int(nbytes); 1496 packet_put_int(nbytes);
1497 for (i = 0; i < nbytes; i++) { 1497 for (i = 0; i < nbytes; i++) {
1498 if (i % 4 == 0) 1498 if (i % 4 == 0)
1499 rand = arc4random(); 1499 rnd = arc4random();
1500 packet_put_char(rand & 0xff); 1500 packet_put_char(rnd & 0xff);
1501 rand >>= 8; 1501 rnd >>= 8;
1502 } 1502 }
1503} 1503}
1504 1504
diff --git a/progressmeter.c b/progressmeter.c
index e74f4785f..629a536b2 100644
--- a/progressmeter.c
+++ b/progressmeter.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: progressmeter.c,v 1.20 2004/05/11 19:01:43 deraadt Exp $"); 26RCSID("$OpenBSD: progressmeter.c,v 1.21 2004/06/21 17:36:31 avsm Exp $");
27 27
28#include "progressmeter.h" 28#include "progressmeter.h"
29#include "atomicio.h" 29#include "atomicio.h"
@@ -224,7 +224,7 @@ update_progress_meter(int ignore)
224} 224}
225 225
226void 226void
227start_progress_meter(char *f, off_t filesize, off_t *stat) 227start_progress_meter(char *f, off_t filesize, off_t *ctr)
228{ 228{
229 struct winsize winsize; 229 struct winsize winsize;
230 230
@@ -232,7 +232,7 @@ start_progress_meter(char *f, off_t filesize, off_t *stat)
232 file = f; 232 file = f;
233 end_pos = filesize; 233 end_pos = filesize;
234 cur_pos = 0; 234 cur_pos = 0;
235 counter = stat; 235 counter = ctr;
236 stalled = 0; 236 stalled = 0;
237 bytes_per_second = 0; 237 bytes_per_second = 0;
238 238
diff --git a/scp.c b/scp.c
index 8621a4409..3ae17c9ac 100644
--- a/scp.c
+++ b/scp.c
@@ -71,7 +71,7 @@
71 */ 71 */
72 72
73#include "includes.h" 73#include "includes.h"
74RCSID("$OpenBSD: scp.c,v 1.114 2004/04/01 12:19:57 markus Exp $"); 74RCSID("$OpenBSD: scp.c,v 1.115 2004/06/21 17:36:31 avsm Exp $");
75 75
76#include "xmalloc.h" 76#include "xmalloc.h"
77#include "atomicio.h" 77#include "atomicio.h"
@@ -663,7 +663,7 @@ bwlimit(int amount)
663{ 663{
664 static struct timeval bwstart, bwend; 664 static struct timeval bwstart, bwend;
665 static int lamt, thresh = 16384; 665 static int lamt, thresh = 16384;
666 u_int64_t wait; 666 u_int64_t waitlen;
667 struct timespec ts, rm; 667 struct timespec ts, rm;
668 668
669 if (!timerisset(&bwstart)) { 669 if (!timerisset(&bwstart)) {
@@ -681,10 +681,10 @@ bwlimit(int amount)
681 return; 681 return;
682 682
683 lamt *= 8; 683 lamt *= 8;
684 wait = (double)1000000L * lamt / limit_rate; 684 waitlen = (double)1000000L * lamt / limit_rate;
685 685
686 bwstart.tv_sec = wait / 1000000L; 686 bwstart.tv_sec = waitlen / 1000000L;
687 bwstart.tv_usec = wait % 1000000L; 687 bwstart.tv_usec = waitlen % 1000000L;
688 688
689 if (timercmp(&bwstart, &bwend, >)) { 689 if (timercmp(&bwstart, &bwend, >)) {
690 timersub(&bwstart, &bwend, &bwend); 690 timersub(&bwstart, &bwend, &bwend);
diff --git a/sftp-server.c b/sftp-server.c
index 1d13e97b2..8349c1763 100644
--- a/sftp-server.c
+++ b/sftp-server.c
@@ -14,7 +14,7 @@
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16#include "includes.h" 16#include "includes.h"
17RCSID("$OpenBSD: sftp-server.c,v 1.45 2004/02/19 21:15:04 markus Exp $"); 17RCSID("$OpenBSD: sftp-server.c,v 1.46 2004/06/21 17:36:31 avsm Exp $");
18 18
19#include "buffer.h" 19#include "buffer.h"
20#include "bufaux.h" 20#include "bufaux.h"
@@ -260,7 +260,7 @@ send_msg(Buffer *m)
260} 260}
261 261
262static void 262static void
263send_status(u_int32_t id, u_int32_t error) 263send_status(u_int32_t id, u_int32_t status)
264{ 264{
265 Buffer msg; 265 Buffer msg;
266 const char *status_messages[] = { 266 const char *status_messages[] = {
@@ -276,14 +276,14 @@ send_status(u_int32_t id, u_int32_t error)
276 "Unknown error" /* Others */ 276 "Unknown error" /* Others */
277 }; 277 };
278 278
279 TRACE("sent status id %u error %u", id, error); 279 TRACE("sent status id %u error %u", id, status);
280 buffer_init(&msg); 280 buffer_init(&msg);
281 buffer_put_char(&msg, SSH2_FXP_STATUS); 281 buffer_put_char(&msg, SSH2_FXP_STATUS);
282 buffer_put_int(&msg, id); 282 buffer_put_int(&msg, id);
283 buffer_put_int(&msg, error); 283 buffer_put_int(&msg, status);
284 if (version >= 3) { 284 if (version >= 3) {
285 buffer_put_cstring(&msg, 285 buffer_put_cstring(&msg,
286 status_messages[MIN(error,SSH2_FX_MAX)]); 286 status_messages[MIN(status,SSH2_FX_MAX)]);
287 buffer_put_cstring(&msg, ""); 287 buffer_put_cstring(&msg, "");
288 } 288 }
289 send_msg(&msg); 289 send_msg(&msg);
@@ -863,20 +863,20 @@ process_readlink(void)
863{ 863{
864 u_int32_t id; 864 u_int32_t id;
865 int len; 865 int len;
866 char link[MAXPATHLEN]; 866 char buf[MAXPATHLEN];
867 char *path; 867 char *path;
868 868
869 id = get_int(); 869 id = get_int();
870 path = get_string(NULL); 870 path = get_string(NULL);
871 TRACE("readlink id %u path %s", id, path); 871 TRACE("readlink id %u path %s", id, path);
872 if ((len = readlink(path, link, sizeof(link) - 1)) == -1) 872 if ((len = readlink(path, buf, sizeof(buf) - 1)) == -1)
873 send_status(id, errno_to_portable(errno)); 873 send_status(id, errno_to_portable(errno));
874 else { 874 else {
875 Stat s; 875 Stat s;
876 876
877 link[len] = '\0'; 877 buf[len] = '\0';
878 attrib_clear(&s.attrib); 878 attrib_clear(&s.attrib);
879 s.name = s.long_name = link; 879 s.name = s.long_name = buf;
880 send_names(id, 1, &s); 880 send_names(id, 1, &s);
881 } 881 }
882 xfree(path); 882 xfree(path);
diff --git a/sftp.c b/sftp.c
index df2aff657..d818ef84e 100644
--- a/sftp.c
+++ b/sftp.c
@@ -16,7 +16,7 @@
16 16
17#include "includes.h" 17#include "includes.h"
18 18
19RCSID("$OpenBSD: sftp.c,v 1.50 2004/06/20 18:53:39 djm Exp $"); 19RCSID("$OpenBSD: sftp.c,v 1.51 2004/06/21 17:36:31 avsm Exp $");
20 20
21#include "buffer.h" 21#include "buffer.h"
22#include "xmalloc.h" 22#include "xmalloc.h"
@@ -277,13 +277,13 @@ path_append(char *p1, char *p2)
277static char * 277static char *
278make_absolute(char *p, char *pwd) 278make_absolute(char *p, char *pwd)
279{ 279{
280 char *abs; 280 char *abs_str;
281 281
282 /* Derelativise */ 282 /* Derelativise */
283 if (p && p[0] != '/') { 283 if (p && p[0] != '/') {
284 abs = path_append(pwd, p); 284 abs_str = path_append(pwd, p);
285 xfree(p); 285 xfree(p);
286 return(abs); 286 return(abs_str);
287 } else 287 } else
288 return(p); 288 return(p);
289} 289}
diff --git a/ssh-gss.h b/ssh-gss.h
index 4f032aa8f..52fb49a6f 100644
--- a/ssh-gss.h
+++ b/ssh-gss.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-gss.h,v 1.4 2003/11/17 11:06:07 markus Exp $ */ 1/* $OpenBSD: ssh-gss.h,v 1.5 2004/06/21 17:36:31 avsm Exp $ */
2/* 2/*
3 * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. 3 * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved.
4 * 4 *
@@ -100,31 +100,31 @@ typedef struct {
100 100
101extern ssh_gssapi_mech *supported_mechs[]; 101extern ssh_gssapi_mech *supported_mechs[];
102 102
103int ssh_gssapi_check_oid(Gssctxt *ctx, void *data, size_t len); 103int ssh_gssapi_check_oid(Gssctxt *, void *, size_t);
104void ssh_gssapi_set_oid_data(Gssctxt *ctx, void *data, size_t len); 104void ssh_gssapi_set_oid_data(Gssctxt *, void *, size_t);
105void ssh_gssapi_set_oid(Gssctxt *ctx, gss_OID oid); 105void ssh_gssapi_set_oid(Gssctxt *, gss_OID);
106void ssh_gssapi_supported_oids(gss_OID_set *oidset); 106void ssh_gssapi_supported_oids(gss_OID_set *);
107ssh_gssapi_mech *ssh_gssapi_get_ctype(Gssctxt *ctxt); 107ssh_gssapi_mech *ssh_gssapi_get_ctype(Gssctxt *);
108 108
109OM_uint32 ssh_gssapi_import_name(Gssctxt *ctx, const char *host); 109OM_uint32 ssh_gssapi_import_name(Gssctxt *, const char *);
110OM_uint32 ssh_gssapi_acquire_cred(Gssctxt *ctx); 110OM_uint32 ssh_gssapi_acquire_cred(Gssctxt *);
111OM_uint32 ssh_gssapi_init_ctx(Gssctxt *ctx, int deleg_creds, 111OM_uint32 ssh_gssapi_init_ctx(Gssctxt *, int,
112 gss_buffer_desc *recv_tok, gss_buffer_desc *send_tok, OM_uint32 *flags); 112 gss_buffer_desc *, gss_buffer_desc *, OM_uint32 *);
113OM_uint32 ssh_gssapi_accept_ctx(Gssctxt *ctx, 113OM_uint32 ssh_gssapi_accept_ctx(Gssctxt *,
114 gss_buffer_desc *recv_tok, gss_buffer_desc *send_tok, OM_uint32 *flags); 114 gss_buffer_desc *, gss_buffer_desc *, OM_uint32 *);
115OM_uint32 ssh_gssapi_getclient(Gssctxt *ctx, ssh_gssapi_client *); 115OM_uint32 ssh_gssapi_getclient(Gssctxt *, ssh_gssapi_client *);
116void ssh_gssapi_error(Gssctxt *ctx); 116void ssh_gssapi_error(Gssctxt *);
117char *ssh_gssapi_last_error(Gssctxt *ctxt, OM_uint32 *maj, OM_uint32 *min); 117char *ssh_gssapi_last_error(Gssctxt *, OM_uint32 *, OM_uint32 *);
118void ssh_gssapi_build_ctx(Gssctxt **ctx); 118void ssh_gssapi_build_ctx(Gssctxt **);
119void ssh_gssapi_delete_ctx(Gssctxt **ctx); 119void ssh_gssapi_delete_ctx(Gssctxt **);
120OM_uint32 ssh_gssapi_sign(Gssctxt *, gss_buffer_t, gss_buffer_t); 120OM_uint32 ssh_gssapi_sign(Gssctxt *, gss_buffer_t, gss_buffer_t);
121OM_uint32 ssh_gssapi_server_ctx(Gssctxt **ctx, gss_OID oid); 121OM_uint32 ssh_gssapi_server_ctx(Gssctxt **, gss_OID);
122void ssh_gssapi_buildmic(Buffer *, const char *, const char *, const char *); 122void ssh_gssapi_buildmic(Buffer *, const char *, const char *, const char *);
123 123
124/* In the server */ 124/* In the server */
125int ssh_gssapi_userok(char *name); 125int ssh_gssapi_userok(char *name);
126OM_uint32 ssh_gssapi_checkmic(Gssctxt *, gss_buffer_t, gss_buffer_t); 126OM_uint32 ssh_gssapi_checkmic(Gssctxt *, gss_buffer_t, gss_buffer_t);
127void ssh_gssapi_do_child(char ***envp, u_int *envsizep); 127void ssh_gssapi_do_child(char ***, u_int *);
128void ssh_gssapi_cleanup_creds(void); 128void ssh_gssapi_cleanup_creds(void);
129void ssh_gssapi_storecreds(void); 129void ssh_gssapi_storecreds(void);
130 130
diff --git a/ssh-keygen.c b/ssh-keygen.c
index 5539fe17a..d4d19d3a1 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: ssh-keygen.c,v 1.115 2004/05/09 00:06:47 djm Exp $"); 15RCSID("$OpenBSD: ssh-keygen.c,v 1.116 2004/06/21 17:36:31 avsm Exp $");
16 16
17#include <openssl/evp.h> 17#include <openssl/evp.h>
18#include <openssl/pem.h> 18#include <openssl/pem.h>
@@ -192,8 +192,8 @@ do_convert_to_ssh2(struct passwd *pw)
192static void 192static void
193buffer_get_bignum_bits(Buffer *b, BIGNUM *value) 193buffer_get_bignum_bits(Buffer *b, BIGNUM *value)
194{ 194{
195 u_int bits = buffer_get_int(b); 195 u_int bignum_bits = buffer_get_int(b);
196 u_int bytes = (bits + 7) / 8; 196 u_int bytes = (bignum_bits + 7) / 8;
197 197
198 if (buffer_len(b) < bytes) 198 if (buffer_len(b) < bytes)
199 fatal("buffer_get_bignum_bits: input buffer too small: " 199 fatal("buffer_get_bignum_bits: input buffer too small: "
@@ -630,7 +630,7 @@ do_change_passphrase(struct passwd *pw)
630 * Print the SSHFP RR. 630 * Print the SSHFP RR.
631 */ 631 */
632static void 632static void
633do_print_resource_record(struct passwd *pw, char *hostname) 633do_print_resource_record(struct passwd *pw, char *hname)
634{ 634{
635 Key *public; 635 Key *public;
636 char *comment = NULL; 636 char *comment = NULL;
@@ -644,7 +644,7 @@ do_print_resource_record(struct passwd *pw, char *hostname)
644 } 644 }
645 public = key_load_public(identity_file, &comment); 645 public = key_load_public(identity_file, &comment);
646 if (public != NULL) { 646 if (public != NULL) {
647 export_dns_rr(hostname, public, stdout, print_generic); 647 export_dns_rr(hname, public, stdout, print_generic);
648 key_free(public); 648 key_free(public);
649 xfree(comment); 649 xfree(comment);
650 exit(0); 650 exit(0);
diff --git a/ssh.c b/ssh.c
index b9bd8c0d1..9e3f73555 100644
--- a/ssh.c
+++ b/ssh.c
@@ -40,7 +40,7 @@
40 */ 40 */
41 41
42#include "includes.h" 42#include "includes.h"
43RCSID("$OpenBSD: ssh.c,v 1.220 2004/06/20 17:36:59 djm Exp $"); 43RCSID("$OpenBSD: ssh.c,v 1.221 2004/06/21 17:36:31 avsm Exp $");
44 44
45#include <openssl/evp.h> 45#include <openssl/evp.h>
46#include <openssl/err.h> 46#include <openssl/err.h>
@@ -807,17 +807,17 @@ x11_get_proto(char **_proto, char **_data)
807 * for the local connection. 807 * for the local connection.
808 */ 808 */
809 if (!got_data) { 809 if (!got_data) {
810 u_int32_t rand = 0; 810 u_int32_t rnd = 0;
811 811
812 logit("Warning: No xauth data; " 812 logit("Warning: No xauth data; "
813 "using fake authentication data for X11 forwarding."); 813 "using fake authentication data for X11 forwarding.");
814 strlcpy(proto, SSH_X11_PROTO, sizeof proto); 814 strlcpy(proto, SSH_X11_PROTO, sizeof proto);
815 for (i = 0; i < 16; i++) { 815 for (i = 0; i < 16; i++) {
816 if (i % 4 == 0) 816 if (i % 4 == 0)
817 rand = arc4random(); 817 rnd = arc4random();
818 snprintf(data + 2 * i, sizeof data - 2 * i, "%02x", 818 snprintf(data + 2 * i, sizeof data - 2 * i, "%02x",
819 rand & 0xff); 819 rnd & 0xff);
820 rand >>= 8; 820 rnd >>= 8;
821 } 821 }
822 } 822 }
823} 823}
diff --git a/sshconnect.c b/sshconnect.c
index 95bb527b2..11008e544 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -13,7 +13,7 @@
13 */ 13 */
14 14
15#include "includes.h" 15#include "includes.h"
16RCSID("$OpenBSD: sshconnect.c,v 1.157 2004/05/08 00:21:31 djm Exp $"); 16RCSID("$OpenBSD: sshconnect.c,v 1.158 2004/06/21 17:36:31 avsm Exp $");
17 17
18#include <openssl/bn.h> 18#include <openssl/bn.h>
19 19
@@ -767,19 +767,19 @@ check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key,
767 break; 767 break;
768 case HOST_CHANGED: 768 case HOST_CHANGED:
769 if (options.check_host_ip && host_ip_differ) { 769 if (options.check_host_ip && host_ip_differ) {
770 char *msg; 770 char *key_msg;
771 if (ip_status == HOST_NEW) 771 if (ip_status == HOST_NEW)
772 msg = "is unknown"; 772 key_msg = "is unknown";
773 else if (ip_status == HOST_OK) 773 else if (ip_status == HOST_OK)
774 msg = "is unchanged"; 774 key_msg = "is unchanged";
775 else 775 else
776 msg = "has a different value"; 776 key_msg = "has a different value";
777 error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); 777 error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
778 error("@ WARNING: POSSIBLE DNS SPOOFING DETECTED! @"); 778 error("@ WARNING: POSSIBLE DNS SPOOFING DETECTED! @");
779 error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); 779 error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
780 error("The %s host key for %s has changed,", type, host); 780 error("The %s host key for %s has changed,", type, host);
781 error("and the key for the according IP address %s", ip); 781 error("and the key for the according IP address %s", ip);
782 error("%s. This could either mean that", msg); 782 error("%s. This could either mean that", key_msg);
783 error("DNS SPOOFING is happening or the IP address for the host"); 783 error("DNS SPOOFING is happening or the IP address for the host");
784 error("and its host key have changed at the same time."); 784 error("and its host key have changed at the same time.");
785 if (ip_status != HOST_NEW) 785 if (ip_status != HOST_NEW)
diff --git a/sshconnect1.c b/sshconnect1.c
index ae33ab39d..61fecab14 100644
--- a/sshconnect1.c
+++ b/sshconnect1.c
@@ -13,7 +13,7 @@
13 */ 13 */
14 14
15#include "includes.h" 15#include "includes.h"
16RCSID("$OpenBSD: sshconnect1.c,v 1.58 2004/05/09 01:19:28 djm Exp $"); 16RCSID("$OpenBSD: sshconnect1.c,v 1.59 2004/06/21 17:36:31 avsm Exp $");
17 17
18#include <openssl/bn.h> 18#include <openssl/bn.h>
19#include <openssl/md5.h> 19#include <openssl/md5.h>
@@ -476,7 +476,7 @@ ssh_kex(char *host, struct sockaddr *hostaddr)
476 u_char cookie[8]; 476 u_char cookie[8];
477 u_int supported_ciphers; 477 u_int supported_ciphers;
478 u_int server_flags, client_flags; 478 u_int server_flags, client_flags;
479 u_int32_t rand = 0; 479 u_int32_t rnd = 0;
480 480
481 debug("Waiting for server public key."); 481 debug("Waiting for server public key.");
482 482
@@ -540,9 +540,9 @@ ssh_kex(char *host, struct sockaddr *hostaddr)
540 */ 540 */
541 for (i = 0; i < 32; i++) { 541 for (i = 0; i < 32; i++) {
542 if (i % 4 == 0) 542 if (i % 4 == 0)
543 rand = arc4random(); 543 rnd = arc4random();
544 session_key[i] = rand & 0xff; 544 session_key[i] = rnd & 0xff;
545 rand >>= 8; 545 rnd >>= 8;
546 } 546 }
547 547
548 /* 548 /*
diff --git a/sshlogin.c b/sshlogin.c
index e1cc4cc82..22cfd344d 100644
--- a/sshlogin.c
+++ b/sshlogin.c
@@ -39,7 +39,7 @@
39 */ 39 */
40 40
41#include "includes.h" 41#include "includes.h"
42RCSID("$OpenBSD: sshlogin.c,v 1.7 2003/06/12 07:57:38 markus Exp $"); 42RCSID("$OpenBSD: sshlogin.c,v 1.8 2004/06/21 17:36:31 avsm Exp $");
43 43
44#include "loginrec.h" 44#include "loginrec.h"
45 45
@@ -64,12 +64,12 @@ get_last_login_time(uid_t uid, const char *logname,
64 * systems were more standardized. 64 * systems were more standardized.
65 */ 65 */
66void 66void
67record_login(pid_t pid, const char *ttyname, const char *user, uid_t uid, 67record_login(pid_t pid, const char *tty, const char *user, uid_t uid,
68 const char *host, struct sockaddr * addr, socklen_t addrlen) 68 const char *host, struct sockaddr * addr, socklen_t addrlen)
69{ 69{
70 struct logininfo *li; 70 struct logininfo *li;
71 71
72 li = login_alloc_entry(pid, user, host, ttyname); 72 li = login_alloc_entry(pid, user, host, tty);
73 login_set_addr(li, addr, addrlen); 73 login_set_addr(li, addr, addrlen);
74 login_login(li); 74 login_login(li);
75 login_free_entry(li); 75 login_free_entry(li);
@@ -91,11 +91,11 @@ record_utmp_only(pid_t pid, const char *ttyname, const char *user,
91 91
92/* Records that the user has logged out. */ 92/* Records that the user has logged out. */
93void 93void
94record_logout(pid_t pid, const char *ttyname, const char *user) 94record_logout(pid_t pid, const char *tty, const char *user)
95{ 95{
96 struct logininfo *li; 96 struct logininfo *li;
97 97
98 li = login_alloc_entry(pid, user, NULL, ttyname); 98 li = login_alloc_entry(pid, user, NULL, tty);
99 login_logout(li); 99 login_logout(li);
100 login_free_entry(li); 100 login_free_entry(li);
101} 101}
diff --git a/sshpty.c b/sshpty.c
index 0fe3891b6..efd1dfefa 100644
--- a/sshpty.c
+++ b/sshpty.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: sshpty.c,v 1.11 2004/01/11 21:55:06 deraadt Exp $"); 15RCSID("$OpenBSD: sshpty.c,v 1.12 2004/06/21 17:36:31 avsm Exp $");
16 16
17#ifdef HAVE_UTIL_H 17#ifdef HAVE_UTIL_H
18# include <util.h> 18# include <util.h>
@@ -60,18 +60,18 @@ pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen)
60/* Releases the tty. Its ownership is returned to root, and permissions to 0666. */ 60/* Releases the tty. Its ownership is returned to root, and permissions to 0666. */
61 61
62void 62void
63pty_release(const char *ttyname) 63pty_release(const char *tty)
64{ 64{
65 if (chown(ttyname, (uid_t) 0, (gid_t) 0) < 0) 65 if (chown(tty, (uid_t) 0, (gid_t) 0) < 0)
66 error("chown %.100s 0 0 failed: %.100s", ttyname, strerror(errno)); 66 error("chown %.100s 0 0 failed: %.100s", tty, strerror(errno));
67 if (chmod(ttyname, (mode_t) 0666) < 0) 67 if (chmod(tty, (mode_t) 0666) < 0)
68 error("chmod %.100s 0666 failed: %.100s", ttyname, strerror(errno)); 68 error("chmod %.100s 0666 failed: %.100s", tty, strerror(errno));
69} 69}
70 70
71/* Makes the tty the process's controlling tty and sets it to sane modes. */ 71/* Makes the tty the process's controlling tty and sets it to sane modes. */
72 72
73void 73void
74pty_make_controlling_tty(int *ttyfd, const char *ttyname) 74pty_make_controlling_tty(int *ttyfd, const char *tty)
75{ 75{
76 int fd; 76 int fd;
77#ifdef USE_VHANGUP 77#ifdef USE_VHANGUP
@@ -82,7 +82,7 @@ pty_make_controlling_tty(int *ttyfd, const char *ttyname)
82 if (setsid() < 0) 82 if (setsid() < 0)
83 error("setsid: %.100s", strerror(errno)); 83 error("setsid: %.100s", strerror(errno));
84 84
85 fd = open(ttyname, O_RDWR|O_NOCTTY); 85 fd = open(tty, O_RDWR|O_NOCTTY);
86 if (fd != -1) { 86 if (fd != -1) {
87 signal(SIGHUP, SIG_IGN); 87 signal(SIGHUP, SIG_IGN);
88 ioctl(fd, TCVHUP, (char *)NULL); 88 ioctl(fd, TCVHUP, (char *)NULL);
@@ -97,7 +97,7 @@ pty_make_controlling_tty(int *ttyfd, const char *ttyname)
97 ioctl(*ttyfd, TCSETCTTY, NULL); 97 ioctl(*ttyfd, TCSETCTTY, NULL);
98 fd = open("/dev/tty", O_RDWR); 98 fd = open("/dev/tty", O_RDWR);
99 if (fd < 0) 99 if (fd < 0)
100 error("%.100s: %.100s", ttyname, strerror(errno)); 100 error("%.100s: %.100s", tty, strerror(errno));
101 close(*ttyfd); 101 close(*ttyfd);
102 *ttyfd = fd; 102 *ttyfd = fd;
103#else /* _UNICOS */ 103#else /* _UNICOS */
@@ -137,9 +137,9 @@ pty_make_controlling_tty(int *ttyfd, const char *ttyname)
137 vhangup(); 137 vhangup();
138 signal(SIGHUP, old); 138 signal(SIGHUP, old);
139#endif /* USE_VHANGUP */ 139#endif /* USE_VHANGUP */
140 fd = open(ttyname, O_RDWR); 140 fd = open(tty, O_RDWR);
141 if (fd < 0) { 141 if (fd < 0) {
142 error("%.100s: %.100s", ttyname, strerror(errno)); 142 error("%.100s: %.100s", tty, strerror(errno));
143 } else { 143 } else {
144#ifdef USE_VHANGUP 144#ifdef USE_VHANGUP
145 close(*ttyfd); 145 close(*ttyfd);
@@ -174,7 +174,7 @@ pty_change_window_size(int ptyfd, int row, int col,
174} 174}
175 175
176void 176void
177pty_setowner(struct passwd *pw, const char *ttyname) 177pty_setowner(struct passwd *pw, const char *tty)
178{ 178{
179 struct group *grp; 179 struct group *grp;
180 gid_t gid; 180 gid_t gid;
@@ -196,33 +196,33 @@ pty_setowner(struct passwd *pw, const char *ttyname)
196 * Warn but continue if filesystem is read-only and the uids match/ 196 * Warn but continue if filesystem is read-only and the uids match/
197 * tty is owned by root. 197 * tty is owned by root.
198 */ 198 */
199 if (stat(ttyname, &st)) 199 if (stat(tty, &st))
200 fatal("stat(%.100s) failed: %.100s", ttyname, 200 fatal("stat(%.100s) failed: %.100s", tty,
201 strerror(errno)); 201 strerror(errno));
202 202
203 if (st.st_uid != pw->pw_uid || st.st_gid != gid) { 203 if (st.st_uid != pw->pw_uid || st.st_gid != gid) {
204 if (chown(ttyname, pw->pw_uid, gid) < 0) { 204 if (chown(tty, pw->pw_uid, gid) < 0) {
205 if (errno == EROFS && 205 if (errno == EROFS &&
206 (st.st_uid == pw->pw_uid || st.st_uid == 0)) 206 (st.st_uid == pw->pw_uid || st.st_uid == 0))
207 debug("chown(%.100s, %u, %u) failed: %.100s", 207 debug("chown(%.100s, %u, %u) failed: %.100s",
208 ttyname, (u_int)pw->pw_uid, (u_int)gid, 208 tty, (u_int)pw->pw_uid, (u_int)gid,
209 strerror(errno)); 209 strerror(errno));
210 else 210 else
211 fatal("chown(%.100s, %u, %u) failed: %.100s", 211 fatal("chown(%.100s, %u, %u) failed: %.100s",
212 ttyname, (u_int)pw->pw_uid, (u_int)gid, 212 tty, (u_int)pw->pw_uid, (u_int)gid,
213 strerror(errno)); 213 strerror(errno));
214 } 214 }
215 } 215 }
216 216
217 if ((st.st_mode & (S_IRWXU|S_IRWXG|S_IRWXO)) != mode) { 217 if ((st.st_mode & (S_IRWXU|S_IRWXG|S_IRWXO)) != mode) {
218 if (chmod(ttyname, mode) < 0) { 218 if (chmod(tty, mode) < 0) {
219 if (errno == EROFS && 219 if (errno == EROFS &&
220 (st.st_mode & (S_IRGRP | S_IROTH)) == 0) 220 (st.st_mode & (S_IRGRP | S_IROTH)) == 0)
221 debug("chmod(%.100s, 0%o) failed: %.100s", 221 debug("chmod(%.100s, 0%o) failed: %.100s",
222 ttyname, (u_int)mode, strerror(errno)); 222 tty, (u_int)mode, strerror(errno));
223 else 223 else
224 fatal("chmod(%.100s, 0%o) failed: %.100s", 224 fatal("chmod(%.100s, 0%o) failed: %.100s",
225 ttyname, (u_int)mode, strerror(errno)); 225 tty, (u_int)mode, strerror(errno));
226 } 226 }
227 } 227 }
228} 228}