[auth-rsa.c auth2-gss.c auth2-pubkey.c authfile.c canohost.c channels.c
     cipher.c dns.c kex.c monitor.c monitor_fdpass.c monitor_wrap.c
     monitor_wrap.h nchan.c packet.c progressmeter.c scp.c sftp-server.c sftp.c
     ssh-gss.h ssh-keygen.c ssh.c sshconnect.c sshconnect1.c sshlogin.c
     sshpty.c]
     make ssh -Wshadow clean, no functional changes
     markus@ ok

There are also some portable-specific -Wshadow warnings to be fixed in
monitor.c and montior_wrap.c.
This commit is contained in:
Darren Tucker 2004-06-22 12:56:01 +10:00
parent b357afc0a0
commit 3f9fdc7121
27 changed files with 251 additions and 243 deletions

View File

@ -10,6 +10,14 @@
- djm@cvs.openbsd.org 2004/06/20 19:28:12 - djm@cvs.openbsd.org 2004/06/20 19:28:12
[sftp.1] [sftp.1]
mention new -n flag mention new -n flag
- avsm@cvs.openbsd.org 2004/06/21 17:36:31
[auth-rsa.c auth2-gss.c auth2-pubkey.c authfile.c canohost.c channels.c
cipher.c dns.c kex.c monitor.c monitor_fdpass.c monitor_wrap.c
monitor_wrap.h nchan.c packet.c progressmeter.c scp.c sftp-server.c sftp.c
ssh-gss.h ssh-keygen.c ssh.c sshconnect.c sshconnect1.c sshlogin.c
sshpty.c]
make ssh -Wshadow clean, no functional changes
markus@ ok
20040620 20040620
- (tim) [configure.ac Makefile.in] Only change TEST_SHELL on broken platforms. - (tim) [configure.ac Makefile.in] Only change TEST_SHELL on broken platforms.
@ -1332,4 +1340,4 @@
- (djm) Trim deprecated options from INSTALL. Mention UsePAM - (djm) Trim deprecated options from INSTALL. Mention UsePAM
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
$Id: ChangeLog,v 1.3420 2004/06/22 02:31:23 dtucker Exp $ $Id: ChangeLog,v 1.3421 2004/06/22 02:56:01 dtucker Exp $

View File

