[-]
[+]
|
Changed |
mosh.changes
|
|
[-]
[+]
|
Changed |
mosh.spec
^
|
|
[-]
[+]
|
Deleted |
mosh-1.2.4.tar.gz/conf/bash_completion.d
^
|
-(directory)
|
[-]
[+]
|
Deleted |
mosh-1.2.4.tar.gz/conf/bash_completion.d/mosh
^
|
@@ -1 +0,0 @@
-complete -F _known_hosts mosh
|
[-]
[+]
|
Deleted |
mosh-1.2.4.tar.gz/scripts/mosh
^
|
@@ -1,308 +0,0 @@
-#!/usr/bin/env perl
-
-# Mosh: the mobile shell
-# Copyright 2012 Keith Winstein
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# In addition, as a special exception, the copyright holders give
-# permission to link the code of portions of this program with the
-# OpenSSL library under certain conditions as described in each
-# individual source file, and distribute linked combinations including
-# the two.
-#
-# You must obey the GNU General Public License in all respects for all
-# of the code used other than OpenSSL. If you modify file(s) with this
-# exception, you may extend this exception to your version of the
-# file(s), but you are not obligated to do so. If you do not wish to do
-# so, delete this exception statement from your version. If you delete
-# this exception statement from all source files in the program, then
-# also delete it here.
-
-my $MOSH_VERSION = '1.2.4';
-
-use warnings;
-use strict;
-use Socket;
-use Getopt::Long;
-
-$|=1;
-
-my $client = 'mosh-client';
-my $server = 'mosh-server';
-
-my $predict = undef;
-
-my $port_request = undef;
-
-my $ssh = 'ssh';
-
-my $term_init = 1;
-
-my $help = undef;
-my $version = undef;
-
-my @cmdline = @ARGV;
-
-my $usage =
-qq{Usage: $0 [options] [--] [user@]host [command...]
- --client=PATH mosh client on local machine
- (default: "mosh-client")
- --server=COMMAND mosh server on remote machine
- (default: "mosh-server")
-
- --predict=adaptive local echo for slower links [default]
--a --predict=always use local echo even on fast links
--n --predict=never never use local echo
- --predict=experimental aggressively echo even when incorrect
-
--p PORT[:PORT2]
- --port=PORT[:PORT2] server-side UDP port or range
-
- --ssh=COMMAND ssh command to run when setting up session
- (example: "ssh -p 2222")
- (default: "ssh")
-
- --no-init do not send terminal initialization string
-
- --help this message
- --version version and copyright information
-
-Please report bugs to mosh-devel\@mit.edu.
-Mosh home page: http://mosh.mit.edu\n};
-
-my $version_message = qq{mosh $MOSH_VERSION
-Copyright 2012 Keith Winstein <mosh-devel\@mit.edu>
-License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
-This is free software: you are free to change and redistribute it.
-There is NO WARRANTY, to the extent permitted by law.\n};
-
-sub predict_check {
- my ( $predict, $env_set ) = @_;
-
- if ( not exists { adaptive => 0, always => 0,
- never => 0, experimental => 0 }->{ $predict } ) {
- my $explanation = $env_set ? " (MOSH_PREDICTION_DISPLAY in environment)" : "";
- print STDERR qq{$0: Unknown mode \"$predict\"$explanation.\n\n};
-
- die $usage;
- }
-}
-
-GetOptions( 'client=s' => \$client,
- 'server=s' => \$server,
- 'predict=s' => \$predict,
- 'port=s' => \$port_request,
- 'a' => sub { $predict = 'always' },
- 'n' => sub { $predict = 'never' },
- 'p=s' => \$port_request,
- 'ssh=s' => \$ssh,
- 'init!' => \$term_init,
- 'help' => \$help,
- 'version' => \$version,
- 'fake-proxy!' => \my $fake_proxy ) or die $usage;
-
-die $usage if ( defined $help );
-die $version_message if ( defined $version );
-
-if ( defined $predict ) {
- predict_check( $predict, 0 );
-} elsif ( defined $ENV{ 'MOSH_PREDICTION_DISPLAY' } ) {
- $predict = $ENV{ 'MOSH_PREDICTION_DISPLAY' };
- predict_check( $predict, 1 );
-} else {
- $predict = 'adaptive';
- predict_check( $predict, 0 );
-}
-
-if ( defined $port_request ) {
- if ( $port_request =~ m{^(\d+)(:(\d+))?$} ) {
- my ( $low, $clause, $high ) = ( $1, $2, $3 );
- # good port or port-range
- if ( $low <= 0 or $low > 65535 ) {
- die "$0: Server-side (low) port ($low) must be within valid range [1..65535].\n";
- }
- if ( defined $high ) {
- if ( $high <= 0 or $high > 65535 ) {
- die "$0: Server-side high port ($high) must be within valid range [1..65535].\n";
- }
- if ( $low > $high ) {
- die "$0: Server-side port range ($port_request): low port greater than high port.\n";
- }
- }
- } else {
- die "$0: Server-side port or range ($port_request) is not valid.\n";
- }
-}
-
-delete $ENV{ 'MOSH_PREDICTION_DISPLAY' };
-
-if ( defined $fake_proxy ) {
- use Errno qw(EINTR);
- use IO::Socket::INET;
- use POSIX qw(_exit);
-
- my ( $host, $port ) = @ARGV;
-
- # Resolve hostname
- my $packed_ip = gethostbyname $host;
- if ( not defined $packed_ip ) {
- die "$0: Could not resolve hostname $host\n";
- }
- my $ip = inet_ntoa $packed_ip;
-
- print STDERR "MOSH IP $ip\n";
-
- # Act like netcat
- my $sock = IO::Socket::INET->new( PeerAddr => $ip,
- PeerPort => $port,
- Proto => "tcp" )
- or die "$0: connect to host $ip port $port: $!\n";
- binmode($sock);
- binmode(STDIN);
- binmode(STDOUT);
-
- sub cat {
- my ( $from, $to ) = @_;
- while ( my $n = $from->sysread( my $buf, 4096 ) ) {
- next if ( $n == -1 && $! == EINTR );
- $n >= 0 or last;
- $to->write( $buf ) or last;
- }
- }
-
- defined( my $pid = fork ) or die "$0: fork: $!\n";
- if ( $pid == 0 ) {
- cat $sock, \*STDOUT; $sock->shutdown( 0 );
- _exit 0;
- }
- $SIG{ 'HUP' } = 'IGNORE';
- cat \*STDIN, $sock; $sock->shutdown( 1 );
- waitpid $pid, 0;
- exit;
-}
-
-if ( scalar @ARGV < 1 ) {
- die $usage;
-}
-
|
[-]
[+]
|
Deleted |
mosh-1.2.4.tar.gz/src/network/networktransport.cc
^
|
@@ -1,204 +0,0 @@
-/*
- Mosh: the mobile shell
- Copyright 2012 Keith Winstein
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of portions of this program with the
- OpenSSL library under certain conditions as described in each
- individual source file, and distribute linked combinations including
- the two.
-
- You must obey the GNU General Public License in all respects for all
- of the code used other than OpenSSL. If you modify file(s) with this
- exception, you may extend this exception to your version of the
- file(s), but you are not obligated to do so. If you do not wish to do
- so, delete this exception statement from your version. If you delete
- this exception statement from all source files in the program, then
- also delete it here.
-*/
-
-#include <iostream>
-
-#include "networktransport.h"
-
-#include "transportsender.cc"
-
-using namespace Network;
-using namespace std;
-
-template <class MyState, class RemoteState>
-Transport<MyState, RemoteState>::Transport( MyState &initial_state, RemoteState &initial_remote,
- const char *desired_ip, const char *desired_port )
- : connection( desired_ip, desired_port ),
- sender( &connection, initial_state ),
- received_states( 1, TimestampedState<RemoteState>( timestamp(), 0, initial_remote ) ),
- receiver_quench_timer( 0 ),
- last_receiver_state( initial_remote ),
- fragments(),
- verbose( false )
-{
- /* server */
-}
-
-template <class MyState, class RemoteState>
-Transport<MyState, RemoteState>::Transport( MyState &initial_state, RemoteState &initial_remote,
- const char *key_str, const char *ip, int port )
- : connection( key_str, ip, port ),
- sender( &connection, initial_state ),
- received_states( 1, TimestampedState<RemoteState>( timestamp(), 0, initial_remote ) ),
- receiver_quench_timer( 0 ),
- last_receiver_state( initial_remote ),
- fragments(),
- verbose( false )
-{
- /* client */
-}
-
-template <class MyState, class RemoteState>
-void Transport<MyState, RemoteState>::recv( void )
-{
- string s( connection.recv() );
- Fragment frag( s );
-
- if ( fragments.add_fragment( frag ) ) { /* complete packet */
- Instruction inst = fragments.get_assembly();
-
- if ( inst.protocol_version() != MOSH_PROTOCOL_VERSION ) {
- throw NetworkException( "mosh protocol version mismatch", 0 );
- }
-
- sender.process_acknowledgment_through( inst.ack_num() );
-
- /* inform network layer of roundtrip (end-to-end-to-end) connectivity */
- connection.set_last_roundtrip_success( sender.get_sent_state_acked_timestamp() );
-
- /* first, make sure we don't already have the new state */
- for ( typename list< TimestampedState<RemoteState> >::iterator i = received_states.begin();
- i != received_states.end();
- i++ ) {
- if ( inst.new_num() == i->num ) {
- return;
- }
- }
-
- /* now, make sure we do have the old state */
- bool found = 0;
- typename list< TimestampedState<RemoteState> >::iterator reference_state = received_states.begin();
- while ( reference_state != received_states.end() ) {
- if ( inst.old_num() == reference_state->num ) {
- found = true;
- break;
- }
- reference_state++;
- }
-
- if ( !found ) {
- // fprintf( stderr, "Ignoring out-of-order packet. Reference state %d has been discarded or hasn't yet been received.\n", int(inst.old_num) );
- return; /* this is security-sensitive and part of how we enforce idempotency */
- }
-
- /* Do not accept state if our queue is full */
- /* This is better than dropping states from the middle of the
- queue (as sender does), because we don't want to ACK a state
- and then discard it later. */
-
- process_throwaway_until( inst.throwaway_num() );
-
- if ( received_states.size() > 1024 ) { /* limit on state queue */
- uint64_t now = timestamp();
- if ( now < receiver_quench_timer ) { /* deny letting state grow further */
- if ( verbose ) {
- fprintf( stderr, "[%u] Receiver queue full, discarding %d (malicious sender or long-unidirectional connectivity?)\n",
- (unsigned int)(timestamp() % 100000), (int)inst.new_num() );
- }
- return;
- } else {
- receiver_quench_timer = now + 15000;
- }
- }
-
- /* apply diff to reference state */
- TimestampedState<RemoteState> new_state = *reference_state;
- new_state.timestamp = timestamp();
- new_state.num = inst.new_num();
-
- if ( !inst.diff().empty() ) {
- new_state.state.apply_string( inst.diff() );
- }
-
- /* Insert new state in sorted place */
- for ( typename list< TimestampedState<RemoteState> >::iterator i = received_states.begin();
- i != received_states.end();
- i++ ) {
- if ( i->num > new_state.num ) {
- received_states.insert( i, new_state );
- if ( verbose ) {
- fprintf( stderr, "[%u] Received OUT-OF-ORDER state %d [ack %d]\n",
- (unsigned int)(timestamp() % 100000), (int)new_state.num, (int)inst.ack_num() );
- }
- return;
- }
- }
- if ( verbose ) {
- fprintf( stderr, "[%u] Received state %d [coming from %d, ack %d]\n",
- (unsigned int)(timestamp() % 100000), (int)new_state.num, (int)inst.old_num(), (int)inst.ack_num() );
- }
- received_states.push_back( new_state );
- sender.set_ack_num( received_states.back().num );
-
- sender.remote_heard( new_state.timestamp );
- if ( !inst.diff().empty() ) {
- sender.set_data_ack();
- }
- }
-}
-
-/* The sender uses throwaway_num to tell us the earliest received state that we need to keep around */
-template <class MyState, class RemoteState>
-void Transport<MyState, RemoteState>::process_throwaway_until( uint64_t throwaway_num )
-{
- typename list< TimestampedState<RemoteState> >::iterator i = received_states.begin();
- while ( i != received_states.end() ) {
- typename list< TimestampedState<RemoteState> >::iterator inext = i;
- inext++;
- if ( i->num < throwaway_num ) {
- received_states.erase( i );
- }
- i = inext;
- }
-
- fatal_assert( received_states.size() > 0 );
-}
-
-template <class MyState, class RemoteState>
-string Transport<MyState, RemoteState>::get_remote_diff( void )
-{
- /* find diff between last receiver state and current remote state, then rationalize states */
-
- string ret( received_states.back().state.diff_from( last_receiver_state ) );
-
- const RemoteState *oldest_receiver_state = &received_states.front().state;
-
- for ( typename list< TimestampedState<RemoteState> >::reverse_iterator i = received_states.rbegin();
- i != received_states.rend();
- i++ ) {
- i->state.subtract( oldest_receiver_state );
- }
|
[-]
[+]
|
Deleted |
mosh-1.2.4.tar.gz/src/network/transportsender.cc
^
|
@@ -1,400 +0,0 @@
-/*
- Mosh: the mobile shell
- Copyright 2012 Keith Winstein
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of portions of this program with the
- OpenSSL library under certain conditions as described in each
- individual source file, and distribute linked combinations including
- the two.
-
- You must obey the GNU General Public License in all respects for all
- of the code used other than OpenSSL. If you modify file(s) with this
- exception, you may extend this exception to your version of the
- file(s), but you are not obligated to do so. If you do not wish to do
- so, delete this exception statement from your version. If you delete
- this exception statement from all source files in the program, then
- also delete it here.
-*/
-
-#include <algorithm>
-#include <list>
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-
-#include "transportsender.h"
-#include "transportfragment.h"
-
-#include <limits.h>
-
-using namespace Network;
-using namespace std;
-
-template <class MyState>
-TransportSender<MyState>::TransportSender( Connection *s_connection, MyState &initial_state )
- : connection( s_connection ),
- current_state( initial_state ),
- sent_states( 1, TimestampedState<MyState>( timestamp(), 0, initial_state ) ),
- assumed_receiver_state( sent_states.begin() ),
- fragmenter(),
- next_ack_time( timestamp() ),
- next_send_time( timestamp() ),
- verbose( false ),
- shutdown_in_progress( false ),
- shutdown_tries( 0 ),
- shutdown_start( -1 ),
- ack_num( 0 ),
- pending_data_ack( false ),
- SEND_MINDELAY( 8 ),
- last_heard( 0 ),
- prng(),
- mindelay_clock( -1 )
-{
-}
-
-/* Try to send roughly two frames per RTT, bounded by limits on frame rate */
-template <class MyState>
-unsigned int TransportSender<MyState>::send_interval( void ) const
-{
- int SEND_INTERVAL = lrint( ceil( connection->get_SRTT() / 2.0 ) );
- if ( SEND_INTERVAL < SEND_INTERVAL_MIN ) {
- SEND_INTERVAL = SEND_INTERVAL_MIN;
- } else if ( SEND_INTERVAL > SEND_INTERVAL_MAX ) {
- SEND_INTERVAL = SEND_INTERVAL_MAX;
- }
-
- return SEND_INTERVAL;
-}
-
-/* Housekeeping routine to calculate next send and ack times */
-template <class MyState>
-void TransportSender<MyState>::calculate_timers( void )
-{
- uint64_t now = timestamp();
-
- /* Update assumed receiver state */
- update_assumed_receiver_state();
-
- /* Cut out common prefix of all states */
- rationalize_states();
-
- if ( pending_data_ack && (next_ack_time > now + ACK_DELAY) ) {
- next_ack_time = now + ACK_DELAY;
- }
-
- if ( !(current_state == sent_states.back().state) ) {
- if ( mindelay_clock == uint64_t( -1 ) ) {
- mindelay_clock = now;
- }
-
- next_send_time = max( mindelay_clock + SEND_MINDELAY,
- sent_states.back().timestamp + send_interval() );
- } else if ( !(current_state == assumed_receiver_state->state)
- && (last_heard + ACTIVE_RETRY_TIMEOUT > now) ) {
- next_send_time = sent_states.back().timestamp + send_interval();
- if ( mindelay_clock != uint64_t( -1 ) ) {
- next_send_time = max( next_send_time, mindelay_clock + SEND_MINDELAY );
- }
- } else if ( !(current_state == sent_states.front().state )
- && (last_heard + ACTIVE_RETRY_TIMEOUT > now) ) {
- next_send_time = sent_states.back().timestamp + connection->timeout() + ACK_DELAY;
- } else {
- next_send_time = uint64_t(-1);
- }
-
- /* speed up shutdown sequence */
- if ( shutdown_in_progress || (ack_num == uint64_t(-1)) ) {
- next_ack_time = sent_states.back().timestamp + send_interval();
- }
-}
-
-/* How many ms to wait until next event */
-template <class MyState>
-int TransportSender<MyState>::wait_time( void )
-{
- calculate_timers();
-
- uint64_t next_wakeup = next_ack_time;
- if ( next_send_time < next_wakeup ) {
- next_wakeup = next_send_time;
- }
-
- uint64_t now = timestamp();
-
- if ( !connection->get_has_remote_addr() ) {
- return INT_MAX;
- }
-
- if ( next_wakeup > now ) {
- return next_wakeup - now;
- } else {
- return 0;
- }
-}
-
-/* Send data or an empty ack if necessary */
-template <class MyState>
-void TransportSender<MyState>::tick( void )
-{
- calculate_timers(); /* updates assumed receiver state and rationalizes */
-
- if ( !connection->get_has_remote_addr() ) {
- return;
- }
-
- uint64_t now = timestamp();
-
- if ( (now < next_ack_time)
- && (now < next_send_time) ) {
- return;
- }
-
- /* Determine if a new diff or empty ack needs to be sent */
-
- string diff = current_state.diff_from( assumed_receiver_state->state );
-
- attempt_prospective_resend_optimization( diff );
-
- if ( verbose ) {
- /* verify diff has round-trip identity (modulo Unicode fallback rendering) */
- MyState newstate( assumed_receiver_state->state );
- newstate.apply_string( diff );
- if ( current_state.compare( newstate ) ) {
- fprintf( stderr, "Warning, round-trip Instruction verification failed!\n" );
- }
- }
-
- if ( diff.empty() && (now >= next_ack_time) ) {
- send_empty_ack();
- mindelay_clock = uint64_t( -1 );
- } else if ( !diff.empty() && ( (now >= next_send_time)
- || (now >= next_ack_time) ) ) {
- /* Send diffs or ack */
- send_to_receiver( diff );
- mindelay_clock = uint64_t( -1 );
- }
-}
-
-template <class MyState>
-void TransportSender<MyState>::send_empty_ack( void )
-{
- uint64_t now = timestamp();
-
- assert( now >= next_ack_time );
-
- uint64_t new_num = sent_states.back().num + 1;
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/AUTHORS
^
|
@@ -3,3 +3,4 @@
Quentin Smith
Richard Tibbetts
Keegan McAllister
+John Hood
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/ChangeLog
^
|
@@ -1,3 +1,181 @@
+2017-07-21 Keith Winstein <mosh-devel@mit.edu>
+
+ * Version 1.3.2 released.
+
+ * Platform support:
+ * Explicitly enable binding to both IPv4 and IPv6 addresses.
+ (Giel van Schijndel)
+ * Restore perl 5.8.8 support for RHEL5. (Alexander Chernyakhovsky)
+ * Make tests detect UTF-8 locale with a helper executable. (John Hood)
+ * Don't print /etc/motd on IllumOS. (John Hood)
+ * Print {,/var}/run/motd.dynamic on Ubuntu. (John Hood)
+ * Fix build on Haiku. (Adrien Destugues)
+ * Disable unicode-later-combining.test for tmux 2.4.
+ This fixes build failures. (John Hood)
+
+ * Bug fixes:
+ * In tests, explicitly set 80x24 tmux window, for newer versions
+ of tmux. (John Hood)
+ * Work around JuiceSSH rendering bug. (John Hood)
+ * Do not move cursor for SCROLL UP and SCROLL DOWN--
+ fixes an issue with tmux 2.4. (John Hood)
+
+2017-03-25 Keith Winstein <mosh-devel@mit.edu>
+
+ * Version 1.3.0 released.
+
+ * New features:
+ * Change website URLs from http://mosh.mit.edu to
+ https://mosh.org. (Keith Winstein)
+ * Add --no-ssh-pty option for Dropbear compatibility and
+ other issues.
+ * Switch to semantic versioning, making this version 1.3.0
+ instead of 1.2.7.
+
+ * Platform support:
+ * Added nonce-incrementing test. (Keith Winstein)
+ * Add build-source-package.sh for Debian. (Keith Winstein)
+ * Fix CPPFLAGS handling possibly causing curses detection
+ failure. (John Hood)
+ * Add an Appveyor/Cygwin CI build.
+ * Improve warning-flags detection for 'make distcheck'. (John Hood)
+ * Improve robustness of regression tests. (John Hood)
+ * Support OpenBSD pledge() sandboxing. (John Hood)
+ * Use backward-compatible name for AES in
+ AppleCommonCrypto, fixing builds with older OS X SDKs. (John Hood)
+ * Detect clock_gettime() and CLOCK_MONOTONIC carefully,
+ fixing OS X 10.12 + Xcode 7.3 builds. (John Hood)
+ * Support older versions of Perl, back to 5.10, fixing
+ RHEL 5 builds. (Anders Kaseorg)
+ * Add a Travis OS X CI and release build. (John Hood)
+ * Add --help and --version, enabling Automake's
+ 'std-options' checks. (Anders Kaseorg)
+ * Add a simple smoke test not requiring tmux, to help
+ validate builds on older platforms including RHEL 5. (Anders Kaseorg)
+ * Check for presence of clock_gettime() for OS X, where
+ the symbol may not be resolved on older OS X versions. (John
+ Hood)
+ * Fix a memory alignment issue in OCB with ARM/Neon. (Carlos Cabanero)
+ * Mosh now runs correctly on Bash for Windows with Windows 10
+ Insider builds 15002 and higher. (No change in Mosh)
+ * Other minor platform compatibility fixes for Mosh
+ sources and tests. (John Hood)
+
+ * Bug fixes:
+ * Work around a pty buffering issue causing failed
+ connections on FreeBSD 11, or with Dropbear. (John Hood)
+ * Restore '-p 0' option for OS-selected UDP port bindings. (John Hood)
+ * Shell hygiene fixes, including better quoting of
+ pathnames. (Anders Kaseorg)
+ * Fix typos in project docs. (Jakub Wilk)
+ * Fix excess newlines on mosh client startup/shutdown. (John Hood)
+ * Exit gracefully, closing session, on pty write or ioctl failure. (John Hood)
+ * Fix two bugs that caused mosh-server to consume
+ excessive CPU in certain circumstances. (John Hood)
+ * Fix bug that caused text copied from mosh-client to
+ paste as long lines joined by spaces. (John Hood)
+ * Documentation improvements. (chenxiaoqino, Ashish Gupta)
+ * Use getuid(), not geteuid(), for correct getpw* lookups. (John Hood)
+
+2016-08-10 Keith Winstein <mosh-devel@mit.edu>
+
+ * Version 1.2.6 released.
+
+ * New features:
+ * Add Travis CI builds for Linux and Mac. (Anders Kaseorg, others)
+ * Add a --local option to run without ssh. (John Hood)
+ * Mosh now returns exitstatus reflecting connection success.
+ (John Hood)
+ * Add an end-to-end test suite and many tests. (John Hood)
+ * Implement timeouts and signals to help address orphaned sessions.
+ (John Hood)
+ * Major rework of Mosh's display differencing/rendering
+ code with much improved performance for slow machines. (John Hood)
+ * Implement ANSI back/forward tab (CSI CBT, CSI CHT).
+ (John Hood)
+ * Do not start user shell until network session starts.
+ (John Hood)
+ * Add options for more flexible specification of IPv4/IPv6
+ hostname resolution. (John Hood)
+ * Improved bash completion. (Steve Dignam, HIGUCHI Yuta)
+ * Add options for different methods of resolving the remote host
+ address, allowing operation without SshProxyCommand. (John Hood)
+
+ * Platform support:
+ * Add configurable support for Apple Common Crypto and
+ Nettle, in place of OpenSSL. Implement base64 locally.
+ (John Hood)
+ * Workaround Cygwin select() bug. (John Hood)
+ * Updates to Debian packaging. (Anders Kaseorg, Keith Winstein)
+ * Workaround a glibc-2.22 issue causing segfaults on Debian Sid.
+ (John Hood with help from many others)
+ * Prefer c++ to g++, for systems like FreeBSD where g++ is not usable.
+ (John Hood)
+ * Fixes for Illumos Hipster 20151003. (John Hood)
+ * Disable -Werror for protobuf code, to resolve a new gcc6 warning.
+ (John Hood)
+ * Link test for -fstack-protector-all on an embedded platform.
+ (Baruch Siach)
+ * Resolve issue with bswap64() on FreeBSD-CURRENT with libc++-3.8.0.
+ (John Hood)
+ * Fix issue with RECVTOS error message on client on FreeBSD.
+ (John Hood)
+
+ * Bug fixes:
+ * Remove an assertion causing aborts on Unicode fallback found by
+ fuzzing with afl. (Keith Winstein)
+ * Fix a server hang with XON/XOFF on BSD systems. (John Hood)
+ * Fix a typeahead-prediction bug that caused display corruption on
+ urxvt. (John Hood)
+
+2015-07-12 Keith Winstein <mosh-devel@mit.edu>
+
+ * Version 1.2.5 released.
+
+ * New features:
+ * Bind to a specific IP address with --bind-server. (Philipp
+ Haselwarter)
+ * MOSH_ESCAPE_KEY configures escape character. (Timo
+ J. Rinne)
+ * Support non-roaming IPv6. (Anders Kaseorg)
+ * Implement XTerm mouse mode. (Barosl LEE, Andrew Chin,
+ Louis Kruger)
+ * Report Git revision along with version if available.
+ (John Hood)
+
+ * Platform support:
+ * Add pselect() emulation. (Jérémie Courrèges-Anglas)
+ * OpenBSD, OS X: Fix be64toh-related issues. (Jérémie
+ Courrèges-Anglas)
+ * ARM Neon: fix gcc4.8 compiling problem(Pasi Sjöholm)
+ * NaCl: Conditionally rename main to mosh_main. (Richard
+ Woodbury)
+ * FreeBSD: Token pasting, forkpty(), ARM fixes. (John Hood)
+ * AIX: Implement CTTY grabbing when TIOCSCTTY is missing
+ (Anton Lundin)
+ * OS X: Broaden build support to cover OS X 10.5 through
+ 10.10. (John Hood)
+ * Debian: Improve bash-completion install and
+ functionality. (Suggested by Gabriel Filion, John Hood)
+
+ * Bug fixes:
+ * Automake/autoconf workarounds. (Anders Kaseorg)
+ * mosh-server: Allow startup without PTY. (Keith Winstein)
+ * network.cc: Properly close old fd on Socket assignment
+ operator. (Thanks to Igor Bukanov)
+ * mosh-server: Allow startup with zero-window-size PTY.
+ (Igor Bukanov)
+ * AddrInfo: Fix error message generation when node == NULL
+ (Anders Kaseorg)
+ * Timestamp: Prevent integer overflow on Darwin PPC 32-bit
+ (Anders Kaseorg)
+ * scripts/mosh: Fix hang when remote closes the connection
+ (Anders Kaseorg)
+ * Fix issues with parsing of 256-color SGR sequences.
+ (John Hood)
+ * Numerous code hygiene, Coverity, and Clang static analyzer
+ fixes. (Anders Kaseorg, Geoffrey Thomas, John Hood)
+
2013-03-27 Keith Winstein <mosh-devel@mit.edu>
* Version 1.2.4 released.
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/Makefile.am
^
|
@@ -1,3 +1,45 @@
ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = src scripts man conf
+SUBDIRS = scripts src man conf
EXTRA_DIST = autogen.sh ocb-license.html README.md COPYING.iOS
+BUILT_SOURCES = version.h
+CLANG_SCAN_BUILD = scan-build
+AM_DISTCHECK_CONFIGURE_FLAGS = --enable-compile-warnings=distcheck --enable-examples
+
+.PHONY: VERSION
+
+VERSION:
+ @echo @PACKAGE_STRING@ > VERSION.dist
+ @set -e; if git describe --dirty --always > VERSION.git 2>&1 && \
+ [ -z `git rev-parse --show-prefix` ]; then \
+ if ! diff -q VERSION.git VERSION > /dev/null 2>&1; then \
+ mv -f VERSION.git VERSION; \
+ fi; \
+ elif ! diff -q VERSION.dist VERSION > /dev/null 2>&1; then \
+ mv -f VERSION.dist VERSION; \
+ fi
+ @rm -f VERSION.dist VERSION.git
+
+version.h: VERSION
+ @printf '#define BUILD_VERSION "%s"\n' "$$(cat VERSION)" > version.h.new
+ @set -e; if ! diff -q version.h version.h.new > /dev/null 2>&1; then \
+ mv -f version.h.new version.h; \
+ fi
+ @rm -f version.h.new
+
+clean-local:
+ @rm -rf version.h VERSION cov-int mosh-coverity.txz
+
+cppcheck: $(BUILT_SOURCES) config.h
+ cppcheck --enable=all --template=gcc -include config.h -I . \
+ -I src/crypto -I src/frontend -I src/network -I src/protobufs \
+ -I src/statesync -I src/terminal -I src/util \
+ -I /usr/include -I /usr/include/google/protobuf -I/usr/include/openssl \
+ .
+
+cov-build: $(BUILT_SOURCES) config.h
+ $(MAKE) clean && rm -rf cov-int && \
+ cov-build --dir cov-int $(MAKE) check && \
+ tar -caf mosh-coverity.txz cov-int
+
+scan-build: $(BUILT_SOURCES) config.h
+ $(MAKE) clean && $(CLANG_SCAN_BUILD) $(MAKE) check
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/Makefile.in
^
|
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,23 +14,61 @@
@SET_MAKE@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
esac; \
- test $$am__dry = yes; \
- }
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -49,10 +86,6 @@
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = .
-DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \
- $(srcdir)/Makefile.in $(srcdir)/config.h.in \
- $(top_srcdir)/configure AUTHORS COPYING ChangeLog NEWS THANKS \
- ar-lib depcomp install-sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_check_library.m4 \
@@ -61,27 +94,36 @@
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
+ $(am__configure_deps) $(am__DIST_COMMON)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
+am__v_at_1 =
SOURCES =
DIST_SOURCES =
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
- html-recursive info-recursive install-data-recursive \
- install-dvi-recursive install-exec-recursive \
- install-html-recursive install-info-recursive \
- install-pdf-recursive install-ps-recursive install-recursive \
- installcheck-recursive installdirs-recursive pdf-recursive \
- ps-recursive uninstall-recursive
+RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
+ ctags-recursive dvi-recursive html-recursive info-recursive \
+ install-data-recursive install-dvi-recursive \
+ install-exec-recursive install-html-recursive \
+ install-info-recursive install-pdf-recursive \
+ install-ps-recursive install-recursive installcheck-recursive \
+ installdirs-recursive pdf-recursive ps-recursive \
+ tags-recursive uninstall-recursive
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -89,12 +131,37 @@
esac
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
-AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
- $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
- distdir dist dist-all distcheck
+am__recursive_targets = \
+ $(RECURSIVE_TARGETS) \
+ $(RECURSIVE_CLEAN_TARGETS) \
+ $(am__extra_recursive_targets)
+AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
+ cscope distdir dist dist-all distcheck
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
+ $(LISP)config.h.in
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
+CSCOPE = cscope
DIST_SUBDIRS = $(SUBDIRS)
+am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in AUTHORS \
+ COPYING ChangeLog NEWS THANKS ar-lib compile install-sh \
+ missing
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
@@ -104,6 +171,7 @@
&& rm -rf "$(distdir)" \
|| { sleep 5 && rm -rf "$(distdir)"; }; \
else :; fi
+am__post_remove_distdir = $(am__remove_distdir)
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
@@ -131,6 +199,7 @@
reldir="$$dir2"
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
+DIST_TARGETS = dist-gzip
distuninstallcheck_listfiles = find . -type f -print
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/README.md
^
|
@@ -1,3 +1,5 @@
+[![Build Status](https://travis-ci.org/mobile-shell/mosh.svg?branch=master)](https://travis-ci.org/mobile-shell/mosh)
+
Mosh: the mobile shell
======================
@@ -57,7 +59,7 @@
Getting Mosh
------------
- [The Mosh web site](http://mosh.mit.edu/#getting) has information about
+ [The Mosh web site](https://mosh.org/#getting) has information about
packages for many operating systems, as well as instructions for building
from source.
@@ -82,8 +84,8 @@
select alternate locations. More options are documented in the mosh(1) manual
page.
- There are [more examples](http://mosh.mit.edu/#usage) and a
- [FAQ](http://mosh.mit.edu/#faq) on the Mosh web site.
+ There are [more examples](https://mosh.org/#usage) and a
+ [FAQ](https://mosh.org/#faq) on the Mosh web site.
How it works
------------
@@ -104,6 +106,7 @@
To function, Mosh requires UDP datagrams to be passed between client
and server. By default, `mosh` uses a port number between 60000 and
61000, but the user can select a particular port with the -p option.
+ Please note that the -p option has no effect on the port used by SSH.
Advice to distributors
----------------------
@@ -136,21 +139,26 @@
intensive and mostly sits idle when the user is not typing, we think
the results suggest that `-O2` (the default) is preferable.
+Our Debian and Fedora packaging presents Mosh as a single package.
+Mosh has a Perl dependency that is only required for client use. For
+some platforms, it may make sense to have separate mosh-server and
+mosh-client packages to allow mosh-server usage without Perl.
+
More info
---------
* Mosh Web site:
- <http://mosh.mit.edu>
+ <https://mosh.org>
* `mosh-devel@mit.edu` mailing list:
- <http://mailman.mit.edu/mailman/listinfo/mosh-devel>
+ <https://mailman.mit.edu/mailman/listinfo/mosh-devel>
* `mosh-users@mit.edu` mailing list:
- <http://mailman.mit.edu/mailman/listinfo/mosh-users>
+ <https://mailman.mit.edu/mailman/listinfo/mosh-users>
- * `#mosh` channel on [Freenode IRC](http://freenode.net/)
+ * `#mosh` channel on [Freenode IRC](https://freenode.net/)
- http://webchat.freenode.net/?channels=mosh
+ https://webchat.freenode.net/?channels=mosh
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/THANKS
^
|
@@ -66,3 +66,33 @@
* Luke Mewburn
* Anton Lundin
+
+* Philipp Haselwarter
+
+* Timo J. Rinne
+
+* Barosl Lee
+
+* Andrew Chin
+
+* Louis Kruger
+
+* Jérémie Courrèges-Anglas
+
+* Pasi Sjöholm
+
+* Richard Woodbury
+
+* Igor Bukanov
+
+* Geoffrey Thomas
+
+* Steve Dignam
+
+* HIGUCHI Yuta
+
+* Baruch Siach
+
+* Adrien Destugues
+
+* Giel van Schijndel
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/aclocal.m4
^
|
@@ -1,8 +1,7 @@
-# generated automatically by aclocal 1.11.6 -*- Autoconf -*-
+# generated automatically by aclocal 1.15 -*- Autoconf -*-
+
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
-# Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -12,33 +11,31 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
+m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
[m4_warning([this file was generated for autoconf 2.69.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
-To do so, use the procedure documented by the package, typically `autoreconf'.])])
+To do so, use the procedure documented by the package, typically 'autoreconf'.])])
-# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 2002-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 1
-
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION],
-[am__api_version='1.11'
+[am__api_version='1.15'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
-m4_if([$1], [1.11.6], [],
+m4_if([$1], [1.15], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@@ -54,19 +51,17 @@
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.11.6])dnl
+[AM_AUTOMAKE_VERSION([1.15])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
-# Copyright (C) 2011 Free Software Foundation, Inc.
+# Copyright (C) 2011-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 1
-
# AM_PROG_AR([ACT-IF-FAIL])
# -------------------------
# Try to determine the archiver interface, and trigger the ar-lib wrapper
@@ -81,7 +76,8 @@
: ${AR=ar}
AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface],
- [am_cv_ar_interface=ar
+ [AC_LANG_PUSH([C])
+ am_cv_ar_interface=ar
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int some_variable = 0;]])],
[am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD'
AC_TRY_EVAL([am_ar_try])
@@ -98,7 +94,7 @@
fi
rm -f conftest.lib libconftest.a
])
- ])
+ AC_LANG_POP([C])])
case $am_cv_ar_interface in
ar)
@@ -122,17 +118,15 @@
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
-# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 1
-
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
-# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
-# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to
+# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
#
# Of course, Automake must honor this variable whenever it calls a
# tool from the auxiliary directory. The problem is that $srcdir (and
@@ -151,7 +145,7 @@
#
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
# are both prefixed by $srcdir. In an in-source build this is usually
-# harmless because $srcdir is `.', but things will broke when you
+# harmless because $srcdir is '.', but things will broke when you
# start a VPATH build or use an absolute $srcdir.
#
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
@@ -169,30 +163,26 @@
# configured tree to be moved without reconfiguration.
AC_DEFUN([AM_AUX_DIR_EXPAND],
-[dnl Rely on autoconf to set up CDPATH properly.
-AC_PREREQ([2.50])dnl
-# expand $ac_aux_dir to an absolute path
-am_aux_dir=`cd $ac_aux_dir && pwd`
+[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+# Expand $ac_aux_dir to an absolute path.
+am_aux_dir=`cd "$ac_aux_dir" && pwd`
])
# AM_CONDITIONAL -*- Autoconf -*-
-# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1997-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 9
-
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
-[AC_PREREQ(2.52)dnl
- ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
- [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+[AC_PREREQ([2.52])dnl
+ m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
AC_SUBST([$1_TRUE])dnl
AC_SUBST([$1_FALSE])dnl
_AM_SUBST_NOTMAKE([$1_TRUE])dnl
@@ -211,16 +201,14 @@
Usually this means the macro was only invoked conditionally.]])
fi])])
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
-# 2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 12
-# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
# will think it sees a *use*, and therefore will trigger all it's
# C support machinery. Also note that it means that autoscan, seeing
@@ -230,7 +218,7 @@
# _AM_DEPENDENCIES(NAME)
# ----------------------
# See how the compiler implements dependency checking.
-# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
# We try a few techniques and use that to set a single cache variable.
#
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
@@ -243,12 +231,13 @@
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
AC_REQUIRE([AM_DEP_TRACK])dnl
-ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
- [$1], CXX, [depcc="$CXX" am_compiler_list=],
- [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
- [$1], UPC, [depcc="$UPC" am_compiler_list=],
- [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
- [depcc="$$1" am_compiler_list=])
+m4_if([$1], [CC], [depcc="$CC" am_compiler_list=],
+ [$1], [CXX], [depcc="$CXX" am_compiler_list=],
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/ar-lib
^
|
@@ -4,7 +4,7 @@
me=ar-lib
scriptversion=2012-03-01.08; # UTC
-# Copyright (C) 2010, 2012 Free Software Foundation, Inc.
+# Copyright (C) 2010-2014 Free Software Foundation, Inc.
# Written by Peter Rosin <peda@lysator.liu.se>.
#
# This program is free software; you can redistribute it and/or modify
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/compile
^
|
@@ -0,0 +1,347 @@
+#! /bin/sh
+# Wrapper for compilers which do not understand '-c -o'.
+
+scriptversion=2012-10-14.11; # UTC
+
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Written by Tom Tromey <tromey@cygnus.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+nl='
+'
+
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent tools from complaining about whitespace usage.
+IFS=" "" $nl"
+
+file_conv=
+
+# func_file_conv build_file lazy
+# Convert a $build file to $host form and store it in $file
+# Currently only supports Windows hosts. If the determined conversion
+# type is listed in (the comma separated) LAZY, no conversion will
+# take place.
+func_file_conv ()
+{
+ file=$1
+ case $file in
+ / | /[!/]*) # absolute file, and not a UNC file
+ if test -z "$file_conv"; then
+ # lazily determine how to convert abs files
+ case `uname -s` in
+ MINGW*)
+ file_conv=mingw
+ ;;
+ CYGWIN*)
+ file_conv=cygwin
+ ;;
+ *)
+ file_conv=wine
+ ;;
+ esac
+ fi
+ case $file_conv/,$2, in
+ *,$file_conv,*)
+ ;;
+ mingw/*)
+ file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
+ ;;
+ cygwin/*)
+ file=`cygpath -m "$file" || echo "$file"`
+ ;;
+ wine/*)
+ file=`winepath -w "$file" || echo "$file"`
+ ;;
+ esac
+ ;;
+ esac
+}
+
+# func_cl_dashL linkdir
+# Make cl look for libraries in LINKDIR
+func_cl_dashL ()
+{
+ func_file_conv "$1"
+ if test -z "$lib_path"; then
+ lib_path=$file
+ else
+ lib_path="$lib_path;$file"
+ fi
+ linker_opts="$linker_opts -LIBPATH:$file"
+}
+
+# func_cl_dashl library
+# Do a library search-path lookup for cl
+func_cl_dashl ()
+{
+ lib=$1
+ found=no
+ save_IFS=$IFS
+ IFS=';'
+ for dir in $lib_path $LIB
+ do
+ IFS=$save_IFS
+ if $shared && test -f "$dir/$lib.dll.lib"; then
+ found=yes
+ lib=$dir/$lib.dll.lib
+ break
+ fi
+ if test -f "$dir/$lib.lib"; then
+ found=yes
+ lib=$dir/$lib.lib
+ break
+ fi
+ if test -f "$dir/lib$lib.a"; then
+ found=yes
+ lib=$dir/lib$lib.a
+ break
+ fi
+ done
+ IFS=$save_IFS
+
+ if test "$found" != yes; then
+ lib=$lib.lib
+ fi
+}
+
+# func_cl_wrapper cl arg...
+# Adjust compile command to suit cl
+func_cl_wrapper ()
+{
+ # Assume a capable shell
+ lib_path=
+ shared=:
+ linker_opts=
+ for arg
+ do
+ if test -n "$eat"; then
+ eat=
+ else
+ case $1 in
+ -o)
+ # configure might choose to run compile as 'compile cc -o foo foo.c'.
+ eat=1
+ case $2 in
+ *.o | *.[oO][bB][jJ])
+ func_file_conv "$2"
+ set x "$@" -Fo"$file"
+ shift
+ ;;
+ *)
+ func_file_conv "$2"
+ set x "$@" -Fe"$file"
+ shift
+ ;;
+ esac
+ ;;
+ -I)
+ eat=1
+ func_file_conv "$2" mingw
+ set x "$@" -I"$file"
+ shift
+ ;;
+ -I*)
+ func_file_conv "${1#-I}" mingw
+ set x "$@" -I"$file"
+ shift
+ ;;
+ -l)
+ eat=1
+ func_cl_dashl "$2"
+ set x "$@" "$lib"
+ shift
+ ;;
+ -l*)
+ func_cl_dashl "${1#-l}"
+ set x "$@" "$lib"
+ shift
+ ;;
+ -L)
+ eat=1
+ func_cl_dashL "$2"
+ ;;
+ -L*)
+ func_cl_dashL "${1#-L}"
+ ;;
+ -static)
+ shared=false
+ ;;
+ -Wl,*)
+ arg=${1#-Wl,}
+ save_ifs="$IFS"; IFS=','
+ for flag in $arg; do
+ IFS="$save_ifs"
+ linker_opts="$linker_opts $flag"
+ done
+ IFS="$save_ifs"
+ ;;
+ -Xlinker)
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/conf/Makefile.am
^
|
@@ -1,3 +1,5 @@
+completionsdir = @completions@
+dist_completions_DATA =
nobase_dist_sysconf_DATA =
if INSTALL_UFW
@@ -5,5 +7,5 @@
endif
if INSTALL_COMPLETION
- nobase_dist_sysconf_DATA += bash_completion.d/mosh
+ dist_completions_DATA += bash-completion/completions/mosh
endif
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/conf/Makefile.in
^
|
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -16,23 +15,61 @@
@SET_MAKE@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
- test $$am__dry = yes; \
- }
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -50,10 +87,8 @@
PRE_UNINSTALL = :
POST_UNINSTALL = :
@INSTALL_UFW_TRUE@am__append_1 = ufw/applications.d/mosh
-@INSTALL_COMPLETION_TRUE@am__append_2 = bash_completion.d/mosh
+@INSTALL_COMPLETION_TRUE@am__append_2 = bash-completion/completions/mosh
subdir = conf
-DIST_COMMON = $(am__nobase_dist_sysconf_DATA_DIST) \
- $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_check_library.m4 \
@@ -62,16 +97,24 @@
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__dist_completions_DATA_DIST) \
+ $(am__nobase_dist_sysconf_DATA_DIST) $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
+am__v_at_1 =
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
@@ -79,8 +122,7 @@
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
-am__nobase_dist_sysconf_DATA_DIST = ufw/applications.d/mosh \
- bash_completion.d/mosh
+am__dist_completions_DATA_DIST = bash-completion/completions/mosh
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -108,8 +150,12 @@
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
-am__installdirs = "$(DESTDIR)$(sysconfdir)"
-DATA = $(nobase_dist_sysconf_DATA)
+am__installdirs = "$(DESTDIR)$(completionsdir)" \
+ "$(DESTDIR)$(sysconfdir)"
+am__nobase_dist_sysconf_DATA_DIST = ufw/applications.d/mosh
+DATA = $(dist_completions_DATA) $(nobase_dist_sysconf_DATA)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+am__DIST_COMMON = $(srcdir)/Makefile.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
@@ -119,13 +165,20 @@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@
+BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CRYPTO_CFLAGS = @CRYPTO_CFLAGS@
+CRYPTO_CPPFLAGS = @CRYPTO_CPPFLAGS@
+CRYPTO_LDFLAGS = @CRYPTO_LDFLAGS@
+CRYPTO_LIBS = @CRYPTO_LIBS@
CURSES_LIB = @CURSES_LIB@
CXX = @CXX@
+CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
@@ -147,14 +200,11 @@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
-LIBUTIL = @LIBUTIL@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MISC_CXXFLAGS = @MISC_CXXFLAGS@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
-OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
-OPENSSL_LIBS = @OPENSSL_LIBS@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
@@ -193,6 +243,7 @@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
+completions = @completions@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
@@ -216,6 +267,7 @@
protobuf_CFLAGS = @protobuf_CFLAGS@
protobuf_LIBS = @protobuf_LIBS@
psdir = @psdir@
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/conf/bash-completion
^
|
+(directory)
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/conf/bash-completion/completions
^
|
+(directory)
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/conf/bash-completion/completions/mosh
^
|
@@ -0,0 +1,31 @@
+# Bash completions for Mosh, the mobile shell. -*- shell-script -*-
+
+__mosh_init_completion()
+{
+ if declare -F _init_completions >/dev/null 2>&1; then
+ _init_completion
+ else
+ COMPREPLY=()
+ _get_comp_words_by_ref cur prev words cword
+ fi
+}
+
+_mosh () {
+ local cur
+
+ __mosh_init_completion || return
+
+ local simple_flags="-a -b -4 -6 -p"
+ local flags="--client= --server= --predict= --family= --port=
+ --bind-server= --ssh= --no-init --help --version"
+
+ if [[ "$cur" == --* && "$COMP_CWORD" == 1 ]]; then
+ COMPREPLY=($(compgen -W "$flags" -- "$cur"))
+ elif [[ "$cur" == -* && "$COMP_CWORD" == 1 ]]; then
+ COMPREPLY=($(compgen -W "$simple_flags" -- "$cur"))
+ else
+ _known_hosts_real -a "$cur"
+ fi
+}
+
+complete -o nospace -F _mosh mosh
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/config.h.in
^
|
@@ -6,15 +6,18 @@
/* Define if libutil.h necessary for forkpty(). */
#undef FORKPTY_IN_LIBUTIL
-/* Define to 1 if you have the <arpa/inet.h> header file. */
-#undef HAVE_ARPA_INET_H
-
/* Define to 1 if you have the `cfmakeraw' function. */
#undef HAVE_CFMAKERAW
-/* Define if clock_gettime is available. */
+/* Define if clock_gettime() is available. */
#undef HAVE_CLOCK_GETTIME
+/* Define to 1 if you have the <CommonCrypto/CommonCrypto.h> header file. */
+#undef HAVE_COMMONCRYPTO_COMMONCRYPTO_H
+
+/* Define to 1 if CRYPTO is found */
+#undef HAVE_CRYPTO
+
/* Define to 1 if a SysV or X/Open compatible Curses library is present */
#undef HAVE_CURSES
@@ -30,6 +33,21 @@
/* Define to 1 if library supports certain obsolete features */
#undef HAVE_CURSES_OBSOLETE
+/* Define to 1 if you have the declaration of `be64toh', and to 0 if you
+ don't. */
+#undef HAVE_DECL_BE64TOH
+
+/* Define to 1 if you have the declaration of `betoh64', and to 0 if you
+ don't. */
+#undef HAVE_DECL_BETOH64
+
+/* Define to 1 if you have the declaration of `bswap64', and to 0 if you
+ don't. */
+#undef HAVE_DECL_BSWAP64
+
+/* Define to 1 if you have the declaration of `ffs', and to 0 if you don't. */
+#undef HAVE_DECL_FFS
+
/* Define to 1 if you have the declaration of `__builtin_bswap64', and to 0 if
you don't. */
#undef HAVE_DECL___BUILTIN_BSWAP64
@@ -50,14 +68,14 @@
/* Define if you have forkpty(). */
#undef HAVE_FORKPTY
-/* Define to 1 if you have the `gettimeofday' function. */
-#undef HAVE_GETTIMEOFDAY
+/* Define to 1 if you have the `getaddrinfo' function. */
+#undef HAVE_GETADDRINFO
-/* Define if htobe64 and friends exist. */
-#undef HAVE_HTOBE64
+/* Define to 1 if you have the `getnameinfo' function. */
+#undef HAVE_GETNAMEINFO
-/* Define to 1 if you have the `inet_ntoa' function. */
-#undef HAVE_INET_NTOA
+/* Define to 1 if you have the `gettimeofday' function. */
+#undef HAVE_GETTIMEOFDAY
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
@@ -95,6 +113,9 @@
/* Define to 1 if you have the `memchr' function. */
#undef HAVE_MEMCHR
+/* Define to 1 if you have the <memory> header file. */
+#undef HAVE_MEMORY
+
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
@@ -119,6 +140,9 @@
/* Define to 1 if <ncurses.h> is present */
#undef HAVE_NCURSES_H
+/* Define to 1 if you have the <netdb.h> header file. */
+#undef HAVE_NETDB_H
+
/* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
@@ -134,9 +158,15 @@
/* Define if pipe2(..., O_CLOEXEC) is available. */
#undef HAVE_PIPE2_CLOEXEC
+/* Define to 1 if you have the `pledge' function. */
+#undef HAVE_PLEDGE
+
/* Define to 1 if you have the `posix_memalign' function. */
#undef HAVE_POSIX_MEMALIGN
+/* Define to 1 if you have the `pselect' function. */
+#undef HAVE_PSELECT
+
/* Define to 1 if you have the <pty.h> header file. */
#undef HAVE_PTY_H
@@ -167,6 +197,12 @@
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
+/* Define if std::shared_ptr is available. */
+#undef HAVE_STD_SHARED_PTR
+
+/* Define if std::tr1::shared_ptr is available. */
+#undef HAVE_STD_TR1_SHARED_PTR
+
/* Define to 1 if you have the `strchr' function. */
#undef HAVE_STRCHR
@@ -224,6 +260,9 @@
/* Define to 1 if TINFO is found */
#undef HAVE_TINFO
+/* Define to 1 if you have the <tr1/memory> header file. */
+#undef HAVE_TR1_MEMORY
+
/* Define to 1 if the system has the type `uintptr_t'. */
#undef HAVE_UINTPTR_T
@@ -287,6 +326,15 @@
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
+/* Use Apple Common Crypto library */
+#undef USE_APPLE_COMMON_CRYPTO_AES
+
+/* Use Nettle library */
+#undef USE_NETTLE_AES
+
+/* Use OpenSSL library */
+#undef USE_OPENSSL_AES
+
/* Version number of package */
#undef VERSION
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/configure
^
|
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for mosh 1.2.4.
+# Generated by GNU Autoconf 2.69 for mosh 1.3.2.
#
# Report bugs to <mosh-devel@mit.edu>.
#
@@ -580,8 +580,8 @@
# Identity of this package.
PACKAGE_NAME='mosh'
PACKAGE_TARNAME='mosh'
-PACKAGE_VERSION='1.2.4'
-PACKAGE_STRING='mosh 1.2.4'
+PACKAGE_VERSION='1.3.2'
+PACKAGE_STRING='mosh 1.3.2'
PACKAGE_BUGREPORT='mosh-devel@mit.edu'
PACKAGE_URL=''
@@ -626,19 +626,24 @@
am__EXEEXT_TRUE
LTLIBOBJS
LIBOBJS
+completions
+BASH_COMPLETION_LIBS
+BASH_COMPLETION_CFLAGS
protobuf_LIBS
protobuf_CFLAGS
-LIBUTIL
+CRYPTO_LDFLAGS
+CRYPTO_CPPFLAGS
+CRYPTO_LIBS
+CRYPTO_CFLAGS
CURSES_LIB
TINFO_LDFLAGS
TINFO_CPPFLAGS
TINFO_LIBS
TINFO_CFLAGS
-OPENSSL_LIBS
-OPENSSL_CFLAGS
PKG_CONFIG_LIBDIR
PKG_CONFIG_PATH
PKG_CONFIG
+CXXCPP
EGREP
GREP
CPP
@@ -730,6 +735,7 @@
docdir
oldincludedir
includedir
+runstatedir
localstatedir
sharedstatedir
sysconfdir
@@ -765,6 +771,7 @@
with_curses
with_ncurses
with_ncursesw
+with_crypto_library
'
ac_precious_vars='build_alias
host_alias
@@ -778,18 +785,23 @@
CXXFLAGS
CCC
CPP
+CXXCPP
PKG_CONFIG
PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR
-OPENSSL_CFLAGS
-OPENSSL_LIBS
TINFO_CFLAGS
TINFO_LIBS
TINFO_CPPFLAGS
TINFO_LDFLAGS
CURSES_LIB
+CRYPTO_CFLAGS
+CRYPTO_LIBS
+CRYPTO_CPPFLAGS
+CRYPTO_LDFLAGS
protobuf_CFLAGS
-protobuf_LIBS'
+protobuf_LIBS
+BASH_COMPLETION_CFLAGS
+BASH_COMPLETION_LIBS'
# Initialize some variables set by options.
@@ -828,6 +840,7 @@
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1080,6 +1093,15 @@
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
+ -runstatedir | --runstatedir | --runstatedi | --runstated \
+ | --runstate | --runstat | --runsta | --runst | --runs \
+ | --run | --ru | --r)
+ ac_prev=runstatedir ;;
+ -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+ | --run=* | --ru=* | --r=*)
+ runstatedir=$ac_optarg ;;
+
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1217,7 +1239,7 @@
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
- libdir localedir mandir
+ libdir localedir mandir runstatedir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
@@ -1330,7 +1352,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures mosh 1.2.4 to adapt to many kinds of systems.
+\`configure' configures mosh 1.3.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1370,6 +1392,7 @@
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -1396,7 +1419,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of mosh 1.2.4:";;
+ short | recursive ) echo "Configuration of mosh 1.3.2:";;
esac
cat <<\_ACEOF
@@ -1404,11 +1427,13 @@
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --enable-silent-rules less verbose build output (undo: `make V=1')
- --disable-silent-rules verbose build output (undo: `make V=0')
- --disable-dependency-tracking speeds up one-time build
- --enable-dependency-tracking do not reject slow dependency extractors
- --enable-compile-warnings[=no/yes/maximum/error]
+ --enable-silent-rules less verbose build output (undo: "make V=1")
+ --disable-silent-rules verbose build output (undo: "make V=0")
+ --enable-dependency-tracking
+ do not reject slow dependency extractors
+ --disable-dependency-tracking
+ speeds up one-time build
+ --enable-compile-warnings[=no/yes/maximum/error/distcheck]
Turn on compiler warnings
--enable-hardening Enable compiler and linker options to frustrate
memory corruption exploits [yes]
@@ -1427,6 +1452,10 @@
--with-curses=DIR Where curses is installed
--with-ncurses force the use of Ncurses or NcursesW
--without-ncursesw do not use NcursesW (wide character support)
+ --with-crypto-library=library
+ build with the given crypto library,
+ TYPE=openssl|nettle|apple-common-crypto
+ [default=openssl]
Some influential environment variables:
CC C compiler command
@@ -1439,15 +1468,12 @@
CXX C++ compiler command
CXXFLAGS C++ compiler flags
CPP C preprocessor
+ CXXCPP C++ preprocessor
PKG_CONFIG path to pkg-config utility
PKG_CONFIG_PATH
directories to add to pkg-config's search path
PKG_CONFIG_LIBDIR
path overriding pkg-config's built-in search path
- OPENSSL_CFLAGS
- C compiler flags for OPENSSL, overriding pkg-config
- OPENSSL_LIBS
- linker flags for OPENSSL, overriding pkg-config
TINFO_CFLAGS
C compiler flags for TINFO, overriding pkg-config
TINFO_LIBS linker flags for TINFO, overriding pkg-config
@@ -1456,10 +1482,21 @@
TINFO_LDFLAGS
linker flags for TINFO libraries
CURSES_LIB linker library for Curses, e.g. -lcurses
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/configure.ac
^
|
@@ -2,16 +2,16 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.61])
-AC_INIT([mosh], [1.2.4], [mosh-devel@mit.edu])
-AM_INIT_AUTOMAKE([-Wall -Werror foreign])
+AC_INIT([mosh], [1.3.2], [mosh-devel@mit.edu])
+AM_INIT_AUTOMAKE([foreign std-options -Wall -Werror])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_CONFIG_SRCDIR([src/frontend/mosh-client.cc])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
-AC_PROG_CC
-AC_PROG_CXX
+AC_PROG_CC([cc gcc clang])
+AC_PROG_CXX([c++ g++ clang++])
AC_PROG_RANLIB
AC_PATH_PROG([PROTOC], [protoc], [])
AS_IF([test x"$PROTOC" = x],
@@ -22,8 +22,9 @@
WARNING_CXXFLAGS=""
PICKY_CXXFLAGS=""
+DISTCHECK_CXXFLAGS=""
AC_ARG_ENABLE([compile-warnings],
- [AS_HELP_STRING([--enable-compile-warnings@<:@=no/yes/maximum/error@:>@],
+ [AS_HELP_STRING([--enable-compile-warnings@<:@=no/yes/maximum/error/distcheck@:>@],
[Turn on compiler warnings])],
[case "$enableval" in
no)
@@ -33,11 +34,23 @@
;;
maximum)
WARNING_CXXFLAGS="-Wall"
- PICKY_CXXFLAGS="-Wextra -pedantic -Wno-long-long -Weffc++"
+ PICKY_CXXFLAGS="-Wextra -pedantic -Wno-long-long -Weffc++ -Wmissing-declarations"
;;
error)
WARNING_CXXFLAGS="-Wall -Werror"
- PICKY_CXXFLAGS="-Wextra -pedantic -Wno-long-long -Weffc++"
+ PICKY_CXXFLAGS="-Wextra -pedantic -Wno-long-long -Weffc++ -Wmissing-declarations"
+ ;;
+ distcheck)
+ WARNING_CXXFLAGS="-Wall -Werror"
+ PICKY_CXXFLAGS="-Wextra -pedantic -Wno-long-long -Weffc++ -Wmissing-declarations"
+ AC_LANG_PUSH(C++)
+ AX_CHECK_COMPILE_FLAG([-Wno-error=unused-parameter],
+ [PICKY_CXXFLAGS="$PICKY_CXXFLAGS -Wno-error=unused-parameter"], [], [-Werror])
+ AX_CHECK_COMPILE_FLAG([-Wno-error=c++11-extensions],
+ [PICKY_CXXFLAGS="$PICKY_CXXFLAGS -Wno-error=c++11-extensions"], [], [-Werror])
+ AX_CHECK_COMPILE_FLAG([-Wno-error=deprecated-declarations],
+ [PICKY_CXXFLAGS="$PICKY_CXXFLAGS -Wno-error=deprecated-declarations"], [], [-Werror])
+ AC_LANG_POP(C++)
;;
*)
AC_MSG_ERROR([Unknown argument '$enableval' to --enable-compile-warnings])
@@ -86,7 +99,7 @@
# This one will likely succeed, even on platforms where it does nothing.
check_cc_cxx_flag([-D_FORTIFY_SOURCE=2], [HARDEN_CFLAGS="$HARDEN_CFLAGS -D_FORTIFY_SOURCE=2"])
- check_cc_cxx_flag([-fstack-protector-all],
+ check_link_flag([-fstack-protector-all],
[HARDEN_CFLAGS="$HARDEN_CFLAGS -fstack-protector-all"
check_cc_cxx_flag([-Wstack-protector], [HARDEN_CFLAGS="$HARDEN_CFLAGS -Wstack-protector"],
[], [-fstack-protector-all])
@@ -166,17 +179,43 @@
AC_SEARCH_LIBS([compress], [z], , [AC_MSG_ERROR([Unable to find zlib.])])
-AC_SEARCH_LIBS([socket], [socket])
+AC_SEARCH_LIBS([socket], [socket network])
AC_SEARCH_LIBS([inet_addr], [nsl])
+AC_SEARCH_LIBS([clock_gettime], [rt])
+
# Checks for header files.
-AC_CHECK_HEADERS([arpa/inet.h fcntl.h langinfo.h limits.h locale.h netinet/in.h stddef.h stdint.h inttypes.h stdlib.h string.h sys/ioctl.h sys/resource.h sys/socket.h sys/stat.h sys/time.h termios.h unistd.h wchar.h wctype.h], [], [AC_MSG_ERROR([Missing required header file.])])
+AC_CHECK_HEADERS(m4_normalize([
+ fcntl.h
+ langinfo.h
+ limits.h
+ locale.h
+ netdb.h
+ netinet/in.h
+ stddef.h
+ stdint.h
+ inttypes.h
+ stdlib.h
+ string.h
+ sys/ioctl.h
+ sys/resource.h
+ sys/socket.h
+ sys/stat.h
+ sys/time.h
+ termios.h
+ unistd.h
+ wchar.h
+ wctype.h
+ ]), [], [AC_MSG_ERROR([Missing required header file.])])
AC_CHECK_HEADERS([pty.h util.h libutil.h paths.h])
AC_CHECK_HEADERS([endian.h sys/endian.h])
AC_CHECK_HEADERS([utmpx.h])
AC_CHECK_HEADERS([termio.h])
AC_CHECK_HEADERS([sys/uio.h])
+AC_LANG_PUSH(C++)
+AC_CHECK_HEADERS([memory tr1/memory])
+AC_LANG_POP(C++)
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
@@ -195,11 +234,31 @@
# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_MBRTOWC
-AC_CHECK_FUNCS([gettimeofday setrlimit inet_ntoa iswprint memchr memset nl_langinfo posix_memalign setenv setlocale sigaction socket strchr strdup strncasecmp strtok strerror strtol wcwidth cfmakeraw])
-
-AC_SEARCH_LIBS([clock_gettime], [rt], [AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Define if clock_gettime is available.])])
-
-PKG_CHECK_MODULES([OPENSSL], [openssl])
+AC_CHECK_FUNCS(m4_normalize([
+ gettimeofday
+ setrlimit
+ iswprint
+ memchr
+ memset
+ nl_langinfo
+ posix_memalign
+ setenv
+ setlocale
+ sigaction
+ socket
+ strchr
+ strdup
+ strncasecmp
+ strtok
+ strerror
+ strtol
+ wcwidth
+ cfmakeraw
+ pselect
+ getaddrinfo
+ getnameinfo
+ pledge
+ ]))
# Start by trying to find the needed tinfo parts by pkg-config
PKG_CHECK_MODULES([TINFO], [tinfo],
@@ -226,7 +285,7 @@
old_LDFLAGS="$LDFLAGS"
old_CPPFLAGS="$CPPFLAGS"
LDFLAGS="$LDFLAGS $CURSES_LDFLAGS"
- CPPFLAGS="$LDFLAGS $CURSES_CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $CURSES_CPPFLAGS"
AX_WITH_CURSES
# restore old LDFLAGS/CPPFLAGS
@@ -241,16 +300,60 @@
fi
fi
+dnl Default to OpenSSL, or OS X crypto library if found
+AC_CHECK_HEADERS([CommonCrypto/CommonCrypto.h],
+ [default_crypto_library="apple-common-crypto"],
+ [default_crypto_library="openssl"]
+)
+
+dnl Allow user to select over the default.
+AC_ARG_WITH(
+ [crypto-library],
+ [AS_HELP_STRING([--with-crypto-library=library], [build with the given crypto library, TYPE=openssl|nettle|apple-common-crypto @<:@default=openssl@:>@])],
+ [
+ case "${withval}" in
+ openssl|nettle|apple-common-crypto) ;;
+ *) AC_MSG_ERROR([bad value ${withval} for --with-crypto-library]) ;;
+ esac
+ ],
+ [with_crypto_library="$default_crypto_library"]
+)
+
+dnl Checks for chosen crypto library
+case "${with_crypto_library}" in
+ openssl)
+ PKG_CHECK_MODULES([CRYPTO], [openssl],
+ [AC_DEFINE([USE_OPENSSL_AES], [1], [Use OpenSSL library])],
+ [AX_CHECK_LIBRARY([CRYPTO], [openssl/aes.h], [crypto],
+ [AC_DEFINE([USE_OPENSSL_AES], [1], [Use OpenSSL library])
+ AC_SUBST([CRYPTO_CFLAGS], ["$CRYPTO_CPPFLAGS"])
+ AC_SUBST([CRYPTO_LIBS], ["$CRYPTO_LDFLAGS -lcrypto"])],
+ [AC_MSG_ERROR([OpenSSL crypto library not found])])])
+ ;;
+ nettle)
+ PKG_CHECK_MODULES([CRYPTO], [nettle],
+ [],
+ [AC_MSG_ERROR([Nettle crypto library not found])])
+ AC_DEFINE([USE_NETTLE_AES], [1], [Use Nettle library])
+ ;;
+ apple-common-crypto)
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/depcomp
^
|
@@ -1,10 +1,9 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
-scriptversion=2012-03-27.16; # UTC
+scriptversion=2013-05-30.07; # UTC
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
-# 2011, 2012 Free Software Foundation, Inc.
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,9 +27,9 @@
case $1 in
'')
- echo "$0: No command. Try '$0 --help' for more information." 1>&2
- exit 1;
- ;;
+ echo "$0: No command. Try '$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
@@ -57,11 +56,65 @@
;;
esac
+# Get the directory component of the given path, and save it in the
+# global variables '$dir'. Note that this directory component will
+# be either empty or ending with a '/' character. This is deliberate.
+set_dir_from ()
+{
+ case $1 in
+ */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
+ *) dir=;;
+ esac
+}
+
+# Get the suffix-stripped basename of the given path, and save it the
+# global variable '$base'.
+set_base_from ()
+{
+ base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
+}
+
+# If no dependency file was actually created by the compiler invocation,
+# we still have to create a dummy depfile, to avoid errors with the
+# Makefile "include basename.Plo" scheme.
+make_dummy_depfile ()
+{
+ echo "#dummy" > "$depfile"
+}
+
+# Factor out some common post-processing of the generated depfile.
+# Requires the auxiliary global variable '$tmpdepfile' to be set.
+aix_post_process_depfile ()
+{
+ # If the compiler actually managed to produce a dependency file,
+ # post-process it.
+ if test -f "$tmpdepfile"; then
+ # Each line is of the form 'foo.o: dependency.h'.
+ # Do two passes, one to just change these to
+ # $object: dependency.h
+ # and one to simply output
+ # dependency.h:
+ # which is needed to avoid the deleted-header problem.
+ { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
+ sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
+ } > "$depfile"
+ rm -f "$tmpdepfile"
+ else
+ make_dummy_depfile
+ fi
+}
+
# A tabulation character.
tab=' '
# A newline character.
nl='
'
+# Character ranges might be problematic outside the C locale.
+# These definitions help.
+upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
+lower=abcdefghijklmnopqrstuvwxyz
+digits=0123456789
+alpha=${upper}${lower}
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
@@ -75,6 +128,9 @@
rm -f "$tmpdepfile"
+# Avoid interferences from the environment.
+gccflag= dashmflag=
+
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
@@ -86,32 +142,32 @@
fi
if test "$depmode" = dashXmstdout; then
- # This is just like dashmstdout with a different argument.
- dashmflag=-xM
- depmode=dashmstdout
+ # This is just like dashmstdout with a different argument.
+ dashmflag=-xM
+ depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
- # This is just like msvisualcpp but w/o cygpath translation.
- # Just convert the backslash-escaped backslashes to single forward
- # slashes to satisfy depend.m4
- cygpath_u='sed s,\\\\,/,g'
- depmode=msvisualcpp
+ # This is just like msvisualcpp but w/o cygpath translation.
+ # Just convert the backslash-escaped backslashes to single forward
+ # slashes to satisfy depend.m4
+ cygpath_u='sed s,\\\\,/,g'
+ depmode=msvisualcpp
fi
if test "$depmode" = msvc7msys; then
- # This is just like msvc7 but w/o cygpath translation.
- # Just convert the backslash-escaped backslashes to single forward
- # slashes to satisfy depend.m4
- cygpath_u='sed s,\\\\,/,g'
- depmode=msvc7
+ # This is just like msvc7 but w/o cygpath translation.
+ # Just convert the backslash-escaped backslashes to single forward
+ # slashes to satisfy depend.m4
+ cygpath_u='sed s,\\\\,/,g'
+ depmode=msvc7
fi
if test "$depmode" = xlc; then
- # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations.
- gccflag=-qmakedep=gcc,-MF
- depmode=gcc
+ # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
+ gccflag=-qmakedep=gcc,-MF
+ depmode=gcc
fi
case "$depmode" in
@@ -134,8 +190,7 @@
done
"$@"
stat=$?
- if test $stat -eq 0; then :
- else
+ if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
@@ -143,13 +198,17 @@
;;
gcc)
+## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
+## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
+## (see the conditional assignment to $gccflag above).
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
-## -MM, not -M (despite what the docs say).
+## -MM, not -M (despite what the docs say). Also, it might not be
+## supported by the other compilers which use the 'gcc' depmode.
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
@@ -157,15 +216,14 @@
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
- if test $stat -eq 0; then :
- else
+ if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
- alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
-## The second -e expression handles DOS-style file names with drive letters.
+ # The second -e expression handles DOS-style file names with drive
+ # letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the "deleted header file" problem.
@@ -174,15 +232,15 @@
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/install-sh
^
|
@@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
-scriptversion=2011-01-19.21; # UTC
+scriptversion=2014-09-12.12; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@@ -35,25 +35,21 @@
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
+# 'make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
+tab=' '
nl='
'
-IFS=" "" $nl"
+IFS=" $tab$nl"
-# set DOITPROG to echo to test this script
+# Set DOITPROG to "echo" to test this script.
-# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
-if test -z "$doit"; then
- doit_exec=exec
-else
- doit_exec=$doit
-fi
+doit_exec=${doit:-exec}
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
@@ -68,17 +64,6 @@
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
-posix_glob='?'
-initialize_posix_glob='
- test "$posix_glob" != "?" || {
- if (set -f) 2>/dev/null; then
- posix_glob=
- else
- posix_glob=:
- fi
- }
-'
-
posix_mkdir=
# Desired mode of installed file.
@@ -97,7 +82,7 @@
dst_arg=
copy_on_change=false
-no_target_directory=
+is_target_a_directory=possibly
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
@@ -137,46 +122,57 @@
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
- shift;;
+ shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
- case $mode in
- *' '* | *' '* | *'
-'* | *'*'* | *'?'* | *'['*)
- echo "$0: invalid mode: $mode" >&2
- exit 1;;
- esac
- shift;;
+ case $mode in
+ *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
+ echo "$0: invalid mode: $mode" >&2
+ exit 1;;
+ esac
+ shift;;
-o) chowncmd="$chownprog $2"
- shift;;
+ shift;;
-s) stripcmd=$stripprog;;
- -t) dst_arg=$2
- # Protect names problematic for `test' and other utilities.
- case $dst_arg in
- -* | [=\(\)!]) dst_arg=./$dst_arg;;
- esac
- shift;;
+ -t)
+ is_target_a_directory=always
+ dst_arg=$2
+ # Protect names problematic for 'test' and other utilities.
+ case $dst_arg in
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
+ esac
+ shift;;
- -T) no_target_directory=true;;
+ -T) is_target_a_directory=never;;
--version) echo "$0 $scriptversion"; exit $?;;
- --) shift
- break;;
+ --) shift
+ break;;
- -*) echo "$0: invalid option: $1" >&2
- exit 1;;
+ -*) echo "$0: invalid option: $1" >&2
+ exit 1;;
*) break;;
esac
shift
done
+# We allow the use of options -d and -T together, by making -d
+# take the precedence; this is for compatibility with GNU install.
+
+if test -n "$dir_arg"; then
+ if test -n "$dst_arg"; then
+ echo "$0: target directory not allowed when installing a directory." >&2
+ exit 1
+ fi
+fi
+
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
@@ -190,7 +186,7 @@
fi
shift # arg
dst_arg=$arg
- # Protect names problematic for `test' and other utilities.
+ # Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
@@ -202,12 +198,21 @@
echo "$0: no input file specified." >&2
exit 1
fi
- # It's OK to call `install-sh -d' without argument.
+ # It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
+ if test $# -gt 1 || test "$is_target_a_directory" = always; then
+ if test ! -d "$dst_arg"; then
+ echo "$0: $dst_arg: Is not a directory." >&2
+ exit 1
+ fi
+ fi
+fi
+
+if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
@@ -223,16 +228,16 @@
*[0-7])
if test -z "$stripcmd"; then
- u_plus_rw=
+ u_plus_rw=
else
- u_plus_rw='% 200'
+ u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
- u_plus_rw=
+ u_plus_rw=
else
- u_plus_rw=,u+rw
+ u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
@@ -240,7 +245,7 @@
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/man/Makefile.in
^
|
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,23 +14,61 @@
@SET_MAKE@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
- test $$am__dry = yes; \
- }
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -51,8 +88,6 @@
@BUILD_CLIENT_TRUE@am__append_1 = mosh.1 mosh-client.1
@BUILD_SERVER_TRUE@am__append_2 = mosh-server.1
subdir = man
-DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.am \
- $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_check_library.m4 \
@@ -61,16 +96,23 @@
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
+am__v_at_1 =
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
@@ -109,6 +151,8 @@
am__installdirs = "$(DESTDIR)$(man1dir)"
NROFF = nroff
MANS = $(dist_man_MANS)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+am__DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
@@ -118,13 +162,20 @@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@
+BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CRYPTO_CFLAGS = @CRYPTO_CFLAGS@
+CRYPTO_CPPFLAGS = @CRYPTO_CPPFLAGS@
+CRYPTO_LDFLAGS = @CRYPTO_LDFLAGS@
+CRYPTO_LIBS = @CRYPTO_LIBS@
CURSES_LIB = @CURSES_LIB@
CXX = @CXX@
+CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
@@ -146,14 +197,11 @@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
-LIBUTIL = @LIBUTIL@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MISC_CXXFLAGS = @MISC_CXXFLAGS@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
-OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
-OPENSSL_LIBS = @OPENSSL_LIBS@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
@@ -192,6 +240,7 @@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
+completions = @completions@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
@@ -215,6 +264,7 @@
protobuf_CFLAGS = @protobuf_CFLAGS@
protobuf_LIBS = @protobuf_LIBS@
psdir = @psdir@
+runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
@@ -239,7 +289,6 @@
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign man/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign man/Makefile
-.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
@@ -300,27 +349,14 @@
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
-tags: TAGS
-TAGS:
+tags TAGS:
+
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/man/mosh-client.1
^
|
@@ -20,6 +20,7 @@
.SH SYNOPSIS
MOSH_KEY=KEY
.B mosh-client
+[\-v]
IP PORT
.br
.B mosh-client
@@ -27,7 +28,7 @@
.br
.SH DESCRIPTION
\fBmosh-client\fP is a helper program for the
-.BR mosh(1)
+.BR mosh (1)
remote terminal application.
\fBmosh\fP itself is a setup script that establishes an SSH
@@ -49,12 +50,40 @@
With the \-c option, \fBmosh-client\fP instead prints the number of colors
of the terminal given by the TERM environment variable.
+The \-v option will print some debugging information on standard
+error. More instances of this flag will result in more debugging
+information. If standard error is not redirected from the terminal,
+the display will be corrupted and quickly become unusable.
+
+.SH ENVIRONMENT VARIABLES
+
+.TP
+.B MOSH_KEY
+This variable must be set, and must contain a Base64-encoded cryptographic key from
+.BR mosh-server (1).
+
+.TP
+.B MOSH_ESCAPE_KEY
+See
+.BR mosh (1).
+
+.TP
+.B MOSH_PREDICTION_DISPLAY
+Controls local echo as described in
+.BR mosh (1).
+
+.TP
+.B MOSH_TITLE_NOPREFIX
+See
+.BR mosh (1).
+
+
.SH SEE ALSO
.BR mosh (1),
.BR mosh-server (1).
Project home page:
-.I http://mosh.mit.edu
+.I https://mosh.org
.br
.SH AUTHOR
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/man/mosh-server.1
^
|
@@ -62,7 +62,8 @@
.TP
.B \-v
-Print some debugging information even after detaching.
+Print some debugging information even after detaching. More instances
+of this flag will result in more debugging information.
.TP
.B \-i \fIIP\fP
@@ -70,7 +71,8 @@
.TP
.B \-p \fIPORT\fP[:\fIPORT2\fP]
-UDP port number or port-range to bind
+UDP port number or port-range to bind. \fB\-p 0\fP will let the
+operating system pick an available UDP port.
.TP
.B \-c \fICOLORS\fP
@@ -82,6 +84,43 @@
environment, if the startup environment does not specify a character
set of UTF-8.
+.SH ENVIRONMENT VARIABLES
+These variables allow server-side configuration of Mosh's behavior.
+They may be set by administrators in system login/rc files,
+/etc/login.conf, or similar mechanisms, or users in their shell's
+login/rc files. \fBmosh-server\fP passes these variables to the login
+session and shell that it starts, but changing them there will have no
+effect.
+
+.TP
+.B MOSH_SERVER_NETWORK_TMOUT
+If this variable is set to a positive integer number, it specifies how
+long (in seconds) \fBmosh-server\fP will wait to receive an update from the
+client before exiting. Since \fPmosh\fP is very useful for mobile
+clients with intermittent operation and connectivity, we suggest
+setting this variable to a high value, such as 604800 (one week) or
+2592000 (30 days). Otherwise, \fBmosh-server\fP will wait
+indefinitely for a client to reappear. This variable is somewhat
+similar to the \fBTMOUT\fP variable found in many Bourne shells.
+However, it is not a login-session inactivity timeout; it only applies
+to network connectivity.
+
+.TP
+.B MOSH_SERVER_SIGNAL_TMOUT
+If this variable is set to a positive integer number, it specifies how
+long (in seconds) \fBmosh-server\fP will ignore SIGUSR1 while waiting
+to receive an update from the client. Otherwise, \fBSIGUSR1\fP will
+always terminate \fBmosh-server\fP. Users and administrators may
+implement scripts to clean up disconnected Mosh sessions. With this
+variable set, a user or administrator can issue
+
+.nf
+$ pkill -SIGUSR1 mosh-server
+.fi
+
+to kill disconnected sessions without killing connected login
+sessions.
+
.SH EXAMPLE
.nf
@@ -100,7 +139,7 @@
.BR mosh-client (1).
Project home page:
-.I http://mosh.mit.edu
+.I https://mosh.org
.br
.SH AUTHOR
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/man/mosh.1
^
|
@@ -2,7 +2,7 @@
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
-.TH MOSH 1 "October 2012"
+.TH MOSH 1 "April 2013"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@@ -64,6 +64,11 @@
between 60000 and 61000, but allows the user to request a particular
UDP port instead.
+Currently, \fBmosh\fP has limited support for IPv6, dual-stack
+networks, and servers with multiple addresses. At session start, it
+will select a single IPv4 or IPv6 server address to connect to for the
+lifetime of the session.
+
\fBmosh\fP will do its best to arrange a UTF-8 character set locale on
the client and server. The client must have locale-related environment
variables that specify UTF-8. \fBmosh\fP will pass these client
@@ -77,6 +82,10 @@
again.
.SH OPTIONS
+Options named \fB \-\-experimental-*\fP are subject to change or
+removal in future versions of Mosh; their design or function is not
+yet final.
+
.TP
.B \fIcommand\fP
Command to run on remote host. By default, \fBmosh\fP executes a login shell.
@@ -92,6 +101,13 @@
The server helper is unprivileged and can be installed in the user's
home directory.
+This option can be used to set environment variables for the server by
+using the
+.BR env (1)
+command to wrap the actual server command. See
+.BR mosh-server (1)
+for available environment variables.
+
.TP
.B \-\-ssh=\fICOMMAND\fP
OpenSSH command to remotely execute mosh-server on remote machine (default: "ssh")
@@ -99,6 +115,12 @@
An alternate ssh port can be specified with, \fIe.g.\fP, \-\-ssh="ssh \-p 2222".
.TP
+.B \-\-ssh-pty\fP
+.B \-\-no-ssh-pty\fP
+Enable or disable ssh's use of a pty when connecting to a remote host.
+The default is enabled.
+
+.TP
.B \-\-predict=\fIWHEN\fP
Controls use of speculative local echo. WHEN defaults to `adaptive'
(show predictions on slower links and to smooth out network glitches)
@@ -121,12 +143,73 @@
Synonym for \-\-predict=never
.TP
+.B \-\-family=inet
+Only use IPv4 for the SSH connection and Mosh session.
+
+.TP
+.B \-\-family=inet6
+Only use IPv6 for the SSH connection and Mosh session. This and the
+following modes require Perl's IO::Socket::IP or IO::Socket::INET6
+modules.
+
+.TP
+.B \-\-family=auto
+Autodetect IPv4 or IPv6 for hosts that only have addresses
+in a single family. Hosts with both IPv4 and IPv6 addresses will
+raise an error, and require re-invocation of \fBmosh\fP with another
+\fB\-\-family\fP option.
+
+.TP
+.B \-\-family=all
+Choose an address from all available IPv4 or IPv6 address, even for
+dual-stack hosts. This is the most convenient option, but requires
+dual-stack connectivity, and Mosh 1.2.5 or later on the server, when
+roaming with dual-stack servers.
+
+.TP
+.B \-\-family=prefer-inet
+Similar to \fB\-\-family=all\fP, but attempt connects to the IPv4
+addresses first. This is the default.
+
+.TP
+.B \-\-family=prefer-inet6
+Similar to \fB\-\-family=all\fP, but attempt connects to the IPv6
+addresses first.
+
+.TP
+.B \-4
+Synonym for \-\-family=inet
+
+.TP
+.B \-6
+Synonym for \-\-family=inet6
+
+.TP
.B \-p \fIPORT\fP[:\fIPORT2\fP], \-\-port=\fIPORT\fP[:\fIPORT2\fP]
Use a particular server-side UDP port or port range,
for example, if this is the
only port that is forwarded through a firewall to the
-server. Otherwise, \fBmosh\fP will choose a port between 60000 and
-61000.
+server. With \fB\-p 0\fP, the server will let the operating system pick an
+available UDP port. Otherwise, \fBmosh\fP will choose a port between 60000 and
+61000. Please note that this option does not affect the server-side
+port used by SSH.
+
+.TP
+.B \-\-bind\-server={ssh|any|\fIIP\fP}
+Control the IP address that the \fBmosh-server\fP binds to.
+
+The default is `ssh', in which case the server will reply from the IP
+address that the SSH connection came from (as found in the
+\fBSSH_CONNECTION\fP environment variable). This is useful for
+multihomed servers.
+
+With \-\-bind\-server=any, the server will reply on the default interface
+and will not bind to a particular IP address. This can be useful if
+the connection is made through \fBsslh\fP or another tool that makes
+the SSH connection appear to come from localhost.
+
+With \-\-bind\-server=\fIIP\fP, the server will attempt to bind to the
+specified IP address.
.TP
.B \-\-no\-init
@@ -134,18 +217,86 @@
deinitialization string to the client's terminal. On many terminals
this disables alternate screen mode.
+.TP
+.B \-\-local
+Invoke \fBmosh-server\fP locally, without using \fBssh\fP. This
+option requires the \fBhost\fP argument to be a local, numeric
+IPv4/IPv6 address. This option is useful for testing.
+
+.TP
+.B \-\-experimental\-remote\-ip={proxy|local|remote}
+Select the method used to discover the IP address that the
+\fBmosh-client\fP connects to.
+
+The default is \fBproxy\fP, which uses SSH's
+.B \-\-ssh\-proxy\-command
+option to generate and report the exact address that \fBssh\fP uses to
+connect to the remote host. This option is generally the most
+compatible with hosts and other options configured in \fBssh\fP
+configuration files. However, this may not work for some
+configurations, or for environments where a \fBssh\fP bastion host
+forwards to a remote machine. It only works with \fBOpenSSH\fP.
+
+With \fBremote\fP, the server's
+.B SSH_CONNECTION
+environment variable will be used. This is useful for environments
+where \fBssh\fP forwarding is used, or the
+.B \-\-ssh\-proxy\-command
+option is used for other purposes.
+
+With \fBlocal\fP, Mosh resolves the hostname given on its command
+line, and uses that address for both \fBssh\fP and Mosh connections.
+This option ignores any configuration in
+.B ssh_config
+for the same hostname.
+
.SH ESCAPE SEQUENCES
-The escape sequence to shut down the connection is \fBCtrl-^ .\fP
-(typically typed with Ctrl-Shift-6, then a period). To send a literal
-Ctrl-^, type \fBCtrl-^ ^\fP. The sequence \fBCtrl-^ Ctrl-Z\fP suspends the
-client.
+The default escape character used by Mosh is ASCII RS (decimal 30).
+This is typically typed as \fBCtrl-^\fP or \fBCtrl-Shift-6\fP, on US
+English keyboards. Users of non-English keyboards may find it
+difficult or impossible to type the default escape character, and may
+need to change the escape character. See the description of
+MOSH_ESCAPE_KEY, below. In this description, the configured escape
+character is represented as \fBEsc\fP.
+
+There are two slightly different modes for escape sequences, depending
+whether the escape character is printable or not.
+
+If the escape character is a printable character, it must be prefixed
+with a newline, similar to \fBOpenSSH\fP. To send the escape character
+itself, type it twice. If the escape character is set to \fB~\fP,
+\fBmosh\fP will behave much like \fBOpenSSH\fP.
+
+If the escape character is a non-printable control character, no
+prefix is used and the escape character is recognized at any time. To
+send the escape character itself, type the escape character, then its
+corresponding ASCII character (for \fBCtrl-^\fP you would type \fB^\fP,
+for \fBCtrl-B\fP you would type \fBB\fP).
+
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/missing
^
|
@@ -1,11 +1,10 @@
#! /bin/sh
-# Common stub for a few missing GNU programs while installing.
+# Common wrapper for a few potentially missing GNU programs.
-scriptversion=2012-01-06.13; # UTC
+scriptversion=2013-10-28.13; # UTC
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
-# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
-# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,68 +25,40 @@
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
- echo 1>&2 "Try \`$0 --help' for more information"
+ echo 1>&2 "Try '$0 --help' for more information"
exit 1
fi
-run=:
-sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
-sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
-
-# In the cases where this matters, `missing' is being run in the
-# srcdir already.
-if test -f configure.ac; then
- configure_ac=configure.ac
-else
- configure_ac=configure.in
-fi
+case $1 in
-msg="missing on your system"
+ --is-lightweight)
+ # Used by our autoconf macros to check whether the available missing
+ # script is modern enough.
+ exit 0
+ ;;
-case $1 in
---run)
- # Try to run requested program, and just exit if it succeeds.
- run=
- shift
- "$@" && exit 0
- # Exit code 63 means version mismatch. This often happens
- # when the user try to use an ancient version of a tool on
- # a file that requires a minimum version. In this case we
- # we should proceed has if the program had been absent, or
- # if --run hadn't been passed.
- if test $? = 63; then
- run=:
- msg="probably too old"
- fi
- ;;
+ --run)
+ # Back-compat with the calling convention used by older automake.
+ shift
+ ;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
-Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
-error status if there is no known handling for PROGRAM.
+Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
+to PROGRAM being missing or too old.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
- --run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
- aclocal touch file \`aclocal.m4'
- autoconf touch file \`configure'
- autoheader touch file \`config.h.in'
- autom4te touch the output file, or create a stub one
- automake touch all \`Makefile.in' files
- bison create \`y.tab.[ch]', if possible, from existing .[ch]
- flex create \`lex.yy.c', if possible, from existing .c
- help2man touch the output file
- lex create \`lex.yy.c', if possible, from existing .c
- makeinfo touch the output file
- yacc create \`y.tab.[ch]', if possible, from existing .[ch]
+ aclocal autoconf autoheader autom4te automake makeinfo
+ bison yacc flex lex help2man
-Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
-\`g' are ignored when checking the name.
+Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
+'g' are ignored when checking the name.
Send bug reports to <bug-automake@gnu.org>."
exit $?
@@ -99,228 +70,141 @@
;;
-*)
- echo 1>&2 "$0: Unknown \`$1' option"
- echo 1>&2 "Try \`$0 --help' for more information"
+ echo 1>&2 "$0: unknown '$1' option"
+ echo 1>&2 "Try '$0 --help' for more information"
exit 1
;;
esac
-# normalize program name to check for.
-program=`echo "$1" | sed '
- s/^gnu-//; t
- s/^gnu//; t
- s/^g//; t'`
-
-# Now exit if we have it, but it failed. Also exit now if we
-# don't have it and --version was passed (most likely to detect
-# the program). This is about non-GNU programs, so use $1 not
-# $program.
-case $1 in
- lex*|yacc*)
- # Not GNU programs, they don't have --version.
- ;;
+# Run the given program, remember its exit status.
+"$@"; st=$?
- *)
- if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
- # We have it, but it failed.
- exit 1
- elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
- # Could not run --version or --help. This is probably someone
- # running `$TOOL --version' or `$TOOL --help' to check whether
- # $TOOL exists and not knowing $TOOL uses missing.
- exit 1
- fi
- ;;
-esac
-
-# If it does not exist, or fails to run (possibly an outdated version),
-# try to emulate it.
-case $program in
- aclocal*)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified \`acinclude.m4' or \`${configure_ac}'. You might want
- to install the \`Automake' and \`Perl' packages. Grab them from
- any GNU archive site."
- touch aclocal.m4
- ;;
-
- autoconf*)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified \`${configure_ac}'. You might want to install the
- \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
- archive site."
- touch configure
- ;;
-
- autoheader*)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified \`acconfig.h' or \`${configure_ac}'. You might want
- to install the \`Autoconf' and \`GNU m4' packages. Grab them
- from any GNU archive site."
- files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
- test -z "$files" && files="config.h"
- touch_files=
- for f in $files; do
- case $f in
- *:*) touch_files="$touch_files "`echo "$f" |
- sed -e 's/^[^:]*://' -e 's/:.*//'`;;
- *) touch_files="$touch_files $f.in";;
- esac
- done
- touch $touch_files
- ;;
+# If it succeeded, we are done.
+test $st -eq 0 && exit 0
- automake*)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
- You might want to install the \`Automake' and \`Perl' packages.
- Grab them from any GNU archive site."
- find . -type f -name Makefile.am -print |
- sed 's/\.am$/.in/' |
- while read f; do touch "$f"; done
- ;;
-
- autom4te*)
- echo 1>&2 "\
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/ocb-license.html
^
|
@@ -1,47 +1,47 @@
-<TITLE>OCB - An Authenticated-Encryption Scheme - GPL Patent Grant - Rogaway</TITLE>
-
-<body bgcolor="#FFFFFF">
-<H2><a name="ocb-grant"> <font face="Arial, Helvetica, sans-serif" size="6" color="#FF0000">OCB:
- Patent Grant for GNU GPL</font> </a> </H2>
-
-Whereas I, Phillip Rogaway (hereinafter "Inventor") have sought
-patent protection for certain technology
-(hereinafter "Patented Technology"),
-and Inventor wishes to aid the Free Software Foundation in achieving its goals,
-and Inventor wishes to increase public awareness of Patented Technology,
-Inventor hereby grants a fully paid-up, nonexclusive,
-royalty-free license to
-practice any patents claiming priority to the
-patent applications below ("the Patents")
-if practiced by
-software distributed
-under the terms of any version of
-the GNU General Public License as published by the Free Software Foundation,
-59 Temple Place, Suite 330, Boston, MA 02111.
-Inventor reserves all other rights, including without limitation
-licensing for software not distributed under the GNU General Public License.
-
-<h4>The patents:</h4>
-
-
-<ul>
-<li> <a href="http://appft1.uspto.gov/netacgi/nph-Parser?Sect1=PTO2&Sect2=HITOFF&p=1&u=%2Fnetahtml%2FPTO%2Fsearch-bool.html&r=2&f=G&l=50&co1=AND&d=PG01&s1=rogaway.IN.&OS=IN/rogaway&RS=IN/rogaway">
-09/918,615</a> -
-Method and Apparatus for Facilitating Efficient Authenticated Encryption.
-
-<li> <a href="http://appft1.uspto.gov/netacgi/nph-Parser?Sect1=PTO2&Sect2=HITOFF&p=1&u=%2Fnetahtml%2FPTO%2Fsearch-bool.html&r=3&f=G&l=50&co1=AND&d=PG01&s1=rogaway.IN.&OS=IN/rogaway&RS=IN/rogaway">
-09/948,084</a> -
-Method and Apparatus for Realizing a Parallelizable Variable-Input-Length
-Pseudorandom Function.
-</ul>
-
-<hr>
-
-<p><b>June 12, 2012</b>: Phillip Rogaway licensed the distribution of OCB
-in Mosh under the GPL with the OpenSSL linking exception and iOS
-waiver contained in the <code>COPYING.iOS</code> file.</p>
-
-<blockquote>
- "Mosh with the two GPL exemptions you specify in the attached note
- is freely licensed to use for any OCB-related IP that I own."
-</blockquote>
+<TITLE>OCB - An Authenticated-Encryption Scheme - GPL Patent Grant - Rogaway</TITLE>
+
+<body bgcolor="#FFFFFF">
+<H2><a name="ocb-grant"> <font face="Arial, Helvetica, sans-serif" size="6" color="#FF0000">OCB:
+ Patent Grant for GNU GPL</font> </a> </H2>
+
+Whereas I, Phillip Rogaway (hereinafter "Inventor") have sought
+patent protection for certain technology
+(hereinafter "Patented Technology"),
+and Inventor wishes to aid the Free Software Foundation in achieving its goals,
+and Inventor wishes to increase public awareness of Patented Technology,
+Inventor hereby grants a fully paid-up, nonexclusive,
+royalty-free license to
+practice any patents claiming priority to the
+patent applications below ("the Patents")
+if practiced by
+software distributed
+under the terms of any version of
+the GNU General Public License as published by the Free Software Foundation,
+59 Temple Place, Suite 330, Boston, MA 02111.
+Inventor reserves all other rights, including without limitation
+licensing for software not distributed under the GNU General Public License.
+
+<h4>The patents:</h4>
+
+
+<ul>
+<li> <a href="http://appft1.uspto.gov/netacgi/nph-Parser?Sect1=PTO2&Sect2=HITOFF&p=1&u=%2Fnetahtml%2FPTO%2Fsearch-bool.html&r=2&f=G&l=50&co1=AND&d=PG01&s1=rogaway.IN.&OS=IN/rogaway&RS=IN/rogaway">
+09/918,615</a> -
+Method and Apparatus for Facilitating Efficient Authenticated Encryption.
+
+<li> <a href="http://appft1.uspto.gov/netacgi/nph-Parser?Sect1=PTO2&Sect2=HITOFF&p=1&u=%2Fnetahtml%2FPTO%2Fsearch-bool.html&r=3&f=G&l=50&co1=AND&d=PG01&s1=rogaway.IN.&OS=IN/rogaway&RS=IN/rogaway">
+09/948,084</a> -
+Method and Apparatus for Realizing a Parallelizable Variable-Input-Length
+Pseudorandom Function.
+</ul>
+
+<hr>
+
+<p><b>June 12, 2012</b>: Phillip Rogaway licensed the distribution of OCB
+in Mosh under the GPL with the OpenSSL linking exception and iOS
+waiver contained in the <code>COPYING.iOS</code> file.</p>
+
+<blockquote>
+ "Mosh with the two GPL exemptions you specify in the attached note
+ is freely licensed to use for any OCB-related IP that I own."
+</blockquote>
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/scripts/Makefile.am
^
|
@@ -1,4 +1,9 @@
-EXTRA_DIST = wrap-compiler-for-flag-check
+EXTRA_DIST = wrap-compiler-for-flag-check mosh.pl
if BUILD_CLIENT
- dist_bin_SCRIPTS = mosh
+ bin_SCRIPTS = mosh
endif
+CLEANFILES = $(bin_SCRIPTS)
+
+mosh: mosh.pl ../VERSION Makefile
+ @sed -e "s/\@VERSION\@/`cat ../VERSION`/" -e "s/\@PACKAGE_STRING\@/@PACKAGE_STRING@/" $(srcdir)/mosh.pl > mosh
+ @chmod a+x mosh
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/scripts/Makefile.in
^
|
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -16,23 +15,61 @@
@SET_MAKE@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
- test $$am__dry = yes; \
- }
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -50,8 +87,6 @@
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = scripts
-DIST_COMMON = $(am__dist_bin_SCRIPTS_DIST) $(srcdir)/Makefile.am \
- $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_check_library.m4 \
@@ -60,11 +95,11 @@
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
-am__dist_bin_SCRIPTS_DIST = mosh
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -93,13 +128,19 @@
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(bindir)"
-SCRIPTS = $(dist_bin_SCRIPTS)
+SCRIPTS = $(bin_SCRIPTS)
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
+am__v_at_1 =
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
@@ -107,6 +148,8 @@
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+am__DIST_COMMON = $(srcdir)/Makefile.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
@@ -116,13 +159,20 @@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@
+BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CRYPTO_CFLAGS = @CRYPTO_CFLAGS@
+CRYPTO_CPPFLAGS = @CRYPTO_CPPFLAGS@
+CRYPTO_LDFLAGS = @CRYPTO_LDFLAGS@
+CRYPTO_LIBS = @CRYPTO_LIBS@
CURSES_LIB = @CURSES_LIB@
CXX = @CXX@
+CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
@@ -144,14 +194,11 @@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
-LIBUTIL = @LIBUTIL@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MISC_CXXFLAGS = @MISC_CXXFLAGS@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
-OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
-OPENSSL_LIBS = @OPENSSL_LIBS@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
@@ -190,6 +237,7 @@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
+completions = @completions@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
@@ -213,6 +261,7 @@
protobuf_CFLAGS = @protobuf_CFLAGS@
protobuf_LIBS = @protobuf_LIBS@
psdir = @psdir@
+runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
@@ -221,8 +270,9 @@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-EXTRA_DIST = wrap-compiler-for-flag-check
-@BUILD_CLIENT_TRUE@dist_bin_SCRIPTS = mosh
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/scripts/mosh.pl
^
|
@@ -0,0 +1,529 @@
+#!/usr/bin/env perl
+
+# Mosh: the mobile shell
+# Copyright 2012 Keith Winstein
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# In addition, as a special exception, the copyright holders give
+# permission to link the code of portions of this program with the
+# OpenSSL library under certain conditions as described in each
+# individual source file, and distribute linked combinations including
+# the two.
+#
+# You must obey the GNU General Public License in all respects for all
+# of the code used other than OpenSSL. If you modify file(s) with this
+# exception, you may extend this exception to your version of the
+# file(s), but you are not obligated to do so. If you do not wish to do
+# so, delete this exception statement from your version. If you delete
+# this exception statement from all source files in the program, then
+# also delete it here.
+
+use 5.8.8;
+
+use warnings;
+use strict;
+use Getopt::Long;
+use IO::Socket;
+use Text::ParseWords;
+use Socket qw(IPPROTO_TCP);
+use Errno qw(EINTR);
+use POSIX qw(_exit);
+
+BEGIN {
+ my @gai_reqs = qw( getaddrinfo getnameinfo AI_CANONNAME AI_NUMERICHOST NI_NUMERICHOST );
+ eval { Socket->import( @gai_reqs ); 1; }
+ || eval { require Socket::GetAddrInfo; Socket::GetAddrInfo->import( ':newapi', @gai_reqs ); 1; }
+ || eval { Socket::GetAddrInfo->import( '0.22', @gai_reqs ); 1; }
+ || die "$0 error: requires Perl 5.14 or Socket::GetAddrInfo.\n";
+}
+
+my $have_ipv6 = eval {
+ require IO::Socket::IP;
+ IO::Socket::IP->import('-register');
+ 1;
+} || eval {
+ require IO::Socket::INET6;
+ 1;
+};
+
+$|=1;
+
+my $client = 'mosh-client';
+my $server = 'mosh-server';
+
+my $predict = undef;
+
+my $bind_ip = undef;
+
+my $use_remote_ip = 'proxy';
+
+my $family = 'prefer-inet';
+my $port_request = undef;
+
+my @ssh = ('ssh');
+
+my $term_init = 1;
+
+my $localhost = undef;
+
+my $ssh_pty = 1;
+
+my $help = undef;
+my $version = undef;
+
+my @cmdline = @ARGV;
+
+my $usage =
+qq{Usage: $0 [options] [--] [user@]host [command...]
+ --client=PATH mosh client on local machine
+ (default: "mosh-client")
+ --server=COMMAND mosh server on remote machine
+ (default: "mosh-server")
+
+ --predict=adaptive local echo for slower links [default]
+-a --predict=always use local echo even on fast links
+-n --predict=never never use local echo
+ --predict=experimental aggressively echo even when incorrect
+
+-4 --family=inet use IPv4 only
+-6 --family=inet6 use IPv6 only
+ --family=auto autodetect network type for single-family hosts only
+ --family=all try all network types
+ --family=prefer-inet use all network types, but try IPv4 first [default]
+ --family=prefer-inet6 use all network types, but try IPv6 first
+-p PORT[:PORT2]
+ --port=PORT[:PORT2] server-side UDP port or range
+ (No effect on server-side SSH port)
+ --bind-server={ssh|any|IP} ask the server to reply from an IP address
+ (default: "ssh")
+
+ --ssh=COMMAND ssh command to run when setting up session
+ (example: "ssh -p 2222")
+ (default: "ssh")
+
+ --no-ssh-pty do not allocate a pseudo tty on ssh connection
+
+ --no-init do not send terminal initialization string
+
+ --local run mosh-server locally without using ssh
+
+ --experimental-remote-ip=(local|remote|proxy) select the method for
+ discovering the remote IP address to use for mosh
+ (default: "proxy")
+
+ --help this message
+ --version version and copyright information
+
+Please report bugs to mosh-devel\@mit.edu.
+Mosh home page: https://mosh.org\n};
+
+my $version_message = '@PACKAGE_STRING@ [build @VERSION@]' . qq{
+Copyright 2012 Keith Winstein <mosh-devel\@mit.edu>
+License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law.\n};
+
+sub predict_check {
+ my ( $predict, $env_set ) = @_;
+
+ if ( not exists { adaptive => 0, always => 0,
+ never => 0, experimental => 0 }->{ $predict } ) {
+ my $explanation = $env_set ? " (MOSH_PREDICTION_DISPLAY in environment)" : "";
+ print STDERR qq{$0: Unknown mode \"$predict\"$explanation.\n\n};
+
+ die $usage;
+ }
+}
+
+GetOptions( 'client=s' => \$client,
+ 'server=s' => \$server,
+ 'predict=s' => \$predict,
+ 'port=s' => \$port_request,
+ 'a' => sub { $predict = 'always' },
+ 'n' => sub { $predict = 'never' },
+ 'family=s' => \$family,
+ '4' => sub { $family = 'inet' },
+ '6' => sub { $family = 'inet6' },
+ 'p=s' => \$port_request,
+ 'ssh=s' => sub { @ssh = shellwords($_[1]); },
+ 'ssh-pty!' => \$ssh_pty,
+ 'init!' => \$term_init,
+ 'local' => \$localhost,
+ 'help' => \$help,
+ 'version' => \$version,
+ 'fake-proxy!' => \my $fake_proxy,
+ 'bind-server=s' => \$bind_ip,
+ 'experimental-remote-ip=s' => \$use_remote_ip) or die $usage;
+
+if ( defined $help ) {
+ print $usage;
+ exit;
+}
+if ( defined $version ) {
+ print $version_message;
+ exit;
+}
+
+if ( defined $predict ) {
+ predict_check( $predict, 0 );
+} elsif ( defined $ENV{ 'MOSH_PREDICTION_DISPLAY' } ) {
+ $predict = $ENV{ 'MOSH_PREDICTION_DISPLAY' };
+ predict_check( $predict, 1 );
+} else {
+ $predict = 'adaptive';
+ predict_check( $predict, 0 );
+}
+
+if ( not grep { $_ eq $use_remote_ip } qw { local remote proxy } ) {
+ die "Unknown parameter $use_remote_ip";
+}
+
+$family = lc( $family );
+# Handle IPv4-only Perl installs.
+if (!$have_ipv6) {
+ # Report failure if IPv6 needed and not available.
+ if (defined($family) && $family eq "inet6") {
+ die "$0: IPv6 sockets not available in this Perl install\n";
+ }
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/scripts/wrap-compiler-for-flag-check
^
|
@@ -7,7 +7,7 @@
# Ideally the search string would also include 'clang: ' but this output might
# depend on clang's argv[0].
-if out=`"$@" 2>&1`; then
+if out=$("$@" 2>&1); then
echo "$out"
if echo "$out" | grep 'warning: argument unused' >/dev/null; then
echo "$0: found clang warning"
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/Makefile.in
^
|
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,23 +14,61 @@
@SET_MAKE@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
esac; \
- test $$am__dry = yes; \
- }
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -49,7 +86,6 @@
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = src
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_check_library.m4 \
@@ -58,25 +94,33 @@
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
+am__v_at_1 =
SOURCES =
DIST_SOURCES =
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
- html-recursive info-recursive install-data-recursive \
- install-dvi-recursive install-exec-recursive \
- install-html-recursive install-info-recursive \
- install-pdf-recursive install-ps-recursive install-recursive \
- installcheck-recursive installdirs-recursive pdf-recursive \
- ps-recursive uninstall-recursive
+RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
+ ctags-recursive dvi-recursive html-recursive info-recursive \
+ install-data-recursive install-dvi-recursive \
+ install-exec-recursive install-html-recursive \
+ install-info-recursive install-pdf-recursive \
+ install-ps-recursive install-recursive installcheck-recursive \
+ installdirs-recursive pdf-recursive ps-recursive \
+ tags-recursive uninstall-recursive
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -84,12 +128,33 @@
esac
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
-AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
- $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+am__recursive_targets = \
+ $(RECURSIVE_TARGETS) \
+ $(RECURSIVE_CLEAN_TARGETS) \
+ $(am__extra_recursive_targets)
+AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
distdir
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
+am__DIST_COMMON = $(srcdir)/Makefile.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
dir0=`pwd`; \
@@ -124,13 +189,20 @@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@
+BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CRYPTO_CFLAGS = @CRYPTO_CFLAGS@
+CRYPTO_CPPFLAGS = @CRYPTO_CPPFLAGS@
+CRYPTO_LDFLAGS = @CRYPTO_LDFLAGS@
+CRYPTO_LIBS = @CRYPTO_LIBS@
CURSES_LIB = @CURSES_LIB@
CXX = @CXX@
+CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
@@ -152,14 +224,11 @@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/crypto/Makefile.am
^
|
@@ -1,4 +1,4 @@
-AM_CPPFLAGS = -I$(srcdir)/../util $(OPENSSL_CFLAGS)
+AM_CPPFLAGS = -I$(srcdir)/../util $(CRYPTO_CFLAGS)
AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(PICKY_CXXFLAGS) $(HARDEN_CFLAGS) $(MISC_CXXFLAGS)
noinst_LIBRARIES = libmoshcrypto.a
@@ -15,10 +15,3 @@
crypto.cc \
crypto.h \
prng.h
-
-check_PROGRAMS = ocb-test
-TESTS = ocb-test
-
-ocb_test_SOURCES = $(OCB_SRCS)
-ocb_test_CPPFLAGS = -DOCB_TEST_PROGRAM
-ocb_test_LDADD = $(OPENSSL_LIBS)
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/crypto/Makefile.in
^
|
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -16,23 +15,61 @@
@SET_MAKE@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
esac; \
- test $$am__dry = yes; \
- }
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -49,10 +86,7 @@
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-check_PROGRAMS = ocb-test$(EXEEXT)
-TESTS = ocb-test$(EXEEXT)
subdir = src/crypto
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_check_library.m4 \
@@ -61,6 +95,7 @@
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
@@ -69,63 +104,82 @@
ARFLAGS = cru
AM_V_AR = $(am__v_AR_@AM_V@)
am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@)
-am__v_AR_0 = @echo " AR " $@;
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
+am__v_AR_0 = @echo " AR " $@;
+am__v_AR_1 =
libmoshcrypto_a_AR = $(AR) $(ARFLAGS)
libmoshcrypto_a_LIBADD =
am__objects_1 = ocb.$(OBJEXT)
am_libmoshcrypto_a_OBJECTS = $(am__objects_1) base64.$(OBJEXT) \
crypto.$(OBJEXT)
libmoshcrypto_a_OBJECTS = $(am_libmoshcrypto_a_OBJECTS)
-am__objects_2 = ocb_test-ocb.$(OBJEXT)
-am_ocb_test_OBJECTS = $(am__objects_2)
-ocb_test_OBJECTS = $(am_ocb_test_OBJECTS)
-am__DEPENDENCIES_1 =
-ocb_test_DEPENDENCIES = $(am__DEPENDENCIES_1)
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
-AM_V_lt = $(am__v_lt_@AM_V@)
-am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
-am__v_lt_0 = --silent
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
AM_V_CXX = $(am__v_CXX_@AM_V@)
am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
-am__v_CXX_0 = @echo " CXX " $@;
+am__v_CXX_0 = @echo " CXX " $@;
+am__v_CXX_1 =
CXXLD = $(CXX)
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
-o $@
AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
-am__v_CXXLD_0 = @echo " CXXLD " $@;
+am__v_CXXLD_0 = @echo " CXXLD " $@;
+am__v_CXXLD_1 =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
-am__v_CC_0 = @echo " CC " $@;
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo " CCLD " $@;
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
-SOURCES = $(libmoshcrypto_a_SOURCES) $(ocb_test_SOURCES)
-DIST_SOURCES = $(libmoshcrypto_a_SOURCES) $(ocb_test_SOURCES)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = $(libmoshcrypto_a_SOURCES)
+DIST_SOURCES = $(libmoshcrypto_a_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/crypto/base64.cc
^
|
@@ -31,102 +31,90 @@
*/
#include <string.h>
-#include <openssl/bio.h>
-#include <openssl/evp.h>
+#include <stdlib.h>
#include "fatal_assert.h"
+#include "base64.h"
-bool base64_decode( const char *b64, const size_t b64_len,
- char *raw, size_t *raw_len )
+static const char table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+static const unsigned char reverse[] = {
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3e, 0xff, 0xff, 0xff, 0x3f,
+ 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
+ 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
+ 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+};
+
+/* Reverse maps from an ASCII char to a base64 sixbit value. Returns > 0x3f on failure. */
+static unsigned char base64_char_to_sixbit(unsigned char c)
{
- bool ret = false;
+ return reverse[c];
+}
+bool base64_decode( const char *b64, const size_t b64_len,
+ uint8_t *raw, size_t *raw_len )
+{
fatal_assert( b64_len == 24 ); /* only useful for Mosh keys */
fatal_assert( *raw_len == 16 );
- /* initialize input/output */
- BIO_METHOD *b64_method = BIO_f_base64();
- fatal_assert( b64_method );
-
- BIO *b64_bio = BIO_new( b64_method );
- fatal_assert( b64_bio );
-
- BIO_set_flags( b64_bio, BIO_FLAGS_BASE64_NO_NL );
-
- BIO *mem_bio = BIO_new_mem_buf( (void *) b64, b64_len );
- fatal_assert( mem_bio );
-
- BIO *combined_bio = BIO_push( b64_bio, mem_bio );
- fatal_assert( combined_bio );
-
- fatal_assert( 1 == BIO_flush( combined_bio ) );
-
- /* read the string */
- int bytes_read = BIO_read( combined_bio, raw, *raw_len );
- if ( bytes_read <= 0 ) {
- goto end;
+ uint32_t bytes = 0;
+ for (int i = 0; i < 22; i++) {
+ unsigned char sixbit = base64_char_to_sixbit(*(b64++));
+ if (sixbit > 0x3f) {
+ return false;
+ }
+ bytes <<= 6;
+ bytes |= sixbit;
+ /* write groups of 3 */
+ if (i % 4 == 3) {
+ raw[0] = bytes >> 16;
+ raw[1] = bytes >> 8;
+ raw[2] = bytes;
+ raw += 3;
+ bytes = 0;
+ }
}
-
- if ( bytes_read != (int)*raw_len ) {
- goto end;
+ /* last byte of output */
+ *raw = bytes >> 4;
+ if (b64[0] != '=' || b64[1] != '=') {
+ return false;
}
-
- fatal_assert( 1 == BIO_flush( combined_bio ) );
-
- /* check if there is more to read */
- char extra[ 256 ];
- bytes_read = BIO_read( combined_bio, extra, 256 );
- if ( bytes_read > 0 ) {
- goto end;
- }
-
- /* check if mem buf is empty */
- if ( !BIO_eof( mem_bio ) ) {
- goto end;
- }
-
- ret = true;
- end:
- BIO_free_all( combined_bio );
- return ret;
+ return true;
}
-void base64_encode( const char *raw, const size_t raw_len,
+void base64_encode( const uint8_t *raw, const size_t raw_len,
char *b64, const size_t b64_len )
{
fatal_assert( b64_len == 24 ); /* only useful for Mosh keys */
fatal_assert( raw_len == 16 );
- /* initialize input/output */
- BIO_METHOD *b64_method = BIO_f_base64(), *mem_method = BIO_s_mem();
- fatal_assert( b64_method );
- fatal_assert( mem_method );
-
- BIO *b64_bio = BIO_new( b64_method ), *mem_bio = BIO_new( mem_method );
- fatal_assert( b64_bio );
- fatal_assert( mem_bio );
-
- BIO_set_flags( b64_bio, BIO_FLAGS_BASE64_NO_NL );
-
- BIO *combined_bio = BIO_push( b64_bio, mem_bio );
- fatal_assert( combined_bio );
+ /* first 15 bytes of input */
+ for (int i = 0; i < 5; i++) {
+ uint32_t bytes = (raw[0] << 16) | (raw[1] << 8) | raw[2];
+ b64[0] = table[(bytes >> 18) & 0x3f];
+ b64[1] = table[(bytes >> 12) & 0x3f];
+ b64[2] = table[(bytes >> 6) & 0x3f];
+ b64[3] = table[(bytes) & 0x3f];
+ raw += 3;
+ b64 += 4;
+ }
- /* write the string */
- int bytes_written = BIO_write( combined_bio, raw, raw_len );
- fatal_assert( bytes_written >= 0 );
-
- fatal_assert( bytes_written == (int)raw_len );
-
- fatal_assert( 1 == BIO_flush( combined_bio ) );
-
- /* check if mem buf has desired length */
- fatal_assert( BIO_pending( mem_bio ) == (int)b64_len );
-
- char *mem_ptr;
-
- BIO_get_mem_data( mem_bio, &mem_ptr );
-
- memcpy( b64, mem_ptr, b64_len );
-
- BIO_free_all( combined_bio );
+ /* last byte of input, last 4 of output */
+ uint8_t lastchar = *raw;
+ b64[0] = table[(lastchar >> 2) & 0x3f];
+ b64[1] = table[(lastchar << 4) & 0x3f];
+ b64[2] = '=';
+ b64[3] = '=';
}
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/crypto/base64.h
^
|
@@ -30,8 +30,10 @@
also delete it here.
*/
+#include <stdint.h>
+
bool base64_decode( const char *b64, const size_t b64_len,
- char *raw, size_t *raw_len );
+ uint8_t *raw, size_t *raw_len );
-bool base64_encode( const char *raw, const size_t raw_len,
- char *b64, size_t b64_len );
+void base64_encode( const uint8_t *raw, const size_t raw_len,
+ char *b64, const size_t b64_len );
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/crypto/byteorder.h
^
|
@@ -35,13 +35,20 @@
#include "config.h"
-#ifdef HAVE_HTOBE64
+#if HAVE_DECL_BE64TOH || HAVE_DECL_BETOH64
+
# if defined(HAVE_ENDIAN_H)
# include <endian.h>
# elif defined(HAVE_SYS_ENDIAN_H)
+# include <sys/types.h>
# include <sys/endian.h>
# endif
+#if !HAVE_DECL_BE64TOH && HAVE_DECL_BETOH64
+#define be64toh betoh64
+#define be16toh betoh16
+#endif
+
#elif HAVE_OSX_SWAP
# include <libkern/OSByteOrder.h>
# define htobe64 OSSwapHostToBigInt64
@@ -65,14 +72,14 @@
inline uint64_t htobe64( uint64_t x ) {
uint8_t xs[ 8 ] = {
- ( x >> 56 ) & 0xFF,
- ( x >> 48 ) & 0xFF,
- ( x >> 40 ) & 0xFF,
- ( x >> 32 ) & 0xFF,
- ( x >> 24 ) & 0xFF,
- ( x >> 16 ) & 0xFF,
- ( x >> 8 ) & 0xFF,
- x & 0xFF };
+ static_cast<uint8_t>( ( x >> 56 ) & 0xFF ),
+ static_cast<uint8_t>( ( x >> 48 ) & 0xFF ),
+ static_cast<uint8_t>( ( x >> 40 ) & 0xFF ),
+ static_cast<uint8_t>( ( x >> 32 ) & 0xFF ),
+ static_cast<uint8_t>( ( x >> 24 ) & 0xFF ),
+ static_cast<uint8_t>( ( x >> 16 ) & 0xFF ),
+ static_cast<uint8_t>( ( x >> 8 ) & 0xFF ),
+ static_cast<uint8_t>( ( x ) & 0xFF ) };
union {
const uint8_t *p8;
const uint64_t *p64;
@@ -99,8 +106,8 @@
inline uint16_t htobe16( uint16_t x ) {
uint8_t xs[ 2 ] = {
- ( x >> 8 ) & 0xFF,
- x & 0xFF };
+ static_cast<uint8_t>( ( x >> 8 ) & 0xFF ),
+ static_cast<uint8_t>( ( x ) & 0xFF ) };
union {
const uint8_t *p8;
const uint16_t *p16;
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/crypto/crypto.cc
^
|
@@ -41,12 +41,12 @@
#include "byteorder.h"
#include "crypto.h"
#include "base64.h"
+#include "fatal_assert.h"
+#include "prng.h"
using namespace std;
using namespace Crypto;
-const char rdev[] = "/dev/urandom";
-
long int myatoi( const char *str )
{
char *end;
@@ -62,11 +62,22 @@
return ret;
}
+uint64_t Crypto::unique( void )
+{
+ static uint64_t counter = 0;
+ uint64_t rv = counter++;
+ if ( counter == 0 ) {
+ throw CryptoException( "Counter wrapped", true );
+ }
+ return rv;
+}
+
AlignedBuffer::AlignedBuffer( size_t len, const char *data )
: m_len( len ), m_allocated( NULL ), m_data( NULL )
{
+ size_t alloc_len = len ? len : 1;
#if defined(HAVE_POSIX_MEMALIGN)
- if ( ( 0 != posix_memalign( &m_allocated, 16, len ) )
+ if ( ( 0 != posix_memalign( &m_allocated, 16, alloc_len ) )
|| ( m_allocated == NULL ) ) {
throw std::bad_alloc();
}
@@ -75,7 +86,7 @@
#else
/* malloc() a region 15 bytes larger than we need, and find
the aligned offset within. */
- m_allocated = malloc( 15 + len );
+ m_allocated = malloc( 15 + alloc_len );
if ( m_allocated == NULL ) {
throw std::bad_alloc();
}
@@ -106,7 +117,7 @@
string base64 = printable_key + "==";
size_t len = 16;
- if ( !base64_decode( base64.data(), 24, (char *)&key[ 0 ], &len ) ) {
+ if ( !base64_decode( base64.data(), 24, key, &len ) ) {
throw CryptoException( "Key must be well-formed base64." );
}
@@ -122,19 +133,19 @@
Base64Key::Base64Key()
{
- ifstream devrandom( rdev, ifstream::in | ifstream::binary );
+ PRNG().fill( key, sizeof( key ) );
+}
- devrandom.read( reinterpret_cast<char *>( key ), sizeof( key ) );
- if ( !devrandom ) {
- throw CryptoException( "Could not read from " + string( rdev ) );
- }
+Base64Key::Base64Key(PRNG &prng)
+{
+ prng.fill( key, sizeof( key ) );
}
string Base64Key::printable_key( void ) const
{
char base64[ 24 ];
- base64_encode( (char *)key, 16, base64, 24 );
+ base64_encode( key, 16, base64, 24 );
if ( (base64[ 23 ] != '=')
|| (base64[ 22 ] != '=') ) {
@@ -159,9 +170,7 @@
Session::~Session()
{
- if ( ae_clear( ctx ) != AE_SUCCESS ) {
- throw CryptoException( "Could not clear AES-OCB context." );
- }
+ fatal_assert( ae_clear( ctx ) == AE_SUCCESS );
}
Nonce::Nonce( uint64_t val )
@@ -172,14 +181,14 @@
memcpy( bytes + 4, &val_net, 8 );
}
-uint64_t Nonce::val( void )
+uint64_t Nonce::val( void ) const
{
uint64_t ret;
memcpy( &ret, bytes + 4, 8 );
return be64toh( ret );
}
-Nonce::Nonce( char *s_bytes, size_t len )
+Nonce::Nonce( const char *s_bytes, size_t len )
{
if ( len != 8 ) {
throw CryptoException( "Nonce representation must be 8 octets long." );
@@ -189,18 +198,7 @@
memcpy( bytes + 4, s_bytes, 8 );
}
-Message::Message( char *nonce_bytes, size_t nonce_len,
- char *text_bytes, size_t text_len )
- : nonce( nonce_bytes, nonce_len ),
- text( (char *)text_bytes, text_len )
-{}
-
-Message::Message( Nonce s_nonce, string s_text )
- : nonce( s_nonce ),
- text( s_text )
-{}
-
-string Session::encrypt( Message plaintext )
+const string Session::encrypt( const Message & plaintext )
{
const size_t pt_len = plaintext.text.size();
const int ciphertext_len = pt_len + 16;
@@ -250,15 +248,13 @@
return plaintext.nonce.cc_str() + text;
}
-Message Session::decrypt( string ciphertext )
+const Message Session::decrypt( const char *str, size_t len )
{
- if ( ciphertext.size() < 24 ) {
+ if ( len < 24 ) {
throw CryptoException( "Ciphertext must contain nonce and tag." );
}
- char *str = (char *)ciphertext.data();
-
- int body_len = ciphertext.size() - 8;
+ int body_len = len - 8;
int pt_len = body_len - 16;
if ( pt_len < 0 ) { /* super-assertion that pt_len does not equal AE_INVALID */
@@ -285,7 +281,7 @@
throw CryptoException( "Packet failed integrity check." );
}
- Message ret( nonce, string( plaintext_buffer.data(), pt_len ) );
+ const Message ret( nonce, string( plaintext_buffer.data(), pt_len ) );
return ret;
}
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/crypto/crypto.h
^
|
@@ -38,20 +38,33 @@
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
+#include <exception>
using std::string;
long int myatoi( const char *str );
+class PRNG;
+
namespace Crypto {
- class CryptoException {
+
+ class CryptoException : public std::exception {
public:
string text;
bool fatal;
CryptoException( string s_text, bool s_fatal = false )
: text( s_text ), fatal( s_fatal ) {};
+ const char *what() const throw () { return text.c_str(); }
+ ~CryptoException() throw () {}
};
+ /*
+ * OCB (and other algorithms) require a source of nonce/sequence
+ * numbers that never repeats its output. Enforce that with this
+ * function.
+ */
+ uint64_t unique( void );
+
/* 16-byte-aligned buffer, with length. */
class AlignedBuffer {
private:
@@ -71,8 +84,8 @@
private:
/* Not implemented */
- AlignedBuffer( const AlignedBuffer& );
- AlignedBuffer& operator=( const AlignedBuffer& );
+ AlignedBuffer( const AlignedBuffer & );
+ AlignedBuffer & operator=( const AlignedBuffer & );
};
class Base64Key {
@@ -81,6 +94,7 @@
public:
Base64Key(); /* random key */
+ Base64Key(PRNG &prng);
Base64Key( string printable_key );
string printable_key( void ) const;
unsigned char *data( void ) { return key; }
@@ -95,21 +109,26 @@
public:
Nonce( uint64_t val );
- Nonce( char *s_bytes, size_t len );
+ Nonce( const char *s_bytes, size_t len );
string cc_str( void ) const { return string( bytes + 4, 8 ); }
const char *data( void ) const { return bytes; }
- uint64_t val( void );
+ uint64_t val( void ) const;
};
class Message {
public:
- Nonce nonce;
- string text;
+ const Nonce nonce;
+ const string text;
- Message( char *nonce_bytes, size_t nonce_len,
- char *text_bytes, size_t text_len );
- Message( Nonce s_nonce, string s_text );
+ Message( const char *nonce_bytes, size_t nonce_len,
+ const char *text_bytes, size_t text_len )
+ : nonce( nonce_bytes, nonce_len ),
+ text( text_bytes, text_len ) {}
+
+ Message( const Nonce & s_nonce, const string & s_text )
+ : nonce( s_nonce ),
+ text( s_text ) {}
};
class Session {
@@ -125,12 +144,17 @@
public:
static const int RECEIVE_MTU = 2048;
+ /* Overhead (not counting the nonce, which is handled by network transport) */
+ static const int ADDED_BYTES = 16 /* final OCB block */;
Session( Base64Key s_key );
~Session();
- string encrypt( Message plaintext );
- Message decrypt( string ciphertext );
+ const string encrypt( const Message & plaintext );
+ const Message decrypt( const char *str, size_t len );
+ const Message decrypt( const string & ciphertext ) {
+ return decrypt( ciphertext.data(), ciphertext.size() );
+ }
Session( const Session & );
Session & operator=( const Session & );
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/crypto/ocb.cc
^
|
@@ -50,9 +50,13 @@
/* This implementation has built-in support for multiple AES APIs. Set any
/ one of the following to non-zero to specify which to use. */
+#if 0
+#define USE_APPLE_COMMON_CRYPTO_AES 0
+#define USE_NETTLE_AES 0
#define USE_OPENSSL_AES 1 /* http://openssl.org */
#define USE_REFERENCE_AES 0 /* Internet search: rijndael-alg-fst.c */
#define USE_AES_NI 0 /* Uses compiler's intrinsics */
+#endif
/* During encryption and decryption, various "L values" are required.
/ The L values can be precomputed during initialization (requiring extra
@@ -72,9 +76,19 @@
/* Includes and compiler specific definitions */
/* ----------------------------------------------------------------------- */
+#include "config.h"
#include "ae.h"
#include <stdlib.h>
#include <string.h>
+#if defined(HAVE_STRINGS_H)
+#include <strings.h>
+#endif
+#if defined(HAVE_ENDIAN_H)
+#include <endian.h>
+#elif defined(HAVE_SYS_ENDIAN_H)
+#include <sys/types.h>
+#include <sys/endian.h>
+#endif
/* Define standard sized integers */
#if defined(_MSC_VER) && (_MSC_VER < 1600)
@@ -95,12 +109,18 @@
#include <intrin.h>
#pragma intrinsic(_byteswap_uint64, _BitScanForward, memcpy)
#elif __GNUC__
+ #ifndef inline
#define inline __inline__ /* No "inline" in GCC ansi C mode */
+ #endif
+ #ifndef restrict
#define restrict __restrict__ /* No "restrict" in GCC ansi C mode */
+ #endif
#endif
#if _MSC_VER
#define bswap64(x) _byteswap_uint64(x)
+#elif HAVE_DECL_BSWAP64
+ /* nothing */
#elif HAVE_DECL___BUILTIN_BSWAP64
#define bswap64(x) __builtin_bswap64(x) /* GCC 4.3+ */
#else
@@ -121,6 +141,8 @@
static inline unsigned ntz(unsigned x) {_BitScanForward(&x,x);return x;}
#elif HAVE_DECL___BUILTIN_CTZ
#define ntz(x) __builtin_ctz((unsigned)(x)) /* GCC 3.4+ */
+#elif HAVE_DECL_FFS
+ #define ntz(x) (ffs(x) - 1)
#else
#if (L_TABLE_SZ <= 9) && (L_TABLE_SZ_IS_ENOUGH) /* < 2^13 byte texts */
static inline unsigned ntz(unsigned x) {
@@ -185,7 +207,7 @@
bl = _mm_slli_epi32(bl, 1);
return _mm_xor_si128(bl,tmp);
}
-#elif __ALTIVEC__
+#elif __ALTIVEC__ && _CALL_ELF != 2
#include <altivec.h>
typedef vector unsigned block;
#define xor_block(x,y) vec_xor(x,y)
@@ -193,7 +215,7 @@
#define unequal_blocks(x,y) vec_any_ne(x,y)
#define swap_if_le(b) (b)
#if __PPC64__
- block gen_offset(uint64_t KtopStr[3], unsigned bot) {
+ static block gen_offset(uint64_t KtopStr[3], unsigned bot) {
union {uint64_t u64[2]; block bl;} rval;
rval.u64[0] = (KtopStr[0] << bot) | (KtopStr[1] >> (64-bot));
rval.u64[1] = (KtopStr[1] << bot) | (KtopStr[2] >> (64-bot));
@@ -201,7 +223,7 @@
}
#else
/* Special handling: Shifts are mod 32, and no 64-bit types */
- block gen_offset(uint64_t KtopStr[3], unsigned bot) {
+ static block gen_offset(uint64_t KtopStr[3], unsigned bot) {
const vector unsigned k32 = {32,32,32,32};
vector unsigned hi = *(vector unsigned *)(KtopStr+0);
vector unsigned lo = *(vector unsigned *)(KtopStr+2);
@@ -246,11 +268,12 @@
}
#define swap_if_le(b) (b) /* Using endian-neutral int8x16_t */
/* KtopStr is reg correct by 64 bits, return mem correct */
- block gen_offset(uint64_t KtopStr[3], unsigned bot) {
+ static block gen_offset(uint64_t KtopStr[3], unsigned bot) {
const union { unsigned x; unsigned char endian; } little = { 1 };
const int64x2_t k64 = {-64,-64};
- uint64x2_t hi = *(uint64x2_t *)(KtopStr+0); /* hi = A B */
- uint64x2_t lo = *(uint64x2_t *)(KtopStr+1); /* hi = B C */
+ uint64x2_t hi, lo;
+ memcpy(&hi, KtopStr, sizeof(hi));
+ memcpy(&lo, KtopStr+1, sizeof(lo));
int64x2_t ls = vdupq_n_s64(bot);
int64x2_t rs = vqaddq_s64(k64,ls);
block rval = (block)veorq_u64(vshlq_u64(hi,ls),vshlq_u64(lo,rs));
@@ -260,7 +283,7 @@
}
static inline block double_block(block b)
{
- const block mask = {135,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
+ const block mask = {-121,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
block tmp = vshrq_n_s8(b,7);
tmp = vandq_s8(tmp, mask);
tmp = vextq_s8(tmp, tmp, 1); /* Rotate high byte to end */
@@ -286,7 +309,7 @@
}
/* KtopStr is reg correct by 64 bits, return mem correct */
- block gen_offset(uint64_t KtopStr[3], unsigned bot) {
+ static block gen_offset(uint64_t KtopStr[3], unsigned bot) {
block rval;
if (bot != 0) {
rval.l = (KtopStr[0] << bot) | (KtopStr[1] >> (64-bot));
@@ -298,7 +321,7 @@
return swap_if_le(rval);
}
- #if __GNUC__ && __arm__
+ #if __GNUC__ && !__clang__ && __arm__
static inline block double_block(block b) {
__asm__ ("adds %1,%1,%1\n\t"
"adcs %H1,%H1,%H1\n\t"
@@ -348,6 +371,131 @@
#define BPI 4 /* Number of blocks in buffer per ECB call */
/*-------------------*/
+#elif USE_APPLE_COMMON_CRYPTO_AES
+/*-------------------*/
+
+#include <fatal_assert.h>
+#include <CommonCrypto/CommonCryptor.h>
+
+typedef struct {
+ CCCryptorRef ref;
+ uint8_t b[4096];
+} AES_KEY;
+#if (OCB_KEY_LEN == 0)
+#define ROUNDS(ctx) ((ctx)->rounds)
+#else
+#define ROUNDS(ctx) (6+OCB_KEY_LEN/4)
+#endif
+
+static inline void AES_set_encrypt_key(unsigned char *handle, const int bits, AES_KEY *key)
+{
+ CCCryptorStatus rv = CCCryptorCreateFromData(
+ kCCEncrypt,
+ kCCAlgorithmAES128,
+ kCCOptionECBMode,
+ handle,
+ bits / 8,
+ NULL,
+ &(key->b),
+ sizeof (key->b),
+ &(key->ref),
+ NULL);
+
+ fatal_assert(rv == kCCSuccess);
+}
+static inline void AES_set_decrypt_key(unsigned char *handle, const int bits, AES_KEY *key)
+{
+ CCCryptorStatus rv = CCCryptorCreateFromData(
+ kCCDecrypt,
+ kCCAlgorithmAES128,
+ kCCOptionECBMode,
+ handle,
+ bits / 8,
+ NULL,
+ &(key->b),
+ sizeof (key->b),
+ &(key->ref),
+ NULL);
+
+ fatal_assert(rv == kCCSuccess);
+}
+static inline void AES_encrypt(unsigned char *src, unsigned char *dst, AES_KEY *key) {
+ size_t dataOutMoved;
+ CCCryptorStatus rv = CCCryptorUpdate(
+ key->ref,
+ (const void *)src,
+ kCCBlockSizeAES128,
+ (void *)dst,
+ kCCBlockSizeAES128,
+ &dataOutMoved);
+ fatal_assert(rv == kCCSuccess);
+ fatal_assert(dataOutMoved == kCCBlockSizeAES128);
+}
+#if 0
+/* unused */
+static inline void AES_decrypt(unsigned char *src, unsigned char *dst, AES_KEY *key) {
+ AES_encrypt(src, dst, key);
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/examples/Makefile.am
^
|
@@ -7,24 +7,24 @@
encrypt_SOURCES = encrypt.cc
encrypt_CPPFLAGS = -I$(srcdir)/../crypto
-encrypt_LDADD = ../crypto/libmoshcrypto.a $(OPENSSL_LIBS)
+encrypt_LDADD = ../crypto/libmoshcrypto.a $(CRYPTO_LIBS)
decrypt_SOURCES = decrypt.cc
decrypt_CPPFLAGS = -I$(srcdir)/../crypto
-decrypt_LDADD = ../crypto/libmoshcrypto.a $(OPENSSL_LIBS)
+decrypt_LDADD = ../crypto/libmoshcrypto.a $(CRYPTO_LIBS)
parse_SOURCES = parse.cc
parse_CPPFLAGS = -I$(srcdir)/../terminal -I$(srcdir)/../util
-parse_LDADD = ../terminal/libmoshterminal.a ../util/libmoshutil.a $(LIBUTIL)
+parse_LDADD = ../terminal/libmoshterminal.a ../util/libmoshutil.a
termemu_SOURCES = termemu.cc
termemu_CPPFLAGS = -I$(srcdir)/../terminal -I$(srcdir)/../util -I$(srcdir)/../statesync -I../protobufs
-termemu_LDADD = ../terminal/libmoshterminal.a ../util/libmoshutil.a ../statesync/libmoshstatesync.a ../protobufs/libmoshprotos.a $(LIBUTIL) $(TINFO_LIBS) $(protobuf_LIBS)
+termemu_LDADD = ../terminal/libmoshterminal.a ../util/libmoshutil.a ../statesync/libmoshstatesync.a ../protobufs/libmoshprotos.a $(TINFO_LIBS) $(protobuf_LIBS)
ntester_SOURCES = ntester.cc
ntester_CPPFLAGS = -I$(srcdir)/../util -I$(srcdir)/../statesync -I$(srcdir)/../terminal -I$(srcdir)/../network -I$(srcdir)/../crypto -I../protobufs $(protobuf_CFLAGS)
-ntester_LDADD = ../statesync/libmoshstatesync.a ../terminal/libmoshterminal.a ../network/libmoshnetwork.a ../crypto/libmoshcrypto.a ../protobufs/libmoshprotos.a ../util/libmoshutil.a $(LIBUTIL) -lm $(protobuf_LIBS) $(OPENSSL_LIBS)
+ntester_LDADD = ../statesync/libmoshstatesync.a ../terminal/libmoshterminal.a ../network/libmoshnetwork.a ../crypto/libmoshcrypto.a ../protobufs/libmoshprotos.a ../util/libmoshutil.a -lm $(protobuf_LIBS) $(CRYPTO_LIBS)
benchmark_SOURCES = benchmark.cc
benchmark_CPPFLAGS = -I$(srcdir)/../util -I$(srcdir)/../statesync -I$(srcdir)/../terminal -I../protobufs -I$(srcdir)/../frontend -I$(srcdir)/../crypto -I$(srcdir)/../network $(protobuf_CFLAGS)
-benchmark_LDADD = ../frontend/terminaloverlay.o ../statesync/libmoshstatesync.a ../terminal/libmoshterminal.a ../protobufs/libmoshprotos.a ../network/libmoshnetwork.a ../crypto/libmoshcrypto.a ../util/libmoshutil.a $(STDDJB_LDFLAGS) $(LIBUTIL) -lm $(TINFO_LIBS) $(protobuf_LIBS) $(OPENSSL_LIBS)
+benchmark_LDADD = ../frontend/terminaloverlay.o ../statesync/libmoshstatesync.a ../terminal/libmoshterminal.a ../protobufs/libmoshprotos.a ../network/libmoshnetwork.a ../crypto/libmoshcrypto.a ../util/libmoshutil.a $(STDDJB_LDFLAGS) -lm $(TINFO_LIBS) $(protobuf_LIBS) $(CRYPTO_LIBS)
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/examples/Makefile.in
^
|
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -16,23 +15,61 @@
@SET_MAKE@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
esac; \
- test $$am__dry = yes; \
- }
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -54,7 +91,6 @@
@BUILD_EXAMPLES_TRUE@ parse$(EXEEXT) termemu$(EXEEXT) \
@BUILD_EXAMPLES_TRUE@ benchmark$(EXEEXT)
subdir = src/examples
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_check_library.m4 \
@@ -63,6 +99,7 @@
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
@@ -76,7 +113,7 @@
../protobufs/libmoshprotos.a ../network/libmoshnetwork.a \
../crypto/libmoshcrypto.a ../util/libmoshutil.a \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+ $(am__DEPENDENCIES_1)
am_decrypt_OBJECTS = decrypt-decrypt.$(OBJEXT)
decrypt_OBJECTS = $(am_decrypt_OBJECTS)
decrypt_DEPENDENCIES = ../crypto/libmoshcrypto.a $(am__DEPENDENCIES_1)
@@ -89,17 +126,29 @@
../terminal/libmoshterminal.a ../network/libmoshnetwork.a \
../crypto/libmoshcrypto.a ../protobufs/libmoshprotos.a \
../util/libmoshutil.a $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+ $(am__DEPENDENCIES_1)
am_parse_OBJECTS = parse-parse.$(OBJEXT)
parse_OBJECTS = $(am_parse_OBJECTS)
parse_DEPENDENCIES = ../terminal/libmoshterminal.a \
- ../util/libmoshutil.a $(am__DEPENDENCIES_1)
+ ../util/libmoshutil.a
am_termemu_OBJECTS = termemu-termemu.$(OBJEXT)
termemu_OBJECTS = $(am_termemu_OBJECTS)
termemu_DEPENDENCIES = ../terminal/libmoshterminal.a \
../util/libmoshutil.a ../statesync/libmoshstatesync.a \
../protobufs/libmoshprotos.a $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+ $(am__DEPENDENCIES_1)
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -107,23 +156,20 @@
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
+am__v_lt_1 =
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
AM_V_CXX = $(am__v_CXX_@AM_V@)
am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
-am__v_CXX_0 = @echo " CXX " $@;
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
+am__v_CXX_0 = @echo " CXX " $@;
+am__v_CXX_1 =
CXXLD = $(CXX)
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
-o $@
AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
-am__v_CXXLD_0 = @echo " CXXLD " $@;
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
+am__v_CXXLD_0 = @echo " CXXLD " $@;
+am__v_CXXLD_1 =
SOURCES = $(benchmark_SOURCES) $(decrypt_SOURCES) $(encrypt_SOURCES) \
$(ntester_SOURCES) $(parse_SOURCES) $(termemu_SOURCES)
DIST_SOURCES = $(benchmark_SOURCES) $(decrypt_SOURCES) \
@@ -134,8 +180,26 @@
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/examples/benchmark.cc
^
|
@@ -44,6 +44,7 @@
#include <signal.h>
#include <time.h>
#include <limits.h>
+#include <exception>
#if HAVE_PTY_H
#include <pty.h>
@@ -62,44 +63,65 @@
using namespace Terminal;
-int main( void )
+int main( int argc, char **argv )
{
- int fbmod = 0;
- Framebuffer local_framebuffers[ 2 ] = { Framebuffer(80,24), Framebuffer(80,24) };
- Framebuffer *local_framebuffer = &(local_framebuffers[ fbmod ]);
- Framebuffer *new_state = &(local_framebuffers[ !fbmod ]);
- Overlay::OverlayManager overlays;
- Display display( true );
- Complete local_terminal( 80, 24 );
-
- /* Adopt native locale */
- set_native_locale();
- fatal_assert( is_utf8_locale() );
-
- for ( int i = 0; i < ITERATIONS; i++ ) {
- /* type a character */
- overlays.get_prediction_engine().new_user_byte( i + 'x', *local_framebuffer );
-
- /* fetch target state */
- *new_state = local_terminal.get_fb();
-
- /* apply local overlays */
- overlays.apply( *new_state );
-
- /* calculate minimal difference from where we are */
- const string diff( display.new_frame( false,
- *local_framebuffer,
- *new_state ) );
-
- /* make sure to use diff */
- if ( diff.size() > INT_MAX ) {
- exit( 1 );
+ try {
+ int fbmod = 0;
+ int width = 80, height = 24;
+ int iterations = ITERATIONS;
+ if (argc > 1) {
+ iterations = atoi(argv[1]);
+ if (iterations < 1 || iterations > 1000000000) {
+ fprintf(stderr, "bogus iteration count\n");
+ exit(1);
+ }
}
-
- fbmod = !fbmod;
- local_framebuffer = &(local_framebuffers[ fbmod ]);
- new_state = &(local_framebuffers[ !fbmod ]);
+ if (argc > 3) {
+ width = atoi(argv[2]);
+ height = atoi(argv[3]);
+ if (width < 1 || width > 1000 || height < 1 || height > 1000) {
+ fprintf(stderr, "bogus window size\n");
+ exit(1);
+ }
+ }
+ Framebuffer local_framebuffers[ 2 ] = { Framebuffer(width,height), Framebuffer(width,height) };
+ Framebuffer *local_framebuffer = &(local_framebuffers[ fbmod ]);
+ Framebuffer *new_state = &(local_framebuffers[ !fbmod ]);
+ Overlay::OverlayManager overlays;
+ Display display( true );
+ Complete local_terminal( width, height );
+
+ /* Adopt native locale */
+ set_native_locale();
+ fatal_assert( is_utf8_locale() );
+
+ for ( int i = 0; i < iterations; i++ ) {
+ /* type a character */
+ overlays.get_prediction_engine().new_user_byte( i + 'x', *local_framebuffer );
+
+ /* fetch target state */
+ *new_state = local_terminal.get_fb();
+
+ /* apply local overlays */
+ overlays.apply( *new_state );
+
+ /* calculate minimal difference from where we are */
+ const string diff( display.new_frame( false,
+ *local_framebuffer,
+ *new_state ) );
+
+ /* make sure to use diff */
+ if ( diff.size() > INT_MAX ) {
+ exit( 1 );
+ }
+
+ fbmod = !fbmod;
+ local_framebuffer = &(local_framebuffers[ fbmod ]);
+ new_state = &(local_framebuffers[ !fbmod ]);
+ }
+ } catch ( const std::exception &e ) {
+ fprintf( stderr, "Exception caught: %s\n", e.what() );
+ return 1;
}
-
return 0;
}
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/examples/decrypt.cc
^
|
@@ -62,7 +62,7 @@
(long)message.nonce.val() );
cout << message.text;
} catch ( const CryptoException &e ) {
- cerr << e.text << endl;
+ cerr << e.what() << endl;
exit( 1 );
}
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/examples/encrypt.cc
^
|
@@ -63,7 +63,7 @@
cout << ciphertext;
} catch ( const CryptoException &e ) {
- cerr << e.text << endl;
+ cerr << e.what() << endl;
exit( 1 );
}
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/examples/ntester.cc
^
|
@@ -36,7 +36,7 @@
#include "user.h"
#include "fatal_assert.h"
#include "pty_compat.h"
-#include "networktransport.cc"
+#include "networktransport-impl.h"
#include "select.h"
using namespace Network;
@@ -46,7 +46,7 @@
bool server = true;
char *key;
char *ip;
- int port;
+ char *port;
UserStream me, remote;
@@ -59,19 +59,18 @@
key = argv[ 1 ];
ip = argv[ 2 ];
- port = atoi( argv[ 3 ] );
+ port = argv[ 3 ];
n = new Transport<UserStream, UserStream>( me, remote, key, ip, port );
} else {
n = new Transport<UserStream, UserStream>( me, remote, NULL, NULL );
}
- } catch ( const CryptoException &e ) {
- fprintf( stderr, "Fatal error: %s\n", e.text.c_str() );
+ fprintf( stderr, "Port bound is %s, key is %s\n", n->port().c_str(), n->get_key().c_str() );
+ } catch ( const std::exception &e ) {
+ fprintf( stderr, "Fatal startup error: %s\n", e.what() );
exit( 1 );
}
- fprintf( stderr, "Port bound is %d, key is %s\n", n->port(), n->get_key().c_str() );
-
if ( server ) {
Select &sel = Select::get_instance();
uint64_t last_num = n->get_remote_state_num();
@@ -97,8 +96,8 @@
last_num = n->get_remote_state_num();
}
}
- } catch ( const CryptoException &e ) {
- fprintf( stderr, "Cryptographic error: %s\n", e.text.c_str() );
+ } catch ( const std::exception &e ) {
+ fprintf( stderr, "Server error: %s\n", e.what() );
}
}
} else {
@@ -154,20 +153,13 @@
/* we only read one socket each run */
network_ready_to_read = true;
}
-
- if ( sel.error( *it ) ) {
- break;
- }
}
if ( network_ready_to_read ) {
n->recv();
}
- } catch ( const NetworkException &e ) {
- fprintf( stderr, "%s: %s\r\n", e.function.c_str(), strerror( e.the_errno ) );
- break;
- } catch ( const CryptoException &e ) {
- fprintf( stderr, "Cryptographic error: %s\n", e.text.c_str() );
+ } catch ( const std::exception &e ) {
+ fprintf( stderr, "Client error: %s\n", e.what() );
}
}
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/examples/parse.cc
^
|
@@ -42,7 +42,6 @@
#include <wchar.h>
#include <assert.h>
#include <wctype.h>
-#include <iostream>
#include <typeinfo>
#include <termios.h>
@@ -50,6 +49,8 @@
#include <pty.h>
#elif HAVE_UTIL_H
#include <util.h>
+#elif HAVE_LIBUTIL_H
+#include <libutil.h>
#endif
#include "parser.h"
@@ -61,9 +62,9 @@
const size_t buf_size = 1024;
-void emulate_terminal( int fd );
-int copy( int src, int dest );
-int vt_parser( int fd, Parser::UTF8Parser *parser );
+static void emulate_terminal( int fd );
+static int copy( int src, int dest );
+static int vt_parser( int fd, Parser::UTF8Parser *parser );
int main( int argc __attribute__((unused)),
char *argv[] __attribute__((unused)),
@@ -133,7 +134,7 @@
return 0;
}
-void emulate_terminal( int fd )
+static void emulate_terminal( int fd )
{
Parser::UTF8Parser parser;
@@ -156,15 +157,13 @@
if ( vt_parser( fd, &parser ) < 0 ) {
return;
}
- } else if ( sel.error( STDIN_FILENO ) || sel.error( fd ) ) {
- return;
} else {
fprintf( stderr, "select mysteriously woken up\n" );
}
}
}
-int copy( int src, int dest )
+static int copy( int src, int dest )
{
char buf[ buf_size ];
@@ -179,7 +178,7 @@
return swrite( dest, buf, bytes_read );
}
-int vt_parser( int fd, Parser::UTF8Parser *parser )
+static int vt_parser( int fd, Parser::UTF8Parser *parser )
{
char buf[ buf_size ];
@@ -193,9 +192,10 @@
}
/* feed to parser */
+ Parser::Actions actions;
for ( int i = 0; i < bytes_read; i++ ) {
- std::list<Parser::Action *> actions = parser->input( buf[ i ] );
- for ( std::list<Parser::Action *>::iterator j = actions.begin();
+ parser->input( buf[ i ], actions );
+ for ( Parser::Actions::iterator j = actions.begin();
j != actions.end();
j++ ) {
@@ -204,7 +204,7 @@
if ( act->char_present ) {
if ( iswprint( act->ch ) ) {
- printf( "%s(0x%02x=%lc) ", act->name().c_str(), (unsigned int)act->ch, act->ch );
+ printf( "%s(0x%02x=%lc) ", act->name().c_str(), (unsigned int)act->ch, (wint_t)act->ch );
} else {
printf( "%s(0x%02x) ", act->name().c_str(), (unsigned int)act->ch );
}
@@ -216,6 +216,7 @@
fflush( stdout );
}
+ actions.clear();
}
return 0;
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/examples/termemu.cc
^
|
@@ -42,7 +42,6 @@
#include <wchar.h>
#include <assert.h>
#include <wctype.h>
-#include <iostream>
#include <typeinfo>
#include <sys/ioctl.h>
#include <sys/stat.h>
@@ -51,11 +50,14 @@
#include <sys/types.h>
#include <pwd.h>
#include <sys/time.h>
+#include <exception>
#if HAVE_PTY_H
#include <pty.h>
#elif HAVE_UTIL_H
#include <util.h>
+#elif HAVE_LIBUTIL_H
+#include <libutil.h>
#endif
#include "parser.h"
@@ -68,9 +70,9 @@
const size_t buf_size = 16384;
-void emulate_terminal( int fd );
+static void emulate_terminal( int fd );
-int main( void )
+int main( int argc, char *argv[] )
{
int master;
struct termios saved_termios, raw_termios, child_termios;
@@ -114,19 +116,26 @@
exit( 1 );
}
- /* get shell name */
- struct passwd *pw = getpwuid( geteuid() );
- if ( pw == NULL ) {
- perror( "getpwuid" );
- exit( 1 );
- }
-
char *my_argv[ 2 ];
- my_argv[ 0 ] = strdup( pw->pw_shell );
- assert( my_argv[ 0 ] );
- my_argv[ 1 ] = NULL;
- if ( execv( pw->pw_shell, my_argv ) < 0 ) {
+ if ( argc > 1 ) {
+ argv++;
+ } else {
+ /* get shell name */
+ my_argv[ 0 ] = getenv( "SHELL" );
+ if ( my_argv[ 0 ] == NULL || *my_argv[ 0 ] == '\0' ) {
+ struct passwd *pw = getpwuid( getuid() );
+ if ( pw == NULL ) {
+ perror( "getpwuid" );
+ exit( 1 );
+ }
+ my_argv[ 0 ] = strdup( pw->pw_shell );
+ }
+ assert( my_argv[ 0 ] );
+ my_argv[ 1 ] = NULL;
+ argv = my_argv;
+ }
+ if ( execvp( argv[ 0 ], argv ) < 0 ) {
perror( "execve" );
exit( 1 );
}
@@ -142,7 +151,11 @@
exit( 1 );
}
- emulate_terminal( master );
+ try {
+ emulate_terminal( master );
+ } catch ( const std::exception &e ) {
+ fprintf( stderr, "\r\nException caught: %s\r\n", e.what() );
+ }
if ( tcsetattr( STDIN_FILENO, TCSANOW, &saved_termios ) < 0 ) {
perror( "tcsetattr" );
@@ -156,8 +169,8 @@
}
/* Print a frame if the last frame was more than 1/50 seconds ago */
-bool tick( Terminal::Framebuffer &state, Terminal::Framebuffer &new_frame,
- const Terminal::Display &display )
+static bool tick( Terminal::Framebuffer &state, Terminal::Framebuffer &new_frame,
+ const Terminal::Display &display )
{
static bool initialized = false;
static struct timeval last_time;
@@ -173,8 +186,6 @@
if ( (!initialized)
|| (diff >= 0.02) ) {
- display.downgrade( new_frame );
-
std::string update = display.new_frame( initialized, state, new_frame );
swrite( STDOUT_FILENO, update.c_str() );
state = new_frame;
@@ -205,7 +216,7 @@
assume the previous frame was sent to the real terminal.
*/
-void emulate_terminal( int fd )
+static void emulate_terminal( int fd )
{
/* get current window size */
struct winsize window_size;
@@ -299,8 +310,6 @@
perror( "ioctl TIOCSWINSZ" );
return;
}
- } else if ( sel.error( STDIN_FILENO ) || sel.error( fd ) ) {
- break;
}
Terminal::Framebuffer new_frame( complete.get_fb() );
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/frontend/Makefile.am
^
|
@@ -1,9 +1,9 @@
-AM_CPPFLAGS = -I$(srcdir)/../statesync -I$(srcdir)/../terminal -I$(srcdir)/../network -I$(srcdir)/../crypto -I../protobufs -I$(srcdir)/../util $(TINFO_CFLAGS) $(protobuf_CFLAGS) $(OPENSSL_CFLAGS)
+AM_CPPFLAGS = -I$(srcdir)/../statesync -I$(srcdir)/../terminal -I$(srcdir)/../network -I$(srcdir)/../crypto -I../protobufs -I$(srcdir)/../util $(TINFO_CFLAGS) $(protobuf_CFLAGS) $(CRYPTO_CFLAGS)
AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(PICKY_CXXFLAGS) $(HARDEN_CFLAGS) $(MISC_CXXFLAGS)
AM_LDFLAGS = $(HARDEN_LDFLAGS)
-LDADD = ../crypto/libmoshcrypto.a ../network/libmoshnetwork.a ../statesync/libmoshstatesync.a ../terminal/libmoshterminal.a ../util/libmoshutil.a ../protobufs/libmoshprotos.a -lm $(TINFO_LIBS) $(protobuf_LIBS) $(OPENSSL_LIBS)
+LDADD = ../crypto/libmoshcrypto.a ../network/libmoshnetwork.a ../statesync/libmoshstatesync.a ../terminal/libmoshterminal.a ../util/libmoshutil.a ../protobufs/libmoshprotos.a -lm $(TINFO_LIBS) $(protobuf_LIBS) $(CRYPTO_LIBS)
-mosh_server_LDADD = $(LDADD) $(LIBUTIL)
+mosh_server_LDADD = $(LDADD)
bin_PROGRAMS =
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/frontend/Makefile.in
^
|
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -16,23 +15,61 @@
@SET_MAKE@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
esac; \
- test $$am__dry = yes; \
- }
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -53,7 +90,6 @@
@BUILD_CLIENT_TRUE@am__append_1 = mosh-client
@BUILD_SERVER_TRUE@am__append_2 = mosh-server
subdir = src/frontend
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_check_library.m4 \
@@ -62,6 +98,7 @@
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
@@ -87,7 +124,19 @@
../terminal/libmoshterminal.a ../util/libmoshutil.a \
../protobufs/libmoshprotos.a $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-mosh_server_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1)
+mosh_server_DEPENDENCIES = $(am__DEPENDENCIES_2)
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -96,29 +145,27 @@
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
AM_V_CXX = $(am__v_CXX_@AM_V@)
am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
-am__v_CXX_0 = @echo " CXX " $@;
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
+am__v_CXX_0 = @echo " CXX " $@;
+am__v_CXX_1 =
CXXLD = $(CXX)
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
-o $@
AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
-am__v_CXXLD_0 = @echo " CXXLD " $@;
+am__v_CXXLD_0 = @echo " CXXLD " $@;
+am__v_CXXLD_1 =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
-am__v_CC_0 = @echo " CC " $@;
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo " CCLD " $@;
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
SOURCES = $(mosh_client_SOURCES) $(mosh_server_SOURCES)
DIST_SOURCES = $(mosh_client_SOURCES) $(mosh_server_SOURCES)
am__can_run_installinfo = \
@@ -126,8 +173,26 @@
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
@@ -137,13 +202,20 @@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@
+BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/frontend/mosh-client.cc
^
|
@@ -31,9 +31,9 @@
*/
#include "config.h"
+#include "version.h"
#include <stdlib.h>
-#include <string.h>
#include <unistd.h>
#include "stmclient.h"
@@ -70,15 +70,21 @@
# error "SysV or X/Open-compatible Curses header file required"
#endif
-void usage( const char *argv0 ) {
- fprintf( stderr, "mosh-client (%s)\n", PACKAGE_STRING );
- fprintf( stderr, "Copyright 2012 Keith Winstein <mosh-devel@mit.edu>\n" );
- fprintf( stderr, "License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.\n\n" );
+static void print_version( FILE *file )
+{
+ fprintf( file, "mosh-client (%s) [build %s]\n", PACKAGE_STRING, BUILD_VERSION );
+ fprintf( file, "Copyright 2012 Keith Winstein <mosh-devel@mit.edu>\n" );
+ fprintf( file, "License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.\n" );
+}
- fprintf( stderr, "Usage: %s IP PORT\n %s -c\n", argv0, argv0 );
+static void print_usage( FILE *file, const char *argv0 )
+{
+ print_version( file );
+ fprintf( file, "\n" );
+ fprintf( file, "Usage: %s [-# 'ARGS'] IP PORT\n %s -c\n", argv0, argv0 );
}
-void print_colorcount( void )
+static void print_colorcount( void )
{
/* check colors */
setupterm((char *)0, 1, (int *)0);
@@ -93,8 +99,13 @@
printf( "%d\n", color_val );
}
+#ifdef NACL
+int mosh_main( int argc, char *argv[] )
+#else
int main( int argc, char *argv[] )
+#endif
{
+ unsigned int verbose = 0;
/* For security, make sure we don't dump core */
Crypto::disable_dumping_core();
@@ -102,25 +113,41 @@
fatal_assert( argc > 0 );
/* Get arguments */
+ for ( int i = 1; i < argc; i++ ) {
+ if ( 0 == strcmp( argv[ i ], "--help" ) ) {
+ print_usage( stdout, argv[ 0 ] );
+ exit( 0 );
+ }
+ if ( 0 == strcmp( argv[ i ], "--version" ) ) {
+ print_version( stdout );
+ exit( 0 );
+ }
+ }
+
int opt;
- while ( (opt = getopt( argc, argv, "c" )) != -1 ) {
+ while ( (opt = getopt( argc, argv, "#:cv" )) != -1 ) {
switch ( opt ) {
+ case '#':
+ // Ignore the original arguments to mosh wrapper
+ break;
case 'c':
print_colorcount();
exit( 0 );
break;
+ case 'v':
+ verbose++;
+ break;
default:
- usage( argv[ 0 ] );
+ print_usage( stderr, argv[ 0 ] );
exit( 1 );
break;
}
}
char *ip, *desired_port;
- int port;
if ( argc - optind != 2 ) {
- usage( argv[ 0 ] );
+ print_usage( stderr, argv[ 0 ] );
exit( 1 );
}
@@ -128,22 +155,13 @@
desired_port = argv[ optind + 1 ];
/* Sanity-check arguments */
- if ( ip
- && ( strspn( ip, "0123456789." ) != strlen( ip ) ) ) {
- fprintf( stderr, "%s: Bad IP address (%s)\n\n", argv[ 0 ], ip );
- usage( argv[ 0 ] );
- exit( 1 );
- }
-
if ( desired_port
&& ( strspn( desired_port, "0123456789" ) != strlen( desired_port ) ) ) {
fprintf( stderr, "%s: Bad UDP port (%s)\n\n", argv[ 0 ], desired_port );
- usage( argv[ 0 ] );
+ print_usage( stderr, argv[ 0 ] );
exit( 1 );
}
- port = myatoi( desired_port );
-
/* Read key from environment */
char *env_key = getenv( "MOSH_KEY" );
if ( env_key == NULL ) {
@@ -169,34 +187,35 @@
/* Adopt native locale */
set_native_locale();
+ bool success = false;
try {
- STMClient client( ip, port, key, predict_mode );
+ STMClient client( ip, desired_port, key, predict_mode, verbose );
client.init();
try {
- client.main();
- } catch ( const Network::NetworkException &e ) {
- fprintf( stderr, "Network exception: %s: %s\r\n",
- e.function.c_str(), strerror( e.the_errno ) );
- } catch ( const Crypto::CryptoException &e ) {
- fprintf( stderr, "Crypto exception: %s\r\n",
- e.text.c_str() );
+ success = client.main();
+ } catch ( ... ) {
+ client.shutdown();
+ throw;
}
client.shutdown();
- } catch ( const Network::NetworkException& e ) {
- fprintf( stderr, "Network exception: %s: %s\r\n",
- e.function.c_str(), strerror( e.the_errno ) );
- } catch ( const Crypto::CryptoException& e ) {
+ } catch ( const Network::NetworkException &e ) {
+ fprintf( stderr, "Network exception: %s\r\n",
+ e.what() );
+ success = false;
+ } catch ( const Crypto::CryptoException &e ) {
fprintf( stderr, "Crypto exception: %s\r\n",
- e.text.c_str() );
- } catch ( const std::string& s ) {
- fprintf( stderr, "Error: %s\r\n", s.c_str() );
+ e.what() );
+ success = false;
+ } catch ( const std::exception &e ) {
+ fprintf( stderr, "Error: %s\r\n", e.what() );
+ success = false;
}
- printf( "\n[mosh is exiting.]\n" );
+ printf( "[mosh is exiting.]\n" );
free( key );
- return 0;
+ return !success;
}
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/frontend/mosh-server.cc
^
|
@@ -31,10 +31,13 @@
*/
#include "config.h"
+#include "version.h"
+#include <err.h>
#include <errno.h>
#include <locale.h>
#include <string.h>
+#include <strings.h>
#include <sstream>
#include <termios.h>
#include <unistd.h>
@@ -50,10 +53,10 @@
#include <utempter.h>
#endif
#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
+#include <netdb.h>
#include <time.h>
#include <sys/stat.h>
+#include <inttypes.h>
#ifdef HAVE_UTMPX_H
#include <utmpx.h>
@@ -87,32 +90,41 @@
#define _PATH_BSHELL "/bin/sh"
#endif
-#include "networktransport.cc"
+#include "networktransport-impl.h"
typedef Network::Transport< Terminal::Complete, Network::UserStream > ServerConnection;
-void serve( int host_fd,
- Terminal::Complete &terminal,
- ServerConnection &network );
-
-int run_server( const char *desired_ip, const char *desired_port,
- const string &command_path, char *command_argv[],
- const int colors, bool verbose, bool with_motd );
+static void serve( int host_fd,
+ Terminal::Complete &terminal,
+ ServerConnection &network,
+ long network_timeout,
+ long network_signaled_timeout );
+
+static int run_server( const char *desired_ip, const char *desired_port,
+ const string &command_path, char *command_argv[],
+ const int colors, unsigned int verbose, bool with_motd );
using namespace std;
-void print_usage( const char *argv0 )
+static void print_version( FILE *file )
{
- fprintf( stderr, "Usage: %s new [-s] [-v] [-i LOCALADDR] [-p PORT[:PORT2]] [-c COLORS] [-l NAME=VALUE] [-- COMMAND...]\n", argv0 );
+ fprintf( file, "mosh-server (%s) [build %s]\n", PACKAGE_STRING, BUILD_VERSION );
+ fprintf( file, "Copyright 2012 Keith Winstein <mosh-devel@mit.edu>\n" );
+ fprintf( file, "License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.\n" );
}
-void print_motd( void );
-void chdir_homedir( void );
-bool motd_hushed( void );
-void warn_unattached( const string & ignore_entry );
+static void print_usage( FILE *stream, const char *argv0 )
+{
+ fprintf( stream, "Usage: %s new [-s] [-v] [-i LOCALADDR] [-p PORT[:PORT2]] [-c COLORS] [-l NAME=VALUE] [-- COMMAND...]\n", argv0 );
+}
+
+static bool print_motd( const char *filename );
+static void chdir_homedir( void );
+static bool motd_hushed( void );
+static void warn_unattached( const string & ignore_entry );
/* Simple spinloop */
-void spin( void )
+static void spin( void )
{
static unsigned int spincount = 0;
spincount++;
@@ -126,19 +138,19 @@
}
}
-string get_SSH_IP( void )
+static string get_SSH_IP( void )
{
const char *SSH_CONNECTION = getenv( "SSH_CONNECTION" );
if ( !SSH_CONNECTION ) { /* Older sshds don't set this */
fprintf( stderr, "Warning: SSH_CONNECTION not found; binding to any interface.\n" );
- return string( "0.0.0.0" );
+ return string( "" );
}
istringstream ss( SSH_CONNECTION );
string dummy, local_interface_IP;
ss >> dummy >> dummy >> local_interface_IP;
if ( !ss ) {
fprintf( stderr, "Warning: Could not parse SSH_CONNECTION; binding to any interface.\n" );
- return string( "0.0.0.0" );
+ return string( "" );
}
/* Strip IPv6 prefix. */
@@ -166,12 +178,20 @@
string command_path;
char **command_argv = NULL;
int colors = 0;
- bool verbose = false; /* don't close stdin/stdout/stderr */
+ unsigned int verbose = 0; /* don't close stdin/stdout/stderr */
/* Will cause mosh-server not to correctly detach on old versions of sshd. */
list<string> locale_vars;
/* strip off command */
- for ( int i = 0; i < argc; i++ ) {
+ for ( int i = 1; i < argc; i++ ) {
+ if ( 0 == strcmp( argv[ i ], "--help" ) || 0 == strcmp( argv[ i ], "-h" ) ) {
+ print_usage( stdout, argv[ 0 ] );
+ exit( 0 );
+ }
+ if ( 0 == strcmp( argv[ i ], "--version" ) ) {
+ print_version( stdout );
+ exit( 0 );
+ }
if ( 0 == strcmp( argv[ i ], "--" ) ) { /* -- is mandatory */
if ( i != argc - 1 ) {
command_argv = argv + i + 1;
@@ -186,8 +206,18 @@
&& (strcmp( argv[ 1 ], "new" ) == 0) ) {
/* new option syntax */
int opt;
- while ( (opt = getopt( argc - 1, argv + 1, "i:p:c:svl:" )) != -1 ) {
+ while ( (opt = getopt( argc - 1, argv + 1, "@:i:p:c:svl:" )) != -1 ) {
switch ( opt ) {
+ /*
+ * This undocumented option does nothing but eat its argument.
+ * Useful in scripting where you prepend something to a
+ * mosh-server argv, and might end up with something like
+ * "mosh-server new -v new -c 256", now you can say
+ * "mosh-server new -v -@ new -c 256" to discard the second
+ * "new".
+ */
+ case '@':
+ break;
case 'i':
desired_ip = optarg;
break;
@@ -195,21 +225,30 @@
desired_port = optarg;
break;
case 's':
+ desired_ip = NULL;
desired_ip_str = get_SSH_IP();
- desired_ip = desired_ip_str.c_str();
- fatal_assert( desired_ip );
+ if ( !desired_ip_str.empty() ) {
+ desired_ip = desired_ip_str.c_str();
+ fatal_assert( desired_ip );
+ }
break;
case 'c':
- colors = myatoi( optarg );
+ try {
+ colors = myatoi( optarg );
+ } catch ( const CryptoException & ) {
+ fprintf( stderr, "%s: Bad number of colors (%s)\n", argv[ 0 ], optarg );
+ print_usage( stderr, argv[ 0 ] );
+ exit( 1 );
+ }
break;
case 'v':
- verbose = true;
+ verbose++;
break;
case 'l':
locale_vars.push_back( string( optarg ) );
break;
default:
- print_usage( argv[ 0 ] );
+ print_usage( stderr, argv[ 0 ] );
/* don't die on unknown options */
}
}
@@ -222,22 +261,15 @@
desired_ip = argv[ 1 ];
desired_port = argv[ 2 ];
} else {
- print_usage( argv[ 0 ] );
+ print_usage( stderr, argv[ 0 ] );
exit( 1 );
}
/* Sanity-check arguments */
- if ( desired_ip
- && ( strspn( desired_ip, "0123456789." ) != strlen( desired_ip ) ) ) {
- fprintf( stderr, "%s: Bad IP address (%s)\n", argv[ 0 ], desired_ip );
- print_usage( argv[ 0 ] );
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/frontend/stmclient.cc
^
|
@@ -32,6 +32,7 @@
#include "config.h"
+#include <err.h>
#include <errno.h>
#include <locale.h>
#include <string.h>
@@ -60,7 +61,7 @@
#include "select.h"
#include "timestamp.h"
-#include "networktransport.cc"
+#include "networktransport-impl.h"
void STMClient::resume( void )
{
@@ -121,8 +122,75 @@
overlays.set_title_prefix( wstring( L"[mosh] " ) );
}
+ /* Set terminal escape key. */
+ const char *escape_key_env;
+ if ( (escape_key_env = getenv( "MOSH_ESCAPE_KEY" )) != NULL ) {
+ if ( strlen( escape_key_env ) == 1 ) {
+ escape_key = (int)escape_key_env[0];
+ if ( escape_key > 0 && escape_key < 128 ) {
+ if ( escape_key < 32 ) {
+ /* If escape is ctrl-something, pass it with repeating the key without ctrl. */
+ escape_pass_key = escape_key + (int)'@';
+ } else {
+ /* If escape is something else, pass it with repeating the key itself. */
+ escape_pass_key = escape_key;
+ }
+ if ( escape_pass_key >= 'A' && escape_pass_key <= 'Z' ) {
+ /* If escape pass is an upper case character, define optional version
+ as lower case of the same. */
+ escape_pass_key2 = escape_pass_key + (int)'a' - (int)'A';
+ } else {
+ escape_pass_key2 = escape_pass_key;
+ }
+ } else {
+ escape_key = 0x1E;
+ escape_pass_key = '^';
+ escape_pass_key2 = '^';
+ }
+ } else if ( strlen( escape_key_env ) == 0 ) {
+ escape_key = -1;
+ } else {
+ escape_key = 0x1E;
+ escape_pass_key = '^';
+ escape_pass_key2 = '^';
+ }
+ } else {
+ escape_key = 0x1E;
+ escape_pass_key = '^';
+ escape_pass_key2 = '^';
+ }
+
+ /* There are so many better ways to shoot oneself into leg than
+ setting escape key to Ctrl-C, Ctrl-D, NewLine, Ctrl-L or CarriageReturn
+ that we just won't allow that. */
+ if ( escape_key == 0x03 || escape_key == 0x04 || escape_key == 0x0A || escape_key == 0x0C || escape_key == 0x0D ) {
+ escape_key = 0x1E;
+ escape_pass_key = '^';
+ escape_pass_key2 = '^';
+ }
+
+ /* Adjust escape help differently if escape is a control character. */
+ if ( escape_key > 0 ) {
+ char escape_pass_name_buf[16];
+ char escape_key_name_buf[16];
+ snprintf(escape_pass_name_buf, sizeof escape_pass_name_buf, "\"%c\"", escape_pass_key);
+ if (escape_key < 32) {
+ snprintf(escape_key_name_buf, sizeof escape_key_name_buf, "Ctrl-%c", escape_pass_key);
+ escape_requires_lf = false;
+ } else {
+ snprintf(escape_key_name_buf, sizeof escape_key_name_buf, "\"%c\"", escape_key);
+ escape_requires_lf = true;
+ }
+ string tmp;
+ tmp = string( escape_pass_name_buf );
+ wstring escape_pass_name = std::wstring(tmp.begin(), tmp.end());
+ tmp = string( escape_key_name_buf );
+ wstring escape_key_name = std::wstring(tmp.begin(), tmp.end());
+ escape_key_help = L"Commands: Ctrl-Z suspends, \".\" quits, " + escape_pass_name + L" gives literal " + escape_key_name;
+ overlays.get_notification_engine().set_escape_key_string( tmp );
+ }
wchar_t tmp[ 128 ];
- swprintf( tmp, 128, L"Nothing received from server on UDP port %d.", port );
+ swprintf( tmp, 128, L"Nothing received from server on UDP port %s.", port.c_str() );
connecting_notification = wstring( tmp );
}
@@ -143,8 +211,8 @@
}
if ( still_connecting() ) {
- fprintf( stderr, "\nmosh did not make a successful connection to %s:%d.\n", ip.c_str(), port );
- fprintf( stderr, "Please verify that UDP port %d is not firewalled and can reach the server.\n\n", port );
+ fprintf( stderr, "\nmosh did not make a successful connection to %s:%s.\n", ip.c_str(), port.c_str() );
+ fprintf( stderr, "Please verify that UDP port %s is not firewalled and can reach the server.\n\n", port.c_str() );
fprintf( stderr, "(By default, mosh uses a UDP port between 60000 and 61000. The -p option\nselects a specific UDP port number.)\n" );
} else if ( network ) {
if ( !clean_shutdown ) {
@@ -170,23 +238,27 @@
}
/* local state */
- local_framebuffer = new Terminal::Framebuffer( window_size.ws_col, window_size.ws_row );
- new_state = new Terminal::Framebuffer( 1, 1 );
+ local_framebuffer = Terminal::Framebuffer( window_size.ws_col, window_size.ws_row );
+ new_state = Terminal::Framebuffer( 1, 1 );
/* initialize screen */
- string init = display.new_frame( false, *local_framebuffer, *local_framebuffer );
+ string init = display.new_frame( false, local_framebuffer, local_framebuffer );
swrite( STDOUT_FILENO, init.data(), init.size() );
/* open network */
Network::UserStream blank;
Terminal::Complete local_terminal( window_size.ws_col, window_size.ws_row );
network = new Network::Transport< Network::UserStream, Terminal::Complete >( blank, local_terminal,
- key.c_str(), ip.c_str(), port );
+ key.c_str(), ip.c_str(), port.c_str() );
network->set_send_delay( 1 ); /* minimal delay on outgoing keystrokes */
/* tell server the size of the terminal */
network->get_current_state().push_back( Parser::Resize( window_size.ws_col, window_size.ws_row ) );
+
+ /* be noisy as necessary */
+ network->set_verbose( verbose );
+ Select::set_verbose( verbose );
}
void STMClient::output_new_frame( void )
@@ -196,29 +268,23 @@
}
/* fetch target state */
- *new_state = network->get_latest_remote_state().state.get_fb();
+ new_state = network->get_latest_remote_state().state.get_fb();
/* apply local overlays */
- overlays.apply( *new_state );
-
- /* apply any mutations */
- display.downgrade( *new_state );
+ overlays.apply( new_state );
/* calculate minimal difference from where we are */
const string diff( display.new_frame( !repaint_requested,
- *local_framebuffer,
- *new_state ) );
+ local_framebuffer,
+ new_state ) );
swrite( STDOUT_FILENO, diff.data(), diff.size() );
repaint_requested = false;
- /* switch pointers */
- Terminal::Framebuffer *tmp = new_state;
- new_state = local_framebuffer;
- local_framebuffer = tmp;
+ local_framebuffer = new_state;
}
-bool STMClient::process_network_input( void )
+void STMClient::process_network_input( void )
{
network->recv();
@@ -229,8 +295,6 @@
overlays.get_prediction_engine().set_local_frame_acked( network->get_sent_state_acked() );
overlays.get_prediction_engine().set_send_interval( network->send_interval() );
overlays.get_prediction_engine().set_local_frame_late_acked( network->get_latest_remote_state().state.get_echo_ack() );
-
- return true;
}
bool STMClient::process_user_input( int fd )
@@ -253,9 +317,7 @@
for ( int i = 0; i < bytes_read; i++ ) {
char the_byte = buf[ i ];
- overlays.get_prediction_engine().new_user_byte( the_byte, *local_framebuffer );
-
- const static wstring help_message( L"Commands: Ctrl-Z suspends, \".\" quits, \"^\" gives literal Ctrl-^" );
+ overlays.get_prediction_engine().new_user_byte( the_byte, local_framebuffer );
if ( quit_sequence_started ) {
if ( the_byte == '.' ) { /* Quit sequence is Ctrl-^ . */
@@ -266,7 +328,7 @@
} else {
return false;
}
- } else if ( the_byte == 0x1a ) { /* Suspend sequence is Ctrl-^ Ctrl-Z */
+ } else if ( the_byte == 0x1a ) { /* Suspend sequence is escape_key Ctrl-Z */
/* Restore terminal and terminal-driver state */
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/frontend/stmclient.h
^
|
@@ -45,24 +45,31 @@
class STMClient {
private:
std::string ip;
- int port;
+ std::string port;
std::string key;
+ int escape_key;
+ int escape_pass_key;
+ int escape_pass_key2;
+ bool escape_requires_lf;
+ std::wstring escape_key_help;
+
struct termios saved_termios, raw_termios;
struct winsize window_size;
- Terminal::Framebuffer *local_framebuffer, *new_state;
+ Terminal::Framebuffer local_framebuffer, new_state;
Overlay::OverlayManager overlays;
Network::Transport< Network::UserStream, Terminal::Complete > *network;
Terminal::Display display;
std::wstring connecting_notification;
- bool repaint_requested, quit_sequence_started;
+ bool repaint_requested, lf_entered, quit_sequence_started;
bool clean_shutdown;
+ unsigned int verbose;
void main_init( void );
- bool process_network_input( void );
+ void process_network_input( void );
bool process_user_input( int fd );
bool process_resize( void );
@@ -77,19 +84,24 @@
void resume( void ); /* restore state after SIGCONT */
public:
- STMClient( const char *s_ip, int s_port, const char *s_key, const char *predict_mode )
- : ip( s_ip ), port( s_port ), key( s_key ),
+ STMClient( const char *s_ip, const char *s_port, const char *s_key, const char *predict_mode, unsigned int s_verbose )
+ : ip( s_ip ? s_ip : "" ), port( s_port ? s_port : "" ),
+ key( s_key ? s_key : "" ),
+ escape_key( 0x1E ), escape_pass_key( '^' ), escape_pass_key2( '^' ),
+ escape_requires_lf( false ), escape_key_help( L"?" ),
saved_termios(), raw_termios(),
window_size(),
- local_framebuffer( NULL ),
- new_state( NULL ),
+ local_framebuffer( 1, 1 ),
+ new_state( 1, 1 ),
overlays(),
network( NULL ),
display( true ), /* use TERM environment var to initialize display */
connecting_notification(),
repaint_requested( false ),
+ lf_entered( false ),
quit_sequence_started( false ),
- clean_shutdown( false )
+ clean_shutdown( false ),
+ verbose( s_verbose )
{
if ( predict_mode ) {
if ( !strcmp( predict_mode, "always" ) ) {
@@ -109,18 +121,10 @@
void init( void );
void shutdown( void );
- void main( void );
+ bool main( void );
~STMClient()
{
- if ( local_framebuffer != NULL ) {
- delete local_framebuffer;
- }
-
- if ( new_state != NULL ) {
- delete new_state;
- }
-
if ( network != NULL ) {
delete network;
}
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/frontend/terminaloverlay.cc
^
|
@@ -61,15 +61,15 @@
if ( unknown ) {
if ( flag && ( col != fb.ds.get_width() - 1 ) ) {
- fb.get_mutable_cell( row, col )->renditions.underlined = true;
+ fb.get_mutable_cell( row, col )->get_renditions().set_attribute(Renditions::underlined, true);
}
return;
}
- if ( !(*(fb.get_cell( row, col )) == replacement) ) {
+ if ( *fb.get_cell( row, col ) != replacement ) {
*(fb.get_mutable_cell( row, col )) = replacement;
if ( flag ) {
- fb.get_mutable_cell( row, col )->renditions.underlined = true;
+ fb.get_mutable_cell( row, col )->get_renditions().set_attribute( Renditions::underlined, true );
}
}
}
@@ -166,8 +166,9 @@
NotificationEngine::NotificationEngine()
: last_word_from_server( timestamp() ),
last_acked_state( timestamp() ),
+ escape_key_string(),
message(),
- message_is_network_exception( false ),
+ message_is_network_error( false ),
message_expiration( -1 ),
show_quit_keystroke( true )
{}
@@ -205,9 +206,9 @@
/* draw bar across top of screen */
Cell notification_bar( 0 );
- notification_bar.renditions.foreground_color = 37;
- notification_bar.renditions.background_color = 44;
- notification_bar.contents.push_back( 0x20 );
+ notification_bar.get_renditions().foreground_color = 37;
+ notification_bar.get_renditions().background_color = 44;
+ notification_bar.append( 0x20 );
for ( int i = 0; i < fb.ds.get_width(); i++ ) {
*(fb.get_mutable_cell( 0, i )) = notification_bar;
@@ -233,22 +234,24 @@
explanation = reply_message;
}
- const static char quit_keystroke[] = " [To quit: Ctrl-^ .]";
const static char blank[] = "";
- const char *keystroke_str = show_quit_keystroke ? quit_keystroke : blank;
+ const char *keystroke_str = show_quit_keystroke ? escape_key_string.c_str() : blank;
if ( message.empty() && (!time_expired) ) {
return;
} else if ( message.empty() && time_expired ) {
swprintf( tmp, 128, L"mosh: Last %s %s ago.%s", explanation,
- human_readable_duration( time_elapsed, "seconds" ).c_str(),
+ human_readable_duration( static_cast<int>( time_elapsed ),
+ "seconds" ).c_str(),
keystroke_str );
} else if ( (!message.empty()) && (!time_expired) ) {
swprintf( tmp, 128, L"mosh: %ls%s", message.c_str(), keystroke_str );
} else {
swprintf( tmp, 128, L"mosh: %ls (%s without %s.)%s", message.c_str(),
- human_readable_duration( time_elapsed, "s" ).c_str(), explanation, keystroke_str );
+ human_readable_duration( static_cast<int>( time_elapsed ),
+ "s" ).c_str(),
+ explanation, keystroke_str );
}
wstring string_to_draw( tmp );
@@ -272,12 +275,12 @@
case 2: /* wide character */
this_cell = fb.get_mutable_cell( 0, overlay_col );
fb.reset_cell( this_cell );
- this_cell->renditions.bold = true;
- this_cell->renditions.foreground_color = 37;
- this_cell->renditions.background_color = 44;
+ this_cell->get_renditions().set_attribute(Renditions::bold, true);
+ this_cell->get_renditions().foreground_color = 37;
+ this_cell->get_renditions().background_color = 44;
- this_cell->contents.push_back( ch );
- this_cell->width = chwidth;
+ this_cell->append( ch );
+ this_cell->set_wide( chwidth == 2 );
combining_cell = this_cell;
overlay_col += chwidth;
@@ -287,14 +290,14 @@
break;
}
- if ( combining_cell->contents.size() == 0 ) {
- assert( combining_cell->width == 1 );
- combining_cell->fallback = true;
+ if ( combining_cell->empty() ) {
+ assert( !combining_cell->get_wide() );
+ combining_cell->set_fallback( true );
overlay_col++;
}
- if ( combining_cell->contents.size() < 16 ) {
- combining_cell->contents.push_back( ch );
+ if ( !combining_cell->full() ) {
+ combining_cell->append( ch );
}
break;
case -1: /* unprintable character */
@@ -342,9 +345,9 @@
title.apply( fb );
}
-void TitleEngine::set_prefix( const wstring s )
+void TitleEngine::set_prefix( const wstring &s )
{
- prefix = deque<wchar_t>( s.begin(), s.end() );
+ prefix = Terminal::Framebuffer::title_type( s.begin(), s.end() );
}
void ConditionalOverlayRow::apply( Framebuffer &fb, uint64_t confirmed_epoch, bool flag ) const
@@ -557,15 +560,15 @@
/* match rest of row to the actual renditions */
{
- const Renditions &actual_renditions = fb.get_cell( i->row_num, j->col )->renditions;
+ const Renditions &actual_renditions = fb.get_cell( i->row_num, j->col )->get_renditions();
for ( overlay_cells_type::iterator k = j;
k != i->overlay_cells.end();
k++ ) {
- k->replacement.renditions = actual_renditions;
+ k->replacement.get_renditions() = actual_renditions;
}
}
- /* no break */
+ /* fallthrough */
case CorrectNoCredit:
j->reset();
@@ -663,9 +666,10 @@
}
last_byte = the_byte;
- list<Parser::Action *> actions( parser.input( the_byte ) );
+ Parser::Actions actions;
+ parser.input( the_byte, actions );
- for ( list<Parser::Action *>::iterator it = actions.begin();
+ for ( Parser::Actions::iterator it = actions.begin();
it != actions.end();
it++ ) {
Parser::Action *act = *it;
@@ -675,7 +679,8 @@
act->name().c_str(), act->char_present ? act->ch : L'_' );
*/
- if ( typeid( *act ) == typeid( Parser::Print ) ) {
+ const std::type_info& type_act = typeid( *act );
+ if ( type_act == typeid( Parser::Print ) ) {
/* make new prediction */
init_cursor( fb );
@@ -772,21 +777,21 @@
cell.active = true;
cell.tentative_until_epoch = prediction_epoch;
cell.expire( local_frame_sent + 1, now );
- cell.replacement.renditions = fb.ds.get_renditions();
+ cell.replacement.get_renditions() = fb.ds.get_renditions();
/* heuristic: match renditions of character to the left */
if ( cursor().col > 0 ) {
ConditionalOverlayCell &prev_cell = the_row.overlay_cells[ cursor().col - 1 ];
const Cell *prev_cell_actual = fb.get_cell( cursor().row, cursor().col - 1 );
if ( prev_cell.active && (!prev_cell.unknown) ) {
- cell.replacement.renditions = prev_cell.replacement.renditions;
+ cell.replacement.get_renditions() = prev_cell.replacement.get_renditions();
} else {
- cell.replacement.renditions = prev_cell_actual->renditions;
+ cell.replacement.get_renditions() = prev_cell_actual->get_renditions();
}
}
- cell.replacement.contents.clear();
- cell.replacement.contents.push_back( ch );
+ cell.replacement.clear();
+ cell.replacement.append( ch );
cell.original_contents.push_back( *fb.get_cell( cursor().row, cursor().col ) );
/*
@@ -806,7 +811,7 @@
newline_carriage_return( fb );
}
}
- } else if ( typeid( *act ) == typeid( Parser::Execute ) ) {
+ } else if ( type_act == typeid( Parser::Execute ) ) {
if ( act->char_present && (act->ch == 0x0d) /* CR */ ) {
become_tentative();
newline_carriage_return( fb );
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/frontend/terminaloverlay.h
^
|
@@ -144,8 +144,9 @@
private:
uint64_t last_word_from_server;
uint64_t last_acked_state;
+ string escape_key_string;
wstring message;
- bool message_is_network_exception;
+ bool message_is_network_error;
uint64_t message_expiration;
bool show_quit_keystroke;
@@ -169,23 +170,30 @@
} else {
message_expiration = timestamp() + 1000;
}
- message_is_network_exception = false;
+ message_is_network_error = false;
show_quit_keystroke = s_show_quit_keystroke;
}
- void set_network_exception( const NetworkException &e )
+ void set_escape_key_string( const string &s_name )
+ {
+ char tmp[ 128 ];
+ snprintf( tmp, sizeof tmp, " [To quit: %s .]", s_name.c_str() );
+ escape_key_string = tmp;
+ }
+
+ void set_network_error( const std::string &s )
{
wchar_t tmp[ 128 ];
- swprintf( tmp, 128, L"%s: %s", e.function.c_str(), strerror( e.the_errno ) );
+ swprintf( tmp, 128, L"%s", s.c_str() );
message = tmp;
- message_is_network_exception = true;
+ message_is_network_error = true;
message_expiration = timestamp() + Network::ACK_INTERVAL + 100;
}
- void clear_network_exception()
+ void clear_network_error()
{
- if ( message_is_network_exception ) {
+ if ( message_is_network_error ) {
message_expiration = std::min( message_expiration, timestamp() + 1000 );
}
}
@@ -301,12 +309,12 @@
class TitleEngine {
private:
- deque<wchar_t> prefix;
+ Terminal::Framebuffer::title_type prefix;
public:
void apply( Framebuffer &fb ) const { fb.prefix_window_title( prefix ); }
- void set_prefix( const wstring s );
TitleEngine() : prefix() {}
+ void set_prefix( const wstring &s );
};
/* the overlay manager */
@@ -322,7 +330,7 @@
NotificationEngine & get_notification_engine( void ) { return notifications; }
PredictionEngine & get_prediction_engine( void ) { return predictions; }
- void set_title_prefix( const wstring s ) { title.set_prefix( s ); }
+ void set_title_prefix( const wstring &s ) { title.set_prefix( s ); }
OverlayManager() : notifications(), predictions(), title() {}
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/network/Makefile.am
^
|
@@ -3,4 +3,4 @@
noinst_LIBRARIES = libmoshnetwork.a
-libmoshnetwork_a_SOURCES = network.cc network.h networktransport.cc networktransport.h transportfragment.cc transportfragment.h transportsender.cc transportsender.h transportstate.h compressor.cc compressor.h
+libmoshnetwork_a_SOURCES = network.cc network.h networktransport-impl.h networktransport.h transportfragment.cc transportfragment.h transportsender-impl.h transportsender.h transportstate.h compressor.cc compressor.h
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/network/Makefile.in
^
|
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -16,23 +15,61 @@
@SET_MAKE@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
esac; \
- test $$am__dry = yes; \
- }
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -50,7 +87,6 @@
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = src/network
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_check_library.m4 \
@@ -59,6 +95,7 @@
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
@@ -67,16 +104,25 @@
ARFLAGS = cru
AM_V_AR = $(am__v_AR_@AM_V@)
am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@)
-am__v_AR_0 = @echo " AR " $@;
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
+am__v_AR_0 = @echo " AR " $@;
+am__v_AR_1 =
libmoshnetwork_a_AR = $(AR) $(ARFLAGS)
libmoshnetwork_a_LIBADD =
am_libmoshnetwork_a_OBJECTS = network.$(OBJEXT) \
- networktransport.$(OBJEXT) transportfragment.$(OBJEXT) \
- transportsender.$(OBJEXT) compressor.$(OBJEXT)
+ transportfragment.$(OBJEXT) compressor.$(OBJEXT)
libmoshnetwork_a_OBJECTS = $(am_libmoshnetwork_a_OBJECTS)
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -85,26 +131,27 @@
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
AM_V_CXX = $(am__v_CXX_@AM_V@)
am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
-am__v_CXX_0 = @echo " CXX " $@;
+am__v_CXX_0 = @echo " CXX " $@;
+am__v_CXX_1 =
CXXLD = $(CXX)
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
-o $@
AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
-am__v_CXXLD_0 = @echo " CXXLD " $@;
+am__v_CXXLD_0 = @echo " CXXLD " $@;
+am__v_CXXLD_1 =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
-am__v_CC_0 = @echo " CC " $@;
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo " CCLD " $@;
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
SOURCES = $(libmoshnetwork_a_SOURCES)
DIST_SOURCES = $(libmoshnetwork_a_SOURCES)
am__can_run_installinfo = \
@@ -112,8 +159,26 @@
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
@@ -123,13 +188,20 @@
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/network/network.cc
^
|
@@ -37,13 +37,15 @@
#ifdef HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif
+#include <netdb.h>
#include <netinet/in.h>
-#include <arpa/inet.h>
#include <assert.h>
#include <errno.h>
+#include <string.h>
#include <unistd.h>
#include "dos_assert.h"
+#include "fatal_assert.h"
#include "byteorder.h"
#include "network.h"
#include "crypto.h"
@@ -54,6 +56,10 @@
#define MSG_DONTWAIT MSG_NONBLOCK
#endif
+#ifndef AI_NUMERICSERV
+#define AI_NUMERICSERV 0
+#endif
+
using namespace std;
using namespace Network;
using namespace Crypto;
@@ -61,30 +67,25 @@
const uint64_t DIRECTION_MASK = uint64_t(1) << 63;
const uint64_t SEQUENCE_MASK = uint64_t(-1) ^ DIRECTION_MASK;
-/* Read in packet from coded string */
-Packet::Packet( string coded_packet, Session *session )
- : seq( -1 ),
- direction( TO_SERVER ),
+/* Read in packet */
+Packet::Packet( const Message & message )
+ : seq( message.nonce.val() & SEQUENCE_MASK ),
+ direction( (message.nonce.val() & DIRECTION_MASK) ? TO_CLIENT : TO_SERVER ),
timestamp( -1 ),
timestamp_reply( -1 ),
payload()
{
- Message message = session->decrypt( coded_packet );
-
- direction = (message.nonce.val() & DIRECTION_MASK) ? TO_CLIENT : TO_SERVER;
- seq = message.nonce.val() & SEQUENCE_MASK;
-
dos_assert( message.text.size() >= 2 * sizeof( uint16_t ) );
- uint16_t *data = (uint16_t *)message.text.data();
+ const uint16_t *data = (uint16_t *)message.text.data();
timestamp = be16toh( data[ 0 ] );
timestamp_reply = be16toh( data[ 1 ] );
payload = string( message.text.begin() + 2 * sizeof( uint16_t ), message.text.end() );
}
-/* Output coded string from packet */
-string Packet::tostring( Session *session )
+/* Output from packet */
+Message Packet::toMessage( void )
{
uint64_t direction_seq = (uint64_t( direction == TO_CLIENT ) << 63) | (seq & SEQUENCE_MASK);
@@ -93,10 +94,10 @@
string timestamps = string( (char *)ts_net, 2 * sizeof( uint16_t ) );
- return session->encrypt( Message( Nonce( direction_seq ), timestamps + payload ) );
+ return Message( Nonce( direction_seq ), timestamps + payload );
}
-Packet Connection::new_packet( string &s_payload )
+Packet Connection::new_packet( const string &s_payload )
{
uint16_t outgoing_timestamp_reply = -1;
@@ -109,7 +110,7 @@
saved_timestamp_received_at = 0;
}
- Packet p( next_seq++, direction, timestamp16(), outgoing_timestamp_reply, s_payload );
+ Packet p( direction, timestamp16(), outgoing_timestamp_reply, s_payload );
return p;
}
@@ -119,6 +120,8 @@
assert( !server );
setup();
+ assert( remote_addr_len != 0 );
+ socks.push_back( Socket( remote_addr.sa.sa_family ) );
prune_sockets();
}
@@ -146,8 +149,8 @@
}
}
-Connection::Socket::Socket()
- : _fd( socket( AF_INET, SOCK_DGRAM, 0 ) )
+Connection::Socket::Socket( int family )
+ : _fd( socket( family, SOCK_DGRAM, 0 ) )
{
if ( _fd < 0 ) {
throw NetworkException( "socket", errno );
@@ -155,34 +158,32 @@
/* Disable path MTU discovery */
#ifdef HAVE_IP_MTU_DISCOVER
- char flag = IP_PMTUDISC_DONT;
- socklen_t optlen = sizeof( flag );
- if ( setsockopt( _fd, IPPROTO_IP, IP_MTU_DISCOVER, &flag, optlen ) < 0 ) {
+ int flag = IP_PMTUDISC_DONT;
+ if ( setsockopt( _fd, IPPROTO_IP, IP_MTU_DISCOVER, &flag, sizeof flag ) < 0 ) {
throw NetworkException( "setsockopt", errno );
}
#endif
// int dscp = 0x92; /* OS X does not have IPTOS_DSCP_AF42 constant */
int dscp = 0x02; /* ECN-capable transport only */
- if ( setsockopt( _fd, IPPROTO_IP, IP_TOS, &dscp, sizeof (dscp)) < 0 ) {
+ if ( setsockopt( _fd, IPPROTO_IP, IP_TOS, &dscp, sizeof dscp ) < 0 ) {
// perror( "setsockopt( IP_TOS )" );
}
/* request explicit congestion notification on received datagrams */
#ifdef HAVE_IP_RECVTOS
int tosflag = true;
- socklen_t tosoptlen = sizeof( tosflag );
- if ( setsockopt( _fd, IPPROTO_IP, IP_RECVTOS, &tosflag, tosoptlen ) < 0 ) {
- perror( "setsockopt( IP_RECVTOS )" );
+ if ( setsockopt( _fd, IPPROTO_IP, IP_RECVTOS, &tosflag, sizeof tosflag ) < 0 ) {
+ /* FreeBSD disallows this option on IPv6 sockets. */
+ if ( family == IPPROTO_IP ) {
+ perror( "setsockopt( IP_RECVTOS )" );
+ }
}
#endif
}
void Connection::setup( void )
{
- /* create socket */
- socks.push_back( Socket() );
-
last_port_choice = timestamp();
}
@@ -199,16 +200,47 @@
return ret;
}
+void Connection::set_MTU( int family )
+{
+ switch ( family ) {
+ case AF_INET:
+ MTU = DEFAULT_IPV4_MTU - IPV4_HEADER_LEN;
+ break;
+ case AF_INET6:
+ MTU = DEFAULT_IPV6_MTU - IPV6_HEADER_LEN;
+ break;
+ default:
+ throw NetworkException( "Unknown address family", 0 );
+ }
+}
+
+class AddrInfo {
+public:
+ struct addrinfo *res;
+ AddrInfo( const char *node, const char *service,
+ const struct addrinfo *hints ) :
+ res( NULL ) {
+ int errcode = getaddrinfo( node, service, hints, &res );
+ if ( errcode != 0 ) {
+ throw NetworkException( std::string( "Bad IP address (" ) + (node != NULL ? node : "(null)") + "): " + gai_strerror( errcode ), 0 );
+ }
+ }
+ ~AddrInfo() { freeaddrinfo(res); }
+private:
+ AddrInfo(const AddrInfo &);
+ AddrInfo &operator=(const AddrInfo &);
+};
+
Connection::Connection( const char *desired_ip, const char *desired_port ) /* server */
: socks(),
has_remote_addr( false ),
remote_addr(),
+ remote_addr_len( 0 ),
server( true ),
MTU( DEFAULT_SEND_MTU ),
key(),
session( key ),
direction( TO_CLIENT ),
- next_seq( 0 ),
saved_timestamp( -1 ),
saved_timestamp_received_at( 0 ),
expected_receiver_seq( 0 ),
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/network/network.h
^
|
@@ -41,6 +41,8 @@
#include <math.h>
#include <vector>
#include <assert.h>
+#include <exception>
+#include <string.h>
#include "crypto.h"
@@ -53,12 +55,18 @@
uint16_t timestamp16( void );
uint16_t timestamp_diff( uint16_t tsnew, uint16_t tsold );
- class NetworkException {
+ class NetworkException : public std::exception {
public:
string function;
int the_errno;
- NetworkException( string s_function, int s_errno ) : function( s_function ), the_errno( s_errno ) {}
- NetworkException() : function( "<none>" ), the_errno( 0 ) {}
+ private:
+ string my_what;
+ public:
+ NetworkException( string s_function="<none>", int s_errno=0)
+ : function( s_function ), the_errno( s_errno ),
+ my_what(function + ": " + strerror(the_errno)) {}
+ const char *what() const throw () { return my_what.c_str(); }
+ ~NetworkException() throw () {}
};
enum Direction {
@@ -68,25 +76,60 @@
class Packet {
public:
- uint64_t seq;
+ const uint64_t seq;
Direction direction;
uint16_t timestamp, timestamp_reply;
string payload;
- Packet( uint64_t s_seq, Direction s_direction,
- uint16_t s_timestamp, uint16_t s_timestamp_reply, string s_payload )
- : seq( s_seq ), direction( s_direction ),
+ Packet( Direction s_direction,
+ uint16_t s_timestamp, uint16_t s_timestamp_reply, const string & s_payload )
+ : seq( Crypto::unique() ), direction( s_direction ),
timestamp( s_timestamp ), timestamp_reply( s_timestamp_reply ), payload( s_payload )
{}
- Packet( string coded_packet, Session *session );
+ Packet( const Message & message );
- string tostring( Session *session );
+ Message toMessage( void );
+ };
+
+ union Addr {
+ struct sockaddr sa;
+ struct sockaddr_in sin;
+ struct sockaddr_in6 sin6;
+ struct sockaddr_storage ss;
};
class Connection {
private:
- static const int DEFAULT_SEND_MTU = 1300;
+ /*
+ * For IPv4, guess the typical (minimum) header length;
+ * fragmentation is not dangerous, just inefficient.
+ */
+ static const int IPV4_HEADER_LEN = 20 /* base IP header */
+ + 8 /* UDP */;
+ /*
+ * For IPv6, we don't want to ever have MTU issues, so make a
+ * conservative guess about header size.
+ */
+ static const int IPV6_HEADER_LEN = 40 /* base IPv6 header */
+ + 16 /* 2 minimum-sized extension headers */
+ + 8 /* UDP */;
+ /* Application datagram MTU. For constructors and fallback. */
+ static const int DEFAULT_SEND_MTU = 500;
+ /*
+ * IPv4 MTU. Don't use full Ethernet-derived MTU,
+ * mobile networks have high tunneling overhead.
+ *
+ * As of July 2016, VPN traffic over Amtrak Acela wifi seems to be
+ * dropped if tunnelled packets are 1320 bytes or larger. Use a
+ * 1280-byte IPv4 MTU for now.
+ *
+ * We may have to implement ICMP-less PMTUD (RFC 4821) eventually.
+ */
+ static const int DEFAULT_IPV4_MTU = 1280;
+ /* IPv6 MTU. Use the guaranteed minimum to avoid fragmentation. */
+ static const int DEFAULT_IPV6_MTU = 1280;
+
static const uint64_t MIN_RTO = 50; /* ms */
static const uint64_t MAX_RTO = 1000; /* ms */
@@ -101,7 +144,7 @@
static const int CONGESTION_TIMESTAMP_PENALTY = 500; /* ms */
- static bool try_bind( int socket, uint32_t addr, int port_low, int port_high );
+ bool try_bind( const char *addr, int port_low, int port_high );
class Socket
{
@@ -110,7 +153,7 @@
public:
int fd( void ) const { return _fd; }
- Socket();
+ Socket( int family );
~Socket();
Socket( const Socket & other );
@@ -119,11 +162,12 @@
std::deque< Socket > socks;
bool has_remote_addr;
- struct sockaddr_in remote_addr;
+ Addr remote_addr;
+ socklen_t remote_addr_len;
bool server;
- int MTU;
+ int MTU; /* application datagram MTU */
Base64Key key;
Session session;
@@ -131,7 +175,6 @@
void setup( void );
Direction direction;
- uint64_t next_seq;
uint16_t saved_timestamp;
uint64_t saved_timestamp_received_at;
uint64_t expected_receiver_seq;
@@ -144,12 +187,10 @@
double SRTT;
double RTTVAR;
- /* Exception from send(), to be delivered if the frontend asks for it,
- without altering control flow. */
- bool have_send_exception;
- NetworkException send_exception;
+ /* Error from send()/sendto(). */
+ string send_error;
- Packet new_packet( string &s_payload );
+ Packet new_packet( const string &s_payload );
void hop_port( void );
@@ -159,27 +200,33 @@
string recv_one( int sock_to_recv, bool nonblocking );
+ void set_MTU( int family );
+
public:
+ /* Network transport overhead. */
+ static const int ADDED_BYTES = 8 /* seqno/nonce */ + 4 /* timestamps */;
+
Connection( const char *desired_ip, const char *desired_port ); /* server */
- Connection( const char *key_str, const char *ip, int port ); /* client */
+ Connection( const char *key_str, const char *ip, const char *port ); /* client */
- void send( string s );
+ void send( const string & s );
string recv( void );
const std::vector< int > fds( void ) const;
int get_MTU( void ) const { return MTU; }
- int port( void ) const;
+ std::string port( void ) const;
string get_key( void ) const { return key.printable_key(); }
bool get_has_remote_addr( void ) const { return has_remote_addr; }
uint64_t timeout( void ) const;
double get_SRTT( void ) const { return SRTT; }
- const struct in_addr & get_remote_ip( void ) const { return remote_addr.sin_addr; }
+ const Addr &get_remote_addr( void ) const { return remote_addr; }
+ socklen_t get_remote_addr_len( void ) const { return remote_addr_len; }
- const NetworkException *get_send_exception( void ) const
+ string &get_send_error( void )
{
- return have_send_exception ? &send_exception : NULL;
+ return send_error;
}
void set_last_roundtrip_success( uint64_t s_success ) { last_roundtrip_success = s_success; }
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/network/networktransport-impl.h
^
|
@@ -0,0 +1,207 @@
+/*
+ Mosh: the mobile shell
+ Copyright 2012 Keith Winstein
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of portions of this program with the
+ OpenSSL library under certain conditions as described in each
+ individual source file, and distribute linked combinations including
+ the two.
+
+ You must obey the GNU General Public License in all respects for all
+ of the code used other than OpenSSL. If you modify file(s) with this
+ exception, you may extend this exception to your version of the
+ file(s), but you are not obligated to do so. If you do not wish to do
+ so, delete this exception statement from your version. If you delete
+ this exception statement from all source files in the program, then
+ also delete it here.
+*/
+
+#ifndef NETWORK_TRANSPORT_IMPL_HPP
+#define NETWORK_TRANSPORT_IMPL_HPP
+
+#include "networktransport.h"
+
+#include "transportsender-impl.h"
+
+using namespace Network;
+using namespace std;
+
+template <class MyState, class RemoteState>
+Transport<MyState, RemoteState>::Transport( MyState &initial_state, RemoteState &initial_remote,
+ const char *desired_ip, const char *desired_port )
+ : connection( desired_ip, desired_port ),
+ sender( &connection, initial_state ),
+ received_states( 1, TimestampedState<RemoteState>( timestamp(), 0, initial_remote ) ),
+ receiver_quench_timer( 0 ),
+ last_receiver_state( initial_remote ),
+ fragments(),
+ verbose( 0 )
+{
+ /* server */
+}
+
+template <class MyState, class RemoteState>
+Transport<MyState, RemoteState>::Transport( MyState &initial_state, RemoteState &initial_remote,
+ const char *key_str, const char *ip, const char *port )
+ : connection( key_str, ip, port ),
+ sender( &connection, initial_state ),
+ received_states( 1, TimestampedState<RemoteState>( timestamp(), 0, initial_remote ) ),
+ receiver_quench_timer( 0 ),
+ last_receiver_state( initial_remote ),
+ fragments(),
+ verbose( 0 )
+{
+ /* client */
+}
+
+template <class MyState, class RemoteState>
+void Transport<MyState, RemoteState>::recv( void )
+{
+ string s( connection.recv() );
+ Fragment frag( s );
+
+ if ( fragments.add_fragment( frag ) ) { /* complete packet */
+ Instruction inst = fragments.get_assembly();
+
+ if ( inst.protocol_version() != MOSH_PROTOCOL_VERSION ) {
+ throw NetworkException( "mosh protocol version mismatch", 0 );
+ }
+
+ sender.process_acknowledgment_through( inst.ack_num() );
+
+ /* inform network layer of roundtrip (end-to-end-to-end) connectivity */
+ connection.set_last_roundtrip_success( sender.get_sent_state_acked_timestamp() );
+
+ /* first, make sure we don't already have the new state */
+ for ( typename list< TimestampedState<RemoteState> >::iterator i = received_states.begin();
+ i != received_states.end();
+ i++ ) {
+ if ( inst.new_num() == i->num ) {
+ return;
+ }
+ }
+
+ /* now, make sure we do have the old state */
+ bool found = 0;
+ typename list< TimestampedState<RemoteState> >::iterator reference_state = received_states.begin();
+ while ( reference_state != received_states.end() ) {
+ if ( inst.old_num() == reference_state->num ) {
+ found = true;
+ break;
+ }
+ reference_state++;
+ }
+
+ if ( !found ) {
+ // fprintf( stderr, "Ignoring out-of-order packet. Reference state %d has been discarded or hasn't yet been received.\n", int(inst.old_num) );
+ return; /* this is security-sensitive and part of how we enforce idempotency */
+ }
+
+ /* Do not accept state if our queue is full */
+ /* This is better than dropping states from the middle of the
+ queue (as sender does), because we don't want to ACK a state
+ and then discard it later. */
+
+ process_throwaway_until( inst.throwaway_num() );
+
+ if ( received_states.size() > 1024 ) { /* limit on state queue */
+ uint64_t now = timestamp();
+ if ( now < receiver_quench_timer ) { /* deny letting state grow further */
+ if ( verbose ) {
+ fprintf( stderr, "[%u] Receiver queue full, discarding %d (malicious sender or long-unidirectional connectivity?)\n",
+ (unsigned int)(timestamp() % 100000), (int)inst.new_num() );
+ }
+ return;
+ } else {
+ receiver_quench_timer = now + 15000;
+ }
+ }
+
+ /* apply diff to reference state */
+ TimestampedState<RemoteState> new_state = *reference_state;
+ new_state.timestamp = timestamp();
+ new_state.num = inst.new_num();
+
+ if ( !inst.diff().empty() ) {
+ new_state.state.apply_string( inst.diff() );
+ }
+
+ /* Insert new state in sorted place */
+ for ( typename list< TimestampedState<RemoteState> >::iterator i = received_states.begin();
+ i != received_states.end();
+ i++ ) {
+ if ( i->num > new_state.num ) {
+ received_states.insert( i, new_state );
+ if ( verbose ) {
+ fprintf( stderr, "[%u] Received OUT-OF-ORDER state %d [ack %d]\n",
+ (unsigned int)(timestamp() % 100000), (int)new_state.num, (int)inst.ack_num() );
+ }
+ return;
+ }
+ }
+ if ( verbose ) {
+ fprintf( stderr, "[%u] Received state %d [coming from %d, ack %d]\n",
+ (unsigned int)(timestamp() % 100000), (int)new_state.num, (int)inst.old_num(), (int)inst.ack_num() );
+ }
+ received_states.push_back( new_state );
+ sender.set_ack_num( received_states.back().num );
+
+ sender.remote_heard( new_state.timestamp );
+ if ( !inst.diff().empty() ) {
+ sender.set_data_ack();
+ }
+ }
+}
+
+/* The sender uses throwaway_num to tell us the earliest received state that we need to keep around */
+template <class MyState, class RemoteState>
+void Transport<MyState, RemoteState>::process_throwaway_until( uint64_t throwaway_num )
+{
+ typename list< TimestampedState<RemoteState> >::iterator i = received_states.begin();
+ while ( i != received_states.end() ) {
+ typename list< TimestampedState<RemoteState> >::iterator inext = i;
+ inext++;
+ if ( i->num < throwaway_num ) {
+ received_states.erase( i );
+ }
+ i = inext;
+ }
+
+ fatal_assert( received_states.size() > 0 );
+}
+
+template <class MyState, class RemoteState>
+string Transport<MyState, RemoteState>::get_remote_diff( void )
+{
+ /* find diff between last receiver state and current remote state, then rationalize states */
+
+ string ret( received_states.back().state.diff_from( last_receiver_state ) );
+
+ const RemoteState *oldest_receiver_state = &received_states.front().state;
+
+ for ( typename list< TimestampedState<RemoteState> >::reverse_iterator i = received_states.rbegin();
+ i != received_states.rend();
+ i++ ) {
+ i->state.subtract( oldest_receiver_state );
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/network/networktransport.h
^
|
@@ -63,13 +63,13 @@
uint64_t receiver_quench_timer;
RemoteState last_receiver_state; /* the state we were in when user last queried state */
FragmentAssembly fragments;
- bool verbose;
+ unsigned int verbose;
public:
Transport( MyState &initial_state, RemoteState &initial_remote,
const char *desired_ip, const char *desired_port );
Transport( MyState &initial_state, RemoteState &initial_remote,
- const char *key_str, const char *ip, int port );
+ const char *key_str, const char *ip, const char *port );
/* Send data or an ack if necessary. */
void tick( void ) { sender.tick(); }
@@ -94,7 +94,7 @@
/* Other side has requested shutdown and we have sent one ACK */
bool counterparty_shutdown_ack_sent( void ) const { return sender.get_counterparty_shutdown_acknowledged(); }
- int port( void ) const { return connection.port(); }
+ std::string port( void ) const { return connection.port(); }
string get_key( void ) const { return connection.get_key(); }
MyState &get_current_state( void ) { return sender.get_current_state(); }
@@ -106,7 +106,7 @@
const std::vector< int > fds( void ) const { return connection.fds(); }
- void set_verbose( void ) { sender.set_verbose(); verbose = true; }
+ void set_verbose( unsigned int s_verbose ) { sender.set_verbose( s_verbose ); verbose = s_verbose; }
void set_send_delay( int new_delay ) { sender.set_send_delay( new_delay ); }
@@ -116,9 +116,10 @@
unsigned int send_interval( void ) const { return sender.send_interval(); }
- const struct in_addr & get_remote_ip( void ) const { return connection.get_remote_ip(); }
+ const Addr &get_remote_addr( void ) const { return connection.get_remote_addr(); }
+ socklen_t get_remote_addr_len( void ) const { return connection.get_remote_addr_len(); }
- const NetworkException *get_send_exception( void ) const { return connection.get_send_exception(); }
+ std::string &get_send_error( void ) { return connection.get_send_error(); }
};
}
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/network/transportfragment.cc
^
|
@@ -72,7 +72,7 @@
return ret;
}
-Fragment::Fragment( string &x )
+Fragment::Fragment( const string &x )
: id( -1 ), fragment_num( -1 ), final( false ), initialized( true ),
contents()
{
@@ -148,14 +148,15 @@
return ret;
}
-bool Fragment::operator==( const Fragment &x )
+bool Fragment::operator==( const Fragment &x ) const
{
return ( id == x.id ) && ( fragment_num == x.fragment_num ) && ( final == x.final )
&& ( initialized == x.initialized ) && ( contents == x.contents );
}
-vector<Fragment> Fragmenter::make_fragments( const Instruction &inst, int MTU )
+vector<Fragment> Fragmenter::make_fragments( const Instruction &inst, size_t MTU )
{
+ MTU -= Fragment::frag_header_len;
if ( (inst.old_num() != last_instruction.old_num())
|| (inst.new_num() != last_instruction.new_num())
|| (inst.ack_num() != last_instruction.ack_num())
@@ -182,9 +183,9 @@
string this_fragment;
bool final = false;
- if ( int( payload.size() + HEADER_LEN ) > MTU ) {
- this_fragment = string( payload.begin(), payload.begin() + MTU - HEADER_LEN );
- payload = string( payload.begin() + MTU - HEADER_LEN, payload.end() );
+ if ( payload.size() > MTU ) {
+ this_fragment = string( payload.begin(), payload.begin() + MTU );
+ payload = string( payload.begin() + MTU, payload.end() );
} else {
this_fragment = payload;
payload.clear();
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/network/transportfragment.h
^
|
@@ -44,14 +44,11 @@
using namespace TransportBuffers;
namespace Network {
- static const int HEADER_LEN = 66;
-
class Fragment
{
- private:
+ public:
static const size_t frag_header_len = sizeof( uint64_t ) + sizeof( uint16_t );
- public:
uint64_t id;
uint16_t fragment_num;
bool final;
@@ -64,16 +61,16 @@
: id( -1 ), fragment_num( -1 ), final( false ), initialized( false ), contents()
{}
- Fragment( uint64_t s_id, uint16_t s_fragment_num, bool s_final, string s_contents )
+ Fragment( uint64_t s_id, uint16_t s_fragment_num, bool s_final, const string & s_contents )
: id( s_id ), fragment_num( s_fragment_num ), final( s_final ), initialized( true ),
contents( s_contents )
{}
- Fragment( string &x );
+ Fragment( const string &x );
string tostring( void );
- bool operator==( const Fragment &x );
+ bool operator==( const Fragment &x ) const;
};
class FragmentAssembly
@@ -94,7 +91,7 @@
private:
uint64_t next_instruction_id;
Instruction last_instruction;
- int last_MTU;
+ size_t last_MTU;
public:
Fragmenter() : next_instruction_id( 0 ), last_instruction(), last_MTU( -1 )
@@ -102,7 +99,7 @@
last_instruction.set_old_num( -1 );
last_instruction.set_new_num( -1 );
}
- vector<Fragment> make_fragments( const Instruction &inst, int MTU );
+ vector<Fragment> make_fragments( const Instruction &inst, size_t MTU );
uint64_t last_ack_sent( void ) const { return last_instruction.ack_num(); }
};
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/network/transportsender-impl.h
^
|
@@ -0,0 +1,417 @@
+/*
+ Mosh: the mobile shell
+ Copyright 2012 Keith Winstein
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of portions of this program with the
+ OpenSSL library under certain conditions as described in each
+ individual source file, and distribute linked combinations including
+ the two.
+
+ You must obey the GNU General Public License in all respects for all
+ of the code used other than OpenSSL. If you modify file(s) with this
+ exception, you may extend this exception to your version of the
+ file(s), but you are not obligated to do so. If you do not wish to do
+ so, delete this exception statement from your version. If you delete
+ this exception statement from all source files in the program, then
+ also delete it here.
+*/
+
+#ifndef TRANSPORT_SENDER_IMPL_HPP
+#define TRANSPORT_SENDER_IMPL_HPP
+
+#include <algorithm>
+#include <list>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
+#include "transportsender.h"
+#include "transportfragment.h"
+
+#include <limits.h>
+
+using namespace Network;
+using namespace std;
+
+template <class MyState>
+TransportSender<MyState>::TransportSender( Connection *s_connection, MyState &initial_state )
+ : connection( s_connection ),
+ current_state( initial_state ),
+ sent_states( 1, TimestampedState<MyState>( timestamp(), 0, initial_state ) ),
+ assumed_receiver_state( sent_states.begin() ),
+ fragmenter(),
+ next_ack_time( timestamp() ),
+ next_send_time( timestamp() ),
+ verbose( 0 ),
+ shutdown_in_progress( false ),
+ shutdown_tries( 0 ),
+ shutdown_start( -1 ),
+ ack_num( 0 ),
+ pending_data_ack( false ),
+ SEND_MINDELAY( 8 ),
+ last_heard( 0 ),
+ prng(),
+ mindelay_clock( -1 )
+{
+}
+
+/* Try to send roughly two frames per RTT, bounded by limits on frame rate */
+template <class MyState>
+unsigned int TransportSender<MyState>::send_interval( void ) const
+{
+ int SEND_INTERVAL = lrint( ceil( connection->get_SRTT() / 2.0 ) );
+ if ( SEND_INTERVAL < SEND_INTERVAL_MIN ) {
+ SEND_INTERVAL = SEND_INTERVAL_MIN;
+ } else if ( SEND_INTERVAL > SEND_INTERVAL_MAX ) {
+ SEND_INTERVAL = SEND_INTERVAL_MAX;
+ }
+
+ return SEND_INTERVAL;
+}
+
+/* Housekeeping routine to calculate next send and ack times */
+template <class MyState>
+void TransportSender<MyState>::calculate_timers( void )
+{
+ uint64_t now = timestamp();
+
+ /* Update assumed receiver state */
+ update_assumed_receiver_state();
+
+ /* Cut out common prefix of all states */
+ rationalize_states();
+
+ if ( pending_data_ack && (next_ack_time > now + ACK_DELAY) ) {
+ next_ack_time = now + ACK_DELAY;
+ }
+
+ if ( !(current_state == sent_states.back().state) ) {
+ if ( mindelay_clock == uint64_t( -1 ) ) {
+ mindelay_clock = now;
+ }
+
+ next_send_time = max( mindelay_clock + SEND_MINDELAY,
+ sent_states.back().timestamp + send_interval() );
+ } else if ( !(current_state == assumed_receiver_state->state)
+ && (last_heard + ACTIVE_RETRY_TIMEOUT > now) ) {
+ next_send_time = sent_states.back().timestamp + send_interval();
+ if ( mindelay_clock != uint64_t( -1 ) ) {
+ next_send_time = max( next_send_time, mindelay_clock + SEND_MINDELAY );
+ }
+ } else if ( !(current_state == sent_states.front().state )
+ && (last_heard + ACTIVE_RETRY_TIMEOUT > now) ) {
+ next_send_time = sent_states.back().timestamp + connection->timeout() + ACK_DELAY;
+ } else {
+ next_send_time = uint64_t(-1);
+ }
+
+ /* speed up shutdown sequence */
+ if ( shutdown_in_progress || (ack_num == uint64_t(-1)) ) {
+ next_ack_time = sent_states.back().timestamp + send_interval();
+ }
+}
+
+/* How many ms to wait until next event */
+template <class MyState>
+int TransportSender<MyState>::wait_time( void )
+{
+ calculate_timers();
+
+ uint64_t next_wakeup = next_ack_time;
+ if ( next_send_time < next_wakeup ) {
+ next_wakeup = next_send_time;
+ }
+
+ uint64_t now = timestamp();
+
+ if ( !connection->get_has_remote_addr() ) {
+ return INT_MAX;
+ }
+
+ if ( next_wakeup > now ) {
+ return next_wakeup - now;
+ } else {
+ return 0;
+ }
+}
+
+/* Send data or an empty ack if necessary */
+template <class MyState>
+void TransportSender<MyState>::tick( void )
+{
+ calculate_timers(); /* updates assumed receiver state and rationalizes */
+
+ if ( !connection->get_has_remote_addr() ) {
+ return;
+ }
+
+ uint64_t now = timestamp();
+
+ if ( (now < next_ack_time)
+ && (now < next_send_time) ) {
+ return;
+ }
+
+ /* Determine if a new diff or empty ack needs to be sent */
+
+ string diff = current_state.diff_from( assumed_receiver_state->state );
+
+ attempt_prospective_resend_optimization( diff );
+
+ if ( verbose ) {
+ /* verify diff has round-trip identity (modulo Unicode fallback rendering) */
+ MyState newstate( assumed_receiver_state->state );
+ newstate.apply_string( diff );
+ if ( current_state.compare( newstate ) ) {
+ fprintf( stderr, "Warning, round-trip Instruction verification failed!\n" );
+ }
+ /* Also verify that both the original frame and generated frame have the same initial diff. */
+ std::string current_diff( current_state.init_diff() );
+ std::string new_diff( newstate.init_diff() );
+ if ( current_diff != new_diff ) {
+ fprintf( stderr, "Warning, target state Instruction verification failed!\n" );
+ }
+ }
+
+ if ( diff.empty() ) {
+ if ( (now >= next_ack_time) ) {
+ send_empty_ack();
+ mindelay_clock = uint64_t( -1 );
+ }
+ if ( (now >= next_send_time) ) {
+ next_send_time = uint64_t( -1 );
+ mindelay_clock = uint64_t( -1 );
+ }
+ } else if ( (now >= next_send_time) || (now >= next_ack_time) ) {
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/network/transportsender.h
^
|
@@ -64,9 +64,9 @@
void update_assumed_receiver_state( void );
void attempt_prospective_resend_optimization( string &proposed_diff );
void rationalize_states( void );
- void send_to_receiver( string diff );
+ void send_to_receiver( const string & diff );
void send_empty_ack( void );
- void send_in_fragments( string diff, uint64_t new_num );
+ void send_in_fragments( const string & diff, uint64_t new_num );
void add_sent_state( uint64_t the_timestamp, uint64_t num, MyState &state );
/* state of sender */
@@ -91,7 +91,7 @@
void calculate_timers( void );
- bool verbose;
+ unsigned int verbose;
bool shutdown_in_progress;
int shutdown_tries;
uint64_t shutdown_start;
@@ -138,8 +138,13 @@
/* Misc. getters and setters */
/* Cannot modify current_state while shutdown in progress */
MyState &get_current_state( void ) { assert( !shutdown_in_progress ); return current_state; }
- void set_current_state( const MyState &x ) { assert( !shutdown_in_progress ); current_state = x; }
- void set_verbose( void ) { verbose = true; }
+ void set_current_state( const MyState &x )
+ {
+ assert( !shutdown_in_progress );
+ current_state = x;
+ current_state.reset_input();
+ }
+ void set_verbose( unsigned int s_verbose ) { verbose = s_verbose; }
bool get_shutdown_in_progress( void ) const { return shutdown_in_progress; }
bool get_shutdown_acknowledged( void ) const { return sent_states.front().num == uint64_t(-1); }
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/network/transportstate.h
^
|
@@ -42,7 +42,7 @@
uint64_t num;
State state;
- TimestampedState( uint64_t s_timestamp, uint64_t s_num, State &s_state )
+ TimestampedState( uint64_t s_timestamp, uint64_t s_num, const State &s_state )
: timestamp( s_timestamp ), num( s_num ), state( s_state )
{}
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/protobufs/Makefile.am
^
|
@@ -1,7 +1,7 @@
source = userinput.proto hostinput.proto transportinstruction.proto
AM_CPPFLAGS = $(protobuf_CFLAGS)
-AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(HARDEN_CFLAGS) $(MISC_CXXFLAGS)
+AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(HARDEN_CFLAGS) $(MISC_CXXFLAGS) -Wno-error
SUFFIXES = .proto .pb.cc
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/protobufs/Makefile.in
^
|
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -16,23 +15,61 @@
@SET_MAKE@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
esac; \
- test $$am__dry = yes; \
- }
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -50,7 +87,6 @@
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = src/protobufs
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_check_library.m4 \
@@ -59,6 +95,7 @@
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
@@ -67,10 +104,8 @@
ARFLAGS = cru
AM_V_AR = $(am__v_AR_@AM_V@)
am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@)
-am__v_AR_0 = @echo " AR " $@;
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
+am__v_AR_0 = @echo " AR " $@;
+am__v_AR_1 =
libmoshprotos_a_AR = $(AR) $(ARFLAGS)
libmoshprotos_a_LIBADD =
am__objects_1 =
@@ -80,6 +115,18 @@
nodist_libmoshprotos_a_OBJECTS = $(am__objects_2) $(am__objects_1)
libmoshprotos_a_OBJECTS = $(am_libmoshprotos_a_OBJECTS) \
$(nodist_libmoshprotos_a_OBJECTS)
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -88,26 +135,27 @@
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
AM_V_CXX = $(am__v_CXX_@AM_V@)
am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
-am__v_CXX_0 = @echo " CXX " $@;
+am__v_CXX_0 = @echo " CXX " $@;
+am__v_CXX_1 =
CXXLD = $(CXX)
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
-o $@
AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
-am__v_CXXLD_0 = @echo " CXXLD " $@;
+am__v_CXXLD_0 = @echo " CXXLD " $@;
+am__v_CXXLD_1 =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
-am__v_CC_0 = @echo " CC " $@;
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo " CCLD " $@;
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
SOURCES = $(libmoshprotos_a_SOURCES) $(nodist_libmoshprotos_a_SOURCES)
DIST_SOURCES = $(libmoshprotos_a_SOURCES)
am__can_run_installinfo = \
@@ -115,8 +163,26 @@
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
@@ -126,13 +192,20 @@
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/protobufs/hostinput.proto
^
|
@@ -1,3 +1,5 @@
+syntax = "proto2";
+
option optimize_for = LITE_RUNTIME;
package HostBuffers;
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/protobufs/transportinstruction.proto
^
|
@@ -1,3 +1,5 @@
+syntax = "proto2";
+
option optimize_for = LITE_RUNTIME;
package TransportBuffers;
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/protobufs/userinput.proto
^
|
@@ -1,3 +1,5 @@
+syntax = "proto2";
+
option optimize_for = LITE_RUNTIME;
package ClientBuffers;
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/statesync/Makefile.in
^
|
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -16,23 +15,61 @@
@SET_MAKE@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
esac; \
- test $$am__dry = yes; \
- }
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -50,7 +87,6 @@
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = src/statesync
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_check_library.m4 \
@@ -59,6 +95,7 @@
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
@@ -67,15 +104,25 @@
ARFLAGS = cru
AM_V_AR = $(am__v_AR_@AM_V@)
am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@)
-am__v_AR_0 = @echo " AR " $@;
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
+am__v_AR_0 = @echo " AR " $@;
+am__v_AR_1 =
libmoshstatesync_a_AR = $(AR) $(ARFLAGS)
libmoshstatesync_a_LIBADD =
am_libmoshstatesync_a_OBJECTS = completeterminal.$(OBJEXT) \
user.$(OBJEXT)
libmoshstatesync_a_OBJECTS = $(am_libmoshstatesync_a_OBJECTS)
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -84,26 +131,27 @@
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
AM_V_CXX = $(am__v_CXX_@AM_V@)
am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
-am__v_CXX_0 = @echo " CXX " $@;
+am__v_CXX_0 = @echo " CXX " $@;
+am__v_CXX_1 =
CXXLD = $(CXX)
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
-o $@
AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
-am__v_CXXLD_0 = @echo " CXXLD " $@;
+am__v_CXXLD_0 = @echo " CXXLD " $@;
+am__v_CXXLD_1 =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
-am__v_CC_0 = @echo " CC " $@;
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo " CCLD " $@;
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
SOURCES = $(libmoshstatesync_a_SOURCES)
DIST_SOURCES = $(libmoshstatesync_a_SOURCES)
am__can_run_installinfo = \
@@ -111,8 +159,26 @@
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
@@ -122,13 +188,20 @@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/statesync/completeterminal.cc
^
|
@@ -46,16 +46,17 @@
{
for ( unsigned int i = 0; i < str.size(); i++ ) {
/* parse octet into up to three actions */
- list<Action *> actions( parser.input( str[ i ] ) );
+ parser.input( str[ i ], actions );
/* apply actions to terminal and delete them */
- for ( list<Action *>::iterator it = actions.begin();
+ for ( Actions::iterator it = actions.begin();
it != actions.end();
it++ ) {
Action *act = *it;
act->act_on_terminal( &terminal );
delete act;
}
+ actions.clear();
}
return terminal.read_octets_to_host();
@@ -86,14 +87,22 @@
new_res->MutableExtension( resize )->set_width( terminal.get_fb().ds.get_width() );
new_res->MutableExtension( resize )->set_height( terminal.get_fb().ds.get_height() );
}
- Instruction *new_inst = output.add_instruction();
- new_inst->MutableExtension( hostbytes )->set_hoststring( display.new_frame( true, existing.get_fb(), terminal.get_fb() ) );
+ string update = display.new_frame( true, existing.get_fb(), terminal.get_fb() );
+ if ( !update.empty() ) {
+ Instruction *new_inst = output.add_instruction();
+ new_inst->MutableExtension( hostbytes )->set_hoststring( update );
+ }
}
return output.SerializeAsString();
}
-void Complete::apply_string( string diff )
+string Complete::init_diff( void ) const
+{
+ return diff_from( Complete( get_fb().ds.get_width(), get_fb().ds.get_height() ));
+}
+
+void Complete::apply_string( const string & diff )
{
HostBuffers::HostMessage input;
fatal_assert( input.ParseFromString( diff ) );
@@ -103,8 +112,9 @@
string terminal_to_host = act( input.instruction( i ).GetExtension( hostbytes ).hoststring() );
assert( terminal_to_host.empty() ); /* server never interrogates client terminal */
} else if ( input.instruction( i ).HasExtension( resize ) ) {
- act( new Resize( input.instruction( i ).GetExtension( resize ).width(),
- input.instruction( i ).GetExtension( resize ).height() ) );
+ Resize new_size( input.instruction( i ).GetExtension( resize ).width(),
+ input.instruction( i ).GetExtension( resize ).height() );
+ act( &new_size );
} else if ( input.instruction( i ).HasExtension( echoack ) ) {
uint64_t inst_echo_ack_num = input.instruction( i ).GetExtension( echoack ).echo_ack_num();
assert( inst_echo_ack_num >= echo_ack );
@@ -132,7 +142,7 @@
for ( input_history_type::const_iterator i = input_history.begin();
i != input_history.end();
i++ ) {
- if ( i->second < now - ECHO_TIMEOUT ) {
+ if ( i->second <= now - ECHO_TIMEOUT ) {
newest_echo_ack = i->first;
}
}
@@ -173,22 +183,35 @@
bool Complete::compare( const Complete &other ) const
{
bool ret = false;
- for ( int x = 0; x < terminal.get_fb().ds.get_width(); x++ ) {
- for ( int y = 0; y < terminal.get_fb().ds.get_height(); y++ ) {
- if ( terminal.get_fb().get_cell( y, x )->compare( *other.terminal.get_fb().get_cell( y, x ) ) ) {
+ const Framebuffer &fb = terminal.get_fb();
+ const Framebuffer &other_fb = other.terminal.get_fb();
+ const int height = fb.ds.get_height();
+ const int other_height = other_fb.ds.get_height();
+ const int width = fb.ds.get_width();
+ const int other_width = other_fb.ds.get_width();
+
+ if ( height != other_height || width != other_width ) {
+ fprintf( stderr, "Framebuffer size (%dx%d, %dx%d) differs.\n", width, height, other_width, other_height );
+ return true;
+ }
+
+ for ( int y = 0; y < height; y++ ) {
+ for ( int x = 0; x < width; x++ ) {
+ if ( fb.get_cell( y, x )->compare( *other_fb.get_cell( y, x ) ) ) {
fprintf( stderr, "Cell (%d, %d) differs.\n", y, x );
ret = true;
}
}
}
- if ( (terminal.get_fb().ds.get_cursor_row() != other.terminal.get_fb().ds.get_cursor_row())
- || (terminal.get_fb().ds.get_cursor_col() != other.terminal.get_fb().ds.get_cursor_col()) ) {
+ if ( (fb.ds.get_cursor_row() != other_fb.ds.get_cursor_row())
+ || (fb.ds.get_cursor_col() != other_fb.ds.get_cursor_col()) ) {
fprintf( stderr, "Cursor mismatch: (%d, %d) vs. (%d, %d).\n",
- terminal.get_fb().ds.get_cursor_row(), terminal.get_fb().ds.get_cursor_col(),
- other.terminal.get_fb().ds.get_cursor_row(), other.terminal.get_fb().ds.get_cursor_col() );
+ fb.ds.get_cursor_row(), fb.ds.get_cursor_col(),
+ other_fb.ds.get_cursor_row(), other_fb.ds.get_cursor_col() );
ret = true;
}
+ /* XXX should compare other terminal state too (mouse mode, bell. etc.) */
return ret;
}
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/statesync/completeterminal.h
^
|
@@ -48,6 +48,11 @@
Terminal::Emulator terminal;
Terminal::Display display;
+ // Only used locally by act(), but kept here as a performance optimization,
+ // to avoid construction/destruction. It must always be empty
+ // outside calls to act() to keep horrible things from happening.
+ Parser::Actions actions;
+
typedef std::list< std::pair<uint64_t, uint64_t> > input_history_type;
input_history_type input_history;
uint64_t echo_ack;
@@ -56,23 +61,23 @@
public:
Complete( size_t width, size_t height ) : parser(), terminal( width, height ), display( false ),
- input_history(), echo_ack( 0 ) {}
+ actions(), input_history(), echo_ack( 0 ) {}
std::string act( const std::string &str );
std::string act( const Parser::Action *act );
const Framebuffer & get_fb( void ) const { return terminal.get_fb(); }
- bool parser_grounded( void ) const { return parser.is_grounded(); }
-
+ void reset_input( void ) { parser.reset_input(); }
uint64_t get_echo_ack( void ) const { return echo_ack; }
bool set_echo_ack( uint64_t now );
void register_input_frame( uint64_t n, uint64_t now );
int wait_time( uint64_t now ) const;
/* interface for Network::Transport */
- void subtract( const Complete * ) {}
+ void subtract( const Complete * ) const {}
std::string diff_from( const Complete &existing ) const;
- void apply_string( std::string diff );
+ std::string init_diff( void ) const;
+ void apply_string( const std::string & diff );
bool operator==( const Complete &x ) const;
bool compare( const Complete &other ) const;
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/statesync/user.cc
^
|
@@ -105,7 +105,7 @@
return output.SerializeAsString();
}
-void UserStream::apply_string( string diff )
+void UserStream::apply_string( const string &diff )
{
ClientBuffers::UserMessage input;
fatal_assert( input.ParseFromString( diff ) );
@@ -123,7 +123,7 @@
}
}
-const Parser::Action *UserStream::get_action( unsigned int i )
+const Parser::Action *UserStream::get_action( unsigned int i ) const
{
switch( actions[ i ].type ) {
case UserByteType:
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/statesync/user.h
^
|
@@ -57,8 +57,8 @@
Parser::UserByte userbyte;
Parser::Resize resize;
- UserEvent( Parser::UserByte s_userbyte ) : type( UserByteType ), userbyte( s_userbyte ), resize( -1, -1 ) {}
- UserEvent( Parser::Resize s_resize ) : type( ResizeType ), userbyte( 0 ), resize( s_resize ) {}
+ UserEvent( const Parser::UserByte & s_userbyte ) : type( UserByteType ), userbyte( s_userbyte ), resize( -1, -1 ) {}
+ UserEvent( const Parser::Resize & s_resize ) : type( ResizeType ), userbyte( 0 ), resize( s_resize ) {}
UserEvent() /* default constructor required by C++11 STL */
: type( UserByteType ),
@@ -79,20 +79,21 @@
public:
UserStream() : actions() {}
- void push_back( Parser::UserByte s_userbyte ) { actions.push_back( UserEvent( s_userbyte ) ); }
- void push_back( Parser::Resize s_resize ) { actions.push_back( UserEvent( s_resize ) ); }
+ void push_back( const Parser::UserByte & s_userbyte ) { actions.push_back( UserEvent( s_userbyte ) ); }
+ void push_back( const Parser::Resize & s_resize ) { actions.push_back( UserEvent( s_resize ) ); }
bool empty( void ) const { return actions.empty(); }
size_t size( void ) const { return actions.size(); }
- const Parser::Action *get_action( unsigned int i );
+ const Parser::Action *get_action( unsigned int i ) const;
/* interface for Network::Transport */
void subtract( const UserStream *prefix );
string diff_from( const UserStream &existing ) const;
- void apply_string( string diff );
+ string init_diff( void ) const { assert( false ); return string(); };
+ void apply_string( const string &diff );
bool operator==( const UserStream &x ) const { return actions == x.actions; }
- bool compare( const UserStream & ) const { return false; }
+ bool compare( const UserStream & ) { return false; }
};
}
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/terminal/Makefile.in
^
|
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -16,23 +15,61 @@
@SET_MAKE@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
esac; \
- test $$am__dry = yes; \
- }
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -50,7 +87,6 @@
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = src/terminal
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_check_library.m4 \
@@ -59,6 +95,7 @@
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
@@ -67,10 +104,8 @@
ARFLAGS = cru
AM_V_AR = $(am__v_AR_@AM_V@)
am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@)
-am__v_AR_0 = @echo " AR " $@;
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
+am__v_AR_0 = @echo " AR " $@;
+am__v_AR_1 =
libmoshterminal_a_AR = $(AR) $(ARFLAGS)
libmoshterminal_a_LIBADD =
am_libmoshterminal_a_OBJECTS = parseraction.$(OBJEXT) parser.$(OBJEXT) \
@@ -79,6 +114,18 @@
terminaldisplayinit.$(OBJEXT) terminalframebuffer.$(OBJEXT) \
terminalfunctions.$(OBJEXT) terminaluserinput.$(OBJEXT)
libmoshterminal_a_OBJECTS = $(am_libmoshterminal_a_OBJECTS)
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -87,26 +134,27 @@
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
AM_V_CXX = $(am__v_CXX_@AM_V@)
am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
-am__v_CXX_0 = @echo " CXX " $@;
+am__v_CXX_0 = @echo " CXX " $@;
+am__v_CXX_1 =
CXXLD = $(CXX)
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
-o $@
AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
-am__v_CXXLD_0 = @echo " CXXLD " $@;
+am__v_CXXLD_0 = @echo " CXXLD " $@;
+am__v_CXXLD_1 =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
-am__v_CC_0 = @echo " CC " $@;
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo " CCLD " $@;
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
SOURCES = $(libmoshterminal_a_SOURCES)
DIST_SOURCES = $(libmoshterminal_a_SOURCES)
am__can_run_installinfo = \
@@ -114,8 +162,26 @@
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
@@ -125,13 +191,20 @@
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/terminal/parser.cc
^
|
@@ -41,21 +41,19 @@
const Parser::StateFamily Parser::family;
static void append_or_delete( Parser::Action *act,
- std::list<Parser::Action *>&vec )
+ Parser::Actions &vec )
{
assert( act );
- if ( typeid( *act ) != typeid( Parser::Ignore ) ) {
+ if ( !act->ignore() ) {
vec.push_back( act );
} else {
delete act;
}
}
-std::list<Parser::Action *> Parser::Parser::input( wchar_t ch )
+void Parser::Parser::input( wchar_t ch, Actions &ret )
{
- std::list<Action *> ret;
-
Transition tx = state->input( ch );
if ( tx.next_state != NULL ) {
@@ -63,36 +61,39 @@
}
append_or_delete( tx.action, ret );
+ tx.action = NULL;
if ( tx.next_state != NULL ) {
append_or_delete( tx.next_state->enter(), ret );
state = tx.next_state;
}
-
- return ret;
}
Parser::UTF8Parser::UTF8Parser()
: parser(), buf_len( 0 )
{
assert( BUF_SIZE >= (size_t)MB_CUR_MAX );
+ buf[0] = '\0';
}
-std::list<Parser::Action *> Parser::UTF8Parser::input( char c )
+void Parser::UTF8Parser::input( char c, Actions &ret )
{
assert( buf_len < BUF_SIZE );
+ /* 1-byte UTF-8 character, aka ASCII? Cheat. */
+ if ( buf_len == 0 && static_cast<unsigned char>(c) <= 0x7f ) {
+ parser.input( static_cast<wchar_t>(c), ret );
+ return;
+ }
+
buf[ buf_len++ ] = c;
/* This function will only work in a UTF-8 locale. */
-
wchar_t pwc;
- mbstate_t ps;
- memset( &ps, 0, sizeof( ps ) );
+ mbstate_t ps = mbstate_t();
size_t total_bytes_parsed = 0;
size_t orig_buf_len = buf_len;
- std::list<Action *> ret;
/* this routine is somewhat complicated in order to comply with
Unicode 6.0, section 3.9, "Best Practices for using U+FFFD" */
@@ -104,9 +105,6 @@
/* this returns 0 when n = 0! */
- /* This function annoying returns a size_t so we have to check
- the negative values first before the "> 0" branch */
-
if ( bytes_parsed == 0 ) {
/* character was NUL, accept and clear buffer */
assert( buf_len == 1 );
@@ -129,19 +127,17 @@
/* can't parse incomplete multibyte character */
total_bytes_parsed += buf_len;
continue;
- } else if ( bytes_parsed > 0 ) {
+ } else {
/* parsed into pwc, accept */
assert( bytes_parsed <= buf_len );
memmove( buf, buf + bytes_parsed, buf_len - bytes_parsed );
buf_len = buf_len - bytes_parsed;
- } else {
- throw std::string( "Unknown return value from mbrtowc" );
}
/* Cast to unsigned for checks, because some
platforms (e.g. ARM) use uint32_t as wchar_t,
causing compiler warning on "pwc > 0" check. */
- uint64_t pwcheck = pwc;
+ const uint32_t pwcheck = pwc;
if ( pwcheck > 0x10FFFF ) { /* outside Unicode range */
pwc = (wchar_t) 0xFFFD;
@@ -156,13 +152,10 @@
pwc = (wchar_t) 0xFFFD;
}
- std::list<Action *> vec = parser.input( pwc );
- ret.insert( ret.end(), vec.begin(), vec.end() );
+ parser.input( pwc, ret );
total_bytes_parsed += bytes_parsed;
}
-
- return ret;
}
Parser::Parser::Parser( const Parser &other )
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/terminal/parser.h
^
|
@@ -37,7 +37,6 @@
http://www.vt100.net/emu/dec_ansi_parser */
#include <wchar.h>
-#include <list>
#include <string.h>
#include "parsertransition.h"
@@ -59,14 +58,13 @@
Parser & operator=( const Parser & );
~Parser() {}
- std::list<Action *> input( wchar_t ch );
+ void input( wchar_t ch, Actions &actions );
- bool operator==( const Parser &x ) const
+ void reset_input( void )
{
- return state == x.state;
+ state = &family.s_Ground;
}
- bool is_grounded( void ) const { return state == &family.s_Ground; }
};
static const size_t BUF_SIZE = 8;
@@ -81,14 +79,14 @@
public:
UTF8Parser();
- std::list<Action *> input( char c );
+ void input( char c, Actions &actions );
- bool operator==( const UTF8Parser &x ) const
+ void reset_input( void )
{
- return parser == x.parser;
+ parser.reset_input();
+ buf[0] = '\0';
+ buf_len = 0;
}
-
- bool is_grounded( void ) const { return parser.is_grounded(); }
};
}
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/terminal/parseraction.cc
^
|
@@ -38,19 +38,6 @@
using namespace Parser;
-std::string Action::str( void )
-{
- char thechar[ 10 ] = { 0 };
- if ( char_present ) {
- if ( iswprint( ch ) )
- snprintf( thechar, 10, "(%lc)", ch );
- else
- snprintf( thechar, 10, "(0x%x)", (unsigned int)ch );
- }
-
- return name() + std::string( thechar );
-}
-
void Print::act_on_terminal( Terminal::Emulator *emu ) const
{
emu->print( this );
@@ -110,12 +97,10 @@
void Resize::act_on_terminal( Terminal::Emulator *emu ) const
{
emu->resize( width, height );
- handled = true;
}
bool Action::operator==( const Action &other ) const
{
return ( char_present == other.char_present )
- && ( ch == other.ch )
- && ( handled == other.handled );
+ && ( ch == other.ch );
}
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/terminal/parseraction.h
^
|
@@ -34,6 +34,7 @@
#define PARSERACTION_HPP
#include <string>
+#include <vector>
namespace Terminal {
class Emulator;
@@ -43,24 +44,27 @@
class Action
{
public:
- bool char_present;
wchar_t ch;
- mutable bool handled;
-
- std::string str( void );
+ bool char_present;
virtual std::string name( void ) = 0;
virtual void act_on_terminal( Terminal::Emulator * ) const {};
- Action() : char_present( false ), ch( -1 ), handled( false ) {};
+ virtual bool ignore() const { return false; }
+
+ Action() : ch( -1 ), char_present( false ) {};
virtual ~Action() {};
virtual bool operator==( const Action &other ) const;
};
+ typedef std::vector<Action *> Actions;
+
class Ignore : public Action {
- public: std::string name( void ) { return std::string( "Ignore" ); }
+ public:
+ std::string name( void ) { return std::string( "Ignore" ); }
+ bool ignore() const { return true; }
};
class Print : public Action {
public:
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/terminal/parserstate.cc
^
|
@@ -56,20 +56,21 @@
return Transition( &family->s_CSI_Entry );
}
- return Transition( NULL, NULL ); /* don't allocate an Ignore action */
+ return Transition(( State * )NULL, NULL ); /* don't allocate an Ignore action */
}
Transition State::input( wchar_t ch ) const
{
- Transition ret = anywhere_rule( ch );
- if ( !ret.next_state ) {
- if ( ch >= 0xA0 ) {
- ret = this->input_state_rule( 0x41 );
- } else {
- ret = this->input_state_rule( ch );
- }
+ /* Check for immediate transitions. */
+ Transition anywhere = anywhere_rule( ch );
+ if ( anywhere.next_state ) {
+ anywhere.action->char_present = true;
+ anywhere.action->ch = ch;
+ return anywhere;
}
-
+ /* Normal X.364 state machine. */
+ /* Parse high Unicode codepoints like 'A'. */
+ Transition ret = this->input_state_rule( ch >= 0xA0 ? 0x41 : ch );
ret.action->char_present = true;
ret.action->ch = ch;
return ret;
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/terminal/parsertransition.h
^
|
@@ -43,6 +43,8 @@
class Transition
{
public:
+ // Transition is only a courier for an Action; it should
+ // never create/delete one on its own.
Action *action;
State *next_state;
@@ -56,14 +58,21 @@
return *this;
}
- virtual ~Transition() {}
+ virtual ~Transition()
+ {
+ // Indicate to checkers that we don't own *action anymore
+ action = NULL;
+ }
Transition( Action *s_action=new Ignore, State *s_next_state=NULL )
: action( s_action ), next_state( s_next_state )
{}
- Transition( State *s_next_state )
- : action( new Ignore ), next_state( s_next_state )
+ // This is only ever used in the 1-argument form;
+ // we use this instead of an initializer to
+ // tell Coverity the object never owns *action.
+ Transition( State *s_next_state, Action *s_action=new Ignore )
+ : action( s_action ), next_state( s_next_state )
{}
};
}
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/terminal/terminal.cc
^
|
@@ -37,7 +37,6 @@
#include <typeinfo>
#include "terminal.h"
-#include "swrite.h"
using namespace Terminal;
@@ -61,11 +60,15 @@
{
assert( act->char_present );
- int chwidth = act->ch == L'\0' ? -1 : wcwidth( act->ch );
+ const wchar_t ch = act->ch;
- Cell *this_cell = fb.get_mutable_cell();
+ /*
+ * Check for printing ISO 8859-1 first, it's a cheap way to detect
+ * some common narrow characters.
+ */
+ const int chwidth = ch == L'\0' ? -1 : ( Cell::isprint_iso8859_1( ch ) ? 1 : wcwidth( ch ));
- Cell *combining_cell = fb.get_combining_cell(); /* can be null if we were resized */
+ Cell *this_cell = fb.get_mutable_cell();
switch ( chwidth ) {
case 1: /* normal character */
@@ -74,6 +77,7 @@
fb.get_mutable_row( -1 )->set_wrap( true );
fb.ds.move_col( 0 );
fb.move_rows_autoscroll( 1 );
+ this_cell = NULL;
} else if ( fb.ds.auto_wrap_mode
&& (chwidth == 2)
&& (fb.ds.get_cursor_col() == fb.ds.get_width() - 1) ) {
@@ -86,20 +90,24 @@
because a wide char was wrapped to the next line. */
fb.ds.move_col( 0 );
fb.move_rows_autoscroll( 1 );
+ this_cell = NULL;
}
if ( fb.ds.insert_mode ) {
for ( int i = 0; i < chwidth; i++ ) {
fb.insert_cell( fb.ds.get_cursor_row(), fb.ds.get_cursor_col() );
}
+ this_cell = NULL;
}
- this_cell = fb.get_mutable_cell();
+ if (!this_cell) {
+ this_cell = fb.get_mutable_cell();
+ }
fb.reset_cell( this_cell );
- this_cell->contents.push_back( act->ch );
- this_cell->width = chwidth;
- fb.apply_renditions_to_current_cell();
+ this_cell->append( ch );
+ this_cell->set_wide( chwidth == 2 ); /* chwidth had better be 1 or 2 here */
+ fb.apply_renditions_to_cell( this_cell );
if ( chwidth == 2 ) { /* erase overlapped cell */
if ( fb.ds.get_cursor_col() + 1 < fb.ds.get_width() ) {
@@ -109,27 +117,28 @@
fb.ds.move_col( chwidth, true, true );
- act->handled = true;
break;
case 0: /* combining character */
- if ( combining_cell == NULL ) { /* character is now offscreen */
- act->handled = true;
- break;
- }
-
- if ( combining_cell->contents.size() == 0 ) {
- /* cell starts with combining character */
- assert( this_cell == combining_cell );
- assert( combining_cell->width == 1 );
- combining_cell->fallback = true;
- fb.ds.move_col( 1, true, true );
- }
+ {
+ Cell *combining_cell = fb.get_combining_cell(); /* can be null if we were resized */
+ if ( combining_cell == NULL ) { /* character is now offscreen */
+ break;
+ }
- if ( combining_cell->contents.size() < 16 ) {
- /* seems like a reasonable limit on combining characters */
- combining_cell->contents.push_back( act->ch );
+ if ( combining_cell->empty() ) {
+ /* cell starts with combining character */
+ /* ... but isn't necessarily the target for a new
+ base character [e.g. start of line], if the
+ combining character has been cleared with
+ a sequence like ED ("J") or EL ("K") */
+ assert( !combining_cell->get_wide() );
+ combining_cell->set_fallback( true );
+ fb.ds.move_col( 1, true, true );
+ }
+ if ( !combining_cell->full() ) {
+ combining_cell->append( ch );
+ }
}
- act->handled = true;
break;
case -1: /* unprintable character */
break;
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/terminal/terminaldispatcher.cc
^
|
@@ -54,7 +54,6 @@
if ( params.length() < 100 ) {
/* enough for 16 five-char params plus 15 semicolons */
params.push_back( act->ch );
- act->handled = true;
}
parsed = false;
}
@@ -65,16 +64,14 @@
if ( ( dispatch_chars.length() < 8 ) /* never should need more than 2 */
&& ( act->ch <= 255 ) ) { /* ignore non-8-bit */
dispatch_chars.push_back( act->ch );
- act->handled = true;
}
}
-void Dispatcher::clear( const Parser::Clear *act )
+void Dispatcher::clear( const Parser::Clear *act __attribute((unused)) )
{
params.clear();
dispatch_chars.clear();
parsed = false;
- act->handled = true;
}
void Dispatcher::parse_params( void )
@@ -173,7 +170,7 @@
}
static void register_function( Function_Type type,
- std::string dispatch_chars,
+ const std::string & dispatch_chars,
Function f )
{
switch ( type ) {
@@ -189,7 +186,7 @@
}
}
-Function::Function( Function_Type type, std::string dispatch_chars,
+Function::Function( Function_Type type, const std::string & dispatch_chars,
void (*s_function)( Framebuffer *, Dispatcher * ),
bool s_clears_wrap_state )
: function( s_function ), clears_wrap_state( s_clears_wrap_state )
@@ -228,7 +225,6 @@
fb->ds.next_print_will_wrap = false;
return;
} else {
- act->handled = true;
if ( i->second.clears_wrap_state ) {
fb->ds.next_print_will_wrap = false;
}
@@ -241,14 +237,12 @@
assert( act->char_present );
if ( OSC_string.size() < 256 ) { /* should be a long enough window title */
OSC_string.push_back( act->ch );
- act->handled = true;
}
}
-void Dispatcher::OSC_start( const Parser::OSC_Start *act )
+void Dispatcher::OSC_start( const Parser::OSC_Start *act __attribute((unused)) )
{
OSC_string.clear();
- act->handled = true;
}
bool Dispatcher::operator==( const Dispatcher &x ) const
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/terminal/terminaldispatcher.h
^
|
@@ -59,7 +59,7 @@
class Function {
public:
Function() : function( NULL ), clears_wrap_state( true ) {}
- Function( Function_Type type, std::string dispatch_chars,
+ Function( Function_Type type, const std::string & dispatch_chars,
void (*s_function)( Framebuffer *, Dispatcher * ),
bool s_clears_wrap_state = true );
void (*function)( Framebuffer *, Dispatcher * );
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/terminal/terminaldisplay.cc
^
|
@@ -33,6 +33,7 @@
#include <stdio.h>
#include "terminaldisplay.h"
+#include "terminalframebuffer.h"
using namespace Terminal;
@@ -51,7 +52,10 @@
std::string Display::close() const
{
- return std::string( "\033[?1l\033[0m\033[?25h" ) + std::string( rmcup ? rmcup : "" );
+ return std::string( "\033[?1l\033[0m\033[?25h"
+ "\033[?1003l\033[?1002l\033[?1001l\033[?1000l"
+ "\033[?1015l\033[?1006l\033[?1005l" ) +
+ std::string( rmcup ? rmcup : "" );
}
std::string Display::new_frame( bool initialized, const Framebuffer &last, const Framebuffer &f ) const
@@ -62,7 +66,7 @@
/* has bell been rung? */
if ( f.get_bell_count() != frame.last_frame.get_bell_count() ) {
- frame.append( "\x07" );
+ frame.append( '\007' );
}
/* has icon name or window title changed? */
@@ -70,40 +74,38 @@
( (!initialized)
|| (f.get_icon_name() != frame.last_frame.get_icon_name())
|| (f.get_window_title() != frame.last_frame.get_window_title()) ) ) {
+ typedef Terminal::Framebuffer::title_type title_type;
/* set icon name and window title */
if ( f.get_icon_name() == f.get_window_title() ) {
/* write combined Icon Name and Window Title */
frame.append( "\033]0;" );
- const std::deque<wchar_t> &window_title( f.get_window_title() );
- for ( std::deque<wchar_t>::const_iterator i = window_title.begin();
+ const title_type &window_title( f.get_window_title() );
+ for ( title_type::const_iterator i = window_title.begin();
i != window_title.end();
i++ ) {
- snprintf( tmp, 64, "%lc", *i );
- frame.append( tmp );
+ frame.append( *i );
}
- frame.append( "\007" );
+ frame.append( '\007' );
/* ST is more correct, but BEL more widely supported */
} else {
/* write Icon Name */
frame.append( "\033]1;" );
- const std::deque<wchar_t> &icon_name( f.get_icon_name() );
- for ( std::deque<wchar_t>::const_iterator i = icon_name.begin();
+ const title_type &icon_name( f.get_icon_name() );
+ for ( title_type::const_iterator i = icon_name.begin();
i != icon_name.end();
i++ ) {
- snprintf( tmp, 64, "%lc", *i );
- frame.append( tmp );
+ frame.append( *i );
}
- frame.append( "\007" );
+ frame.append( '\007' );
frame.append( "\033]2;" );
- const std::deque<wchar_t> &window_title( f.get_window_title() );
- for ( std::deque<wchar_t>::const_iterator i = window_title.begin();
+ const title_type &window_title( f.get_window_title() );
+ for ( title_type::const_iterator i = window_title.begin();
i != window_title.end();
i++ ) {
- snprintf( tmp, 64, "%lc", *i );
- frame.append( tmp );
+ frame.append( *i );
}
- frame.append( "\007" );
+ frame.append( '\007' );
}
}
@@ -121,9 +123,7 @@
|| (f.ds.get_width() != frame.last_frame.ds.get_width())
|| (f.ds.get_height() != frame.last_frame.ds.get_height()) ) {
/* reset scrolling region */
- snprintf( tmp, 64, "\033[%d;%dr",
- 1, f.ds.get_height() );
- frame.append( tmp );
+ frame.append( "\033[r" );
/* clear screen */
frame.append( "\033[0m\033[H\033[2J" );
@@ -136,15 +136,44 @@
frame.current_rendition = frame.last_frame.ds.get_renditions();
}
- /* shortcut -- has display moved up by a certain number of lines? */
- frame.y = 0;
+ /* is cursor visibility initialized? */
+ if ( !initialized ) {
+ frame.cursor_visible = false;
+ frame.append( "\033[?25l" );
+ }
+
+ int frame_y = 0;
+ Framebuffer::row_pointer blank_row;
+ Framebuffer::rows_type rows( frame.last_frame.get_rows() );
+ /* Extend rows if we've gotten a resize and new is wider than old */
+ if ( frame.last_frame.ds.get_width() < f.ds.get_width() ) {
+ for ( Framebuffer::rows_type::iterator p = rows.begin(); p != rows.end(); p++ ) {
+ *p = make_shared<Row>( **p );
+ (*p)->cells.resize( f.ds.get_width(), Cell( f.ds.get_background_rendition() ) );
+ }
+ }
+ /* Add rows if we've gotten a resize and new is taller than old */
+ if ( static_cast<int>( rows.size() ) < f.ds.get_height() ) {
+ // get a proper blank row
+ const size_t w = f.ds.get_width();
+ const color_type c = 0;
+ blank_row = make_shared<Row>( w, c );
+ rows.resize( f.ds.get_height(), blank_row );
+ }
+ /* shortcut -- has display moved up by a certain number of lines? */
if ( initialized ) {
int lines_scrolled = 0;
int scroll_height = 0;
for ( int row = 0; row < f.ds.get_height(); row++ ) {
- if ( *(f.get_row( 0 )) == *(frame.last_frame.get_row( row )) ) {
+ const Row *new_row = f.get_row( 0 );
+ const Row *old_row = &*rows.at( row );
+ if ( new_row == old_row || *new_row == *old_row ) {
+ /* if row 0, we're looking at ourselves and probably didn't scroll */
+ if ( row == 0 ) {
+ break;
+ }
/* found a scroll */
lines_scrolled = row;
scroll_height = 1;
@@ -153,8 +182,8 @@
for ( int region_height = 1;
lines_scrolled + region_height < f.ds.get_height();
region_height++ ) {
- if ( *(f.get_row( region_height ))
- == *(frame.last_frame.get_row( lines_scrolled + region_height )) ) {
+ if ( *f.get_row( region_height )
+ == *rows.at( lines_scrolled + region_height ) ) {
scroll_height = region_height + 1;
} else {
break;
@@ -166,112 +195,76 @@
}
if ( scroll_height ) {
- frame.y = scroll_height;
+ frame_y = scroll_height;
if ( lines_scrolled ) {
- if ( !(frame.current_rendition == initial_rendition()) ) {
- frame.append( "\033[0m" );
- frame.current_rendition = initial_rendition();
+ /* Now we need a proper blank row. */
+ if ( blank_row.get() == NULL ) {
+ const size_t w = f.ds.get_width();
+ const color_type c = 0;
+ blank_row = make_shared<Row>( w, c );
}
+ frame.update_rendition( initial_rendition(), true );
int top_margin = 0;
int bottom_margin = top_margin + lines_scrolled + scroll_height - 1;
assert( bottom_margin < f.ds.get_height() );
- /* set scrolling region */
- snprintf( tmp, 64, "\033[%d;%dr",
- top_margin + 1, bottom_margin + 1);
- frame.append( tmp );
-
- /* go to bottom of scrolling region */
- frame.append_silent_move( bottom_margin, 0 );
+ /* Common case: if we're already on the bottom line and we're scrolling the whole
+ * screen, just do a CR and LFs.
+ */
+ if ( (scroll_height + lines_scrolled == f.ds.get_height() ) && frame.cursor_y + 1 == f.ds.get_height() ) {
+ frame.append( '\r' );
+ frame.append( lines_scrolled, '\n' );
+ frame.cursor_x = 0;
+ } else {
+ /* set scrolling region */
+ snprintf( tmp, 64, "\033[%d;%dr",
+ top_margin + 1, bottom_margin + 1);
+ frame.append( tmp );
- /* scroll */
- for ( int i = 0; i < lines_scrolled; i++ ) {
- frame.append( "\n" );
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/terminal/terminaldisplay.h
^
|
@@ -39,35 +39,33 @@
/* variables used within a new_frame */
class FrameState {
public:
- int x, y;
- bool force_next_put;
std::string str;
int cursor_x, cursor_y;
Renditions current_rendition;
+ bool cursor_visible;
- Framebuffer last_frame;
+ const Framebuffer &last_frame;
- FrameState( const Framebuffer &s_last )
- : x(0), y(0),
- force_next_put( false ),
- str(), cursor_x(0), cursor_y(0), current_rendition( 0 ),
- last_frame( s_last )
- {
- str.reserve( 1024 );
- }
+ FrameState( const Framebuffer &s_last );
+ void append( char c ) { str.append( 1, c ); }
+ void append( size_t s, char c ) { str.append( s, c ); }
+ void append( wchar_t wc ) { Cell::append_to_str( str, wc ); }
void append( const char * s ) { str.append( s ); }
- void appendstring( const std::string &s ) { str.append( s ); }
+ void append_string( const std::string &append ) { str.append(append); }
+ void append_cell(const Cell & cell) { cell.print_grapheme( str ); }
void append_silent_move( int y, int x );
+ void append_move( int y, int x );
+ void update_rendition( const Renditions &r, bool force = false );
};
class Display {
private:
- bool ti_flag( const char *capname ) const;
- int ti_num( const char *capname ) const;
- const char *ti_str( const char *capname ) const;
+ static bool ti_flag( const char *capname );
+ static int ti_num( const char *capname );
+ static const char *ti_str( const char *capname );
bool has_ech; /* erase character is part of vt200 but not supported by tmux
(or by "screen" terminfo entry, which is what tmux advertises) */
@@ -76,15 +74,11 @@
bool has_title; /* supports window title and icon name */
- int posterize_colors; /* downsample input colors >8 to [0..7] */
-
const char *smcup, *rmcup; /* enter and exit alternate screen mode */
- void put_cell( bool initialized, FrameState &frame, const Framebuffer &f ) const;
+ bool put_row( bool initialized, FrameState &frame, const Framebuffer &f, int frame_y, const Row &old_row, bool wrap ) const;
public:
- void downgrade( Framebuffer &f ) const { if ( posterize_colors ) { f.posterize(); } }
-
std::string open() const;
std::string close() const;
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/terminal/terminaldisplayinit.cc
^
|
@@ -37,6 +37,7 @@
#include "terminaldisplay.h"
#include <string>
+#include <stdexcept>
#if defined HAVE_NCURSESW_CURSES_H
# include <ncursesw/curses.h>
@@ -61,35 +62,35 @@
using namespace Terminal;
-bool Display::ti_flag( const char *capname ) const
+bool Display::ti_flag( const char *capname )
{
int val = tigetflag( const_cast<char *>( capname ) );
if ( val == -1 ) {
- throw std::string( "Invalid terminfo boolean capability " ) + capname;
+ throw std::invalid_argument( std::string( "Invalid terminfo boolean capability " ) + capname );
}
return val;
}
-int Display::ti_num( const char *capname ) const
+int Display::ti_num( const char *capname )
{
int val = tigetnum( const_cast<char *>( capname ) );
if ( val == -2 ) {
- throw std::string( "Invalid terminfo numeric capability " ) + capname;
+ throw std::invalid_argument( std::string( "Invalid terminfo numeric capability " ) + capname );
}
return val;
}
-const char *Display::ti_str( const char *capname ) const
+const char *Display::ti_str( const char *capname )
{
const char *val = tigetstr( const_cast<char *>( capname ) );
if ( val == (const char *)-1 ) {
- throw std::string( "Invalid terminfo string capability " ) + capname;
+ throw std::invalid_argument( std::string( "Invalid terminfo string capability " ) + capname );
}
return val;
}
Display::Display( bool use_environment )
- : has_ech( true ), has_bce( true ), has_title( true ), posterize_colors( false ), smcup( NULL ), rmcup( NULL )
+ : has_ech( true ), has_bce( true ), has_title( true ), smcup( NULL ), rmcup( NULL )
{
if ( use_environment ) {
int errret = -2;
@@ -98,16 +99,16 @@
if ( ret != OK ) {
switch ( errret ) {
case 1:
- throw std::string( "Terminal is hardcopy and cannot be used by curses applications." );
+ throw std::runtime_error( "Terminal is hardcopy and cannot be used by curses applications." );
break;
case 0:
- throw std::string( "Unknown terminal type." );
+ throw std::runtime_error( "Unknown terminal type." );
break;
case -1:
- throw std::string( "Terminfo database could not be found." );
+ throw std::runtime_error( "Terminfo database could not be found." );
break;
default:
- throw std::string( "Unknown terminfo error." );
+ throw std::runtime_error( "Unknown terminfo error." );
break;
}
}
@@ -140,12 +141,6 @@
}
}
- /* posterization disabled because server now only advertises
- xterm-256color when client has colors = 256 */
- /*
- posterize_colors = ti_num( "colors" ) < 256;
- */
-
if ( !getenv( "MOSH_NO_TERM_INIT" ) ) {
smcup = ti_str("smcup");
rmcup = ti_str("rmcup");
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/terminal/terminalframebuffer.cc
^
|
@@ -32,17 +32,35 @@
#include <assert.h>
#include <stdio.h>
+#include <stdlib.h>
#include "terminalframebuffer.h"
using namespace Terminal;
-void Cell::reset( int background_color )
+Cell::Cell( color_type background_color )
+ : contents(),
+ renditions( background_color ),
+ wide( false ),
+ fallback( false ),
+ wrap( false )
+{}
+Cell::Cell() /* default constructor required by C++11 STL */
+ : contents(),
+ renditions( 0 ),
+ wide( false ),
+ fallback( false ),
+ wrap( false )
+{
+ assert( false );
+}
+
+void Cell::reset( color_type background_color )
{
contents.clear();
- fallback = false;
- width = 1;
renditions = Renditions( background_color );
+ wide = false;
+ fallback = false;
wrap = false;
}
@@ -62,33 +80,47 @@
renditions( 0 ), save(),
next_print_will_wrap( false ), origin_mode( false ), auto_wrap_mode( true ),
insert_mode( false ), cursor_visible( true ), reverse_video( false ),
- application_mode_cursor_keys( false )
+ bracketed_paste( false ), mouse_reporting_mode( MOUSE_REPORTING_NONE ), mouse_focus_event( false ),
+ mouse_alternate_scroll( false ), mouse_encoding_mode( MOUSE_ENCODING_DEFAULT ), application_mode_cursor_keys( false )
{
reinitialize_tabs( 0 );
}
Framebuffer::Framebuffer( int s_width, int s_height )
- : rows( s_height, Row( s_width, 0 ) ), icon_name(), window_title(), bell_count( 0 ), title_initialized( false ), ds( s_width, s_height )
+ : rows(), icon_name(), window_title(), bell_count( 0 ), title_initialized( false ), ds( s_width, s_height )
{
assert( s_height > 0 );
assert( s_width > 0 );
+ const size_t w = s_width;
+ const color_type c = 0;
+ rows = rows_type(s_height, row_pointer(make_shared<Row>( w, c )));
+}
+
+Framebuffer::Framebuffer( const Framebuffer &other )
+ : rows( other.rows ), icon_name( other.icon_name ), window_title( other.window_title ),
+ bell_count( other.bell_count ), title_initialized( other.title_initialized ), ds( other.ds )
+{
+}
+
+Framebuffer & Framebuffer::operator=( const Framebuffer &other )
+{
+ if ( this != &other ) {
+ rows = other.rows;
+ icon_name = other.icon_name;
+ window_title = other.window_title;
+ bell_count = other.bell_count;
+ title_initialized = other.title_initialized;
+ ds = other.ds;
+ }
+ return *this;
}
void Framebuffer::scroll( int N )
{
if ( N >= 0 ) {
- for ( int i = 0; i < N; i++ ) {
- delete_line( ds.get_scrolling_region_top_row() );
- ds.move_row( -1, true );
- }
+ delete_line( ds.get_scrolling_region_top_row(), N );
} else {
- N = -N;
-
- for ( int i = 0; i < N; i++ ) {
- rows.insert( rows.begin() + ds.get_scrolling_region_top_row(), newrow() );
- rows.erase( rows.begin() + ds.get_scrolling_region_bottom_row() + 1 );
- ds.move_row( 1, true );
- }
+ insert_line( ds.get_scrolling_region_top_row(), -N );
}
}
@@ -152,9 +184,13 @@
}
if ( ds.get_cursor_row() + rows > ds.get_scrolling_region_bottom_row() ) {
- scroll( ds.get_cursor_row() + rows - ds.get_scrolling_region_bottom_row() );
+ int N = ds.get_cursor_row() + rows - ds.get_scrolling_region_bottom_row();
+ scroll( N );
+ ds.move_row( -N, true );
} else if ( ds.get_cursor_row() + rows < ds.get_scrolling_region_top_row() ) {
- scroll( ds.get_cursor_row() + rows - ds.get_scrolling_region_top_row() );
+ int N = ds.get_cursor_row() + rows - ds.get_scrolling_region_top_row();
+ scroll( N );
+ ds.move_row( -N, true );
}
ds.move_row( rows, true );
@@ -169,7 +205,7 @@
return NULL;
} /* can happen if a resize came in between */
- return &rows[ ds.get_combining_char_row() ].cells[ ds.get_combining_char_col() ];
+ return get_mutable_cell( ds.get_combining_char_row(), ds.get_combining_char_col() );
}
void DrawState::set_tab( void )
@@ -182,14 +218,23 @@
tabs[ col ] = false;
}
-int DrawState::get_next_tab( void )
+int DrawState::get_next_tab( int count ) const
{
- for ( int i = cursor_col + 1; i < width; i++ ) {
- if ( tabs[ i ] ) {
- return i;
+ if ( count >= 0 ) {
+ for ( int i = cursor_col + 1; i < width; i++ ) {
+ if ( tabs[ i ] && --count == 0 ) {
+ return i;
+ }
}
+ return -1;
+ } else {
+ for ( int i = cursor_col - 1; i > 0; i-- ) {
+ if ( tabs[ i ] && ++count == 0 ) {
+ return i;
+ }
+ }
+ return 0;
}
- return -1;
}
void DrawState::set_scrolling_region( int top, int bottom )
@@ -214,19 +259,22 @@
}
}
-int DrawState::limit_top( void )
+int DrawState::limit_top( void ) const
{
return origin_mode ? scrolling_region_top_row : 0;
}
-int DrawState::limit_bottom( void )
+int DrawState::limit_bottom( void ) const
{
return origin_mode ? scrolling_region_bottom_row : height - 1;
}
-void Framebuffer::apply_renditions_to_current_cell( void )
+void Framebuffer::apply_renditions_to_cell( Cell *cell )
{
- get_mutable_cell()->renditions = ds.get_renditions();
+ if (!cell) {
+ cell = get_mutable_cell();
+ }
+ cell->set_renditions( ds.get_renditions() );
}
SavedCursor::SavedCursor()
@@ -257,41 +305,77 @@
new_grapheme();
}
-void Framebuffer::insert_line( int before_row )
+void Framebuffer::insert_line( int before_row, int count )
{
if ( (before_row < ds.get_scrolling_region_top_row())
|| (before_row > ds.get_scrolling_region_bottom_row() + 1) ) {
return;
}
- rows.insert( rows.begin() + before_row, newrow() );
- rows.erase( rows.begin() + ds.get_scrolling_region_bottom_row() + 1 );
+ int max_scroll = ds.get_scrolling_region_bottom_row() + 1 - before_row;
+ if ( count > max_scroll ) {
+ count = max_scroll;
+ }
+
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/terminal/terminalframebuffer.h
^
|
@@ -33,120 +33,198 @@
#ifndef TERMINALFB_HPP
#define TERMINALFB_HPP
+#include <assert.h>
+#include <limits.h>
+#include <stdint.h>
+
#include <vector>
#include <deque>
#include <string>
#include <list>
-#include <assert.h>
+
+#include "shared.h"
/* Terminal framebuffer */
namespace Terminal {
+ using shared::shared_ptr;
+ using shared::make_shared;
+ typedef uint16_t color_type;
+
class Renditions {
public:
- bool bold, underlined, blink, inverse, invisible;
- int foreground_color;
- int background_color;
+ typedef enum { bold, faint, italic, underlined, blink, inverse, invisible, SIZE } attribute_type;
- Renditions( int s_background );
+ // all together, a 32 bit word now...
+ unsigned int foreground_color : 12;
+ unsigned int background_color : 12;
+ private:
+ unsigned int attributes : 8;
+
+ public:
+ Renditions( color_type s_background );
void set_foreground_color( int num );
void set_background_color( int num );
- void set_rendition( int num );
+ void set_rendition( color_type num );
std::string sgr( void ) const;
- void posterize( void );
-
bool operator==( const Renditions &x ) const
{
- return (bold == x.bold) && (underlined == x.underlined)
- && (blink == x.blink) && (inverse == x.inverse)
- && (invisible == x.invisible) && (foreground_color == x.foreground_color)
- && (background_color == x.background_color);
+ return ( attributes == x.attributes )
+ && ( foreground_color == x.foreground_color )
+ && ( background_color == x.background_color );
+ }
+ void set_attribute( attribute_type attr, bool val )
+ {
+ attributes = val ?
+ ( attributes | (1 << attr) ) :
+ ( attributes & ~(1 << attr) );
}
+ bool get_attribute( attribute_type attr ) const { return attributes & ( 1 << attr ); }
+ void clear_attributes() { attributes = 0; }
};
class Cell {
- public:
- std::vector<wchar_t> contents;
- char fallback; /* first character is combining character */
- int width;
+ private:
+ typedef std::string content_type; /* can be std::string, std::vector<uint8_t>, or __gnu_cxx::__vstring */
+ content_type contents;
Renditions renditions;
- bool wrap; /* if last cell, wrap to next line */
+ unsigned int wide : 1; /* 0 = narrow, 1 = wide */
+ unsigned int fallback : 1; /* first character is combining character */
+ unsigned int wrap : 1;
- Cell( int background_color )
- : contents(),
- fallback( false ),
- width( 1 ),
- renditions( background_color ),
- wrap( false )
- {}
-
- Cell() /* default constructor required by C++11 STL */
- : contents(),
- fallback( false ),
- width( 1 ),
- renditions( 0 ),
- wrap( false )
- {
- assert( false );
- }
+ public:
+ Cell( color_type background_color );
+ Cell(); /* default constructor required by C++11 STL */
- void reset( int background_color );
+ void reset( color_type background_color );
bool operator==( const Cell &x ) const
{
return ( (contents == x.contents)
&& (fallback == x.fallback)
- && (width == x.width)
+ && (wide == x.wide)
&& (renditions == x.renditions)
&& (wrap == x.wrap) );
}
- wchar_t debug_contents( void ) const;
+ bool operator!=( const Cell &x ) const { return !operator==( x ); }
+
+ /* Accessors for contents field */
+ std::string debug_contents( void ) const;
+
+ bool empty( void ) const { return contents.empty(); }
+ /* 32 seems like a reasonable limit on combining characters */
+ bool full( void ) const { return contents.size() >= 32; }
+ void clear( void ) { contents.clear(); }
bool is_blank( void ) const
{
+ // XXX fix.
return ( contents.empty()
- || ( (contents.size() == 1) && ( (contents.front() == 0x20)
- || (contents.front() == 0xA0) ) ) );
+ || contents == " "
+ || contents == "\xC2\xA0" );
}
- bool contents_match ( const Cell& other ) const
+ bool contents_match ( const Cell &other ) const
{
return ( is_blank() && other.is_blank() )
|| ( contents == other.contents );
}
bool compare( const Cell &other ) const;
+
+ // Is this a printing ISO 8859-1 character?
+ static bool isprint_iso8859_1( const wchar_t c )
+ {
+ return ( c <= 0xff && c >= 0xa0 ) || ( c <= 0x7e && c >= 0x20 );
+ }
+
+ static void append_to_str( std::string &dest, const wchar_t c )
+ {
+ /* ASCII? Cheat. */
+ if ( static_cast<uint32_t>(c) <= 0x7f ) {
+ dest.push_back( static_cast<char>(c) );
+ return;
+ }
+ static mbstate_t ps = mbstate_t();
+ char tmp[MB_LEN_MAX];
+ size_t ignore = wcrtomb(NULL, 0, &ps);
+ (void)ignore;
+ size_t len = wcrtomb(tmp, c, &ps);
+ dest.append( tmp, len );
+ }
+
+ void append( const wchar_t c )
+ {
+ /* ASCII? Cheat. */
+ if ( static_cast<uint32_t>(c) <= 0x7f ) {
+ contents.push_back( static_cast<char>(c) );
+ return;
+ }
+ static mbstate_t ps = mbstate_t();
+ char tmp[MB_LEN_MAX];
+ size_t ignore = wcrtomb(NULL, 0, &ps);
+ (void)ignore;
+ size_t len = wcrtomb(tmp, c, &ps);
+ contents.insert( contents.end(), tmp, tmp+len );
+ }
+
+ void print_grapheme( std::string &output ) const
+ {
+ if ( contents.empty() ) {
+ output.append( 1, ' ' );
+ return;
+ }
+ /*
+ * cells that begin with combining character get combiner
+ * attached to no-break space
+ */
+ if ( fallback ) {
+ output.append( "\xC2\xA0" );
+ }
+ output.append( contents );
+ }
+
+ /* Other accessors */
+ const Renditions& get_renditions( void ) const { return renditions; }
+ Renditions& get_renditions( void ) { return renditions; }
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/terminal/terminalfunctions.cc
^
|
@@ -50,7 +50,7 @@
}
/* erase in line */
-void CSI_EL( Framebuffer *fb, Dispatcher *dispatch )
+static void CSI_EL( Framebuffer *fb, Dispatcher *dispatch )
{
switch ( dispatch->getparam( 0, 0 ) ) {
case 0: /* default: active position to end of line, inclusive */
@@ -68,7 +68,7 @@
static Function func_CSI_EL( CSI, "K", CSI_EL );
/* erase in display */
-void CSI_ED( Framebuffer *fb, Dispatcher *dispatch ) {
+static void CSI_ED( Framebuffer *fb, Dispatcher *dispatch ) {
switch ( dispatch->getparam( 0, 0 ) ) {
case 0: /* active position to end of screen, inclusive */
clearline( fb, -1, fb->ds.get_cursor_col(), fb->ds.get_width() - 1 );
@@ -93,7 +93,7 @@
static Function func_CSI_ED( CSI, "J", CSI_ED );
/* cursor movement -- relative and absolute */
-void CSI_cursormove( Framebuffer *fb, Dispatcher *dispatch )
+static void CSI_cursormove( Framebuffer *fb, Dispatcher *dispatch )
{
int num = dispatch->getparam( 0, 1 );
@@ -127,7 +127,7 @@
static Function func_CSI_cursormove_f( CSI, "f", CSI_cursormove );
/* device attributes */
-void CSI_DA( Framebuffer *fb __attribute((unused)), Dispatcher *dispatch )
+static void CSI_DA( Framebuffer *fb __attribute((unused)), Dispatcher *dispatch )
{
dispatch->terminal_to_host.append( "\033[?62c" ); /* plain vt220 */
}
@@ -135,7 +135,7 @@
static Function func_CSI_DA( CSI, "c", CSI_DA );
/* secondary device attributes */
-void CSI_SDA( Framebuffer *fb __attribute((unused)), Dispatcher *dispatch )
+static void CSI_SDA( Framebuffer *fb __attribute((unused)), Dispatcher *dispatch )
{
dispatch->terminal_to_host.append( "\033[>1;10;0c" ); /* plain vt220 */
}
@@ -143,12 +143,12 @@
static Function func_CSI_SDA( CSI, ">c", CSI_SDA );
/* screen alignment diagnostic */
-void Esc_DECALN( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
+static void Esc_DECALN( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
{
for ( int y = 0; y < fb->ds.get_height(); y++ ) {
for ( int x = 0; x < fb->ds.get_width(); x++ ) {
fb->reset_cell( fb->get_mutable_cell( y, x ) );
- fb->get_mutable_cell( y, x )->contents.push_back( L'E' );
+ fb->get_mutable_cell( y, x )->append( 'E' );
}
}
}
@@ -156,7 +156,7 @@
static Function func_Esc_DECALN( ESCAPE, "#8", Esc_DECALN );
/* line feed */
-void Ctrl_LF( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
+static void Ctrl_LF( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
{
fb->move_rows_autoscroll( 1 );
}
@@ -168,7 +168,7 @@
static Function func_Ctrl_FF( CONTROL, "\x0c", Ctrl_LF );
/* carriage return */
-void Ctrl_CR( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
+static void Ctrl_CR( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
{
fb->ds.move_col( 0 );
}
@@ -176,7 +176,7 @@
static Function func_Ctrl_CR( CONTROL, "\x0d", Ctrl_CR );
/* backspace */
-void Ctrl_BS( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
+static void Ctrl_BS( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
{
fb->ds.move_col( -1, true );
}
@@ -184,7 +184,7 @@
static Function func_Ctrl_BS( CONTROL, "\x08", Ctrl_BS );
/* reverse index -- like a backwards line feed */
-void Ctrl_RI( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
+static void Ctrl_RI( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
{
fb->move_rows_autoscroll( -1 );
}
@@ -192,7 +192,7 @@
static Function func_Ctrl_RI( CONTROL, "\x8D", Ctrl_RI );
/* newline */
-void Ctrl_NEL( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
+static void Ctrl_NEL( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
{
fb->ds.move_col( 0 );
fb->move_rows_autoscroll( 1 );
@@ -201,9 +201,9 @@
static Function func_Ctrl_NEL( CONTROL, "\x85", Ctrl_NEL );
/* horizontal tab */
-void Ctrl_HT( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
+static void HT_n( Framebuffer *fb, size_t count )
{
- int col = fb->ds.get_next_tab();
+ int col = fb->ds.get_next_tab( count );
if ( col == -1 ) { /* no tabs, go to end of line */
col = fb->ds.get_width() - 1;
}
@@ -216,10 +216,29 @@
fb->ds.next_print_will_wrap = wrap_state_save;
}
+static void Ctrl_HT( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
+{
+ HT_n( fb, 1 );
+}
static Function func_Ctrl_HT( CONTROL, "\x09", Ctrl_HT, false );
+static void CSI_CxT( Framebuffer *fb, Dispatcher *dispatch )
+{
+ int param = dispatch->getparam( 0, 1 );
+ if ( dispatch->get_dispatch_chars()[ 0 ] == 'Z' ) {
+ param = -param;
+ }
+ if ( param == 0 ) {
+ return;
+ }
+ HT_n( fb, param );
+}
+
+static Function func_CSI_CHT( CSI, "I", CSI_CxT, false );
+static Function func_CSI_CBT( CSI, "Z", CSI_CxT, false );
+
/* horizontal tab set */
-void Ctrl_HTS( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
+static void Ctrl_HTS( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
{
fb->ds.set_tab();
}
@@ -227,7 +246,7 @@
static Function func_Ctrl_HTS( CONTROL, "\x88", Ctrl_HTS );
/* tabulation clear */
-void CSI_TBC( Framebuffer *fb, Dispatcher *dispatch )
+static void CSI_TBC( Framebuffer *fb, Dispatcher *dispatch )
{
int param = dispatch->getparam( 0, 0 );
switch ( param ) {
@@ -268,28 +287,48 @@
return &(fb->ds.auto_wrap_mode);
case 25:
return &(fb->ds.cursor_visible);
+ case 1004: /* xterm mouse focus event */
+ return &(fb->ds.mouse_focus_event);
+ case 1007: /* xterm mouse alternate scroll */
+ return &(fb->ds.mouse_alternate_scroll);
+ case 2004: /* bracketed paste */
+ return &(fb->ds.bracketed_paste);
}
return NULL;
}
+/* helper for CSI_DECSM and CSI_DECRM */
+static void set_if_available( bool *mode, bool value )
+{
+ if ( mode ) { *mode = value; }
+}
+
/* set private mode */
-void CSI_DECSM( Framebuffer *fb, Dispatcher *dispatch )
+static void CSI_DECSM( Framebuffer *fb, Dispatcher *dispatch )
{
for ( int i = 0; i < dispatch->param_count(); i++ ) {
- bool *mode = get_DEC_mode( dispatch->getparam( i, 0 ), fb );
- if ( mode ) {
- *mode = true;
+ int param = dispatch->getparam( i, 0 );
+ if (param == 9 || (param >= 1000 && param <= 1003)) {
+ fb->ds.mouse_reporting_mode = (Terminal::DrawState::MouseReportingMode) param;
+ } else if (param == 1005 || param == 1006 || param == 1015) {
+ fb->ds.mouse_encoding_mode = (Terminal::DrawState::MouseEncodingMode) param;
+ } else {
+ set_if_available( get_DEC_mode( param, fb ), true );
}
}
}
/* clear private mode */
-void CSI_DECRM( Framebuffer *fb, Dispatcher *dispatch )
+static void CSI_DECRM( Framebuffer *fb, Dispatcher *dispatch )
{
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/terminal/terminaluserinput.cc
^
|
@@ -39,8 +39,6 @@
string UserInput::input( const Parser::UserByte *act,
bool application_mode_cursor_keys )
{
- act->handled = true;
-
/* The user will always be in application mode. If stm is not in
application mode, convert user's cursor control function to an
ANSI cursor control sequence */
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/tests/Makefile.am
^
|
@@ -1,13 +1,78 @@
+EXTRA_DIST = \
+ hold-stdin print-exitstatus \
+ e2e-test e2e-test-server \
+ e2e-test-subrs \
+ mosh-client mosh-server \
+ local.test \
+ $(displaytests) \
+ emulation-attributes.test
+
AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(PICKY_CXXFLAGS) $(HARDEN_CFLAGS) $(MISC_CXXFLAGS)
AM_LDFLAGS = $(HARDEN_LDFLAGS)
-check_PROGRAMS = ocb-aes encrypt-decrypt
-TESTS = ocb-aes encrypt-decrypt
+displaytests = \
+ e2e-success.test \
+ e2e-failure.test \
+ emulation-ascii-iso-8859.test \
+ emulation-80th-column.test \
+ emulation-attributes-vt100.test \
+ emulation-attributes-16color.test \
+ emulation-attributes-256color8.test \
+ emulation-attributes-256color248.test \
+ emulation-back-tab.test \
+ emulation-cursor-motion.test \
+ emulation-multiline-scroll.test \
+ emulation-scroll.test \
+ emulation-wrap-across-frames.test \
+ network-no-diff.test \
+ prediction-unicode.test \
+ pty-deadlock.test \
+ repeat.test \
+ repeat-with-input.test \
+ server-network-timeout.test \
+ server-signal-timeout.test \
+ window-resize.test \
+ unicode-combine-fallback-assert.test \
+ unicode-later-combining.test \
+ window-resize.test
+
+check_PROGRAMS = ocb-aes encrypt-decrypt base64 nonce-incr inpty is-utf8-locale
+TESTS = ocb-aes encrypt-decrypt base64 nonce-incr local.test $(displaytests)
+XFAIL_TESTS = \
+ e2e-failure.test \
+ emulation-attributes-256color8.test
+
+base64_vector.cc: $(srcdir)/genbase64.pl
+ $(AM_V_GEN)echo '#include "base64_vector.h"' > base64_vector.cc || rm base64_vector.cc
+ $(AM_V_GEN)perl $(srcdir)/genbase64.pl >> base64_vector.cc || rm base64_vector.cc
ocb_aes_SOURCES = ocb-aes.cc test_utils.cc test_utils.h
-ocb_aes_CPPFLAGS = -I$(srcdir)/../crypto -I$(srcdir)/../util
-ocb_aes_LDADD = ../crypto/libmoshcrypto.a ../util/libmoshutil.a $(OPENSSL_LIBS)
+ocb_aes_CPPFLAGS = -I$(srcdir)/../crypto -I$(srcdir)/../util $(CRYPTO_CFLAGS)
+ocb_aes_LDADD = ../crypto/libmoshcrypto.a ../util/libmoshutil.a $(CRYPTO_LIBS)
encrypt_decrypt_SOURCES = encrypt-decrypt.cc test_utils.cc test_utils.h
encrypt_decrypt_CPPFLAGS = -I$(srcdir)/../crypto -I$(srcdir)/../util
-encrypt_decrypt_LDADD = ../crypto/libmoshcrypto.a ../util/libmoshutil.a $(OPENSSL_LIBS)
+encrypt_decrypt_LDADD = ../crypto/libmoshcrypto.a ../util/libmoshutil.a $(CRYPTO_LIBS)
+
+base64_SOURCES = base64.cc base64_vector.cc base64_vector.h genbase64.pl
+base64_CPPFLAGS = $(ocb_aes_CPPFLAGS)
+base64_LDADD = $(ocb_aes_LDADD)
+
+nonce_incr_SOURCES = nonce-incr.cc
+nonce_incr_CPPFLAGS = -I$(srcdir)/../network -I$(srcdir)/../crypto -I$(srcdir)/../util $(CRYPTO_CFLAGS)
+nonce_incr_LDADD = ../network/libmoshnetwork.a ../crypto/libmoshcrypto.a ../util/libmoshutil.a $(CRYPTO_LIBS)
+
+inpty_SOURCES = inpty.cc
+inpty_CPPFLAGS = -I$(srcdir)/../util
+inpty_LDADD = ../util/libmoshutil.a
+
+is_utf8_locale_SOURCES = is-utf8-locale.cc
+is_utf8_locale_CPPFLAGS = -I$(srcdir)/../util
+is_utf8_locale_LDADD = ../util/libmoshutil.a $(LIBUTIL)
+
+clean-local: clean-local-check
+.PHONY: clean-local-check
+clean-local-check:
+ -for i in $(displaytests); do rm -rf $$i.d/; done
+
+CLEANFILES = base64_vector.cc
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/tests/Makefile.in
^
|
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,23 +14,61 @@
@SET_MAKE@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
- test $$am__dry = yes; \
- }
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -48,10 +85,12 @@
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-check_PROGRAMS = ocb-aes$(EXEEXT) encrypt-decrypt$(EXEEXT)
-TESTS = ocb-aes$(EXEEXT) encrypt-decrypt$(EXEEXT)
+check_PROGRAMS = ocb-aes$(EXEEXT) encrypt-decrypt$(EXEEXT) \
+ base64$(EXEEXT) nonce-incr$(EXEEXT) inpty$(EXEEXT) \
+ is-utf8-locale$(EXEEXT)
+TESTS = ocb-aes$(EXEEXT) encrypt-decrypt$(EXEEXT) base64$(EXEEXT) \
+ nonce-incr$(EXEEXT) local.test $(displaytests)
subdir = src/tests
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_check_library.m4 \
@@ -60,22 +99,52 @@
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
+am_base64_OBJECTS = base64-base64.$(OBJEXT) \
+ base64-base64_vector.$(OBJEXT)
+base64_OBJECTS = $(am_base64_OBJECTS)
+am__DEPENDENCIES_1 =
+am__DEPENDENCIES_2 = ../crypto/libmoshcrypto.a ../util/libmoshutil.a \
+ $(am__DEPENDENCIES_1)
+base64_DEPENDENCIES = $(am__DEPENDENCIES_2)
am_encrypt_decrypt_OBJECTS = \
encrypt_decrypt-encrypt-decrypt.$(OBJEXT) \
encrypt_decrypt-test_utils.$(OBJEXT)
encrypt_decrypt_OBJECTS = $(am_encrypt_decrypt_OBJECTS)
-am__DEPENDENCIES_1 =
encrypt_decrypt_DEPENDENCIES = ../crypto/libmoshcrypto.a \
../util/libmoshutil.a $(am__DEPENDENCIES_1)
+am_inpty_OBJECTS = inpty-inpty.$(OBJEXT)
+inpty_OBJECTS = $(am_inpty_OBJECTS)
+inpty_DEPENDENCIES = ../util/libmoshutil.a
+am_is_utf8_locale_OBJECTS = is_utf8_locale-is-utf8-locale.$(OBJEXT)
+is_utf8_locale_OBJECTS = $(am_is_utf8_locale_OBJECTS)
+is_utf8_locale_DEPENDENCIES = ../util/libmoshutil.a
+am_nonce_incr_OBJECTS = nonce_incr-nonce-incr.$(OBJEXT)
+nonce_incr_OBJECTS = $(am_nonce_incr_OBJECTS)
+nonce_incr_DEPENDENCIES = ../network/libmoshnetwork.a \
+ ../crypto/libmoshcrypto.a ../util/libmoshutil.a \
+ $(am__DEPENDENCIES_1)
am_ocb_aes_OBJECTS = ocb_aes-ocb-aes.$(OBJEXT) \
ocb_aes-test_utils.$(OBJEXT)
ocb_aes_OBJECTS = $(am_ocb_aes_OBJECTS)
ocb_aes_DEPENDENCIES = ../crypto/libmoshcrypto.a ../util/libmoshutil.a \
$(am__DEPENDENCIES_1)
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -83,44 +152,268 @@
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
+am__v_lt_1 =
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
AM_V_CXX = $(am__v_CXX_@AM_V@)
am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
-am__v_CXX_0 = @echo " CXX " $@;
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
+am__v_CXX_0 = @echo " CXX " $@;
+am__v_CXX_1 =
CXXLD = $(CXX)
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
-o $@
AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
-am__v_CXXLD_0 = @echo " CXXLD " $@;
+am__v_CXXLD_0 = @echo " CXXLD " $@;
+am__v_CXXLD_1 =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
-am__v_CC_0 = @echo " CC " $@;
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo " CCLD " $@;
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
-SOURCES = $(encrypt_decrypt_SOURCES) $(ocb_aes_SOURCES)
-DIST_SOURCES = $(encrypt_decrypt_SOURCES) $(ocb_aes_SOURCES)
+am__v_CCLD_0 = @echo " CCLD " $@;
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/base64.cc
^
|
@@ -0,0 +1,145 @@
+/*
+ Mosh: the mobile shell
+ Copyright 2012 Keith Winstein
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of portions of this program with the
+ OpenSSL library under certain conditions as described in each
+ individual source file, and distribute linked combinations including
+ the two.
+
+ You must obey the GNU General Public License in all respects for all
+ of the code used other than OpenSSL. If you modify file(s) with this
+ exception, you may extend this exception to your version of the
+ file(s), but you are not obligated to do so. If you do not wish to do
+ so, delete this exception statement from your version. If you delete
+ this exception statement from all source files in the program, then
+ also delete it here.
+*/
+
+/* Test suite for the OCB-AES reference implementation included with Mosh.
+
+ 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. */
+
+#include <stdint.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "base64.h"
+#include "base64_vector.h"
+#include "crypto.h"
+#include "prng.h"
+#include "fatal_assert.h"
+// #include "test_utils.h"
+
+#define KEY_LEN 16
+#define NONCE_LEN 12
+#define TAG_LEN 16
+
+bool verbose = false;
+
+static void test_base64( void ) {
+ /* run through a test vector */
+ char encoded[25];
+ uint8_t decoded[16];
+ size_t b64_len = 24;
+ size_t raw_len = 16;
+ for ( base64_test_row *row = static_base64_vector; *row->native != '\0'; row++ ) {
+ memset(encoded, '\0', sizeof encoded);
+ memset(decoded, '\0', sizeof decoded);
+
+ base64_encode(static_cast<const uint8_t *>(row->native), raw_len, encoded, b64_len);
+ fatal_assert( b64_len == 24 );
+ fatal_assert( !memcmp(row->encoded, encoded, sizeof encoded));
+
+ fatal_assert( base64_decode(row->encoded, b64_len, decoded, &raw_len ));
+ fatal_assert( raw_len == 16 );
+ fatal_assert( !memcmp(row->native, decoded, sizeof decoded));
+ }
+ if ( verbose ) {
+ printf( "validation PASSED\n" );
+ }
+ /* try 0..255 in the last byte; make sure the final two characters are output properly */
+ uint8_t source[16];
+ memset(source, '\0', sizeof source);
+ for ( int i = 0; i < 256; i++ ) {
+ source[15] = i;
+ base64_encode(source, raw_len, encoded, b64_len);
+ fatal_assert( b64_len == 24 );
+
+ fatal_assert( base64_decode(encoded, b64_len, decoded, &raw_len ));
+ fatal_assert( raw_len == 16 );
+ fatal_assert( !memcmp(source, decoded, sizeof decoded));
+ }
+ if ( verbose ) {
+ printf( "last-byte PASSED\n" );
+ }
+
+ /* randomly try keys */
+ PRNG prng;
+ for ( int i = 0; i < ( 1<<17 ); i++ ) {
+ Base64Key key1(prng);
+ Base64Key key2(key1.printable_key());
+ fatal_assert( key1.printable_key() == key2.printable_key() && !memcmp(key1.data(), key2.data(), 16 ));
+ }
+ if ( verbose ) {
+ printf( "random PASSED\n" );
+ }
+
+ /* test bad keys */
+ const char *bad_keys[] = {
+ "",
+ "AAAAAAAAAAAAAAAAAAAAAA",
+ "AAAAAAAAAAAAAAAAAAAAAA=",
+ "AAAAAAAAAAAAAAAAAAAAA==",
+ "AAAAAAAAAAAAAAAAAAAAAAA==",
+ "AAAAAAAAAAAAAAAAAAAAAAAA==",
+ "AAAAAAAAAAAAAAAAAAAAAA~=",
+ "AAAAAAAAAAAAAAAAAAAAAA=~",
+ "~AAAAAAAAAAAAAAAAAAAAA==",
+ "AAAAAAAAAAAAAAAAAAAA~A==",
+ "AAAAAAAAAAAAAAAAAAAAA~==",
+ "AAAAAAAAAA~AAAAAAAAAAA==",
+ "AAAAAAAAAA==",
+ NULL,
+ };
+ for ( const char **key = bad_keys; *key != NULL; key++ ) {
+ b64_len = 24;
+ raw_len = 16;
+ fatal_assert( !base64_decode(*key, b64_len, decoded, &raw_len ));
+ }
+ if ( verbose ) {
+ printf( "bad-keys PASSED\n" );
+ }
+}
+
+int main( int argc, char *argv[] )
+{
+ if ( argc >= 2 && strcmp( argv[ 1 ], "-v" ) == 0 ) {
+ verbose = true;
+ }
+
+ try {
+ test_base64();
+ } catch ( const std::exception &e ) {
+ fprintf( stderr, "Error: %s\r\n", e.what() );
+ return 1;
+ }
+ return 0;
+}
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/base64_vector.cc
^
|
@@ -0,0 +1,12 @@
+#include "base64_vector.h"
+base64_test_row static_base64_vector[] = {
+ { "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", "AAAAAAAAAAAAAAAAAAAAAA==" },
+ { "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff", "/////////////////////w==" },
+ { "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff", "AAAAAAAAAAAAAAAAAAAA/w==" },
+ { "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00", "////////////////////AA==" },
+ { "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", "qqqqqqqqqqqqqqqqqqqqqg==" },
+ { "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\x55\x55\x55\x55\x55\x55\x55\x55", "qqqqqqqqqqpVVVVVVVVVVQ==" },
+ { "\x55\x55\x55\x55\x55\x55\x55\x55\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", "VVVVVVVVVVWqqqqqqqqqqg==" },
+ { "\x01\x02\x04\x08\x10\x20\x40\x80\xfe\xfd\xfb\xf7\xef\xdf\xbf\x7f", "AQIECBAgQID+/fv379+/fw==" },
+ { "", "" }
+};
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/base64_vector.h
^
|
@@ -0,0 +1,3 @@
+struct base64_test_row { const unsigned char native[17]; const char encoded[25]; };
+typedef base64_test_row *base64_test_vector;
+extern base64_test_row static_base64_vector[];
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/e2e-failure.test
^
|
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# shellcheck source=e2e-test-subrs
+. "$(dirname "$0")/e2e-test-subrs"
+PATH=$PATH:.:$srcdir
+# Top-level wrapper.
+if [ $# -eq 0 ]; then
+ e2e-test "$0" baseline variant different
+ exit
+fi
+
+# OK, we have arguments, we're one of the test hooks.
+if [ $# -ne 1 ]; then
+ fail "bad arguments %s\n" "$@"
+fi
+
+baseline()
+{
+ printf "\033[H\033[J"
+}
+
+case $1 in
+ baseline|variant)
+ baseline;;
+ *)
+ fail "unknown test argument %s\n" "$1";;
+esac
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/e2e-success.test
^
|
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# shellcheck source=e2e-test-subrs
+. "$(dirname "$0")/e2e-test-subrs"
+PATH=$PATH:.:$srcdir
+# Top-level wrapper.
+if [ $# -eq 0 ]; then
+ e2e-test "$0" baseline direct variant verify same
+ exit
+fi
+
+# OK, we have arguments, we're one of the test hooks.
+if [ $# -ne 1 ]; then
+ fail "bad arguments %s\n" "$@"
+fi
+
+baseline()
+{
+ printf "\033[H\033[J"
+}
+
+case $1 in
+ baseline|direct|variant)
+ baseline;;
+ *)
+ fail "unknown test argument %s\n" "$1";;
+esac
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/e2e-test
^
|
@@ -0,0 +1,326 @@
+#!/bin/sh
+
+. "$(dirname "$0")/e2e-test-subrs"
+
+#
+# Validate that mosh produces expected output, using screen captures
+# in tmux.
+#
+
+log()
+{
+ printf "$@"
+}
+
+error()
+{
+ printf "$@" >&2
+}
+
+dump_logs()
+{
+ dir=$1
+ shift
+ testname=$(basename "$dir" .d)
+ for logfile in $dir/*.tmux.log; do
+ printf "travis_fold:start:%s-%s\n" "$testname" "$(basename "$logfile")"
+ cat "$logfile"
+ printf "travis_fold:end:%s-%s\n" "$testname" "$(basename "$logfile")"
+ done
+}
+
+test_success()
+{
+ exit 0
+}
+test_failure()
+{
+ error "$@"
+ exit 1
+}
+test_skipped()
+{
+ error "$@"
+ exit 77
+}
+test_error()
+{
+ error "$@"
+ exit 99
+}
+test_exitstatus()
+{
+ status=$1
+ shift
+ error "$@"
+ exit "$status"
+}
+
+
+# Tmux check.
+tmux_check()
+{
+ # OpenBSD tmux does not have '-V'.
+ if [ "$(uname -s)" = "OpenBSD" ]; then
+ openbsd_major="$(uname -r)"
+ openbsd_major="${openbsd_major%%.*}"
+ if [ "${openbsd_major}" -ge 6 ]; then
+ return 0
+ fi
+ fi
+ version=$(tmux -V)
+ if [ $? != 0 ]; then
+ error "tmux unavailable\n"
+ return 1
+ fi
+ if [ "$version" = "tmux master" ]; then
+ return 0
+ fi
+ version=${version##tmux }
+ version_major=${version%%.*}
+ version_minor=${version##*.}
+ # need version 1.8 for capture-pane
+ if [ "$version_major" -lt 1 ] ||
+ { [ "$version_major" -eq 1 ] && [ "$version_minor" -lt 8 ]; }; then
+ error "tmux version %s too old\n" "$version"
+ return 1
+ fi
+ # Finally, check that tmux actually works to some degree.
+ tmux -C new-session true
+}
+
+ssh_localhost_check()
+{
+ ssh localhost :
+ if [ $? -ne 0 ]; then
+ error "ssh to localhost failed\n"
+ return 1
+ fi
+ return 0
+}
+
+# These two functions are wrappers for mosh-client/mosh-server to turn
+# on verbosity and log stderr.
+mosh_client()
+{
+ if [ -z "$MOSH_CLIENT" ] || [ -z "$MOSH_E2E_TEST" ]; then
+ test_error "mosh_client: variables missing\n"
+ fi
+ exec 2> "${MOSH_E2E_TEST}.client.stderr"
+ exec "$MOSH_CLIENT" $MOSH_CLIENT_ARGS "$@"
+}
+
+mosh_server()
+{
+ if [ -z "$MOSH_SERVER" ] || [ -z "$MOSH_E2E_TEST" ]; then
+ test_error "mosh_server: variables missing\n"
+ fi
+ exec 2> "${MOSH_E2E_TEST}.server.stderr"
+ exec "$MOSH_SERVER" new -vv $MOSH_SERVER_ARGS -@ "$@"
+}
+
+# main
+# Set up environment
+if [ -z "$srcdir" ]; then
+ export srcdir=$PWD
+else
+ srcdir="$(cd "$srcdir" && pwd)"
+ if [ $? -ne 0 ]; then
+ error "can't cd to srcdir: %s\n" "$srcdir"
+ exit 99
+ fi
+fi
+
+# Wrappers.
+case "$(basename "$0")" in
+ mosh-client)
+ mosh_client "$@"
+ exit
+ ;;
+ mosh-server)
+ mosh_server "$@"
+ exit
+ ;;
+ *)
+ ;;
+esac
+
+if [ $# -lt 2 ]; then
+ test_error "not enough args\n"
+fi
+
+# Get arguments (only one so far)
+test_name=$1
+shift
+test_args=$@
+# XXX could use AM testsubdir macro instead
+test_dir=$(basename "${test_name}").d
+test_script="${test_name}"
+
+tests_dir=$(dirname "${test_name}")
+if ! set_locale "${tests_dir}"; then
+ test_error "e2e-test: no usable locale\n"
+fi
+
+if ! tmux_check; then
+ test_skipped "tmux unavailable\n"
+fi
+
+rm -rf "${test_dir}"
+mkdir "${test_dir}"
+
+
+on_exit() {
+ rv=$?
+ if test $rv -ne 0; then
+ dump_logs "$test_dir" $test_args
+ fi
+ exit $rv
+}
+trap on_exit EXIT
+
+# Set up tests to run.
+server_tests=
+compare_tests=
+for i in $test_args; do
+ case $i in
+ baseline|direct|variant)
+ server_tests="$server_tests $i";;
+ verify|same|different)
+ compare_tests="$compare_tests $i";;
+ tmux)
+ tmux=1;;
+ client)
+ client=1;;
+ server)
+ server=1;;
+ post)
+ post=1;;
+ mosh-args)
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/e2e-test-server
^
|
@@ -0,0 +1,92 @@
+#!/bin/sh
+
+#
+# Harness script for Mosh tests, server side. Runs test script and
+# then captures screen with `tmux capture-pane`. Captures exitstatus
+# of both and returns appropriate errors.
+#
+
+# If MOSH_E2E_WAIT is set, then the test will wait for another tmux
+# client to attach to the test session before starting, and will wait
+# for other tmux clients to detach before exiting.
+wait_for_clients()
+{
+ if [ -z "$MOSH_E2E_WAIT" ]; then
+ return
+ fi
+ expected=$1
+ while true; do
+ n=$(tmux list-clients -F . | wc -l)
+ if [ $expected -eq 1 ]; then
+ if [ $n -eq 1 ]; then
+ return
+ fi
+ elif [ $n -ne 1 ]; then
+ return
+ fi
+ sleep 1
+ done
+}
+
+export MOSH_SERVER_PID=$PPID
+
+if [ $# -lt 2 ]; then
+ printf "not enough args\n" >&2
+ exit 99
+fi
+testname=$1
+shift
+rm -f "$testname.capture" "$testname.exitstatus"
+trap ":" TERM HUP QUIT # If the session closes on us, let the test we're running drive.
+on_exit() {
+ rv=$?
+ echo $rv > "$testname.exitstatus"
+ exit $rv
+}
+trap on_exit EXIT
+# check for tmux
+if [ -z "$TMUX_PANE" ]; then
+ printf "not running under tmux\n" >&2
+ exit 99
+fi
+wait_for_clients 2
+# run harnessed command
+eval "$@"
+testret=$?
+# Capture mosh-server runtime if possible.
+runtime=$(ps -o time= $PPID 2>/dev/null)
+if [ $? -ne 0 ]; then # Cygwin...
+ runtime=-
+fi
+# Wait for tmux client screen to become up to date.
+sleep 1
+printf "@@@ server complete @@@" >&2
+wait_for_clients 1
+i=0
+while [ $i -lt 60 ]; do
+ if grep -q "@@@ server complete @@@" "$testname.tmux.log"; then
+ break
+ fi
+ i=$((i+1))
+ sleep 1
+done
+if [ $i -ge 60 ]; then
+ printf "wait for tmux client update failed, erroring test\n" >&2
+ exit 99
+fi
+# capture screen
+if ! tmux capture-pane -et "$TMUX_PANE"; then
+ printf "tmux capture-pane failed, erroring test\n" >&2
+ exit 99
+fi
+if ! tmux save-buffer "$testname.capture"; then
+ printf "tmux save-buffer failed, erroring test\n" >&2
+ exit 99
+fi
+# Dump runtime into tmux log.
+printf "@@@ runtime %s @@@\n" "$runtime"
+# return useful exitstatus from harnessed command
+if [ $testret -ne 0 ]; then
+ exit 1
+fi
+exit 0
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/e2e-test-subrs
^
|
@@ -0,0 +1,82 @@
+#!/bin/sh
+
+#
+# This is a library of subroutines mostly intended for test scripts.
+#
+
+fail()
+{
+ printf "$@" 2>&1
+ exit 99
+}
+
+skip()
+{
+ printf "$@" 2>&1
+ exit 77
+}
+
+sleepf()
+{
+ (sleep .1 || sleep 1) > /dev/null 2>&1
+}
+
+seq_function()
+{
+ if [ $# -lt 1 ] || [ $# -gt 3 ]; then
+ echo "bad args" >&2
+ fi
+ first=$1
+ incr=1
+ last=0
+ case $# in
+ 3)
+ incr=$2
+ last=$3
+ ;;
+ 2)
+ last=$2
+ ;;
+ 1)
+ ;;
+ esac
+ while :; do
+ printf '%d\n' "$first"
+ first=$(( first + incr ))
+ if [ "$first" -gt "$last" ]; then
+ break
+ fi
+ done
+}
+
+if ! seq 1 > /dev/null 2>&1; then
+ seq()
+ {
+ seq_function "$@"
+ }
+fi
+
+chr()
+{
+ printf '%b' "\\0$(printf %03o "$1")"
+}
+
+# If the locale is not set to a UTF-8 locale, set it to en_US.UTF-8
+# or C.UTF-8.
+set_locale()
+{
+ # Test for a usable locale.
+ if ./is-utf8-locale 2> /dev/null; then
+ return 0
+ fi
+ # Attempt to find/set a usable locale.
+ unset LANG LC_CTYPE LC_COLLATE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME LC_ALL
+ for i in en_US.UTF-8 en_US.utf8 C.UTF-8; do
+ if env LC_ALL=$i ./is-utf8-locale 2> /dev/null; then
+ export LC_ALL=$i
+ return 0
+ fi
+ done
+ # Fail.
+ return 1
+}
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/emulation-80th-column.test
^
|
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+#
+# This test validates the ancient VT100 behavior of positioning the
+# cursor at column 80 (and not wrapping) after 80 characters are
+# output, and behaving accordingly with subsequent cursor motion
+# commands (CR+LF in this state should not result in an extra blank
+# line).
+#
+
+# shellcheck source=e2e-test-subrs
+. "$(dirname "$0")/e2e-test-subrs"
+PATH=$PATH:.:$srcdir
+# Top-level wrapper.
+if [ $# -eq 0 ]; then
+ e2e-test "$0" baseline post
+ exit
+fi
+
+# OK, we have arguments, we're one of the test hooks.
+if [ $# -ne 1 ]; then
+ fail "bad arguments %s\n" "$@"
+fi
+
+baseline()
+{
+ # We need to control CR and LF individually for this test.
+ TERMIO=$(stty -g)
+ trap 'stty "$TERMIO"' EXIT
+ stty raw
+ printf '\033[H\033[J'
+ for lines in $(seq 1 25); do
+ for tencols in $(seq 1 8); do
+ printf "EEEEEEEEEE"
+ done
+ printf "\r\n"
+ done
+}
+
+post()
+{
+ # If hidden 80th column is working properly, then the lines
+ # will have no blank lines in between and we should see 23
+ # of them.
+ if [ "$(grep -c "EEEEEEEEEE" "$(basename "$0").d/baseline.capture")" -ne 23 ]; then
+ exit 1
+ fi
+}
+
+case $1 in
+ baseline)
+ baseline;;
+ post)
+ post;;
+ *)
+ fail "unknown test argument %s\n" "$1";;
+esac
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/emulation-ascii-iso-8859.test
^
|
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+#
+# This validates display of ASCII and ISO-8859-1 characters.
+#
+
+# shellcheck source=e2e-test-subrs
+. "$(dirname "$0")/e2e-test-subrs"
+PATH=$PATH:.:$srcdir
+# Top-level wrapper.
+if [ $# -eq 0 ]; then
+ e2e-test "$0" baseline direct verify
+ exit
+fi
+
+# OK, we have arguments, we're one of the test hooks.
+if [ $# -ne 1 ]; then
+ fail "bad arguments %s\n" "$@"
+fi
+
+baseline()
+{
+ printf '\033[H\033[J'
+
+ cat <<'EOF'
+20 21 ! 22 " 23 # 24 $ 25 % 26 & 27 ' 28 ( 29 ) 2a * 2b + 2c , 2d - 2e . 2f /
+30 0 31 1 32 2 33 3 34 4 35 5 36 6 37 7 38 8 39 9 3a : 3b ; 3c < 3d = 3e > 3f ?
+40 @ 41 A 42 B 43 C 44 D 45 E 46 F 47 G 48 H 49 I 4a J 4b K 4c L 4d M 4e N 4f O
+50 P 51 Q 52 R 53 S 54 T 55 U 56 V 57 W 58 X 59 Y 5a Z 5b [ 5c \ 5d ] 5e ^ 5f _
+60 ` 61 a 62 b 63 c 64 d 65 e 66 f 67 g 68 h 69 i 6a j 6b k 6c l 6d m 6e n 6f o
+70 p 71 q 72 r 73 s 74 t 75 u 76 v 77 w 78 x 79 y 7a z 7b { 7c | 7d } 7e ~
+a0 a1 ¡ a2 ¢ a3 £ a4 ¤ a5 ¥ a6 ¦ a7 § a8 ¨ a9 © aa ª ab « ac ¬ ad ae ® af ¯
+b0 ° b1 ± b2 ² b3 ³ b4 ´ b5 µ b6 ¶ b7 · b8 ¸ b9 ¹ ba º bb » bc ¼ bd ½ be ¾ bf ¿
+c0 À c1 Á c2 Â c3 Ã c4 Ä c5 Å c6 Æ c7 Ç c8 È c9 É ca Ê cb Ë cc Ì cd Í ce Î cf Ï
+d0 Ð d1 Ñ d2 Ò d3 Ó d4 Ô d5 Õ d6 Ö d7 × d8 Ø d9 Ù da Ú db Û dc Ü dd Ý de Þ df ß
+e0 à e1 á e2 â e3 ã e4 ä e5 å e6 æ e7 ç e8 è e9 é ea ê eb ë ec ì ed í ee î ef ï
+f0 ð f1 ñ f2 ò f3 ó f4 ô f5 õ f6 ö f7 ÷ f8 ø f9 ù fa ú fb û fc ü fd ý fe þ ff ÿ
+EOF
+}
+
+case $1 in
+ baseline|direct)
+ baseline;;
+ *)
+ fail "unknown test argument %s\n" "$1";;
+esac
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/emulation-attributes-16color.test
^
|
@@ -0,0 +1,77 @@
+#!/bin/sh
+
+#
+# This validates VT100, 16-color, and 256-color attributes against
+# tmux. It is not run directly, but as subtests based on the
+# executable's name for vt100, 16color, 256color8, and 256color248.
+# This is because Mosh internally represents the first 8 values of the
+# 256color space as though they were the 16-color values they are
+# equivalent to. tmux does not filter this out on its redisplay, so
+# compares on these values fail though they are visually identical.
+#
+
+# shellcheck source=e2e-test-subrs
+. "$(dirname "$0")/e2e-test-subrs"
+PATH=$PATH:.:$srcdir
+# Top-level wrapper.
+if [ $# -eq 0 ]; then
+ e2e-test "$0" baseline direct verify
+ exit
+fi
+
+# OK, we have arguments, we're one of the test hooks.
+if [ $# -ne 1 ]; then
+ fail "bad arguments %s\n" "$@"
+fi
+
+baseline()
+{
+ # Strip our name to the last dash-separated word before the .test suffix.
+ testname=$(basename "$1")
+ testname=${testname%%.test}
+ testname=${testname##*-}
+
+ printf '\033[H\033[J'
+
+
+ case $testname in
+ # Traditional ancient VT100 attributes.
+ vt100)
+ for attr in 0 1 4 5 7; do
+ printf '\033[%dmE\033[m ' $attr
+ done
+ ;;
+ # 16-color attributes.
+ 16color)
+ for attr in $(seq 30 37) $(seq 39 47) 49; do
+ printf '\033[%dmE\033[m ' "$attr"
+ done
+ ;;
+ # First 8 256-color attributes. Comparing mosh and tmux fails.
+ 256color8)
+ for attr in $(seq 0 7); do
+ printf '\033[38;5;%dmE\033[m ' "$attr"
+ printf '\033[48;5;%dmM\033[m ' "$attr"
+ done
+ ;;
+ # Last 248 256-color attributes.
+ 256color248)
+ for attr in $(seq 8 255); do
+ printf '\033[38;5;%dmE\033[m ' "$attr"
+ printf '\033[48;5;%dmM\033[m ' "$attr"
+ done
+ ;;
+ *)
+ fail "unknown test name %s\n" "$1"
+ ;;
+ esac
+
+ printf '\033[mend\n'
+}
+
+case $1 in
+ baseline|direct)
+ baseline "$0";;
+ *)
+ fail "unknown test argument %s\n" "$1";;
+esac
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/emulation-attributes-256color248.test
^
|
@@ -0,0 +1,77 @@
+#!/bin/sh
+
+#
+# This validates VT100, 16-color, and 256-color attributes against
+# tmux. It is not run directly, but as subtests based on the
+# executable's name for vt100, 16color, 256color8, and 256color248.
+# This is because Mosh internally represents the first 8 values of the
+# 256color space as though they were the 16-color values they are
+# equivalent to. tmux does not filter this out on its redisplay, so
+# compares on these values fail though they are visually identical.
+#
+
+# shellcheck source=e2e-test-subrs
+. "$(dirname "$0")/e2e-test-subrs"
+PATH=$PATH:.:$srcdir
+# Top-level wrapper.
+if [ $# -eq 0 ]; then
+ e2e-test "$0" baseline direct verify
+ exit
+fi
+
+# OK, we have arguments, we're one of the test hooks.
+if [ $# -ne 1 ]; then
+ fail "bad arguments %s\n" "$@"
+fi
+
+baseline()
+{
+ # Strip our name to the last dash-separated word before the .test suffix.
+ testname=$(basename "$1")
+ testname=${testname%%.test}
+ testname=${testname##*-}
+
+ printf '\033[H\033[J'
+
+
+ case $testname in
+ # Traditional ancient VT100 attributes.
+ vt100)
+ for attr in 0 1 4 5 7; do
+ printf '\033[%dmE\033[m ' $attr
+ done
+ ;;
+ # 16-color attributes.
+ 16color)
+ for attr in $(seq 30 37) $(seq 39 47) 49; do
+ printf '\033[%dmE\033[m ' "$attr"
+ done
+ ;;
+ # First 8 256-color attributes. Comparing mosh and tmux fails.
+ 256color8)
+ for attr in $(seq 0 7); do
+ printf '\033[38;5;%dmE\033[m ' "$attr"
+ printf '\033[48;5;%dmM\033[m ' "$attr"
+ done
+ ;;
+ # Last 248 256-color attributes.
+ 256color248)
+ for attr in $(seq 8 255); do
+ printf '\033[38;5;%dmE\033[m ' "$attr"
+ printf '\033[48;5;%dmM\033[m ' "$attr"
+ done
+ ;;
+ *)
+ fail "unknown test name %s\n" "$1"
+ ;;
+ esac
+
+ printf '\033[mend\n'
+}
+
+case $1 in
+ baseline|direct)
+ baseline "$0";;
+ *)
+ fail "unknown test argument %s\n" "$1";;
+esac
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/emulation-attributes-256color8.test
^
|
@@ -0,0 +1,77 @@
+#!/bin/sh
+
+#
+# This validates VT100, 16-color, and 256-color attributes against
+# tmux. It is not run directly, but as subtests based on the
+# executable's name for vt100, 16color, 256color8, and 256color248.
+# This is because Mosh internally represents the first 8 values of the
+# 256color space as though they were the 16-color values they are
+# equivalent to. tmux does not filter this out on its redisplay, so
+# compares on these values fail though they are visually identical.
+#
+
+# shellcheck source=e2e-test-subrs
+. "$(dirname "$0")/e2e-test-subrs"
+PATH=$PATH:.:$srcdir
+# Top-level wrapper.
+if [ $# -eq 0 ]; then
+ e2e-test "$0" baseline direct verify
+ exit
+fi
+
+# OK, we have arguments, we're one of the test hooks.
+if [ $# -ne 1 ]; then
+ fail "bad arguments %s\n" "$@"
+fi
+
+baseline()
+{
+ # Strip our name to the last dash-separated word before the .test suffix.
+ testname=$(basename "$1")
+ testname=${testname%%.test}
+ testname=${testname##*-}
+
+ printf '\033[H\033[J'
+
+
+ case $testname in
+ # Traditional ancient VT100 attributes.
+ vt100)
+ for attr in 0 1 4 5 7; do
+ printf '\033[%dmE\033[m ' $attr
+ done
+ ;;
+ # 16-color attributes.
+ 16color)
+ for attr in $(seq 30 37) $(seq 39 47) 49; do
+ printf '\033[%dmE\033[m ' "$attr"
+ done
+ ;;
+ # First 8 256-color attributes. Comparing mosh and tmux fails.
+ 256color8)
+ for attr in $(seq 0 7); do
+ printf '\033[38;5;%dmE\033[m ' "$attr"
+ printf '\033[48;5;%dmM\033[m ' "$attr"
+ done
+ ;;
+ # Last 248 256-color attributes.
+ 256color248)
+ for attr in $(seq 8 255); do
+ printf '\033[38;5;%dmE\033[m ' "$attr"
+ printf '\033[48;5;%dmM\033[m ' "$attr"
+ done
+ ;;
+ *)
+ fail "unknown test name %s\n" "$1"
+ ;;
+ esac
+
+ printf '\033[mend\n'
+}
+
+case $1 in
+ baseline|direct)
+ baseline "$0";;
+ *)
+ fail "unknown test argument %s\n" "$1";;
+esac
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/emulation-attributes-vt100.test
^
|
@@ -0,0 +1,77 @@
+#!/bin/sh
+
+#
+# This validates VT100, 16-color, and 256-color attributes against
+# tmux. It is not run directly, but as subtests based on the
+# executable's name for vt100, 16color, 256color8, and 256color248.
+# This is because Mosh internally represents the first 8 values of the
+# 256color space as though they were the 16-color values they are
+# equivalent to. tmux does not filter this out on its redisplay, so
+# compares on these values fail though they are visually identical.
+#
+
+# shellcheck source=e2e-test-subrs
+. "$(dirname "$0")/e2e-test-subrs"
+PATH=$PATH:.:$srcdir
+# Top-level wrapper.
+if [ $# -eq 0 ]; then
+ e2e-test "$0" baseline direct verify
+ exit
+fi
+
+# OK, we have arguments, we're one of the test hooks.
+if [ $# -ne 1 ]; then
+ fail "bad arguments %s\n" "$@"
+fi
+
+baseline()
+{
+ # Strip our name to the last dash-separated word before the .test suffix.
+ testname=$(basename "$1")
+ testname=${testname%%.test}
+ testname=${testname##*-}
+
+ printf '\033[H\033[J'
+
+
+ case $testname in
+ # Traditional ancient VT100 attributes.
+ vt100)
+ for attr in 0 1 4 5 7; do
+ printf '\033[%dmE\033[m ' $attr
+ done
+ ;;
+ # 16-color attributes.
+ 16color)
+ for attr in $(seq 30 37) $(seq 39 47) 49; do
+ printf '\033[%dmE\033[m ' "$attr"
+ done
+ ;;
+ # First 8 256-color attributes. Comparing mosh and tmux fails.
+ 256color8)
+ for attr in $(seq 0 7); do
+ printf '\033[38;5;%dmE\033[m ' "$attr"
+ printf '\033[48;5;%dmM\033[m ' "$attr"
+ done
+ ;;
+ # Last 248 256-color attributes.
+ 256color248)
+ for attr in $(seq 8 255); do
+ printf '\033[38;5;%dmE\033[m ' "$attr"
+ printf '\033[48;5;%dmM\033[m ' "$attr"
+ done
+ ;;
+ *)
+ fail "unknown test name %s\n" "$1"
+ ;;
+ esac
+
+ printf '\033[mend\n'
+}
+
+case $1 in
+ baseline|direct)
+ baseline "$0";;
+ *)
+ fail "unknown test argument %s\n" "$1";;
+esac
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/emulation-attributes.test
^
|
@@ -0,0 +1,77 @@
+#!/bin/sh
+
+#
+# This validates VT100, 16-color, and 256-color attributes against
+# tmux. It is not run directly, but as subtests based on the
+# executable's name for vt100, 16color, 256color8, and 256color248.
+# This is because Mosh internally represents the first 8 values of the
+# 256color space as though they were the 16-color values they are
+# equivalent to. tmux does not filter this out on its redisplay, so
+# compares on these values fail though they are visually identical.
+#
+
+# shellcheck source=e2e-test-subrs
+. "$(dirname "$0")/e2e-test-subrs"
+PATH=$PATH:.:$srcdir
+# Top-level wrapper.
+if [ $# -eq 0 ]; then
+ e2e-test "$0" baseline direct verify
+ exit
+fi
+
+# OK, we have arguments, we're one of the test hooks.
+if [ $# -ne 1 ]; then
+ fail "bad arguments %s\n" "$@"
+fi
+
+baseline()
+{
+ # Strip our name to the last dash-separated word before the .test suffix.
+ testname=$(basename "$1")
+ testname=${testname%%.test}
+ testname=${testname##*-}
+
+ printf '\033[H\033[J'
+
+
+ case $testname in
+ # Traditional ancient VT100 attributes.
+ vt100)
+ for attr in 0 1 4 5 7; do
+ printf '\033[%dmE\033[m ' $attr
+ done
+ ;;
+ # 16-color attributes.
+ 16color)
+ for attr in $(seq 30 37) $(seq 39 47) 49; do
+ printf '\033[%dmE\033[m ' "$attr"
+ done
+ ;;
+ # First 8 256-color attributes. Comparing mosh and tmux fails.
+ 256color8)
+ for attr in $(seq 0 7); do
+ printf '\033[38;5;%dmE\033[m ' "$attr"
+ printf '\033[48;5;%dmM\033[m ' "$attr"
+ done
+ ;;
+ # Last 248 256-color attributes.
+ 256color248)
+ for attr in $(seq 8 255); do
+ printf '\033[38;5;%dmE\033[m ' "$attr"
+ printf '\033[48;5;%dmM\033[m ' "$attr"
+ done
+ ;;
+ *)
+ fail "unknown test name %s\n" "$1"
+ ;;
+ esac
+
+ printf '\033[mend\n'
+}
+
+case $1 in
+ baseline|direct)
+ baseline "$0";;
+ *)
+ fail "unknown test argument %s\n" "$1";;
+esac
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/emulation-back-tab.test
^
|
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+#
+# This test is for issue 539 on github.
+#
+
+# shellcheck source=e2e-test-subrs
+. "$(dirname "$0")/e2e-test-subrs"
+PATH=$PATH:.:$srcdir
+# Top-level wrapper.
+if [ $# -eq 0 ]; then
+ e2e-test "$0" baseline post
+ exit
+fi
+
+# OK, we have arguments, we're one of the test hooks.
+if [ $# -ne 1 ]; then
+ fail "bad arguments %s\n" "$@"
+fi
+
+baseline()
+{
+ printf 'hello, wurld\033[Zo\n'
+ printf 'hello, wurld\033[2Zo\n'
+ printf 'hello, wurld\033[99Z9\n'
+ printf 'hello, wurld\033[It\n'
+ printf '\033[99I#\n'
+}
+
+post()
+{
+ # Basic previously-failing case.
+ if grep -q 'hello, wurldo' "$(basename "$0").d/baseline.capture"; then
+ exit 1
+ fi
+ if ! grep -q 'hello, world' "$(basename "$0").d/baseline.capture"; then
+ exit 99
+ fi
+ # New test cases for new code.
+ if ! grep -q 'oello, wurld' "$(basename "$0").d/baseline.capture" ||
+ ! grep -q '9ello, wurld' "$(basename "$0").d/baseline.capture" ||
+ ! grep -q 'hello, wurld t' "$(basename "$0").d/baseline.capture" ||
+ ! grep -E -q '^ {79}#$' "$(basename "$0").d/baseline.capture"; then
+ exit 1
+ fi
+ exit 0
+}
+
+case $1 in
+ baseline)
+ baseline;;
+ post)
+ post;;
+ *)
+ fail "unknown test argument %s\n" "$1";;
+esac
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/emulation-cursor-motion.test
^
|
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+#
+# This test exercises a particular optimization involving small cursor
+# motions in Mosh.
+#
+
+# shellcheck source=e2e-test-subrs
+. "$(dirname "$0")/e2e-test-subrs"
+PATH=$PATH:.:$srcdir
+# Top-level wrapper.
+if [ $# -eq 0 ]; then
+ e2e-test "$0" baseline direct verify
+ exit
+fi
+
+# OK, we have arguments, we're one of the test hooks.
+if [ $# -ne 1 ]; then
+ fail "bad arguments %s\n" "$@"
+fi
+
+baseline()
+{
+ printf '\033[H\033[J'
+
+ while read -r x y text; do
+ printf '\033[%d;%dH%s' "$y" "$x" "$text"
+ sleepf
+ done <<EOF
+1 1 A
+10 1 B
+1 2 C
+1 4 D
+10 4 E
+1 7 F
+1 11 G
+10 11 H
+1 16 I
+2 16 J
+1 22 K
+60 23 L
+59 23 M
+57 23 N
+54 23 O
+50 23 P
+45 23 Q
+39 23 R
+32 23 S
+1 24 done
+EOF
+}
+
+case $1 in
+ baseline|direct)
+ baseline;;
+ *)
+ fail "unknown test argument %s\n" "$1";;
+esac
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/emulation-multiline-scroll.test
^
|
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+#
+# This is a regression test for a crash seen in my development
+# of performance code for Mosh, involving insert/delete line.
+# It does insert/delete line from 0 to 2 more than the window height
+# 24 in this test environment).
+#
+
+# shellcheck source=e2e-test-subrs
+. "$(dirname "$0")/e2e-test-subrs"
+PATH=$PATH:.:$srcdir
+# Top-level wrapper.
+if [ $# -eq 0 ]; then
+ e2e-test "$0" baseline
+ exit
+fi
+
+# OK, we have arguments, we're one of the test hooks.
+if [ $# -ne 1 ]; then
+ fail "bad arguments %s\n" "$@"
+fi
+
+baseline()
+{
+ printf '\033[H\033[J'
+ for dir in L M; do
+ for i in $(seq 0 2) $(seq 22 26); do
+ printf '%d\r' "$i"
+ printf '\033[%d%s' "$i" "$dir"
+ # On the one hand, we'd like to test that this works
+ # properly on both client and server, which requires
+ # delays so that each iteration percolates to the client
+ # by itself. On the other hand, that makes the test take
+ # a long time. Compromise on .1 second.
+ sleepf
+ done
+ done
+}
+
+case $1 in
+ baseline)
+ baseline;;
+ *)
+ fail "unknown test argument %s\n" "$1";;
+esac
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/emulation-scroll.test
^
|
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+#
+# This is a regression test for a bug in Mosh: it would move the
+# cursor for the SCROLL UP and SCROLL DOWN commands, though it should
+# not.
+#
+
+# shellcheck source=e2e-test-subrs
+. "$(dirname "$0")/e2e-test-subrs"
+PATH=$PATH:.:$srcdir
+# Top-level wrapper.
+if [ $# -eq 0 ]; then
+ e2e-test "$0" baseline post
+ exit
+fi
+
+# OK, we have arguments, we're one of the test hooks.
+if [ $# -ne 1 ]; then
+ fail "bad arguments %s\n" "$@"
+fi
+
+baseline()
+{
+ # Clear
+ printf '\033[H\033[J'
+ # Fill with sample text
+ for i in $(seq 1 24); do
+ printf '\ntext %s' "$i"
+ done
+ # Scroll up 4 lines
+ printf '\033[4S'
+ # Then down 2
+ printf '\033[2T'
+
+ # The cursor should not have moved and this should print on the
+ # last line, and not overprint 'line 24'
+ printf '\rBad line'
+ # Overprint on line 24
+ printf '\033[24;1HLast line'
+ # and line 1
+ printf '\033[HFirst line\n'
+
+}
+
+post()
+{
+ local capture
+ capture="$(basename "$0").d/baseline.capture"
+ # 'Bad line' should have been overwritten
+ if grep -q '^Bad line$' "$capture"; then
+ exit 1
+ fi
+ # The first four lines should have scrolled off
+ if grep -q '^text [1-4]$' "$capture"; then
+ exit 1
+ fi
+ # The last line should not have scrolled off or been overwritten
+ if ! grep -q '^text 24$' "$capture"; then
+ exit 1
+ fi
+ # 20 lines of the original text should remain
+ if [ "$(grep -c '^text' "$capture")" -ne 20 ]; then
+ exit 1
+ fi
+ exit 0
+}
+
+case $1 in
+ baseline)
+ baseline;;
+ post)
+ post;;
+ *)
+ fail "unknown test argument %s\n" "$1";;
+esac
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/emulation-wrap-across-frames.test
^
|
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+#
+# This is a regression test for a bug seen where mosh-server's
+# round-trip verification failed if text was filled to column 80 on
+# frame N and then wrapped to the next line on frame N+1, because the
+# wrap flag used to be in the Cell class and caused miscompares
+# between cells. It got moved to the Rows class where it makes more
+# sense.
+#
+
+# shellcheck source=e2e-test-subrs
+. "$(dirname "$0")/e2e-test-subrs"
+PATH=$PATH:.:$srcdir
+# Top-level wrapper.
+if [ $# -eq 0 ]; then
+ e2e-test "$0" baseline direct verify
+ exit
+fi
+
+# OK, we have arguments, we're one of the test hooks.
+if [ $# -ne 1 ]; then
+ fail "bad arguments %s\n" "$@"
+fi
+
+baseline()
+{
+ printf '\033[H\033[J'
+
+ for x in $(seq 1 10); do
+ printf "abcdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX1234"
+ sleepf
+ printf "ABCDxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5678"
+ sleepf
+ done
+ printf '\n'
+}
+
+case $1 in
+ baseline|direct)
+ baseline;;
+ *)
+ fail "unknown test argument %s\n" "$1";;
+esac
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/tests/encrypt-decrypt.cc
^
|
@@ -54,9 +54,9 @@
bool verbose = false;
-#define NONCE_FMT "%016"PRIx64
+#define NONCE_FMT "%016" PRIx64
-std::string random_payload( void ) {
+static std::string random_payload( void ) {
const size_t len = prng.uint32() % MESSAGE_SIZE_MAX;
char *buf = new char[len];
prng.fill( buf, len );
@@ -66,13 +66,13 @@
return payload;
}
-void test_bad_decrypt( Session &decryption_session ) {
+static void test_bad_decrypt( Session &decryption_session ) {
std::string bad_ct = random_payload();
bool got_exn = false;
try {
decryption_session.decrypt( bad_ct );
- } catch ( const CryptoException& e ) {
+ } catch ( const CryptoException &e ) {
got_exn = true;
/* The "bad decrypt" exception needs to be non-fatal, otherwise we are
@@ -87,7 +87,7 @@
}
/* Generate a single key and initial nonce, then perform some encryptions. */
-void test_one_session( void ) {
+static void test_one_session( void ) {
Base64Key key;
Session encryption_session( key );
Session decryption_session( key );
@@ -142,9 +142,9 @@
for ( size_t i=0; i<NUM_SESSIONS; i++ ) {
try {
test_one_session();
- } catch ( const CryptoException& e ) {
+ } catch ( const CryptoException &e ) {
fprintf( stderr, "Crypto exception: %s\r\n",
- e.text.c_str() );
+ e.what() );
fatal_assert( false );
}
}
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/genbase64.pl
^
|
@@ -0,0 +1,28 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use MIME::Base64;
+
+my @vectors = (
+ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
+ "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff",
+ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff",
+ "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00",
+ "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
+ "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\x55\x55\x55\x55\x55\x55\x55\x55",
+ "\x55\x55\x55\x55\x55\x55\x55\x55\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
+ "\x01\x02\x04\x08\x10\x20\x40\x80\xfe\xfd\xfb\xf7\xef\xdf\xbf\x7f",
+ );
+
+print 'base64_test_row static_base64_vector[] = {' . "\n";
+for my $v (@vectors) {
+ print ' { "';
+ my @chars = split '', $v;
+ for my $c (@chars) {
+ printf "\\x%02x", ord($c);
+ }
+ print '", "' . encode_base64($v, "") . '" },' . "\n";
+}
+print ' { "", "" }' . "\n";
+print "};\n";
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/hold-stdin
^
|
@@ -0,0 +1,21 @@
+#!/usr/bin/env perl
+
+#
+# The sole function of this script is to provide a stdin that doesn't
+# read data or return EOF to its children. If there's a clean,
+# portable, not-Perl way to do this, then that should replace this.
+#
+use warnings;
+use strict;
+
+my $pid = open(my $fh, "|-", @ARGV) or die;
+waitpid($pid, 0) == $pid or die;
+my $rc;
+if ($? == 0) {
+ $rc = 0;
+} elsif ($? >= 256) {
+ $rc = $? >> 8;
+} else {
+ $rc = ($? & 127) | 128;
+}
+exit $rc;
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/inpty.cc
^
|
@@ -0,0 +1,127 @@
+/*
+ Mosh: the mobile shell
+ Copyright 2012 Keith Winstein
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of portions of this program with the
+ OpenSSL library under certain conditions as described in each
+ individual source file, and distribute linked combinations including
+ the two.
+
+ You must obey the GNU General Public License in all respects for all
+ of the code used other than OpenSSL. If you modify file(s) with this
+ exception, you may extend this exception to your version of the
+ file(s), but you are not obligated to do so. If you do not wish to do
+ so, delete this exception statement from your version. If you delete
+ this exception statement from all source files in the program, then
+ also delete it here.
+*/
+
+#include "config.h"
+
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <errno.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <termios.h>
+#include <unistd.h>
+
+#if HAVE_PTY_H
+#include <pty.h>
+#elif HAVE_UTIL_H
+#include <util.h>
+#endif
+
+#if FORKPTY_IN_LIBUTIL
+#include <libutil.h>
+#endif
+
+#include "pty_compat.h"
+#include "swrite.h"
+
+int main( int argc, char *argv[] )
+{
+ if (argc < 2) {
+ fprintf( stderr, "usage: inpty COMMAND [ARGS...]\n" );
+ return 1;
+ }
+
+ struct winsize winsize;
+ memset( &winsize, 0, sizeof( winsize ) );
+ winsize.ws_col = 80;
+ winsize.ws_row = 24;
+
+ int saved_stderr = dup(STDERR_FILENO);
+ if ( saved_stderr < 0 ) {
+ perror( "dup" );
+ return 1;
+ }
+
+ int master;
+ pid_t child = forkpty( &master, NULL, NULL, &winsize );
+ if ( child == -1 ) {
+ perror( "forkpty" );
+ /* The Debian and Ubuntu build systems fail to set up a working
+ * /dev/ptmx (https://bugs.debian.org/817236). There is not much
+ * we can do about that except skip the test. In the future when
+ * this is fixed, we should turn this into an failure.
+ */
+ return 77;
+ } else if ( child == 0 ) {
+ if ( dup2( saved_stderr, STDERR_FILENO ) < 0 ) {
+ perror( "dup2" );
+ exit( 1 );
+ }
+ if ( close( saved_stderr ) < 0 ) {
+ perror( "close" );
+ exit( 1 );
+ }
+ if ( execvp( argv[1], argv + 1 ) < 0 ) {
+ perror( "execve" );
+ exit( 1 );
+ }
+ exit( 0 );
+ }
+
+ while ( 1 ) {
+ char buf[ 1024 ];
+ ssize_t bytes_read = read( master, buf, sizeof( buf ) );
+ if ( bytes_read == 0 || ( bytes_read < 0 && errno == EIO ) ) { /* EOF */
+ break;
+ } else if ( bytes_read < 0 ) {
+ perror( "read" );
+ return 1;
+ }
+ swrite( STDOUT_FILENO, buf, bytes_read );
+ }
+
+ int wstatus;
+ if ( waitpid( child, &wstatus, 0 ) < 0 ) {
+ perror( "waitpid" );
+ return 1;
+ }
+
+ if ( WIFSIGNALED( wstatus ) ) {
+ fprintf( stderr, "inpty: child exited with signal %d\n", WTERMSIG( wstatus ) );
+ raise( WTERMSIG( wstatus ) );
+ return -1;
+ } else {
+ return WIFEXITED( wstatus ) ? WEXITSTATUS( wstatus ) : -1;
+ }
+}
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/is-utf8-locale.cc
^
|
@@ -0,0 +1,45 @@
+/*
+ Mosh: the mobile shell
+ Copyright 2012 Keith Winstein
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of portions of this program with the
+ OpenSSL library under certain conditions as described in each
+ individual source file, and distribute linked combinations including
+ the two.
+
+ You must obey the GNU General Public License in all respects for all
+ of the code used other than OpenSSL. If you modify file(s) with this
+ exception, you may extend this exception to your version of the
+ file(s), but you are not obligated to do so. If you do not wish to do
+ so, delete this exception statement from your version. If you delete
+ this exception statement from all source files in the program, then
+ also delete it here.
+*/
+
+#include <stdio.h>
+
+#include "locale_utils.h"
+
+int main( int argc __attribute__(( unused )), char **argv __attribute__(( unused )))
+{
+ set_native_locale();
+ if ( !is_utf8_locale() ) {
+ fprintf( stderr, "not a UTF-8 locale\n" );
+ return 1;
+ }
+ return 0;
+}
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/local.test
^
|
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+. "$(dirname "$0")/e2e-test-subrs"
+if ! set_locale; then
+ echo "$0: no usable locale" >&2
+ exit 99
+fi
+
+set -eu
+out=$(
+ TERM=xterm \
+ ./inpty \
+ ../../scripts/mosh \
+ --client="../frontend/mosh-client" \
+ --server="$PWD/../frontend/mosh-server" \
+ --local --bind-server=127.0.0.1 127.0.0.1 \
+ -- printf 'he%s\n' llo)
+case "$out" in
+ *hello*) exit 0;;
+ *) exit 1;;
+esac
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/mosh-client
^
|
@@ -0,0 +1,326 @@
+#!/bin/sh
+
+. "$(dirname "$0")/e2e-test-subrs"
+
+#
+# Validate that mosh produces expected output, using screen captures
+# in tmux.
+#
+
+log()
+{
+ printf "$@"
+}
+
+error()
+{
+ printf "$@" >&2
+}
+
+dump_logs()
+{
+ dir=$1
+ shift
+ testname=$(basename "$dir" .d)
+ for logfile in $dir/*.tmux.log; do
+ printf "travis_fold:start:%s-%s\n" "$testname" "$(basename "$logfile")"
+ cat "$logfile"
+ printf "travis_fold:end:%s-%s\n" "$testname" "$(basename "$logfile")"
+ done
+}
+
+test_success()
+{
+ exit 0
+}
+test_failure()
+{
+ error "$@"
+ exit 1
+}
+test_skipped()
+{
+ error "$@"
+ exit 77
+}
+test_error()
+{
+ error "$@"
+ exit 99
+}
+test_exitstatus()
+{
+ status=$1
+ shift
+ error "$@"
+ exit "$status"
+}
+
+
+# Tmux check.
+tmux_check()
+{
+ # OpenBSD tmux does not have '-V'.
+ if [ "$(uname -s)" = "OpenBSD" ]; then
+ openbsd_major="$(uname -r)"
+ openbsd_major="${openbsd_major%%.*}"
+ if [ "${openbsd_major}" -ge 6 ]; then
+ return 0
+ fi
+ fi
+ version=$(tmux -V)
+ if [ $? != 0 ]; then
+ error "tmux unavailable\n"
+ return 1
+ fi
+ if [ "$version" = "tmux master" ]; then
+ return 0
+ fi
+ version=${version##tmux }
+ version_major=${version%%.*}
+ version_minor=${version##*.}
+ # need version 1.8 for capture-pane
+ if [ "$version_major" -lt 1 ] ||
+ { [ "$version_major" -eq 1 ] && [ "$version_minor" -lt 8 ]; }; then
+ error "tmux version %s too old\n" "$version"
+ return 1
+ fi
+ # Finally, check that tmux actually works to some degree.
+ tmux -C new-session true
+}
+
+ssh_localhost_check()
+{
+ ssh localhost :
+ if [ $? -ne 0 ]; then
+ error "ssh to localhost failed\n"
+ return 1
+ fi
+ return 0
+}
+
+# These two functions are wrappers for mosh-client/mosh-server to turn
+# on verbosity and log stderr.
+mosh_client()
+{
+ if [ -z "$MOSH_CLIENT" ] || [ -z "$MOSH_E2E_TEST" ]; then
+ test_error "mosh_client: variables missing\n"
+ fi
+ exec 2> "${MOSH_E2E_TEST}.client.stderr"
+ exec "$MOSH_CLIENT" $MOSH_CLIENT_ARGS "$@"
+}
+
+mosh_server()
+{
+ if [ -z "$MOSH_SERVER" ] || [ -z "$MOSH_E2E_TEST" ]; then
+ test_error "mosh_server: variables missing\n"
+ fi
+ exec 2> "${MOSH_E2E_TEST}.server.stderr"
+ exec "$MOSH_SERVER" new -vv $MOSH_SERVER_ARGS -@ "$@"
+}
+
+# main
+# Set up environment
+if [ -z "$srcdir" ]; then
+ export srcdir=$PWD
+else
+ srcdir="$(cd "$srcdir" && pwd)"
+ if [ $? -ne 0 ]; then
+ error "can't cd to srcdir: %s\n" "$srcdir"
+ exit 99
+ fi
+fi
+
+# Wrappers.
+case "$(basename "$0")" in
+ mosh-client)
+ mosh_client "$@"
+ exit
+ ;;
+ mosh-server)
+ mosh_server "$@"
+ exit
+ ;;
+ *)
+ ;;
+esac
+
+if [ $# -lt 2 ]; then
+ test_error "not enough args\n"
+fi
+
+# Get arguments (only one so far)
+test_name=$1
+shift
+test_args=$@
+# XXX could use AM testsubdir macro instead
+test_dir=$(basename "${test_name}").d
+test_script="${test_name}"
+
+tests_dir=$(dirname "${test_name}")
+if ! set_locale "${tests_dir}"; then
+ test_error "e2e-test: no usable locale\n"
+fi
+
+if ! tmux_check; then
+ test_skipped "tmux unavailable\n"
+fi
+
+rm -rf "${test_dir}"
+mkdir "${test_dir}"
+
+
+on_exit() {
+ rv=$?
+ if test $rv -ne 0; then
+ dump_logs "$test_dir" $test_args
+ fi
+ exit $rv
+}
+trap on_exit EXIT
+
+# Set up tests to run.
+server_tests=
+compare_tests=
+for i in $test_args; do
+ case $i in
+ baseline|direct|variant)
+ server_tests="$server_tests $i";;
+ verify|same|different)
+ compare_tests="$compare_tests $i";;
+ tmux)
+ tmux=1;;
+ client)
+ client=1;;
+ server)
+ server=1;;
+ post)
+ post=1;;
+ mosh-args)
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/mosh-server
^
|
@@ -0,0 +1,326 @@
+#!/bin/sh
+
+. "$(dirname "$0")/e2e-test-subrs"
+
+#
+# Validate that mosh produces expected output, using screen captures
+# in tmux.
+#
+
+log()
+{
+ printf "$@"
+}
+
+error()
+{
+ printf "$@" >&2
+}
+
+dump_logs()
+{
+ dir=$1
+ shift
+ testname=$(basename "$dir" .d)
+ for logfile in $dir/*.tmux.log; do
+ printf "travis_fold:start:%s-%s\n" "$testname" "$(basename "$logfile")"
+ cat "$logfile"
+ printf "travis_fold:end:%s-%s\n" "$testname" "$(basename "$logfile")"
+ done
+}
+
+test_success()
+{
+ exit 0
+}
+test_failure()
+{
+ error "$@"
+ exit 1
+}
+test_skipped()
+{
+ error "$@"
+ exit 77
+}
+test_error()
+{
+ error "$@"
+ exit 99
+}
+test_exitstatus()
+{
+ status=$1
+ shift
+ error "$@"
+ exit "$status"
+}
+
+
+# Tmux check.
+tmux_check()
+{
+ # OpenBSD tmux does not have '-V'.
+ if [ "$(uname -s)" = "OpenBSD" ]; then
+ openbsd_major="$(uname -r)"
+ openbsd_major="${openbsd_major%%.*}"
+ if [ "${openbsd_major}" -ge 6 ]; then
+ return 0
+ fi
+ fi
+ version=$(tmux -V)
+ if [ $? != 0 ]; then
+ error "tmux unavailable\n"
+ return 1
+ fi
+ if [ "$version" = "tmux master" ]; then
+ return 0
+ fi
+ version=${version##tmux }
+ version_major=${version%%.*}
+ version_minor=${version##*.}
+ # need version 1.8 for capture-pane
+ if [ "$version_major" -lt 1 ] ||
+ { [ "$version_major" -eq 1 ] && [ "$version_minor" -lt 8 ]; }; then
+ error "tmux version %s too old\n" "$version"
+ return 1
+ fi
+ # Finally, check that tmux actually works to some degree.
+ tmux -C new-session true
+}
+
+ssh_localhost_check()
+{
+ ssh localhost :
+ if [ $? -ne 0 ]; then
+ error "ssh to localhost failed\n"
+ return 1
+ fi
+ return 0
+}
+
+# These two functions are wrappers for mosh-client/mosh-server to turn
+# on verbosity and log stderr.
+mosh_client()
+{
+ if [ -z "$MOSH_CLIENT" ] || [ -z "$MOSH_E2E_TEST" ]; then
+ test_error "mosh_client: variables missing\n"
+ fi
+ exec 2> "${MOSH_E2E_TEST}.client.stderr"
+ exec "$MOSH_CLIENT" $MOSH_CLIENT_ARGS "$@"
+}
+
+mosh_server()
+{
+ if [ -z "$MOSH_SERVER" ] || [ -z "$MOSH_E2E_TEST" ]; then
+ test_error "mosh_server: variables missing\n"
+ fi
+ exec 2> "${MOSH_E2E_TEST}.server.stderr"
+ exec "$MOSH_SERVER" new -vv $MOSH_SERVER_ARGS -@ "$@"
+}
+
+# main
+# Set up environment
+if [ -z "$srcdir" ]; then
+ export srcdir=$PWD
+else
+ srcdir="$(cd "$srcdir" && pwd)"
+ if [ $? -ne 0 ]; then
+ error "can't cd to srcdir: %s\n" "$srcdir"
+ exit 99
+ fi
+fi
+
+# Wrappers.
+case "$(basename "$0")" in
+ mosh-client)
+ mosh_client "$@"
+ exit
+ ;;
+ mosh-server)
+ mosh_server "$@"
+ exit
+ ;;
+ *)
+ ;;
+esac
+
+if [ $# -lt 2 ]; then
+ test_error "not enough args\n"
+fi
+
+# Get arguments (only one so far)
+test_name=$1
+shift
+test_args=$@
+# XXX could use AM testsubdir macro instead
+test_dir=$(basename "${test_name}").d
+test_script="${test_name}"
+
+tests_dir=$(dirname "${test_name}")
+if ! set_locale "${tests_dir}"; then
+ test_error "e2e-test: no usable locale\n"
+fi
+
+if ! tmux_check; then
+ test_skipped "tmux unavailable\n"
+fi
+
+rm -rf "${test_dir}"
+mkdir "${test_dir}"
+
+
+on_exit() {
+ rv=$?
+ if test $rv -ne 0; then
+ dump_logs "$test_dir" $test_args
+ fi
+ exit $rv
+}
+trap on_exit EXIT
+
+# Set up tests to run.
+server_tests=
+compare_tests=
+for i in $test_args; do
+ case $i in
+ baseline|direct|variant)
+ server_tests="$server_tests $i";;
+ verify|same|different)
+ compare_tests="$compare_tests $i";;
+ tmux)
+ tmux=1;;
+ client)
+ client=1;;
+ server)
+ server=1;;
+ post)
+ post=1;;
+ mosh-args)
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/network-no-diff.test
^
|
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+#
+# This is a regression test to ensure that Mosh does not spin
+# on updates that do not actually change the framebuffer.
+#
+
+# shellcheck source=e2e-test-subrs
+. "$(dirname "$0")/e2e-test-subrs"
+PATH=$PATH:.:$srcdir
+# Top-level wrapper.
+if [ $# -eq 0 ]; then
+ e2e-test "$0" baseline post
+ exit
+fi
+
+# OK, we have arguments, we're one of the test hooks.
+if [ $# -ne 1 ]; then
+ fail "bad arguments %s\n" "$@"
+fi
+
+baseline()
+{
+ # Generate updates that don't change the screen
+ i=0
+ while [ $i -lt 10 ] && printf 'x\b' && sleep 1; do
+ i=$((i + 1))
+ done
+}
+
+post()
+{
+ # Extract server run time.
+ runtime=$(sed -E -n 's/.*@@@ runtime: (.*) @@@.*/\1/p' "$(basename "$0").d/baseline.tmux.log")
+
+ # If this system can't actually report runtime, bail.
+ if [ -z "$runtime" ] || [ "$runtime" -eq "-" ]; then
+ exit 0
+ fi
+
+ # If we ran for more than one second, fail.
+ seconds=${runtime##*:}
+ bigger=${runtime%:*}
+ onesec=$(echo "$seconds >= 1" | bc)
+ if [ "$onesec" -eq 1 ] || [ "$bigger" -ne 0 ]; then
+ exit 1
+ fi
+ exit 0
+}
+
+case $1 in
+ baseline)
+ baseline;;
+ post)
+ post;;
+ *)
+ fail "unknown test argument %s\n" "$1";;
+esac
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/nonce-incr.cc
^
|
@@ -0,0 +1,73 @@
+/*
+ Mosh: the mobile shell
+ Copyright 2012 Keith Winstein
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of portions of this program with the
+ OpenSSL library under certain conditions as described in each
+ individual source file, and distribute linked combinations including
+ the two.
+
+ You must obey the GNU General Public License in all respects for all
+ of the code used other than OpenSSL. If you modify file(s) with this
+ exception, you may extend this exception to your version of the
+ file(s), but you are not obligated to do so. If you do not wish to do
+ so, delete this exception statement from your version. If you delete
+ this exception statement from all source files in the program, then
+ also delete it here.
+*/
+
+/* Tests that the Mosh network layer seems to be using unique nonces */
+
+#include <iostream>
+#include <cstdlib>
+#include <set>
+
+#include "network.h"
+
+int main()
+{
+ std::set<uint64_t> nonces;
+ const unsigned int NUM_EXAMPLES = 1000000;
+
+ for ( unsigned int i = 0; i < NUM_EXAMPLES; i++ ) {
+ Network::Packet packet( Network::TO_CLIENT, 0, 0, "test" );
+ nonces.insert( packet.toMessage().nonce.val() );
+ }
+
+ for ( unsigned int i = 0; i < NUM_EXAMPLES; i++ ) {
+ Network::Packet packet( Network::TO_SERVER, 0, 0, "test" );
+ nonces.insert( packet.toMessage().nonce.val() );
+ }
+
+ for ( unsigned int i = 0; i < NUM_EXAMPLES; i++ ) {
+ {
+ Network::Packet packet( Network::TO_SERVER, 0, 0, "test" );
+ nonces.insert( packet.toMessage().nonce.val() );
+ }
+
+ {
+ Network::Packet packet( Network::TO_CLIENT, 0, 0, "test" );
+ nonces.insert( packet.toMessage().nonce.val() );
+ }
+ }
+
+ if ( nonces.size() == 4 * NUM_EXAMPLES ) {
+ return EXIT_SUCCESS;
+ }
+
+ return EXIT_FAILURE;
+}
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/tests/ocb-aes.cc
^
|
@@ -55,26 +55,26 @@
bool verbose = false;
-bool equal( const AlignedBuffer &a, const AlignedBuffer &b ) {
+static bool equal( const AlignedBuffer &a, const AlignedBuffer &b ) {
return ( a.len() == b.len() )
&& !memcmp( a.data(), b.data(), a.len() );
}
-AlignedBuffer *get_ctx( const AlignedBuffer &key ) {
+static AlignedBuffer *get_ctx( const AlignedBuffer &key ) {
AlignedBuffer *ctx_buf = new AlignedBuffer( ae_ctx_sizeof() );
fatal_assert( ctx_buf );
fatal_assert( AE_SUCCESS == ae_init( (ae_ctx *)ctx_buf->data(), key.data(), key.len(), NONCE_LEN, TAG_LEN ) );
return ctx_buf;
}
-void scrap_ctx( AlignedBuffer *ctx_buf ) {
+static void scrap_ctx( AlignedBuffer *ctx_buf ) {
fatal_assert( AE_SUCCESS == ae_clear( (ae_ctx *)ctx_buf->data() ) );
delete ctx_buf;
}
-void test_encrypt( const AlignedBuffer &key, const AlignedBuffer &nonce,
- const AlignedBuffer &plaintext, const AlignedBuffer &assoc,
- const AlignedBuffer &expected_ciphertext ) {
+static void test_encrypt( const AlignedBuffer &key, const AlignedBuffer &nonce,
+ const AlignedBuffer &plaintext, const AlignedBuffer &assoc,
+ const AlignedBuffer &expected_ciphertext ) {
AlignedBuffer *ctx_buf = get_ctx( key );
ae_ctx *ctx = (ae_ctx *)ctx_buf->data();
@@ -97,10 +97,10 @@
scrap_ctx( ctx_buf );
}
-void test_decrypt( const AlignedBuffer &key, const AlignedBuffer &nonce,
- const AlignedBuffer &ciphertext, const AlignedBuffer &assoc,
- const AlignedBuffer &expected_plaintext,
- bool valid ) {
+static void test_decrypt( const AlignedBuffer &key, const AlignedBuffer &nonce,
+ const AlignedBuffer &ciphertext, const AlignedBuffer &assoc,
+ const AlignedBuffer &expected_plaintext,
+ bool valid ) {
AlignedBuffer *ctx_buf = get_ctx( key );
ae_ctx *ctx = (ae_ctx *)ctx_buf->data();
@@ -129,10 +129,10 @@
scrap_ctx( ctx_buf );
}
-void test_vector( const char *key_p, const char *nonce_p,
- size_t assoc_len, const char *assoc_p,
- size_t plaintext_len, const char *plaintext_p,
- size_t ciphertext_len, const char *ciphertext_p ) {
+static void test_vector( const char *key_p, const char *nonce_p,
+ size_t assoc_len, const char *assoc_p,
+ size_t plaintext_len, const char *plaintext_p,
+ size_t ciphertext_len, const char *ciphertext_p ) {
AlignedBuffer key ( KEY_LEN, key_p );
AlignedBuffer nonce ( NONCE_LEN, nonce_p );
@@ -172,7 +172,7 @@
#define TEST_VECTOR( _key, _nonce, _assoc, _pt, _ct ) \
test_vector( _key, _nonce, sizeof(_assoc)-1, _assoc, sizeof(_pt)-1, _pt, sizeof(_ct)-1, _ct )
-void test_all_vectors( void ) {
+static void test_all_vectors( void ) {
/* Test vectors from http://tools.ietf.org/html/draft-krovetz-ocb-03#appendix-A */
const char ietf_key[] = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F";
@@ -463,7 +463,7 @@
/* http://tools.ietf.org/html/draft-krovetz-ocb-03#appendix-A
also specifies an iterative test algorithm, which we implement here. */
-void test_iterative( void ) {
+static void test_iterative( void ) {
/* Key is always all zeros */
AlignedBuffer key( KEY_LEN );
memset( key.data(), 0, KEY_LEN );
@@ -544,8 +544,12 @@
verbose = true;
}
- test_all_vectors();
- test_iterative();
-
+ try {
+ test_all_vectors();
+ test_iterative();
+ } catch ( const std::exception &e ) {
+ fprintf( stderr, "Error: %s\r\n", e.what() );
+ return 1;
+ }
return 0;
}
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/prediction-unicode.test
^
|
@@ -0,0 +1,97 @@
+#!/bin/sh
+
+#
+# This is a regression test for a bug seen where mosh-client's
+# prediction code would sometimes show "gück" when "glück" was typed.
+# mosh-client would output a predicted Unicode input character
+# first as an 8-bit character containing the lowest 8 bits of the
+# Unicode code point, then redraw it correctly with its UTF-8 sequence
+# when the prediction is validated. For many accented Latin
+# characters, the 8-bit character is an illegal UTF-8 code sequence.
+# Most terminal emulators will output the Unicode replacement
+# character, which is only visible until validation. urxvt, however,
+# draws no character and does not change the cursor location on an
+# illegal UTF-8 sequence, causing this bug to be visible as ongoing
+# display corruption. A subset of wide characters (including CJK)
+# will show display corruption with all terminal emulators, because a
+# narrow replacement character will be drawn when a wide character
+# should have been.
+#
+# tmux draws a replacement character for invalid UTF-8, and we
+# depend on that in this test.
+#
+# Another similar failing case is typing "faĩl". In this case the "ĩ"
+# would be predicted as ")" before being replaced by the
+# correct character.
+#
+
+# shellcheck source=e2e-test-subrs
+. "$(dirname "$0")/e2e-test-subrs"
+PATH=$PATH:.:$srcdir
+# Top-level wrapper.
+if [ $# -eq 0 ]; then
+ e2e-test "$0" tmux baseline mosh-args post
+ exit
+fi
+
+tmux_commands()
+{
+ for x in $(seq 1 5); do
+ for y in $(seq 1 5); do
+ for i in "gl" ü "ck fa" ĩ "l "; do
+ printf "send-keys '%s'\n" "$i"
+ sleepf
+ done
+ done
+ printf "send-keys 0x0d\n"
+ done
+ printf "send-keys 0x0d\n"
+ sleep 1
+ printf "send-keys 0x04\n"
+ # Unreliable on Cygwin under load, it seems.
+ sleep 1
+ printf "send-keys 0x04\n"
+ # This will get killed by SIGPIPE.
+ while printf "show-options\n" && sleep 1; do
+ :
+ done
+}
+
+tmux_stdin()
+{
+ tmux_commands | "$@"
+ exit
+}
+
+baseline()
+{
+ # Just receive and toss input in canonical mode.
+ cat > /dev/null
+}
+
+post()
+{
+ # Look for bad output: ')' or \374
+ (
+ unset LC_ALL
+ unset LC_CTYPE
+ unset LANGUAGE
+ ! env LANG=C egrep -q "%output %0 (\)|$(printf \\374))" "$(basename "$0").d/baseline.tmux.log"
+ # Implicit exitcode return.
+ )
+ return $?
+}
+
+case $1 in
+ tmux)
+ shift;
+ tmux_stdin "$@";;
+ baseline)
+ baseline;;
+ mosh-args)
+ printf "%s\n" "--predict=always";;
+ post)
+ post;;
+ *)
+ fail "unknown test argument %s\n" "$1";;
+esac
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/print-exitstatus
^
|
@@ -0,0 +1,33 @@
+#!/usr/bin/env perl
+
+#
+# Print exitstatus on stderr.
+#
+use warnings;
+use strict;
+
+my $rc = system(@ARGV);
+if ($? == -1) {
+ die "system failed: %!\n";
+}
+if ($? == 0) {
+ $rc = 0;
+} elsif ($? >= 256) {
+ $rc = $? >> 8;
+} else {
+ $rc = ($? & 127) | 128;
+}
+print STDERR "@@@ exitstatus: ${rc} @@@\n";
+# Now look for it in log file.
+my $grepfilename = $ENV{'MOSH_E2E_TEST'} . ".tmux.log";
+for my $i (1..600) {
+ open(my $grepfile, "<", $grepfilename) or die;
+ while (<$grepfile>) {
+ chomp;
+ /@@@ exitstatus: .* @@@/ && goto gotit;
+ }
+ close($grepfile);
+ sleep .1;
+}
+ gotit:
+exit $rc;
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/pty-deadlock.test
^
|
@@ -0,0 +1,94 @@
+#!/bin/sh
+
+#
+# This is a regression test for a BSD pty bug in Mosh. On
+# FreeBSD/OpenBSD/OS X, a pty master can block on read() after
+# select() has informed us that there is data available, if a ^S is
+# written to the pty master between the select() and the read().
+#
+# Unfortunately, everything attached to the pty gets stuck when this
+# happens. If this tests fails, you will need to do some manual
+# cleanup with kill -9.
+#
+
+# shellcheck source=e2e-test-subrs
+. "$(dirname "$0")/e2e-test-subrs"
+PATH=$PATH:.:$srcdir
+# Top-level wrapper.
+if [ $# -eq 0 ]; then
+ e2e-test "$0" tmux baseline post
+ exit
+fi
+
+tmux_commands()
+{
+ # An interactive shell is waiting for us in the mosh session.
+ # Start test...
+ sleep 2
+ printf "send-keys 0x0d\n"
+ sleep 5
+ # Stop output...
+ printf "send-keys 0x13\n"
+ sleep 10
+ # Restart output...
+ printf "send-keys 0x11\n"
+ sleep 10
+ # And stop the test script, so it produces its exit messge.
+ printf "send-keys 0x0d\n"
+ # This will get killed by SIGPIPE.
+ while printf "show-options\n" && sleep 1; do
+ :
+ done
+}
+
+tmux_stdin()
+{
+ tmux_commands | "$@"
+ exit
+}
+
+baseline()
+{
+ # Make a lot of noise on stdout to keep mosh busy, and exit
+ # with a distinctive message when we get a CR. Exit after 10s in any case.
+ blat=$(for i in $(seq 1 100); do
+ printf 'a\nb\nc\nd\ne\nf\ng\nh\ni\nj\nk\nl\nm\nn\no\np\nq\nr\ns\nt\nu\nv\nw\nx\ny\nz\n'
+ done)
+ read -r x
+ while printf '%s' "$blat"; do
+ :
+ done &
+ printpid=$!
+ (sleep 120; kill $$ $printpid) &
+ killpid=$!
+ read -r x
+ kill $printpid
+ # Try and make sure the printer stops writing before the following printf
+ sleep 1
+ printf "\n=== normal exit ===\n"
+ # Let tty queues drain, so the exit message gets to mosh-client
+ # before we exit
+ sleep 4
+ # Kill the killer and exit normally.
+ kill $killpid
+}
+
+post()
+{
+ if grep -q '=== normal exit ===' "$(basename "$0").d/baseline.capture"; then
+ exit 0
+ fi
+ exit 1
+}
+
+case $1 in
+ tmux)
+ shift;
+ tmux_stdin "$@";;
+ baseline)
+ baseline;;
+ post)
+ post;;
+ *)
+ fail "unknown test argument %s\n" "$1";;
+esac
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/repeat-with-input.test
^
|
@@ -0,0 +1,91 @@
+#!/bin/sh
+
+#
+# Run mosh many times. If run as repeat-with-stdin.test, also send
+# input constantly, to try and trigger a bug where mosh-server would
+# exit on OS X if input was received after the client session had
+# exited.
+#
+
+# 100 iterations runs in comparable time to other tests.
+: ${REPEAT_TEST_LOOPCOUNT:=100}
+
+# shellcheck source=e2e-test-subrs
+. "$(dirname "$0")/e2e-test-subrs"
+PATH=$PATH:.:$srcdir
+
+# Top-level wrapper.
+if [ $# -eq 0 ]; then
+ do_tmux=
+ case $(basename "$0" .test) in
+ repeat-with-input)
+ do_tmux=tmux;;
+ esac
+ e2e-test "$0" baseline client server ${do_tmux}
+ exit
+fi
+
+# Run mosh repeatedly
+client()
+{
+ for i in $(seq 1 $REPEAT_TEST_LOOPCOUNT); do
+ (sleep 15; kill $$) &
+ killpid=$!
+ if ! "$@"; then
+ printf "### iteration %d failed\n" "$i"
+ kill $killpid
+ exit 1
+ fi
+ kill $killpid
+ done
+}
+
+# e2e-test-server is slow because of its screen capture; this simple
+# wrapper is faster.
+server()
+{
+ shift
+ eval "$@"
+}
+
+# Constantly send keyboard input.
+tmux_commands()
+{
+ while printf "send-keys 0x0d\n" && sleepf; do
+ :
+ done
+}
+
+tmux_stdin()
+{
+ tmux_commands | "$@"
+ exit
+}
+
+baseline()
+{
+ printf "@@@ done\n"
+}
+
+post()
+{
+ if [ "$(grep -c "@@@ done" "$(basename "$0").d/baseline.tmux.log")" -lt $REPEAT_TEST_LOOPCOUNT ]; then
+ exit 1
+ fi
+}
+
+case $1 in
+ tmux)
+ shift;
+ tmux_stdin "$@";;
+ baseline)
+ baseline;;
+ client)
+ shift
+ client "$@";;
+ server)
+ shift
+ server "$@";;
+ *)
+ fail "unknown test argument %s\n" "$1";;
+esac
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/repeat.test
^
|
@@ -0,0 +1,91 @@
+#!/bin/sh
+
+#
+# Run mosh many times. If run as repeat-with-stdin.test, also send
+# input constantly, to try and trigger a bug where mosh-server would
+# exit on OS X if input was received after the client session had
+# exited.
+#
+
+# 100 iterations runs in comparable time to other tests.
+: ${REPEAT_TEST_LOOPCOUNT:=100}
+
+# shellcheck source=e2e-test-subrs
+. "$(dirname "$0")/e2e-test-subrs"
+PATH=$PATH:.:$srcdir
+
+# Top-level wrapper.
+if [ $# -eq 0 ]; then
+ do_tmux=
+ case $(basename "$0" .test) in
+ repeat-with-input)
+ do_tmux=tmux;;
+ esac
+ e2e-test "$0" baseline client server ${do_tmux}
+ exit
+fi
+
+# Run mosh repeatedly
+client()
+{
+ for i in $(seq 1 $REPEAT_TEST_LOOPCOUNT); do
+ (sleep 15; kill $$) &
+ killpid=$!
+ if ! "$@"; then
+ printf "### iteration %d failed\n" "$i"
+ kill $killpid
+ exit 1
+ fi
+ kill $killpid
+ done
+}
+
+# e2e-test-server is slow because of its screen capture; this simple
+# wrapper is faster.
+server()
+{
+ shift
+ eval "$@"
+}
+
+# Constantly send keyboard input.
+tmux_commands()
+{
+ while printf "send-keys 0x0d\n" && sleepf; do
+ :
+ done
+}
+
+tmux_stdin()
+{
+ tmux_commands | "$@"
+ exit
+}
+
+baseline()
+{
+ printf "@@@ done\n"
+}
+
+post()
+{
+ if [ "$(grep -c "@@@ done" "$(basename "$0").d/baseline.tmux.log")" -lt $REPEAT_TEST_LOOPCOUNT ]; then
+ exit 1
+ fi
+}
+
+case $1 in
+ tmux)
+ shift;
+ tmux_stdin "$@";;
+ baseline)
+ baseline;;
+ client)
+ shift
+ client "$@";;
+ server)
+ shift
+ server "$@";;
+ *)
+ fail "unknown test argument %s\n" "$1";;
+esac
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/server-network-timeout.test
^
|
@@ -0,0 +1,114 @@
+#!/bin/sh
+
+#
+# This test checks for operation of the MOSH_SERVER_NETWORK_TMOUT variable.
+# It does this by
+# * setting the variable
+# * killing the client (and its network traffic)
+# * waiting server-side, for the server to die
+# If it is killed, the test is successful.
+# If it survives that long and the server is still around, the test fails.
+# The client waits a bit longer than the server so that status can be collected
+# properly.
+#
+
+TIMEOUT=10
+
+# shellcheck source=e2e-test-subrs
+. "$(dirname "$0")/e2e-test-subrs"
+PATH=$PATH:.:$srcdir
+# Top-level wrapper.
+if [ $# -eq 0 ]; then
+ e2e-test "$0" client baseline
+ exit
+fi
+
+# OK, we have arguments, we're one of the test hooks.
+
+client()
+{
+ case "$myname" in
+ server-network-timeout)
+ export MOSH_SERVER_NETWORK_TMOUT=$TIMEOUT;;
+ server-signal-timeout)
+ export MOSH_SERVER_SIGNAL_TMOUT=$TIMEOUT;;
+ *)
+ fail "unexpected test name %s\n" "$myname"
+ esac
+ shift
+ # Print this early, because the server is expected to die before
+ # the normal time this is sent by e2e-test-server.
+ printf "@@@ server complete @@@\n" >&2
+ # Run mosh SUT.
+ eval "$@"
+ # The client may be murdered. We need to expect that...
+ retval=$?
+ case $retval in
+ 0|1)
+ fail "mosh-client had a normal exit\n";; # test condition failed
+ 9|137|265)
+ # Aha, signal 9. Wait.
+ sleep $(( TIMEOUT + 12 ))
+ exit 0
+ ;;
+ *)
+ fail "unknown client wrapper failure, retval=%d\n" $retval
+ ;;
+ esac
+ fail "client wrapper shouldnt get here\n"
+}
+baseline()
+{
+ # check for our wonderful variable
+ if [ -z "$MOSH_SERVER_NETWORK_TMOUT" ] && [ -z "$MOSH_SERVER_SIGNAL_TMOUT" ]; then
+ env
+ fail "Variable unset\n"
+ fi
+ # check for our client
+ if [ -z "$MOSH_CLIENT_PID" ]; then
+ env
+ fail "Client pid unavailable\n"
+ fi
+ if ! kill -0 "$MOSH_CLIENT_PID"; then
+ fail "mosh client is unexpectedly missing\n"
+ fi
+
+ # Set up for good return and cleanup on being killed
+ trap "echo got killed >&2; sleep 1; exit 0" HUP TERM
+ sleep 1
+
+ # Kill the client, to stop network traffic.
+ kill -KILL "$MOSH_CLIENT_PID"
+ case "$myname" in
+ server-network-timeout)
+ # Just wait. This is the hardest part.
+ sleep $(( TIMEOUT + 7 ))
+ ;;
+ server-signal-timeout)
+ # Wait for the timeout to expire.
+ sleep $(( TIMEOUT + 2 ))
+ # Tell the server to go away.
+ kill -USR1 "$MOSH_SERVER_PID"
+ sleep 5
+ ;;
+ *)
+ fail "unexpected test name %s\n" "$myname"
+ esac
+ # If we're still alive and the server is too, the test failed.
+ # XXX the server is getting killed and we're getting here anyway.
+ # Exit with error only if server is still around.
+ sleep 1
+ ! kill -0 "$MOSH_SERVER_PID"
+ exit
+}
+
+myname="$(basename "$0" .test)"
+
+case $1 in
+ baseline|variant)
+ baseline;;
+ client)
+ client "$@";;
+ *)
+ fail "unknown test argument %s\n" "$1";;
+esac
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/server-signal-timeout.test
^
|
@@ -0,0 +1,114 @@
+#!/bin/sh
+
+#
+# This test checks for operation of the MOSH_SERVER_NETWORK_TMOUT variable.
+# It does this by
+# * setting the variable
+# * killing the client (and its network traffic)
+# * waiting server-side, for the server to die
+# If it is killed, the test is successful.
+# If it survives that long and the server is still around, the test fails.
+# The client waits a bit longer than the server so that status can be collected
+# properly.
+#
+
+TIMEOUT=10
+
+# shellcheck source=e2e-test-subrs
+. "$(dirname "$0")/e2e-test-subrs"
+PATH=$PATH:.:$srcdir
+# Top-level wrapper.
+if [ $# -eq 0 ]; then
+ e2e-test "$0" client baseline
+ exit
+fi
+
+# OK, we have arguments, we're one of the test hooks.
+
+client()
+{
+ case "$myname" in
+ server-network-timeout)
+ export MOSH_SERVER_NETWORK_TMOUT=$TIMEOUT;;
+ server-signal-timeout)
+ export MOSH_SERVER_SIGNAL_TMOUT=$TIMEOUT;;
+ *)
+ fail "unexpected test name %s\n" "$myname"
+ esac
+ shift
+ # Print this early, because the server is expected to die before
+ # the normal time this is sent by e2e-test-server.
+ printf "@@@ server complete @@@\n" >&2
+ # Run mosh SUT.
+ eval "$@"
+ # The client may be murdered. We need to expect that...
+ retval=$?
+ case $retval in
+ 0|1)
+ fail "mosh-client had a normal exit\n";; # test condition failed
+ 9|137|265)
+ # Aha, signal 9. Wait.
+ sleep $(( TIMEOUT + 12 ))
+ exit 0
+ ;;
+ *)
+ fail "unknown client wrapper failure, retval=%d\n" $retval
+ ;;
+ esac
+ fail "client wrapper shouldnt get here\n"
+}
+baseline()
+{
+ # check for our wonderful variable
+ if [ -z "$MOSH_SERVER_NETWORK_TMOUT" ] && [ -z "$MOSH_SERVER_SIGNAL_TMOUT" ]; then
+ env
+ fail "Variable unset\n"
+ fi
+ # check for our client
+ if [ -z "$MOSH_CLIENT_PID" ]; then
+ env
+ fail "Client pid unavailable\n"
+ fi
+ if ! kill -0 "$MOSH_CLIENT_PID"; then
+ fail "mosh client is unexpectedly missing\n"
+ fi
+
+ # Set up for good return and cleanup on being killed
+ trap "echo got killed >&2; sleep 1; exit 0" HUP TERM
+ sleep 1
+
+ # Kill the client, to stop network traffic.
+ kill -KILL "$MOSH_CLIENT_PID"
+ case "$myname" in
+ server-network-timeout)
+ # Just wait. This is the hardest part.
+ sleep $(( TIMEOUT + 7 ))
+ ;;
+ server-signal-timeout)
+ # Wait for the timeout to expire.
+ sleep $(( TIMEOUT + 2 ))
+ # Tell the server to go away.
+ kill -USR1 "$MOSH_SERVER_PID"
+ sleep 5
+ ;;
+ *)
+ fail "unexpected test name %s\n" "$myname"
+ esac
+ # If we're still alive and the server is too, the test failed.
+ # XXX the server is getting killed and we're getting here anyway.
+ # Exit with error only if server is still around.
+ sleep 1
+ ! kill -0 "$MOSH_SERVER_PID"
+ exit
+}
+
+myname="$(basename "$0" .test)"
+
+case $1 in
+ baseline|variant)
+ baseline;;
+ client)
+ client "$@";;
+ *)
+ fail "unknown test argument %s\n" "$1";;
+esac
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/unicode-combine-fallback-assert.test
^
|
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+#
+# This test is for Github issue 667
+# https://github.com/mobile-shell/mosh/issues/667
+# where mosh will assert when a combining character is printed on a
+# just-cleared cell.
+#
+# It just sends the offending output to mosh and expects it to not die.
+
+# shellcheck source=e2e-test-subrs
+. "$(dirname "$0")/e2e-test-subrs"
+PATH=$PATH:.:$srcdir
+# Top-level wrapper.
+if [ $# -eq 0 ]; then
+ e2e-test "$0" baseline
+ exit
+fi
+
+# OK, we have arguments, we're one of the test hooks.
+if [ $# -ne 1 ]; then
+ fail "bad arguments %s\n" "$@"
+fi
+
+baseline()
+{
+ printf '0\033[1J\xcc\xb4'
+}
+
+case $1 in
+ baseline)
+ baseline;;
+ *)
+ fail "unknown test argument %s\n" "$1";;
+esac
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/unicode-later-combining.test
^
|
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+#
+# This test is for the first Unicode issue described on the Mosh web
+# page, a combining character drawn on a cell after returning the
+# cursor to that cell.
+#
+# XXX This test is fragile because it depends on tmux's unicode rendering.
+# The baseline and variant tests produce different (but valid) outputs
+# that are visually identical. The variant test is not run or validated.
+#
+
+# shellcheck source=e2e-test-subrs
+. "$(dirname "$0")/e2e-test-subrs"
+PATH=$PATH:.:$srcdir
+# Top-level wrapper.
+if [ $# -eq 0 ]; then
+ e2e-test "$0" baseline post
+ exit
+fi
+
+# OK, we have arguments, we're one of the test hooks.
+if [ $# -ne 1 ]; then
+ fail "bad arguments %s\n" "$@"
+fi
+
+baseline()
+{
+ printf 'abc\n\314\202\ndef\n'
+}
+
+variant()
+{
+ printf 'abc\n \314\202\ndef\n'
+}
+
+post()
+{
+ export LANG=C
+ if [ "$(tmux -V)" = "tmux 2.4" ]; then
+ skip "tmux 2.4 unicode combining bug breaks this test\n"
+ fi
+ if grep -q "$(printf '^\302\240\314\202$')" "$(basename "$0").d/baseline.capture"; then
+ exit 0
+ fi
+ exit 1
+}
+
+case $1 in
+ baseline)
+ baseline;;
+ variant)
+ variant;;
+ post)
+ post;;
+ *)
+ fail "unknown test argument %s\n" "$1";;
+esac
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/tests/window-resize.test
^
|
@@ -0,0 +1,83 @@
+#!/bin/sh
+
+#
+# This is a regression test for window resizing in Mosh. Making it
+# happen is a little kludgy: we have to create other panes in tmux and
+# resize them. But it works!
+#
+
+# shellcheck source=e2e-test-subrs
+. "$(dirname "$0")/e2e-test-subrs"
+PATH=$PATH:.:$srcdir
+# Top-level wrapper.
+if [ $# -eq 0 ]; then
+ e2e-test "$0" tmux baseline
+ exit
+fi
+
+tmux_resize_commands()
+{
+ hv=$1
+ shrink=$2
+ grow=$3
+ # Split the window into two panes.
+ printf "split-window -%s\n" "${hv}"
+ # Shrink the pane we created
+ for i in $(seq 1 10); do
+ sleepf
+ printf "resize-pane -%s\n" "${shrink}"
+ done
+ # And grow it
+ for i in $(seq 1 10); do
+ sleepf
+ printf "resize-pane -%s\n" "${grow}"
+ done
+ sleep 1
+ # Remove the pane we created.
+ printf "kill-pane\n"
+}
+
+tmux_commands()
+{
+ # An interactive shell is waiting for us in the mosh session.
+ # Start a full screen application that will redraw on window
+ # resize.
+ printf "send-keys 'less \"%s\"' 0x0d\n" "${srcdir}/e2e-test"
+ sleep 1
+ # we control the horizontal...
+ tmux_resize_commands v D U
+ sleep 1
+ # and the vertical.
+ tmux_resize_commands h L R
+ sleep 1
+ # Exit less.
+ printf "send-keys 'q'\n"
+ sleep 1
+ # Exit mosh session shell.
+ printf "send-keys 'exit 0' 0x0d\n"
+ # need to sleep extra long here, to let child commands complete,
+ # and not have tmux exit prematurely
+ sleep 5
+}
+
+tmux_stdin()
+{
+ tmux_commands | "$@"
+ exit
+}
+
+baseline()
+{
+ # Just start an interactive shell and wait. The tmux action drives.
+ sh
+}
+
+case $1 in
+ tmux)
+ shift;
+ tmux_stdin "$@";;
+ baseline)
+ baseline;;
+ *)
+ fail "unknown test argument %s\n" "$1";;
+esac
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/util/Makefile.am
^
|
@@ -2,4 +2,4 @@
noinst_LIBRARIES = libmoshutil.a
-libmoshutil_a_SOURCES = locale_utils.cc locale_utils.h swrite.cc swrite.h dos_assert.h fatal_assert.h select.h select.cc timestamp.h timestamp.cc pty_compat.cc pty_compat.h
+libmoshutil_a_SOURCES = locale_utils.cc locale_utils.h swrite.cc swrite.h dos_assert.h fatal_assert.h select.h select.cc timestamp.h timestamp.cc pty_compat.cc pty_compat.h shared.h
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/util/Makefile.in
^
|
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -16,23 +15,61 @@
@SET_MAKE@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
esac; \
- test $$am__dry = yes; \
- }
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -50,7 +87,6 @@
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = src/util
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_check_library.m4 \
@@ -59,6 +95,7 @@
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
@@ -67,15 +104,25 @@
ARFLAGS = cru
AM_V_AR = $(am__v_AR_@AM_V@)
am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@)
-am__v_AR_0 = @echo " AR " $@;
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
+am__v_AR_0 = @echo " AR " $@;
+am__v_AR_1 =
libmoshutil_a_AR = $(AR) $(ARFLAGS)
libmoshutil_a_LIBADD =
am_libmoshutil_a_OBJECTS = locale_utils.$(OBJEXT) swrite.$(OBJEXT) \
select.$(OBJEXT) timestamp.$(OBJEXT) pty_compat.$(OBJEXT)
libmoshutil_a_OBJECTS = $(am_libmoshutil_a_OBJECTS)
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -84,26 +131,27 @@
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
AM_V_CXX = $(am__v_CXX_@AM_V@)
am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
-am__v_CXX_0 = @echo " CXX " $@;
+am__v_CXX_0 = @echo " CXX " $@;
+am__v_CXX_1 =
CXXLD = $(CXX)
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
-o $@
AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
-am__v_CXXLD_0 = @echo " CXXLD " $@;
+am__v_CXXLD_0 = @echo " CXXLD " $@;
+am__v_CXXLD_1 =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
-am__v_CC_0 = @echo " CC " $@;
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo " CCLD " $@;
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
SOURCES = $(libmoshutil_a_SOURCES)
DIST_SOURCES = $(libmoshutil_a_SOURCES)
am__can_run_installinfo = \
@@ -111,8 +159,26 @@
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
@@ -122,13 +188,20 @@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/util/locale_utils.cc
^
|
@@ -88,9 +88,9 @@
/* Verify locale calls for UTF-8 */
if ( strcmp( locale_charset(), "UTF-8" ) != 0 &&
strcmp( locale_charset(), "utf-8" ) != 0 ) {
- return 0;
+ return false;
}
- return 1;
+ return true;
}
void set_native_locale( void ) {
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/util/pty_compat.cc
^
|
@@ -62,7 +62,7 @@
master = open( PTY_DEVICE, O_RDWR | O_NOCTTY );
if ( master < 0 ) {
- perror( "open("PTY_DEVICE")" );
+ perror( "open(" PTY_DEVICE ")" );
return -1;
}
@@ -140,12 +140,22 @@
case 0: /* Child */
if ( setsid() < 0 )
perror( "setsid" );
-#ifndef _AIX
+#ifdef TIOCSCTTY
if ( ioctl( slave, TIOCSCTTY, NULL ) < 0 ) {
perror( "ioctl" );
return -1;
}
-#endif
+#else
+ {
+ int dummy_fd;
+ dummy_fd = open (slave_name, O_RDWR);
+ if (dummy_fd < 0) {
+ perror( "open(slave_name)" );
+ return -1;
+ }
+ close (dummy_fd);
+ }
+#endif /* TIOCSCTTY */
close( master );
dup2( slave, STDIN_FILENO );
dup2( slave, STDOUT_FILENO );
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/util/select.cc
^
|
@@ -36,6 +36,8 @@
sigset_t Select::dummy_sigset;
+unsigned int Select::verbose = 0;
+
void Select::handle_signal( int signum )
{
fatal_assert( signum >= 0 );
@@ -43,5 +45,4 @@
Select &sel = get_instance();
sel.got_signal[ signum ] = 1;
- sel.got_any_signal = 1;
}
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/util/select.h
^
|
@@ -58,18 +58,15 @@
private:
Select()
: max_fd( -1 )
- , got_any_signal( 0 )
-
/* These initializations are not used; they are just
here to appease -Weffc++. */
, all_fds( dummy_fd_set )
, read_fds( dummy_fd_set )
- , error_fds( dummy_fd_set )
, empty_sigset( dummy_sigset )
+ , consecutive_polls( 0 )
{
FD_ZERO( &all_fds );
FD_ZERO( &read_fds );
- FD_ZERO( &error_fds );
clear_got_signal();
fatal_assert( 0 == sigemptyset( &empty_sigset ) );
@@ -98,7 +95,7 @@
FD_ZERO( &all_fds );
}
- void add_signal( int signum )
+ static void add_signal( int signum )
{
fatal_assert( signum >= 0 );
fatal_assert( signum <= MAX_SIGNAL_NUMBER );
@@ -118,30 +115,68 @@
fatal_assert( 0 == sigaction( signum, &sa, NULL ) );
}
+ /* timeout unit: milliseconds; negative timeout means wait forever */
int select( int timeout )
{
memcpy( &read_fds, &all_fds, sizeof( read_fds ) );
- memcpy( &error_fds, &all_fds, sizeof( error_fds ) );
clear_got_signal();
- got_any_signal = 0;
+ /* Rate-limit and warn about polls. */
+ if ( verbose > 1 && timeout == 0 ) {
+ fprintf( stderr, "%s: got poll (timeout 0)\n", __func__ );
+ }
+ if ( timeout == 0 && ++consecutive_polls >= MAX_POLLS ) {
+ if ( verbose > 1 && consecutive_polls == MAX_POLLS ) {
+ fprintf( stderr, "%s: got %d polls, rate limiting.\n", __func__, MAX_POLLS );
+ }
+ timeout = 1;
+ } else if ( timeout != 0 && consecutive_polls ) {
+ if ( verbose > 1 && consecutive_polls >= MAX_POLLS ) {
+ fprintf( stderr, "%s: got %d consecutive polls\n", __func__, consecutive_polls );
+ }
+ consecutive_polls = 0;
+ }
+
+#ifdef HAVE_PSELECT
struct timespec ts;
struct timespec *tsp = NULL;
if ( timeout >= 0 ) {
- // timeout in milliseconds
ts.tv_sec = timeout / 1000;
ts.tv_nsec = 1000000 * (long( timeout ) % 1000);
tsp = &ts;
}
- // negative timeout means wait forever
- int ret = ::pselect( max_fd + 1, &read_fds, NULL, &error_fds, tsp, &empty_sigset );
+ int ret = ::pselect( max_fd + 1, &read_fds, NULL, NULL, tsp, &empty_sigset );
+#else
+ struct timeval tv;
+ struct timeval *tvp = NULL;
+ sigset_t old_sigset;
+
+ if ( timeout >= 0 ) {
+ tv.tv_sec = timeout / 1000;
+ tv.tv_usec = 1000 * (long( timeout ) % 1000);
+ tvp = &tv;
+ }
+
+ int ret = sigprocmask( SIG_SETMASK, &empty_sigset, &old_sigset );
+ if ( ret != -1 ) {
+ ret = ::select( max_fd + 1, &read_fds, NULL, NULL, tvp );
+ sigprocmask( SIG_SETMASK, &old_sigset, NULL );
+ }
+#endif
- if ( ( ret == -1 ) && ( errno == EINTR ) ) {
+ if ( ret == 0 || ( ret == -1 && errno == EINTR ) ) {
+ /* Look for and report Cygwin select() bug. */
+ if ( ret == 0 ) {
+ for ( int fd = 0; fd <= max_fd; fd++ ) {
+ if ( FD_ISSET( fd, &read_fds ) ) {
+ fprintf( stderr, "select(): nfds = 0 but read fd %d is set\n", fd );
+ }
+ }
+ }
/* The user should process events as usual. */
FD_ZERO( &read_fds );
- FD_ZERO( &error_fds );
ret = 0;
}
@@ -159,29 +194,34 @@
return FD_ISSET( fd, &read_fds );
}
- bool error( int fd )
-#if FD_ISSET_IS_CONST
- const
-#endif
- {
- assert( FD_ISSET( fd, &all_fds ) );
- return FD_ISSET( fd, &error_fds );
- }
-
- bool signal( int signum ) const
+ /* This method consumes a signal notification. */
+ bool signal( int signum )
{
fatal_assert( signum >= 0 );
fatal_assert( signum <= MAX_SIGNAL_NUMBER );
- return got_signal[ signum ];
+ /* XXX This requires a guard against concurrent signals. */
+ bool rv = got_signal[ signum ];
+ got_signal[ signum ] = 0;
+ return rv;
}
+ /* This method does not consume signal notifications. */
bool any_signal( void ) const
{
- return got_any_signal;
+ bool rv = false;
+ for (int i = 0; i < MAX_SIGNAL_NUMBER; i++) {
+ rv |= got_signal[ i ];
+ }
+ return rv;
}
+ static void set_verbose( unsigned int s_verbose ) { verbose = s_verbose; }
+
private:
static const int MAX_SIGNAL_NUMBER = 64;
+ /* Number of 0-timeout selects after which we begin to think
+ * something's wrong. */
+ static const int MAX_POLLS = 10;
static void handle_signal( int signum );
@@ -189,15 +229,16 @@
/* We assume writes to these ints are atomic, though we also try to mask out
concurrent signal handlers. */
- int got_any_signal;
int got_signal[ MAX_SIGNAL_NUMBER + 1 ];
- fd_set all_fds, read_fds, error_fds;
+ fd_set all_fds, read_fds;
sigset_t empty_sigset;
static fd_set dummy_fd_set;
static sigset_t dummy_sigset;
+ int consecutive_polls;
+ static unsigned int verbose;
};
#endif
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/src/util/shared.h
^
|
@@ -0,0 +1,84 @@
+/*
+ Mosh: the mobile shell
+ Copyright 2012 Keith Winstein
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of portions of this program with the
+ OpenSSL library under certain conditions as described in each
+ individual source file, and distribute linked combinations including
+ the two.
+
+ You must obey the GNU General Public License in all respects for all
+ of the code used other than OpenSSL. If you modify file(s) with this
+ exception, you may extend this exception to your version of the
+ file(s), but you are not obligated to do so. If you do not wish to do
+ so, delete this exception statement from your version. If you delete
+ this exception statement from all source files in the program, then
+ also delete it here.
+*/
+
+#ifndef SHARED_HPP
+#define SHARED_HPP
+
+#include "config.h"
+
+#ifdef HAVE_MEMORY
+#include <memory>
+#endif
+
+#ifdef HAVE_TR1_MEMORY
+#include <tr1/memory>
+#endif
+
+namespace shared {
+#ifdef HAVE_STD_SHARED_PTR
+ using std::shared_ptr;
+ using std::make_shared;
+#else
+#ifdef HAVE_STD_TR1_SHARED_PTR
+ using std::tr1::shared_ptr;
+
+ // make_shared emulation.
+ template<typename Tp, typename A1>
+ inline shared_ptr<Tp>
+ make_shared(const A1& a1)
+ {
+ return shared_ptr<Tp>(new Tp(a1));
+ }
+ template<typename Tp, typename A1, typename A2>
+ inline shared_ptr<Tp>
+ make_shared(const A1& a1, const A2& a2)
+ {
+ return shared_ptr<Tp>(new Tp(a1, a2));
+ }
+ template<typename Tp, typename A1, typename A2, typename A3>
+ inline shared_ptr<Tp>
+ make_shared(const A1& a1, const A2& a2, const A3& a3)
+ {
+ return shared_ptr<Tp>(new Tp(a1, a2, a3));
+ }
+ template<typename Tp, typename A1, typename A2, typename A3, typename A4>
+ inline shared_ptr<Tp>
+ make_shared(const A1& a1, const A2& a2, const A3& a3, const A4& a4)
+ {
+ return shared_ptr<Tp>(new Tp(a1, a2, a3, a4));
+ }
+#else
+#error Need a shared_ptr class. Try Boost::TR1.
+#endif
+#endif
+}
+#endif
|
[-]
[+]
|
Changed |
mosh-1.3.2.tar.gz/src/util/timestamp.cc
^
|
@@ -37,12 +37,15 @@
#include <errno.h>
#if HAVE_CLOCK_GETTIME
- #include <time.h>
-#elif HAVE_MACH_ABSOLUTE_TIME
- #include <mach/mach_time.h>
-#elif HAVE_GETTIMEOFDAY
- #include <sys/time.h>
- #include <stdio.h>
+#include <time.h>
+#endif
+#if HAVE_MACH_ABSOLUTE_TIME
+#include <mach/error.h>
+#include <mach/mach_time.h>
+#endif
+#if HAVE_GETTIMEOFDAY
+#include <sys/time.h>
+#include <stdio.h>
#endif
static uint64_t millis_cache = -1;
@@ -58,30 +61,48 @@
void freeze_timestamp( void )
{
+ // Try all our clock sources till we get something. This could
+ // break if a source only sometimes works in a given process.
#if HAVE_CLOCK_GETTIME
+ // Preferred clock source-- portable, monotonic, (should be)
+ // adjusted after system sleep
struct timespec tp;
- if ( clock_gettime( CLOCK_MONOTONIC, &tp ) < 0 ) {
- /* did not succeed */
- } else {
+ if (
+#if defined(__APPLE__) && defined(__MACH__)
+ // Check for presence, for OS X SDK >= 10.12 and runtime < 10.12
+ &clock_gettime != NULL &&
+#endif
+ clock_gettime( CLOCK_MONOTONIC, &tp ) == 0 ) {
uint64_t millis = tp.tv_nsec / 1000000;
millis += uint64_t( tp.tv_sec ) * 1000;
millis_cache = millis;
return;
}
-#elif HAVE_MACH_ABSOLUTE_TIME
+#endif
+#if HAVE_MACH_ABSOLUTE_TIME
+ // Monotonic, not adjusted after system sleep. OS X 10.12 has
+ // mach_continuous_time(), but also has clock_gettime().
static mach_timebase_info_data_t s_timebase_info;
+ static double absolute_to_millis = 0.0;
- if (s_timebase_info.denom == 0) {
- mach_timebase_info(&s_timebase_info);
+ if (absolute_to_millis == 0.0) {
+ if (ERR_SUCCESS == mach_timebase_info(&s_timebase_info)) {
+ absolute_to_millis = 1e-6 * s_timebase_info.numer / s_timebase_info.denom;
+ } else
+ absolute_to_millis = -1.0;
}
// NB: mach_absolute_time() returns "absolute time units"
// We need to apply a conversion to get milliseconds.
- millis_cache = ((mach_absolute_time() * s_timebase_info.numer) / (1000000 * s_timebase_info.denom));
- return;
-#elif HAVE_GETTIMEOFDAY
+ if (absolute_to_millis > 0.0) {
+ millis_cache = mach_absolute_time() * absolute_to_millis;
+ return;
+ }
+#endif
+#if HAVE_GETTIMEOFDAY
+ // Not monotonic.
// NOTE: If time steps backwards, timeouts may be confused.
struct timeval tv;
if ( gettimeofday(&tv, NULL) ) {
@@ -94,6 +115,6 @@
return;
}
#else
-# error "Don't know how to get a timestamp on this platform"
+# error "gettimeofday() unavailable-- required as timer of last resort"
#endif
}
|
[-]
[+]
|
Added |
mosh-1.3.2.tar.gz/test-driver
^
|
@@ -0,0 +1,148 @@
+#! /bin/sh
+# test-driver - basic testsuite driver script.
+
+scriptversion=2013-07-13.22; # UTC
+
+# Copyright (C) 2011-2014 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+# Make unconditional expansion of undefined variables an error. This
+# helps a lot in preventing typo-related bugs.
+set -u
+
+usage_error ()
+{
+ echo "$0: $*" >&2
+ print_usage >&2
+ exit 2
+}
+
+print_usage ()
+{
+ cat <<END
+Usage:
+ test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
+ [--expect-failure={yes|no}] [--color-tests={yes|no}]
+ [--enable-hard-errors={yes|no}] [--]
+ TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS]
+The '--test-name', '--log-file' and '--trs-file' options are mandatory.
+END
+}
+
+test_name= # Used for reporting.
+log_file= # Where to save the output of the test script.
+trs_file= # Where to save the metadata of the test run.
+expect_failure=no
+color_tests=no
+enable_hard_errors=yes
+while test $# -gt 0; do
+ case $1 in
+ --help) print_usage; exit $?;;
+ --version) echo "test-driver $scriptversion"; exit $?;;
+ --test-name) test_name=$2; shift;;
+ --log-file) log_file=$2; shift;;
+ --trs-file) trs_file=$2; shift;;
+ --color-tests) color_tests=$2; shift;;
+ --expect-failure) expect_failure=$2; shift;;
+ --enable-hard-errors) enable_hard_errors=$2; shift;;
+ --) shift; break;;
+ -*) usage_error "invalid option: '$1'";;
+ *) break;;
+ esac
+ shift
+done
+
+missing_opts=
+test x"$test_name" = x && missing_opts="$missing_opts --test-name"
+test x"$log_file" = x && missing_opts="$missing_opts --log-file"
+test x"$trs_file" = x && missing_opts="$missing_opts --trs-file"
+if test x"$missing_opts" != x; then
+ usage_error "the following mandatory options are missing:$missing_opts"
+fi
+
+if test $# -eq 0; then
+ usage_error "missing argument"
+fi
+
+if test $color_tests = yes; then
+ # Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
+ red='[0;31m' # Red.
+ grn='[0;32m' # Green.
+ lgn='[1;32m' # Light green.
+ blu='[1;34m' # Blue.
+ mgn='[0;35m' # Magenta.
+ std='[m' # No color.
+else
+ red= grn= lgn= blu= mgn= std=
+fi
+
+do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
+trap "st=129; $do_exit" 1
+trap "st=130; $do_exit" 2
+trap "st=141; $do_exit" 13
+trap "st=143; $do_exit" 15
+
+# Test script is run here.
+"$@" >$log_file 2>&1
+estatus=$?
+
+if test $enable_hard_errors = no && test $estatus -eq 99; then
+ tweaked_estatus=1
+else
+ tweaked_estatus=$estatus
+fi
+
+case $tweaked_estatus:$expect_failure in
+ 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
+ 0:*) col=$grn res=PASS recheck=no gcopy=no;;
+ 77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
+ 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;;
+ *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;;
+ *:*) col=$red res=FAIL recheck=yes gcopy=yes;;
+esac
+
+# Report the test outcome and exit status in the logs, so that one can
+# know whether the test passed or failed simply by looking at the '.log'
+# file, without the need of also peaking into the corresponding '.trs'
+# file (automake bug#11814).
+echo "$res $test_name (exit status: $estatus)" >>$log_file
+
+# Report outcome to console.
+echo "${col}${res}${std}: $test_name"
+
+# Register the test result, and other relevant metadata.
+echo ":test-result: $res" > $trs_file
+echo ":global-test-result: $res" >> $trs_file
+echo ":recheck: $recheck" >> $trs_file
+echo ":copy-in-global-log: $gcopy" >> $trs_file
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
|
[-]
[+]
|
Deleted |
mosh.SuSEfirewall
^
|
@@ -1,5 +0,0 @@
-## Name: Mosh Server UDP ports
-## Description: Opens UDP ports for the Mosh Server
-
-# space separated list of allowed UDP ports
-UDP="60000:61000"
|