| 7566 | } |
| 7567 | |
| 7568 | void SrvAuthBlock::createPluginsItr() |
| 7569 | { |
| 7570 | if (firstTime || plugins) |
| 7571 | { |
| 7572 | return; |
| 7573 | } |
| 7574 | |
| 7575 | ParsedList fromClient(pluginList); |
| 7576 | ParsedList onServer(port->getPortConfig()->getPlugins(IPluginManager::TYPE_AUTH_SERVER)); |
| 7577 | ParsedList final; |
| 7578 | |
| 7579 | for (unsigned s = 0; s < onServer.getCount(); ++s) |
| 7580 | { |
| 7581 | // do not expect too long lists, therefore use double loop |
| 7582 | for (unsigned c = 0; c < fromClient.getCount(); ++c) |
| 7583 | { |
| 7584 | if (onServer[s] == fromClient[c]) |
| 7585 | { |
| 7586 | final.push(onServer[s]); |
| 7587 | } |
| 7588 | } |
| 7589 | } |
| 7590 | |
| 7591 | if (final.getCount() == 0) |
| 7592 | { |
| 7593 | HANDSHAKE_DEBUG(fprintf(stderr, "Srv: createPluginsItr: No matching plugins on server\n")); |
| 7594 | |
| 7595 | Arg::Gds loginError(isc_login_error); |
| 7596 | #ifdef DEV_BUILD |
| 7597 | loginError << Arg::Gds(isc_random) << "No matching plugins on server"; |
| 7598 | #endif |
| 7599 | gds__log("Authentication error\n\tNo matching plugins on server"); |
| 7600 | loginError.raise(); |
| 7601 | } |
| 7602 | |
| 7603 | // reorder to make it match first, already passed, plugin data |
| 7604 | for (unsigned f = 1; f < final.getCount(); ++f) |
| 7605 | { |
| 7606 | if (final[f] == pluginName) |
| 7607 | { |
| 7608 | final[f] = final[0]; |
| 7609 | final[0] = pluginName; |
| 7610 | break; |
| 7611 | } |
| 7612 | } |
| 7613 | |
| 7614 | // special case - last plugin from the list on the server may be used to check |
| 7615 | // correctness of what previous plugins added to auth parameters block |
| 7616 | bool multiFactor = true; |
| 7617 | for (unsigned sp = 0; sp < final.getCount(); ++sp) |
| 7618 | { |
| 7619 | if (final[sp] == onServer[onServer.getCount() - 1]) |
| 7620 | { |
| 7621 | multiFactor = false; |
| 7622 | break; |
| 7623 | } |
| 7624 | } |
| 7625 | if (multiFactor) |
no test coverage detected