| 7648 | } |
| 7649 | |
| 7650 | bool SrvAuthBlock::extractNewKeys(CSTRING* to, ULONG flags) |
| 7651 | { |
| 7652 | lastExtractedKeys.reset(); |
| 7653 | |
| 7654 | if (!(flags & ONLY_CLEANUP)) |
| 7655 | { |
| 7656 | for (unsigned n = 0; n < newKeys.getCount(); ++n) |
| 7657 | { |
| 7658 | const PathName& t = newKeys[n]->keyName; |
| 7659 | PathName plugins = knownCryptKeyTypes()[t]; |
| 7660 | if (plugins.hasData()) |
| 7661 | { |
| 7662 | lastExtractedKeys.insertString(TAG_KEY_TYPE, t); |
| 7663 | lastExtractedKeys.insertString(TAG_KEY_PLUGINS, plugins); |
| 7664 | |
| 7665 | if (port->port_protocol < PROTOCOL_VERSION16) |
| 7666 | continue; |
| 7667 | |
| 7668 | for (CryptKeyTypeManager::SpecificPlugins sp(knownCryptKeyTypes().getSpecific(t)); sp.hasData(); sp.next()) |
| 7669 | { |
| 7670 | PathName plugin = sp.get(); |
| 7671 | GetPlugins<IWireCryptPlugin> cp(IPluginManager::TYPE_WIRE_CRYPT, plugin.c_str()); |
| 7672 | fb_assert(cp.hasData()); |
| 7673 | if (cp.hasData()) |
| 7674 | { |
| 7675 | LocalStatus ls; |
| 7676 | CheckStatusWrapper st(&ls); |
| 7677 | unsigned l; |
| 7678 | const unsigned char* d = cp.plugin()->getSpecificData(&st, t.c_str(), &l); |
| 7679 | check(&st, isc_wish_list); |
| 7680 | if (d) |
| 7681 | { |
| 7682 | port->addSpecificData(t, plugin, l, d); |
| 7683 | |
| 7684 | plugin += '\0'; |
| 7685 | plugin.append(reinterpret_cast<const char*>(d), l); |
| 7686 | lastExtractedKeys.insertString(TAG_PLUGIN_SPECIFIC, plugin); |
| 7687 | } |
| 7688 | } |
| 7689 | } |
| 7690 | } |
| 7691 | } |
| 7692 | |
| 7693 | if ((flags & EXTRACT_PLUGINS_LIST) && (dataFromPlugin.getCount() == 0)) |
| 7694 | { |
| 7695 | lastExtractedKeys.insertString(TAG_KNOWN_PLUGINS, pluginList); |
| 7696 | } |
| 7697 | } |
| 7698 | |
| 7699 | to->cstr_length = (ULONG) lastExtractedKeys.getBufferLength(); |
| 7700 | to->cstr_address = const_cast<UCHAR*>(lastExtractedKeys.getBuffer()); |
| 7701 | to->cstr_allocated = 0; |
| 7702 | |
| 7703 | newKeys.clear(); // Very important - avoids sending same key type more than once |
| 7704 | |
| 7705 | return to->cstr_length > 0; |
| 7706 | } |
no test coverage detected