*/
#include "includes.h"
-RCSID("$Id: atomicio.c,v 1.2 2000/02/01 22:32:53 d Exp $");
+RCSID("$Id: atomicio.c,v 1.3 2000/03/16 20:56:13 markus Exp $");
#include "xmalloc.h"
#include "ssh.h"
* ensure all of data on socket comes through. f==read || f==write
*/
ssize_t
-atomicio(f, fd, s, n)
+atomicio(f, fd, _s, n)
ssize_t (*f) ();
int fd;
- void *s;
+ void *_s;
size_t n;
{
+ char *s = _s;
ssize_t res, pos = 0;
while (n > pos) {
KTEXT_ST reply;
char instance[INST_SZ];
int r, s;
+ socklen_t slen;
u_int cksum;
Key_schedule schedule;
struct sockaddr_in local, foreign;
s = packet_get_connection_in();
- r = sizeof(local);
+ slen = sizeof(local);
memset(&local, 0, sizeof(local));
- if (getsockname(s, (struct sockaddr *) & local, &r) < 0)
+ if (getsockname(s, (struct sockaddr *) & local, &slen) < 0)
debug("getsockname failed: %.100s", strerror(errno));
- r = sizeof(foreign);
+ slen = sizeof(foreign);
memset(&foreign, 0, sizeof(foreign));
- if (getpeername(s, (struct sockaddr *) & foreign, &r) < 0) {
+ if (getpeername(s, (struct sockaddr *) & foreign, &slen) < 0) {
debug("getpeername failed: %.100s", strerror(errno));
fatal_cleanup();
}
*/
#include "includes.h"
-RCSID("$Id: bufaux.c,v 1.7 1999/11/24 19:53:44 markus Exp $");
+RCSID("$Id: bufaux.c,v 1.8 2000/03/16 20:56:14 markus Exp $");
#include "ssh.h"
#include <ssl/bn.h>
{
int bits = BN_num_bits(value);
int bin_size = (bits + 7) / 8;
- char *buf = xmalloc(bin_size);
+ char unsigned *buf = xmalloc(bin_size);
int oi;
char msg[2];
PUT_16BIT(msg, bits);
buffer_append(buffer, msg, 2);
/* Store the binary data. */
- buffer_append(buffer, buf, oi);
+ buffer_append(buffer, (char *)buf, oi);
memset(buf, 0, bin_size);
xfree(buf);
bytes = (bits + 7) / 8;
if (buffer_len(buffer) < bytes)
fatal("buffer_get_bignum: input buffer too small");
- bin = buffer_ptr(buffer);
+ bin = (unsigned char*) buffer_ptr(buffer);
BN_bin2bn(bin, bytes, value);
buffer_consume(buffer, bytes);
*/
#include "includes.h"
-RCSID("$Id: channels.c,v 1.38 2000/01/24 20:37:29 markus Exp $");
+RCSID("$Id: channels.c,v 1.39 2000/03/16 20:56:14 markus Exp $");
#include "ssh.h"
#include "packet.h"
int remote_channel, sock = 0, newch, i;
u_short host_port;
char *host, *originator_string;
- int host_len, originator_len;
+ unsigned int host_len, originator_len;
struct addrinfo hints, *ai, *aitop;
char ntop[NI_MAXHOST], strport[NI_MAXSERV];
int gaierr;
int remote_channel, display_number, sock = 0, newch;
const char *display;
char buf[1024], *cp, *remote_host;
- int remote_len;
+ unsigned int remote_len;
struct addrinfo hints, *ai, *aitop;
char strport[NI_MAXSERV];
int gaierr;
*/
#include "includes.h"
-RCSID("$Id: compress.c,v 1.4 1999/11/24 19:53:46 markus Exp $");
+RCSID("$Id: compress.c,v 1.5 2000/03/16 20:56:14 markus Exp $");
#include "ssh.h"
#include "buffer.h"
return;
/* Input is the contents of the input buffer. */
- outgoing_stream.next_in = buffer_ptr(input_buffer);
+ outgoing_stream.next_in = (unsigned char *) buffer_ptr(input_buffer);
outgoing_stream.avail_in = buffer_len(input_buffer);
/* Loop compressing until deflate() returns with avail_out != 0. */
do {
/* Set up fixed-size output buffer. */
- outgoing_stream.next_out = buf;
+ outgoing_stream.next_out = (unsigned char *)buf;
outgoing_stream.avail_out = sizeof(buf);
/* Compress as much data into the buffer as possible. */
char buf[4096];
int status;
- incoming_stream.next_in = buffer_ptr(input_buffer);
+ incoming_stream.next_in = (unsigned char *) buffer_ptr(input_buffer);
incoming_stream.avail_in = buffer_len(input_buffer);
- incoming_stream.next_out = buf;
+ incoming_stream.next_out = (unsigned char *) buf;
incoming_stream.avail_out = sizeof(buf);
for (;;) {
case Z_OK:
buffer_append(output_buffer, buf,
sizeof(buf) - incoming_stream.avail_out);
- incoming_stream.next_out = buf;
+ incoming_stream.next_out = (unsigned char *) buf;
incoming_stream.avail_out = sizeof(buf);
break;
case Z_STREAM_END:
*/
#include "includes.h"
-RCSID("$Id: fingerprint.c,v 1.4 1999/11/24 16:15:25 markus Exp $");
+RCSID("$Id: fingerprint.c,v 1.5 2000/03/16 20:56:14 markus Exp $");
#include "ssh.h"
#include "xmalloc.h"
static char retval[80];
MD5_CTX md;
unsigned char d[16];
- char *buf;
+ unsigned char *buf;
int nlen, elen;
nlen = BN_num_bytes(n);
*
*/
-/* RCSID("$Id: packet.h,v 1.9 2000/01/04 16:54:58 markus Exp $"); */
+/* RCSID("$Id: packet.h,v 1.10 2000/03/16 20:56:14 markus Exp $"); */
#ifndef PACKET_H
#define PACKET_H
* The error message should not contain a newline. The total length of the
* message must not exceed 1024 bytes.
*/
-void packet_disconnect(const char *fmt,...) __attribute__((format(printf, 1, 2)));;
+void packet_disconnect(const char *fmt,...) __attribute__((format(printf, 1, 2)));
/*
* Sends a diagnostic message to the other side. This message can be sent at
* remote side protocol flags do not indicate that it supports SSH_MSG_DEBUG,
* this will do nothing.
*/
-void packet_send_debug(const char *fmt,...) __attribute__((format(printf, 1, 2)));;
+void packet_send_debug(const char *fmt,...) __attribute__((format(printf, 1, 2)));
/* Checks if there is any buffered output, and tries to write some of the output. */
void packet_write_poll(void);
p += creds->ticket_st.length;
len = p - temp;
- return (uuencode(temp, len, buf));
+ return (uuencode((unsigned char *)temp, len, (char *)buf));
}
int
char version;
char temp[2048];
- if (!(len = uudecode(buf, temp, sizeof(temp))))
+ if (!(len = uudecode(buf, (unsigned char *)temp, sizeof(temp))))
return 0;
p = temp;
*/
#include "includes.h"
-RCSID("$Id: rsa.c,v 1.12 2000/02/21 21:47:31 markus Exp $");
+RCSID("$Id: rsa.c,v 1.13 2000/03/16 20:56:14 markus Exp $");
#include "rsa.h"
#include "ssh.h"
void
rsa_public_encrypt(BIGNUM *out, BIGNUM *in, RSA *key)
{
- char *inbuf, *outbuf;
+ unsigned char *inbuf, *outbuf;
int len, ilen, olen;
if (BN_num_bits(key->e) < 2 || !BN_is_odd(key->e))
void
rsa_private_decrypt(BIGNUM *out, BIGNUM *in, RSA *key)
{
- char *inbuf, *outbuf;
+ unsigned char *inbuf, *outbuf;
int len, ilen, olen;
olen = BN_num_bytes(key->n);
*/
#include "includes.h"
-RCSID("$Id: scp.c,v 1.25 2000/01/24 22:11:20 markus Exp $");
+RCSID("$Id: scp.c,v 1.26 2000/03/16 20:56:14 markus Exp $");
#include "ssh.h"
#include "xmalloc.h"
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: scp.c,v 1.25 2000/01/24 22:11:20 markus Exp $
+ * $Id: scp.c,v 1.26 2000/03/16 20:56:14 markus Exp $
*/
char *
}
void
-updateprogressmeter(void)
+updateprogressmeter(int ignore)
{
int save_errno = errno;
atomicio(write, fileno(stdout), buf, strlen(buf));
if (flag == -1) {
- signal(SIGALRM, (void *) updateprogressmeter);
+ signal(SIGALRM, updateprogressmeter);
alarmtimer(1);
} else if (flag == 1) {
alarmtimer(0);
-/* $OpenBSD: ssh-agent.c,v 1.25 2000/01/02 21:51:03 markus Exp $ */
+/* $OpenBSD: ssh-agent.c,v 1.26 2000/03/16 20:56:14 markus Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
*/
#include "includes.h"
-RCSID("$OpenBSD: ssh-agent.c,v 1.25 2000/01/02 21:51:03 markus Exp $");
+RCSID("$OpenBSD: ssh-agent.c,v 1.26 2000/03/16 20:56:14 markus Exp $");
#include "ssh.h"
#include "rsa.h"
{
unsigned int i;
int len, sock;
+ socklen_t slen;
char buf[1024];
struct sockaddr_un sunaddr;
break;
case AUTH_SOCKET:
if (FD_ISSET(sockets[i].fd, readset)) {
- len = sizeof(sunaddr);
- sock = accept(sockets[i].fd, (struct sockaddr *) & sunaddr, &len);
+ slen = sizeof(sunaddr);
+ sock = accept(sockets[i].fd, (struct sockaddr *) & sunaddr, &slen);
if (sock < 0) {
perror("accept from AUTH_SOCKET");
break;
*/
#include "includes.h"
-RCSID("$Id: ssh-keygen.c,v 1.16 2000/02/04 14:34:09 markus Exp $");
+RCSID("$Id: ssh-keygen.c,v 1.17 2000/03/16 20:56:14 markus Exp $");
#include "rsa.h"
#include "ssh.h"
RSA *public_key;
char *comment = NULL, *cp, *ep, line[16*1024];
int i, skip = 0, num = 1, invalid = 1;
+ unsigned int ignore;
struct stat st;
if (!have_identity)
*cp++ = '\0';
}
ep = cp;
- if (auth_rsa_read_key(&cp, &i, e, n)) {
+ if (auth_rsa_read_key(&cp, &ignore, e, n)) {
invalid = 0;
comment = *cp ? cp : comment;
printf("%d %s %s\n", BN_num_bits(n),
*/
#include "includes.h"
-RCSID("$OpenBSD: sshconnect.c,v 1.56 2000/02/18 08:50:33 markus Exp $");
+RCSID("$OpenBSD: sshconnect.c,v 1.57 2000/03/16 20:56:14 markus Exp $");
#include <ssl/bn.h>
#include "xmalloc.h"
char *realm;
CREDENTIALS cred;
int r, type, plen;
+ socklen_t slen;
Key_schedule schedule;
u_long checksum, cksum;
MSG_DAT msg_data;
/* Zero the buffer. */
(void) memset(auth.dat, 0, MAX_KTXT_LEN);
- r = sizeof(local);
+ slen = sizeof(local);
memset(&local, 0, sizeof(local));
if (getsockname(packet_get_connection_in(),
- (struct sockaddr *) & local, &r) < 0)
+ (struct sockaddr *) & local, &slen) < 0)
debug("getsockname failed: %s", strerror(errno));
- r = sizeof(foreign);
+ slen = sizeof(foreign);
memset(&foreign, 0, sizeof(foreign));
if (getpeername(packet_get_connection_in(),
- (struct sockaddr *) & foreign, &r) < 0) {
+ (struct sockaddr *) & foreign, &slen) < 0) {
debug("getpeername failed: %s", strerror(errno));
fatal_cleanup();
}
CREDENTIALS *creds;
char pname[ANAME_SZ], pinst[INST_SZ], prealm[REALM_SZ];
int r, type, plen;
- unsigned char buffer[8192];
+ char buffer[8192];
struct stat st;
/* Don't do anything if we don't have any tickets. */
debug("Kerberos V4 ticket expired: %s", TKT_FILE);
return 0;
}
- creds_to_radix(creds, buffer);
+ creds_to_radix(creds, (unsigned char *)buffer);
xfree(creds);
packet_start(SSH_CMSG_HAVE_KERBEROS_TGT);
- packet_put_string((char *) buffer, strlen(buffer));
+ packet_put_string(buffer, strlen(buffer));
packet_send();
packet_write_wait();
struct ClearToken ct;
int i, type, len, plen;
char buf[2048], *p, *server_cell;
- unsigned char buffer[8192];
+ char buffer[8192];
/* Move over ktc_GetToken, here's something leaner. */
for (i = 0; i < 100; i++) { /* just in case */
creds.pinst[0] = '\0';
/* Encode token, ship it off. */
- if (!creds_to_radix(&creds, buffer))
+ if (!creds_to_radix(&creds, (unsigned char*) buffer))
break;
packet_start(SSH_CMSG_HAVE_AFS_TOKEN);
- packet_put_string((char *) buffer, strlen(buffer));
+ packet_put_string(buffer, strlen(buffer));
packet_send();
packet_write_wait();
int
try_skey_authentication()
{
- int type, i, payload_len;
+ int type, i;
+ int payload_len;
+ unsigned int clen;
char *challenge, *response;
debug("Doing skey authentication.");
debug("No challenge for skey authentication.");
return 0;
}
- challenge = packet_get_string(&payload_len);
+ challenge = packet_get_string(&clen);
+ packet_integrity_check(payload_len, (4 + clen), type);
if (options.cipher == SSH_CIPHER_NONE)
log("WARNING: Encryption is disabled! "
"Reponse will be transmitted in clear text.");
*/
#include "includes.h"
-RCSID("$OpenBSD: sshd.c,v 1.91 2000/03/09 19:31:47 markus Exp $");
+RCSID("$OpenBSD: sshd.c,v 1.92 2000/03/16 20:56:15 markus Exp $");
#include "xmalloc.h"
#include "rsa.h"
do_authentication()
{
struct passwd *pw, pwcopy;
- int plen, ulen;
+ int plen;
+ unsigned int ulen;
char *user;
/* Get the name of the user that we wish to log in as. */
BIGNUM *n;
char *client_user, *password;
char user[1024];
- int plen, dlen, nlen, ulen, elen;
+ unsigned int dlen;
+ int plen, nlen, elen;
+ unsigned int ulen;
int type = 0;
void (*authlog) (const char *fmt,...) = verbose;
int plen;
int type = packet_read(&plen);
#ifdef SKEY
- int dlen;
+ unsigned int dlen;
char *password, *skeyinfo;
/* Try to send a fake s/key challenge. */
if (options.skey_authentication == 1 &&
int row, col, xpixel, ypixel, screen;
char ttyname[64];
char *command, *term = NULL, *display = NULL, *proto = NULL, *data = NULL;
+ int plen;
+ unsigned int dlen;
int n_bytes;
/*
* or a command.
*/
while (1) {
- int plen, dlen;
/* Get a packet from the client. */
type = packet_read(&plen);
if (display)
packet_disconnect("Protocol error: X11 display already set.");
{
- int proto_len, data_len;
+ unsigned int proto_len, data_len;
proto = packet_get_string(&proto_len);
data = packet_get_string(&data_len);
packet_integrity_check(plen, 4 + proto_len + 4 + data_len + 4, type);
goto do_forced_command;
/* Get command from the packet. */
{
- int dlen;
+ unsigned int dlen;
command = packet_get_string(&dlen);
debug("Executing command '%.500s'", command);
packet_integrity_check(plen, 4 + dlen, type);