diff options
author | Justin Clarke Casey | 2009-04-30 19:57:07 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-04-30 19:57:07 +0000 |
commit | e7078520db1622b4726a1b9e9c312002a48d474b (patch) | |
tree | 5fc8a27dc6ceb725d8a78c6a964062d0c655d099 /OpenSim | |
parent | Estate owners who are not administrators, even in god mode, should not be (diff) | |
download | opensim-SC-e7078520db1622b4726a1b9e9c312002a48d474b.zip opensim-SC-e7078520db1622b4726a1b9e9c312002a48d474b.tar.gz opensim-SC-e7078520db1622b4726a1b9e9c312002a48d474b.tar.bz2 opensim-SC-e7078520db1622b4726a1b9e9c312002a48d474b.tar.xz |
* refactor: move iar name hashing into a method
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/Communications/OspResolver.cs | 12 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | 2 |
2 files changed, 12 insertions, 2 deletions
diff --git a/OpenSim/Framework/Communications/OspResolver.cs b/OpenSim/Framework/Communications/OspResolver.cs index 4627e30..924a4a9 100644 --- a/OpenSim/Framework/Communications/OspResolver.cs +++ b/OpenSim/Framework/Communications/OspResolver.cs | |||
@@ -105,6 +105,16 @@ namespace OpenSim.Framework.Communications | |||
105 | } | 105 | } |
106 | 106 | ||
107 | /// <summary> | 107 | /// <summary> |
108 | /// Hash a profile name into a UUID | ||
109 | /// </summary> | ||
110 | /// <param name="name"></param> | ||
111 | /// <returns></returns> | ||
112 | public static UUID HashName(string name) | ||
113 | { | ||
114 | return new UUID(Utils.MD5(Encoding.Unicode.GetBytes(name)), 0); | ||
115 | } | ||
116 | |||
117 | /// <summary> | ||
108 | /// Resolve an OSPI name by querying existing persistent user profiles. If there is no persistent user profile | 118 | /// Resolve an OSPI name by querying existing persistent user profiles. If there is no persistent user profile |
109 | /// then a temporary user profile is inserted in the cache. | 119 | /// then a temporary user profile is inserted in the cache. |
110 | /// </summary> | 120 | /// </summary> |
@@ -133,7 +143,7 @@ namespace OpenSim.Framework.Communications | |||
133 | UserProfileData tempUserProfile = new UserProfileData(); | 143 | UserProfileData tempUserProfile = new UserProfileData(); |
134 | tempUserProfile.FirstName = firstName; | 144 | tempUserProfile.FirstName = firstName; |
135 | tempUserProfile.SurName = lastName; | 145 | tempUserProfile.SurName = lastName; |
136 | tempUserProfile.ID = new UUID(Utils.MD5(Encoding.Unicode.GetBytes(tempUserProfile.Name)), 0); | 146 | tempUserProfile.ID = HashName(tempUserProfile.Name); |
137 | 147 | ||
138 | m_log.DebugFormat( | 148 | m_log.DebugFormat( |
139 | "[OSP RESOLVER]: Adding temporary user profile for {0} {1}", tempUserProfile.Name, tempUserProfile.ID); | 149 | "[OSP RESOLVER]: Adding temporary user profile for {0} {1}", tempUserProfile.Name, tempUserProfile.ID); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index d059632..214f494 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -311,7 +311,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
311 | // Check that a suitable temporary user profile has been created. | 311 | // Check that a suitable temporary user profile has been created. |
312 | UserProfileData user2Profile | 312 | UserProfileData user2Profile |
313 | = scene.CommsManager.UserService.GetUserProfile( | 313 | = scene.CommsManager.UserService.GetUserProfile( |
314 | new UUID(Utils.MD5(Encoding.Unicode.GetBytes(user2FirstName + " " + user2LastName)), 0)); | 314 | OspResolver.HashName(user2FirstName + " " + user2LastName)); |
315 | Assert.That(user2Profile, Is.Not.Null); | 315 | Assert.That(user2Profile, Is.Not.Null); |
316 | Assert.That(user2Profile.FirstName == user2FirstName); | 316 | Assert.That(user2Profile.FirstName == user2FirstName); |
317 | Assert.That(user2Profile.SurName == user2LastName); | 317 | Assert.That(user2Profile.SurName == user2LastName); |