diff --git a/src/crypto/crypto.h b/src/crypto/crypto.h index 1ed7582..c0b3d18 100644 --- a/src/crypto/crypto.h +++ b/src/crypto/crypto.h @@ -32,7 +32,9 @@ namespace Crypto { class CryptoException { public: string text; - CryptoException( string s_text ) : text( s_text ) {}; + bool fatal; + CryptoException( string s_text, bool s_fatal = false ) + : text( s_text ), fatal( s_fatal ) {}; }; class Base64Key { diff --git a/src/frontend/mosh-server.cc b/src/frontend/mosh-server.cc index d7988c5..27e8e3a 100644 --- a/src/frontend/mosh-server.cc +++ b/src/frontend/mosh-server.cc @@ -592,7 +592,11 @@ void serve( int host_fd, Terminal::Complete &terminal, ServerConnection &network fprintf( stderr, "%s: %s\n", e.function.c_str(), strerror( e.the_errno ) ); spin(); } catch ( Crypto::CryptoException e ) { - fprintf( stderr, "Crypto exception: %s\n", e.text.c_str() ); + if ( e.fatal ) { + throw; + } else { + fprintf( stderr, "Crypto exception: %s\n", e.text.c_str() ); + } } } } diff --git a/src/frontend/stmclient.cc b/src/frontend/stmclient.cc index b191914..5a57783 100644 --- a/src/frontend/stmclient.cc +++ b/src/frontend/stmclient.cc @@ -398,9 +398,13 @@ void STMClient::main( void ) req.tv_nsec = 200000000; /* 0.2 sec */ nanosleep( &req, NULL ); } catch ( Crypto::CryptoException e ) { - wchar_t tmp[ 128 ]; - swprintf( tmp, 128, L"Crypto exception: %s", e.text.c_str() ); - overlays.get_notification_engine().set_notification_string( wstring( tmp ) ); + if ( e.fatal ) { + throw; + } else { + wchar_t tmp[ 128 ]; + swprintf( tmp, 128, L"Crypto exception: %s", e.text.c_str() ); + overlays.get_notification_engine().set_notification_string( wstring( tmp ) ); + } } } }