X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Ffilter_zoom.cpp;h=df9fc04a96c2adba99c81e6cb893070b036f7e7b;hb=eb5b6a470cf2a4725ee734c9bb7baa9ba978853e;hp=5a4446912ddc1212e83e378fe9243cd95777743b;hpb=b57b6423aebc8f0aaeb4913f1a010e821dc6c456;p=metaproxy-moved-to-github.git diff --git a/src/filter_zoom.cpp b/src/filter_zoom.cpp index 5a44469..df9fc04 100644 --- a/src/filter_zoom.cpp +++ b/src/filter_zoom.cpp @@ -219,6 +219,7 @@ namespace metaproxy_1 { std::string torus_content_url; std::string torus_auth_url; std::string default_realm; + std::string torus_auth_hostname; std::map fieldmap; std::string xsldir; std::string file_path; @@ -778,6 +779,8 @@ void yf::Zoom::Impl::configure(const xmlNode *ptr, bool test_only, torus_auth_url = mp::xml::get_text(attr->children); else if (!strcmp((const char *) attr->name, "realm")) default_realm = mp::xml::get_text(attr->children); + else if (!strcmp((const char *) attr->name, "auth_hostname")) + torus_auth_hostname = mp::xml::get_text(attr->children); else if (!strcmp((const char *) attr->name, "xsldir")) xsldir = mp::xml::get_text(attr->children); else if (!strcmp((const char *) attr->name, "element_transform")) @@ -1732,8 +1735,19 @@ Z_Records *yf::Zoom::Frontend::get_records(mp::Package &package, if (!*error) { for (i = 0; i < number_to_present; i++) + { if (!recs[i]) break; + + const char *addinfo; + int sur_error = ZOOM_record_error(recs[i], 0 /* msg */, + &addinfo, 0 /* diagset */); + if (sur_error == + YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS && addinfo && + !strcmp(addinfo, + "ZOOM C generated. Present phase and no records")) + break; + } } if (i > 0) { // only return records if no error and at least one record @@ -1764,7 +1778,7 @@ Z_Records *yf::Zoom::Frontend::get_records(mp::Package &package, npl->num_records = i; npl->records = (Z_NamePlusRecord **) odr_malloc(odr, i * sizeof(*npl->records)); - for (i = 0; i < number_to_present; i++) + for (i = 0; i < npl->num_records; i++) { Z_NamePlusRecord *npr = 0; const char *addinfo; @@ -2629,9 +2643,16 @@ void yf::Zoom::Frontend::auth(mp::Package &package, Z_InitRequest *req, } else { - torus_query = "ip encloses/net.ipaddress \""; + torus_query = "ipRanges encloses/net.ipaddress \""; torus_query += escape_cql_term(std::string(ip)); torus_query += "\""; + + if (m_p->torus_auth_hostname.length()) + { + torus_query += " AND hostName == \""; + torus_query += escape_cql_term(m_p->torus_auth_hostname); + torus_query += "\""; + } failure_code = YAZ_BIB1_INIT_AC_BLOCKED_NETWORK_ADDRESS; }