* Added password change support (references #95)

* Fixed 64bit support
* Repaired line endings
* Bumped protocol version
This commit is contained in:
Andreas Schneider 2013-11-20 18:12:52 +01:00
parent 9676549ac3
commit 829a604c30
35 changed files with 21115 additions and 20710 deletions

View File

@ -17,11 +17,11 @@
<VersionInfo> <VersionInfo>
<UseVersionInfo Value="True"/> <UseVersionInfo Value="True"/>
<MinorVersionNr Value="6"/> <MinorVersionNr Value="6"/>
<RevisionNr Value="3"/> <RevisionNr Value="4"/>
<BuildNr Value="241"/> <BuildNr Value="245"/>
<StringTable CompanyName="AKS DataBasis" ProductName="CentrED" InternalName="CentrED" LegalCopyright="(c) 2012 Andreas Schneider" ProductVersion="0.6.3" FileDescription="UO CentrED" OriginalFilename="CentrED.exe"/> <StringTable CompanyName="AKS DataBasis" FileDescription="UO CentrED" InternalName="CentrED" LegalCopyright="(c) 2013 Andreas Schneider" OriginalFilename="CentrED.exe" ProductName="CentrED" ProductVersion="0.6.4"/>
</VersionInfo> </VersionInfo>
<BuildModes Count="3"> <BuildModes Count="4">
<Item1 Name="default" Default="True"/> <Item1 Name="default" Default="True"/>
<Item2 Name="Release Win32"> <Item2 Name="Release Win32">
<MacroValues Count="1"> <MacroValues Count="1">
@ -127,9 +127,61 @@
</Other> </Other>
</CompilerOptions> </CompilerOptions>
</Item3> </Item3>
<Item4 Name="Release Linux GTK2 x64">
<MacroValues Count="1">
<Macro2 Name="LCLWidgetType" Value="gtk2"/>
</MacroValues>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="../bin/CentrED"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir);../Imaging;.."/>
<OtherUnitFiles Value="..;../UOLib;../MulProvider;../Imaging;../Imaging/JpegLib;../Imaging/ZLib;Tools"/>
<UnitOutputDirectory Value="../obj/$(TargetCPU)-$(TargetOS)"/>
<SrcPath Value="$(LazarusDir)/lcl;$(LazarusDir)/lcl/interfaces/$(LCLWidgetType);..;../UOLib;../MulProvider;../Imaging;../Imaging/JpegLib;../Imaging/ZLib;Tools"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<CStyleOperator Value="False"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<TargetCPU Value="x86_64"/>
<TargetOS Value="linux"/>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
<UseLineInfoUnit Value="False"/>
<StripSymbols Value="True"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CompilerMessages>
<IgnoredMessages idx4079="True" idx4080="True" idx4081="True" idx5024="True" idx5028="True"/>
<UseMsgFile Value="True"/>
</CompilerMessages>
<CustomOptions Value="-FE../bin/
-dNoLogging"/>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
</Item4>
<SharedMatrixOptions Count="2"> <SharedMatrixOptions Count="2">
<Item1 ID="851019893220" Modes="Release Win32" Type="IDEMacro" MacroName="LCLWidgetType" Value="win32"/> <Item1 ID="851019893220" Modes="Release Win32" Type="IDEMacro" MacroName="LCLWidgetType" Value="win32"/>
<Item2 ID="521965364444" Modes="Release Linux GTK2 x86" Type="IDEMacro" MacroName="LCLWidgetType" Value="gtk2"/> <Item2 ID="521965364444" Modes="Release Linux GTK2 x86,Release Linux GTK2 x64" Type="IDEMacro" MacroName="LCLWidgetType" Value="gtk2"/>
</SharedMatrixOptions> </SharedMatrixOptions>
</BuildModes> </BuildModes>
<PublishOptions> <PublishOptions>
@ -172,7 +224,7 @@
<MinVersion Major="4" Minor="5" Release="1" Valid="True"/> <MinVersion Major="4" Minor="5" Release="1" Valid="True"/>
</Item6> </Item6>
</RequiredPackages> </RequiredPackages>
<Units Count="48"> <Units Count="49">
<Unit0> <Unit0>
<Filename Value="CentrED.lpr"/> <Filename Value="CentrED.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
@ -190,6 +242,7 @@
<Filename Value="UdmNetwork.pas"/> <Filename Value="UdmNetwork.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="dmNetwork"/> <ComponentName Value="dmNetwork"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="DataModule"/> <ResourceBaseClass Value="DataModule"/>
<UnitName Value="UdmNetwork"/> <UnitName Value="UdmNetwork"/>
</Unit2> </Unit2>
@ -197,6 +250,7 @@
<Filename Value="UfrmLogin.pas"/> <Filename Value="UfrmLogin.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="frmLogin"/> <ComponentName Value="frmLogin"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="UfrmLogin"/> <UnitName Value="UfrmLogin"/>
</Unit3> </Unit3>
@ -455,6 +509,14 @@
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="UContnrExt"/> <UnitName Value="UContnrExt"/>
</Unit47> </Unit47>
<Unit48>
<Filename Value="UfrmChangePassword.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmChangePassword"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="UfrmChangePassword"/>
</Unit48>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>

View File

@ -141,6 +141,7 @@ initialization
//$06-$0B --> handled by TLandscape //$06-$0B --> handled by TLandscape
//$0C --> ClientHandling, done by TfrmMain //$0C --> ClientHandling, done by TfrmMain
//$0D --> RadarMapHandling, done by TfrmRadarMap //$0D --> RadarMapHandling, done by TfrmRadarMap
//$0E --> LargeScaleCommands, done by TfrmLargeScaleCommands
finalization finalization
for i := 0 to $FF do for i := 0 to $FF do
if PacketHandlers[i] <> nil then if PacketHandlers[i] <> nil then

View File

@ -21,7 +21,7 @@
* CDDL HEADER END * CDDL HEADER END
* *
* *
* Portions Copyright 2009 Andreas Schneider * Portions Copyright 2013 Andreas Schneider
*) *)
unit UPackets; unit UPackets;
@ -134,6 +134,12 @@ type
constructor Create(AUsername: string); constructor Create(AUsername: string);
end; end;
{ TChangePasswordPacket }
TChangePasswordPacket = class(TPacket)
constructor Create(AOldPassword, ANewPassword: String);
end;
{ TRequestRadarChecksumPacket } { TRequestRadarChecksumPacket }
TRequestRadarChecksumPacket = class(TPacket) TRequestRadarChecksumPacket = class(TPacket)
@ -346,6 +352,16 @@ begin
FStream.WriteStringNull(AUsername); FStream.WriteStringNull(AUsername);
end; end;
{ TChangePasswordPacket }
constructor TChangePasswordPacket.Create(AOldPassword, ANewPassword: String);
begin
inherited Create($0C, 0);
FStream.WriteByte($08);
FStream.WriteStringNull(AOldPassword);
FStream.WriteStringNull(ANewPassword);
end;
{ TRequestRadarChecksumPacket } { TRequestRadarChecksumPacket }
constructor TRequestRadarChecksumPacket.Create; constructor TRequestRadarChecksumPacket.Create;

