aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer/UserServer
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim.RegionServer/UserServer/LocalUserProfileManager.cs27
-rw-r--r--OpenSim.RegionServer/UserServer/LoginServer.cs145
2 files changed, 27 insertions, 145 deletions
diff --git a/OpenSim.RegionServer/UserServer/LocalUserProfileManager.cs b/OpenSim.RegionServer/UserServer/LocalUserProfileManager.cs
index 3ae7878..6166e02 100644
--- a/OpenSim.RegionServer/UserServer/LocalUserProfileManager.cs
+++ b/OpenSim.RegionServer/UserServer/LocalUserProfileManager.cs
@@ -1,3 +1,30 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27
1using System; 28using System;
2using System.Collections.Generic; 29using System.Collections.Generic;
3using System.Collections; 30using System.Collections;
diff --git a/OpenSim.RegionServer/UserServer/LoginServer.cs b/OpenSim.RegionServer/UserServer/LoginServer.cs
index a68e013..4c77389 100644
--- a/OpenSim.RegionServer/UserServer/LoginServer.cs
+++ b/OpenSim.RegionServer/UserServer/LoginServer.cs
@@ -84,28 +84,16 @@ namespace OpenSim.UserServer
84 84
85 public void Startup() 85 public void Startup()
86 { 86 {
87 this.InitializeLogin();
88 //Thread runLoginProxy = new Thread(new ThreadStart(RunLogin));
89 //runLoginProxy.IsBackground = true;
90 //runLoginProxy.Start();
91 }
92
93 // InitializeLogin: initialize the login
94 private void InitializeLogin()
95 {
96 this._needPasswd = false; 87 this._needPasswd = false;
97 //read in default response string 88 //read in default response string
98 StreamReader SR; 89 StreamReader SR;
99 string lines; 90 string lines;
100 SR = File.OpenText("new-login.dat"); 91 SR = File.OpenText("new-login.dat");
101 92
102 //lines=SR.ReadLine();
103
104 while (!SR.EndOfStream) 93 while (!SR.EndOfStream)
105 { 94 {
106 lines = SR.ReadLine(); 95 lines = SR.ReadLine();
107 _defaultResponse += lines; 96 _defaultResponse += lines;
108 //lines = SR.ReadLine();
109 } 97 }
110 SR.Close(); 98 SR.Close();
111 this._mpasswd = EncodePassword("testpass"); 99 this._mpasswd = EncodePassword("testpass");
@@ -113,118 +101,8 @@ namespace OpenSim.UserServer
113 userManager = new LocalUserProfileManager(this.m_gridServer, m_simPort, m_simAddr); 101 userManager = new LocalUserProfileManager(this.m_gridServer, m_simPort, m_simAddr);
114 userManager.InitUserProfiles(); 102 userManager.InitUserProfiles();
115 userManager.SetKeys("", "", "", "Welcome to OpenSim"); 103 userManager.SetKeys("", "", "", "Welcome to OpenSim");
116
117 //loginServer = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
118 // loginServer.Bind(new IPEndPoint(remoteAddress, _loginPort));
119 //loginServer.Listen(1);
120 } 104 }
121 105
122 /* private void RunLogin()
123 {
124 Console.WriteLine("Starting Login Server");
125 try
126 {
127 for (; ; )
128 {
129 Socket client = loginServer.Accept();
130 IPEndPoint clientEndPoint = (IPEndPoint)client.RemoteEndPoint;
131
132
133 NetworkStream networkStream = new NetworkStream(client);
134 StreamReader networkReader = new StreamReader(networkStream);
135 StreamWriter networkWriter = new StreamWriter(networkStream);
136
137 try
138 {
139 LoginRequest(networkReader, networkWriter);
140 }
141 catch (Exception e)
142 {
143 Console.WriteLine(e.Message);
144 }
145
146 networkWriter.Close();
147 networkReader.Close();
148 networkStream.Close();
149
150 client.Close();
151
152 // send any packets queued for injection
153
154 }
155 }
156 catch (Exception e)
157 {
158 Console.WriteLine(e.Message);
159 Console.WriteLine(e.StackTrace);
160 }
161 }
162
163 // ProxyLogin: proxy a login request
164 private void LoginRequest(StreamReader reader, StreamWriter writer)
165 {
166 lock (this)
167 {
168 string line;
169 int contentLength = 0;
170 // read HTTP header
171 do
172 {
173 // read one line of the header
174 line = reader.ReadLine();
175
176 // check for premature EOF
177 if (line == null)
178 throw new Exception("EOF in client HTTP header");
179
180 // look for Content-Length
181 Match match = (new Regex(@"Content-Length: (\d+)$")).Match(line);
182 if (match.Success)
183 contentLength = Convert.ToInt32(match.Groups[1].Captures[0].ToString());
184 } while (line != "");
185
186 // read the HTTP body into a buffer
187 char[] content = new char[contentLength];
188 reader.Read(content, 0, contentLength);
189
190 if (this.userAccounts)
191 {
192 //ask the UserProfile Manager to process the request
193 string reply = this.userManager.ParseXMLRPC(new String(content));
194 // forward the XML-RPC response to the client
195 writer.WriteLine("HTTP/1.0 200 OK");
196 writer.WriteLine("Content-type: text/xml");
197 writer.WriteLine();
198 writer.WriteLine(reply);
199 }
200 else
201 {
202 //handle ourselves
203 XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(new String(content));
204 if (request.MethodName == "login_to_simulator")
205 {
206 this.ProcessXmlRequest(request, writer);
207 }
208 else
209 {
210 XmlRpcResponse PresenceErrorResp = new XmlRpcResponse();
211 Hashtable PresenceErrorRespData = new Hashtable();
212 PresenceErrorRespData["reason"] = "XmlRequest"; ;
213 PresenceErrorRespData["message"] = "Unknown Rpc request";
214 PresenceErrorRespData["login"] = "false";
215 PresenceErrorResp.Value = PresenceErrorRespData;
216 string reply = Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(PresenceErrorResp), " encoding=\"utf-16\"", "");
217 writer.WriteLine("HTTP/1.0 200 OK");
218 writer.WriteLine("Content-type: text/xml");
219 writer.WriteLine();
220 writer.WriteLine(reply);
221 }
222 }
223 }
224 }
225 */
226 //public bool ProcessXmlRequest(XmlRpcRequest request, StreamWriter writer)
227
228 public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) 106 public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
229 { 107 {
230 Console.WriteLine("login attempt"); 108 Console.WriteLine("login attempt");
@@ -267,19 +145,6 @@ namespace OpenSim.UserServer
267 145
268 if (!Authenticate(first, last, passwd)) 146 if (!Authenticate(first, last, passwd))
269 { 147 {
270 /* XmlRpcResponse PresenceErrorResp = new XmlRpcResponse();
271 Hashtable PresenceErrorRespData = new Hashtable();
272 PresenceErrorRespData["reason"] = "key"; ;
273 PresenceErrorRespData["message"] = "You have entered an invalid name/password combination. Check Caps/lock.";
274 PresenceErrorRespData["login"] = "false";
275 PresenceErrorResp.Value = PresenceErrorRespData;
276 string reply = Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(PresenceErrorResp), " encoding=\"utf-16\"", "");
277 writer.WriteLine("HTTP/1.0 200 OK");
278 writer.WriteLine("Content-type: text/xml");
279 writer.WriteLine();
280 writer.WriteLine(reply);
281 return false;*/
282
283 Hashtable loginError = new Hashtable(); 148 Hashtable loginError = new Hashtable();
284 loginError["reason"] = "key"; ; 149 loginError["reason"] = "key"; ;
285 loginError["message"] = "You have entered an invalid name/password combination. Check Caps/lock."; 150 loginError["message"] = "You have entered an invalid name/password combination. Check Caps/lock.";
@@ -356,15 +221,6 @@ namespace OpenSim.UserServer
356 ((LocalGridBase)m_gridServer).AddNewSession(_login); 221 ((LocalGridBase)m_gridServer).AddNewSession(_login);
357 } 222 }
358 223
359 /* // forward the XML-RPC response to the client
360 writer.WriteLine("HTTP/1.0 200 OK");
361 writer.WriteLine("Content-type: text/xml");
362 writer.WriteLine();
363
364 XmlTextWriter responseWriter = new XmlTextWriter(writer);
365 XmlRpcResponseSerializer.Singleton.Serialize(responseWriter, response);
366 responseWriter.Close();*/
367
368 return response; 224 return response;
369 } 225 }
370 226
@@ -445,7 +301,6 @@ namespace OpenSim.UserServer
445 { 301 {
446 302
447 } 303 }
448
449 } 304 }
450 305
451 306