@ -14,7 +14,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: auth-rsa.c,v 1.59 2004/05/09 01:19:27 djm Exp $"); RCSID("$OpenBSD: auth-rsa.c,v 1.60 2004/06/21 17:36:31 avsm Exp $");
#include <openssl/rsa.h> #include <openssl/rsa.h>
#include <openssl/md5.h> #include <openssl/md5.h>
@ -203,7 +203,7 @@ auth_rsa_key_allowed(struct passwd *pw, BIGNUM *client_n, Key **rkey)
*/ */
while (fgets(line, sizeof(line), f)) { while (fgets(line, sizeof(line), f)) {
char *cp; char *cp;
char *options; char *key_options;
linenum++; linenum++;
@ -221,7 +221,7 @@ auth_rsa_key_allowed(struct passwd *pw, BIGNUM *client_n, Key **rkey)
*/ */
if (*cp < '0' || *cp > '9') { if (*cp < '0' || *cp > '9') {
int quoted = 0; int quoted = 0;
options = cp; key_options = cp;
for (; *cp && (quoted || (*cp != ' ' && *cp != '\t')); cp++) { for (; *cp && (quoted || (*cp != ' ' && *cp != '\t')); cp++) {
if (*cp == '\\' && cp[1] == '"') if (*cp == '\\' && cp[1] == '"')
cp++; /* Skip both */ cp++; /* Skip both */
@ -229,7 +229,7 @@ auth_rsa_key_allowed(struct passwd *pw, BIGNUM *client_n, Key **rkey)
quoted = !quoted; quoted = !quoted;
} }
} else } else
options = NULL; key_options = NULL;
/* Parse the key from the line. */ /* Parse the key from the line. */
if (hostfile_read_key(&cp, &bits, key) == 0) { if (hostfile_read_key(&cp, &bits, key) == 0) {
@ -254,7 +254,7 @@ auth_rsa_key_allowed(struct passwd *pw, BIGNUM *client_n, Key **rkey)
* If our options do not allow this key to be used, * If our options do not allow this key to be used,
* do not send challenge. * do not send challenge.
*/ */
if (!auth_parse_options(pw, options, file, linenum)) if (!auth_parse_options(pw, key_options, file, linenum))
continue; continue;
/* break out, this key is allowed */ /* break out, this key is allowed */

View File

@ -1,4 +1,4 @@
/* $OpenBSD: auth2-gss.c,v 1.7 2003/11/21 11:57:03 djm Exp $ */ /* $OpenBSD: auth2-gss.c,v 1.8 2004/06/21 17:36:31 avsm Exp $ */
/* /*
* Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved.
@ -54,7 +54,7 @@ static void input_gssapi_errtok(int, u_int32_t, void *);
static int static int
userauth_gssapi(Authctxt *authctxt) userauth_gssapi(Authctxt *authctxt)
{ {
gss_OID_desc oid = {0, NULL}; gss_OID_desc goid = {0, NULL};
Gssctxt *ctxt = NULL; Gssctxt *ctxt = NULL;
int mechs; int mechs;
gss_OID_set supported; gss_OID_set supported;
@ -85,9 +85,9 @@ userauth_gssapi(Authctxt *authctxt)
if (len > 2 && if (len > 2 &&
doid[0] == SSH_GSS_OIDTYPE && doid[0] == SSH_GSS_OIDTYPE &&
doid[1] == len - 2) { doid[1] == len - 2) {
oid.elements = doid + 2; goid.elements = doid + 2;
oid.length = len - 2; goid.length = len - 2;
gss_test_oid_set_member(&ms, &oid, supported, gss_test_oid_set_member(&ms, &goid, supported,
&present); &present);
} else { } else {
logit("Badly formed OID received"); logit("Badly formed OID received");
@ -101,7 +101,7 @@ userauth_gssapi(Authctxt *authctxt)
return (0); return (0);
} }
if (GSS_ERROR(PRIVSEP(ssh_gssapi_server_ctx(&ctxt, &oid)))) { if (GSS_ERROR(PRIVSEP(ssh_gssapi_server_ctx(&ctxt, &goid)))) {
xfree(doid); xfree(doid);
return (0); return (0);
} }

View File

@ -23,7 +23,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: auth2-pubkey.c,v 1.6 2004/01/19 21:25:15 markus Exp $"); RCSID("$OpenBSD: auth2-pubkey.c,v 1.7 2004/06/21 17:36:31 avsm Exp $");
#include "ssh2.h" #include "ssh2.h"
#include "xmalloc.h" #include "xmalloc.h"
@ -205,7 +205,7 @@ user_key_allowed2(struct passwd *pw, Key *key, char *file)
found = key_new(key->type); found = key_new(key->type);
while (fgets(line, sizeof(line), f)) { while (fgets(line, sizeof(line), f)) {
char *cp, *options = NULL; char *cp, *key_options = NULL;
linenum++; linenum++;
/* Skip leading whitespace, empty and comment lines. */ /* Skip leading whitespace, empty and comment lines. */
for (cp = line; *cp == ' ' || *cp == '\t'; cp++) for (cp = line; *cp == ' ' || *cp == '\t'; cp++)
@ -217,7 +217,7 @@ user_key_allowed2(struct passwd *pw, Key *key, char *file)
/* no key? check if there are options for this key */ /* no key? check if there are options for this key */
int quoted = 0; int quoted = 0;
debug2("user_key_allowed: check options: '%s'", cp); debug2("user_key_allowed: check options: '%s'", cp);
options = cp; key_options = cp;
for (; *cp && (quoted || (*cp != ' ' && *cp != '\t')); cp++) { for (; *cp && (quoted || (*cp != ' ' && *cp != '\t')); cp++) {
if (*cp == '\\' && cp[1] == '"') if (*cp == '\\' && cp[1] == '"')
cp++; /* Skip both */ cp++; /* Skip both */
@ -234,7 +234,7 @@ user_key_allowed2(struct passwd *pw, Key *key, char *file)
} }
} }
if (key_equal(found, key) && if (key_equal(found, key) &&
auth_parse_options(pw, options, file, linenum) == 1) { auth_parse_options(pw, key_options, file, linenum) == 1) {
found_key = 1; found_key = 1;
debug("matching key found: file %s, line %lu", debug("matching key found: file %s, line %lu",
file, linenum); file, linenum);

View File

@ -36,7 +36,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: authfile.c,v 1.56 2004/05/11 19:01:43 deraadt Exp $"); RCSID("$OpenBSD: authfile.c,v 1.57 2004/06/21 17:36:31 avsm Exp $");
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/evp.h> #include <openssl/evp.h>
@ -72,7 +72,7 @@ key_save_private_rsa1(Key *key, const char *filename, const char *passphrase,
int fd, i, cipher_num; int fd, i, cipher_num;
CipherContext ciphercontext; CipherContext ciphercontext;
Cipher *cipher; Cipher *cipher;
u_int32_t rand; u_int32_t rnd;
/* /*
* If the passphrase is empty, use SSH_CIPHER_NONE to ease converting * 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,
buffer_init(&buffer); buffer_init(&buffer);
/* Put checkbytes for checking passphrase validity. */ /* Put checkbytes for checking passphrase validity. */
rand = arc4random(); rnd = arc4random();
buf[0] = rand & 0xff; buf[0] = rnd & 0xff;
buf[1] = (rand >> 8) & 0xff; buf[1] = (rnd >> 8) & 0xff;
buf[2] = buf[0]; buf[2] = buf[0];
buf[3] = buf[1]; buf[3] = buf[1];
buffer_append(&buffer, buf, 4); buffer_append(&buffer, buf, 4);

View File

@ -12,7 +12,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: canohost.c,v 1.39 2004/03/31 21:58:47 djm Exp $"); RCSID("$OpenBSD: canohost.c,v 1.40 2004/06/21 17:36:31 avsm Exp $");
#include "packet.h" #include "packet.h"
#include "xmalloc.h" #include "xmalloc.h"
@ -28,7 +28,7 @@ static void ipv64_normalise_mapped(struct sockaddr_storage *, socklen_t *);
*/ */
static char * static char *
get_remote_hostname(int socket, int use_dns) get_remote_hostname(int sock, int use_dns)
{ {
struct sockaddr_storage from; struct sockaddr_storage from;
int i; int i;
@ -39,13 +39,13 @@ get_remote_hostname(int socket, int use_dns)
/* Get IP address of client. */ /* Get IP address of client. */
fromlen = sizeof(from); fromlen = sizeof(from);
memset(&from, 0, sizeof(from)); memset(&from, 0, sizeof(from));
if (getpeername(socket, (struct sockaddr *)&from, &fromlen) < 0) { if (getpeername(sock, (struct sockaddr *)&from, &fromlen) < 0) {
debug("getpeername failed: %.100s", strerror(errno)); debug("getpeername failed: %.100s", strerror(errno));
cleanup_exit(255); cleanup_exit(255);
} }
if (from.ss_family == AF_INET) if (from.ss_family == AF_INET)
check_ip_options(socket, ntop); check_ip_options(sock, ntop);
ipv64_normalise_mapped(&from, &fromlen); ipv64_normalise_mapped(&from, &fromlen);
@ -138,7 +138,7 @@ get_remote_hostname(int socket, int use_dns)
*/ */
/* IPv4 only */ /* IPv4 only */
static void static void
check_ip_options(int socket, char *ipaddr) check_ip_options(int sock, char *ipaddr)
{ {
#ifdef IP_OPTIONS #ifdef IP_OPTIONS
u_char options[200]; u_char options[200];
@ -152,7 +152,7 @@ check_ip_options(int socket, char *ipaddr)
else else
ipproto = IPPROTO_IP; ipproto = IPPROTO_IP;
option_size = sizeof(options); option_size = sizeof(options);
if (getsockopt(socket, ipproto, IP_OPTIONS, options, if (getsockopt(sock, ipproto, IP_OPTIONS, options,
&option_size) >= 0 && option_size != 0) { &option_size) >= 0 && option_size != 0) {
text[0] = '\0'; text[0] = '\0';
for (i = 0; i < option_size; i++) for (i = 0; i < option_size; i++)
@ -227,7 +227,7 @@ get_canonical_hostname(int use_dns)
* The returned string must be freed. * The returned string must be freed.
*/ */
static char * static char *
get_socket_address(int socket, int remote, int flags) get_socket_address(int sock, int remote, int flags)
{ {
struct sockaddr_storage addr; struct sockaddr_storage addr;
socklen_t addrlen; socklen_t addrlen;
@ -238,11 +238,11 @@ get_socket_address(int socket, int remote, int flags)
memset(&addr, 0, sizeof(addr)); memset(&addr, 0, sizeof(addr));
if (remote) { if (remote) {
if (getpeername(socket, (struct sockaddr *)&addr, &addrlen) if (getpeername(sock, (struct sockaddr *)&addr, &addrlen)
< 0) < 0)
return NULL; return NULL;
} else { } else {
if (getsockname(socket, (struct sockaddr *)&addr, &addrlen) if (getsockname(sock, (struct sockaddr *)&addr, &addrlen)
< 0) < 0)
return NULL; return NULL;
} }
@ -261,29 +261,29 @@ get_socket_address(int socket, int remote, int flags)
} }
char * char *
get_peer_ipaddr(int socket) get_peer_ipaddr(int sock)
{ {
char *p; char *p;
if ((p = get_socket_address(socket, 1, NI_NUMERICHOST)) != NULL) if ((p = get_socket_address(sock, 1, NI_NUMERICHOST)) != NULL)
return p; return p;
return xstrdup("UNKNOWN"); return xstrdup("UNKNOWN");
} }
char * char *
get_local_ipaddr(int socket) get_local_ipaddr(int sock)
{ {
char *p; char *p;
if ((p = get_socket_address(socket, 0, NI_NUMERICHOST)) != NULL) if ((p = get_socket_address(sock, 0, NI_NUMERICHOST)) != NULL)
return p; return p;
return xstrdup("UNKNOWN"); return xstrdup("UNKNOWN");
} }
char * char *
get_local_name(int socket) get_local_name(int sock)
{ {
return get_socket_address(socket, 0, NI_NAMEREQD); return get_socket_address(sock, 0, NI_NAMEREQD);
} }
/* /*

View File

@ -39,7 +39,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: channels.c,v 1.206 2004/06/18 11:11:54 djm Exp $"); RCSID("$OpenBSD: channels.c,v 1.207 2004/06/21 17:36:31 avsm Exp $");
#include "ssh.h" #include "ssh.h"
#include "ssh1.h" #include "ssh1.h"
@ -2903,7 +2903,7 @@ x11_request_forwarding_with_spoofing(int client_session_id,
char *new_data; char *new_data;
int screen_number; int screen_number;
const char *cp; const char *cp;
u_int32_t rand = 0; u_int32_t rnd = 0;
cp = getenv("DISPLAY"); cp = getenv("DISPLAY");
if (cp) if (cp)
@ -2928,10 +2928,10 @@ x11_request_forwarding_with_spoofing(int client_session_id,
if (sscanf(data + 2 * i, "%2x", &value) != 1) if (sscanf(data + 2 * i, "%2x", &value) != 1)
fatal("x11_request_forwarding: bad authentication data: %.100s", data); fatal("x11_request_forwarding: bad authentication data: %.100s", data);
if (i % 4 == 0) if (i % 4 == 0)
rand = arc4random(); rnd = arc4random();
x11_saved_data[i] = value; x11_saved_data[i] = value;
x11_fake_data[i] = rand & 0xff; x11_fake_data[i] = rnd & 0xff;
rand >>= 8; rnd >>= 8;
} }
x11_saved_data_len = data_len; x11_saved_data_len = data_len;
x11_fake_data_len = data_len; x11_fake_data_len = data_len;

View File

@ -35,7 +35,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: cipher.c,v 1.68 2004/01/23 19:26:33 hshoexer Exp $"); RCSID("$OpenBSD: cipher.c,v 1.69 2004/06/21 17:36:31 avsm Exp $");
#include "xmalloc.h" #include "xmalloc.h"
#include "log.h" #include "log.h"
@ -166,25 +166,25 @@ int
ciphers_valid(const char *names) ciphers_valid(const char *names)
{ {
Cipher *c; Cipher *c;
char *ciphers, *cp; char *cipher_list, *cp;
char *p; char *p;
if (names == NULL || strcmp(names, "") == 0) if (names == NULL || strcmp(names, "") == 0)
return 0; return 0;
ciphers = cp = xstrdup(names); cipher_list = cp = xstrdup(names);
for ((p = strsep(&cp, CIPHER_SEP)); p && *p != '\0'; for ((p = strsep(&cp, CIPHER_SEP)); p && *p != '\0';
(p = strsep(&cp, CIPHER_SEP))) { (p = strsep(&cp, CIPHER_SEP))) {
c = cipher_by_name(p); c = cipher_by_name(p);
if (c == NULL || c->number != SSH_CIPHER_SSH2) { if (c == NULL || c->number != SSH_CIPHER_SSH2) {
debug("bad cipher %s [%s]", p, names); debug("bad cipher %s [%s]", p, names);
xfree(ciphers); xfree(cipher_list);
return 0; return 0;
} else { } else {
debug3("cipher ok: %s [%s]", p, names); debug3("cipher ok: %s [%s]", p, names);
} }
} }
debug3("ciphers ok: [%s]", names); debug3("ciphers ok: [%s]", names);
xfree(ciphers); xfree(cipher_list);
return 1; return 1;
} }
@ -213,7 +213,7 @@ cipher_name(int id)
void void
cipher_init(CipherContext *cc, Cipher *cipher, cipher_init(CipherContext *cc, Cipher *cipher,
const u_char *key, u_int keylen, const u_char *iv, u_int ivlen, const u_char *key, u_int keylen, const u_char *iv, u_int ivlen,
int encrypt) int do_encrypt)
{ {
static int dowarn = 1; static int dowarn = 1;
#ifdef SSH_OLD_EVP #ifdef SSH_OLD_EVP
@ -255,7 +255,7 @@ cipher_init(CipherContext *cc, Cipher *cipher,
(encrypt == CIPHER_ENCRYPT)); (encrypt == CIPHER_ENCRYPT));
#else #else
if (EVP_CipherInit(&cc->evp, type, NULL, (u_char *)iv, if (EVP_CipherInit(&cc->evp, type, NULL, (u_char *)iv,
(encrypt == CIPHER_ENCRYPT)) == 0) (do_encrypt == CIPHER_ENCRYPT)) == 0)
fatal("cipher_init: EVP_CipherInit failed for %s", fatal("cipher_init: EVP_CipherInit failed for %s",
cipher->name); cipher->name);
klen = EVP_CIPHER_CTX_key_length(&cc->evp); klen = EVP_CIPHER_CTX_key_length(&cc->evp);
@ -302,7 +302,7 @@ cipher_cleanup(CipherContext *cc)
void void
cipher_set_key_string(CipherContext *cc, Cipher *cipher, cipher_set_key_string(CipherContext *cc, Cipher *cipher,
const char *passphrase, int encrypt) const char *passphrase, int do_encrypt)
{ {
MD5_CTX md; MD5_CTX md;
u_char digest[16]; u_char digest[16];
@ -311,7 +311,7 @@ cipher_set_key_string(CipherContext *cc, Cipher *cipher,
MD5_Update(&md, (const u_char *)passphrase, strlen(passphrase)); MD5_Update(&md, (const u_char *)passphrase, strlen(passphrase));
MD5_Final(digest, &md); MD5_Final(digest, &md);
cipher_init(cc, cipher, digest, 16, NULL, 0, encrypt); cipher_init(cc, cipher, digest, 16, NULL, 0, do_encrypt);
memset(digest, 0, sizeof(digest)); memset(digest, 0, sizeof(digest));
memset(&md, 0, sizeof(md)); memset(&md, 0, sizeof(md));

8
dns.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: dns.c,v 1.9 2003/11/21 11:57:03 djm Exp $ */ /* $OpenBSD: dns.c,v 1.10 2004/06/21 17:36:31 avsm Exp $ */
/* /*
* Copyright (c) 2003 Wesley Griffin. All rights reserved. * Copyright (c) 2003 Wesley Griffin. All rights reserved.
@ -43,7 +43,7 @@
#include "uuencode.h" #include "uuencode.h"
extern char *__progname; extern char *__progname;
RCSID("$OpenBSD: dns.c,v 1.9 2003/11/21 11:57:03 djm Exp $"); RCSID("$OpenBSD: dns.c,v 1.10 2004/06/21 17:36:31 avsm Exp $");
#ifndef LWRES #ifndef LWRES
static const char *errset_text[] = { static const char *errset_text[] = {
@ -56,9 +56,9 @@ static const char *errset_text[] = {
}; };
static const char * static const char *
dns_result_totext(unsigned int error) dns_result_totext(unsigned int res)
{ {
switch (error) { switch (res) {
case ERRSET_SUCCESS: case ERRSET_SUCCESS:
return errset_text[ERRSET_SUCCESS]; return errset_text[ERRSET_SUCCESS];
case ERRSET_NOMEMORY: case ERRSET_NOMEMORY:

10
kex.c
View File

@ -23,7 +23,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: kex.c,v 1.59 2004/06/13 12:53:24 djm Exp $"); RCSID("$OpenBSD: kex.c,v 1.60 2004/06/21 17:36:31 avsm Exp $");
#include <openssl/crypto.h> #include <openssl/crypto.h>
@ -148,7 +148,7 @@ kex_finish(Kex *kex)
void void
kex_send_kexinit(Kex *kex) kex_send_kexinit(Kex *kex)
{ {
u_int32_t rand = 0; u_int32_t rnd = 0;
u_char *cookie; u_char *cookie;
int i; int i;
@ -168,9 +168,9 @@ kex_send_kexinit(Kex *kex)
cookie = buffer_ptr(&kex->my); cookie = buffer_ptr(&kex->my);
for (i = 0; i < KEX_COOKIE_LEN; i++) { for (i = 0; i < KEX_COOKIE_LEN; i++) {
if (i % 4 == 0) if (i % 4 == 0)
rand = arc4random(); rnd = arc4random();
cookie[i] = rand; cookie[i] = rnd;
rand >>= 8; rnd >>= 8;
} }
packet_start(SSH2_MSG_KEXINIT); packet_start(SSH2_MSG_KEXINIT);
packet_put_raw(buffer_ptr(&kex->my), buffer_len(&kex->my)); packet_put_raw(buffer_ptr(&kex->my), buffer_len(&kex->my));

110
monitor.c
View File

@ -25,7 +25,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: monitor.c,v 1.58 2004/06/13 12:53:24 djm Exp $"); RCSID("$OpenBSD: monitor.c,v 1.59 2004/06/21 17:36:31 avsm Exp $");
#include <openssl/dh.h> #include <openssl/dh.h>
@ -350,9 +350,9 @@ monitor_set_child_handler(pid_t pid)
} }
static void static void
monitor_child_handler(int signal) monitor_child_handler(int sig)
{ {
kill(monitor_child_pid, signal); kill(monitor_child_pid, sig);
} }
void void
@ -467,7 +467,7 @@ monitor_reset_key_state(void)
} }
int int
mm_answer_moduli(int socket, Buffer *m) mm_answer_moduli(int sock, Buffer *m)
{ {
DH *dh; DH *dh;
int min, want, max; int min, want, max;
@ -497,12 +497,12 @@ mm_answer_moduli(int socket, Buffer *m)
DH_free(dh); DH_free(dh);
} }
mm_request_send(socket, MONITOR_ANS_MODULI, m); mm_request_send(sock, MONITOR_ANS_MODULI, m);
return (0); return (0);
} }
int int
mm_answer_sign(int socket, Buffer *m) mm_answer_sign(int sock, Buffer *m)
{ {
Key *key; Key *key;
u_char *p; u_char *p;
@ -538,7 +538,7 @@ mm_answer_sign(int socket, Buffer *m)
xfree(p); xfree(p);
xfree(signature); xfree(signature);
mm_request_send(socket, MONITOR_ANS_SIGN, m); mm_request_send(sock, MONITOR_ANS_SIGN, m);
/* Turn on permissions for getpwnam */ /* Turn on permissions for getpwnam */
monitor_permit(mon_dispatch, MONITOR_REQ_PWNAM, 1); monitor_permit(mon_dispatch, MONITOR_REQ_PWNAM, 1);
@ -549,7 +549,7 @@ mm_answer_sign(int socket, Buffer *m)
/* Retrieves the password entry and also checks if the user is permitted */ /* Retrieves the password entry and also checks if the user is permitted */
int int
mm_answer_pwnamallow(int socket, Buffer *m) mm_answer_pwnamallow(int sock, Buffer *m)
{ {
char *login; char *login;
struct passwd *pwent; struct passwd *pwent;
@ -593,7 +593,7 @@ mm_answer_pwnamallow(int socket, Buffer *m)
out: out:
debug3("%s: sending MONITOR_ANS_PWNAM: %d", __func__, allowed); debug3("%s: sending MONITOR_ANS_PWNAM: %d", __func__, allowed);
mm_request_send(socket, MONITOR_ANS_PWNAM, m); mm_request_send(sock, MONITOR_ANS_PWNAM, m);
/* For SSHv1 allow authentication now */ /* For SSHv1 allow authentication now */
if (!compat20) if (!compat20)
@ -612,14 +612,14 @@ mm_answer_pwnamallow(int socket, Buffer *m)
return (0); return (0);
} }
int mm_answer_auth2_read_banner(int socket, Buffer *m) int mm_answer_auth2_read_banner(int sock, Buffer *m)
{ {
char *banner; char *banner;
buffer_clear(m); buffer_clear(m);
banner = auth2_read_banner(); banner = auth2_read_banner();
buffer_put_cstring(m, banner != NULL ? banner : ""); buffer_put_cstring(m, banner != NULL ? banner : "");
mm_request_send(socket, MONITOR_ANS_AUTH2_READ_BANNER, m); mm_request_send(sock, MONITOR_ANS_AUTH2_READ_BANNER, m);
if (banner != NULL) if (banner != NULL)
xfree(banner); xfree(banner);
@ -628,7 +628,7 @@ int mm_answer_auth2_read_banner(int socket, Buffer *m)
} }
int int
mm_answer_authserv(int socket, Buffer *m) mm_answer_authserv(int sock, Buffer *m)
{ {
monitor_permit_authentications(1); monitor_permit_authentications(1);
@ -646,7 +646,7 @@ mm_answer_authserv(int socket, Buffer *m)
} }
int int
mm_answer_authpassword(int socket, Buffer *m) mm_answer_authpassword(int sock, Buffer *m)
{ {
static int call_count; static int call_count;
char *passwd; char *passwd;
@ -664,7 +664,7 @@ mm_answer_authpassword(int socket, Buffer *m)
buffer_put_int(m, authenticated); buffer_put_int(m, authenticated);
debug3("%s: sending result %d", __func__, authenticated); debug3("%s: sending result %d", __func__, authenticated);
mm_request_send(socket, MONITOR_ANS_AUTHPASSWORD, m); mm_request_send(sock, MONITOR_ANS_AUTHPASSWORD, m);
call_count++; call_count++;
if (plen == 0 && call_count == 1) if (plen == 0 && call_count == 1)
@ -678,7 +678,7 @@ mm_answer_authpassword(int socket, Buffer *m)
#ifdef BSD_AUTH #ifdef BSD_AUTH
int int
mm_answer_bsdauthquery(int socket, Buffer *m) mm_answer_bsdauthquery(int sock, Buffer *m)
{ {
char *name, *infotxt; char *name, *infotxt;
u_int numprompts; u_int numprompts;
@ -695,7 +695,7 @@ mm_answer_bsdauthquery(int socket, Buffer *m)
buffer_put_cstring(m, prompts[0]); buffer_put_cstring(m, prompts[0]);
debug3("%s: sending challenge success: %u", __func__, success); debug3("%s: sending challenge success: %u", __func__, success);
mm_request_send(socket, MONITOR_ANS_BSDAUTHQUERY, m); mm_request_send(sock, MONITOR_ANS_BSDAUTHQUERY, m);
if (success) { if (success) {
xfree(name); xfree(name);
@ -708,7 +708,7 @@ mm_answer_bsdauthquery(int socket, Buffer *m)
} }
int int
mm_answer_bsdauthrespond(int socket, Buffer *m) mm_answer_bsdauthrespond(int sock, Buffer *m)
{ {
char *response; char *response;
int authok; int authok;
@ -727,7 +727,7 @@ mm_answer_bsdauthrespond(int socket, Buffer *m)
buffer_put_int(m, authok); buffer_put_int(m, authok);
debug3("%s: sending authenticated: %d", __func__, authok); debug3("%s: sending authenticated: %d", __func__, authok);
mm_request_send(socket, MONITOR_ANS_BSDAUTHRESPOND, m); mm_request_send(sock, MONITOR_ANS_BSDAUTHRESPOND, m);
auth_method = "bsdauth"; auth_method = "bsdauth";
@ -737,7 +737,7 @@ mm_answer_bsdauthrespond(int socket, Buffer *m)
#ifdef SKEY #ifdef SKEY
int int
mm_answer_skeyquery(int socket, Buffer *m) mm_answer_skeyquery(int sock, Buffer *m)
{ {
struct skey skey; struct skey skey;
char challenge[1024]; char challenge[1024];
@ -752,13 +752,13 @@ mm_answer_skeyquery(int socket, Buffer *m)
buffer_put_cstring(m, challenge); buffer_put_cstring(m, challenge);
debug3("%s: sending challenge success: %u", __func__, success); debug3("%s: sending challenge success: %u", __func__, success);
mm_request_send(socket, MONITOR_ANS_SKEYQUERY, m); mm_request_send(sock, MONITOR_ANS_SKEYQUERY, m);
return (0); return (0);
} }
int int
mm_answer_skeyrespond(int socket, Buffer *m) mm_answer_skeyrespond(int sock, Buffer *m)
{ {
char *response; char *response;
int authok; int authok;
@ -776,7 +776,7 @@ mm_answer_skeyrespond(int socket, Buffer *m)
buffer_put_int(m, authok); buffer_put_int(m, authok);
debug3("%s: sending authenticated: %d", __func__, authok); debug3("%s: sending authenticated: %d", __func__, authok);
mm_request_send(socket, MONITOR_ANS_SKEYRESPOND, m); mm_request_send(sock, MONITOR_ANS_SKEYRESPOND, m);
auth_method = "skey"; auth_method = "skey";
@ -925,7 +925,7 @@ mm_append_debug(Buffer *m)
} }
int int
mm_answer_keyallowed(int socket, Buffer *m) mm_answer_keyallowed(int sock, Buffer *m)
{ {
Key *key; Key *key;
char *cuser, *chost; char *cuser, *chost;
@ -995,7 +995,7 @@ mm_answer_keyallowed(int socket, Buffer *m)
mm_append_debug(m); mm_append_debug(m);
mm_request_send(socket, MONITOR_ANS_KEYALLOWED, m); mm_request_send(sock, MONITOR_ANS_KEYALLOWED, m);
if (type == MM_RSAHOSTKEY) if (type == MM_RSAHOSTKEY)
monitor_permit(mon_dispatch, MONITOR_REQ_RSACHALLENGE, allowed); monitor_permit(mon_dispatch, MONITOR_REQ_RSACHALLENGE, allowed);
@ -1116,7 +1116,7 @@ monitor_valid_hostbasedblob(u_char *data, u_int datalen, char *cuser,
} }
int int
mm_answer_keyverify(int socket, Buffer *m) mm_answer_keyverify(int sock, Buffer *m)
{ {
Key *key; Key *key;
u_char *signature, *data, *blob; u_char *signature, *data, *blob;
@ -1166,7 +1166,7 @@ mm_answer_keyverify(int socket, Buffer *m)
buffer_clear(m); buffer_clear(m);
buffer_put_int(m, verified); buffer_put_int(m, verified);
mm_request_send(socket, MONITOR_ANS_KEYVERIFY, m); mm_request_send(sock, MONITOR_ANS_KEYVERIFY, m);
return (verified); return (verified);
} }
@ -1208,7 +1208,7 @@ mm_session_close(Session *s)
} }
int int
mm_answer_pty(int socket, Buffer *m) mm_answer_pty(int sock, Buffer *m)
{ {
extern struct monitor *pmonitor; extern struct monitor *pmonitor;
Session *s; Session *s;
@ -1230,10 +1230,10 @@ mm_answer_pty(int socket, Buffer *m)
buffer_put_int(m, 1); buffer_put_int(m, 1);
buffer_put_cstring(m, s->tty); buffer_put_cstring(m, s->tty);
mm_request_send(socket, MONITOR_ANS_PTY, m); mm_request_send(sock, MONITOR_ANS_PTY, m);
mm_send_fd(socket, s->ptyfd); mm_send_fd(sock, s->ptyfd);
mm_send_fd(socket, s->ttyfd); mm_send_fd(sock, s->ttyfd);
/* We need to trick ttyslot */ /* We need to trick ttyslot */
if (dup2(s->ttyfd, 0) == -1) if (dup2(s->ttyfd, 0) == -1)
@ -1264,12 +1264,12 @@ mm_answer_pty(int socket, Buffer *m)
if (s != NULL) if (s != NULL)
mm_session_close(s); mm_session_close(s);
buffer_put_int(m, 0); buffer_put_int(m, 0);
mm_request_send(socket, MONITOR_ANS_PTY, m); mm_request_send(sock, MONITOR_ANS_PTY, m);
return (0); return (0);
} }
int int
mm_answer_pty_cleanup(int socket, Buffer *m) mm_answer_pty_cleanup(int sock, Buffer *m)
{ {
Session *s; Session *s;
char *tty; char *tty;
@ -1285,7 +1285,7 @@ mm_answer_pty_cleanup(int socket, Buffer *m)
} }
int int
mm_answer_sesskey(int socket, Buffer *m) mm_answer_sesskey(int sock, Buffer *m)
{ {
BIGNUM *p; BIGNUM *p;
int rsafail; int rsafail;
@ -1306,7 +1306,7 @@ mm_answer_sesskey(int socket, Buffer *m)
BN_clear_free(p); BN_clear_free(p);
mm_request_send(socket, MONITOR_ANS_SESSKEY, m); mm_request_send(sock, MONITOR_ANS_SESSKEY, m);
/* Turn on permissions for sessid passing */ /* Turn on permissions for sessid passing */
monitor_permit(mon_dispatch, MONITOR_REQ_SESSID, 1); monitor_permit(mon_dispatch, MONITOR_REQ_SESSID, 1);
@ -1315,7 +1315,7 @@ mm_answer_sesskey(int socket, Buffer *m)
} }
int int
mm_answer_sessid(int socket, Buffer *m) mm_answer_sessid(int sock, Buffer *m)
{ {
int i; int i;
@ -1333,7 +1333,7 @@ mm_answer_sessid(int socket, Buffer *m)
} }
int int
mm_answer_rsa_keyallowed(int socket, Buffer *m) mm_answer_rsa_keyallowed(int sock, Buffer *m)
{ {
BIGNUM *client_n; BIGNUM *client_n;
Key *key = NULL; Key *key = NULL;
@ -1373,7 +1373,7 @@ mm_answer_rsa_keyallowed(int socket, Buffer *m)
mm_append_debug(m); mm_append_debug(m);
mm_request_send(socket, MONITOR_ANS_RSAKEYALLOWED, m); mm_request_send(sock, MONITOR_ANS_RSAKEYALLOWED, m);
monitor_permit(mon_dispatch, MONITOR_REQ_RSACHALLENGE, allowed); monitor_permit(mon_dispatch, MONITOR_REQ_RSACHALLENGE, allowed);
monitor_permit(mon_dispatch, MONITOR_REQ_RSARESPONSE, 0); monitor_permit(mon_dispatch, MONITOR_REQ_RSARESPONSE, 0);
@ -1381,7 +1381,7 @@ mm_answer_rsa_keyallowed(int socket, Buffer *m)
} }
int int
mm_answer_rsa_challenge(int socket, Buffer *m) mm_answer_rsa_challenge(int sock, Buffer *m)
{ {
Key *key = NULL; Key *key = NULL;
u_char *blob; u_char *blob;
@ -1407,7 +1407,7 @@ mm_answer_rsa_challenge(int socket, Buffer *m)
buffer_put_bignum2(m, ssh1_challenge); buffer_put_bignum2(m, ssh1_challenge);
debug3("%s sending reply", __func__); debug3("%s sending reply", __func__);
mm_request_send(socket, MONITOR_ANS_RSACHALLENGE, m); mm_request_send(sock, MONITOR_ANS_RSACHALLENGE, m);
monitor_permit(mon_dispatch, MONITOR_REQ_RSARESPONSE, 1); monitor_permit(mon_dispatch, MONITOR_REQ_RSARESPONSE, 1);
@ -1417,7 +1417,7 @@ mm_answer_rsa_challenge(int socket, Buffer *m)
} }
int int
mm_answer_rsa_response(int socket, Buffer *m) mm_answer_rsa_response(int sock, Buffer *m)
{ {
Key *key = NULL; Key *key = NULL;
u_char *blob, *response; u_char *blob, *response;
@ -1456,13 +1456,13 @@ mm_answer_rsa_response(int socket, Buffer *m)
buffer_clear(m); buffer_clear(m);
buffer_put_int(m, success); buffer_put_int(m, success);
mm_request_send(socket, MONITOR_ANS_RSARESPONSE, m); mm_request_send(sock, MONITOR_ANS_RSARESPONSE, m);
return (success); return (success);
} }
int int
mm_answer_term(int socket, Buffer *req) mm_answer_term(int sock, Buffer *req)
{ {
extern struct monitor *pmonitor; extern struct monitor *pmonitor;
int res, status; int res, status;
@ -1740,23 +1740,23 @@ monitor_reinit(struct monitor *mon)
#ifdef GSSAPI #ifdef GSSAPI
int int
mm_answer_gss_setup_ctx(int socket, Buffer *m) mm_answer_gss_setup_ctx(int sock, Buffer *m)
{ {
gss_OID_desc oid; gss_OID_desc goid;
OM_uint32 major; OM_uint32 major;
u_int len; u_int len;
oid.elements = buffer_get_string(m, &len); goid.elements = buffer_get_string(m, &len);
oid.length = len; goid.length = len;
major = ssh_gssapi_server_ctx(&gsscontext, &oid); major = ssh_gssapi_server_ctx(&gsscontext, &goid);
xfree(oid.elements); xfree(goid.elements);
buffer_clear(m); buffer_clear(m);
buffer_put_int(m, major); buffer_put_int(m, major);
mm_request_send(socket,MONITOR_ANS_GSSSETUP, m); mm_request_send(sock,MONITOR_ANS_GSSSETUP, m);
/* Now we have a context, enable the step */ /* Now we have a context, enable the step */
monitor_permit(mon_dispatch, MONITOR_REQ_GSSSTEP, 1); monitor_permit(mon_dispatch, MONITOR_REQ_GSSSTEP, 1);
@ -1765,7 +1765,7 @@ mm_answer_gss_setup_ctx(int socket, Buffer *m)
} }
int int
mm_answer_gss_accept_ctx(int socket, Buffer *m) mm_answer_gss_accept_ctx(int sock, Buffer *m)
{ {
gss_buffer_desc in; gss_buffer_desc in;
gss_buffer_desc out = GSS_C_EMPTY_BUFFER; gss_buffer_desc out = GSS_C_EMPTY_BUFFER;
@ -1782,7 +1782,7 @@ mm_answer_gss_accept_ctx(int socket, Buffer *m)
buffer_put_int(m, major); buffer_put_int(m, major);
buffer_put_string(m, out.value, out.length); buffer_put_string(m, out.value, out.length);
buffer_put_int(m, flags); buffer_put_int(m, flags);
mm_request_send(socket, MONITOR_ANS_GSSSTEP, m); mm_request_send(sock, MONITOR_ANS_GSSSTEP, m);
gss_release_buffer(&minor, &out); gss_release_buffer(&minor, &out);
@ -1795,7 +1795,7 @@ mm_answer_gss_accept_ctx(int socket, Buffer *m)
} }
int int
mm_answer_gss_checkmic(int socket, Buffer *m) mm_answer_gss_checkmic(int sock, Buffer *m)
{ {
gss_buffer_desc gssbuf, mic; gss_buffer_desc gssbuf, mic;
OM_uint32 ret; OM_uint32 ret;
@ -1814,7 +1814,7 @@ mm_answer_gss_checkmic(int socket, Buffer *m)
buffer_clear(m); buffer_clear(m);
buffer_put_int(m, ret); buffer_put_int(m, ret);
mm_request_send(socket, MONITOR_ANS_GSSCHECKMIC, m); mm_request_send(sock, MONITOR_ANS_GSSCHECKMIC, m);
if (!GSS_ERROR(ret)) if (!GSS_ERROR(ret))
monitor_permit(mon_dispatch, MONITOR_REQ_GSSUSEROK, 1); monitor_permit(mon_dispatch, MONITOR_REQ_GSSUSEROK, 1);
@ -1823,7 +1823,7 @@ mm_answer_gss_checkmic(int socket, Buffer *m)
} }
int int
mm_answer_gss_userok(int socket, Buffer *m) mm_answer_gss_userok(int sock, Buffer *m)
{ {
int authenticated; int authenticated;
@ -1833,7 +1833,7 @@ mm_answer_gss_userok(int socket, Buffer *m)
buffer_put_int(m, authenticated); buffer_put_int(m, authenticated);
debug3("%s: sending result %d", __func__, authenticated); debug3("%s: sending result %d", __func__, authenticated);
mm_request_send(socket, MONITOR_ANS_GSSUSEROK, m); mm_request_send(sock, MONITOR_ANS_GSSUSEROK, m);
auth_method="gssapi-with-mic"; auth_method="gssapi-with-mic";

View File

@ -24,7 +24,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: monitor_fdpass.c,v 1.4 2002/06/26 14:50:04 deraadt Exp $"); RCSID("$OpenBSD: monitor_fdpass.c,v 1.5 2004/06/21 17:36:31 avsm Exp $");
#include <sys/uio.h> #include <sys/uio.h>
@ -32,7 +32,7 @@ RCSID("$OpenBSD: monitor_fdpass.c,v 1.4 2002/06/26 14:50:04 deraadt Exp $");
#include "monitor_fdpass.h" #include "monitor_fdpass.h"
void void
mm_send_fd(int socket, int fd) mm_send_fd(int sock, int fd)
{ {
#if defined(HAVE_SENDMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) || defined(HAVE_CONTROL_IN_MSGHDR)) #if defined(HAVE_SENDMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) || defined(HAVE_CONTROL_IN_MSGHDR))
struct msghdr msg; struct msghdr msg;
@ -63,7 +63,7 @@ mm_send_fd(int socket, int fd)
msg.msg_iov = &vec; msg.msg_iov = &vec;
msg.msg_iovlen = 1; msg.msg_iovlen = 1;
if ((n = sendmsg(socket, &msg, 0)) == -1) if ((n = sendmsg(sock, &msg, 0)) == -1)
fatal("%s: sendmsg(%d): %s", __func__, fd, fatal("%s: sendmsg(%d): %s", __func__, fd,
strerror(errno)); strerror(errno));
if (n != 1) if (n != 1)
@ -76,7 +76,7 @@ mm_send_fd(int socket, int fd)
} }
int int
mm_receive_fd(int socket) mm_receive_fd(int sock)
{ {
#if defined(HAVE_RECVMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) || defined(HAVE_CONTROL_IN_MSGHDR)) #if defined(HAVE_RECVMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) || defined(HAVE_CONTROL_IN_MSGHDR))
struct msghdr msg; struct msghdr msg;
@ -102,7 +102,7 @@ mm_receive_fd(int socket)
msg.msg_controllen = sizeof(tmp); msg.msg_controllen = sizeof(tmp);
#endif #endif
if ((n = recvmsg(socket, &msg, 0)) == -1) if ((n = recvmsg(sock, &msg, 0)) == -1)
fatal("%s: recvmsg: %s", __func__, strerror(errno)); fatal("%s: recvmsg: %s", __func__, strerror(errno));
if (n != 1) if (n != 1)
fatal("%s: recvmsg: expected received 1 got %ld", fatal("%s: recvmsg: expected received 1 got %ld",

View File

@ -25,7 +25,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: monitor_wrap.c,v 1.35 2003/11/17 11:06:07 markus Exp $"); RCSID("$OpenBSD: monitor_wrap.c,v 1.36 2004/06/21 17:36:31 avsm Exp $");
#include <openssl/bn.h> #include <openssl/bn.h>
#include <openssl/dh.h> #include <openssl/dh.h>
@ -83,7 +83,7 @@ mm_is_monitor(void)
} }
void void
mm_request_send(int socket, enum monitor_reqtype type, Buffer *m) mm_request_send(int sock, enum monitor_reqtype type, Buffer *m)
{ {
u_int mlen = buffer_len(m); u_int mlen = buffer_len(m);
u_char buf[5]; u_char buf[5];
@ -92,14 +92,14 @@ mm_request_send(int socket, enum monitor_reqtype type, Buffer *m)
PUT_32BIT(buf, mlen + 1); PUT_32BIT(buf, mlen + 1);
buf[4] = (u_char) type; /* 1st byte of payload is mesg-type */ buf[4] = (u_char) type; /* 1st byte of payload is mesg-type */
if (atomicio(vwrite, socket, buf, sizeof(buf)) != sizeof(buf)) if (atomicio(vwrite, sock, buf, sizeof(buf)) != sizeof(buf))
fatal("%s: write", __func__); fatal("%s: write", __func__);
if (atomicio(vwrite, socket, buffer_ptr(m), mlen) != mlen) if (atomicio(vwrite, sock, buffer_ptr(m), mlen) != mlen)
fatal("%s: write", __func__); fatal("%s: write", __func__);
} }
void void
mm_request_receive(int socket, Buffer *m) mm_request_receive(int sock, Buffer *m)
{ {
u_char buf[4]; u_char buf[4];
u_int msg_len; u_int msg_len;
@ -107,7 +107,7 @@ mm_request_receive(int socket, Buffer *m)
debug3("%s entering", __func__); debug3("%s entering", __func__);
res = atomicio(read, socket, buf, sizeof(buf)); res = atomicio(read, sock, buf, sizeof(buf));
if (res != sizeof(buf)) { if (res != sizeof(buf)) {
if (res == 0) if (res == 0)
cleanup_exit(255); cleanup_exit(255);
@ -118,19 +118,19 @@ mm_request_receive(int socket, Buffer *m)
fatal("%s: read: bad msg_len %d", __func__, msg_len); fatal("%s: read: bad msg_len %d", __func__, msg_len);
buffer_clear(m); buffer_clear(m);
buffer_append_space(m, msg_len); buffer_append_space(m, msg_len);
res = atomicio(read, socket, buffer_ptr(m), msg_len); res = atomicio(read, sock, buffer_ptr(m), msg_len);
if (res != msg_len) if (res != msg_len)
fatal("%s: read: %ld != msg_len", __func__, (long)res); fatal("%s: read: %ld != msg_len", __func__, (long)res);
} }
void void
mm_request_receive_expect(int socket, enum monitor_reqtype type, Buffer *m) mm_request_receive_expect(int sock, enum monitor_reqtype type, Buffer *m)
{ {
u_char rtype; u_char rtype;
debug3("%s entering: type %d", __func__, type); debug3("%s entering: type %d", __func__, type);
mm_request_receive(socket, m); mm_request_receive(sock, m);
rtype = buffer_get_char(m); rtype = buffer_get_char(m);
if (rtype != type) if (rtype != type)
fatal("%s: read: rtype %d != type %d", __func__, fatal("%s: read: rtype %d != type %d", __func__,
@ -544,7 +544,7 @@ mm_send_kex(Buffer *m, Kex *kex)
} }
void void
mm_send_keystate(struct monitor *pmonitor) mm_send_keystate(struct monitor *monitor)
{ {
Buffer m; Buffer m;
u_char *blob, *p; u_char *blob, *p;
@ -580,7 +580,7 @@ mm_send_keystate(struct monitor *pmonitor)
goto skip; goto skip;
} else { } else {
/* Kex for rekeying */ /* Kex for rekeying */
mm_send_kex(&m, *pmonitor->m_pkex); mm_send_kex(&m, *monitor->m_pkex);
} }
debug3("%s: Sending new keys: %p %p", debug3("%s: Sending new keys: %p %p",
@ -632,7 +632,7 @@ mm_send_keystate(struct monitor *pmonitor)
buffer_put_string(&m, buffer_ptr(&input), buffer_len(&input)); buffer_put_string(&m, buffer_ptr(&input), buffer_len(&input));
buffer_put_string(&m, buffer_ptr(&output), buffer_len(&output)); buffer_put_string(&m, buffer_ptr(&output), buffer_len(&output));
mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_KEYEXPORT, &m); mm_request_send(monitor->m_recvfd, MONITOR_REQ_KEYEXPORT, &m);
debug3("%s: Finished sending state", __func__); debug3("%s: Finished sending state", __func__);
buffer_free(&m); buffer_free(&m);
@ -1093,7 +1093,7 @@ mm_auth_rsa_verify_response(Key *key, BIGNUM *p, u_char response[16])
#ifdef GSSAPI #ifdef GSSAPI
OM_uint32 OM_uint32
mm_ssh_gssapi_server_ctx(Gssctxt **ctx, gss_OID oid) mm_ssh_gssapi_server_ctx(Gssctxt **ctx, gss_OID goid)
{ {
Buffer m; Buffer m;
OM_uint32 major; OM_uint32 major;
@ -1102,7 +1102,7 @@ mm_ssh_gssapi_server_ctx(Gssctxt **ctx, gss_OID oid)
*ctx = NULL; *ctx = NULL;
buffer_init(&m); buffer_init(&m);
buffer_put_string(&m, oid->elements, oid->length); buffer_put_string(&m, goid->elements, goid->length);
mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_GSSSETUP, &m); mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_GSSSETUP, &m);
mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_GSSSETUP, &m); mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_GSSSETUP, &m);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: monitor_wrap.h,v 1.13 2003/11/17 11:06:07 markus Exp $ */ /* $OpenBSD: monitor_wrap.h,v 1.14 2004/06/21 17:36:31 avsm Exp $ */
/* /*
* Copyright 2002 Niels Provos <provos@citi.umich.edu> * Copyright 2002 Niels Provos <provos@citi.umich.edu>
@ -58,9 +58,9 @@ BIGNUM *mm_auth_rsa_generate_challenge(Key *);
#ifdef GSSAPI #ifdef GSSAPI
#include "ssh-gss.h" #include "ssh-gss.h"
OM_uint32 mm_ssh_gssapi_server_ctx(Gssctxt **ctxt, gss_OID oid); OM_uint32 mm_ssh_gssapi_server_ctx(Gssctxt **, gss_OID);
OM_uint32 mm_ssh_gssapi_accept_ctx(Gssctxt *ctxt, OM_uint32 mm_ssh_gssapi_accept_ctx(Gssctxt *,
gss_buffer_desc *recv, gss_buffer_desc *send, OM_uint32 *flags); gss_buffer_desc *, gss_buffer_desc *, OM_uint32 *);
int mm_ssh_gssapi_userok(char *user); int mm_ssh_gssapi_userok(char *user);
OM_uint32 mm_ssh_gssapi_checkmic(Gssctxt *, gss_buffer_t, gss_buffer_t); OM_uint32 mm_ssh_gssapi_checkmic(Gssctxt *, gss_buffer_t, gss_buffer_t);
#endif #endif

View File

@ -23,7 +23,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: nchan.c,v 1.49 2003/08/29 10:04:36 markus Exp $"); RCSID("$OpenBSD: nchan.c,v 1.50 2004/06/21 17:36:31 avsm Exp $");
#include "ssh1.h" #include "ssh1.h"
#include "ssh2.h" #include "ssh2.h"
@ -395,7 +395,7 @@ chan_mark_dead(Channel *c)
} }
int int
chan_is_dead(Channel *c, int send) chan_is_dead(Channel *c, int do_send)
{ {
if (c->type == SSH_CHANNEL_ZOMBIE) { if (c->type == SSH_CHANNEL_ZOMBIE) {
debug2("channel %d: zombie", c->self); debug2("channel %d: zombie", c->self);
@ -416,7 +416,7 @@ chan_is_dead(Channel *c, int send)
return 0; return 0;
} }
if (!(c->flags & CHAN_CLOSE_SENT)) { if (!(c->flags & CHAN_CLOSE_SENT)) {
if (send) { if (do_send) {
chan_send_close2(c); chan_send_close2(c);
} else { } else {
/* channel would be dead if we sent a close */ /* channel would be dead if we sent a close */

View File

@ -37,7 +37,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: packet.c,v 1.114 2004/06/14 01:44:39 djm Exp $"); RCSID("$OpenBSD: packet.c,v 1.115 2004/06/21 17:36:31 avsm Exp $");
#include "openbsd-compat/sys-queue.h" #include "openbsd-compat/sys-queue.h"
@ -507,7 +507,7 @@ packet_send1(void)
u_char buf[8], *cp; u_char buf[8], *cp;
int i, padding, len; int i, padding, len;
u_int checksum; u_int checksum;
u_int32_t rand = 0; u_int32_t rnd = 0;
/* /*
* If using packet compression, compress the payload of the outgoing * If using packet compression, compress the payload of the outgoing
@ -533,9 +533,9 @@ packet_send1(void)
cp = buffer_ptr(&outgoing_packet); cp = buffer_ptr(&outgoing_packet);
for (i = 0; i < padding; i++) { for (i = 0; i < padding; i++) {
if (i % 4 == 0) if (i % 4 == 0)
rand = arc4random(); rnd = arc4random();
cp[7 - i] = rand & 0xff; cp[7 - i] = rnd & 0xff;
rand >>= 8; rnd >>= 8;
} }
} }
buffer_consume(&outgoing_packet, 8 - padding); buffer_consume(&outgoing_packet, 8 - padding);
@ -580,18 +580,18 @@ set_newkeys(int mode)
Comp *comp; Comp *comp;
CipherContext *cc; CipherContext *cc;
u_int64_t *max_blocks; u_int64_t *max_blocks;
int encrypt; int crypt_type;
debug2("set_newkeys: mode %d", mode); debug2("set_newkeys: mode %d", mode);
if (mode == MODE_OUT) { if (mode == MODE_OUT) {
cc = &send_context; cc = &send_context;
encrypt = CIPHER_ENCRYPT; crypt_type = CIPHER_ENCRYPT;
p_send.packets = p_send.blocks = 0; p_send.packets = p_send.blocks = 0;
max_blocks = &max_blocks_out; max_blocks = &max_blocks_out;
} else { } else {
cc = &receive_context; cc = &receive_context;
encrypt = CIPHER_DECRYPT; crypt_type = CIPHER_DECRYPT;
p_read.packets = p_read.blocks = 0; p_read.packets = p_read.blocks = 0;
max_blocks = &max_blocks_in; max_blocks = &max_blocks_in;
} }
@ -620,7 +620,7 @@ set_newkeys(int mode)
mac->enabled = 1; mac->enabled = 1;
DBG(debug("cipher_init_context: %d", mode)); DBG(debug("cipher_init_context: %d", mode));
cipher_init(cc, enc->cipher, enc->key, enc->key_len, cipher_init(cc, enc->cipher, enc->key, enc->key_len,
enc->iv, enc->block_size, encrypt); enc->iv, enc->block_size, crypt_type);
/* Deleting the keys does not gain extra security */ /* Deleting the keys does not gain extra security */
/* memset(enc->iv, 0, enc->block_size); /* memset(enc->iv, 0, enc->block_size);
memset(enc->key, 0, enc->key_len); */ memset(enc->key, 0, enc->key_len); */
@ -654,7 +654,7 @@ packet_send2_wrapped(void)
u_char padlen, pad; u_char padlen, pad;
u_int packet_length = 0; u_int packet_length = 0;
u_int i, len; u_int i, len;
u_int32_t rand = 0; u_int32_t rnd = 0;
Enc *enc = NULL; Enc *enc = NULL;
Mac *mac = NULL; Mac *mac = NULL;
Comp *comp = NULL; Comp *comp = NULL;
@ -713,9 +713,9 @@ packet_send2_wrapped(void)
/* random padding */ /* random padding */
for (i = 0; i < padlen; i++) { for (i = 0; i < padlen; i++) {
if (i % 4 == 0) if (i % 4 == 0)
rand = arc4random(); rnd = arc4random();
cp[i] = rand & 0xff; cp[i] = rnd & 0xff;
rand >>= 8; rnd >>= 8;
} }
} else { } else {
/* clear padding */ /* clear padding */
@ -1489,16 +1489,16 @@ packet_add_padding(u_char pad)
void void
packet_send_ignore(int nbytes) packet_send_ignore(int nbytes)
{ {
u_int32_t rand = 0; u_int32_t rnd = 0;
int i; int i;
packet_start(compat20 ? SSH2_MSG_IGNORE : SSH_MSG_IGNORE); packet_start(compat20 ? SSH2_MSG_IGNORE : SSH_MSG_IGNORE);
packet_put_int(nbytes); packet_put_int(nbytes);
for (i = 0; i < nbytes; i++) { for (i = 0; i < nbytes; i++) {
if (i % 4 == 0) if (i % 4 == 0)
rand = arc4random(); rnd = arc4random();
packet_put_char(rand & 0xff); packet_put_char(rnd & 0xff);
rand >>= 8; rnd >>= 8;
} }
} }

View File

@ -23,7 +23,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: progressmeter.c,v 1.20 2004/05/11 19:01:43 deraadt Exp $"); RCSID("$OpenBSD: progressmeter.c,v 1.21 2004/06/21 17:36:31 avsm Exp $");
#include "progressmeter.h" #include "progressmeter.h"
#include "atomicio.h" #include "atomicio.h"
@ -224,7 +224,7 @@ update_progress_meter(int ignore)
} }
void void
start_progress_meter(char *f, off_t filesize, off_t *stat) start_progress_meter(char *f, off_t filesize, off_t *ctr)
{ {
struct winsize winsize; struct winsize winsize;
@ -232,7 +232,7 @@ start_progress_meter(char *f, off_t filesize, off_t *stat)
file = f; file = f;
end_pos = filesize; end_pos = filesize;
cur_pos = 0; cur_pos = 0;
counter = stat; counter = ctr;
stalled = 0; stalled = 0;
bytes_per_second = 0; bytes_per_second = 0;

10
scp.c
View File

@ -71,7 +71,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: scp.c,v 1.114 2004/04/01 12:19:57 markus Exp $"); RCSID("$OpenBSD: scp.c,v 1.115 2004/06/21 17:36:31 avsm Exp $");
#include "xmalloc.h" #include "xmalloc.h"
#include "atomicio.h" #include "atomicio.h"
@ -663,7 +663,7 @@ bwlimit(int amount)
{ {
static struct timeval bwstart, bwend; static struct timeval bwstart, bwend;
static int lamt, thresh = 16384; static int lamt, thresh = 16384;
u_int64_t wait; u_int64_t waitlen;
struct timespec ts, rm; struct timespec ts, rm;
if (!timerisset(&bwstart)) { if (!timerisset(&bwstart)) {
@ -681,10 +681,10 @@ bwlimit(int amount)
return; return;
lamt *= 8; lamt *= 8;
wait = (double)1000000L * lamt / limit_rate; waitlen = (double)1000000L * lamt / limit_rate;
bwstart.tv_sec = wait / 1000000L; bwstart.tv_sec = waitlen / 1000000L;
bwstart.tv_usec = wait % 1000000L; bwstart.tv_usec = waitlen % 1000000L;
if (timercmp(&bwstart, &bwend, >)) { if (timercmp(&bwstart, &bwend, >)) {
timersub(&bwstart, &bwend, &bwend); timersub(&bwstart, &bwend, &bwend);

View File

@ -14,7 +14,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: sftp-server.c,v 1.45 2004/02/19 21:15:04 markus Exp $"); RCSID("$OpenBSD: sftp-server.c,v 1.46 2004/06/21 17:36:31 avsm Exp $");
#include "buffer.h" #include "buffer.h"
#include "bufaux.h" #include "bufaux.h"
@ -260,7 +260,7 @@ send_msg(Buffer *m)
} }
static void static void
send_status(u_int32_t id, u_int32_t error) send_status(u_int32_t id, u_int32_t status)
{ {
Buffer msg; Buffer msg;
const char *status_messages[] = { const char *status_messages[] = {
@ -276,14 +276,14 @@ send_status(u_int32_t id, u_int32_t error)
"Unknown error" /* Others */ "Unknown error" /* Others */
}; };
TRACE("sent status id %u error %u", id, error); TRACE("sent status id %u error %u", id, status);
buffer_init(&msg); buffer_init(&msg);
buffer_put_char(&msg, SSH2_FXP_STATUS); buffer_put_char(&msg, SSH2_FXP_STATUS);
buffer_put_int(&msg, id); buffer_put_int(&msg, id);
buffer_put_int(&msg, error); buffer_put_int(&msg, status);
if (version >= 3) { if (version >= 3) {
buffer_put_cstring(&msg, buffer_put_cstring(&msg,
status_messages[MIN(error,SSH2_FX_MAX)]); status_messages[MIN(status,SSH2_FX_MAX)]);
buffer_put_cstring(&msg, ""); buffer_put_cstring(&msg, "");
} }
send_msg(&msg); send_msg(&msg);
@ -863,20 +863,20 @@ process_readlink(void)
{ {
u_int32_t id; u_int32_t id;
int len; int len;
char link[MAXPATHLEN]; char buf[MAXPATHLEN];
char *path; char *path;
id = get_int(); id = get_int();
path = get_string(NULL); path = get_string(NULL);
TRACE("readlink id %u path %s", id, path); TRACE("readlink id %u path %s", id, path);
if ((len = readlink(path, link, sizeof(link) - 1)) == -1) if ((len = readlink(path, buf, sizeof(buf) - 1)) == -1)
send_status(id, errno_to_portable(errno)); send_status(id, errno_to_portable(errno));
else { else {
Stat s; Stat s;
link[len] = '\0'; buf[len] = '\0';
attrib_clear(&s.attrib); attrib_clear(&s.attrib);
s.name = s.long_name = link; s.name = s.long_name = buf;
send_names(id, 1, &s); send_names(id, 1, &s);
} }
xfree(path); xfree(path);

8
sftp.c
View File

@ -16,7 +16,7 @@
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: sftp.c,v 1.50 2004/06/20 18:53:39 djm Exp $"); RCSID("$OpenBSD: sftp.c,v 1.51 2004/06/21 17:36:31 avsm Exp $");
#include "buffer.h" #include "buffer.h"
#include "xmalloc.h" #include "xmalloc.h"
@ -277,13 +277,13 @@ path_append(char *p1, char *p2)
static char * static char *
make_absolute(char *p, char *pwd) make_absolute(char *p, char *pwd)
{ {
char *abs; char *abs_str;
/* Derelativise */ /* Derelativise */
if (p && p[0] != '/') { if (p && p[0] != '/') {
abs = path_append(pwd, p); abs_str = path_append(pwd, p);
xfree(p); xfree(p);
return(abs); return(abs_str);
} else } else
return(p); return(p);
} }

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ssh-gss.h,v 1.4 2003/11/17 11:06:07 markus Exp $ */ /* $OpenBSD: ssh-gss.h,v 1.5 2004/06/21 17:36:31 avsm Exp $ */
/* /*
* Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved.
* *
@ -100,31 +100,31 @@ typedef struct {
extern ssh_gssapi_mech *supported_mechs[]; extern ssh_gssapi_mech *supported_mechs[];
int ssh_gssapi_check_oid(Gssctxt *ctx, void *data, size_t len); int ssh_gssapi_check_oid(Gssctxt *, void *, size_t);
void ssh_gssapi_set_oid_data(Gssctxt *ctx, void *data, size_t len); void ssh_gssapi_set_oid_data(Gssctxt *, void *, size_t);
void ssh_gssapi_set_oid(Gssctxt *ctx, gss_OID oid); void ssh_gssapi_set_oid(Gssctxt *, gss_OID);
void ssh_gssapi_supported_oids(gss_OID_set *oidset); void ssh_gssapi_supported_oids(gss_OID_set *);
ssh_gssapi_mech *ssh_gssapi_get_ctype(Gssctxt *ctxt); ssh_gssapi_mech *ssh_gssapi_get_ctype(Gssctxt *);
OM_uint32 ssh_gssapi_import_name(Gssctxt *ctx, const char *host); OM_uint32 ssh_gssapi_import_name(Gssctxt *, const char *);
OM_uint32 ssh_gssapi_acquire_cred(Gssctxt *ctx); OM_uint32 ssh_gssapi_acquire_cred(Gssctxt *);
OM_uint32 ssh_gssapi_init_ctx(Gssctxt *ctx, int deleg_creds, OM_uint32 ssh_gssapi_init_ctx(Gssctxt *, int,
gss_buffer_desc *recv_tok, gss_buffer_desc *send_tok, OM_uint32 *flags); gss_buffer_desc *, gss_buffer_desc *, OM_uint32 *);
OM_uint32 ssh_gssapi_accept_ctx(Gssctxt *ctx, OM_uint32 ssh_gssapi_accept_ctx(Gssctxt *,
gss_buffer_desc *recv_tok, gss_buffer_desc *send_tok, OM_uint32 *flags); gss_buffer_desc *, gss_buffer_desc *, OM_uint32 *);
OM_uint32 ssh_gssapi_getclient(Gssctxt *ctx, ssh_gssapi_client *); OM_uint32 ssh_gssapi_getclient(Gssctxt *, ssh_gssapi_client *);
void ssh_gssapi_error(Gssctxt *ctx); void ssh_gssapi_error(Gssctxt *);
char *ssh_gssapi_last_error(Gssctxt *ctxt, OM_uint32 *maj, OM_uint32 *min); char *ssh_gssapi_last_error(Gssctxt *, OM_uint32 *, OM_uint32 *);
void ssh_gssapi_build_ctx(Gssctxt **ctx); void ssh_gssapi_build_ctx(Gssctxt **);
void ssh_gssapi_delete_ctx(Gssctxt **ctx); void ssh_gssapi_delete_ctx(Gssctxt **);
OM_uint32 ssh_gssapi_sign(Gssctxt *, gss_buffer_t, gss_buffer_t); OM_uint32 ssh_gssapi_sign(Gssctxt *, gss_buffer_t, gss_buffer_t);
OM_uint32 ssh_gssapi_server_ctx(Gssctxt **ctx, gss_OID oid); OM_uint32 ssh_gssapi_server_ctx(Gssctxt **, gss_OID);
void ssh_gssapi_buildmic(Buffer *, const char *, const char *, const char *); void ssh_gssapi_buildmic(Buffer *, const char *, const char *, const char *);
/* In the server */ /* In the server */
int ssh_gssapi_userok(char *name); int ssh_gssapi_userok(char *name);
OM_uint32 ssh_gssapi_checkmic(Gssctxt *, gss_buffer_t, gss_buffer_t); OM_uint32 ssh_gssapi_checkmic(Gssctxt *, gss_buffer_t, gss_buffer_t);
void ssh_gssapi_do_child(char ***envp, u_int *envsizep); void ssh_gssapi_do_child(char ***, u_int *);
void ssh_gssapi_cleanup_creds(void); void ssh_gssapi_cleanup_creds(void);
void ssh_gssapi_storecreds(void); void ssh_gssapi_storecreds(void);

View File

@ -12,7 +12,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: ssh-keygen.c,v 1.115 2004/05/09 00:06:47 djm Exp $"); RCSID("$OpenBSD: ssh-keygen.c,v 1.116 2004/06/21 17:36:31 avsm Exp $");
#include <openssl/evp.h> #include <openssl/evp.h>
#include <openssl/pem.h> #include <openssl/pem.h>
@ -192,8 +192,8 @@ do_convert_to_ssh2(struct passwd *pw)
static void static void
buffer_get_bignum_bits(Buffer *b, BIGNUM *value) buffer_get_bignum_bits(Buffer *b, BIGNUM *value)
{ {
u_int bits = buffer_get_int(b); u_int bignum_bits = buffer_get_int(b);
u_int bytes = (bits + 7) / 8; u_int bytes = (bignum_bits + 7) / 8;
if (buffer_len(b) < bytes) if (buffer_len(b) < bytes)
fatal("buffer_get_bignum_bits: input buffer too small: " fatal("buffer_get_bignum_bits: input buffer too small: "
@ -630,7 +630,7 @@ do_change_passphrase(struct passwd *pw)
* Print the SSHFP RR. * Print the SSHFP RR.
*/ */
static void static void
do_print_resource_record(struct passwd *pw, char *hostname) do_print_resource_record(struct passwd *pw, char *hname)
{ {
Key *public; Key *public;
char *comment = NULL; char *comment = NULL;
@ -644,7 +644,7 @@ do_print_resource_record(struct passwd *pw, char *hostname)
} }
public = key_load_public(identity_file, &comment); public = key_load_public(identity_file, &comment);
if (public != NULL) { if (public != NULL) {
export_dns_rr(hostname, public, stdout, print_generic); export_dns_rr(hname, public, stdout, print_generic);
key_free(public); key_free(public);
xfree(comment); xfree(comment);
exit(0); exit(0);

10
ssh.c
View File

@ -40,7 +40,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: ssh.c,v 1.220 2004/06/20 17:36:59 djm Exp $"); RCSID("$OpenBSD: ssh.c,v 1.221 2004/06/21 17:36:31 avsm Exp $");
#include <openssl/evp.h> #include <openssl/evp.h>
#include <openssl/err.h> #include <openssl/err.h>
@ -807,17 +807,17 @@ x11_get_proto(char **_proto, char **_data)
* for the local connection. * for the local connection.
*/ */
if (!got_data) { if (!got_data) {
u_int32_t rand = 0; u_int32_t rnd = 0;
logit("Warning: No xauth data; " logit("Warning: No xauth data; "
"using fake authentication data for X11 forwarding."); "using fake authentication data for X11 forwarding.");
strlcpy(proto, SSH_X11_PROTO, sizeof proto); strlcpy(proto, SSH_X11_PROTO, sizeof proto);
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
if (i % 4 == 0) if (i % 4 == 0)
rand = arc4random(); rnd = arc4random();
snprintf(data + 2 * i, sizeof data - 2 * i, "%02x", snprintf(data + 2 * i, sizeof data - 2 * i, "%02x",
rand & 0xff); rnd & 0xff);
rand >>= 8; rnd >>= 8;
} }
} }
} }

View File

@ -13,7 +13,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: sshconnect.c,v 1.157 2004/05/08 00:21:31 djm Exp $"); RCSID("$OpenBSD: sshconnect.c,v 1.158 2004/06/21 17:36:31 avsm Exp $");
#include <openssl/bn.h> #include <openssl/bn.h>
@ -767,19 +767,19 @@ check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key,
break; break;
case HOST_CHANGED: case HOST_CHANGED:
if (options.check_host_ip && host_ip_differ) { if (options.check_host_ip && host_ip_differ) {
char *msg; char *key_msg;
if (ip_status == HOST_NEW) if (ip_status == HOST_NEW)
msg = "is unknown"; key_msg = "is unknown";
else if (ip_status == HOST_OK) else if (ip_status == HOST_OK)
msg = "is unchanged"; key_msg = "is unchanged";
else else
msg = "has a different value"; key_msg = "has a different value";
error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
error("@ WARNING: POSSIBLE DNS SPOOFING DETECTED! @"); error("@ WARNING: POSSIBLE DNS SPOOFING DETECTED! @");
error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
error("The %s host key for %s has changed,", type, host); error("The %s host key for %s has changed,", type, host);
error("and the key for the according IP address %s", ip); error("and the key for the according IP address %s", ip);
error("%s. This could either mean that", msg); error("%s. This could either mean that", key_msg);
error("DNS SPOOFING is happening or the IP address for the host"); error("DNS SPOOFING is happening or the IP address for the host");
error("and its host key have changed at the same time."); error("and its host key have changed at the same time.");
if (ip_status != HOST_NEW) if (ip_status != HOST_NEW)

View File

@ -13,7 +13,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: sshconnect1.c,v 1.58 2004/05/09 01:19:28 djm Exp $"); RCSID("$OpenBSD: sshconnect1.c,v 1.59 2004/06/21 17:36:31 avsm Exp $");
#include <openssl/bn.h> #include <openssl/bn.h>
#include <openssl/md5.h> #include <openssl/md5.h>
@ -476,7 +476,7 @@ ssh_kex(char *host, struct sockaddr *hostaddr)
u_char cookie[8]; u_char cookie[8];
u_int supported_ciphers; u_int supported_ciphers;
u_int server_flags, client_flags; u_int server_flags, client_flags;
u_int32_t rand = 0; u_int32_t rnd = 0;
debug("Waiting for server public key."); debug("Waiting for server public key.");
@ -540,9 +540,9 @@ ssh_kex(char *host, struct sockaddr *hostaddr)
*/ */
for (i = 0; i < 32; i++) { for (i = 0; i < 32; i++) {
if (i % 4 == 0) if (i % 4 == 0)
rand = arc4random(); rnd = arc4random();
session_key[i] = rand & 0xff; session_key[i] = rnd & 0xff;
rand >>= 8; rnd >>= 8;
} }
/* /*

View File

@ -39,7 +39,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: sshlogin.c,v 1.7 2003/06/12 07:57:38 markus Exp $"); RCSID("$OpenBSD: sshlogin.c,v 1.8 2004/06/21 17:36:31 avsm Exp $");
#include "loginrec.h" #include "loginrec.h"
@ -64,12 +64,12 @@ get_last_login_time(uid_t uid, const char *logname,
* systems were more standardized. * systems were more standardized.
*/ */
void void
record_login(pid_t pid, const char *ttyname, const char *user, uid_t uid, record_login(pid_t pid, const char *tty, const char *user, uid_t uid,
const char *host, struct sockaddr * addr, socklen_t addrlen) const char *host, struct sockaddr * addr, socklen_t addrlen)
{ {
struct logininfo *li; struct logininfo *li;
li = login_alloc_entry(pid, user, host, ttyname); li = login_alloc_entry(pid, user, host, tty);
login_set_addr(li, addr, addrlen); login_set_addr(li, addr, addrlen);
login_login(li); login_login(li);
login_free_entry(li); login_free_entry(li);
@ -91,11 +91,11 @@ record_utmp_only(pid_t pid, const char *ttyname, const char *user,
/* Records that the user has logged out. */ /* Records that the user has logged out. */
void void
record_logout(pid_t pid, const char *ttyname, const char *user) record_logout(pid_t pid, const char *tty, const char *user)
{ {
struct logininfo *li; struct logininfo *li;
li = login_alloc_entry(pid, user, NULL, ttyname); li = login_alloc_entry(pid, user, NULL, tty);
login_logout(li); login_logout(li);
login_free_entry(li); login_free_entry(li);
} }

View File

@ -12,7 +12,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: sshpty.c,v 1.11 2004/01/11 21:55:06 deraadt Exp $"); RCSID("$OpenBSD: sshpty.c,v 1.12 2004/06/21 17:36:31 avsm Exp $");
#ifdef HAVE_UTIL_H #ifdef HAVE_UTIL_H
# include <util.h> # include <util.h>
@ -60,18 +60,18 @@ pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen)
/* Releases the tty. Its ownership is returned to root, and permissions to 0666. */ /* Releases the tty. Its ownership is returned to root, and permissions to 0666. */
void void
pty_release(const char *ttyname) pty_release(const char *tty)
{ {
if (chown(ttyname, (uid_t) 0, (gid_t) 0) < 0) if (chown(tty, (uid_t) 0, (gid_t) 0) < 0)
error("chown %.100s 0 0 failed: %.100s", ttyname, strerror(errno)); error("chown %.100s 0 0 failed: %.100s", tty, strerror(errno));
if (chmod(ttyname, (mode_t) 0666) < 0) if (chmod(tty, (mode_t) 0666) < 0)
error("chmod %.100s 0666 failed: %.100s", ttyname, strerror(errno)); error("chmod %.100s 0666 failed: %.100s", tty, strerror(errno));
} }
/* Makes the tty the process's controlling tty and sets it to sane modes. */ /* Makes the tty the process's controlling tty and sets it to sane modes. */
void void
pty_make_controlling_tty(int *ttyfd, const char *ttyname) pty_make_controlling_tty(int *ttyfd, const char *tty)
{ {
int fd; int fd;
#ifdef USE_VHANGUP #ifdef USE_VHANGUP
@ -82,7 +82,7 @@ pty_make_controlling_tty(int *ttyfd, const char *ttyname)
if (setsid() < 0) if (setsid() < 0)
error("setsid: %.100s", strerror(errno)); error("setsid: %.100s", strerror(errno));
fd = open(ttyname, O_RDWR|O_NOCTTY); fd = open(tty, O_RDWR|O_NOCTTY);
if (fd != -1) { if (fd != -1) {
signal(SIGHUP, SIG_IGN); signal(SIGHUP, SIG_IGN);
ioctl(fd, TCVHUP, (char *)NULL); ioctl(fd, TCVHUP, (char *)NULL);
@ -97,7 +97,7 @@ pty_make_controlling_tty(int *ttyfd, const char *ttyname)
ioctl(*ttyfd, TCSETCTTY, NULL); ioctl(*ttyfd, TCSETCTTY, NULL);
fd = open("/dev/tty", O_RDWR); fd = open("/dev/tty", O_RDWR);
if (fd < 0) if (fd < 0)
error("%.100s: %.100s", ttyname, strerror(errno)); error("%.100s: %.100s", tty, strerror(errno));
close(*ttyfd); close(*ttyfd);
*ttyfd = fd; *ttyfd = fd;
#else /* _UNICOS */ #else /* _UNICOS */
@ -137,9 +137,9 @@ pty_make_controlling_tty(int *ttyfd, const char *ttyname)
vhangup(); vhangup();
signal(SIGHUP, old); signal(SIGHUP, old);
#endif /* USE_VHANGUP */ #endif /* USE_VHANGUP */
fd = open(ttyname, O_RDWR); fd = open(tty, O_RDWR);
if (fd < 0) { if (fd < 0) {
error("%.100s: %.100s", ttyname, strerror(errno)); error("%.100s: %.100s", tty, strerror(errno));
} else { } else {
#ifdef USE_VHANGUP #ifdef USE_VHANGUP
close(*ttyfd); close(*ttyfd);
@ -174,7 +174,7 @@ pty_change_window_size(int ptyfd, int row, int col,
} }
void void
pty_setowner(struct passwd *pw, const char *ttyname) pty_setowner(struct passwd *pw, const char *tty)
{ {
struct group *grp; struct group *grp;
gid_t gid; gid_t gid;
@ -196,33 +196,33 @@ pty_setowner(struct passwd *pw, const char *ttyname)
* Warn but continue if filesystem is read-only and the uids match/ * Warn but continue if filesystem is read-only and the uids match/
* tty is owned by root. * tty is owned by root.
*/ */
if (stat(ttyname, &st)) if (stat(tty, &st))
fatal("stat(%.100s) failed: %.100s", ttyname, fatal("stat(%.100s) failed: %.100s", tty,
strerror(errno)); strerror(errno));
if (st.st_uid != pw->pw_uid || st.st_gid != gid) { if (st.st_uid != pw->pw_uid || st.st_gid != gid) {
if (chown(ttyname, pw->pw_uid, gid) < 0) { if (chown(tty, pw->pw_uid, gid) < 0) {
if (errno == EROFS && if (errno == EROFS &&
(st.st_uid == pw->pw_uid || st.st_uid == 0)) (st.st_uid == pw->pw_uid || st.st_uid == 0))
debug("chown(%.100s, %u, %u) failed: %.100s", debug("chown(%.100s, %u, %u) failed: %.100s",
ttyname, (u_int)pw->pw_uid, (u_int)gid, tty, (u_int)pw->pw_uid, (u_int)gid,
strerror(errno)); strerror(errno));
else else
fatal("chown(%.100s, %u, %u) failed: %.100s", fatal("chown(%.100s, %u, %u) failed: %.100s",
ttyname, (u_int)pw->pw_uid, (u_int)gid, tty, (u_int)pw->pw_uid, (u_int)gid,
strerror(errno)); strerror(errno));
} }
} }
if ((st.st_mode & (S_IRWXU|S_IRWXG|S_IRWXO)) != mode) { if ((st.st_mode & (S_IRWXU|S_IRWXG|S_IRWXO)) != mode) {
if (chmod(ttyname, mode) < 0) { if (chmod(tty, mode) < 0) {
if (errno == EROFS && if (errno == EROFS &&
(st.st_mode & (S_IRGRP | S_IROTH)) == 0) (st.st_mode & (S_IRGRP | S_IROTH)) == 0)
debug("chmod(%.100s, 0%o) failed: %.100s", debug("chmod(%.100s, 0%o) failed: %.100s",
ttyname, (u_int)mode, strerror(errno)); tty, (u_int)mode, strerror(errno));
else else
fatal("chmod(%.100s, 0%o) failed: %.100s", fatal("chmod(%.100s, 0%o) failed: %.100s",
ttyname, (u_int)mode, strerror(errno)); tty, (u_int)mode, strerror(errno));
} }
} }
} }