From ada737df8a221496581267f17f011e0c7c26d2fb Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 10 Feb 2015 14:05:56 +0100 Subject: [PATCH] zoom: allow / in user and password db args MP-592 --- src/filter_zoom.cpp | 46 +++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/src/filter_zoom.cpp b/src/filter_zoom.cpp index 755b17e..67eb01e 100644 --- a/src/filter_zoom.cpp +++ b/src/filter_zoom.cpp @@ -1140,8 +1140,6 @@ yf::Zoom::BackendPtr yf::Zoom::Frontend::get_backend_from_databases( else torus_db = database; - std::string authentication; - std::string content_authentication; std::string content_proxy; std::string realm = session_realm; if (realm.length() == 0) @@ -1256,19 +1254,6 @@ yf::Zoom::BackendPtr yf::Zoom::Frontend::get_backend_from_databases( return m_backend; } - if (param_user) - { - authentication = std::string(param_user); - if (param_password) - authentication += "/" + std::string(param_password); - } - if (param_content_user) - { - content_authentication = std::string(param_content_user); - if (param_content_password) - content_authentication += "/" + std::string(param_content_password); - } - if (torus_db.compare("IR-Explain---1") == 0) return explain_search(package, database, error, addinfo, odr, torus_url, torus_db, realm); @@ -1470,11 +1455,20 @@ yf::Zoom::BackendPtr yf::Zoom::Frontend::get_backend_from_databases( maximumRecords > 0 */ b->set_option("piggyback", sptr->piggyback ? "1" : "0"); - if (content_authentication.length() == 0) - content_authentication = sptr->contentAuthentication; - - if (authentication.length() == 0) - authentication = sptr->authentication; + std::string authentication = sptr->authentication; + if (param_user) + { + authentication = std::string(param_user); + if (param_password) + authentication += "/" + std::string(param_password); + } + std::string content_authentication = sptr->contentAuthentication; + if (param_content_user) + { + content_authentication = std::string(param_content_user); + if (param_content_password) + content_authentication += "/" + std::string(param_content_password); + } if (proxy.length() == 0) proxy = sptr->cfProxy; @@ -1484,7 +1478,17 @@ yf::Zoom::BackendPtr yf::Zoom::Frontend::get_backend_from_databases( { // A CF target b->set_option("user", sptr->cfAuth); - if (authentication.length()) + if (param_user) + { + out_names[no_out_args] = "user"; + out_values[no_out_args++] = odr_strdup(odr, param_user); + if (param_password) + { + out_names[no_out_args] = "password"; + out_values[no_out_args++] = odr_strdup(odr, param_password); + } + } + else if (authentication.length()) { size_t found = authentication.find('/'); if (found != std::string::npos) -- 1.7.10.4