View File

@ -78,7 +78,8 @@ uses
UGameResources, UfrmAccountControl, UfrmEditAccount, UfrmDrawSettings, UGameResources, UfrmAccountControl, UfrmEditAccount, UfrmDrawSettings,
UfrmBoundaries, UfrmElevateSettings, UfrmConfirmation, UfrmMoveSettings, UfrmBoundaries, UfrmElevateSettings, UfrmConfirmation, UfrmMoveSettings,
UfrmAbout, UfrmHueSettings, UfrmRadar, UfrmLargeScaleCommand, UfrmAbout, UfrmHueSettings, UfrmRadar, UfrmLargeScaleCommand,
UfrmVirtualLayer, UfrmFilter, UfrmRegionControl, UfrmLightlevel; UfrmVirtualLayer, UfrmFilter, UfrmRegionControl, UfrmLightlevel,
UfrmChangePassword;
{$I version.inc} {$I version.inc}
@ -212,6 +213,7 @@ begin
frmVirtualLayer := TfrmVirtualLayer.Create(frmMain); frmVirtualLayer := TfrmVirtualLayer.Create(frmMain);
frmLightlevel := TfrmLightlevel.Create(frmMain); frmLightlevel := TfrmLightlevel.Create(frmMain);
frmAbout := TfrmAbout.Create(frmMain); frmAbout := TfrmAbout.Create(frmMain);
frmChangePassword := TfrmChangePassword.Create(frmMain);
frmMain.Show; frmMain.Show;
frmInitialize.Hide; frmInitialize.Hide;
tmNoOp.Enabled := True; tmNoOp.Enabled := True;
@ -308,6 +310,7 @@ begin
FreeAndNil(frmLargeScaleCommand); FreeAndNil(frmLargeScaleCommand);
FreeAndNil(frmRadarMap); FreeAndNil(frmRadarMap);
FreeAndNil(frmLightlevel); FreeAndNil(frmLightlevel);
FreeAndNil(frmChangePassword);
if frmMain <> nil then if frmMain <> nil then
begin begin

View File

@ -0,0 +1,129 @@
object frmChangePassword: TfrmChangePassword
Left = 283
Height = 145
Top = 193
Width = 315
BorderStyle = bsDialog
Caption = 'Change Password'
ClientHeight = 145
ClientWidth = 315
OnShow = FormShow
Position = poMainFormCenter
LCLVersion = '1.3'
object Label1: TLabel
AnchorSideTop.Control = edOldPwd
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = edOldPwd
Left = 32
Height = 15
Top = 13
Width = 88
Anchors = [akTop, akRight]
BorderSpacing.Right = 8
Caption = 'Old Password:'
ParentColor = False
end
object Label2: TLabel
AnchorSideTop.Control = edNewPwd
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = edNewPwd
Left = 26
Height = 15
Top = 46
Width = 94
Anchors = [akTop, akRight]
BorderSpacing.Right = 8
Caption = 'New Password:'
ParentColor = False
end
object lblNewPwdRepeat: TLabel
AnchorSideTop.Control = edNewPwdRepeat
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = edNewPwdRepeat
Left = 9
Height = 15
Top = 79
Width = 111
Anchors = [akTop, akRight]
BorderSpacing.Right = 8
Caption = 'Repeat Password:'
ParentColor = False
end
object edOldPwd: TEdit
Left = 128
Height = 25
Top = 8
Width = 176
EchoMode = emPassword
PasswordChar = '*'
TabOrder = 0
end
object edNewPwd: TEdit
AnchorSideLeft.Control = edOldPwd
AnchorSideTop.Control = edOldPwd
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = edOldPwd
AnchorSideRight.Side = asrBottom
Left = 128
Height = 25
Top = 41
Width = 176
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 8
EchoMode = emPassword
OnChange = edNewPwdChange
PasswordChar = '*'
TabOrder = 1
end
object edNewPwdRepeat: TEdit
AnchorSideLeft.Control = edNewPwd
AnchorSideTop.Control = edNewPwd
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = edNewPwd
AnchorSideRight.Side = asrBottom
Left = 128
Height = 25
Top = 74
Width = 176
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 8
EchoMode = emPassword
OnChange = edNewPwdChange
PasswordChar = '*'
TabOrder = 2
end
object btnOK: TButton
AnchorSideTop.Control = btnCancel
AnchorSideRight.Control = btnCancel
Left = 149
Height = 25
Top = 112
Width = 75
Anchors = [akTop, akRight]
BorderSpacing.Right = 8
Caption = '&OK'
Default = True
Enabled = False
ModalResult = 1
OnClick = btnOKClick
TabOrder = 3
end
object btnCancel: TButton
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 232
Height = 25
Top = 112
Width = 75
Anchors = [akRight, akBottom]
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Cancel = True
Caption = 'Cancel'
ModalResult = 2
OnClick = btnCancelClick
TabOrder = 4
end
end

View File

