summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2006-03-31 23:13:02 +1100
committerDamien Miller <djm@mindrot.org>2006-03-31 23:13:02 +1100
commit3f9418893e1254bda3b87e7d3af7029d11b0a6c7 (patch)
tree97662277f300ea1ab8255905b9d5d72a26f7578f
parentd79b424e8ad424a44119f327e5ab1f79cd35649c (diff)
downloadopenssh-git-3f9418893e1254bda3b87e7d3af7029d11b0a6c7.tar.gz
- djm@cvs.openbsd.org 2006/03/30 09:58:16
[authfd.c bufaux.c deattack.c gss-serv.c mac.c misc.c misc.h] [monitor_wrap.c msg.c packet.c sftp-client.c sftp-server.c ssh-agent.c] replace {GET,PUT}_XXBIT macros with functionally similar functions, silencing a heap of lint warnings. also allows them to use __bounded__ checking which can't be applied to macros; requested by and feedback from deraadt@
-rw-r--r--ChangeLog9
-rw-r--r--authfd.c8
-rw-r--r--bufaux.c20
-rw-r--r--deattack.c6
-rw-r--r--gss-serv.c8
-rw-r--r--mac.c6
-rw-r--r--misc.c93
-rw-r--r--misc.h24
-rw-r--r--monitor_wrap.c8
-rw-r--r--msg.c8
-rw-r--r--packet.c15
-rw-r--r--sftp-client.c6
-rw-r--r--sftp-server.c9
-rw-r--r--ssh-agent.c5
14 files changed, 166 insertions, 59 deletions
diff --git a/ChangeLog b/ChangeLog
index 85648b98..827719c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -23,6 +23,13 @@
- djm@cvs.openbsd.org 2006/03/30 09:41:25
[channels.c]
ARGSUSED for dispatch table-driven functions
+ - djm@cvs.openbsd.org 2006/03/30 09:58:16
+ [authfd.c bufaux.c deattack.c gss-serv.c mac.c misc.c misc.h]
+ [monitor_wrap.c msg.c packet.c sftp-client.c sftp-server.c ssh-agent.c]
+ replace {GET,PUT}_XXBIT macros with functionally similar functions,
+ silencing a heap of lint warnings. also allows them to use
+ __bounded__ checking which can't be applied to macros; requested
+ by and feedback from deraadt@
20060326
- OpenBSD CVS Sync
@@ -4472,4 +4479,4 @@
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
-$Id: ChangeLog,v 1.4294 2006/03/31 12:11:44 djm Exp $
+$Id: ChangeLog,v 1.4295 2006/03/31 12:13:02 djm Exp $
diff --git a/authfd.c b/authfd.c
index 2654892d..0fa69bd2 100644
--- a/authfd.c
+++ b/authfd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: authfd.c,v 1.73 2006/03/25 18:29:35 deraadt Exp $ */
+/* $OpenBSD: authfd.c,v 1.74 2006/03/30 09:58:15 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -47,7 +47,6 @@
#include "buffer.h"
#include "bufaux.h"
#include "xmalloc.h"
-#include "getput.h"
#include "key.h"
#include "authfd.h"
#include "cipher.h"
@@ -55,6 +54,7 @@
#include "compat.h"
#include "log.h"
#include "atomicio.h"
+#include "misc.h"
static int agent_present = 0;
@@ -122,7 +122,7 @@ ssh_request_reply(AuthenticationConnection *auth, Buffer *request, Buffer *reply
/* Get the length of the message, and format it in the buffer. */
len = buffer_len(request);
- PUT_32BIT(buf, len);
+ put_u32(buf, len);
/* Send the length and then the packet to the agent. */
if (atomicio(vwrite, auth->fd, buf, 4) != 4 ||
@@ -141,7 +141,7 @@ ssh_request_reply(AuthenticationConnection *auth, Buffer *request, Buffer *reply
}
/* Extract the length, and check it for sanity. */
- len = GET_32BIT(buf);
+ len = get_u32(buf);
if (len > 256 * 1024)
fatal("Authentication response too long: %u", len);
diff --git a/bufaux.c b/bufaux.c
index 21a2badf..4f9a8988 100644
--- a/bufaux.c
+++ b/bufaux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bufaux.c,v 1.40 2006/03/25 18:56:54 deraadt Exp $ */
+/* $OpenBSD: bufaux.c,v 1.41 2006/03/30 09:58:15 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -42,8 +42,8 @@
#include <openssl/bn.h>
#include "bufaux.h"
#include "xmalloc.h"
-#include "getput.h"
#include "log.h"
+#include "misc.h"
/*
* Stores an BIGNUM in the buffer with a 2-byte msb first bit count, followed
@@ -68,7 +68,7 @@ buffer_put_bignum_ret(Buffer *buffer, const BIGNUM *value)
}
/* Store the number of bits in the buffer in two bytes, msb first. */
- PUT_16BIT(msg, bits);
+ put_u16(msg, bits);
buffer_append(buffer, msg, 2);
/* Store the binary data. */
buffer_append(buffer, buf, oi);
@@ -100,7 +100,7 @@ buffer_get_bignum_ret(Buffer *buffer, BIGNUM *value)
error("buffer_get_bignum_ret: invalid length");
return (-1);
}
- bits = GET_16BIT(buf);
+ bits = get_u16(buf);
/* Compute the number of binary bytes that follow. */
bytes = (bits + 7) / 8;
if (bytes > 8 * 1024) {
@@ -219,7 +219,7 @@ buffer_get_short_ret(u_short *ret, Buffer *buffer)
if (buffer_get_ret(buffer, (char *) buf, 2) == -1)
return (-1);
- *ret = GET_16BIT(buf);
+ *ret = get_u16(buf);
return (0);
}
@@ -241,7 +241,7 @@ buffer_get_int_ret(u_int *ret, Buffer *buffer)
if (buffer_get_ret(buffer, (char *) buf, 4) == -1)
return (-1);
- *ret = GET_32BIT(buf);
+ *ret = get_u32(buf);
return (0);
}
@@ -263,7 +263,7 @@ buffer_get_int64_ret(u_int64_t *ret, Buffer *buffer)
if (buffer_get_ret(buffer, (char *) buf, 8) == -1)
return (-1);
- *ret = GET_64BIT(buf);
+ *ret = get_u64(buf);
return (0);
}
@@ -286,7 +286,7 @@ buffer_put_short(Buffer *buffer, u_short value)
{
char buf[2];
- PUT_16BIT(buf, value);
+ put_u16(buf, value);
buffer_append(buffer, buf, 2);
}
@@ -295,7 +295,7 @@ buffer_put_int(Buffer *buffer, u_int value)
{
char buf[4];
- PUT_32BIT(buf, value);
+ put_u32(buf, value);
buffer_append(buffer, buf, 4);
}
@@ -304,7 +304,7 @@ buffer_put_int64(Buffer *buffer, u_int64_t value)
{
char buf[8];
- PUT_64BIT(buf, value);
+ put_u64(buf, value);
buffer_append(buffer, buf, 8);
}
diff --git a/deattack.c b/deattack.c
index 2adf185e..fa397e6e 100644
--- a/deattack.c
+++ b/deattack.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: deattack.c,v 1.26 2006/03/25 13:17:01 djm Exp $ */
+/* $OpenBSD: deattack.c,v 1.27 2006/03/30 09:58:15 djm Exp $ */
/*
* Cryptographic attack detector for ssh - source code
*
@@ -23,8 +23,8 @@
#include "deattack.h"
#include "log.h"
#include "crc32.h"
-#include "getput.h"
#include "xmalloc.h"
+#include "misc.h"
/* SSH Constants */
#define SSH_MAXBLOCKS (32 * 1024)
@@ -42,7 +42,7 @@
/* Hash function (Input keys are cipher results) */
-#define HASH(x) GET_32BIT(x)
+#define HASH(x) get_u32(x)
#define CMP(a, b) (memcmp(a, b, SSH_BLOCKSIZE))
diff --git a/gss-serv.c b/gss-serv.c
index 53ec634e..5e43ffe5 100644
--- a/gss-serv.c
+++ b/gss-serv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gss-serv.c,v 1.16 2006/03/25 22:22:43 djm Exp $ */
+/* $OpenBSD: gss-serv.c,v 1.17 2006/03/30 09:58:15 djm Exp $ */
/*
* Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved.
@@ -35,7 +35,7 @@
#include "session.h"
#include "servconf.h"
#include "xmalloc.h"
-#include "getput.h"
+#include "misc.h"
#include "ssh-gss.h"
@@ -153,7 +153,7 @@ ssh_gssapi_parse_ename(Gssctxt *ctx, gss_buffer_t ename, gss_buffer_t name)
* second without.
*/
- oidl = GET_16BIT(tok+2); /* length including next two bytes */
+ oidl = get_u16(tok+2); /* length including next two bytes */
oidl = oidl-2; /* turn it into the _real_ length of the variable OID */
/*
@@ -170,7 +170,7 @@ ssh_gssapi_parse_ename(Gssctxt *ctx, gss_buffer_t ename, gss_buffer_t name)
if (ename->length < offset+4)
return GSS_S_FAILURE;
- name->length = GET_32BIT(tok+offset);
+ name->length = get_u32(tok+offset);
offset += 4;
if (ename->length < offset+name->length)
diff --git a/mac.c b/mac.c
index c155dbd3..02bcc31e 100644
--- a/mac.c
+++ b/mac.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mac.c,v 1.9 2006/03/25 13:17:02 djm Exp $ */
+/* $OpenBSD: mac.c,v 1.10 2006/03/30 09:58:15 djm Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
*
@@ -28,11 +28,11 @@
#include <openssl/hmac.h>
#include "xmalloc.h"
-#include "getput.h"
#include "log.h"
#include "cipher.h"
#include "kex.h"
#include "mac.h"
+#include "misc.h"
struct {
char *name;
@@ -83,7 +83,7 @@ mac_compute(Mac *mac, u_int32_t seqno, u_char *data, int datalen)
if (mac->mac_len > sizeof(m))
fatal("mac_compute: mac too long");
HMAC_Init(&c, mac->key, mac->key_len, mac->md);
- PUT_32BIT(b, seqno);
+ put_u32(b, seqno);
HMAC_Update(&c, b, sizeof(b));
HMAC_Update(&c, data, datalen);
HMAC_Final(&c, m, NULL);
diff --git a/misc.c b/misc.c
index daeb86c8..158d4878 100644
--- a/misc.c
+++ b/misc.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: misc.c,v 1.51 2006/03/25 13:17:02 djm Exp $ */
+/* $OpenBSD: misc.c,v 1.52 2006/03/30 09:58:15 djm Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
- * Copyright (c) 2005 Damien Miller. All rights reserved.
+ * Copyright (c) 2005,2006 Damien Miller. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -691,17 +691,100 @@ sanitise_stdfd(void)
}
char *
-tohex(const u_char *d, u_int l)
+tohex(const void *vp, size_t l)
{
+ const u_char *p = (const u_char *)vp;
char b[3], *r;
- u_int i, hl;
+ size_t i, hl;
+
+ if (l > 65536)
+ return xstrdup("tohex: length > 65536");
hl = l * 2 + 1;
r = xcalloc(1, hl);
for (i = 0; i < l; i++) {
- snprintf(b, sizeof(b), "%02x", d[i]);
+ snprintf(b, sizeof(b), "%02x", p[i]);
strlcat(r, b, hl);
}
return (r);
}
+u_int64_t
+get_u64(const void *vp)
+{
+ const u_char *p = (const u_char *)vp;
+ u_int64_t v;
+
+ v = (u_int64_t)p[0] << 56;
+ v |= (u_int64_t)p[1] << 48;
+ v |= (u_int64_t)p[2] << 40;
+ v |= (u_int64_t)p[3] << 32;
+ v |= (u_int64_t)p[4] << 24;
+ v |= (u_int64_t)p[5] << 16;
+ v |= (u_int64_t)p[6] << 8;
+ v |= (u_int64_t)p[7];
+
+ return (v);
+}
+
+u_int32_t
+get_u32(const void *vp)
+{
+ const u_char *p = (const u_char *)vp;
+ u_int32_t v;
+
+ v = (u_int32_t)p[0] << 24;
+ v |= (u_int32_t)p[1] << 16;
+ v |= (u_int32_t)p[2] << 8;
+ v |= (u_int32_t)p[3];
+
+ return (v);
+}
+
+u_int16_t
+get_u16(const void *vp)
+{
+ const u_char *p = (const u_char *)vp;
+ u_int16_t v;
+
+ v = (u_int16_t)p[0] << 8;
+ v |= (u_int16_t)p[1];
+
+ return (v);
+}
+
+void
+put_u64(void *vp, u_int64_t v)
+{
+ u_char *p = (u_char *)vp;
+
+ p[0] = (u_char)(v >> 56) & 0xff;
+ p[1] = (u_char)(v >> 48) & 0xff;
+ p[2] = (u_char)(v >> 40) & 0xff;
+ p[3] = (u_char)(v >> 32) & 0xff;
+ p[4] = (u_char)(v >> 24) & 0xff;
+ p[5] = (u_char)(v >> 16) & 0xff;
+ p[6] = (u_char)(v >> 8) & 0xff;
+ p[7] = (u_char)v & 0xff;
+}
+
+void
+put_u32(void *vp, u_int32_t v)
+{
+ u_char *p = (u_char *)vp;
+
+ p[0] = (u_char)(v >> 24) & 0xff;
+ p[1] = (u_char)(v >> 16) & 0xff;
+ p[2] = (u_char)(v >> 8) & 0xff;
+ p[3] = (u_char)v & 0xff;
+}
+
+
+void
+put_u16(void *vp, u_int16_t v)
+{
+ u_char *p = (u_char *)vp;
+
+ p[0] = (u_char)(v >> 8) & 0xff;
+ p[1] = (u_char)v & 0xff;
+}
diff --git a/misc.h b/misc.h
index f20cb60b..bbd66ef1 100644
--- a/misc.h
+++ b/misc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.h,v 1.30 2006/03/25 22:22:43 djm Exp $ */
+/* $OpenBSD: misc.h,v 1.31 2006/03/30 09:58:15 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -12,6 +12,9 @@
* called by a name other than "ssh" or "Secure Shell".
*/
+#ifndef _MISC_H
+#define _MISC_H
+
/* misc.c */
char *chop(char *);
@@ -27,7 +30,7 @@ char *colon(char *);
long convtime(const char *);
char *tilde_expand_filename(const char *, uid_t);
char *percent_expand(const char *, ...) __attribute__((__sentinel__));
-char *tohex(const u_char *, u_int);
+char *tohex(const void *, size_t);
void sanitise_stdfd(void);
struct passwd *pwcopy(struct passwd *);
@@ -67,3 +70,20 @@ int tun_open(int, int);
#define SSH_TUNID_ANY 0x7fffffff
#define SSH_TUNID_ERR (SSH_TUNID_ANY - 1)
#define SSH_TUNID_MAX (SSH_TUNID_ANY - 2)
+
+/* Functions to extract or store big-endian words of various sizes */
+u_int64_t get_u64(const void *)
+ __attribute__((__bounded__( __minbytes__, 1, 8)));
+u_int32_t get_u32(const void *)
+ __attribute__((__bounded__( __minbytes__, 1, 4)));
+u_int16_t get_u16(const void *)
+ __attribute__((__bounded__( __minbytes__, 1, 2)));
+void put_u64(void *, u_int64_t)
+ __attribute__((__bounded__( __minbytes__, 1, 8)));
+void put_u32(void *, u_int32_t)
+ __attribute__((__bounded__( __minbytes__, 1, 4)));
+void put_u16(void *, u_int16_t)
+ __attribute__((__bounded__( __minbytes__, 1, 2)));
+
+#endif /* _MISC_H */
+
diff --git a/monitor_wrap.c b/monitor_wrap.c
index f2fbd99e..8cfc8cc0 100644
--- a/monitor_wrap.c
+++ b/monitor_wrap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: monitor_wrap.c,v 1.44 2006/03/25 13:17:02 djm Exp $ */
+/* $OpenBSD: monitor_wrap.c,v 1.45 2006/03/30 09:58:15 djm Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* Copyright 2002 Markus Friedl <markus@openbsd.org>
@@ -52,7 +52,7 @@
#include "xmalloc.h"
#include "atomicio.h"
#include "monitor_fdpass.h"
-#include "getput.h"
+#include "misc.h"
#include "servconf.h"
#include "auth.h"
@@ -91,7 +91,7 @@ mm_request_send(int sock, enum monitor_reqtype type, Buffer *m)
debug3("%s entering: type %d", __func__, type);
- PUT_32BIT(buf, mlen + 1);
+ put_u32(buf, mlen + 1);
buf[4] = (u_char) type; /* 1st byte of payload is mesg-type */
if (atomicio(vwrite, sock, buf, sizeof(buf)) != sizeof(buf))
fatal("%s: write: %s", __func__, strerror(errno));
@@ -112,7 +112,7 @@ mm_request_receive(int sock, Buffer *m)
cleanup_exit(255);
fatal("%s: read: %s", __func__, strerror(errno));
}
- msg_len = GET_32BIT(buf);
+ msg_len = get_u32(buf);
if (msg_len > 256 * 1024)
fatal("%s: read: bad msg_len %d", __func__, msg_len);
buffer_clear(m);
diff --git a/msg.c b/msg.c
index 2c0a6726..fb08df54 100644
--- a/msg.c
+++ b/msg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: msg.c,v 1.10 2006/03/25 13:17:02 djm Exp $ */
+/* $OpenBSD: msg.c,v 1.11 2006/03/30 09:58:15 djm Exp $ */
/*
* Copyright (c) 2002 Markus Friedl. All rights reserved.
*
@@ -25,10 +25,10 @@
#include "includes.h"
#include "buffer.h"
-#include "getput.h"
#include "log.h"
#include "atomicio.h"
#include "msg.h"
+#include "misc.h"
int
ssh_msg_send(int fd, u_char type, Buffer *m)
@@ -38,7 +38,7 @@ ssh_msg_send(int fd, u_char type, Buffer *m)
debug3("ssh_msg_send: type %u", (unsigned int)type & 0xff);
- PUT_32BIT(buf, mlen + 1);
+ put_u32(buf, mlen + 1);
buf[4] = type; /* 1st byte of payload is mesg-type */
if (atomicio(vwrite, fd, buf, sizeof(buf)) != sizeof(buf)) {
error("ssh_msg_send: write");
@@ -64,7 +64,7 @@ ssh_msg_recv(int fd, Buffer *m)
error("ssh_msg_recv: read: header");
return (-1);
}
- msg_len = GET_32BIT(buf);
+ msg_len = get_u32(buf);
if (msg_len > 256 * 1024) {
error("ssh_msg_recv: read: bad msg_len %u", msg_len);
return (-1);
diff --git a/packet.c b/packet.c
index 5eb2c1c9..ea0a82e2 100644
--- a/packet.c
+++ b/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.130 2006/03/25 18:56:55 deraadt Exp $ */
+/* $OpenBSD: packet.c,v 1.131 2006/03/30 09:58:16 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -48,7 +48,6 @@
#include "packet.h"
#include "bufaux.h"
#include "crc32.h"
-#include "getput.h"
#include "compress.h"
#include "deattack.h"
@@ -559,7 +558,7 @@ packet_send1(void)
/* Add check bytes. */
checksum = ssh_crc32(buffer_ptr(&outgoing_packet),
buffer_len(&outgoing_packet));
- PUT_32BIT(buf, checksum);
+ put_u32(buf, checksum);
buffer_append(&outgoing_packet, buf, 4);
#ifdef PACKET_DEBUG
@@ -568,7 +567,7 @@ packet_send1(void)
#endif
/* Append to output. */
- PUT_32BIT(buf, len);
+ put_u32(buf, len);
buffer_append(&output, buf, 4);
cp = buffer_append_space(&output, buffer_len(&outgoing_packet));
cipher_crypt(&send_context, cp, buffer_ptr(&outgoing_packet),
@@ -771,7 +770,7 @@ packet_send2_wrapped(void)
/* packet_length includes payload, padding and padding length field */
packet_length = buffer_len(&outgoing_packet) - 4;
cp = buffer_ptr(&outgoing_packet);
- PUT_32BIT(cp, packet_length);
+ put_u32(cp, packet_length);
cp[4] = padlen;
DBG(debug("send: len %d (includes padlen %d)", packet_length+4, padlen));
@@ -969,7 +968,7 @@ packet_read_poll1(void)
return SSH_MSG_NONE;
/* Get length of incoming packet. */
cp = buffer_ptr(&input);
- len = GET_32BIT(cp);
+ len = get_u32(cp);
if (len < 1 + 2 + 2 || len > 256 * 1024)
packet_disconnect("Bad packet length %u.", len);
padded_len = (len + 8) & ~7;
@@ -1017,7 +1016,7 @@ packet_read_poll1(void)
len, buffer_len(&incoming_packet));
cp = (u_char *)buffer_ptr(&incoming_packet) + len - 4;
- stored_checksum = GET_32BIT(cp);
+ stored_checksum = get_u32(cp);
if (checksum != stored_checksum)
packet_disconnect("Corrupted check bytes on input.");
buffer_consume_end(&incoming_packet, 4);
@@ -1066,7 +1065,7 @@ packet_read_poll2(u_int32_t *seqnr_p)
cipher_crypt(&receive_context, cp, buffer_ptr(&input),
block_size);
cp = buffer_ptr(&incoming_packet);
- packet_length = GET_32BIT(cp);
+ packet_length = get_u32(cp);
if (packet_length < 1 + 4 || packet_length > 256 * 1024) {
#ifdef PACKET_DEBUG
buffer_dump(&incoming_packet);
diff --git a/sftp-client.c b/sftp-client.c
index 5788aa6a..c71c66f3 100644
--- a/sftp-client.c
+++ b/sftp-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp-client.c,v 1.63 2006/03/25 13:17:02 djm Exp $ */
+/* $OpenBSD: sftp-client.c,v 1.64 2006/03/30 09:58:16 djm Exp $ */
/*
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
*
@@ -32,11 +32,11 @@
#include "buffer.h"
#include "bufaux.h"
-#include "getput.h"
#include "xmalloc.h"
#include "log.h"
#include "atomicio.h"
#include "progressmeter.h"
+#include "misc.h"
#include "sftp.h"
#include "sftp-common.h"
@@ -66,7 +66,7 @@ send_msg(int fd, Buffer *m)
fatal("Outbound message too long %u", buffer_len(m));
/* Send length first */
- PUT_32BIT(mlen, buffer_len(m));
+ put_u32(mlen, buffer_len(m));
if (atomicio(vwrite, fd, mlen, sizeof(mlen)) != sizeof(mlen))
fatal("Couldn't send packet: %s", strerror(errno));
diff --git a/sftp-server.c b/sftp-server.c
index e58aa59c..e842341c 100644
--- a/sftp-server.c
+++ b/sftp-server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp-server.c,v 1.56 2006/03/25 13:17:02 djm Exp $ */
+/* $OpenBSD: sftp-server.c,v 1.57 2006/03/30 09:58:16 djm Exp $ */
/*
* Copyright (c) 2000-2004 Markus Friedl. All rights reserved.
*
@@ -23,7 +23,6 @@
#include "buffer.h"
#include "bufaux.h"
-#include "getput.h"
#include "log.h"
#include "xmalloc.h"
#include "misc.h"
@@ -172,7 +171,7 @@ handle_to_string(int handle, char **stringp, int *hlenp)
if (stringp == NULL || hlenp == NULL)
return -1;
*stringp = xmalloc(sizeof(int32_t));
- PUT_32BIT(*stringp, handle);
+ put_u32(*stringp, handle);
*hlenp = sizeof(int32_t);
return 0;
}
@@ -184,7 +183,7 @@ handle_from_string(const char *handle, u_int hlen)
if (hlen != sizeof(int32_t))
return -1;
- val = GET_32BIT(handle);
+ val = get_u32(handle);
if (handle_is_ok(val, HANDLE_FILE) ||
handle_is_ok(val, HANDLE_DIR))
return val;
@@ -950,7 +949,7 @@ process(void)
if (buf_len < 5)
return; /* Incomplete message. */
cp = buffer_ptr(&iqueue);
- msg_len = GET_32BIT(cp);
+ msg_len = get_u32(cp);
if (msg_len > SFTP_MAX_MSG_LENGTH) {
error("bad message ");
exit(11);
diff --git a/ssh-agent.c b/ssh-agent.c
index 162760ac..681c3023 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-agent.c,v 1.136 2006/03/28 01:53:43 deraadt Exp $ */
+/* $OpenBSD: ssh-agent.c,v 1.137 2006/03/30 09:58:16 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -56,7 +56,6 @@
#include "buffer.h"
#include "bufaux.h"
#include "xmalloc.h"
-#include "getput.h"
#include "key.h"
#include "authfd.h"
#include "compat.h"
@@ -692,7 +691,7 @@ process_message(SocketEntry *e)
if (buffer_len(&e->input) < 5)
return; /* Incomplete message. */
cp = buffer_ptr(&e->input);
- msg_len = GET_32BIT(cp);
+ msg_len = get_u32(cp);
if (msg_len > 256 * 1024) {
close_socket(e);
return;