Commit Graph

418 Commits

Author SHA1 Message Date
Keith Winstein 0e9be1b471 Close terminal fd's to properly detach on old sshd (e.g. RHEL/CentOS 5.0).
May help some sufferers of #114 github issue.
2012-04-14 12:37:28 -04:00
Keith Winstein 1823f7e860 Provide more helpful error message on lack of -t argument. 2012-04-14 12:29:05 -04:00
Keith Winstein 5c20c8d4be Keep using OSC 0 when possible to preserve compability with older clients.
Re: #137
2012-04-14 02:11:31 -04:00
Keith Winstein d0a818d2e2 Track icon name and window title separately. Implement MOSH_TITLE_NOPREFIX 2012-04-14 01:55:28 -04:00
Keith Winstein 53f79e4261 Fix vttest "Funny scrolling regions" by ignoring some invalid scroll regions
Addresses #155 github issue.
2012-04-14 01:11:57 -04:00
Keith Winstein 45487f6623 Handle crazy cursor more gracefully (closes #168) 2012-04-13 14:03:16 -04:00
Keith Winstein 7be90ae244 Close server-related file descriptors before executing child process
Closes #170 github issue.
2012-04-13 13:48:56 -04:00
Keegan McAllister 0eec0b60f0 Linux: Use our own signalfd wrapper, rather than libstddjb
selfpipe already does a fine job of interfacing to signalfd.  But Debian and
Ubuntu want us to depend on the skalibs-dev package rather than build libstddjb
ourselves.  That would be fine except that skalibs-dev has static libraries
only, and they aren't built with -fPIC.  This interferes with building
mosh-{client,server} as position-independent executables, which is a desirable
security measure.

So we have our own wrapper, which invokes either signalfd or selfpipe.  And we
build it ourselves with our own flags, because it's part of the Mosh project
proper.

(closes #108)
2012-04-13 12:33:21 -04:00
Keegan McAllister d2434d1a79 Check compiler support for -fno-default-inline and -pipe
clang was spewing warnings about the unrecognized -fno-default-inline.  (Oddly,
it warns only with -c, not when compiling directly to an executable.)  For
completeness we also check -pipe, even though clang is OK with that one.

It should be fine to omit either flag.  gcc -fno-default-inline drops the
implicit 'inline' annotation on functions defined inside a class scope, but
'inline' is only a hint anyway.  -fno-default-inline does not change linkage.
-pipe is merely a compile speed optimization.
2012-04-13 12:27:27 -04:00
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