@ -0,0 +1,81 @@
unit UfrmChangePassword;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;
type
{ TfrmChangePassword }
TfrmChangePassword = class(TForm)
btnOK: TButton;
btnCancel: TButton;
edOldPwd: TEdit;
edNewPwd: TEdit;
edNewPwdRepeat: TEdit;
Label1: TLabel;
Label2: TLabel;
lblNewPwdRepeat: TLabel;
procedure btnCancelClick(Sender: TObject);
procedure btnOKClick(Sender: TObject);
procedure edNewPwdChange(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
frmChangePassword: TfrmChangePassword;
implementation
uses
UdmNetwork, UPackets, UEnums;
{$R *.lfm}
{ TfrmChangePassword }
procedure TfrmChangePassword.FormShow(Sender: TObject);
begin
edOldPwd.Text := '';
edNewPwd.Text := '';
edNewPwdRepeat.Text := '';
end;
procedure TfrmChangePassword.btnCancelClick(Sender: TObject);
begin
Close;
end;
procedure TfrmChangePassword.btnOKClick(Sender: TObject);
begin
dmNetwork.Send(TChangePasswordPacket.Create(edOldPwd.Text,
edNewPwd.Text));
end;
procedure TfrmChangePassword.edNewPwdChange(Sender: TObject);
var
pwdValid: Boolean;
begin
if edNewPwd.Text <> edNewPwdRepeat.Text then
begin
pwdValid := False;
lblNewPwdRepeat.Font.Color := clRed;
end else
begin
pwdValid := True;
lblNewPwdRepeat.Font.Color := clDefault;
end;
btnOK.Enabled := (Length(edNewPwd.Text) > 0) and pwdValid;
end;
end.

View File

@ -5,7 +5,7 @@ object frmMain: TfrmMain
Width = 755 Width = 755
ActiveControl = oglGameWindow ActiveControl = oglGameWindow
Caption = 'UO CentrED' Caption = 'UO CentrED'
ClientHeight = 559 ClientHeight = 558
ClientWidth = 755 ClientWidth = 755
Constraints.MinHeight = 500 Constraints.MinHeight = 500
Constraints.MinWidth = 750 Constraints.MinWidth = 750
@ -23,7 +23,7 @@ object frmMain: TfrmMain
object pnlBottom: TPanel object pnlBottom: TPanel
Left = 0 Left = 0
Height = 31 Height = 31
Top = 528 Top = 527
Width = 755 Width = 755
Align = alBottom Align = alBottom
BevelOuter = bvNone BevelOuter = bvNone
@ -34,7 +34,7 @@ object frmMain: TfrmMain
Left = 11 Left = 11
Height = 13 Height = 13
Top = 7 Top = 7
Width = 9 Width = 11
Caption = 'X:' Caption = 'X:'
ParentColor = False ParentColor = False
end end
@ -42,7 +42,7 @@ object frmMain: TfrmMain
Left = 88 Left = 88
Height = 13 Height = 13
Top = 7 Top = 7
Width = 8 Width = 10
Caption = 'Y:' Caption = 'Y:'
ParentColor = False ParentColor = False
end end
@ -50,15 +50,15 @@ object frmMain: TfrmMain
Left = 240 Left = 240
Height = 13 Height = 13
Top = 7 Top = 7
Width = 3 Width = 4
Caption = ' ' Caption = ' '
ParentColor = False ParentColor = False
end end
object lblTip: TLabel object lblTip: TLabel
Left = 524 Left = 501
Height = 31 Height = 31
Top = 0 Top = 0
Width = 223 Width = 246
Align = alRight Align = alRight
Alignment = taRightJustify Alignment = taRightJustify
BorderSpacing.Right = 8 BorderSpacing.Right = 8
@ -67,10 +67,10 @@ object frmMain: TfrmMain
ParentColor = False ParentColor = False
end end
object lblTipC: TLabel object lblTipC: TLabel
Left = 502 Left = 473
Height = 31 Height = 31
Top = 0 Top = 0
Width = 22 Width = 28
Align = alRight Align = alRight
Caption = 'Tip: ' Caption = 'Tip: '
Font.Height = -11 Font.Height = -11
@ -81,7 +81,7 @@ object frmMain: TfrmMain
end end
object edX: TSpinEdit object edX: TSpinEdit
Left = 24 Left = 24
Height = 21 Height = 25
Top = 3 Top = 3
Width = 55 Width = 55
MaxValue = 100000 MaxValue = 100000
@ -89,7 +89,7 @@ object frmMain: TfrmMain
end end
object edY: TSpinEdit object edY: TSpinEdit
Left = 104 Left = 104
Height = 21 Height = 25
Top = 3 Top = 3
Width = 52 Width = 52
MaxValue = 100000 MaxValue = 100000
@ -108,7 +108,7 @@ object frmMain: TfrmMain
end end
object pcLeft: TPageControl object pcLeft: TPageControl
Left = 0 Left = 0
Height = 504 Height = 503
Top = 24 Top = 24
Width = 224 Width = 224
ActivePage = tsTiles ActivePage = tsTiles
@ -117,16 +117,16 @@ object frmMain: TfrmMain
TabOrder = 1 TabOrder = 1
object tsTiles: TTabSheet object tsTiles: TTabSheet
Caption = 'Tiles' Caption = 'Tiles'
ClientHeight = 478 ClientHeight = 472
ClientWidth = 216 ClientWidth = 218
object lblFilter: TLabel object lblFilter: TLabel
AnchorSideLeft.Control = cbTerrain AnchorSideLeft.Control = cbTerrain
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = cbTerrain AnchorSideTop.Control = cbTerrain
Left = 75 Left = 89
Height = 13 Height = 13
Top = 8 Top = 8
Width = 29 Width = 31
BorderSpacing.Left = 16 BorderSpacing.Left = 16
Caption = 'Filter:' Caption = 'Filter:'
ParentColor = False ParentColor = False
@ -140,10 +140,10 @@ object frmMain: TfrmMain
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = spTileList AnchorSideBottom.Control = spTileList
Left = 4 Left = 4
Height = 240 Height = 224
Hint = '-' Hint = '-'
Top = 50 Top = 60
Width = 208 Width = 210
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 4 BorderSpacing.Left = 4
BorderSpacing.Top = 4 BorderSpacing.Top = 4
@ -200,12 +200,12 @@ object frmMain: TfrmMain
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 0 Left = 0
Height = 183 Height = 183
Top = 295 Top = 289
Width = 216 Width = 218
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
Caption = 'Random pool' Caption = 'Random pool'
ClientHeight = 165 ClientHeight = 169
ClientWidth = 212 ClientWidth = 216
TabOrder = 1 TabOrder = 1
object btnAddRandom: TSpeedButton object btnAddRandom: TSpeedButton
AnchorSideLeft.Control = gbRandom AnchorSideLeft.Control = gbRandom
@ -359,10 +359,10 @@ object frmMain: TfrmMain
object btnRandomPresetSave: TSpeedButton object btnRandomPresetSave: TSpeedButton
AnchorSideTop.Control = cbRandomPreset AnchorSideTop.Control = cbRandomPreset
AnchorSideRight.Control = btnRandomPresetDelete AnchorSideRight.Control = btnRandomPresetDelete
Left = 160 Left = 164
Height = 22 Height = 22
Hint = 'Save Preset' Hint = 'Save Preset'
Top = 140 Top = 138
Width = 22 Width = 22
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
BorderSpacing.Right = 4 BorderSpacing.Right = 4
@ -411,10 +411,10 @@ object frmMain: TfrmMain
AnchorSideTop.Control = btnRandomPresetSave AnchorSideTop.Control = btnRandomPresetSave
AnchorSideRight.Control = gbRandom AnchorSideRight.Control = gbRandom
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 186 Left = 190
Height = 22 Height = 22
Hint = 'Delete Preset' Hint = 'Delete Preset'
Top = 140 Top = 138
Width = 22 Width = 22
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
BorderSpacing.Right = 4 BorderSpacing.Right = 4
@ -469,9 +469,9 @@ object frmMain: TfrmMain
AnchorSideBottom.Control = cbRandomPreset AnchorSideBottom.Control = cbRandomPreset
Cursor = 63 Cursor = 63
Left = 4 Left = 4
Height = 112 Height = 110
Top = 24 Top = 24
Width = 204 Width = 208
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 4 BorderSpacing.Left = 4
BorderSpacing.Top = 2 BorderSpacing.Top = 2
@ -517,14 +517,14 @@ object frmMain: TfrmMain
AnchorSideBottom.Control = gbRandom AnchorSideBottom.Control = gbRandom
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 4 Left = 4
Height = 21 Height = 27
Top = 140 Top = 138
Width = 152 Width = 156
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 4 BorderSpacing.Left = 4
BorderSpacing.Right = 4 BorderSpacing.Right = 4
BorderSpacing.Bottom = 4 BorderSpacing.Bottom = 4
ItemHeight = 13 ItemHeight = 0
OnChange = cbRandomPresetChange OnChange = cbRandomPresetChange
Sorted = True Sorted = True
Style = csDropDownList Style = csDropDownList
@ -538,8 +538,8 @@ object frmMain: TfrmMain
Cursor = crVSplit Cursor = crVSplit
Left = 0 Left = 0
Height = 5 Height = 5
Top = 290 Top = 284
Width = 216 Width = 218
Align = alNone Align = alNone
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
ResizeAnchor = akBottom ResizeAnchor = akBottom
@ -549,10 +549,10 @@ object frmMain: TfrmMain
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = vdtTiles AnchorSideBottom.Control = vdtTiles
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 108 Left = 110
Height = 21 Height = 23
Hint = 'Append S or T to restrict the search to Statics or Terrain.' Hint = 'Append S or T to restrict the search to Statics or Terrain.'
Top = 261 Top = 253
Width = 96 Width = 96
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
BorderSpacing.Right = 8 BorderSpacing.Right = 8
@ -571,10 +571,10 @@ object frmMain: TfrmMain
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = tsTiles AnchorSideRight.Control = tsTiles
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 75 Left = 89
Height = 21 Height = 23
Top = 21 Top = 21
Width = 125 Width = 113
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Right = 16 BorderSpacing.Right = 16
OnEditingDone = edFilterEditingDone OnEditingDone = edFilterEditingDone
@ -585,10 +585,10 @@ object frmMain: TfrmMain
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = cbTerrain AnchorSideTop.Control = cbTerrain
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 5 Left = 3
Height = 19 Height = 24
Top = 27 Top = 32
Width = 53 Width = 71
Caption = 'Statics' Caption = 'Statics'
Checked = True Checked = True
OnChange = cbStaticsChange OnChange = cbStaticsChange
@ -599,9 +599,9 @@ object frmMain: TfrmMain
AnchorSideLeft.Control = tsTiles AnchorSideLeft.Control = tsTiles
AnchorSideTop.Control = tsTiles AnchorSideTop.Control = tsTiles
Left = 4 Left = 4
Height = 19 Height = 24
Top = 8 Top = 8
Width = 55 Width = 69
BorderSpacing.Left = 4 BorderSpacing.Left = 4
BorderSpacing.Top = 8 BorderSpacing.Top = 8
Caption = 'Terrain' Caption = 'Terrain'
@ -613,8 +613,8 @@ object frmMain: TfrmMain
end end
object tsClients: TTabSheet object tsClients: TTabSheet
Caption = 'Clients' Caption = 'Clients'
ClientHeight = 478 ClientHeight = 472
ClientWidth = 216 ClientWidth = 218
object lbClients: TListBox object lbClients: TListBox
Left = 0 Left = 0
Height = 478 Height = 478
@ -624,14 +624,16 @@ object frmMain: TfrmMain
ItemHeight = 0 ItemHeight = 0
OnDblClick = mnuGoToClientClick OnDblClick = mnuGoToClientClick
PopupMenu = pmClients PopupMenu = pmClients
ScrollWidth = 214
Sorted = True Sorted = True
TabOrder = 0 TabOrder = 0
TopIndex = -1
end end
end end
object tsLocations: TTabSheet object tsLocations: TTabSheet
Caption = 'Locations' Caption = 'Locations'
ClientHeight = 478 ClientHeight = 472
ClientWidth = 216 ClientWidth = 218
object btnClearLocations: TSpeedButton object btnClearLocations: TSpeedButton
AnchorSideLeft.Control = btnDeleteLocation AnchorSideLeft.Control = btnDeleteLocation
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
@ -1027,7 +1029,7 @@ object frmMain: TfrmMain
AnchorSideBottom.Control = spChat AnchorSideBottom.Control = spChat
Left = 224 Left = 224
Height = 22 Height = 22
Top = 392 Top = 391
Width = 531 Width = 531
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
BevelInner = bvRaised BevelInner = bvRaised
@ -1040,7 +1042,7 @@ object frmMain: TfrmMain
Left = 10 Left = 10
Height = 18 Height = 18
Top = 2 Top = 2
Width = 100 Width = 113
Align = alLeft Align = alLeft
BorderSpacing.Left = 8 BorderSpacing.Left = 8
Caption = 'Chat and Messages' Caption = 'Chat and Messages'
@ -1061,7 +1063,7 @@ object frmMain: TfrmMain
AnchorSideBottom.Control = pnlBottom AnchorSideBottom.Control = pnlBottom
Left = 224 Left = 224
Height = 109 Height = 109
Top = 419 Top = 418
Width = 531 Width = 531
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BevelOuter = bvNone BevelOuter = bvNone
@ -1072,7 +1074,7 @@ object frmMain: TfrmMain
object vstChat: TVirtualStringTree object vstChat: TVirtualStringTree
Cursor = 63 Cursor = 63
Left = 0 Left = 0
Height = 88 Height = 86
Top = 0 Top = 0
Width = 531 Width = 531
Align = alClient Align = alClient
@ -1092,7 +1094,7 @@ object frmMain: TfrmMain
item item
Position = 2 Position = 2
Text = 'Message' Text = 'Message'
Width = 377 Width = 379
end> end>
Header.DefaultHeight = 17 Header.DefaultHeight = 17
Header.MainColumn = 2 Header.MainColumn = 2
@ -1110,8 +1112,8 @@ object frmMain: TfrmMain
end end
object edChat: TEdit object edChat: TEdit
Left = 0 Left = 0
Height = 21 Height = 23
Top = 88 Top = 86
Width = 531 Width = 531
Align = alBottom Align = alBottom
OnKeyPress = edChatKeyPress OnKeyPress = edChatKeyPress
@ -1126,7 +1128,7 @@ object frmMain: TfrmMain
Cursor = crVSplit Cursor = crVSplit
Left = 224 Left = 224
Height = 5 Height = 5
Top = 414 Top = 413
Width = 531 Width = 531
Align = alNone Align = alNone
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
@ -1143,7 +1145,7 @@ object frmMain: TfrmMain
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = pnlChatHeader AnchorSideBottom.Control = pnlChatHeader
Left = 224 Left = 224
Height = 368 Height = 367
Top = 24 Top = 24
Width = 531 Width = 531
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
@ -1164,6 +1166,13 @@ object frmMain: TfrmMain
top = 33 top = 33
object mnuCentrED: TMenuItem object mnuCentrED: TMenuItem
Caption = '&CentrED' Caption = '&CentrED'
object mnuChangePassword: TMenuItem
Caption = '&Change Password'
OnClick = mnuChangePasswordClick
end
object mnuSeparator1: TMenuItem
Caption = '-'
end
object mnuDisconnect: TMenuItem object mnuDisconnect: TMenuItem
Caption = '&Disconnect' Caption = '&Disconnect'
Bitmap.Data = { Bitmap.Data = {
@ -1205,9 +1214,6 @@ object frmMain: TfrmMain
ImageIndex = 0 ImageIndex = 0
OnClick = mnuDisconnectClick OnClick = mnuDisconnectClick
end end
object mnuSeparator1: TMenuItem
Caption = '-'
end
object mnuExit: TMenuItem object mnuExit: TMenuItem
Caption = 'E&xit' Caption = 'E&xit'
OnClick = mnuExitClick OnClick = mnuExitClick

View File

@ -103,6 +103,7 @@ type
lblY: TLabel; lblY: TLabel;
lbClients: TListBox; lbClients: TListBox;
MainMenu1: TMainMenu; MainMenu1: TMainMenu;
mnuChangePassword: TMenuItem;
mnuWhiteBackground: TMenuItem; mnuWhiteBackground: TMenuItem;
mnuSecurityQuestion: TMenuItem; mnuSecurityQuestion: TMenuItem;
mnuShowAnimations: TMenuItem; mnuShowAnimations: TMenuItem;
@ -222,6 +223,7 @@ type
procedure lblChatHeaderCaptionClick(Sender: TObject); procedure lblChatHeaderCaptionClick(Sender: TObject);
procedure lblChatHeaderCaptionMouseEnter(Sender: TObject); procedure lblChatHeaderCaptionMouseEnter(Sender: TObject);
procedure lblChatHeaderCaptionMouseLeave(Sender: TObject); procedure lblChatHeaderCaptionMouseLeave(Sender: TObject);
procedure mnuChangePasswordClick(Sender: TObject);
procedure mnuAboutClick(Sender: TObject); procedure mnuAboutClick(Sender: TObject);
procedure mnuAccountControlClick(Sender: TObject); procedure mnuAccountControlClick(Sender: TObject);
procedure mnuDisconnectClick(Sender: TObject); procedure mnuDisconnectClick(Sender: TObject);
@ -407,7 +409,7 @@ uses
UfrmBoundaries, UfrmElevateSettings, UfrmConfirmation, UfrmMoveSettings, UfrmBoundaries, UfrmElevateSettings, UfrmConfirmation, UfrmMoveSettings,
UfrmAbout, UPacketHandlers, UfrmHueSettings, UfrmRadar, UfrmLargeScaleCommand, UfrmAbout, UPacketHandlers, UfrmHueSettings, UfrmRadar, UfrmLargeScaleCommand,
UfrmLogin, UResourceManager, UfrmVirtualLayer, UfrmFilter, UfrmRegionControl, UfrmLogin, UResourceManager, UfrmVirtualLayer, UfrmFilter, UfrmRegionControl,
Logging, LConvEncoding, LCLType, UfrmLightlevel; Logging, LConvEncoding, LCLType, UfrmLightlevel, UfrmChangePassword;
type type
TGLArrayf4 = array[0..3] of GLfloat; TGLArrayf4 = array[0..3] of GLfloat;
@ -1417,6 +1419,11 @@ begin
lblChatHeaderCaption.Font.Underline := False; lblChatHeaderCaption.Font.Underline := False;
end; end;
procedure TfrmMain.mnuChangePasswordClick(Sender: TObject);
begin
frmChangePassword.ShowModal;
end;
procedure TfrmMain.mnuAboutClick(Sender: TObject); procedure TfrmMain.mnuAboutClick(Sender: TObject);
begin begin
frmAbout.ShowModal; frmAbout.ShowModal;
@ -3060,6 +3067,7 @@ var
i: Integer; i: Integer;
accessLevel: TAccessLevel; accessLevel: TAccessLevel;
accessChangedListener: TAccessChangedListener; accessChangedListener: TAccessChangedListener;
pwdChangeStatus: TPasswordChangeStatus;
begin begin
case ABuffer.ReadByte of case ABuffer.ReadByte of
$01: //client connected $01: //client connected
@ -3117,6 +3125,23 @@ begin
for accessChangedListener in FAccessChangedListeners.Reversed do for accessChangedListener in FAccessChangedListeners.Reversed do
accessChangedListener(accessLevel); accessChangedListener(accessLevel);
end; end;
$08: //password change status
begin
pwdChangeStatus := TPasswordChangeStatus(ABuffer.ReadByte);
case pwdChangeStatus of
pcSuccess:
Messagedlg('Password Change', 'Your password has been changed', mtInformation, [mbOK], 0);
pcOldPwInvalid:
Messagedlg('Password Change', 'The old password is wrong.' + sLineBreak +
'Your password has NOT been changed.', mtWarning, [mbOK], 0);
pcNewPwInvalid:
Messagedlg('Password Change', 'The new password is not allowed.' + sLineBreak +
'Your password has NOT been changed.', mtWarning, [mbOK], 0);
pcIdentical:
Messagedlg('Password Change', 'The new password matched the old password.' + sLineBreak +
'Your password has NOT been changed.', mtWarning, [mbOK], 0);
end;
end;
end; end;
end; end;

View File

@ -336,7 +336,7 @@ implementation
uses uses
{$IF Defined(LCL)} {$IF Defined(LCL)}
{$IF Defined(LCLGTK2)} {$IF Defined(LCLGTK2)}
GLib2, GDK2, GTK2, GTKDef, GTKProc, GLib2, GDK2, GTK2, Gtk2Def, Gtk2Proc,
{$ELSEIF Defined(LCLGTK)} {$ELSEIF Defined(LCLGTK)}
GDK, GTK, GTKDef, GTKProc, GDK, GTK, GTKDef, GTKProc,
{$IFEND} {$IFEND}

View File

@ -21,7 +21,7 @@
* CDDL HEADER END * CDDL HEADER END
* *
* *
* Portions Copyright 2008 Andreas Schneider * Portions Copyright 2013 Andreas Schneider
*) *)
unit UAccount; unit UAccount;
@ -37,7 +37,7 @@ type
{ TAccount } { TAccount }
TAccount = class(TObject, ISerializable, IInvalidate) TAccount = class(TObject, ISerializable, IInvalidate)
constructor Create(AOwner: IInvalidate; AName, APasswordHash: string; constructor Create(AOwner: IInvalidate; AName, APassword: string;
AAccessLevel: TAccessLevel; ARegions: TStringList); AAccessLevel: TAccessLevel; ARegions: TStringList);
constructor Deserialize(AOwner: IInvalidate; AElement: TDOMElement); constructor Deserialize(AOwner: IInvalidate; AElement: TDOMElement);
destructor Destroy; override; destructor Destroy; override;
@ -58,7 +58,9 @@ type
property PasswordHash: string read FPasswordHash write SetPasswordHash; property PasswordHash: string read FPasswordHash write SetPasswordHash;
property LastPos: TPoint read FLastPos write SetLastPos; property LastPos: TPoint read FLastPos write SetLastPos;
property Regions: TStringList read FRegions; property Regions: TStringList read FRegions;
function CheckPassword(APassword: String): Boolean;
procedure Invalidate; procedure Invalidate;
procedure UpdatePassword(APassword: String);
end; end;
{ TAccountList } { TAccountList }
@ -79,17 +81,17 @@ type
implementation implementation
uses uses
UCEDServer, UConfig; UCEDServer, UConfig, md5;
{ TAccount } { TAccount }
constructor TAccount.Create(AOwner: IInvalidate; AName, APasswordHash: string; constructor TAccount.Create(AOwner: IInvalidate; AName, APassword: string;
AAccessLevel: TAccessLevel; ARegions: TStringList); AAccessLevel: TAccessLevel; ARegions: TStringList);
begin begin
inherited Create; inherited Create;
FOwner := AOwner; FOwner := AOwner;
FName := AName; FName := AName;
FPasswordHash := APasswordHash; FPasswordHash := MD5Print(MD5String(APassword));
FAccessLevel := AAccessLevel; FAccessLevel := AAccessLevel;
if ARegions <> nil then if ARegions <> nil then
FRegions := ARegions FRegions := ARegions
@ -154,11 +156,27 @@ begin
Invalidate; Invalidate;
end; end;
function TAccount.CheckPassword(APassword: String): Boolean;
var
testHash: String;
begin
//Since I want to change to PBKDF2 sometime, we compare strings instead
//of MD5Digest, so we can (later) check what type of hash the string has
//been created with.
testHash := MD5Print(MD5String(APassword));
Result := FPasswordHash = testHash;
end;
procedure TAccount.Invalidate; procedure TAccount.Invalidate;
begin begin
FOwner.Invalidate; FOwner.Invalidate;
end; end;
procedure TAccount.UpdatePassword(APassword: String);
begin
PasswordHash := MD5Print(MD5String(APassword));
end;
procedure TAccount.Serialize(AElement: TDOMElement); procedure TAccount.Serialize(AElement: TDOMElement);
var var
i: Integer; i: Integer;

View File

@ -21,7 +21,7 @@
* CDDL HEADER END * CDDL HEADER END
* *
* *
* Portions Copyright 2008 Andreas Schneider * Portions Copyright 2013 Andreas Schneider
*) *)
unit UAdminHandling; unit UAdminHandling;
@ -88,7 +88,7 @@ var
implementation implementation
uses uses
md5, UCEDServer, UPackets, UClientHandling; UCEDServer, UPackets, UClientHandling;
procedure AdminBroadcast(AAccessLevel: TAccessLevel; APacket: TPacket); procedure AdminBroadcast(AAccessLevel: TAccessLevel; APacket: TPacket);
var var
@ -146,7 +146,7 @@ begin
if account <> nil then if account <> nil then
begin begin
if password <> '' then if password <> '' then
account.PasswordHash := MD5Print(MD5String(password)); account.UpdatePassword(password);
account.AccessLevel := accessLevel; account.AccessLevel := accessLevel;
@ -181,8 +181,8 @@ begin
for i := 0 to regionCount - 1 do for i := 0 to regionCount - 1 do
regions.Add(ABuffer.ReadStringNull); regions.Add(ABuffer.ReadStringNull);
account := TAccount.Create(Config.Accounts, username, account := TAccount.Create(Config.Accounts, username, password,
MD5Print(MD5String(password)), accessLevel, regions); accessLevel, regions);
Config.Accounts.Add(account); Config.Accounts.Add(account);
Config.Accounts.Invalidate; Config.Accounts.Invalidate;

