| 10434 | } |
| 10435 | |
| 10436 | unsigned ClntAuthBlock::ClientCrypt::callback(unsigned dlen, const void* data, unsigned blen, void* buffer) |
| 10437 | { |
| 10438 | HANDSHAKE_DEBUG(fprintf(stderr, "dlen=%d blen=%d\n", dlen, blen)); |
| 10439 | |
| 10440 | int loop = 0; |
| 10441 | while (loop < 2) |
| 10442 | { |
| 10443 | for (; pluginItr.hasData(); pluginItr.next()) |
| 10444 | { |
| 10445 | if (!currentIface) |
| 10446 | { |
| 10447 | LocalStatus ls; |
| 10448 | CheckStatusWrapper st(&ls); |
| 10449 | |
| 10450 | HANDSHAKE_DEBUG(fprintf(stderr, "Try plugin %s\n", pluginItr.name())); |
| 10451 | currentIface = pluginItr.plugin()->chainHandle(&st); |
| 10452 | // if plugin does not support chaining - silently ignore it |
| 10453 | check(&st, isc_wish_list); |
| 10454 | HANDSHAKE_DEBUG(fprintf(stderr, "Use plugin %s, ptr=%p\n", pluginItr.name(), currentIface)); |
| 10455 | } |
| 10456 | |
| 10457 | // if we have an iface - try it |
| 10458 | if (currentIface) |
| 10459 | { |
| 10460 | unsigned retlen = currentIface->callback(dlen, data, blen, buffer); |
| 10461 | HANDSHAKE_DEBUG(fprintf(stderr, "Iface %p returned %d\n", currentIface, retlen)); |
| 10462 | if (retlen) |
| 10463 | return retlen; |
| 10464 | } |
| 10465 | |
| 10466 | // no success with iface - clear it |
| 10467 | // appropriate data structures to be released by plugin cleanup code |
| 10468 | currentIface = nullptr; |
| 10469 | } |
| 10470 | |
| 10471 | ++loop; |
| 10472 | // prepare iterator for next use |
| 10473 | pluginItr.rewind(); |
| 10474 | } |
| 10475 | |
| 10476 | // no luck with suggested data |
| 10477 | return 0; |
| 10478 | } |
| 10479 | |
| 10480 | int ClntAuthBlock::ClientCrypt::getHashLength(Firebird::CheckStatusWrapper* status) |
| 10481 | { |