From c5564e1c4c41ae9af96973e2996e2a4285acbae8 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Sun, 21 Jun 2009 18:53:53 +1000 Subject: - andreas@cvs.openbsd.org 2009/05/28 16:50:16 [sshd.c packet.c serverloop.c monitor_wrap.c clientloop.c sshconnect.c monitor.c Added roaming.h roaming_common.c roaming_dummy.c] Keep track of number of bytes read and written. Needed for upcoming changes. Most code from Martin Forssen, maf at appgate dot com. ok markus@ Also, applied appropriate changes to Makefile.in --- roaming_dummy.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 roaming_dummy.c (limited to 'roaming_dummy.c') diff --git a/roaming_dummy.c b/roaming_dummy.c new file mode 100644 index 000000000..cd1d20257 --- /dev/null +++ b/roaming_dummy.c @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2004-2009 AppGate Network Security AB + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * This file is included in the client programs which should not + * support roaming. + */ + +#include +#include + +int resume_in_progress = 0; + +u_int64_t get_recv_bytes() +{ + return 0; +} + +ssize_t +roaming_write(int fd, const void *buf, size_t count, int *cont) +{ + return write(fd, buf, count); +} + +ssize_t +roaming_read(int fd, void *buf, size_t count, int *cont) +{ + if (cont) + *cont = 0; + return read(fd, buf, count); +} + +void +add_recv_bytes(u_int64_t num) +{ +} + +int +resume_kex() +{ + return 1; +} -- cgit v1.2.3 From e6b590e8d40e2b2ab0aab9da1b7d34cd357caf6a Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Sun, 21 Jun 2009 19:08:48 +1000 Subject: - dtucker@cvs.openbsd.org 2009/06/21 09:04:03 [roaming.h roaming_common.c roaming_dummy.c] Add tags for the benefit of the sync scripts Also: pull in the changes for 1.1->1.2 missed in the previous sync. --- ChangeLog | 4 ++++ roaming.h | 3 ++- roaming_common.c | 17 ++++++++++------- roaming_dummy.c | 8 ++++++-- 4 files changed, 22 insertions(+), 10 deletions(-) (limited to 'roaming_dummy.c') diff --git a/ChangeLog b/ChangeLog index a10870522..c816276cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -101,6 +101,10 @@ [kexdhs.c kexgexs.c] abort if key_sign fails, preventing possible null deref. Based on report from Paolo Ganci, ok markus@ djm@ + - dtucker@cvs.openbsd.org 2009/06/21 09:04:03 + [roaming.h roaming_common.c roaming_dummy.c] + Add tags for the benefit of the sync scripts + Also: pull in the changes for 1.1->1.2 missed in the previous sync. 20090616 - (dtucker) [configure.ac defines.h] Bug #1607: handle the case where fsid_t diff --git a/roaming.h b/roaming.h index 88193453a..e99465502 100644 --- a/roaming.h +++ b/roaming.h @@ -1,3 +1,4 @@ +/* $OpenBSD: roaming.h,v 1.3 2009/06/21 09:04:03 dtucker Exp $ */ /* * Copyright (c) 2004-2009 AppGate Network Security AB * @@ -22,7 +23,7 @@ extern int resume_in_progress; void add_recv_bytes(u_int64_t); ssize_t roaming_write(int, const void *, size_t, int *); ssize_t roaming_read(int, void *, size_t, int *); -ssize_t roaming_atomicio(ssize_t (*)(int, void *, size_t), int, void *, size_t); +size_t roaming_atomicio(ssize_t (*)(int, void *, size_t), int, void *, size_t); u_int64_t get_recv_bytes(void); u_int64_t get_sent_bytes(void); void roam_set_bytes(u_int64_t, u_int64_t); diff --git a/roaming_common.c b/roaming_common.c index 5a871b23e..065542520 100644 --- a/roaming_common.c +++ b/roaming_common.c @@ -1,3 +1,4 @@ +/* $OpenBSD: roaming_common.c,v 1.4 2009/06/21 09:04:03 dtucker Exp $ */ /* * Copyright (c) 2004-2009 AppGate Network Security AB * @@ -55,9 +56,9 @@ get_sent_bytes(void) } void -roam_set_bytes(u_int64_t sent, u_int64_t recv) +roam_set_bytes(u_int64_t sent, u_int64_t recvd) { - read_bytes = recv; + read_bytes = recvd; write_bytes = sent; } @@ -70,7 +71,8 @@ roaming_write(int fd, const void *buf, size_t count, int *cont) if (ret > 0 && !resume_in_progress) { write_bytes += ret; } - debug("Wrote %d bytes for a total of %lld", ret, write_bytes); + debug3("Wrote %ld bytes for a total of %llu", (long)ret, + (unsigned long long)write_bytes); return ret; } @@ -86,12 +88,13 @@ roaming_read(int fd, void *buf, size_t count, int *cont) return ret; } -ssize_t -roaming_atomicio(ssize_t(*f)(), int fd, void *buf, size_t count) +size_t +roaming_atomicio(ssize_t(*f)(int, void*, size_t), int fd, void *buf, + size_t count) { - ssize_t ret = atomicio(f, fd, buf, count); + size_t ret = atomicio(f, fd, buf, count); - if ((f == write || f == vwrite) && ret > 0 && !resume_in_progress) { + if (f == vwrite && ret > 0 && !resume_in_progress) { write_bytes += ret; } else if (f == read && ret > 0 && !resume_in_progress) { read_bytes += ret; diff --git a/roaming_dummy.c b/roaming_dummy.c index cd1d20257..f081bffe9 100644 --- a/roaming_dummy.c +++ b/roaming_dummy.c @@ -1,3 +1,4 @@ +/* $OpenBSD: roaming_dummy.c,v 1.3 2009/06/21 09:04:03 dtucker Exp $ */ /* * Copyright (c) 2004-2009 AppGate Network Security AB * @@ -22,9 +23,12 @@ #include #include +#include "roaming.h" + int resume_in_progress = 0; -u_int64_t get_recv_bytes() +u_int64_t +get_recv_bytes(void) { return 0; } @@ -49,7 +53,7 @@ add_recv_bytes(u_int64_t num) } int -resume_kex() +resume_kex(void) { return 1; } -- cgit v1.2.3 From 828c96d48fce9040a75b0e9e66ecd02c96dee11e Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Sun, 21 Jun 2009 22:22:08 +1000 Subject: - (dtucker) [roaming_common.c roaming_dummy.c] Wrap #include in ifdef. --- ChangeLog | 2 ++ roaming_common.c | 4 ++++ roaming_dummy.c | 2 ++ 3 files changed, 8 insertions(+) (limited to 'roaming_dummy.c') diff --git a/ChangeLog b/ChangeLog index 5635d7aa0..c801521bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -108,6 +108,8 @@ - (dtucker) [auth2-jpake.c auth2.c canohost.h session.c] Whitespace and header-order changes to reduce diff vs OpenBSD. - (dtucker) [servconf.c sshd.c] More whitespace sync. + - (dtucker) [roaming_common.c roaming_dummy.c] Wrap #include in + ifdef. 20090616 - (dtucker) [configure.ac defines.h] Bug #1607: handle the case where fsid_t diff --git a/roaming_common.c b/roaming_common.c index 065542520..14dd5808f 100644 --- a/roaming_common.c +++ b/roaming_common.c @@ -15,12 +15,16 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "includes.h" + #include #include #include #include +#ifdef HAVE_INTTYPES_H #include +#endif #include #include diff --git a/roaming_dummy.c b/roaming_dummy.c index f081bffe9..45c4008e7 100644 --- a/roaming_dummy.c +++ b/roaming_dummy.c @@ -20,6 +20,8 @@ * support roaming. */ +#include "includes.h" + #include #include -- cgit v1.2.3