View File

@ -217,7 +217,7 @@ begin
try try
buffer := ANetState.ReceiveQueue; buffer := ANetState.ReceiveQueue;
buffer.Position := 0; buffer.Position := 0;
while (buffer.Size >= 1) and ANetState.Socket.Connected do while (buffer.Size >= 1) and (ANetState.Socket.ConnectionStatus = scConnected) do
begin begin
packetID := buffer.ReadByte; packetID := buffer.ReadByte;
packetHandler := PacketHandlers[packetID]; packetHandler := PacketHandlers[packetID];
@ -268,7 +268,7 @@ begin
netState := TNetState(FTCPServer.Iterator.UserData); netState := TNetState(FTCPServer.Iterator.UserData);
if netState <> nil then if netState <> nil then
begin begin
if FTCPServer.Iterator.Connected then if FTCPServer.Iterator.ConnectionStatus = scConnected then
begin begin
if (SecondsBetween(netState.LastAction, Now) > 120) then if (SecondsBetween(netState.LastAction, Now) > 120) then
begin begin
@ -326,7 +326,7 @@ begin
while FTCPServer.IterNext do while FTCPServer.IterNext do
begin begin
netState := TNetState(FTCPServer.Iterator.UserData); netState := TNetState(FTCPServer.Iterator.UserData);
if (netState <> nil) and (FTCPServer.Iterator.Connected) then if (netState <> nil) and (FTCPServer.Iterator.ConnectionStatus = scConnected) then
begin begin
netState.SendQueue.Seek(0, soFromEnd); netState.SendQueue.Seek(0, soFromEnd);
netState.SendQueue.CopyFrom(APacket.Stream, 0); netState.SendQueue.CopyFrom(APacket.Stream, 0);
@ -340,7 +340,7 @@ end;
procedure TCEDServer.Disconnect(ASocket: TLSocket); procedure TCEDServer.Disconnect(ASocket: TLSocket);
begin begin
if ASocket.Connected then if ASocket.ConnectionStatus = scConnected then
begin begin
ASocket.Disconnect; ASocket.Disconnect;
//OnDisconnect(ASocket); //OnDisconnect(ASocket);

