| 8834 | #endif // NOT_USED_OR_REPLACED |
| 8835 | |
| 8836 | static void authReceiveResponse(bool havePacket, ClntAuthBlock& cBlock, rem_port* port, |
| 8837 | Rdb* rdb, IStatus* status, PACKET* packet, bool checkKeys) |
| 8838 | { |
| 8839 | LocalStatus ls; |
| 8840 | CheckStatusWrapper s(&ls); |
| 8841 | |
| 8842 | for (;;) |
| 8843 | { |
| 8844 | // Get response |
| 8845 | if (!havePacket) |
| 8846 | receive_packet(port, packet); |
| 8847 | else |
| 8848 | fb_assert(packet->p_operation == op_cond_accept); |
| 8849 | |
| 8850 | havePacket = false; // havePacket means first packet is already received |
| 8851 | |
| 8852 | // Check response |
| 8853 | cstring* n = NULL; |
| 8854 | cstring* d = NULL; |
| 8855 | |
| 8856 | switch(packet->p_operation) |
| 8857 | { |
| 8858 | case op_trusted_auth: |
| 8859 | HANDSHAKE_DEBUG(fprintf(stderr, "Cli: authReceiveResponse: trusted_auth\n")); |
| 8860 | d = &packet->p_trau.p_trau_data; |
| 8861 | break; |
| 8862 | |
| 8863 | case op_cont_auth: |
| 8864 | d = &packet->p_auth_cont.p_data; |
| 8865 | n = &packet->p_auth_cont.p_name; |
| 8866 | port->addServerKeys(&packet->p_auth_cont.p_keys); |
| 8867 | HANDSHAKE_DEBUG(fprintf(stderr, "Cli: authReceiveResponse: cont_auth d=%d n=%d '%.*s' 0x%x\n", |
| 8868 | d->cstr_length, n->cstr_length, |
| 8869 | n->cstr_length, n->cstr_address, n->cstr_address ? n->cstr_address[0] : 0)); |
| 8870 | break; |
| 8871 | |
| 8872 | case op_cond_accept: |
| 8873 | d = &packet->p_acpd.p_acpt_data; |
| 8874 | n = &packet->p_acpd.p_acpt_plugin; |
| 8875 | port->addServerKeys(&packet->p_acpd.p_acpt_keys); |
| 8876 | HANDSHAKE_DEBUG(fprintf(stderr, "Cli: authReceiveResponse: cond_accept d=%d n=%d '%.*s' 0x%x\n", |
| 8877 | d->cstr_length, n->cstr_length, |
| 8878 | n->cstr_length, n->cstr_address, n->cstr_address ? n->cstr_address[0] : 0)); |
| 8879 | if (packet->p_acpd.p_acpt_type & pflag_compress) |
| 8880 | { |
| 8881 | port->initCompression(); |
| 8882 | port->port_flags |= PORT_compressed; |
| 8883 | } |
| 8884 | packet->p_acpd.p_acpt_type &= ptype_MASK; |
| 8885 | break; |
| 8886 | |
| 8887 | default: |
| 8888 | HANDSHAKE_DEBUG(fprintf(stderr, "Cli: authReceiveResponse: Default answer\n")); |
| 8889 | REMOTE_check_response(status, rdb, packet, checkKeys); |
| 8890 | // successfully attached |
| 8891 | HANDSHAKE_DEBUG(fprintf(stderr, "Cli: authReceiveResponse: OK!\n")); |
| 8892 | cBlock.authComplete = true; |
| 8893 | rdb->rdb_id = packet->p_resp.p_resp_object; |
no test coverage detected