diff options
author | MW | 2007-06-28 11:26:22 +0000 |
---|---|---|
committer | MW | 2007-06-28 11:26:22 +0000 |
commit | 1aca39a7a6148e77bc75b912ec7da5d4ed6fe427 (patch) | |
tree | 2fc3441d0357d80b6827bec32e740c21c0ba6e6b | |
parent | * Run prebuild, and stuff. (Fixed bug) (diff) | |
download | opensim-SC-1aca39a7a6148e77bc75b912ec7da5d4ed6fe427.zip opensim-SC-1aca39a7a6148e77bc75b912ec7da5d4ed6fe427.tar.gz opensim-SC-1aca39a7a6148e77bc75b912ec7da5d4ed6fe427.tar.bz2 opensim-SC-1aca39a7a6148e77bc75b912ec7da5d4ed6fe427.tar.xz |
Deleted some files that are no longer in use. (I am sure I deleted these yesterday but they seem to have returned).
-rw-r--r-- | Common/OpenSim.Framework/OpenSim.Framework.csproj | 43 | ||||
-rw-r--r-- | Common/OpenSim.Framework/UserProfileManager.cs | 299 | ||||
-rw-r--r-- | Common/OpenSim.Framework/UserProfileManagerBase.cs | 151 | ||||
-rw-r--r-- | Common/OpenSim.Servers/LocalUserProfileManager.cs | 124 | ||||
-rw-r--r-- | Common/OpenSim.Servers/LoginResponse.cs | 655 | ||||
-rw-r--r-- | Common/OpenSim.Servers/LoginServer.cs | 258 | ||||
-rw-r--r-- | Common/OpenSim.Servers/OpenSim.Servers.csproj | 46 |
7 files changed, 44 insertions, 1532 deletions
diff --git a/Common/OpenSim.Framework/OpenSim.Framework.csproj b/Common/OpenSim.Framework/OpenSim.Framework.csproj index 3b938cb..7ebe0ee 100644 --- a/Common/OpenSim.Framework/OpenSim.Framework.csproj +++ b/Common/OpenSim.Framework/OpenSim.Framework.csproj | |||
@@ -1,4 +1,4 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | 1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
2 | <PropertyGroup> | 2 | <PropertyGroup> |
3 | <ProjectType>Local</ProjectType> | 3 | <ProjectType>Local</ProjectType> |
4 | <ProductVersion>8.0.50727</ProductVersion> | 4 | <ProductVersion>8.0.50727</ProductVersion> |
@@ -6,7 +6,8 @@ | |||
6 | <ProjectGuid>{8ACA2445-0000-0000-0000-000000000000}</ProjectGuid> | 6 | <ProjectGuid>{8ACA2445-0000-0000-0000-000000000000}</ProjectGuid> |
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | 7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | 8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
9 | <ApplicationIcon></ApplicationIcon> | 9 | <ApplicationIcon> |
10 | </ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | 11 | <AssemblyKeyContainerName> |
11 | </AssemblyKeyContainerName> | 12 | </AssemblyKeyContainerName> |
12 | <AssemblyName>OpenSim.Framework</AssemblyName> | 13 | <AssemblyName>OpenSim.Framework</AssemblyName> |
@@ -15,9 +16,11 @@ | |||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | 16 | <DefaultTargetSchema>IE50</DefaultTargetSchema> |
16 | <DelaySign>false</DelaySign> | 17 | <DelaySign>false</DelaySign> |
17 | <OutputType>Library</OutputType> | 18 | <OutputType>Library</OutputType> |
18 | <AppDesignerFolder></AppDesignerFolder> | 19 | <AppDesignerFolder> |
20 | </AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.Framework</RootNamespace> | 21 | <RootNamespace>OpenSim.Framework</RootNamespace> |
20 | <StartupObject></StartupObject> | 22 | <StartupObject> |
23 | </StartupObject> | ||
21 | <FileUpgradeFlags> | 24 | <FileUpgradeFlags> |
22 | </FileUpgradeFlags> | 25 | </FileUpgradeFlags> |
23 | </PropertyGroup> | 26 | </PropertyGroup> |
@@ -28,7 +31,8 @@ | |||
28 | <ConfigurationOverrideFile> | 31 | <ConfigurationOverrideFile> |
29 | </ConfigurationOverrideFile> | 32 | </ConfigurationOverrideFile> |
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | 33 | <DefineConstants>TRACE;DEBUG</DefineConstants> |
31 | <DocumentationFile></DocumentationFile> | 34 | <DocumentationFile> |
35 | </DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | 36 | <DebugSymbols>True</DebugSymbols> |
33 | <FileAlignment>4096</FileAlignment> | 37 | <FileAlignment>4096</FileAlignment> |
34 | <Optimize>False</Optimize> | 38 | <Optimize>False</Optimize> |
@@ -37,7 +41,8 @@ | |||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | 41 | <RemoveIntegerChecks>False</RemoveIntegerChecks> |
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | 42 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
39 | <WarningLevel>4</WarningLevel> | 43 | <WarningLevel>4</WarningLevel> |
40 | <NoWarn></NoWarn> | 44 | <NoWarn> |
45 | </NoWarn> | ||
41 | </PropertyGroup> | 46 | </PropertyGroup> |
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | 47 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | 48 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
@@ -46,7 +51,8 @@ | |||
46 | <ConfigurationOverrideFile> | 51 | <ConfigurationOverrideFile> |
47 | </ConfigurationOverrideFile> | 52 | </ConfigurationOverrideFile> |
48 | <DefineConstants>TRACE</DefineConstants> | 53 | <DefineConstants>TRACE</DefineConstants> |
49 | <DocumentationFile></DocumentationFile> | 54 | <DocumentationFile> |
55 | </DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | 56 | <DebugSymbols>False</DebugSymbols> |
51 | <FileAlignment>4096</FileAlignment> | 57 | <FileAlignment>4096</FileAlignment> |
52 | <Optimize>True</Optimize> | 58 | <Optimize>True</Optimize> |
@@ -55,22 +61,23 @@ | |||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | 61 | <RemoveIntegerChecks>False</RemoveIntegerChecks> |
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | 62 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
57 | <WarningLevel>4</WarningLevel> | 63 | <WarningLevel>4</WarningLevel> |
58 | <NoWarn></NoWarn> | 64 | <NoWarn> |
65 | </NoWarn> | ||
59 | </PropertyGroup> | 66 | </PropertyGroup> |
60 | <ItemGroup> | 67 | <ItemGroup> |
61 | <Reference Include="Db4objects.Db4o.dll" > | 68 | <Reference Include="Db4objects.Db4o.dll"> |
62 | <HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath> | 69 | <HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath> |
63 | <Private>False</Private> | 70 | <Private>False</Private> |
64 | </Reference> | 71 | </Reference> |
65 | <Reference Include="libsecondlife.dll" > | 72 | <Reference Include="libsecondlife.dll"> |
66 | <HintPath>..\..\bin\libsecondlife.dll</HintPath> | 73 | <HintPath>..\..\bin\libsecondlife.dll</HintPath> |
67 | <Private>False</Private> | 74 | <Private>False</Private> |
68 | </Reference> | 75 | </Reference> |
69 | <Reference Include="System" > | 76 | <Reference Include="System"> |
70 | <HintPath>System.dll</HintPath> | 77 | <HintPath>System.dll</HintPath> |
71 | <Private>False</Private> | 78 | <Private>False</Private> |
72 | </Reference> | 79 | </Reference> |
73 | <Reference Include="System.Xml" > | 80 | <Reference Include="System.Xml"> |
74 | <HintPath>System.Xml.dll</HintPath> | 81 | <HintPath>System.Xml.dll</HintPath> |
75 | <Private>False</Private> | 82 | <Private>False</Private> |
76 | </Reference> | 83 | </Reference> |
@@ -80,13 +87,13 @@ | |||
80 | <Name>OpenSim.Framework.Console</Name> | 87 | <Name>OpenSim.Framework.Console</Name> |
81 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> | 88 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> |
82 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 89 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
83 | <Private>False</Private> | 90 | <Private>False</Private> |
84 | </ProjectReference> | 91 | </ProjectReference> |
85 | <ProjectReference Include="..\XmlRpcCS\XMLRPC.csproj"> | 92 | <ProjectReference Include="..\XmlRpcCS\XMLRPC.csproj"> |
86 | <Name>XMLRPC</Name> | 93 | <Name>XMLRPC</Name> |
87 | <Project>{8E81D43C-0000-0000-0000-000000000000}</Project> | 94 | <Project>{8E81D43C-0000-0000-0000-000000000000}</Project> |
88 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 95 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
89 | <Private>False</Private> | 96 | <Private>False</Private> |
90 | </ProjectReference> | 97 | </ProjectReference> |
91 | </ItemGroup> | 98 | </ItemGroup> |
92 | <ItemGroup> | 99 | <ItemGroup> |
@@ -123,12 +130,6 @@ | |||
123 | <Compile Include="UserProfile.cs"> | 130 | <Compile Include="UserProfile.cs"> |
124 | <SubType>Code</SubType> | 131 | <SubType>Code</SubType> |
125 | </Compile> | 132 | </Compile> |
126 | <Compile Include="UserProfileManager.cs"> | ||
127 | <SubType>Code</SubType> | ||
128 | </Compile> | ||
129 | <Compile Include="UserProfileManagerBase.cs"> | ||
130 | <SubType>Code</SubType> | ||
131 | </Compile> | ||
132 | <Compile Include="Util.cs"> | 133 | <Compile Include="Util.cs"> |
133 | <SubType>Code</SubType> | 134 | <SubType>Code</SubType> |
134 | </Compile> | 135 | </Compile> |
@@ -218,4 +219,4 @@ | |||
218 | <PostBuildEvent> | 219 | <PostBuildEvent> |
219 | </PostBuildEvent> | 220 | </PostBuildEvent> |
220 | </PropertyGroup> | 221 | </PropertyGroup> |
221 | </Project> | 222 | </Project> \ No newline at end of file |
diff --git a/Common/OpenSim.Framework/UserProfileManager.cs b/Common/OpenSim.Framework/UserProfileManager.cs deleted file mode 100644 index 64e830f..0000000 --- a/Common/OpenSim.Framework/UserProfileManager.cs +++ /dev/null | |||
@@ -1,299 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Collections; | ||
31 | using System.Text; | ||
32 | using System.Text.RegularExpressions; | ||
33 | using System.Xml; | ||
34 | using libsecondlife; | ||
35 | using Nwc.XmlRpc; | ||
36 | using OpenSim.Framework.Sims; | ||
37 | using OpenSim.Framework.Inventory; | ||
38 | using OpenSim.Framework.Utilities; | ||
39 | |||
40 | namespace OpenSim.Framework.User | ||
41 | { | ||
42 | public class UserProfileManager : UserProfileManagerBase | ||
43 | { | ||
44 | public string GridURL; | ||
45 | public string GridSendKey; | ||
46 | public string GridRecvKey; | ||
47 | public string DefaultStartupMsg; | ||
48 | |||
49 | public UserProfileManager() | ||
50 | { | ||
51 | |||
52 | } | ||
53 | |||
54 | public void SetKeys(string sendKey, string recvKey, string url, string message) | ||
55 | { | ||
56 | GridRecvKey = recvKey; | ||
57 | GridSendKey = sendKey; | ||
58 | GridURL = url; | ||
59 | DefaultStartupMsg = message; | ||
60 | } | ||
61 | |||
62 | public virtual string ParseXMLRPC(string requestBody) | ||
63 | { | ||
64 | |||
65 | XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody); | ||
66 | |||
67 | switch (request.MethodName) | ||
68 | { | ||
69 | case "login_to_simulator": | ||
70 | XmlRpcResponse response = XmlRpcLoginMethod(request); | ||
71 | |||
72 | return (Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(response), "utf-16", "utf-8")); | ||
73 | } | ||
74 | |||
75 | return ""; | ||
76 | } | ||
77 | |||
78 | public string RestDeleteUserSessionMethod( string request, string path, string param ) | ||
79 | { | ||
80 | LLUUID sessionid = new LLUUID(param); // get usersessions/sessionid | ||
81 | foreach (libsecondlife.LLUUID UUID in UserProfiles.Keys) | ||
82 | { | ||
83 | if ( UserProfiles[UUID].CurrentSessionID == sessionid) | ||
84 | { | ||
85 | UserProfiles[UUID].CurrentSessionID = null; | ||
86 | UserProfiles[UUID].CurrentSecureSessionID = null; | ||
87 | UserProfiles[UUID].Circuits.Clear(); | ||
88 | } | ||
89 | } | ||
90 | |||
91 | return "OK"; | ||
92 | } | ||
93 | |||
94 | public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) | ||
95 | { | ||
96 | XmlRpcResponse response = new XmlRpcResponse(); | ||
97 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
98 | |||
99 | bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd")); | ||
100 | bool GoodLogin = false; | ||
101 | string firstname = ""; | ||
102 | string lastname = ""; | ||
103 | string passwd = ""; | ||
104 | |||
105 | if (GoodXML) | ||
106 | { | ||
107 | firstname = (string)requestData["first"]; | ||
108 | lastname = (string)requestData["last"]; | ||
109 | passwd = (string)requestData["passwd"]; | ||
110 | GoodLogin = AuthenticateUser(firstname, lastname, passwd); | ||
111 | } | ||
112 | |||
113 | |||
114 | if (!(GoodXML && GoodLogin)) | ||
115 | { | ||
116 | response = CreateErrorConnectingToGridResponse(); | ||
117 | } | ||
118 | else | ||
119 | { | ||
120 | UserProfile TheUser = GetProfileByName(firstname, lastname); | ||
121 | //we need to sort out how sessions are logged out , currently the sim tells the gridserver | ||
122 | //but if as this suggests the userserver handles it then please have the sim telling the userserver instead | ||
123 | //as it really makes things messy for sandbox mode | ||
124 | //if (!((TheUser.CurrentSessionID == null) && (TheUser.CurrentSecureSessionID == null))) | ||
125 | // { | ||
126 | // response = CreateAlreadyLoggedInResponse(); | ||
127 | // } | ||
128 | //else | ||
129 | //{ | ||
130 | try | ||
131 | { | ||
132 | Hashtable responseData = new Hashtable(); | ||
133 | |||
134 | LLUUID AgentID = TheUser.UUID; | ||
135 | TheUser.InitSessionData(); | ||
136 | |||
137 | //for loading data from a grid server, make any changes in CustomiseResponse() (or create a sub class of this and override that method) | ||
138 | //SimProfile SimInfo = new SimProfile(); | ||
139 | //SimInfo = SimInfo.LoadFromGrid(TheUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey); | ||
140 | |||
141 | |||
142 | Hashtable GlobalT = new Hashtable(); | ||
143 | GlobalT["sun_texture_id"] = "cce0f112-878f-4586-a2e2-a8f104bba271"; | ||
144 | GlobalT["cloud_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; | ||
145 | GlobalT["moon_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; | ||
146 | ArrayList GlobalTextures = new ArrayList(); | ||
147 | GlobalTextures.Add(GlobalT); | ||
148 | |||
149 | Hashtable LoginFlagsHash = new Hashtable(); | ||
150 | LoginFlagsHash["daylight_savings"] = "N"; | ||
151 | LoginFlagsHash["stipend_since_login"] = "N"; | ||
152 | LoginFlagsHash["gendered"] = "Y"; | ||
153 | LoginFlagsHash["ever_logged_in"] = "Y"; | ||
154 | ArrayList LoginFlags = new ArrayList(); | ||
155 | LoginFlags.Add(LoginFlagsHash); | ||
156 | |||
157 | Hashtable uiconfig = new Hashtable(); | ||
158 | uiconfig["allow_first_life"] = "Y"; | ||
159 | ArrayList ui_config = new ArrayList(); | ||
160 | ui_config.Add(uiconfig); | ||
161 | |||
162 | Hashtable ClassifiedCategoriesHash = new Hashtable(); | ||
163 | ClassifiedCategoriesHash["category_name"] = "bla bla"; | ||
164 | ClassifiedCategoriesHash["category_id"] = (Int32)1; | ||
165 | ArrayList ClassifiedCategories = new ArrayList(); | ||
166 | ClassifiedCategories.Add(ClassifiedCategoriesHash); | ||
167 | |||
168 | ArrayList AgentInventory = new ArrayList(); | ||
169 | System.Console.WriteLine("adding inventory to response"); | ||
170 | Hashtable TempHash; | ||
171 | foreach (InventoryFolder InvFolder in TheUser.Inventory.InventoryFolders.Values) | ||
172 | { | ||
173 | TempHash = new Hashtable(); | ||
174 | System.Console.WriteLine("adding folder " + InvFolder.FolderName + ", ID: " + InvFolder.FolderID.ToStringHyphenated() + " with parent: " + InvFolder.ParentID.ToStringHyphenated()); | ||
175 | TempHash["name"] = InvFolder.FolderName; | ||
176 | TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); | ||
177 | TempHash["version"] = (Int32)InvFolder.Version; | ||
178 | TempHash["type_default"] = (Int32)InvFolder.DefaultType; | ||
179 | TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); | ||
180 | AgentInventory.Add(TempHash); | ||
181 | } | ||
182 | |||
183 | Hashtable InventoryRootHash = new Hashtable(); | ||
184 | InventoryRootHash["folder_id"] = TheUser.Inventory.InventoryRoot.FolderID.ToStringHyphenated(); | ||
185 | ArrayList InventoryRoot = new ArrayList(); | ||
186 | InventoryRoot.Add(InventoryRootHash); | ||
187 | |||
188 | Hashtable InitialOutfitHash = new Hashtable(); | ||
189 | InitialOutfitHash["folder_name"] = "Nightclub Female"; | ||
190 | InitialOutfitHash["gender"] = "female"; | ||
191 | ArrayList InitialOutfit = new ArrayList(); | ||
192 | InitialOutfit.Add(InitialOutfitHash); | ||
193 | |||
194 | uint circode = (uint)(Util.RandomClass.Next()); | ||
195 | //TheUser.AddSimCircuit(circode, SimInfo.UUID); | ||
196 | |||
197 | responseData["last_name"] = TheUser.lastname; | ||
198 | responseData["ui-config"] = ui_config; | ||
199 | responseData["sim_ip"] = "127.0.0.1"; //SimInfo.sim_ip.ToString(); | ||
200 | responseData["login-flags"] = LoginFlags; | ||
201 | responseData["global-textures"] = GlobalTextures; | ||
202 | responseData["classified_categories"] = ClassifiedCategories; | ||
203 | responseData["event_categories"] = new ArrayList(); | ||
204 | responseData["inventory-skeleton"] = AgentInventory; | ||
205 | responseData["inventory-skel-lib"] = new ArrayList(); | ||
206 | responseData["inventory-root"] = InventoryRoot; | ||
207 | responseData["event_notifications"] = new ArrayList(); | ||
208 | responseData["gestures"] = new ArrayList(); | ||
209 | responseData["inventory-lib-owner"] = new ArrayList(); | ||
210 | responseData["initial-outfit"] = InitialOutfit; | ||
211 | responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | ||
212 | responseData["start_location"] = "last"; | ||
213 | responseData["home"] = "{'region_handle':[r" + (0 * 256).ToString() + ",r" + (0 * 256).ToString() + "], 'position':[r" + TheUser.homepos.X.ToString() + ",r" + TheUser.homepos.Y.ToString() + ",r" + TheUser.homepos.Z.ToString() + "], 'look_at':[r" + TheUser.homelookat.X.ToString() + ",r" + TheUser.homelookat.Y.ToString() + ",r" + TheUser.homelookat.Z.ToString() + "]}"; | ||
214 | responseData["message"] = DefaultStartupMsg; | ||
215 | responseData["first_name"] = TheUser.firstname; | ||
216 | responseData["circuit_code"] = (Int32)circode; | ||
217 | responseData["sim_port"] = 0; //(Int32)SimInfo.sim_port; | ||
218 | responseData["secure_session_id"] = TheUser.CurrentSecureSessionID.ToStringHyphenated(); | ||
219 | responseData["look_at"] = "\n[r" + TheUser.homelookat.X.ToString() + ",r" + TheUser.homelookat.Y.ToString() + ",r" + TheUser.homelookat.Z.ToString() + "]\n"; | ||
220 | responseData["agent_id"] = AgentID.ToStringHyphenated(); | ||
221 | responseData["region_y"] = (Int32)0 * 256; // (Int32)SimInfo.RegionLocY * 256; | ||
222 | responseData["region_x"] = (Int32)0 * 256; //SimInfo.RegionLocX * 256; | ||
223 | responseData["seed_capability"] = ""; | ||
224 | responseData["agent_access"] = "M"; | ||
225 | responseData["session_id"] = TheUser.CurrentSessionID.ToStringHyphenated(); | ||
226 | responseData["login"] = "true"; | ||
227 | |||
228 | this.CustomiseResponse(ref responseData, TheUser); | ||
229 | response.Value = responseData; | ||
230 | // TheUser.SendDataToSim(SimInfo); | ||
231 | return response; | ||
232 | |||
233 | } | ||
234 | catch (Exception E) | ||
235 | { | ||
236 | System.Console.WriteLine(E.ToString()); | ||
237 | } | ||
238 | //} | ||
239 | } | ||
240 | return response; | ||
241 | |||
242 | } | ||
243 | |||
244 | private static XmlRpcResponse CreateErrorConnectingToGridResponse() | ||
245 | { | ||
246 | XmlRpcResponse response = new XmlRpcResponse(); | ||
247 | Hashtable ErrorRespData = new Hashtable(); | ||
248 | ErrorRespData["reason"] = "key"; | ||
249 | ErrorRespData["message"] = "Error connecting to grid. Please double check your login details and check with the grid owner if you are sure these are correct"; | ||
250 | ErrorRespData["login"] = "false"; | ||
251 | response.Value = ErrorRespData; | ||
252 | return response; | ||
253 | } | ||
254 | |||
255 | private static XmlRpcResponse CreateAlreadyLoggedInResponse() | ||
256 | { | ||
257 | XmlRpcResponse response = new XmlRpcResponse(); | ||
258 | Hashtable PresenceErrorRespData = new Hashtable(); | ||
259 | PresenceErrorRespData["reason"] = "presence"; | ||
260 | PresenceErrorRespData["message"] = "You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner"; | ||
261 | PresenceErrorRespData["login"] = "false"; | ||
262 | response.Value = PresenceErrorRespData; | ||
263 | return response; | ||
264 | } | ||
265 | |||
266 | public virtual void CustomiseResponse(ref Hashtable response, UserProfile theUser) | ||
267 | { | ||
268 | //default method set up to act as ogs user server | ||
269 | SimProfile SimInfo= new SimProfile(); | ||
270 | //get siminfo from grid server | ||
271 | SimInfo = SimInfo.LoadFromGrid(theUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey); | ||
272 | Int32 circode = (Int32)Convert.ToUInt32(response["circuit_code"]); | ||
273 | theUser.AddSimCircuit((uint)circode, SimInfo.UUID); | ||
274 | response["home"] = "{'region_handle':[r" + (SimInfo.RegionLocX * 256).ToString() + ",r" + (SimInfo.RegionLocY * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}"; | ||
275 | response["sim_ip"] = SimInfo.sim_ip; | ||
276 | response["sim_port"] = (Int32)SimInfo.sim_port; | ||
277 | response["region_y"] = (Int32)SimInfo.RegionLocY * 256; | ||
278 | response["region_x"] = (Int32)SimInfo.RegionLocX * 256; | ||
279 | |||
280 | //default is ogs user server, so let the sim know about the user via a XmlRpcRequest | ||
281 | System.Console.WriteLine(SimInfo.caps_url); | ||
282 | Hashtable SimParams = new Hashtable(); | ||
283 | SimParams["session_id"] = theUser.CurrentSessionID.ToString(); | ||
284 | SimParams["secure_session_id"] = theUser.CurrentSecureSessionID.ToString(); | ||
285 | SimParams["firstname"] = theUser.firstname; | ||
286 | SimParams["lastname"] = theUser.lastname; | ||
287 | SimParams["agent_id"] = theUser.UUID.ToString(); | ||
288 | SimParams["circuit_code"] = (Int32)circode; | ||
289 | SimParams["startpos_x"] = theUser.homepos.X.ToString(); | ||
290 | SimParams["startpos_y"] = theUser.homepos.Y.ToString(); | ||
291 | SimParams["startpos_z"] = theUser.homepos.Z.ToString(); | ||
292 | ArrayList SendParams = new ArrayList(); | ||
293 | SendParams.Add(SimParams); | ||
294 | |||
295 | XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); | ||
296 | XmlRpcResponse GridResp = GridReq.Send(SimInfo.caps_url, 3000); | ||
297 | } | ||
298 | } | ||
299 | } | ||
diff --git a/Common/OpenSim.Framework/UserProfileManagerBase.cs b/Common/OpenSim.Framework/UserProfileManagerBase.cs deleted file mode 100644 index 638077e..0000000 --- a/Common/OpenSim.Framework/UserProfileManagerBase.cs +++ /dev/null | |||
@@ -1,151 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using libsecondlife; | ||
32 | using OpenSim.Framework.Utilities; | ||
33 | using OpenSim.Framework.Inventory; | ||
34 | using Db4objects.Db4o; | ||
35 | |||
36 | namespace OpenSim.Framework.User | ||
37 | { | ||
38 | public class UserProfileManagerBase | ||
39 | { | ||
40 | |||
41 | public Dictionary<LLUUID, UserProfile> UserProfiles = new Dictionary<LLUUID, UserProfile>(); | ||
42 | |||
43 | public UserProfileManagerBase() | ||
44 | { | ||
45 | } | ||
46 | |||
47 | public virtual void InitUserProfiles() | ||
48 | { | ||
49 | IObjectContainer db; | ||
50 | db = Db4oFactory.OpenFile("userprofiles.yap"); | ||
51 | IObjectSet result = db.Get(typeof(UserProfile)); | ||
52 | foreach (UserProfile userprof in result) | ||
53 | { | ||
54 | UserProfiles.Add(userprof.UUID, userprof); | ||
55 | } | ||
56 | System.Console.WriteLine("UserProfiles.Cs:InitUserProfiles() - Successfully loaded " + result.Count.ToString() + " from database"); | ||
57 | db.Close(); | ||
58 | } | ||
59 | |||
60 | public virtual void SaveUserProfiles() // ZOMG! INEFFICIENT! | ||
61 | { | ||
62 | IObjectContainer db; | ||
63 | db = Db4oFactory.OpenFile("userprofiles.yap"); | ||
64 | IObjectSet result = db.Get(typeof(UserProfile)); | ||
65 | foreach (UserProfile userprof in result) | ||
66 | { | ||
67 | db.Delete(userprof); | ||
68 | db.Commit(); | ||
69 | } | ||
70 | foreach (UserProfile userprof in UserProfiles.Values) | ||
71 | { | ||
72 | db.Set(userprof); | ||
73 | db.Commit(); | ||
74 | } | ||
75 | db.Close(); | ||
76 | } | ||
77 | |||
78 | public UserProfile GetProfileByName(string firstname, string lastname) | ||
79 | { | ||
80 | foreach (libsecondlife.LLUUID UUID in UserProfiles.Keys) | ||
81 | { | ||
82 | if (UserProfiles[UUID].firstname.Equals(firstname)) if (UserProfiles[UUID].lastname.Equals(lastname)) | ||
83 | { | ||
84 | return UserProfiles[UUID]; | ||
85 | } | ||
86 | } | ||
87 | return null; | ||
88 | } | ||
89 | |||
90 | public UserProfile GetProfileByLLUUID(LLUUID ProfileLLUUID) | ||
91 | { | ||
92 | return UserProfiles[ProfileLLUUID]; | ||
93 | } | ||
94 | |||
95 | public virtual bool AuthenticateUser(string firstname, string lastname, string passwd) | ||
96 | { | ||
97 | UserProfile TheUser = GetProfileByName(firstname, lastname); | ||
98 | passwd = passwd.Remove(0, 3); //remove $1$ | ||
99 | if (TheUser != null) | ||
100 | { | ||
101 | if (TheUser.MD5passwd == passwd) | ||
102 | { | ||
103 | System.Console.WriteLine("UserProfile - authorised " + firstname + " " + lastname); | ||
104 | return true; | ||
105 | } | ||
106 | else | ||
107 | { | ||
108 | System.Console.WriteLine("UserProfile - not authorised, password not match " + TheUser.MD5passwd + " and " + passwd); | ||
109 | return false; | ||
110 | } | ||
111 | } | ||
112 | else | ||
113 | { | ||
114 | System.Console.WriteLine("UserProfile - not authorised , unkown: " + firstname + " , " + lastname); | ||
115 | return false; | ||
116 | } | ||
117 | |||
118 | } | ||
119 | |||
120 | public void SetGod(LLUUID GodID) | ||
121 | { | ||
122 | this.UserProfiles[GodID].IsGridGod = true; | ||
123 | } | ||
124 | |||
125 | public virtual UserProfile CreateNewProfile(string firstname, string lastname, string MD5passwd) | ||
126 | { | ||
127 | System.Console.WriteLine("creating new profile for : " + firstname + " , " + lastname); | ||
128 | UserProfile newprofile = new UserProfile(); | ||
129 | newprofile.homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256)); | ||
130 | newprofile.firstname = firstname; | ||
131 | newprofile.lastname = lastname; | ||
132 | newprofile.MD5passwd = MD5passwd; | ||
133 | newprofile.UUID = LLUUID.Random(); | ||
134 | newprofile.Inventory.CreateRootFolder(newprofile.UUID, true); | ||
135 | this.UserProfiles.Add(newprofile.UUID, newprofile); | ||
136 | return newprofile; | ||
137 | } | ||
138 | |||
139 | public virtual AgentInventory GetUsersInventory(LLUUID agentID) | ||
140 | { | ||
141 | UserProfile user = this.GetProfileByLLUUID(agentID); | ||
142 | if (user != null) | ||
143 | { | ||
144 | return user.Inventory; | ||
145 | } | ||
146 | |||
147 | return null; | ||
148 | } | ||
149 | |||
150 | } | ||
151 | } | ||
diff --git a/Common/OpenSim.Servers/LocalUserProfileManager.cs b/Common/OpenSim.Servers/LocalUserProfileManager.cs deleted file mode 100644 index 773de5a..0000000 --- a/Common/OpenSim.Servers/LocalUserProfileManager.cs +++ /dev/null | |||
@@ -1,124 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Collections; | ||
32 | using System.Text; | ||
33 | using OpenSim.Framework.User; | ||
34 | using OpenSim.Framework.Grid; | ||
35 | using OpenSim.Framework.Inventory; | ||
36 | using OpenSim.Framework.Interfaces; | ||
37 | using OpenSim.Framework.Types; | ||
38 | using libsecondlife; | ||
39 | |||
40 | namespace OpenSim.UserServer | ||
41 | { | ||
42 | public class LocalUserProfileManager : UserProfileManager | ||
43 | { | ||
44 | // private IGridServer m_gridServer; | ||
45 | private int m_port; | ||
46 | private string m_ipAddr; | ||
47 | private uint regionX; | ||
48 | private uint regionY; | ||
49 | private AddNewSessionHandler AddSession; | ||
50 | |||
51 | public LocalUserProfileManager( int simPort, string ipAddr , uint regX, uint regY) | ||
52 | { | ||
53 | |||
54 | m_port = simPort; | ||
55 | m_ipAddr = ipAddr; | ||
56 | regionX = regX; | ||
57 | regionY = regY; | ||
58 | } | ||
59 | |||
60 | public void SetSessionHandler(AddNewSessionHandler sessionHandler) | ||
61 | { | ||
62 | this.AddSession = sessionHandler; | ||
63 | } | ||
64 | |||
65 | public override void InitUserProfiles() | ||
66 | { | ||
67 | // TODO: need to load from database | ||
68 | } | ||
69 | |||
70 | public override void CustomiseResponse(ref System.Collections.Hashtable response, UserProfile theUser) | ||
71 | { | ||
72 | Int32 circode = (Int32)response["circuit_code"]; | ||
73 | theUser.AddSimCircuit((uint)circode, LLUUID.Random()); | ||
74 | response["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}"; | ||
75 | response["sim_port"] = m_port; | ||
76 | response["sim_ip"] = m_ipAddr; | ||
77 | response["region_y"] = (Int32)regionY* 256; | ||
78 | response["region_x"] = (Int32)regionX* 256; | ||
79 | |||
80 | string first; | ||
81 | string last; | ||
82 | if (response.Contains("first_name")) | ||
83 | { | ||
84 | first = (string)response["first_name"]; | ||
85 | } | ||
86 | else | ||
87 | { | ||
88 | first = "test"; | ||
89 | } | ||
90 | |||
91 | if (response.Contains("last_name")) | ||
92 | { | ||
93 | last = (string)response["last_name"]; | ||
94 | } | ||
95 | else | ||
96 | { | ||
97 | last = "User"; | ||
98 | } | ||
99 | |||
100 | ArrayList InventoryList = (ArrayList)response["inventory-skeleton"]; | ||
101 | Hashtable Inventory1 = (Hashtable)InventoryList[0]; | ||
102 | |||
103 | Login _login = new Login(); | ||
104 | //copy data to login object | ||
105 | _login.First = first; | ||
106 | _login.Last = last; | ||
107 | _login.Agent = new LLUUID((string)response["agent_id"]) ; | ||
108 | _login.Session = new LLUUID((string)response["session_id"]); | ||
109 | _login.SecureSession = new LLUUID((string)response["secure_session_id"]); | ||
110 | _login.CircuitCode =(uint) circode; | ||
111 | _login.BaseFolder = null; | ||
112 | _login.InventoryFolder = new LLUUID((string)Inventory1["folder_id"]); | ||
113 | |||
114 | //working on local computer if so lets add to the gridserver's list of sessions? | ||
115 | /*if (m_gridServer.GetName() == "Local") | ||
116 | { | ||
117 | Console.WriteLine("adding login data to gridserver"); | ||
118 | ((LocalGridBase)this.m_gridServer).AddNewSession(_login); | ||
119 | }*/ | ||
120 | ulong reghand = Helpers.UIntsToLong((regionX * 256), (regionY * 256)); | ||
121 | this.AddSession(reghand, _login); | ||
122 | } | ||
123 | } | ||
124 | } | ||
diff --git a/Common/OpenSim.Servers/LoginResponse.cs b/Common/OpenSim.Servers/LoginResponse.cs deleted file mode 100644 index dc4732c..0000000 --- a/Common/OpenSim.Servers/LoginResponse.cs +++ /dev/null | |||
@@ -1,655 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | using Nwc.XmlRpc; | ||
30 | using System; | ||
31 | using System.IO; | ||
32 | using System.Net; | ||
33 | using System.Net.Sockets; | ||
34 | using System.Text; | ||
35 | using System.Text.RegularExpressions; | ||
36 | using System.Threading; | ||
37 | using System.Collections; | ||
38 | using System.Security.Cryptography; | ||
39 | using System.Xml; | ||
40 | using libsecondlife; | ||
41 | using OpenSim; | ||
42 | using OpenSim.Framework.User; | ||
43 | using OpenSim.Framework.Inventory; | ||
44 | using OpenSim.Framework.Utilities; | ||
45 | using OpenSim.Framework.Interfaces; | ||
46 | |||
47 | // ? | ||
48 | using OpenSim.Framework.Grid; | ||
49 | |||
50 | namespace OpenSim.UserServer | ||
51 | { | ||
52 | /// <summary> | ||
53 | /// A temp class to handle login response. | ||
54 | /// Should make use of UserProfileManager where possible. | ||
55 | /// </summary> | ||
56 | |||
57 | public class LoginResponse | ||
58 | { | ||
59 | private Hashtable loginFlagsHash; | ||
60 | private Hashtable globalTexturesHash; | ||
61 | private Hashtable loginError; | ||
62 | private Hashtable eventCategoriesHash; | ||
63 | private Hashtable uiConfigHash; | ||
64 | private Hashtable classifiedCategoriesHash; | ||
65 | |||
66 | private ArrayList loginFlags; | ||
67 | private ArrayList globalTextures; | ||
68 | private ArrayList eventCategories; | ||
69 | private ArrayList uiConfig; | ||
70 | private ArrayList classifiedCategories; | ||
71 | private ArrayList inventoryRoot; | ||
72 | private ArrayList initialOutfit; | ||
73 | private ArrayList agentInventory; | ||
74 | |||
75 | private UserInfo userProfile; | ||
76 | |||
77 | private LLUUID agentID; | ||
78 | private LLUUID sessionID; | ||
79 | private LLUUID secureSessionID; | ||
80 | private LLUUID baseFolderID; | ||
81 | private LLUUID inventoryFolderID; | ||
82 | |||
83 | // Login Flags | ||
84 | private string dst; | ||
85 | private string stipendSinceLogin; | ||
86 | private string gendered; | ||
87 | private string everLoggedIn; | ||
88 | private string login; | ||
89 | private string simPort; | ||
90 | private string simAddress; | ||
91 | private string agentAccess; | ||
92 | private Int32 circuitCode; | ||
93 | private uint regionX; | ||
94 | private uint regionY; | ||
95 | |||
96 | // Login | ||
97 | private string firstname; | ||
98 | private string lastname; | ||
99 | |||
100 | // Global Textures | ||
101 | private string sunTexture; | ||
102 | private string cloudTexture; | ||
103 | private string moonTexture; | ||
104 | |||
105 | // Error Flags | ||
106 | private string errorReason; | ||
107 | private string errorMessage; | ||
108 | |||
109 | // Response | ||
110 | private XmlRpcResponse xmlRpcResponse; | ||
111 | private XmlRpcResponse defaultXmlRpcResponse; | ||
112 | |||
113 | private string welcomeMessage; | ||
114 | private string startLocation; | ||
115 | private string allowFirstLife; | ||
116 | private string home; | ||
117 | private string seedCapability; | ||
118 | private string lookAt; | ||
119 | |||
120 | public LoginResponse() | ||
121 | { | ||
122 | this.loginFlags = new ArrayList(); | ||
123 | this.globalTextures = new ArrayList(); | ||
124 | this.eventCategories = new ArrayList(); | ||
125 | this.uiConfig = new ArrayList(); | ||
126 | this.classifiedCategories = new ArrayList(); | ||
127 | |||
128 | this.loginError = new Hashtable(); | ||
129 | this.eventCategoriesHash = new Hashtable(); | ||
130 | this.classifiedCategoriesHash = new Hashtable(); | ||
131 | this.uiConfigHash = new Hashtable(); | ||
132 | |||
133 | this.defaultXmlRpcResponse = new XmlRpcResponse(); | ||
134 | this.userProfile = new UserInfo(); | ||
135 | this.inventoryRoot = new ArrayList(); | ||
136 | this.initialOutfit = new ArrayList(); | ||
137 | this.agentInventory = new ArrayList(); | ||
138 | |||
139 | this.xmlRpcResponse = new XmlRpcResponse(); | ||
140 | this.defaultXmlRpcResponse = new XmlRpcResponse(); | ||
141 | |||
142 | this.SetDefaultValues(); | ||
143 | } // LoginServer | ||
144 | |||
145 | public void SetDefaultValues() | ||
146 | { | ||
147 | try | ||
148 | { | ||
149 | this.DST = "N"; | ||
150 | this.StipendSinceLogin = "N"; | ||
151 | this.Gendered = "Y"; | ||
152 | this.EverLoggedIn = "Y"; | ||
153 | this.login = "false"; | ||
154 | this.firstname = "Test"; | ||
155 | this.lastname = "User"; | ||
156 | this.agentAccess = "M"; | ||
157 | this.startLocation = "last"; | ||
158 | this.allowFirstLife = "Y"; | ||
159 | |||
160 | this.SunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271"; | ||
161 | this.CloudTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; | ||
162 | this.MoonTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; | ||
163 | |||
164 | this.ErrorMessage = "You have entered an invalid name/password combination. Check Caps/lock."; | ||
165 | this.ErrorReason = "key"; | ||
166 | this.welcomeMessage = "Welcome to OpenSim!"; | ||
167 | this.seedCapability = ""; | ||
168 | this.home = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + this.userProfile.homepos.X.ToString() + ",r" + this.userProfile.homepos.Y.ToString() + ",r" + this.userProfile.homepos.Z.ToString() + "], 'look_at':[r" + this.userProfile.homelookat.X.ToString() + ",r" + this.userProfile.homelookat.Y.ToString() + ",r" + this.userProfile.homelookat.Z.ToString() + "]}"; | ||
169 | this.lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]"; | ||
170 | this.RegionX = (uint)255232; | ||
171 | this.RegionY = (uint)254976; | ||
172 | |||
173 | // Classifieds; | ||
174 | this.AddClassifiedCategory((Int32)1, "Shopping"); | ||
175 | this.AddClassifiedCategory((Int32)2, "Land Rental"); | ||
176 | this.AddClassifiedCategory((Int32)3, "Property Rental"); | ||
177 | this.AddClassifiedCategory((Int32)4, "Special Attraction"); | ||
178 | this.AddClassifiedCategory((Int32)5, "New Products"); | ||
179 | this.AddClassifiedCategory((Int32)6, "Employment"); | ||
180 | this.AddClassifiedCategory((Int32)7, "Wanted"); | ||
181 | this.AddClassifiedCategory((Int32)8, "Service"); | ||
182 | this.AddClassifiedCategory((Int32)9, "Personal"); | ||
183 | |||
184 | this.SessionID = LLUUID.Random(); | ||
185 | this.SecureSessionID = LLUUID.Random(); | ||
186 | this.AgentID = LLUUID.Random(); | ||
187 | |||
188 | Hashtable InitialOutfitHash = new Hashtable(); | ||
189 | InitialOutfitHash["folder_name"] = "Nightclub Female"; | ||
190 | InitialOutfitHash["gender"] = "female"; | ||
191 | this.initialOutfit.Add(InitialOutfitHash); | ||
192 | } | ||
193 | catch (Exception e) | ||
194 | { | ||
195 | OpenSim.Framework.Console.MainLog.Instance.WriteLine( | ||
196 | OpenSim.Framework.Console.LogPriority.LOW, | ||
197 | "LoginResponse: Unable to set default values: " + e.Message | ||
198 | ); | ||
199 | } | ||
200 | |||
201 | } // SetDefaultValues | ||
202 | |||
203 | private XmlRpcResponse GenerateFailureResponse(string reason, string message, string login) | ||
204 | { | ||
205 | // Overwrite any default values; | ||
206 | this.xmlRpcResponse = new XmlRpcResponse(); | ||
207 | |||
208 | // Ensure Login Failed message/reason; | ||
209 | this.ErrorMessage = message; | ||
210 | this.ErrorReason = reason; | ||
211 | |||
212 | this.loginError["reason"] = this.ErrorReason; | ||
213 | this.loginError["message"] = this.ErrorMessage; | ||
214 | this.loginError["login"] = login; | ||
215 | this.xmlRpcResponse.Value = this.loginError; | ||
216 | return (this.xmlRpcResponse); | ||
217 | } // GenerateResponse | ||
218 | |||
219 | public XmlRpcResponse LoginFailedResponse() | ||
220 | { | ||
221 | return (this.GenerateFailureResponse("key", "You have entered an invalid name/password combination. Check Caps/lock.", "false")); | ||
222 | } // LoginFailedResponse | ||
223 | |||
224 | public XmlRpcResponse ConnectionFailedResponse() | ||
225 | { | ||
226 | return (this.LoginFailedResponse()); | ||
227 | } // CreateErrorConnectingToGridResponse() | ||
228 | |||
229 | public XmlRpcResponse CreateAlreadyLoggedInResponse() | ||
230 | { | ||
231 | return (this.GenerateFailureResponse("presence", "You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner", "false")); | ||
232 | } // CreateAlreadyLoggedInResponse() | ||
233 | |||
234 | public XmlRpcResponse ToXmlRpcResponse() | ||
235 | { | ||
236 | try | ||
237 | { | ||
238 | |||
239 | Hashtable responseData = new Hashtable(); | ||
240 | |||
241 | this.loginFlagsHash = new Hashtable(); | ||
242 | this.loginFlagsHash["daylight_savings"] = this.DST; | ||
243 | this.loginFlagsHash["stipend_since_login"] = this.StipendSinceLogin; | ||
244 | this.loginFlagsHash["gendered"] = this.Gendered; | ||
245 | this.loginFlagsHash["ever_logged_in"] = this.EverLoggedIn; | ||
246 | this.loginFlags.Add(this.loginFlagsHash); | ||
247 | |||
248 | responseData["first_name"] = this.Firstname; | ||
249 | responseData["last_name"] = this.Lastname; | ||
250 | responseData["agent_access"] = this.agentAccess; | ||
251 | |||
252 | this.globalTexturesHash = new Hashtable(); | ||
253 | this.globalTexturesHash["sun_texture_id"] = this.SunTexture; | ||
254 | this.globalTexturesHash["cloud_texture_id"] = this.CloudTexture; | ||
255 | this.globalTexturesHash["moon_texture_id"] = this.MoonTexture; | ||
256 | this.globalTextures.Add(this.globalTexturesHash); | ||
257 | this.eventCategories.Add(this.eventCategoriesHash); | ||
258 | |||
259 | this.AddToUIConfig("allow_first_life", this.allowFirstLife); | ||
260 | this.uiConfig.Add(this.uiConfigHash); | ||
261 | |||
262 | responseData["sim_port"] = this.SimPort; | ||
263 | responseData["sim_ip"] = this.SimAddress; | ||
264 | responseData["agent_id"] = this.AgentID.ToStringHyphenated(); | ||
265 | responseData["session_id"] = this.SessionID.ToStringHyphenated(); | ||
266 | responseData["secure_session_id"] = this.SecureSessionID.ToStringHyphenated(); | ||
267 | responseData["circuit_code"] = this.CircuitCode; | ||
268 | responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | ||
269 | responseData["login-flags"] = this.loginFlags; | ||
270 | responseData["global-textures"] = this.globalTextures; | ||
271 | responseData["seed_capability"] = this.seedCapability; | ||
272 | |||
273 | responseData["event_categories"] = this.eventCategories; | ||
274 | responseData["event_notifications"] = new ArrayList(); // todo | ||
275 | responseData["classified_categories"] = this.classifiedCategories; | ||
276 | responseData["ui-config"] = this.uiConfig; | ||
277 | |||
278 | responseData["inventory-skeleton"] = this.agentInventory; | ||
279 | responseData["inventory-skel-lib"] = new ArrayList(); // todo | ||
280 | responseData["inventory-root"] = this.inventoryRoot; | ||
281 | responseData["gestures"] = new ArrayList(); // todo | ||
282 | responseData["inventory-lib-owner"] = new ArrayList(); // todo | ||
283 | responseData["initial-outfit"] = this.initialOutfit; | ||
284 | responseData["start_location"] = this.startLocation; | ||
285 | responseData["seed_capability"] = this.seedCapability; | ||
286 | responseData["home"] = this.home; | ||
287 | responseData["look_at"] = this.lookAt; | ||
288 | responseData["message"] = this.welcomeMessage; | ||
289 | responseData["region_x"] = (Int32)this.RegionX * 256; | ||
290 | responseData["region_y"] = (Int32)this.RegionY * 256; | ||
291 | |||
292 | //responseData["inventory-lib-root"] = new ArrayList(); // todo | ||
293 | //responseData["buddy-list"] = new ArrayList(); // todo | ||
294 | |||
295 | responseData["login"] = "true"; | ||
296 | this.xmlRpcResponse.Value = responseData; | ||
297 | |||
298 | return (this.xmlRpcResponse); | ||
299 | } | ||
300 | catch (Exception e) | ||
301 | { | ||
302 | OpenSim.Framework.Console.MainLog.Instance.WriteLine( | ||
303 | OpenSim.Framework.Console.LogPriority.LOW, | ||
304 | "LoginResponse: Error creating XML-RPC Response: " + e.Message | ||
305 | ); | ||
306 | return (this.GenerateFailureResponse("Internal Error", "Error generating Login Response", "false")); | ||
307 | |||
308 | } | ||
309 | |||
310 | } // ToXmlRpcResponse | ||
311 | |||
312 | public void SetEventCategories(string category, string value) | ||
313 | { | ||
314 | this.eventCategoriesHash[category] = value; | ||
315 | } // SetEventCategories | ||
316 | |||
317 | public void AddToUIConfig(string itemName, string item) | ||
318 | { | ||
319 | this.uiConfigHash[itemName] = item; | ||
320 | } // SetUIConfig | ||
321 | |||
322 | public void AddClassifiedCategory(Int32 ID, string categoryName) | ||
323 | { | ||
324 | this.classifiedCategoriesHash["category_name"] = categoryName; | ||
325 | this.classifiedCategoriesHash["category_id"] = ID; | ||
326 | this.classifiedCategories.Add(this.classifiedCategoriesHash); | ||
327 | // this.classifiedCategoriesHash.Clear(); | ||
328 | } // SetClassifiedCategory | ||
329 | |||
330 | #region Properties | ||
331 | public string Login | ||
332 | { | ||
333 | get | ||
334 | { | ||
335 | return this.login; | ||
336 | } | ||
337 | set | ||
338 | { | ||
339 | this.login = value; | ||
340 | } | ||
341 | } // Login | ||
342 | |||
343 | public string DST | ||
344 | { | ||
345 | get | ||
346 | { | ||
347 | return this.dst; | ||
348 | } | ||
349 | set | ||
350 | { | ||
351 | this.dst = value; | ||
352 | } | ||
353 | } // DST | ||
354 | |||
355 | public string StipendSinceLogin | ||
356 | { | ||
357 | get | ||
358 | { | ||
359 | return this.stipendSinceLogin; | ||
360 | } | ||
361 | set | ||
362 | { | ||
363 | this.stipendSinceLogin = value; | ||
364 | } | ||
365 | } // StipendSinceLogin | ||
366 | |||
367 | public string Gendered | ||
368 | { | ||
369 | get | ||
370 | { | ||
371 | return this.gendered; | ||
372 | } | ||
373 | set | ||
374 | { | ||
375 | this.gendered = value; | ||
376 | } | ||
377 | } // Gendered | ||
378 | |||
379 | public string EverLoggedIn | ||
380 | { | ||
381 | get | ||
382 | { | ||
383 | return this.everLoggedIn; | ||
384 | } | ||
385 | set | ||
386 | { | ||
387 | this.everLoggedIn = value; | ||
388 | } | ||
389 | } // EverLoggedIn | ||
390 | |||
391 | public string SimPort | ||
392 | { | ||
393 | get | ||
394 | { | ||
395 | return this.simPort; | ||
396 | } | ||
397 | set | ||
398 | { | ||
399 | this.simPort = value; | ||
400 | } | ||
401 | } // SimPort | ||
402 | |||
403 | public string SimAddress | ||
404 | { | ||
405 | get | ||
406 | { | ||
407 | return this.simAddress; | ||
408 | } | ||
409 | set | ||
410 | { | ||
411 | this.simAddress = value; | ||
412 | } | ||
413 | } // SimAddress | ||
414 | |||
415 | public LLUUID AgentID | ||
416 | { | ||
417 | get | ||
418 | { | ||
419 | return this.agentID; | ||
420 | } | ||
421 | set | ||
422 | { | ||
423 | this.agentID = value; | ||
424 | } | ||
425 | } // AgentID | ||
426 | |||
427 | public LLUUID SessionID | ||
428 | { | ||
429 | get | ||
430 | { | ||
431 | return this.sessionID; | ||
432 | } | ||
433 | set | ||
434 | { | ||
435 | this.sessionID = value; | ||
436 | } | ||
437 | } // SessionID | ||
438 | |||
439 | public LLUUID SecureSessionID | ||
440 | { | ||
441 | get | ||
442 | { | ||
443 | return this.secureSessionID; | ||
444 | } | ||
445 | set | ||
446 | { | ||
447 | this.secureSessionID = value; | ||
448 | } | ||
449 | } // SecureSessionID | ||
450 | |||
451 | public LLUUID BaseFolderID | ||
452 | { | ||
453 | get | ||
454 | { | ||
455 | return this.baseFolderID; | ||
456 | } | ||
457 | set | ||
458 | { | ||
459 | this.baseFolderID = value; | ||
460 | } | ||
461 | } // BaseFolderID | ||
462 | |||
463 | public LLUUID InventoryFolderID | ||
464 | { | ||
465 | get | ||
466 | { | ||
467 | return this.inventoryFolderID; | ||
468 | } | ||
469 | set | ||
470 | { | ||
471 | this.inventoryFolderID = value; | ||
472 | } | ||
473 | } // InventoryFolderID | ||
474 | |||
475 | public Int32 CircuitCode | ||
476 | { | ||
477 | get | ||
478 | { | ||
479 | return this.circuitCode; | ||
480 | } | ||
481 | set | ||
482 | { | ||
483 | this.circuitCode = value; | ||
484 | } | ||
485 | } // CircuitCode | ||
486 | |||
487 | public uint RegionX | ||
488 | { | ||
489 | get | ||
490 | { | ||
491 | return this.regionX; | ||
492 | } | ||
493 | set | ||
494 | { | ||
495 | this.regionX = value; | ||
496 | } | ||
497 | } // RegionX | ||
498 | |||
499 | public uint RegionY | ||
500 | { | ||
501 | get | ||
502 | { | ||
503 | return this.regionY; | ||
504 | } | ||
505 | set | ||
506 | { | ||
507 | this.regionY = value; | ||
508 | } | ||
509 | } // RegionY | ||
510 | |||
511 | public string SunTexture | ||
512 | { | ||
513 | get | ||
514 | { | ||
515 | return this.sunTexture; | ||
516 | } | ||
517 | set | ||
518 | { | ||
519 | this.sunTexture = value; | ||
520 | } | ||
521 | } // SunTexture | ||
522 | |||
523 | public string CloudTexture | ||
524 | { | ||
525 | get | ||
526 | { | ||
527 | return this.cloudTexture; | ||
528 | } | ||
529 | set | ||
530 | { | ||
531 | this.cloudTexture = value; | ||
532 | } | ||
533 | } // CloudTexture | ||
534 | |||
535 | public string MoonTexture | ||
536 | { | ||
537 | get | ||
538 | { | ||
539 | return this.moonTexture; | ||
540 | } | ||
541 | set | ||
542 | { | ||
543 | this.moonTexture = value; | ||
544 | } | ||
545 | } // MoonTexture | ||
546 | |||
547 | public string Firstname | ||
548 | { | ||
549 | get | ||
550 | { | ||
551 | return this.firstname; | ||
552 | } | ||
553 | set | ||
554 | { | ||
555 | this.firstname = value; | ||
556 | } | ||
557 | } // Firstname | ||
558 | |||
559 | public string Lastname | ||
560 | { | ||
561 | get | ||
562 | { | ||
563 | return this.lastname; | ||
564 | } | ||
565 | set | ||
566 | { | ||
567 | this.lastname = value; | ||
568 | } | ||
569 | } // Lastname | ||
570 | |||
571 | public string AgentAccess | ||
572 | { | ||
573 | get | ||
574 | { | ||
575 | return this.agentAccess; | ||
576 | } | ||
577 | set | ||
578 | { | ||
579 | this.agentAccess = value; | ||
580 | } | ||
581 | } | ||
582 | |||
583 | public string StartLocation | ||
584 | { | ||
585 | get | ||
586 | { | ||
587 | return this.startLocation; | ||
588 | } | ||
589 | set | ||
590 | { | ||
591 | this.startLocation = value; | ||
592 | } | ||
593 | } // StartLocation | ||
594 | |||
595 | public string LookAt | ||
596 | { | ||
597 | get | ||
598 | { | ||
599 | return this.lookAt; | ||
600 | } | ||
601 | set | ||
602 | { | ||
603 | this.lookAt = value; | ||
604 | } | ||
605 | } | ||
606 | |||
607 | public string SeedCapability | ||
608 | { | ||
609 | get | ||
610 | { | ||
611 | return this.seedCapability; | ||
612 | } | ||
613 | set | ||
614 | { | ||
615 | this.seedCapability = value; | ||
616 | } | ||
617 | } // SeedCapability | ||
618 | |||
619 | public string ErrorReason | ||
620 | { | ||
621 | get | ||
622 | { | ||
623 | return this.errorReason; | ||
624 | } | ||
625 | set | ||
626 | { | ||
627 | this.errorReason = value; | ||
628 | } | ||
629 | } // ErrorReason | ||
630 | |||
631 | public string ErrorMessage | ||
632 | { | ||
633 | get | ||
634 | { | ||
635 | return this.errorMessage; | ||
636 | } | ||
637 | set | ||
638 | { | ||
639 | this.errorMessage = value; | ||
640 | } | ||
641 | } // ErrorMessage | ||
642 | |||
643 | #endregion | ||
644 | |||
645 | |||
646 | public class UserInfo | ||
647 | { | ||
648 | public string firstname; | ||
649 | public string lastname; | ||
650 | public ulong homeregionhandle; | ||
651 | public LLVector3 homepos; | ||
652 | public LLVector3 homelookat; | ||
653 | } | ||
654 | } | ||
655 | } \ No newline at end of file | ||
diff --git a/Common/OpenSim.Servers/LoginServer.cs b/Common/OpenSim.Servers/LoginServer.cs deleted file mode 100644 index e5373dd..0000000 --- a/Common/OpenSim.Servers/LoginServer.cs +++ /dev/null | |||
@@ -1,258 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using Nwc.XmlRpc; | ||
29 | using System; | ||
30 | using System.IO; | ||
31 | using System.Net; | ||
32 | using System.Net.Sockets; | ||
33 | using System.Text; | ||
34 | using System.Text.RegularExpressions; | ||
35 | using System.Threading; | ||
36 | using System.Collections; | ||
37 | using System.Security.Cryptography; | ||
38 | using System.Xml; | ||
39 | using libsecondlife; | ||
40 | using OpenSim; | ||
41 | using OpenSim.Framework.Interfaces; | ||
42 | using OpenSim.Framework.Grid; | ||
43 | using OpenSim.Framework.Inventory; | ||
44 | using OpenSim.Framework.User; | ||
45 | using OpenSim.Framework.Utilities; | ||
46 | using OpenSim.Framework.Types; | ||
47 | |||
48 | namespace OpenSim.UserServer | ||
49 | { | ||
50 | public delegate bool AddNewSessionHandler(ulong regionHandle, Login loginData); | ||
51 | /// <summary> | ||
52 | /// When running in local (default) mode , handles client logins. | ||
53 | /// </summary> | ||
54 | public class LoginServer : LoginService, IUserServer | ||
55 | { | ||
56 | //private IGridServer m_gridServer; | ||
57 | public IPAddress clientAddress = IPAddress.Loopback; | ||
58 | public IPAddress remoteAddress = IPAddress.Any; | ||
59 | private int NumClients; | ||
60 | private bool userAccounts = false; | ||
61 | private string _mpasswd; | ||
62 | private bool _needPasswd = false; | ||
63 | private LocalUserProfileManager userManager; | ||
64 | private int m_simPort; | ||
65 | private string m_simAddr; | ||
66 | private uint regionX; | ||
67 | private uint regionY; | ||
68 | private AddNewSessionHandler AddSession; | ||
69 | |||
70 | public LocalUserProfileManager LocalUserManager | ||
71 | { | ||
72 | get | ||
73 | { | ||
74 | return userManager; | ||
75 | } | ||
76 | } | ||
77 | |||
78 | public LoginServer( string simAddr, int simPort, uint regX, uint regY, bool useAccounts) | ||
79 | { | ||
80 | m_simPort = simPort; | ||
81 | m_simAddr = simAddr; | ||
82 | regionX = regX; | ||
83 | regionY = regY; | ||
84 | this.userAccounts = useAccounts; | ||
85 | } | ||
86 | |||
87 | public void SetSessionHandler(AddNewSessionHandler sessionHandler) | ||
88 | { | ||
89 | this.AddSession = sessionHandler; | ||
90 | this.userManager.SetSessionHandler(sessionHandler); | ||
91 | } | ||
92 | |||
93 | public void Startup() | ||
94 | { | ||
95 | this._needPasswd = false; | ||
96 | |||
97 | this._mpasswd = EncodePassword("testpass"); | ||
98 | |||
99 | userManager = new LocalUserProfileManager( m_simPort, m_simAddr, regionX, regionY); | ||
100 | //userManager.InitUserProfiles(); | ||
101 | userManager.SetKeys("", "", "", "Welcome to OpenSim"); | ||
102 | } | ||
103 | |||
104 | public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) | ||
105 | { | ||
106 | Console.WriteLine("login attempt"); | ||
107 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
108 | string first; | ||
109 | string last; | ||
110 | string passwd; | ||
111 | |||
112 | LoginResponse loginResponse = new LoginResponse(); | ||
113 | loginResponse.RegionX = regionX; | ||
114 | loginResponse.RegionY = regionY; | ||
115 | |||
116 | //get login name | ||
117 | if (requestData.Contains("first")) | ||
118 | { | ||
119 | first = (string)requestData["first"]; | ||
120 | } | ||
121 | else | ||
122 | { | ||
123 | first = "test"; | ||
124 | } | ||
125 | |||
126 | if (requestData.Contains("last")) | ||
127 | { | ||
128 | last = (string)requestData["last"]; | ||
129 | } | ||
130 | else | ||
131 | { | ||
132 | last = "User" + NumClients.ToString(); | ||
133 | } | ||
134 | |||
135 | if (requestData.Contains("passwd")) | ||
136 | { | ||
137 | passwd = (string)requestData["passwd"]; | ||
138 | } | ||
139 | else | ||
140 | { | ||
141 | passwd = "notfound"; | ||
142 | } | ||
143 | |||
144 | if (!Authenticate(first, last, passwd)) | ||
145 | { | ||
146 | return loginResponse.LoginFailedResponse(); | ||
147 | } | ||
148 | |||
149 | NumClients++; | ||
150 | |||
151 | loginResponse.SimPort = m_simPort.ToString(); | ||
152 | loginResponse.SimAddress = m_simAddr.ToString(); | ||
153 | |||
154 | loginResponse.CircuitCode = (Int32)(Util.RandomClass.Next()); | ||
155 | XmlRpcResponse response = loginResponse.ToXmlRpcResponse(); | ||
156 | Hashtable responseData = (Hashtable)response.Value; | ||
157 | |||
158 | |||
159 | CustomiseLoginResponse(responseData, first, last); | ||
160 | |||
161 | Login _login = new Login(); | ||
162 | //copy data to login object | ||
163 | _login.First = first; | ||
164 | _login.Last = last; | ||
165 | _login.Agent = loginResponse.AgentID; | ||
166 | _login.Session = loginResponse.SessionID; | ||
167 | _login.SecureSession = loginResponse.SecureSessionID; | ||
168 | _login.CircuitCode = (uint) loginResponse.CircuitCode; | ||
169 | _login.BaseFolder = loginResponse.BaseFolderID; | ||
170 | _login.InventoryFolder = loginResponse.InventoryFolderID; | ||
171 | |||
172 | ulong reghand = Helpers.UIntsToLong((regionX * 256), (regionY * 256)); | ||
173 | AddSession(reghand,_login); | ||
174 | |||
175 | return response; | ||
176 | } | ||
177 | |||
178 | protected virtual void CustomiseLoginResponse(Hashtable responseData, string first, string last) | ||
179 | { | ||
180 | } | ||
181 | |||
182 | protected virtual LLUUID GetAgentId(string firstName, string lastName) | ||
183 | { | ||
184 | LLUUID Agent; | ||
185 | int AgentRand = Util.RandomClass.Next(1, 9999); | ||
186 | Agent = new LLUUID("99998888-0100-" + AgentRand.ToString("0000") + "-8ec1-0b1d5cd6aead"); | ||
187 | return Agent; | ||
188 | } | ||
189 | |||
190 | protected virtual bool Authenticate(string first, string last, string passwd) | ||
191 | { | ||
192 | if (this._needPasswd) | ||
193 | { | ||
194 | //every user needs the password to login | ||
195 | string encodedPass = passwd.Remove(0, 3); //remove $1$ | ||
196 | if (encodedPass == this._mpasswd) | ||
197 | { | ||
198 | return true; | ||
199 | } | ||
200 | else | ||
201 | { | ||
202 | return false; | ||
203 | } | ||
204 | } | ||
205 | else | ||
206 | { | ||
207 | //do not need password to login | ||
208 | return true; | ||
209 | } | ||
210 | } | ||
211 | |||
212 | private static string EncodePassword(string passwd) | ||
213 | { | ||
214 | Byte[] originalBytes; | ||
215 | Byte[] encodedBytes; | ||
216 | MD5 md5; | ||
217 | |||
218 | md5 = new MD5CryptoServiceProvider(); | ||
219 | originalBytes = ASCIIEncoding.Default.GetBytes(passwd); | ||
220 | encodedBytes = md5.ComputeHash(originalBytes); | ||
221 | |||
222 | return Regex.Replace(BitConverter.ToString(encodedBytes), "-", "").ToLower(); | ||
223 | } | ||
224 | |||
225 | public bool CreateUserAccount(string firstName, string lastName, string password) | ||
226 | { | ||
227 | Console.WriteLine("creating new user account"); | ||
228 | string mdPassword = EncodePassword(password); | ||
229 | Console.WriteLine("with password: " + mdPassword); | ||
230 | this.userManager.CreateNewProfile(firstName, lastName, mdPassword); | ||
231 | return true; | ||
232 | } | ||
233 | |||
234 | //IUserServer implementation | ||
235 | public AgentInventory RequestAgentsInventory(LLUUID agentID) | ||
236 | { | ||
237 | AgentInventory aInventory = null; | ||
238 | if (this.userAccounts) | ||
239 | { | ||
240 | aInventory = this.userManager.GetUsersInventory(agentID); | ||
241 | } | ||
242 | |||
243 | return aInventory; | ||
244 | } | ||
245 | |||
246 | public bool UpdateAgentsInventory(LLUUID agentID, AgentInventory inventory) | ||
247 | { | ||
248 | return true; | ||
249 | } | ||
250 | |||
251 | public void SetServerInfo(string ServerUrl, string SendKey, string RecvKey) | ||
252 | { | ||
253 | |||
254 | } | ||
255 | } | ||
256 | |||
257 | |||
258 | } | ||
diff --git a/Common/OpenSim.Servers/OpenSim.Servers.csproj b/Common/OpenSim.Servers/OpenSim.Servers.csproj index e9be796..6e8eba7 100644 --- a/Common/OpenSim.Servers/OpenSim.Servers.csproj +++ b/Common/OpenSim.Servers/OpenSim.Servers.csproj | |||
@@ -1,4 +1,4 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | 1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
2 | <PropertyGroup> | 2 | <PropertyGroup> |
3 | <ProjectType>Local</ProjectType> | 3 | <ProjectType>Local</ProjectType> |
4 | <ProductVersion>8.0.50727</ProductVersion> | 4 | <ProductVersion>8.0.50727</ProductVersion> |
@@ -6,7 +6,8 @@ | |||
6 | <ProjectGuid>{8BB20F0A-0000-0000-0000-000000000000}</ProjectGuid> | 6 | <ProjectGuid>{8BB20F0A-0000-0000-0000-000000000000}</ProjectGuid> |
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | 7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | 8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
9 | <ApplicationIcon></ApplicationIcon> | 9 | <ApplicationIcon> |
10 | </ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | 11 | <AssemblyKeyContainerName> |
11 | </AssemblyKeyContainerName> | 12 | </AssemblyKeyContainerName> |
12 | <AssemblyName>OpenSim.Servers</AssemblyName> | 13 | <AssemblyName>OpenSim.Servers</AssemblyName> |
@@ -15,9 +16,11 @@ | |||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | 16 | <DefaultTargetSchema>IE50</DefaultTargetSchema> |
16 | <DelaySign>false</DelaySign> | 17 | <DelaySign>false</DelaySign> |
17 | <OutputType>Library</OutputType> | 18 | <OutputType>Library</OutputType> |
18 | <AppDesignerFolder></AppDesignerFolder> | 19 | <AppDesignerFolder> |
20 | </AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.Servers</RootNamespace> | 21 | <RootNamespace>OpenSim.Servers</RootNamespace> |
20 | <StartupObject></StartupObject> | 22 | <StartupObject> |
23 | </StartupObject> | ||
21 | <FileUpgradeFlags> | 24 | <FileUpgradeFlags> |
22 | </FileUpgradeFlags> | 25 | </FileUpgradeFlags> |
23 | </PropertyGroup> | 26 | </PropertyGroup> |
@@ -28,7 +31,8 @@ | |||
28 | <ConfigurationOverrideFile> | 31 | <ConfigurationOverrideFile> |
29 | </ConfigurationOverrideFile> | 32 | </ConfigurationOverrideFile> |
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | 33 | <DefineConstants>TRACE;DEBUG</DefineConstants> |
31 | <DocumentationFile></DocumentationFile> | 34 | <DocumentationFile> |
35 | </DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | 36 | <DebugSymbols>True</DebugSymbols> |
33 | <FileAlignment>4096</FileAlignment> | 37 | <FileAlignment>4096</FileAlignment> |
34 | <Optimize>False</Optimize> | 38 | <Optimize>False</Optimize> |
@@ -37,7 +41,8 @@ | |||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | 41 | <RemoveIntegerChecks>False</RemoveIntegerChecks> |
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | 42 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
39 | <WarningLevel>4</WarningLevel> | 43 | <WarningLevel>4</WarningLevel> |
40 | <NoWarn></NoWarn> | 44 | <NoWarn> |
45 | </NoWarn> | ||
41 | </PropertyGroup> | 46 | </PropertyGroup> |
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | 47 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | 48 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
@@ -46,7 +51,8 @@ | |||
46 | <ConfigurationOverrideFile> | 51 | <ConfigurationOverrideFile> |
47 | </ConfigurationOverrideFile> | 52 | </ConfigurationOverrideFile> |
48 | <DefineConstants>TRACE</DefineConstants> | 53 | <DefineConstants>TRACE</DefineConstants> |
49 | <DocumentationFile></DocumentationFile> | 54 | <DocumentationFile> |
55 | </DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | 56 | <DebugSymbols>False</DebugSymbols> |
51 | <FileAlignment>4096</FileAlignment> | 57 | <FileAlignment>4096</FileAlignment> |
52 | <Optimize>True</Optimize> | 58 | <Optimize>True</Optimize> |
@@ -55,18 +61,19 @@ | |||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | 61 | <RemoveIntegerChecks>False</RemoveIntegerChecks> |
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | 62 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
57 | <WarningLevel>4</WarningLevel> | 63 | <WarningLevel>4</WarningLevel> |
58 | <NoWarn></NoWarn> | 64 | <NoWarn> |
65 | </NoWarn> | ||
59 | </PropertyGroup> | 66 | </PropertyGroup> |
60 | <ItemGroup> | 67 | <ItemGroup> |
61 | <Reference Include="libsecondlife.dll" > | 68 | <Reference Include="libsecondlife.dll"> |
62 | <HintPath>..\..\bin\libsecondlife.dll</HintPath> | 69 | <HintPath>..\..\bin\libsecondlife.dll</HintPath> |
63 | <Private>False</Private> | 70 | <Private>False</Private> |
64 | </Reference> | 71 | </Reference> |
65 | <Reference Include="System" > | 72 | <Reference Include="System"> |
66 | <HintPath>System.dll</HintPath> | 73 | <HintPath>System.dll</HintPath> |
67 | <Private>False</Private> | 74 | <Private>False</Private> |
68 | </Reference> | 75 | </Reference> |
69 | <Reference Include="System.Xml" > | 76 | <Reference Include="System.Xml"> |
70 | <HintPath>System.Xml.dll</HintPath> | 77 | <HintPath>System.Xml.dll</HintPath> |
71 | <Private>False</Private> | 78 | <Private>False</Private> |
72 | </Reference> | 79 | </Reference> |
@@ -76,19 +83,19 @@ | |||
76 | <Name>OpenSim.Framework</Name> | 83 | <Name>OpenSim.Framework</Name> |
77 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> | 84 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> |
78 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 85 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
79 | <Private>False</Private> | 86 | <Private>False</Private> |
80 | </ProjectReference> | 87 | </ProjectReference> |
81 | <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> | 88 | <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> |
82 | <Name>OpenSim.Framework.Console</Name> | 89 | <Name>OpenSim.Framework.Console</Name> |
83 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> | 90 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> |
84 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 91 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
85 | <Private>False</Private> | 92 | <Private>False</Private> |
86 | </ProjectReference> | 93 | </ProjectReference> |
87 | <ProjectReference Include="..\XmlRpcCS\XMLRPC.csproj"> | 94 | <ProjectReference Include="..\XmlRpcCS\XMLRPC.csproj"> |
88 | <Name>XMLRPC</Name> | 95 | <Name>XMLRPC</Name> |
89 | <Project>{8E81D43C-0000-0000-0000-000000000000}</Project> | 96 | <Project>{8E81D43C-0000-0000-0000-000000000000}</Project> |
90 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 97 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
91 | <Private>False</Private> | 98 | <Private>False</Private> |
92 | </ProjectReference> | 99 | </ProjectReference> |
93 | </ItemGroup> | 100 | </ItemGroup> |
94 | <ItemGroup> | 101 | <ItemGroup> |
@@ -101,15 +108,6 @@ | |||
101 | <Compile Include="IRestHandler.cs"> | 108 | <Compile Include="IRestHandler.cs"> |
102 | <SubType>Code</SubType> | 109 | <SubType>Code</SubType> |
103 | </Compile> | 110 | </Compile> |
104 | <Compile Include="LocalUserProfileManager.cs"> | ||
105 | <SubType>Code</SubType> | ||
106 | </Compile> | ||
107 | <Compile Include="LoginResponse.cs"> | ||
108 | <SubType>Code</SubType> | ||
109 | </Compile> | ||
110 | <Compile Include="LoginServer.cs"> | ||
111 | <SubType>Code</SubType> | ||
112 | </Compile> | ||
113 | <Compile Include="UDPServerBase.cs"> | 111 | <Compile Include="UDPServerBase.cs"> |
114 | <SubType>Code</SubType> | 112 | <SubType>Code</SubType> |
115 | </Compile> | 113 | </Compile> |
@@ -124,4 +122,4 @@ | |||
124 | <PostBuildEvent> | 122 | <PostBuildEvent> |
125 | </PostBuildEvent> | 123 | </PostBuildEvent> |
126 | </PropertyGroup> | 124 | </PropertyGroup> |
127 | </Project> | 125 | </Project> \ No newline at end of file |