aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer/UserServer/LoginServer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim.RegionServer/UserServer/LoginServer.cs')
-rw-r--r--OpenSim.RegionServer/UserServer/LoginServer.cs145
1 files changed, 0 insertions, 145 deletions
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