diff options
author | MW | 2007-08-11 11:59:51 +0000 |
---|---|---|
committer | MW | 2007-08-11 11:59:51 +0000 |
commit | 114807b9d1caeffad1f245982baa2c07e88ee470 (patch) | |
tree | f3a3ed3c24de47085192d7215a81ef25254fceda /OpenSim/Region/Communications/Local | |
parent | Few small fixes (diff) | |
download | opensim-SC-114807b9d1caeffad1f245982baa2c07e88ee470.zip opensim-SC-114807b9d1caeffad1f245982baa2c07e88ee470.tar.gz opensim-SC-114807b9d1caeffad1f245982baa2c07e88ee470.tar.bz2 opensim-SC-114807b9d1caeffad1f245982baa2c07e88ee470.tar.xz |
Made account Authentication optional in "sandbox/standalone" mode. Just change "standalone_authenticate = false" to be true in OpenSim.ini. Then as per grid mode, you can use the "create user" command to create new accounts.
Diffstat (limited to 'OpenSim/Region/Communications/Local')
-rw-r--r-- | OpenSim/Region/Communications/Local/CommunicationsLocal.cs | 32 | ||||
-rw-r--r-- | OpenSim/Region/Communications/Local/LocalUserServices.cs | 23 |
2 files changed, 49 insertions, 6 deletions
diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs index 0c40453..69352d1 100644 --- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs +++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs | |||
@@ -25,10 +25,13 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | ||
28 | using OpenSim.Framework.Communications; | 29 | using OpenSim.Framework.Communications; |
29 | using OpenSim.Framework.Types; | 30 | using OpenSim.Framework.Types; |
30 | using OpenSim.Framework.Servers; | 31 | using OpenSim.Framework.Servers; |
31 | using OpenSim.Framework.Communications.Caches; | 32 | using OpenSim.Framework.Communications.Caches; |
33 | using OpenSim.Framework.Console; | ||
34 | using OpenSim.Framework.Utilities; | ||
32 | 35 | ||
33 | namespace OpenSim.Region.Communications.Local | 36 | namespace OpenSim.Region.Communications.Local |
34 | { | 37 | { |
@@ -37,10 +40,10 @@ namespace OpenSim.Region.Communications.Local | |||
37 | public LocalBackEndServices SandBoxServices = new LocalBackEndServices(); | 40 | public LocalBackEndServices SandBoxServices = new LocalBackEndServices(); |
38 | public LocalUserServices UserServices; | 41 | public LocalUserServices UserServices; |
39 | 42 | ||
40 | public CommunicationsLocal(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache ) | 43 | public CommunicationsLocal(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache, bool accountsAuthenticate ) |
41 | : base(serversInfo, httpServer, assetCache) | 44 | : base(serversInfo, httpServer, assetCache) |
42 | { | 45 | { |
43 | UserServices = new LocalUserServices(this, serversInfo); | 46 | UserServices = new LocalUserServices(this, serversInfo, accountsAuthenticate); |
44 | UserServices.AddPlugin("OpenSim.Framework.Data.DB4o.dll"); | 47 | UserServices.AddPlugin("OpenSim.Framework.Data.DB4o.dll"); |
45 | UserServer = UserServices; | 48 | UserServer = UserServices; |
46 | GridServer = SandBoxServices; | 49 | GridServer = SandBoxServices; |
@@ -52,5 +55,30 @@ namespace OpenSim.Region.Communications.Local | |||
52 | { | 55 | { |
53 | this.SandBoxServices.AddNewSession(regionHandle, login); | 56 | this.SandBoxServices.AddNewSession(regionHandle, login); |
54 | } | 57 | } |
58 | |||
59 | public void do_create(string what) | ||
60 | { | ||
61 | switch (what) | ||
62 | { | ||
63 | case "user": | ||
64 | string tempfirstname; | ||
65 | string templastname; | ||
66 | string tempMD5Passwd; | ||
67 | uint regX = 1000; | ||
68 | uint regY = 1000; | ||
69 | |||
70 | tempfirstname = MainLog.Instance.CmdPrompt("First name"); | ||
71 | templastname = MainLog.Instance.CmdPrompt("Last name"); | ||
72 | tempMD5Passwd = MainLog.Instance.PasswdPrompt("Password"); | ||
73 | regX = Convert.ToUInt32(MainLog.Instance.CmdPrompt("Start Region X")); | ||
74 | regY = Convert.ToUInt32(MainLog.Instance.CmdPrompt("Start Region Y")); | ||
75 | |||
76 | tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); | ||
77 | |||
78 | this.UserServices.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); | ||
79 | break; | ||
80 | } | ||
81 | } | ||
82 | |||
55 | } | 83 | } |
56 | } | 84 | } |
diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs index cc80c81..223c157 100644 --- a/OpenSim/Region/Communications/Local/LocalUserServices.cs +++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs | |||
@@ -15,13 +15,15 @@ namespace OpenSim.Region.Communications.Local | |||
15 | private NetworkServersInfo serversInfo; | 15 | private NetworkServersInfo serversInfo; |
16 | private uint defaultHomeX ; | 16 | private uint defaultHomeX ; |
17 | private uint defaultHomeY; | 17 | private uint defaultHomeY; |
18 | private bool authUsers = false; | ||
18 | 19 | ||
19 | public LocalUserServices(CommunicationsLocal parent, NetworkServersInfo serversInfo) | 20 | public LocalUserServices(CommunicationsLocal parent, NetworkServersInfo serversInfo, bool authenticate) |
20 | { | 21 | { |
21 | m_Parent = parent; | 22 | m_Parent = parent; |
22 | this.serversInfo = serversInfo; | 23 | this.serversInfo = serversInfo; |
23 | defaultHomeX = this.serversInfo.DefaultHomeLocX; | 24 | defaultHomeX = this.serversInfo.DefaultHomeLocX; |
24 | defaultHomeY = this.serversInfo.DefaultHomeLocY; | 25 | defaultHomeY = this.serversInfo.DefaultHomeLocY; |
26 | this.authUsers = authenticate; | ||
25 | } | 27 | } |
26 | 28 | ||
27 | public UserProfileData GetUserProfile(string firstName, string lastName) | 29 | public UserProfileData GetUserProfile(string firstName, string lastName) |
@@ -68,9 +70,22 @@ namespace OpenSim.Region.Communications.Local | |||
68 | 70 | ||
69 | public override bool AuthenticateUser(UserProfileData profile, string password) | 71 | public override bool AuthenticateUser(UserProfileData profile, string password) |
70 | { | 72 | { |
71 | //for now we will accept any password in sandbox mode | 73 | if (!authUsers) |
72 | Console.WriteLine("authorising user"); | 74 | { |
73 | return true; | 75 | //for now we will accept any password in sandbox mode |
76 | Console.WriteLine("authorising user"); | ||
77 | return true; | ||
78 | } | ||
79 | else | ||
80 | { | ||
81 | Console.WriteLine( "Authenticating " + profile.username + " " + profile.surname); | ||
82 | |||
83 | password = password.Remove(0, 3); //remove $1$ | ||
84 | |||
85 | string s = Util.Md5Hash(password + ":" + profile.passwordSalt); | ||
86 | |||
87 | return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase); | ||
88 | } | ||
74 | } | 89 | } |
75 | 90 | ||
76 | public override void CustomiseResponse(LoginResponse response, UserProfileData theUser) | 91 | public override void CustomiseResponse(LoginResponse response, UserProfileData theUser) |