diff options
Diffstat (limited to 'linden/indra/newview/lluserauth.cpp')
-rw-r--r-- | linden/indra/newview/lluserauth.cpp | 92 |
1 files changed, 90 insertions, 2 deletions
diff --git a/linden/indra/newview/lluserauth.cpp b/linden/indra/newview/lluserauth.cpp index 3c630b4..44df12c 100644 --- a/linden/indra/newview/lluserauth.cpp +++ b/linden/indra/newview/lluserauth.cpp | |||
@@ -12,12 +12,12 @@ | |||
12 | * ("GPL"), unless you have obtained a separate licensing agreement | 12 | * ("GPL"), unless you have obtained a separate licensing agreement |
13 | * ("Other License"), formally executed by you and Linden Lab. Terms of | 13 | * ("Other License"), formally executed by you and Linden Lab. Terms of |
14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | 14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or |
15 | * online at http://secondlife.com/developers/opensource/gplv2 | 15 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 |
16 | * | 16 | * |
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlife.com/developers/opensource/flossexception | 20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception |
21 | * | 21 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 22 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 23 | * that you have read and understood your obligations described above, |
@@ -163,6 +163,94 @@ void LLUserAuth::authenticate( | |||
163 | llinfos << "LLUserAuth::authenticate: uri=" << auth_uri << llendl; | 163 | llinfos << "LLUserAuth::authenticate: uri=" << auth_uri << llendl; |
164 | } | 164 | } |
165 | 165 | ||
166 | |||
167 | |||
168 | // Legacy version of constructor | ||
169 | |||
170 | // passwd is already MD5 hashed by the time we get to it. | ||
171 | void LLUserAuth::authenticate( | ||
172 | const char* auth_uri, | ||
173 | const char* method, | ||
174 | const char* firstname, | ||
175 | const char* lastname, | ||
176 | const char* passwd, | ||
177 | const char* start, | ||
178 | BOOL skip_optional, | ||
179 | BOOL accept_tos, | ||
180 | BOOL accept_critical_message, | ||
181 | const LLUUID& viewer_digest, | ||
182 | BOOL last_exec_froze, | ||
183 | const std::vector<const char*>& requested_options, | ||
184 | const std::string& hashed_mac, | ||
185 | const std::string& hashed_volume_serial) | ||
186 | { | ||
187 | std::string dpasswd("$1$"); | ||
188 | dpasswd.append(passwd); | ||
189 | llinfos << "Authenticating: " << firstname << " " << lastname << ", " | ||
190 | << /*dpasswd.c_str() <<*/ llendl; | ||
191 | std::ostringstream option_str; | ||
192 | option_str << "Options: "; | ||
193 | std::ostream_iterator<const char*> appender(option_str, ", "); | ||
194 | std::copy(requested_options.begin(), requested_options.end(), appender); | ||
195 | option_str << "END"; | ||
196 | llinfos << option_str.str().c_str() << llendl; | ||
197 | |||
198 | mAuthResponse = E_NO_RESPONSE_YET; | ||
199 | //mDownloadTimer.reset(); | ||
200 | |||
201 | // create the request | ||
202 | XMLRPC_REQUEST request = XMLRPC_RequestNew(); | ||
203 | XMLRPC_RequestSetMethodName(request, method); | ||
204 | XMLRPC_RequestSetRequestType(request, xmlrpc_request_call); | ||
205 | |||
206 | // stuff the parameters | ||
207 | XMLRPC_VALUE params = XMLRPC_CreateVector(NULL, xmlrpc_vector_struct); | ||
208 | XMLRPC_VectorAppendString(params, "first", firstname, 0); | ||
209 | XMLRPC_VectorAppendString(params, "last", lastname, 0); | ||
210 | XMLRPC_VectorAppendString(params, "passwd", dpasswd.c_str(), 0); | ||
211 | XMLRPC_VectorAppendString(params, "start", start, 0); | ||
212 | XMLRPC_VectorAppendString(params, "version", gCurrentVersion.c_str(), 0); // Includes channel name | ||
213 | XMLRPC_VectorAppendString(params, "channel", gChannelName.c_str(), 0); | ||
214 | XMLRPC_VectorAppendString(params, "platform", PLATFORM_STRING, 0); | ||
215 | XMLRPC_VectorAppendString(params, "mac", hashed_mac.c_str(), 0); | ||
216 | // A bit of security through obscurity: id0 is volume_serial | ||
217 | XMLRPC_VectorAppendString(params, "id0", hashed_volume_serial.c_str(), 0); | ||
218 | if (skip_optional) | ||
219 | { | ||
220 | XMLRPC_VectorAppendString(params, "skipoptional", "true", 0); | ||
221 | } | ||
222 | if (accept_tos) | ||
223 | { | ||
224 | XMLRPC_VectorAppendString(params, "agree_to_tos", "true", 0); | ||
225 | } | ||
226 | if (accept_critical_message) | ||
227 | { | ||
228 | XMLRPC_VectorAppendString(params, "read_critical", "true", 0); | ||
229 | } | ||
230 | XMLRPC_VectorAppendString(params, "viewer_digest", viewer_digest.asString().c_str(), 0); | ||
231 | XMLRPC_VectorAppendInt(params, "last_exec_event", (int) last_exec_froze); | ||
232 | |||
233 | // append optional requests in an array | ||
234 | XMLRPC_VALUE options = XMLRPC_CreateVector("options", xmlrpc_vector_array); | ||
235 | std::vector<const char*>::const_iterator it = requested_options.begin(); | ||
236 | std::vector<const char*>::const_iterator end = requested_options.end(); | ||
237 | for( ; it < end; ++it) | ||
238 | { | ||
239 | XMLRPC_VectorAppendString(options, NULL, (*it), 0); | ||
240 | } | ||
241 | XMLRPC_AddValueToVector(params, options); | ||
242 | |||
243 | // put the parameters on the request | ||
244 | XMLRPC_RequestSetData(request, params); | ||
245 | |||
246 | mTransaction = new LLXMLRPCTransaction(auth_uri, request); | ||
247 | |||
248 | XMLRPC_RequestFree(request, 1); | ||
249 | |||
250 | llinfos << "LLUserAuth::authenticate: uri=" << auth_uri << llendl; | ||
251 | } | ||
252 | |||
253 | |||
166 | LLUserAuth::UserAuthcode LLUserAuth::authResponse() | 254 | LLUserAuth::UserAuthcode LLUserAuth::authResponse() |
167 | { | 255 | { |
168 | if (!mTransaction) | 256 | if (!mTransaction) |