Quote:
Originally Posted by Chernobyl*
A bit edited SMC 0.3, so, got login form appear, but pointless... i don't know nor id, nor pw, nor SS code
So, if anyone got anything to say, please, do it .
|
I worked out a bit of the SMC stuff recently. There's still some minor stuff to work with, but you should be able to make use of a lot of it now.
First, I'll explain their system.
They have a simple group permission system setup, much like any forum system would have. Users are assigned a SMC group. Each group has access to different SMC functionality.
_SecurityDescription : contains the SMC functionality. Three observed columns, an id, a name, and description. The name should follow the format "SMC_*". For login to SMC, SMC_Login is used. For plugins, the format is "SMC_Plugin*". There might be more, but I've not come across them.
_SecurityDescriptionGroup : contains the user groups to which users are assigned. Three observed columns, an id, a name, and a description. The name should just tell a general classification, but it does not have to be anything specific. For example, you can have Group1, Group2, etc... but having something like Admin, StatManager, ServerManager, etc.. might be easier.
_SecurityDescriptionGroupAssign : contains the mappings of user groups to user group permissions. Two observed columns, an id of the group and an id of the permissions. Each permissions for a group has its own row that maps the group id to the permission id. So if you had two groups (1, 2) and three permissions (5, 6, 7), and you wanted to let group 1 have permissions 6 and 7, two rows would be there, "1 6" and "1 7".
The hardest part in working out the database stuff is how the exe's actually use the data. For example, you will see I use tinyint for some of the fields and int for others. The GlobalManager parses the results based on these types so do not change them. I don't know why Joymax's code is setup like this, but it's pretty bad, imo.
Now for getting it all to work.
First, you will need to delete any tables you have that are named: "_SecurityDescription", "_SecurityDescriptionGroup", "_SecurityDescriptionGroupAssign", "_SMC", or "_SMCLog".
Second, you will need to delete any stored procedures named: "_CertifyUser".
Third, change the database name at the top of the following script to match yours. I kept the original database name structure, so mine is called 'account'.
Forth, execute the following sql script in a new query.
Code:
USE [account]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE _SecurityDescription
(
nID int NOT NULL IDENTITY(1,1),
szName varchar(32) NOT NULL,
szDesc varchar(64) NOT NULL,
PRIMARY KEY(nID)
)
GO
insert into _SecurityDescription values('SMC_Login', '')
insert into _SecurityDescription values('SMC_Plugin_cas', '')
insert into _SecurityDescription values('SMC_Plugin_concurrentuserlog', '')
insert into _SecurityDescription values('SMC_Plugin_modulepatch', '')
insert into _SecurityDescription values('SMC_Plugin_notice', '')
insert into _SecurityDescription values('SMC_Plugin_security', '')
insert into _SecurityDescription values('SMC_Plugin_servercontrol', '')
insert into _SecurityDescription values('SMC_Plugin_sr_notice', '')
insert into _SecurityDescription values('SMC_Plugin_sr_userdata', '')
insert into _SecurityDescription values('SMC_Plugin_sr_useredit', '')
insert into _SecurityDescription values('SMC_Plugin_sr_userlog', '')
insert into _SecurityDescription values('SMC_Plugin_sr_userpunishment', '')
insert into _SecurityDescription values('SMC_Plugin_usercontrol', '')
insert into _SecurityDescription values('SMC_Plugin_userstatistics', '')
GO
CREATE TABLE _SecurityDescriptionGroup
(
nID tinyint NOT NULL IDENTITY(1,1),
szName varchar(32) NOT NULL,
szDesc varchar(64) NOT NULL,
PRIMARY KEY(nID)
)
GO
insert into _SecurityDescriptionGroup values('admin', 'Admin group')
GO
CREATE TABLE _SecurityDescriptionGroupAssign
(
nGroupID tinyint NOT NULL,
nDescriptionID tinyint NOT NULL
)
GO
insert into _SecurityDescriptionGroupAssign values( (select nID from _SecurityDescriptionGroup where szName = 'admin'), (select nID from _SecurityDescription where szName = 'SMC_Login') )
insert into _SecurityDescriptionGroupAssign values( (select nID from _SecurityDescriptionGroup where szName = 'admin'), (select nID from _SecurityDescription where szName = 'SMC_Plugin_cas') )
insert into _SecurityDescriptionGroupAssign values( (select nID from _SecurityDescriptionGroup where szName = 'admin'), (select nID from _SecurityDescription where szName = 'SMC_Plugin_concurrentuserlog') )
insert into _SecurityDescriptionGroupAssign values( (select nID from _SecurityDescriptionGroup where szName = 'admin'), (select nID from _SecurityDescription where szName = 'SMC_Plugin_modulepatch') )
insert into _SecurityDescriptionGroupAssign values( (select nID from _SecurityDescriptionGroup where szName = 'admin'), (select nID from _SecurityDescription where szName = 'SMC_Plugin_notice') )
insert into _SecurityDescriptionGroupAssign values( (select nID from _SecurityDescriptionGroup where szName = 'admin'), (select nID from _SecurityDescription where szName = 'SMC_Plugin_security') )
insert into _SecurityDescriptionGroupAssign values( (select nID from _SecurityDescriptionGroup where szName = 'admin'), (select nID from _SecurityDescription where szName = 'SMC_Plugin_servercontrol') )
insert into _SecurityDescriptionGroupAssign values( (select nID from _SecurityDescriptionGroup where szName = 'admin'), (select nID from _SecurityDescription where szName = 'SMC_Plugin_sr_notice') )
insert into _SecurityDescriptionGroupAssign values( (select nID from _SecurityDescriptionGroup where szName = 'admin'), (select nID from _SecurityDescription where szName = 'SMC_Plugin_sr_userdata') )
insert into _SecurityDescriptionGroupAssign values( (select nID from _SecurityDescriptionGroup where szName = 'admin'), (select nID from _SecurityDescription where szName = 'SMC_Plugin_sr_useredit') )
insert into _SecurityDescriptionGroupAssign values( (select nID from _SecurityDescriptionGroup where szName = 'admin'), (select nID from _SecurityDescription where szName = 'SMC_Plugin_sr_userlog') )
insert into _SecurityDescriptionGroupAssign values( (select nID from _SecurityDescriptionGroup where szName = 'admin'), (select nID from _SecurityDescription where szName = 'SMC_Plugin_sr_userpunishment') )
insert into _SecurityDescriptionGroupAssign values( (select nID from _SecurityDescriptionGroup where szName = 'admin'), (select nID from _SecurityDescription where szName = 'SMC_Plugin_usercontrol') )
insert into _SecurityDescriptionGroupAssign values( (select nID from _SecurityDescriptionGroup where szName = 'admin'), (select nID from _SecurityDescription where szName = 'SMC_Plugin_userstatistics') )
GO
CREATE TABLE _SMCLog
(
idx int NOT NULL IDENTITY(1,1),
name varchar(16) NOT NULL,
level int NOT NULL,
message varchar(256) NOT NULL,
unknown int NOT NULL
)
GO
CREATE TABLE _SMC
(
nID int NOT NULL IDENTITY(1,1),
name varchar(16) NOT NULL,
pass varchar(32) NOT NULL,
ss varchar(32) NOT NULL,
smcuser int NOT NULL,
smcgroup int NOT NULL
)
GO
insert into _SMC values('admin', '202cb962ac59075b964b07152d234b70', '202cb962ac59075b964b07152d234b70', 1, (select nID from _SecurityDescriptionGroup where szName = 'admin'))
insert into _SMC values('user', '202cb962ac59075b964b07152d234b70', '202cb962ac59075b964b07152d234b70', 0, 0)
GO
CREATE PROCEDURE _CertifyUser
@name varchar(16),
@pass varchar(32),
@ss varchar(32)
AS
select smcuser, smcgroup from _SMC
where name = @name AND pass = @pass AND ss = @ss
Now to use it, you need to have the CertificationServer running first then the GlobalManager
at minimal.
Assuming you are running those two, which is what I tested with, simply run SMC with an argument of "1" to bypass the need for using "smcupdater.exe". I.e., create a shortcut to smc.exe and add a command line argument to it.
Run smc via the shortcut. The UserID is 'admin' and the Password and SSNumber2 are both '123'. Hit OK to login.
If all is well, you should be able to see the SMC main dialog. You will get a lot of spam messages from 'msg is not completely used'. This can be patched in the exe itself to remove that clutter.
Now it is time to load the plugins.
You might want to turn down or off your sound! An alarm will trigger in the program... Simply go to "Application->LoadPlugins". Some plugins will generate errors upon loading. This is because not all files needed for the SMC stuff was leaked. Other plugins crash on processing the game files from the DownloadServer. I'm guessing more data is missing or the format is unexpected.
Most of the plugins functionality has to be implement still. I.e., you must create all of the additional stored procedures executed by SMC as well as any other tables referenced for it to be useful. To get a feel for it, I'd suggest starting with the "security" DLL, which controls the SMC users.
Now the minor stuff to take heed of is:
* I'm not sure about the exact varchar lengths for the description. If you use too long, it might over flow.
* While the szName length is 32, the plugins seem to implement the buffers wrong, so if you use 32 characters, you will overflow the buffer. Use strings that are less than the sizes for now.
* Passwords and SS numbers are in MD5 format. You can use any online or offline tool to calculate them.
* As mentioned, a lot more work has to be done in terms of the stored procedures and tables the plugins use, but this should be a good start for people to get working on SMC!
* Finally, my stored procedure does not work 100%. I.e., if you type in a user name that does not exist, SMC will start still. I don't know enough about MSSQL and SPs to fix this right now.
One last note: The GlobalManager caches the initial SMC setup on load. If you make changes to it after it is running, you have to
restart it. There might be a way around that, but I've not looked into it. Every change I've made I had to restart the slyz.exe and GlobalManager.exe. Just a heads up!