View File

@ -71,6 +71,12 @@ type
constructor Create(AAccount: TAccount); constructor Create(AAccount: TAccount);
end; end;
{ TPasswordChangeStatusPacket }
TPasswordChangeStatusPacket = class(TPacket)
constructor Create(AResult: TPasswordChangeStatus);
end;
procedure OnClientHandlerPacket(ABuffer: TEnhancedMemoryStream; procedure OnClientHandlerPacket(ABuffer: TEnhancedMemoryStream;
ANetState: TNetState); ANetState: TNetState);
procedure OnUpdateClientPosPacket(ABuffer: TEnhancedMemoryStream; procedure OnUpdateClientPosPacket(ABuffer: TEnhancedMemoryStream;
@ -79,6 +85,8 @@ procedure OnChatMessagePacket(ABuffer: TEnhancedMemoryStream;
ANetState: TNetState); ANetState: TNetState);
procedure OnGotoClientPosPacket(ABuffer: TEnhancedMemoryStream; procedure OnGotoClientPosPacket(ABuffer: TEnhancedMemoryStream;
ANetState: TNetState); ANetState: TNetState);
procedure OnChangePasswordPacket(ABuffer: TEnhancedMemoryStream;
ANetState: TNetState);
procedure WriteAccountRestrictions(AStream: TEnhancedMemoryStream; procedure WriteAccountRestrictions(AStream: TEnhancedMemoryStream;
AAccount: TAccount); AAccount: TAccount);
@ -130,6 +138,44 @@ begin
TSetClientPosPacket.Create(account.LastPos)); TSetClientPosPacket.Create(account.LastPos));
end; end;
procedure OnChangePasswordPacket(ABuffer: TEnhancedMemoryStream;
ANetState: TNetState);
var
oldPwd, newPwd: String;
begin
oldPwd := ABuffer.ReadStringNull;
newPwd := ABuffer.ReadStringNull;
if ANetState.Account.CheckPassword(oldPwd) then
begin
//Check if the passwords actually differ. Changing them isn't allowed
//otherwise. Might be open for configuration, though.
if oldPwd <> newPwd then
begin
//Just a simple restriction to disallow too easy passwords.
//TODO: Configurable restrictions
if Length(newPwd) >= 4 then
begin
//Everything fine, update the password and report success.
ANetState.Account.UpdatePassword(newPwd);
CEDServerInstance.SendPacket(ANetState,
TPasswordChangeStatusPacket.Create(pcSuccess));
end else
begin
CEDServerInstance.SendPacket(ANetState,
TPasswordChangeStatusPacket.Create(pcNewPwInvalid));
end;
end else
begin
CEDServerInstance.SendPacket(ANetState,
TPasswordChangeStatusPacket.Create(pcIdentical));
end;
end else
begin
CEDServerInstance.SendPacket(ANetState,
TPasswordChangeStatusPacket.Create(pcOldPwInvalid));
end;
end;
procedure WriteAccountRestrictions(AStream: TEnhancedMemoryStream; procedure WriteAccountRestrictions(AStream: TEnhancedMemoryStream;
AAccount: TAccount); AAccount: TAccount);
var var
@ -236,6 +282,15 @@ begin
WriteAccountRestrictions(FStream, AAccount); WriteAccountRestrictions(FStream, AAccount);
end; end;
{ TPasswordChangeStatusPacket }
constructor TPasswordChangeStatusPacket.Create(AResult: TPasswordChangeStatus);
begin
inherited Create($0C, 0);
FStream.WriteByte($08);
FStream.WriteByte(Byte(AResult));
end;
{$WARNINGS OFF} {$WARNINGS OFF}
var var
i: Integer; i: Integer;
@ -246,6 +301,7 @@ initialization
ClientPacketHandlers[$04] := TPacketHandler.Create(0, @OnUpdateClientPosPacket); ClientPacketHandlers[$04] := TPacketHandler.Create(0, @OnUpdateClientPosPacket);
ClientPacketHandlers[$05] := TPacketHandler.Create(0, @OnChatMessagePacket); ClientPacketHandlers[$05] := TPacketHandler.Create(0, @OnChatMessagePacket);
ClientPacketHandlers[$06] := TPacketHandler.Create(0, @OnGotoClientPosPacket); ClientPacketHandlers[$06] := TPacketHandler.Create(0, @OnGotoClientPosPacket);
ClientPacketHandlers[$08] := TPacketHandler.Create(0, @OnChangePasswordPacket);
finalization finalization
for i := 0 to $FF do for i := 0 to $FF do
if ClientPacketHandlers[i] <> nil then if ClientPacketHandlers[i] <> nil then

