Let plugins try to add data to DPB in order to avoid extra network roundtrip
| 8756 | |
| 8757 | // Let plugins try to add data to DPB in order to avoid extra network roundtrip |
| 8758 | static void authFillParametersBlock(ClntAuthBlock& cBlock, ClumpletWriter& dpb, |
| 8759 | const ParametersSet* tags, rem_port* port) |
| 8760 | { |
| 8761 | if (cBlock.authComplete) |
| 8762 | return; // Already authenticated |
| 8763 | |
| 8764 | LocalStatus ls; |
| 8765 | CheckStatusWrapper s(&ls); |
| 8766 | |
| 8767 | cBlock.resetDataFromPlugin(); |
| 8768 | |
| 8769 | for (; cBlock.plugins.hasData(); cBlock.plugins.next()) |
| 8770 | { |
| 8771 | if (port->port_protocol >= PROTOCOL_VERSION13 || |
| 8772 | useLegacyAuth(cBlock.plugins.name(), port->port_protocol, dpb)) |
| 8773 | { |
| 8774 | // OK to use plugin |
| 8775 | cBlock.resetDataFromPlugin(); |
| 8776 | HANDSHAKE_DEBUG(fprintf(stderr, "Cli: authFillParametersBlock(%s)\n", cBlock.plugins.name())); |
| 8777 | int authRc = cBlock.plugins.plugin()->authenticate(&s, &cBlock); |
| 8778 | |
| 8779 | switch (authRc) |
| 8780 | { |
| 8781 | case IAuth::AUTH_SUCCESS: |
| 8782 | case IAuth::AUTH_MORE_DATA: |
| 8783 | HANDSHAKE_DEBUG(fprintf(stderr, "Cli: authFillParametersBlock: plugin %s is OK\n", |
| 8784 | cBlock.plugins.name())); |
| 8785 | cleanDpb(dpb, tags); |
| 8786 | cBlock.extractDataFromPluginTo(dpb, tags, port->port_protocol); |
| 8787 | return; |
| 8788 | |
| 8789 | case IAuth::AUTH_CONTINUE: |
| 8790 | continue; |
| 8791 | |
| 8792 | case IAuth::AUTH_FAILED: |
| 8793 | HANDSHAKE_DEBUG(fprintf(stderr, "Cli: authFillParametersBlock: plugin %s FAILED\n", |
| 8794 | cBlock.plugins.name())); |
| 8795 | (Arg::Gds(isc_login) << Arg::StatusVector(&s)).raise(); |
| 8796 | break; // compiler silencer |
| 8797 | } |
| 8798 | } |
| 8799 | |
| 8800 | HANDSHAKE_DEBUG(fprintf(stderr, "Cli: authFillParametersBlock: try next plugin, %s skipped\n", |
| 8801 | cBlock.plugins.name())); |
| 8802 | } |
| 8803 | } |
| 8804 | |
| 8805 | #ifdef NOT_USED_OR_REPLACED |
| 8806 | static CSTRING* REMOTE_dup_string(const CSTRING* from) |
no test coverage detected