X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=src%2Ffilter_virt_db.cpp;h=b84e08753ef707962d80161aae0b6eae01dc6c31;hb=f1cc4b4b376376d19998f036e08cee76be3b7c54;hp=b58375730014b510646002dc31f3d0e15fe55290;hpb=50b8a2a1725e7552986efd893d9f9d0374749fd0;p=metaproxy-moved-to-github.git diff --git a/src/filter_virt_db.cpp b/src/filter_virt_db.cpp index b583757..b84e087 100644 --- a/src/filter_virt_db.cpp +++ b/src/filter_virt_db.cpp @@ -233,7 +233,7 @@ yf::VirtualDB::BackendPtr yf::VirtualDB::Frontend::init_backend( Z_GDU *gdu = init_package.response().get(); // we hope to get an init response - error_code = YAZ_BIB1_DATABASE_UNAVAILABLE; + error_code = 0; if (gdu && gdu->which == Z_GDU_Z3950 && gdu->u.z3950->which == Z_APDU_initResponse) { @@ -249,6 +249,13 @@ yf::VirtualDB::BackendPtr yf::VirtualDB::Frontend::init_backend( } mp::util::get_init_diagnostics(res, error_code, addinfo); } + if (error_code == 0) + { + std::list::const_iterator db_it = databases.begin(); + error_code = YAZ_BIB1_ACCESS_TO_SPECIFIED_DATABASE_DENIED; + if (db_it != databases.end()) + addinfo = *db_it; + } if (!init_package.session().is_closed()) { Package close_package(b->m_backend_session, package.origin()); @@ -262,7 +269,8 @@ yf::VirtualDB::BackendPtr yf::VirtualDB::Frontend::init_backend( void yf::VirtualDB::Frontend::search(mp::Package &package, Z_APDU *apdu_req) { - Z_SearchRequest *req = apdu_req->u.searchRequest; + yazpp_1::GDU ngdu(apdu_req); + Z_SearchRequest *req = ngdu.get()->u.z3950->u.searchRequest; std::string vhost; std::string resultSetId = req->resultSetName; mp::odr odr; @@ -351,8 +359,8 @@ void yf::VirtualDB::Frontend::search(mp::Package &package, Z_APDU *apdu_req) *req->replaceIndicator = 1; - search_package.request() = yazpp_1::GDU(apdu_req); - + search_package.request() = ngdu; + search_package.move(b->m_route); if (search_package.session().is_closed()) @@ -571,7 +579,8 @@ void yf::VirtualDB::Frontend::fixup_package(mp::Package &p, BackendPtr b) void yf::VirtualDB::Frontend::present(mp::Package &package, Z_APDU *apdu_req) { - Z_PresentRequest *req = apdu_req->u.presentRequest; + yazpp_1::GDU ngdu(apdu_req); + Z_PresentRequest *req = ngdu.get()->u.z3950->u.presentRequest; std::string resultSetId = req->resultSetId; mp::odr odr; @@ -595,7 +604,7 @@ void yf::VirtualDB::Frontend::present(mp::Package &package, Z_APDU *apdu_req) req->resultSetId = odr_strdup(odr, sets_it->second.m_setname.c_str()); - present_package.request() = yazpp_1::GDU(apdu_req); + present_package.request() = ngdu; present_package.move(sets_it->second.m_backend->m_route); @@ -637,7 +646,8 @@ int yf::VirtualDB::Frontend::relay_apdu(mp::Package &package, Z_APDU *apdu_req) void yf::VirtualDB::Frontend::scan(mp::Package &package, Z_APDU *apdu_req) { - Z_ScanRequest *req = apdu_req->u.scanRequest; + yazpp_1::GDU ngdu(apdu_req); + Z_ScanRequest *req = ngdu.get()->u.z3950->u.scanRequest; std::string vhost; mp::odr odr; @@ -688,7 +698,7 @@ void yf::VirtualDB::Frontend::scan(mp::Package &package, Z_APDU *apdu_req) &req->databaseNames); } - scan_package.request() = yazpp_1::GDU(apdu_req); + scan_package.request() = ngdu; scan_package.move(b->m_route);