View File

@ -21,7 +21,7 @@
* CDDL HEADER END * CDDL HEADER END
* *
* *
* Portions Copyright 2008 Andreas Schneider * Portions Copyright 2013 Andreas Schneider
*) *)
unit UConfig; unit UConfig;
@ -30,8 +30,8 @@ unit UConfig;
interface interface
uses uses
Classes, SysUtils, DOM, XMLRead, XMLWrite, md5, Keyboard, UAccount, Classes, SysUtils, DOM, XMLRead, XMLWrite, Keyboard, UAccount, UXmlHelper,
UXmlHelper, UInterfaces, UEnums, URegions; UInterfaces, UEnums, URegions;
type type
@ -292,8 +292,8 @@ begin
until stringValue <> ''; until stringValue <> '';
Write ('Password [hidden]: '); Write ('Password [hidden]: ');
password := QueryPassword; password := QueryPassword;
FAccounts.Add(TAccount.Create(FAccounts, stringValue, FAccounts.Add(TAccount.Create(FAccounts, stringValue, password,
MD5Print(MD5String(password)), alAdministrator, nil)); alAdministrator, nil));
FChanged := True; FChanged := True;
end; end;

View File

@ -21,7 +21,7 @@
* CDDL HEADER END * CDDL HEADER END
* *
* *
* Portions Copyright 2008 Andreas Schneider * Portions Copyright 2013 Andreas Schneider
*) *)
unit UConnectionHandling; unit UConnectionHandling;
@ -63,7 +63,7 @@ var
implementation implementation
uses uses
md5, UCEDServer, UClientHandling, UPackets; UCEDServer, UClientHandling, UPackets;
procedure OnConnectionHandlerPacket(ABuffer: TEnhancedMemoryStream; ANetState: TNetState); procedure OnConnectionHandlerPacket(ABuffer: TEnhancedMemoryStream; ANetState: TNetState);
var var
@ -77,19 +77,19 @@ end;
procedure OnLoginRequestPacket(ABuffer: TEnhancedMemoryStream; procedure OnLoginRequestPacket(ABuffer: TEnhancedMemoryStream;
ANetState: TNetState); ANetState: TNetState);
var var
username, passwordHash: string; username, password: string;
account: TAccount; account: TAccount;
netState: TNetState; netState: TNetState;
invalid: Boolean; invalid: Boolean;
begin begin
username := ABuffer.ReadStringNull; username := ABuffer.ReadStringNull;
passwordHash := MD5Print(MD5String(ABuffer.ReadStringNull)); password := ABuffer.ReadStringNull;
account := Config.Accounts.Find(username); account := Config.Accounts.Find(username);
if account <> nil then if account <> nil then
begin begin
if account.AccessLevel > alNone then if account.AccessLevel > alNone then
begin begin
if account.PasswordHash = passwordHash then if account.CheckPassword(password) then
begin begin
invalid := False; invalid := False;
CEDServerInstance.TCPServer.IterReset; CEDServerInstance.TCPServer.IterReset;

