From: Adam Dickmeiss Date: Thu, 16 Aug 2012 07:14:30 +0000 (+0200) Subject: zoom: tweak diagnostics for Torus auth X-Git-Tag: v1.3.42~2 X-Git-Url: http://git.indexdata.com/?a=commitdiff_plain;h=581e7621e9664408aac1f0386f7d823f4906860c;p=metaproxy-moved-to-github.git zoom: tweak diagnostics for Torus auth If no result was found in Torus lookup and user&password was given, then return 'VInit/AC: Bad Userid and/or Password'. If lookup failed, and user/password was not given (IP auth in effect) return 'Init/AC: Blocked network address'. --- diff --git a/src/filter_zoom.cpp b/src/filter_zoom.cpp index 264fa5a..d7ca935 100644 --- a/src/filter_zoom.cpp +++ b/src/filter_zoom.cpp @@ -2481,11 +2481,13 @@ void yf::Zoom::Frontend::auth(mp::Package &package, Z_InitRequest *req, yaz_log(YLOG_LOG, "IP=%s", ip.c_str()); std::string torus_query; + int failure_code; if (user.length() && password.length()) { torus_query = "userName==\"" + escape_cql_term(user) + "\" and password==\"" + escape_cql_term(password) + "\""; + failure_code = YAZ_BIB1_INIT_AC_BAD_USERID_AND_OR_PASSWORD; } else { @@ -2497,6 +2499,7 @@ void yf::Zoom::Frontend::auth(mp::Package &package, Z_InitRequest *req, torus_query = "ip encloses/net.ipaddress \""; torus_query += escape_cql_term(std::string(ip_cstr)); torus_query += "\""; + failure_code = YAZ_BIB1_INIT_AC_BLOCKED_NETWORK_ADDRESS; } std::string dummy_db; @@ -2505,7 +2508,8 @@ void yf::Zoom::Frontend::auth(mp::Package &package, Z_InitRequest *req, torus_query, dummy_realm, m_p->proxy); if (!doc) { - *error = YAZ_BIB1_UNSPECIFIED_ERROR; + // something fundamental broken in lookup. + *error = YAZ_BIB1_TEMPORARY_SYSTEM_ERROR; *addinfo = odr_strdup(odr, "Torus server unavailable or " "incorrectly configured"); return; @@ -2541,7 +2545,7 @@ void yf::Zoom::Frontend::auth(mp::Package &package, Z_InitRequest *req, } if (!ptr) { - *error = YAZ_BIB1_INIT_AC_BAD_USERID_AND_OR_PASSWORD; + *error = failure_code; return; } session_realm = mp::xml::get_text(ptr);