diff options
Diffstat (limited to 'indra/viewer_components')
-rw-r--r-- | indra/viewer_components/CMakeLists.txt | 1 | ||||
-rw-r--r-- | indra/viewer_components/login/CMakeLists.txt | 22 | ||||
-rw-r--r-- | indra/viewer_components/login/lllogin.cpp | 79 | ||||
-rw-r--r-- | indra/viewer_components/login/lllogin.h | 36 | ||||
-rw-r--r-- | indra/viewer_components/login/tests/lllogin_test.cpp | 23 |
5 files changed, 92 insertions, 69 deletions
diff --git a/indra/viewer_components/CMakeLists.txt b/indra/viewer_components/CMakeLists.txt index c95c854b7c..0993b64b14 100644 --- a/indra/viewer_components/CMakeLists.txt +++ b/indra/viewer_components/CMakeLists.txt @@ -1,5 +1,4 @@ # -*- cmake -*- add_subdirectory(login) -add_subdirectory(eventhost) diff --git a/indra/viewer_components/login/CMakeLists.txt b/indra/viewer_components/login/CMakeLists.txt index fb65779eb7..fe64926da6 100644 --- a/indra/viewer_components/login/CMakeLists.txt +++ b/indra/viewer_components/login/CMakeLists.txt @@ -3,7 +3,9 @@ project(login) include(00-Common) -include(LLAddBuildTest) +if(LL_TESTS) + include(LLAddBuildTest) +endif(LL_TESTS) include(LLCommon) include(LLMath) include(LLXML) @@ -43,14 +45,16 @@ target_link_libraries(lllogin ${PTH_LIBRARIES} ) -SET(lllogin_TEST_SOURCE_FILES +if(LL_TESTS) + SET(lllogin_TEST_SOURCE_FILES + lllogin.cpp + ) + + set_source_files_properties( lllogin.cpp + PROPERTIES + LL_TEST_ADDITIONAL_LIBRARIES "${PTH_LIBRARIES}" ) -set_source_files_properties( - lllogin.cpp - PROPERTIES - LL_TEST_ADDITIONAL_LIBRARIES "${PTH_LIBRARIES}" - ) - -LL_ADD_PROJECT_UNIT_TESTS(lllogin "${lllogin_TEST_SOURCE_FILES}") + LL_ADD_PROJECT_UNIT_TESTS(lllogin "${lllogin_TEST_SOURCE_FILES}") +endif(LL_TESTS) diff --git a/indra/viewer_components/login/lllogin.cpp b/indra/viewer_components/login/lllogin.cpp index b9f61ca7e1..651d803e0d 100644 --- a/indra/viewer_components/login/lllogin.cpp +++ b/indra/viewer_components/login/lllogin.cpp @@ -1,31 +1,25 @@ /** * @file lllogin.cpp * - * $LicenseInfo:firstyear=2009&license=viewergpl$ - * - * Copyright (c) 2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -122,29 +116,35 @@ private: LLSD mAuthResponse, mValidAuthResponse; }; -void LLLogin::Impl::connect(const std::string& uri, const LLSD& credentials) +void LLLogin::Impl::connect(const std::string& uri, const LLSD& login_params) { + LL_DEBUGS("LLLogin") << " connect with uri '" << uri << "', login_params " << login_params << LL_ENDL; + // Launch a coroutine with our login_() method. Run the coroutine until // its first wait; at that point, return here. std::string coroname = LLCoros::instance().launch("LLLogin::Impl::login_", - boost::bind(&Impl::login_, this, _1, uri, credentials)); + boost::bind(&Impl::login_, this, _1, uri, login_params)); + LL_DEBUGS("LLLogin") << " connected with uri '" << uri << "', login_params " << login_params << LL_ENDL; } -void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD credentials) +void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD login_params) { - LLSD printable_credentials = credentials; - if(printable_credentials.has("params") - && printable_credentials["params"].has("passwd")) + try { - printable_credentials["params"]["passwd"] = "*******"; - } + LLSD printable_params = login_params; + //if(printable_params.has("params") + // && printable_params["params"].has("passwd")) + //{ + // printable_params["params"]["passwd"] = "*******"; + //} LL_DEBUGS("LLLogin") << "Entering coroutine " << LLCoros::instance().getName(self) - << " with uri '" << uri << "', credentials " << printable_credentials << LL_ENDL; + << " with uri '" << uri << "', parameters " << printable_params << LL_ENDL; // Arriving in SRVRequest state LLEventStream replyPump("SRVreply", true); // Should be an array of one or more uri strings. + LLSD rewrittenURIs; { LLEventTimeout filter(replyPump); @@ -155,9 +155,9 @@ void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD credential // *NOTE:Mani - Completely arbitrary default timeout value for SRV request. F32 seconds_to_timeout = 5.0f; - if(credentials.has("cfg_srv_timeout")) + if(login_params.has("cfg_srv_timeout")) { - seconds_to_timeout = credentials["cfg_srv_timeout"].asReal(); + seconds_to_timeout = login_params["cfg_srv_timeout"].asReal(); } // If the SRV request times out (e.g. EXT-3934), simulate response: an @@ -167,9 +167,9 @@ void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD credential filter.eventAfter(seconds_to_timeout, fakeResponse); std::string srv_pump_name = "LLAres"; - if(credentials.has("cfg_srv_pump")) + if(login_params.has("cfg_srv_pump")) { - srv_pump_name = credentials["cfg_srv_pump"].asString(); + srv_pump_name = login_params["cfg_srv_pump"].asString(); } // Make request @@ -194,7 +194,7 @@ void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD credential urend(rewrittenURIs.endArray()); urit != urend; ++urit) { - LLSD request(credentials); + LLSD request(login_params); request["reply"] = loginReplyPump.getName(); request["uri"] = *urit; std::string status; @@ -291,8 +291,17 @@ void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD credential // to success, add a data/message and data/reason fields. LLSD error_response; error_response["reason"] = mAuthResponse["status"]; + error_response["errorcode"] = mAuthResponse["errorcode"]; error_response["message"] = mAuthResponse["error"]; + if(mAuthResponse.has("certificate")) + { + error_response["certificate"] = mAuthResponse["certificate"]; + } sendProgressEvent("offline", "fail.login", error_response); + } + catch (...) { + llerrs << "login exception caught" << llendl; + } } void LLLogin::Impl::disconnect() diff --git a/indra/viewer_components/login/lllogin.h b/indra/viewer_components/login/lllogin.h index 0598b4e457..051641ff59 100644 --- a/indra/viewer_components/login/lllogin.h +++ b/indra/viewer_components/login/lllogin.h @@ -1,31 +1,25 @@ /** * @file lllogin.h * - * $LicenseInfo:firstyear=2009&license=viewergpl$ - * - * Copyright (c) 2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/viewer_components/login/tests/lllogin_test.cpp b/indra/viewer_components/login/tests/lllogin_test.cpp index 51f5cd0692..95d0421273 100644 --- a/indra/viewer_components/login/tests/lllogin_test.cpp +++ b/indra/viewer_components/login/tests/lllogin_test.cpp @@ -4,8 +4,25 @@ * @date 2009-02-26 * @brief Tests of lllogin.cpp. * - * $LicenseInfo:firstyear=2009&license=internal$ - * Copyright (c) 2009, Linden Research, Inc. + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -209,7 +226,7 @@ namespace tut typedef test_group<llviewerlogin_data> llviewerlogin_group; typedef llviewerlogin_group::object llviewerlogin_object; - llviewerlogin_group llviewerlogingrp("llviewerlogin"); + llviewerlogin_group llviewerlogingrp("LLViewerLogin"); template<> template<> void llviewerlogin_object::test<1>() |