View File

@ -139,7 +139,7 @@ begin
begin begin
subscriptions := CEDServerInstance.Landscape.BlockSubscriptions[ACoords[i].X, ACoords[i].Y]; subscriptions := CEDServerInstance.Landscape.BlockSubscriptions[ACoords[i].X, ACoords[i].Y];
subscriptions.Delete(ANetState); subscriptions.Delete(ANetState);
subscriptions.Add(Integer(ANetState), ANetState); subscriptions.Add(PtrInt(ANetState), ANetState);
if ANetState.Subscriptions.IndexOf(subscriptions) = -1 then if ANetState.Subscriptions.IndexOf(subscriptions) = -1 then
ANetState.Subscriptions.Add(subscriptions); ANetState.Subscriptions.Add(subscriptions);
end; end;

View File

@ -1,4 +1,4 @@
<?xml version="1.0"?> <?xml version="1.0" encoding="UTF-8"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="9"/> <Version Value="9"/>
@ -13,9 +13,9 @@
<VersionInfo> <VersionInfo>
<UseVersionInfo Value="True"/> <UseVersionInfo Value="True"/>
<MinorVersionNr Value="6"/> <MinorVersionNr Value="6"/>
<RevisionNr Value="3"/> <RevisionNr Value="4"/>
<BuildNr Value="240"/> <BuildNr Value="240"/>
<StringTable CompanyName="AKS DataBasis" ProductName="CentrED" InternalName="CentrED Server" LegalCopyright="(c) 2012 Andreas Schneider" ProductVersion="0.6.3" FileDescription="CentrED Server" OriginalFilename="cedserver.exe"/> <StringTable CompanyName="AKS DataBasis" FileDescription="CentrED Server" InternalName="CentrED Server" LegalCopyright="(c) 2013 Andreas Schneider" OriginalFilename="cedserver.exe" ProductName="CentrED" ProductVersion="0.6.4"/>
</VersionInfo> </VersionInfo>
<BuildModes Count="3"> <BuildModes Count="3">
<Item1 Name="default" Default="True"/> <Item1 Name="default" Default="True"/>
@ -69,7 +69,7 @@
</Item2> </Item2>
<Item3 Name="Release Win32"> <Item3 Name="Release Win32">
<MacroValues Count="1"> <MacroValues Count="1">
<Macro1 Name="LCLWidgetType" Value="win32"/> <Macro2 Name="LCLWidgetType" Value="win32"/>
</MacroValues> </MacroValues>
<CompilerOptions> <CompilerOptions>
<Version Value="11"/> <Version Value="11"/>
@ -115,6 +115,10 @@
</Other> </Other>
</CompilerOptions> </CompilerOptions>
</Item3> </Item3>
<SharedMatrixOptions Count="2">
<Item1 ID="285940101796" Modes="Release Linux i686" Type="IDEMacro" MacroName="LCLWidgetType" Value="gtk2"/>
<Item2 ID="285439860087" Modes="Release Win32" Type="IDEMacro" MacroName="LCLWidgetType" Value="win32"/>
</SharedMatrixOptions>
</BuildModes> </BuildModes>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
@ -231,7 +235,6 @@
<Parsing> <Parsing>
<SyntaxOptions> <SyntaxOptions>
<CStyleOperator Value="False"/> <CStyleOperator Value="False"/>
<UseAnsiStrings Value="False"/>
</SyntaxOptions> </SyntaxOptions>
</Parsing> </Parsing>
<Linking> <Linking>

