Commit Graph

509 Commits

Author SHA1 Message Date
Keegan McAllister 349e2d20c8 Use the hardening flags
Closes #79.
2012-04-13 12:25:09 -04:00
Daniel O'Connor 3d76ec8208 Skip 'new' otherwise BSD getopt will think there are no options.
IMO 'new' should be dropped entirely since it's not optional and 'new' is the only choice.

If it were to change in future then it should go after all the options.

(closes #111)
2012-04-13 12:07:49 -04:00
Keith Winstein a67ae7b0f4 Support 16-color set (per Anders Kaseorg).
Closes #106 github issue.
Closes #133 github issue.
Closes #131 github issue.
2012-04-11 03:09:26 -04:00
termie 774e50dc19 Allow lowercase "utf-8" in charset for OS X iTerm.
Closes #104 github pull request.
2012-04-11 02:49:35 -04:00
Anders Kaseorg 9cec566cd1 Find ncurses from pkg-config if possible, and prefer separate libtinfo
Recent ncurses can be configured --with-termlib, which splits out the
terminfo-level functions from libncurses into a separate libtinfo.
This allows us to avoid an unnecessary dependency on libncurses.  (We
already avoided this on distributions that link with -Wl,--as-needed.)

Signed-off-by: Anders Kaseorg <andersk@mit.edu>

Closes #128 github pull request.
2012-04-11 02:47:55 -04:00
Peter Jeremy fd0ddf0e22 strtol(3) can optionally set errno to EINVAL if no conversion could be
performed and FreeBSD (at least) implements thin behaviour.  Add an
explicit test to detect this situation in Dispatcher::parse_params().
(This behaviour difference is not relevant to other uses of strtol()).

This corrects the mishandling of (eg) "CSI m" on FreeBSD.

Closes #129 github pull request.
[keithw -- also fixes same issue with mosh-server on OS X]
2012-04-11 02:46:26 -04:00
Keith Winstein b4c47b77cf Fix bug involving wraparound copy-and-paste to a blank line.
Identified by Anders Kaseorg.

Test case:

( reset; seq 100; printf 'Hello, world!'; sleep 1;
printf '\t\t\t\t\t\t\t\t\t\t   \r\e[K'; sleep 1; printf '\n' )
> /dev/pts/16 2>&1

(replace /dev/pts/16 with mosh or termemu terminal)
2012-04-11 02:40:18 -04:00
Keith Winstein 4144f2e4f0 Don't clear wrap state on DEC set mode escape (matches xterm) 2012-04-11 01:58:20 -04:00
Keith Winstein 4d9483bc83 Fix build when libutil.h exists but is deprecated 2012-04-07 20:23:59 -04:00
Keegan McAllister c354a69ee6 Test the Mosh crypto layer 2012-04-06 23:43:42 -04:00
Keegan McAllister d1c4b0a5d7 Test the OCB-AES reference implementation
This tests cryptographic primitives implemented by others.  It uses the same
interfaces and indeed the same compiled object code as the Mosh client and
server.  It does not particularly test any code written for the Mosh project.
2012-04-06 23:43:42 -04:00
Keegan McAllister fe34cb3809 Create src/tests 2012-04-06 23:43:42 -04:00
Keegan McAllister 3b61581bcd Make aligned allocation without posix_memalign more robust
Instead of guessing the right function to use, we malloc() 15 bytes more than
we need, and compute the aligned offset within.  The AlignedBuffer class takes
care of passing the original pointer to free().
2012-04-06 23:43:41 -04:00
Keegan McAllister 0734640e14 Add a class for aligned buffers
This simplifies the core crypto routines, especially the error handling.  In
fact there was already one error path where we were failing to call free().
2012-04-06 23:43:41 -04:00
Peter Iannucci c19bce27e6 Added missing flags in src/statesync/Makefile.am
(closes #93)
2012-04-06 23:34:45 -04:00
Benjamin Kaduk 29539516e5 FreeBSD needs libutil.h for forkpty()
The header is not available everywhere, so only include it if it
is present.  (The extra include should be harmless on Linux by
inspection.)
2012-04-05 18:19:37 -04:00
Benjamin Kaduk 424e2b53e1 Allow <sys/endian.h> as well as <endian.h>
On FreeBSD, the header which defines htobe64() is the sys/ variant,
unlike Linux.
2012-04-05 18:19:37 -04:00
Keith Winstein 8221838f51 Fix bug sometimes causing missing (or spurious) wraparound copy-and-paste 2012-04-02 19:04:26 -04:00
Keegan McAllister b4ef664bc0 Kill the session after encrypting 2^47 blocks
"Both the privacy and the authenticity properties of OCB degrade as
 per s^2 / 2^128, where s is the total number of blocks that the
 adversary acquires.... In order to ensure that s^2 / 2^128 remains
 small, a given key should be used to encrypt at most 2^48 blocks (2^55
 bits or 4 petabytes)"

-- http://tools.ietf.org/html/draft-krovetz-ocb-03

We deem it unlikely that a legitimate user will send 4 PB through a Mosh
session.  If it happens, we simply kill the session.  The server and
client use the same key, so we actually need to die after 2^47 blocks.

Closes #77.
2012-03-31 16:19:33 -04:00
Keegan McAllister ba6387f36c Allow CryptoExceptions to be fatal 2012-03-31 16:19:33 -04:00
Keegan McAllister ba9b16aafa Fully initialize the argument to TIOCSWINSZ
struct winsize contains fields other than ws_col and ws_row.  To avoid passing
uninitialized data to TIOCSWINSZ, initialize it first using TIOCGWINSZ.

Found by Valgrind.

(closes #85 github issue)
2012-03-31 15:41:34 -04:00
Keith Winstein 9a7f3ad33d Print warnings when IUTF8 missing 2012-03-31 15:20:30 -04:00
Keith Winstein edf6ec9052 Insert missing "if-then" instruction in OCB ARM assem so works with Thumb-2.
(closes #86 github issue)

(approved by Ted Krovetz, author of OCB reference implementation)
2012-03-31 14:31:22 -04:00
Keith Winstein eea48e59d3 Avoid compiler warning on platforms where wchar_t is uint32_t (arm) 2012-03-31 14:30:24 -04:00
Quentin Smith f2a1271dee -lpoll must come before -lm (which pulls in the system poll implementation) 2012-03-28 14:32:32 +02:00
Quentin Smith 7a4ef054c3 Allow the user to specify CFLAGS and LIBS for linking with poll, and test for -lpoll if necessary 2012-03-28 14:32:32 +02:00
Quentin Smith 44ab7360bc Fix poll.h location 2012-03-28 14:32:32 +02:00
Quentin Smith 3b2604b81c Handle early gcc compilers that are missing __builtin_bswap64 or __builtin_ctz
(closes #84)
2012-03-26 21:26:33 -04:00
Quentin Smith d867a716b7 Use uintptr_t instead of size_t, since size_t is not guaranteed to be pointer-sized. 2012-03-26 21:18:55 -04:00
Keegan McAllister 0d6875b8be Don't pass -lutil when linking mosh-client
On Android we lack libutil, and we configure with --disable-server.
2012-03-26 20:08:56 -04:00
Keegan McAllister 7ed5174aa7 Move some locale handling into one place 2012-03-26 20:08:55 -04:00
Keegan McAllister f46bad0aa0 Rename sse_alloc to aligned_alloc
SSE is x86-specific, but we use this function on all archs.
2012-03-26 20:07:34 -04:00
Alexander Chernyakhovsky 87d57c9567 Add unistd.h to network.cc to allow mosh to build on Fedora Rawhide (future Fedora 18) 2012-03-26 18:46:52 -04:00
Keegan McAllister a9b5850019 Split the fatal_assert message into two lines
(closes #78)
2012-03-24 11:14:42 -04:00
Keegan McAllister 84b4330ba2 Actually print the message on fatal_assert failure 2012-03-24 11:14:30 -04:00
Quentin Smith 10332ec61f Handle platforms (like Darwin 9) that do not have posix_memalign 2012-03-23 02:17:29 -04:00
Keith Winstein 26fc88634d Update documentation to version 1.1 2012-03-22 19:09:40 -04:00
Keith Winstein ab94397726 Fix copy-paste error in port argument check 2012-03-21 22:45:58 -04:00
Keith Winstein 0b0ff72f40 Don't display blue "Connecting..." bar immediately 2012-03-21 19:21:02 -04:00
Keith Winstein 00561a95d3 No need to reset scrolling region on close -- we always clean this up 2012-03-21 19:01:35 -04:00
Keith Winstein 76612229d5 Change shutdown sequence (take away DECSTR) 2012-03-21 18:59:04 -04:00
Keegan McAllister 9f38c76699 Explicitly disable dumping core (closes #72)
This is a precaution to avoid saving sensitive data to disk, e.g. session keys.
We expect that corefiles are not world readable, but they're still sitting on
the physical disk and it's safer just to disable creating them.

GitHub issue #71 deals with a similar concern.
2012-03-21 18:41:51 -04:00
Keith Winstein ec0c8c8984 Allow immediate return on initial spins 2012-03-21 18:00:36 -04:00
Keith Winstein ad3877626d Use _exit() for hygiene (per Anders Kaseorg) 2012-03-21 17:32:46 -04:00
Keith Winstein 6842dbf066 Startup script quoting cleanups per Anders Kaseorg 2012-03-21 17:19:12 -04:00
Keegan McAllister 4eb3cace0b Use the PRNG class for chaff
In particular, srand( time( NULL ) ) is very predictable.

[keithw@mit.edu -- modified to use byte PRNG from /dev/urandom]
2012-03-19 23:12:07 -04:00
Keith Winstein 40d69da5e6 Add PRNG reading from /dev/urandom
[Keegan: various small changes]
2012-03-19 23:12:07 -04:00
Keith Winstein e4780c5d05 Invalidate cursor location (but don't actually move cursor) after scroll reset 2012-03-18 16:26:16 -04:00
Keith Winstein 231c181101 Scroll only scrolled region (fixes #31 github issue) 2012-03-18 16:07:23 -04:00
Keith Winstein 483bfe9f0f Make make_chaff() static class function to fix spurious clang warning 2012-03-18 14:11:49 -04:00