Commit Graph

274 Commits

Author SHA1 Message Date
John Hood 8ca8a54e11 Split a long printf format string. 2017-08-06 22:21:38 -04:00
John Hood 2b724d5868 Simplify some conditionals in terminaloverlay.cc. 2017-08-02 22:56:19 -04:00
John Hood 42d2b5d029 Use shared_ptr and references for Actions.
This slows terminal emulation slightly.
2017-08-02 22:07:02 -04:00
John Hood c6c7f09954 Deref a shared pointer in a per-byte loop 2017-08-02 22:07:02 -04:00
John Hood 8f68400c13 Convert new/delete to shared_ptr. 2017-08-02 22:07:02 -04:00
John Hood eef77fd5a5 Convert strdup/free to string 2017-08-02 22:07:02 -04:00
John Hood 4902970486 Fix utempter #ifdefs. 2017-08-02 22:07:02 -04:00
John Hood c49c67cecf --predict-overwrite was still inserting one column sometimes. Fix. 2017-08-02 21:56:32 -04:00
John Hood 8aac3cc927 Allow non-inserting prediction.
This may be useful for users who find prediction's activity right of
the cursor distracting.

Prediction underscoring is still a little weird sometimes, it replays
a history of known/unknown changes as acks come in from the server.
2017-08-02 00:31:37 -04:00
John Hood 91de8901f5 Don't do prediction on large pastes into mosh-client.
Fixes #482, memory use blowup on large pastes.  mosh is still pretty slow
about copying pastes through, though.
2017-08-02 00:31:37 -04:00
John Hood 48e9dd169f Reformat printed strings in source
Consolidate multiple printfs.
Break up multiline strings with string concatentation, for better
 clarity and shorter lines.
Use fputs where appropriate.

This also has the benefit of producing a single constant string with
copyright and versions in the binaries.
2017-08-02 00:02:52 -04:00
Adrien Destugues aa74af9a34 Fix build on Haiku.
- Look for socket in libnetwork
- Look for forkpty in libbsd
2017-04-24 22:40:31 -04:00
John Hood 32b1e6ee4b Print {,/var}/run/motd.dynamic on Ubuntu. 2017-04-24 22:40:30 -04:00
John Hood 3f0ac51071 Don't print /etc/motd on IllumOS. 2017-04-24 22:40:30 -04:00
Jérémie Courrèges-Anglas c0bf8053b2 Remove deprecated pledge("ioctl")
Unbreaks mosh on recent (> 2017/03/18) OpenBSD systems.
2017-03-20 09:54:33 -04:00
John Hood a993c83632 Handle GCC 7's new -Wimplicit-fallthrough. 2017-01-31 22:12:27 -05:00
John Hood bb54325dc9 s/geteuid/getuid/ for correct user lookups
Addresses an issue mentioned in #193.
2016-11-23 17:03:45 -05:00
John Hood 24eb5a7544 Remove a Network::Exception that isn't one.
Code smell pointed out by Coverity.
2016-11-19 21:11:04 -05:00
Anders Kaseorg 94027efc45 Make all commands properly support --help and --version
These should output to stdout and exit with status 0.  Passing
std-options to AM_INIT_AUTOMAKE causes ‘make installcheck’ (hence also
‘make distcheck’) to verify this.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2016-11-19 17:15:48 -05:00
John Hood 302c7deb41 Describe Cell width as a narrow/wide boolean.
A character cell can only be either narrow or wide.  It's more
convenient to represent that as an int containing 1 or 2, but slightly
more correct to represent it as a "boolean" single-bit integer.
2016-11-17 00:56:31 -05:00
John Hood 9ffbeddbc8 Put spin debug under -vv flag, and add to mosh-client 2016-11-06 06:15:41 -05:00
John Hood 22f5d58144 Exit gracefully on pty write or ioctl failure.
Fixes #821, OS X abnormal exit on client input at mosh-server
shutdown.  On OpenIndiana, TIOCG[GS]WINSZ also fail in this situation.
2016-11-06 06:14:02 -05:00
John Hood 795549aafb OpenIndiana pid_t is long int 2016-11-06 06:09:49 -05:00
John Hood 1077db41b6 Support OpenBSD 6.0 pledge() syscall for sandboxing. 2016-09-19 13:23:16 -04:00
John Hood 39ea3d9512 Fix excess newlines on mosh startup/shutdown.
Fixes #788.

This also works around issues with remote pty typeahead echo corrupting output
from mosh-server.
2016-09-19 13:23:16 -04:00
John Hood 70d48fbcc0 Add --no-ssh-pty option.
This eliminates issues with typeahead being echoed by the remote pty
and corrupting remote output from mosh-server to the mosh script, but
cannot be made default because older mosh-servers require a pty.
2016-09-19 13:23:15 -04:00
John Hood 4ad131a55d Fix lost MOSH CONNECT on FreeBSD 11
This moves all routine stdout/stderr output into the parent
server, and adds tcdrain(), even though this may be a
FreeBSD pty bug.
2016-09-18 01:53:36 -04:00
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