| 5385 | |
| 5386 | |
| 5387 | static bool continue_authentication(rem_port* port, PACKET* send, PACKET* receive) |
| 5388 | { |
| 5389 | /************************************** |
| 5390 | * |
| 5391 | * c o n t i n u e _ a u t h e n t i c a t i o n |
| 5392 | * |
| 5393 | ************************************** |
| 5394 | * |
| 5395 | * Functional description |
| 5396 | * Server side of multi-hop auth handshake. |
| 5397 | * Returns false if auth failed and port was disconnected. |
| 5398 | * |
| 5399 | **************************************/ |
| 5400 | ServerAuthBase* sa = port->port_srv_auth; |
| 5401 | if (!sa) |
| 5402 | { |
| 5403 | send_error(port, send, isc_unavailable); |
| 5404 | } |
| 5405 | else if (port->port_protocol < PROTOCOL_VERSION11 || |
| 5406 | receive->p_operation == op_trusted_auth && port->port_protocol >= PROTOCOL_VERSION13 || |
| 5407 | receive->p_operation == op_cont_auth && port->port_protocol < PROTOCOL_VERSION13) |
| 5408 | { |
| 5409 | send_error(port, send, Arg::Gds(isc_non_plugin_protocol)); |
| 5410 | } |
| 5411 | else |
| 5412 | { |
| 5413 | try |
| 5414 | { |
| 5415 | if (receive->p_operation == op_trusted_auth) |
| 5416 | { |
| 5417 | HANDSHAKE_DEBUG(fprintf(stderr, "Srv: trusted_auth\n")); |
| 5418 | port->port_srv_auth_block->setDataForPlugin(receive->p_trau.p_trau_data); |
| 5419 | } |
| 5420 | else if (receive->p_operation == op_cont_auth) |
| 5421 | { |
| 5422 | HANDSHAKE_DEBUG(fprintf(stderr, "Srv: continue_authentication\n")); |
| 5423 | port->port_srv_auth_block->setDataForPlugin(&receive->p_auth_cont); |
| 5424 | } |
| 5425 | |
| 5426 | if (sa->authenticate(send, ServerAuth::AUTH_CONTINUE)) |
| 5427 | { |
| 5428 | delete sa; |
| 5429 | port->port_srv_auth = NULL; |
| 5430 | } |
| 5431 | |
| 5432 | return true; |
| 5433 | } |
| 5434 | catch (const Exception& ex) |
| 5435 | { |
| 5436 | LocalStatus ls; |
| 5437 | CheckStatusWrapper status_vector(&ls); |
| 5438 | ex.stuffException(&status_vector); |
| 5439 | |
| 5440 | port->send_response(send, 0, 0, &status_vector, false); |
| 5441 | } |
| 5442 | } |
| 5443 | |
| 5444 | port->disconnect(send, receive); |
no test coverage detected