aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJohn Hurliman2010-03-26 12:21:05 -0700
committerJohn Hurliman2010-03-26 12:21:05 -0700
commit5a2315c68c7ccac2fafeb7e2cd51ecda863a9fa7 (patch)
treee42b1104ade22fdb4dfb2129aad45f908f5a3044 /OpenSim
parentFixed a backwards null check that was preventing estate owner from being set ... (diff)
downloadopensim-SC_OLD-5a2315c68c7ccac2fafeb7e2cd51ecda863a9fa7.zip
opensim-SC_OLD-5a2315c68c7ccac2fafeb7e2cd51ecda863a9fa7.tar.gz
opensim-SC_OLD-5a2315c68c7ccac2fafeb7e2cd51ecda863a9fa7.tar.bz2
opensim-SC_OLD-5a2315c68c7ccac2fafeb7e2cd51ecda863a9fa7.tar.xz
* Fixed a bug with null value handling in WebUtil.BuildQueryString()
* Changed the null check back in estate manager setup but fixed the case for an existing account being found * Implemented SetPassword() in the SimianGrid auth connector
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/WebUtil.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs6
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs43
3 files changed, 50 insertions, 7 deletions
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index 16e44af..2843e20 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -263,8 +263,12 @@ namespace OpenSim.Framework
263 263
264 foreach (string key in parameters.Keys) 264 foreach (string key in parameters.Keys)
265 { 265 {
266 foreach (string value in parameters.GetValues(key)) 266 string[] values = parameters.GetValues(key);
267 items.Add(String.Concat(key, "=", HttpUtility.UrlEncode(value ?? String.Empty))); 267 if (values != null)
268 {
269 foreach (string value in values)
270 items.Add(String.Concat(key, "=", HttpUtility.UrlEncode(value ?? String.Empty)));
271 }
268 } 272 }
269 273
270 return String.Join("&", items.ToArray()); 274 return String.Join("&", items.ToArray());
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 7fed1ea..8a583c1 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1266,8 +1266,9 @@ namespace OpenSim.Region.Framework.Scenes
1266 1266
1267 UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last); 1267 UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last);
1268 1268
1269 if (account != null) 1269 if (account == null)
1270 { 1270 {
1271 // Create a new account
1271 account = new UserAccount(m_regInfo.ScopeID, first, last, String.Empty); 1272 account = new UserAccount(m_regInfo.ScopeID, first, last, String.Empty);
1272 if (account.ServiceURLs == null || (account.ServiceURLs != null && account.ServiceURLs.Count == 0)) 1273 if (account.ServiceURLs == null || (account.ServiceURLs != null && account.ServiceURLs.Count == 0))
1273 { 1274 {
@@ -1325,7 +1326,8 @@ namespace OpenSim.Region.Framework.Scenes
1325 } 1326 }
1326 else 1327 else
1327 { 1328 {
1328 MainConsole.Instance.Output("User account not found. Please enter the name of an existing user"); 1329 m_regInfo.EstateSettings.EstateOwner = account.PrincipalID;
1330 m_regInfo.EstateSettings.Save();
1329 } 1331 }
1330 } 1332 }
1331 } 1333 }
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
index 29c9219..031b326 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
@@ -177,9 +177,46 @@ namespace OpenSim.Services.Connectors.SimianGrid
177 177
178 public bool SetPassword(UUID principalID, string passwd) 178 public bool SetPassword(UUID principalID, string passwd)
179 { 179 {
180 // TODO: Use GetIdentities to find the md5hash identity for principalID 180 // Fetch the user name first
181 // and then update it with AddIdentity 181 NameValueCollection requestArgs = new NameValueCollection
182 m_log.Error("[AUTH CONNECTOR]: Changing passwords is not implemented yet"); 182 {
183 { "RequestMethod", "GetUser" },
184 { "UserID", principalID.ToString() }
185 };
186
187 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
188 if (response["Success"].AsBoolean() && response["User"] is OSDMap)
189 {
190 OSDMap userMap = (OSDMap)response["User"];
191 string identifier = userMap["Name"].AsString();
192
193 if (!String.IsNullOrEmpty(identifier))
194 {
195 // Add/update the md5hash identity
196 requestArgs = new NameValueCollection
197 {
198 { "RequestMethod", "AddIdentity" },
199 { "Identifier", identifier },
200 { "Credential", "$1$" + Utils.MD5String(passwd) },
201 { "Type", "md5hash" },
202 { "UserID", principalID.ToString() }
203 };
204
205 response = WebUtil.PostToService(m_serverUrl, requestArgs);
206 bool success = response["Success"].AsBoolean();
207
208 if (!success)
209 m_log.WarnFormat("[AUTH CONNECTOR]: Failed to set password for {0} ({1})", identifier, principalID);
210
211 return success;
212 }
213 }
214 else
215 {
216 m_log.Warn("[AUTH CONNECTOR]: Failed to retrieve identities for " + principalID + ": " +
217 response["Message"].AsString());
218 }
219
183 return false; 220 return false;
184 } 221 }
185 222