verifyDatabaseName @brief Verify database name for open/create against given in conf file list of available directories and security database name @param name @param status **/
| 8575 | |
| 8576 | **/ |
| 8577 | static VdnResult verifyDatabaseName(const PathName& name, FbStatusVector* status, bool is_alias) |
| 8578 | { |
| 8579 | // Check for securityX.fdb |
| 8580 | static GlobalPtr<PathName> securityNameBuffer, expandedSecurityNameBuffer; |
| 8581 | static GlobalPtr<Mutex> mutex; |
| 8582 | |
| 8583 | MutexLockGuard guard(mutex, FB_FUNCTION); |
| 8584 | |
| 8585 | if (!securityNameBuffer->hasData()) |
| 8586 | { |
| 8587 | const RefPtr<const Config> defConf(Config::getDefaultConfig()); |
| 8588 | securityNameBuffer->assign(defConf->getSecurityDatabase()); |
| 8589 | expandedSecurityNameBuffer->assign(securityNameBuffer); |
| 8590 | ISC_expand_filename(expandedSecurityNameBuffer, false); |
| 8591 | } |
| 8592 | |
| 8593 | if (name == securityNameBuffer || name == expandedSecurityNameBuffer) |
| 8594 | return VDN_OK; |
| 8595 | |
| 8596 | // Check for .conf |
| 8597 | if (!JRD_verify_database_access(name)) |
| 8598 | { |
| 8599 | if (!is_alias) { |
| 8600 | ERR_build_status(status, Arg::Gds(isc_conf_access_denied) << Arg::Str("database") << |
| 8601 | Arg::Str(name)); |
| 8602 | } |
| 8603 | return VDN_FAIL; |
| 8604 | } |
| 8605 | return VDN_OK; |
| 8606 | } |
| 8607 | |
| 8608 | |
| 8609 | /** |
no test coverage detected