View File

@ -118,7 +118,7 @@ var
length: Integer; length: Integer;
begin begin
Result := ''; Result := '';
buffer := Pointer(LongInt(Memory) + Position); buffer := Pointer(PtrInt(Memory) + Position);
length := 0; length := 0;
while (buffer[length] <> #0) and (length < (Size - Position)) do while (buffer[length] <> #0) and (length < (Size - Position)) do
begin begin
@ -138,7 +138,7 @@ var
length: Integer; length: Integer;
begin begin
Result := ''; Result := '';
buffer := Pointer(LongInt(FMemory) + FPosition); buffer := Pointer(PtrInt(FMemory) + FPosition);
length := 0; length := 0;
while (length < ALength) and (length < (FSize - (FPosition - FLockOffset))) do while (length < ALength) and (length < (FSize - (FPosition - FLockOffset))) do
begin begin
@ -158,7 +158,7 @@ var
length: Integer; length: Integer;
begin begin
Result := ''; Result := '';
buffer := Pointer(LongInt(FMemory) + FPosition); buffer := Pointer(PtrInt(FMemory) + FPosition);
length := 0; length := 0;
while (buffer^[length] <> 0) and (length < (FSize - (FPosition - FLockOffset))) do while (buffer^[length] <> 0) and (length < (FSize - (FPosition - FLockOffset))) do
begin begin

View File

@ -57,6 +57,11 @@ type
TDeleteRegionStatus = (drNotFound = 0, TDeleteRegionStatus = (drNotFound = 0,
drDeleted = 1); drDeleted = 1);
TPasswordChangeStatus = (pcSuccess = 0,
pcOldPwInvalid = 1,
pcNewPwInvalid = 2,
pcIdentical = 3);
function GetAccessLevelString(AAccessLevel: TAccessLevel): string; function GetAccessLevelString(AAccessLevel: TAccessLevel): string;
implementation implementation

Binary file not shown.

View File

@ -1,2 +1,2 @@
const const
ProtocolVersion = 6; ProtocolVersion = 7;