//-------------------------------------------------------------------------- bool rpc_debmod_t::open_remote( const char *hostname, int port_number, const char *password) { rpc_packet_t *rp = NULL; network_error_code = 0; irs = init_client_irs(hostname, port_number); if ( irs == NULL ) { FAILURE: if ( rp != NULL ) qfree(rp); term_irs(); return false; } rp = recv_request(); if ( rp == NULL || rp->code != RPC_OPEN ) // is this an ida debugger server? { rpc_client_t::dwarning("ICON ERROR\nAUTOHIDE NONE\n" "Bogus or irresponsive remote server"); goto FAILURE; } const uchar *answer = (uchar *)(rp+1); const uchar *end = answer + rp->length; int version = extract_long(&answer, end); int remote_debugger_id = extract_long(&answer, end); int easize = extract_long(&answer, end); qstring errstr; if ( version != IDD_INTERFACE_VERSION ) errstr.sprnt("protocol version is %d, expected %d", version, IDD_INTERFACE_VERSION); else if ( remote_debugger_id != debugger.id ) errstr.sprnt("debugger id is %d, expected %d (%s)", remote_debugger_id, debugger.id, debugger.name); else if ( easize != get_expected_addrsize() ) errstr.sprnt("address size is %d bytes, expected %d", easize, inf.is_64bit() ? 8 : 4); if ( !errstr.empty() ) { bytevec_t req = prepare_rpc_packet(RPC_OK); append_dd(req, false); send_request(req); warning("ICON ERROR\nAUTOHIDE NONE\n" "Incompatible debugging server:\n" "%s\n", errstr.c_str()); goto FAILURE; } qfree(rp); bytevec_t req = prepare_rpc_packet(RPC_OK); append_dd(req, true); append_str(req, password); send_request(req); rp = recv_request(); if ( rp == NULL || rp->code != RPC_OK ) goto FAILURE; answer = (uchar *)(rp+1); end = answer + rp->length; bool password_ok = extract_long(&answer, end) != 0; if ( !password_ok ) // is this an ida debugger server? { warning("ICON ERROR\nAUTOHIDE NONE\n" "Bad password"); goto FAILURE; } qfree(rp); return true; }
//-------------------------------------------------------------------------- void rpc_debmod_t::connection_failed(rpc_packet_t *rp) { if (rp != NULL) qfree(rp); term_irs(); }