| 1121 | typedef Firebird::GetPlugins<Firebird::IServer> AuthServerPlugins; |
| 1122 | |
| 1123 | class SrvAuthBlock final : |
| 1124 | public Firebird::VersionedIface<Firebird::IServerBlockImpl<SrvAuthBlock, Firebird::CheckStatusWrapper> >, |
| 1125 | public Firebird::GlobalStorage |
| 1126 | { |
| 1127 | private: |
| 1128 | rem_port* port; |
| 1129 | Firebird::string userName; |
| 1130 | Firebird::PathName pluginName, pluginList; |
| 1131 | // These two may be legacy encrypted password, trusted auth data and so on |
| 1132 | Firebird::UCharBuffer dataForPlugin, dataFromPlugin; |
| 1133 | Firebird::ClumpletWriter lastExtractedKeys; |
| 1134 | Firebird::HalfStaticArray<InternalCryptKey*, 8> newKeys; |
| 1135 | bool flComplete, firstTime; |
| 1136 | |
| 1137 | public: |
| 1138 | AuthServerPlugins* plugins; |
| 1139 | Auth::WriterImplementation authBlockWriter; |
| 1140 | |
| 1141 | // extractNewKeys flags |
| 1142 | static const ULONG EXTRACT_PLUGINS_LIST = 0x1; |
| 1143 | static const ULONG ONLY_CLEANUP = 0x2; |
| 1144 | |
| 1145 | explicit SrvAuthBlock(rem_port* p_port) |
| 1146 | : port(p_port), |
| 1147 | userName(getPool()), pluginName(getPool()), pluginList(getPool()), |
| 1148 | dataForPlugin(getPool()), dataFromPlugin(getPool()), |
| 1149 | lastExtractedKeys(getPool(), Firebird::ClumpletReader::UnTagged, MAX_DPB_SIZE), |
| 1150 | newKeys(getPool()), |
| 1151 | flComplete(false), firstTime(true), |
| 1152 | plugins(NULL) |
| 1153 | { |
| 1154 | } |
| 1155 | |
| 1156 | ~SrvAuthBlock() |
| 1157 | { |
| 1158 | delete plugins; |
| 1159 | } |
| 1160 | |
| 1161 | void extractDataFromPluginTo(cstring* to); |
| 1162 | void extractDataFromPluginTo(P_AUTH_CONT* to); |
| 1163 | void extractDataFromPluginTo(P_ACPD* to); |
| 1164 | bool authCompleted(bool flag = false); |
| 1165 | void setLogin(const Firebird::string& user); |
| 1166 | void load(Firebird::ClumpletReader& userId); |
| 1167 | const char* getPluginName(); |
| 1168 | void setPluginList(const Firebird::string& name); |
| 1169 | const char* getPluginList(); |
| 1170 | void setPluginName(const Firebird::string& name); |
| 1171 | void extractPluginName(cstring* to); |
| 1172 | void setDataForPlugin(const Firebird::UCharBuffer& data); |
| 1173 | void setDataForPlugin(const cstring& data); |
| 1174 | void createPluginsItr(); |
| 1175 | void setDataForPlugin(const p_auth_continue* data); |
| 1176 | void reset(); |
| 1177 | bool extractNewKeys(CSTRING* to, ULONG flags); |
| 1178 | bool hasDataForPlugin(); |
| 1179 | |
| 1180 | // Firebird::IServerBlock implementation |
no outgoing calls
no test coverage detected