@ -250,6 +250,7 @@ namespace
const char * USAGE_MMS_SET ( " mms set <option_name> [<option_value>] " ) ;
const char * USAGE_MMS_SET ( " mms set <option_name> [<option_value>] " ) ;
const char * USAGE_MMS_SEND_SIGNER_CONFIG ( " mms send_signer_config " ) ;
const char * USAGE_MMS_SEND_SIGNER_CONFIG ( " mms send_signer_config " ) ;
const char * USAGE_MMS_START_AUTO_CONFIG ( " mms start_auto_config [<label> <label> ...] " ) ;
const char * USAGE_MMS_START_AUTO_CONFIG ( " mms start_auto_config [<label> <label> ...] " ) ;
const char * USAGE_MMS_CONFIG_CHECKSUM ( " mms config_checksum " ) ;
const char * USAGE_MMS_STOP_AUTO_CONFIG ( " mms stop_auto_config " ) ;
const char * USAGE_MMS_STOP_AUTO_CONFIG ( " mms stop_auto_config " ) ;
const char * USAGE_MMS_AUTO_CONFIG ( " mms auto_config <auto_config_token> " ) ;
const char * USAGE_MMS_AUTO_CONFIG ( " mms auto_config <auto_config_token> " ) ;
const char * USAGE_PRINT_RING ( " print_ring <key_image> | <txid> " ) ;
const char * USAGE_PRINT_RING ( " print_ring <key_image> | <txid> " ) ;
@ -3460,7 +3461,7 @@ simple_wallet::simple_wallet()
tr ( " Interface with the MMS (Multisig Messaging System) \n "
tr ( " Interface with the MMS (Multisig Messaging System) \n "
" <subcommand> is one of: \n "
" <subcommand> is one of: \n "
" init, info, signer, list, next, sync, transfer, delete, send, receive, export, note, show, set, help \n "
" init, info, signer, list, next, sync, transfer, delete, send, receive, export, note, show, set, help \n "
" send_signer_config, start_auto_config, stop_auto_config, auto_config \n "
" send_signer_config, start_auto_config, stop_auto_config, auto_config , config_checksum \n "
" Get help about a subcommand with: help_advanced mms <subcommand> " ) ) ;
" Get help about a subcommand with: help_advanced mms <subcommand> " ) ) ;
m_cmd_binder . set_handler ( " mms init " ,
m_cmd_binder . set_handler ( " mms init " ,
boost : : bind ( & simple_wallet : : on_command , this , & simple_wallet : : mms , _1 ) ,
boost : : bind ( & simple_wallet : : on_command , this , & simple_wallet : : mms , _1 ) ,
@ -3529,6 +3530,10 @@ simple_wallet::simple_wallet()
boost : : bind ( & simple_wallet : : on_command , this , & simple_wallet : : mms , _1 ) ,
boost : : bind ( & simple_wallet : : on_command , this , & simple_wallet : : mms , _1 ) ,
tr ( USAGE_MMS_START_AUTO_CONFIG ) ,
tr ( USAGE_MMS_START_AUTO_CONFIG ) ,
tr ( " Start auto-config at the auto-config manager's wallet by issuing auto-config tokens and optionally set others' labels " ) ) ;
tr ( " Start auto-config at the auto-config manager's wallet by issuing auto-config tokens and optionally set others' labels " ) ) ;
m_cmd_binder . set_handler ( " mms config_checksum " ,
boost : : bind ( & simple_wallet : : on_command , this , & simple_wallet : : mms , _1 ) ,
tr ( USAGE_MMS_CONFIG_CHECKSUM ) ,
tr ( " Get a checksum that allows signers to easily check for identical MMS configuration " ) ) ;
m_cmd_binder . set_handler ( " mms stop_auto_config " ,
m_cmd_binder . set_handler ( " mms stop_auto_config " ,
boost : : bind ( & simple_wallet : : on_command , this , & simple_wallet : : mms , _1 ) ,
boost : : bind ( & simple_wallet : : on_command , this , & simple_wallet : : mms , _1 ) ,
tr ( USAGE_MMS_STOP_AUTO_CONFIG ) ,
tr ( USAGE_MMS_STOP_AUTO_CONFIG ) ,
@ -10361,6 +10366,14 @@ bool simple_wallet::user_confirms(const std::string &question)
return ! std : : cin . eof ( ) & & command_line : : is_yes ( answer ) ;
return ! std : : cin . eof ( ) & & command_line : : is_yes ( answer ) ;
}
}
bool simple_wallet : : user_confirms_auto_config ( )
{
message_writer ( console_color_red , true ) < < tr ( " WARNING: Using MMS auto-config mechanisms is not trustless " ) ;
message_writer ( ) < < tr ( " A malicious auto-config manager could send you info about own wallets instead of other signers' info " ) ;
message_writer ( ) < < tr ( " If in doubt do not use auto-config or at least compare configs using the \" mms config_checksum \" command " ) ;
return user_confirms ( " Accept the risks and continue? " ) ;
}
bool simple_wallet : : get_number_from_arg ( const std : : string & arg , uint32_t & number , const uint32_t lower_bound , const uint32_t upper_bound )
bool simple_wallet : : get_number_from_arg ( const std : : string & arg , uint32_t & number , const uint32_t lower_bound , const uint32_t upper_bound )
{
{
bool valid = false ;
bool valid = false ;
@ -10513,7 +10526,7 @@ void simple_wallet::show_message(const mms::message &m)
case mms : : message_type : : additional_key_set :
case mms : : message_type : : additional_key_set :
case mms : : message_type : : note :
case mms : : message_type : : note :
display_content = true ;
display_content = true ;
ms. get_sanitized_message_text ( m , sanitized_text ) ;
sanitized_text = mms : : message_store : : get_sanitized_text ( m . content , 1000 ) ;
break ;
break ;
default :
default :
display_content = false ;
display_content = false ;
@ -10862,6 +10875,11 @@ void simple_wallet::mms_next(const std::vector<std::string> &args)
{
{
break ;
break ;
}
}
if ( ! user_confirms_auto_config ( ) )
{
message_writer ( ) < < tr ( " You can use the \" mms delete \" command to delete any unwanted message " ) ;
break ;
}
}
}
ms . process_signer_config ( state , m . content ) ;
ms . process_signer_config ( state , m . content ) ;
ms . stop_auto_config ( ) ;
ms . stop_auto_config ( ) ;
@ -11188,6 +11206,18 @@ void simple_wallet::mms_start_auto_config(const std::vector<std::string> &args)
list_signers ( ms . get_all_signers ( ) ) ;
list_signers ( ms . get_all_signers ( ) ) ;
}
}
void simple_wallet : : mms_config_checksum ( const std : : vector < std : : string > & args )
{
if ( args . size ( ) ! = 0 )
{
fail_msg_writer ( ) < < tr ( " Usage: mms config_checksum " ) ;
return ;
}
mms : : message_store & ms = m_wallet - > get_message_store ( ) ;
LOCK_IDLE_SCOPE ( ) ;
message_writer ( ) < < ms . get_config_checksum ( ) ;
}
void simple_wallet : : mms_stop_auto_config ( const std : : vector < std : : string > & args )
void simple_wallet : : mms_stop_auto_config ( const std : : vector < std : : string > & args )
{
{
if ( args . size ( ) ! = 0 )
if ( args . size ( ) ! = 0 )
@ -11218,6 +11248,10 @@ void simple_wallet::mms_auto_config(const std::vector<std::string> &args)
fail_msg_writer ( ) < < tr ( " Invalid auto-config token " ) ;
fail_msg_writer ( ) < < tr ( " Invalid auto-config token " ) ;
return ;
return ;
}
}
if ( ! user_confirms_auto_config ( ) )
{
return ;
}
mms : : authorized_signer me = ms . get_signer ( 0 ) ;
mms : : authorized_signer me = ms . get_signer ( 0 ) ;
if ( me . auto_config_running )
if ( me . auto_config_running )
{
{
@ -11330,6 +11364,10 @@ bool simple_wallet::mms(const std::vector<std::string> &args)
{
{
mms_start_auto_config ( mms_args ) ;
mms_start_auto_config ( mms_args ) ;
}
}
else if ( sub_command = = " config_checksum " )
{
mms_config_checksum ( mms_args ) ;
}
else if ( sub_command = = " stop_auto_config " )
else if ( sub_command = = " stop_auto_config " )
{
{
mms_stop_auto_config ( mms_args ) ;
mms_stop_auto_config ( mms_args ) ;