Commit Graph

247 Commits

Author SHA1 Message Date
John Hood 882539884e Remove unnecessary usage of #include <iostream>. Rename templated impls from .cc to -impl.h. 2016-05-14 00:10:59 -04:00
John Hood 9a6e0d576d Coverity fixes: deref of NULL pointers
We were potentially passing (char *)NULL to string constructors.
2016-05-10 23:58:56 -04:00
John Hood da30bb74a2 Coverity fixes: deref of stale pointer
I think this one was actually impossible to trigger.
2016-05-10 23:57:29 -04:00
Jaeho Shin d636845c8d Display original command line argv via no-op flag.
Improves 679b819216 to make it simpler to
ignore mosh-client from OS X Terminal.app's "Ask before closing" process
list. (See: http://superuser.com/a/254647)

Moreover, the command displayed from ps is a completely functional one,
which was not the case in the previous approach, that mangles `argv[0]`.

Fixes #742.
2016-05-08 23:05:36 -04:00
John Hood 880c639361 Include POSIX header strings.h for strncasecmp()
Motivated by Cygwin.
2016-05-08 20:46:58 -04:00
John Hood d4832ca63a Fix bugs in resize handling.
* A resize action could be applied to the framebuffer but discarded
  before being applied to termios, causing them to be out of sync.

* Only every second action was skipped, instead of skipping
  consecutive resize actions, as intended.

Found by inspection, not seen in actual usage or by the window-resize
test.
2016-03-30 23:52:19 -04:00
John Hood 1de6575e59 mosh-server.cc: Do not start user shell until network session starts 2016-03-30 23:52:19 -04:00
John Hood ca21788c96 Remove usage of exceptional fdsets with select(). 2016-01-11 04:35:21 -05:00
John Hood 2ac3bbeb9b Fix prediction unicode bug. Make all Cell members private.
Fixes #702.
2015-12-24 22:27:17 -05:00
John Hood 90a529b18a Fix broken compile on Ubuntu 12.04 2015-12-07 00:25:47 -05:00
john hood 8609f88207 mosh-server: Fix hang with ^S on OS X and FreeBSD.
Fixes #692.
2015-12-06 19:09:42 -05:00
John Hood 551b77f27e Remove display-posterizing code. It's been dead 3 years.
Signed-off-by: John Hood <cgull@glup.org>
2015-12-06 19:03:36 -05:00
John Hood 1e003b0e76 mosh-server: skip redundant resize requests
This might reduce redraw activity on window resize, especially for
slow servers.
2015-12-06 17:47:11 -05:00
John Hood 992fec1f30 e2e-test: Add check for Instruction verification failures. 2015-12-06 17:47:11 -05:00
John Hood b41bad918d Make Terminal::Framebuffer::Rows shared and copy-on-write.
* Support both std:: and std::tr1:: shared_ptr. FreeBSD 10 now uses C++11 by default.
* Remove Framebuffer pointers in STMClient
2015-12-06 17:42:34 -05:00
John Hood 32afa96111 Change Framebuffer's containers/methods to improve performance.
* Reduce the size of Terminal::Cell.
* Change colors and attributes in Terminal::Rendition to bitfields/bitmask.
* Change Cells to use UTF-8 strings instead of vector<wchar_t>.  Store Rows in a vector instead of a deque.
* Add various Framebuffer::append() methods for more efficient passing of single and repeated characters.
* Change title/icon strings from deques to a vector typedef-- this is more for tidiness than any real performance.
2015-12-06 17:42:34 -05:00
John Hood 8fdcdc88cd Isolated algorithmic improvements.
* Fix inefficient STL use around Parser::UTF8Parser.
* Reduce typeid() usage, change some of it to a virtual method
* Do multiple-line scrolls as a single move
2015-12-06 17:42:34 -05:00
John Hood b742e958b6 mosh-server: Support timeouts on lost connectivity to network client.
Closes #690.
2015-11-24 02:36:08 -05:00
Andrew Chin 8b5b7aedfa Make --help or -h work again
Also make --help go to stdout, but everywhere else print_help is used,
     go to stderr

Signed-off-by: Andrew Chin <achin@eminence32.net>
2015-11-01 01:09:00 -04:00
John Hood 0eb614809a Add configurable support for Apple Common Crypto and Nettle libraries. 2015-10-16 19:00:42 -04:00
John Hood 5959342ac7 mosh-client: return meaningful exitstatus on network setup/teardown or other failure 2015-10-03 03:43:18 -04:00
John Hood 7fb542c874 Change SSH_CONNECTION fallback to allow IPv6 2015-10-03 03:43:18 -04:00
Anders Kaseorg 10dd74c016 NotificationEngine: Fix -Weffc++ warning
Fixes warning: ‘Overlay::NotificationEngine::escape_key_string’ should
be initialized in the member initialization list.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2015-06-11 01:16:52 -04:00
John Hood fc80eaaecf Show the escape key properly when server unavailable.
Fixes #624.

Signed-off-by: John Hood <cgull@glup.org>
2015-06-11 00:49:06 -04:00
Keith Winstein 2e4e601468 mosh-server.cc: compare like types.
Fixes #626 (resize not working) introduced by 543f346a
2015-06-09 15:17:48 -07:00
John Hood 543f346ac7 Fix various new compiler warnings.
terminalfunctions.cc: set_if_available() was undeclared.
Fix printf() wint_t/wchar_t warnings.
mosh-server.cc: Fix warning for side effects inside typeid().

Signed-off-by: John Hood <cgull@glup.org>
2015-06-06 13:12:32 -04:00
Anders Kaseorg b604a7d7c2 Respect HOME environment variable if set
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2015-06-05 22:53:31 -04:00
Anders Kaseorg 9019f62bf6 Respect SHELL environment variable if set
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2015-06-05 22:53:31 -04:00
Anders Kaseorg cd2ae36f36 Mark local functions as static
This helps to catch unused functions like the former mosh_read_line,
allows the compiler to make better inlining decisions, and reduces the
binary size a bit.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2015-06-04 23:52:03 -04:00
Anders Kaseorg a52b095f50 mosh-server: Remove unused mosh_read_line function
This function is buggy.  feof(file) does not become true until after
we’ve tried to read past the last character; it should instead be
checking the getc return value for EOF (which is distinct from any
unsigned char).  Really it should just be replaced by istream
&std::getline(istream &is, string &str).  Fortunately, it’s unused so
we can just delete it.

Resolves a truncated stdio return value issue found by Coverity Scan
service.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2015-06-04 23:50:40 -04:00
Anders Kaseorg c03bacd0c9 mosh-server: Catch exception for parsing nonintegral number of colors
Print a real error message instead of abnormally aborting.  Found by
Coverity Scan service.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2015-06-04 23:50:40 -04:00
Geoffrey Thomas a38b6f61d5 STMClient::process_network_input: Return void, instead of always true
This function has never in its history had a codepath returning false.
2015-06-04 23:47:32 -04:00
Geoffrey Thomas b5ac92491c Throw std::exception subclasses instead of std::strings
Now everything we throw or catch ourselves is a subclass of
std::exception.
2015-06-04 23:47:32 -04:00
Geoffrey Thomas aeffb71cfc Style cleanup: "foo &x", not "foo& x" 2015-06-04 23:47:32 -04:00
Geoffrey Thomas 5721b392ab Make all exception classes inherit from std::exception
This refactors out a very common pattern of formatting "%s: %s" with
e.function.c_str() and strerror( e.the_errno ) into just the what()
method of NetworkException. It's also a prerequisite for making cleaner
public API for any exceptions we throw, and allows us to more easily
get exceptions passed back to us to handle.
2015-06-04 23:47:31 -04:00
john hood f3073bbe5d Add git commit version info 2015-05-25 03:46:48 -04:00
John Hood fdf8e427c3 OpenBSD: Use snprintf, not sprintf (PORT) 2015-05-25 02:17:24 -04:00
Richard Woodbury cd1317b273 Conditionally rename main to mosh_main for building under NaCl. 2014-04-26 20:50:01 +00:00
Anders Kaseorg 50152bfcba mosh-client: Catch all exceptions when ensuring client is shut down
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2014-01-08 18:54:40 -05:00
Anders Kaseorg 56837881fc Fix MOSH_ESCAPE_KEY validation
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2014-01-08 18:52:08 -05:00
Igor Bukanov 96bf5af1b4 mosh-server: allow startup with PTY with zero width or height like Emacs shell.
Closes #472
Closes #473
2014-01-04 02:55:17 -05:00
Anders Kaseorg 553918d3f2 Connection: Support IPv6 addresses
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2013-08-17 09:02:44 -04:00
Anders Kaseorg c1f96b37a1 Connection: Store the port number as a string
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2013-08-17 08:26:30 -04:00
Anders Kaseorg 9187e307c6 mosh-client: Print exceptions after the client is shut down
Otherwise the printed exception may be immediately hidden when the
terminal exits alternate screen mode.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2013-08-17 08:26:30 -04:00
Keith Winstein 45bba44c83 mosh-server: Allow startup without PTY 2013-07-15 11:20:07 -04:00
Timo J. Rinne f960a8bcf5 mosh-client: Make terminal escape character configurable
Uses environment variable MOSH_ESCAPE_KEY. Defaults to current Ctrl-^
which is somewhat problematic for many non-US keyboards.

Signed-off-by: Timo J. Rinne <tri@iki.fi>

Closes #425. Closes #215.
2013-05-17 15:05:33 -04:00
Alexander Chernyakhovsky 172b1e5cef Cast time_elapsed to int before calling human_readable_duration
When attempting to build againt EPEL 5, it was noticed that
human_readable_duration expects an int, but time_elapsed is an
integer.  Explicitly static_cast<int>( time_elapsed ) to appease older
compilers.
2013-03-27 02:15:25 -04:00
Keith Winstein 61c6ee6011 Send SIGSTOP to whole process group on suspend (closes #401) 2013-03-27 00:26:59 -04:00
Keith Winstein abf240768f Cleanups when suspending/resuming with smcup/rmcup 2013-03-11 01:25:18 -04:00
Keith Winstein 093bbc9111 Detached warning: Omit spurious utmp entries (generated by screen) 2013-03-10 16:31:37 -04:00