Commit Graph

260 Commits

Author SHA1 Message Date
Keegan McAllister c8fe5a3999 mosh-client: Return true for still_connecting if !network
Fixes:

    $ MOSH_KEY=foo ./mosh-client 127.0.0.1 60010
    Crypto exception: Key must be 22 letters long.
    Segmentation fault

Closes #189.
2012-04-16 03:46:09 -04:00
Keith Winstein cca925e020 Reset prediction engine after size has changed (i.e. after Resize is applied) 2012-04-16 03:06:11 -04:00
Keith Winstein 119bbcaced Add nicer message and 15s timeout if server can't be reached on UDP.
(Closes #152)
2012-04-16 02:31:27 -04:00
Ed Schouten 033953dcd2 Don't leak utmpx entries on shutdown.
As far as I know, for all implementations of libutempter, the
utempter_remove_added_record() function depends on the file descriptor
passed to utempter_add_record() to still be valid. The reason for this,
is that this file descriptor is propagated to the setuid utility that is
responsible for modifying utmpx.

Modify the code to remove the utmpx entry before closing the
pseudo-terminal master device. While there, simply use
utempter_remove_record(), which takes the file descriptor explicitly.
The advantage is that this prevents potential foot-shooting in the
future. Visual inspection of the source code will make it more obvious
that utempter depends on the file descriptor.

Closes #179.
2012-04-16 01:37:48 -04:00
Keith Winstein 7103c5f48b Using fclose() instead of close() means future fprintf() doesn't kill us on Mac. 2012-04-15 23:25:21 -04:00
Keegan McAllister cd2d482484 Don't use *_t for our own typedefs
It's reserved by POSIX.

(closes #158 pull request)
2012-04-15 13:50:18 -04:00
Keegan McAllister 280400152d Replace one find_if with a loop
g++/libstdc++ 4.1.2 is unhappy with this use of bind2nd, possibly because the
argument is a reference.  This is a problem for EL5.
2012-04-15 13:49:15 -04:00
Keegan McAllister 8bcc001b52 Remove Boost entirely 2012-04-15 13:49:15 -04:00
Keegan McAllister 2675f13676 Remove boost::lambda remaining instances from terminaloverlay.cc 2012-04-15 13:49:15 -04:00
Keegan McAllister 06fa8eaedb Remove boost::lambda from PredictionEngine::get_or_make_row 2012-04-15 13:49:15 -04:00
Keegan McAllister 5f1bc88ed8 Remove boost::lambda with for_each in terminaloverlay.cc 2012-04-15 13:49:15 -04:00
Keegan McAllister 8f099cafbb Remove boost::lambda from ConditionalOverlayCell::get_validity 2012-04-15 13:49:15 -04:00
Keegan McAllister 4152af9c8e Remove BOOST_AUTO from terminaloverlay.cc 2012-04-15 13:49:15 -04:00
Keith Winstein cc8b1f293a Forcibly detach earlier in blind effort to fix #114 (needs testing) 2012-04-15 12:38:48 -04:00
Keith Winstein 8f60f7ab05 Convey locale-related environment variables as backup, and nicer error.
Fixes #74.
2012-04-14 16:56:48 -04:00
Keith Winstein 597756b846 Document new -v (verbose) server switch. 2012-04-14 13:56:46 -04:00
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 d0a818d2e2 Track icon name and window title separately. Implement MOSH_TITLE_NOPREFIX 2012-04-14 01:55:28 -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
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
Keith Winstein 4d9483bc83 Fix build when libutil.h exists but is deprecated 2012-04-07 20:23:59 -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
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
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
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
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
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
Keith Winstein 9d7d47c57d Count colors locally. Server advertises xterm-256color only when necessary. 2012-03-18 05:47:26 -04:00
Keith Winstein 262a19e5d9 Give mosh-client option to print number of colors 2012-03-18 04:53:14 -04:00
Keith Winstein cbeda2d2fe Don't die immediately on broken command 2012-03-18 03:53:01 -04:00
Keith Winstein 89d1c88bcf More robust option parsing and redo wrapper 2012-03-18 03:23:58 -04:00
Keith Winstein 0e5fd920b1 New option-parsing for mosh-server 2012-03-18 03:13:50 -04:00
Keith Winstein cf017cd99c Don't try to parse single -- as IP address 2012-03-18 02:38:45 -04:00
Keith Winstein 452ff9f992 Require at least one element of command 2012-03-18 02:31:40 -04:00