| 208 | |
| 209 | |
| 210 | void SecurityDatabase::prepare(const char* secureDbName) |
| 211 | { |
| 212 | if (lookup_db) |
| 213 | { |
| 214 | return; |
| 215 | } |
| 216 | |
| 217 | #ifndef PLUG_MODULE |
| 218 | fb_shutdown_callback(status, shutdown, fb_shut_preproviders, 0); |
| 219 | #endif |
| 220 | |
| 221 | lookup_db = lookup_req = 0; |
| 222 | |
| 223 | // Perhaps build up a dpb |
| 224 | ClumpletWriter dpb(ClumpletReader::dpbList, MAX_DPB_SIZE); |
| 225 | |
| 226 | // Attachment is for the security database |
| 227 | dpb.insertByte(isc_dpb_sec_attach, TRUE); |
| 228 | |
| 229 | // Attach as SYSDBA |
| 230 | dpb.insertString(isc_dpb_trusted_auth, DBA_USER_NAME, fb_strlen(DBA_USER_NAME)); |
| 231 | |
| 232 | // Do not use loopback provider |
| 233 | dpb.insertString(isc_dpb_config, ParsedList::getNonLoopbackProviders(secureDbName)); |
| 234 | |
| 235 | isc_db_handle tempHandle = 0; |
| 236 | isc_attach_database(status, 0, secureDbName, &tempHandle, |
| 237 | dpb.getBufferLength(), reinterpret_cast<const char*>(dpb.getBuffer())); |
| 238 | checkStatus("isc_attach_database", isc_psw_attach); |
| 239 | lookup_db = tempHandle; |
| 240 | |
| 241 | isc_compile_request(status, &lookup_db, &lookup_req, sizeof(PWD_REQUEST), |
| 242 | reinterpret_cast<const char*>(PWD_REQUEST)); |
| 243 | if (status[1]) |
| 244 | { |
| 245 | ISC_STATUS_ARRAY localStatus; |
| 246 | // ignore status returned in order to keep first error |
| 247 | isc_detach_database(localStatus, &lookup_db); |
| 248 | } |
| 249 | |
| 250 | checkStatus("isc_compile_request", isc_psw_attach); |
| 251 | } |
| 252 | |
| 253 | void SecurityDatabase::checkStatus(const char* callName, ISC_STATUS userError) |
| 254 | { |
no test coverage detected