Skip to content

Commit

Permalink
1. 修复NetService的脚本错误
Browse files Browse the repository at this point in the history
2. 适应登陆协议错误的修正,做了些改动
3. 密码做了SHA1计算,才传给服务端

git-svn-id: http://subversion.assembla.com/svn/vnoc/trunk@255 36a5fca6-8feb-4701-ac75-490187a78786
  • Loading branch information
bengin committed Jun 13, 2012
1 parent 1e9fb51 commit 6b12fde
Show file tree
Hide file tree
Showing 13 changed files with 1,326 additions and 23 deletions.
6 changes: 3 additions & 3 deletions NetService/ServerPostBuild.bat
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
@echo off
@cd ..
setlocal EnableDelayedExpansion

@if "%1"=="RELEASE" goto gRelease
;
cd
xcopy /e/c/y "../VisualLeakDetector/bin/win32" "Debug" > nul

goto gEnd

:gRelease
;
@xcopy /e/c/y "../VisualLeakDetector/bin/win32" "Release" > nul

:gEnd
@echo "Post Dispatch OK!"
28 changes: 14 additions & 14 deletions VNOC/VNOC.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VNOC", "VNOC\VNOC.vcxproj",
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MyNetClient", "..\MyNetClient\MyNetClient.vcxproj", "{BF0C816A-FB56-47B1-84BB-881F6E320887}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cppunit_vs10", "..\cppunit-1.12.1\src\cppunit\cppunit_vs10.vcxproj", "{F80B2DA6-C279-B8DA-5E33-D58D3486560F}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cppunit_vs10", "..\cppunit-1.12.1\src\cppunit\cppunit_vs10.vcxproj", "{85AFC928-BE19-F7CA-113B-8D128D323A90}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testRunner", "VNOC\testRunner\testRunner.vcxproj", "{5857152D-B7F5-4175-AD8C-DEA94DEDA32B}"
ProjectSection(ProjectDependencies) = postProject
{F80B2DA6-C279-B8DA-5E33-D58D3486560F} = {F80B2DA6-C279-B8DA-5E33-D58D3486560F}
{85AFC928-BE19-F7CA-113B-8D128D323A90} = {85AFC928-BE19-F7CA-113B-8D128D323A90}
EndProjectSection
EndProject
Global
Expand Down Expand Up @@ -39,18 +39,18 @@ Global
{BF0C816A-FB56-47B1-84BB-881F6E320887}.Release|x64.ActiveCfg = Release|Win32
{BF0C816A-FB56-47B1-84BB-881F6E320887}.VldMemLeakCheck|Win32.ActiveCfg = Release|Win32
{BF0C816A-FB56-47B1-84BB-881F6E320887}.VldMemLeakCheck|x64.ActiveCfg = Release|Win32
{F80B2DA6-C279-B8DA-5E33-D58D3486560F}.Debug|Win32.ActiveCfg = Debug|Win32
{F80B2DA6-C279-B8DA-5E33-D58D3486560F}.Debug|Win32.Build.0 = Debug|Win32
{F80B2DA6-C279-B8DA-5E33-D58D3486560F}.Debug|x64.ActiveCfg = Debug|x64
{F80B2DA6-C279-B8DA-5E33-D58D3486560F}.Debug|x64.Build.0 = Debug|x64
{F80B2DA6-C279-B8DA-5E33-D58D3486560F}.Release|Win32.ActiveCfg = Release|Win32
{F80B2DA6-C279-B8DA-5E33-D58D3486560F}.Release|Win32.Build.0 = Release|Win32
{F80B2DA6-C279-B8DA-5E33-D58D3486560F}.Release|x64.ActiveCfg = Release|x64
{F80B2DA6-C279-B8DA-5E33-D58D3486560F}.Release|x64.Build.0 = Release|x64
{F80B2DA6-C279-B8DA-5E33-D58D3486560F}.VldMemLeakCheck|Win32.ActiveCfg = Debug|Win32
{F80B2DA6-C279-B8DA-5E33-D58D3486560F}.VldMemLeakCheck|Win32.Build.0 = Debug|Win32
{F80B2DA6-C279-B8DA-5E33-D58D3486560F}.VldMemLeakCheck|x64.ActiveCfg = Template|x64
{F80B2DA6-C279-B8DA-5E33-D58D3486560F}.VldMemLeakCheck|x64.Build.0 = Template|x64
{85AFC928-BE19-F7CA-113B-8D128D323A90}.Debug|Win32.ActiveCfg = Debug|Win32
{85AFC928-BE19-F7CA-113B-8D128D323A90}.Debug|Win32.Build.0 = Debug|Win32
{85AFC928-BE19-F7CA-113B-8D128D323A90}.Debug|x64.ActiveCfg = Debug|x64
{85AFC928-BE19-F7CA-113B-8D128D323A90}.Debug|x64.Build.0 = Debug|x64
{85AFC928-BE19-F7CA-113B-8D128D323A90}.Release|Win32.ActiveCfg = Release|Win32
{85AFC928-BE19-F7CA-113B-8D128D323A90}.Release|Win32.Build.0 = Release|Win32
{85AFC928-BE19-F7CA-113B-8D128D323A90}.Release|x64.ActiveCfg = Release|x64
{85AFC928-BE19-F7CA-113B-8D128D323A90}.Release|x64.Build.0 = Release|x64
{85AFC928-BE19-F7CA-113B-8D128D323A90}.VldMemLeakCheck|Win32.ActiveCfg = Debug|Win32
{85AFC928-BE19-F7CA-113B-8D128D323A90}.VldMemLeakCheck|Win32.Build.0 = Debug|Win32
{85AFC928-BE19-F7CA-113B-8D128D323A90}.VldMemLeakCheck|x64.ActiveCfg = Template|x64
{85AFC928-BE19-F7CA-113B-8D128D323A90}.VldMemLeakCheck|x64.Build.0 = Template|x64
{5857152D-B7F5-4175-AD8C-DEA94DEDA32B}.Debug|Win32.ActiveCfg = Debug|Win32
{5857152D-B7F5-4175-AD8C-DEA94DEDA32B}.Debug|Win32.Build.0 = Debug|Win32
{5857152D-B7F5-4175-AD8C-DEA94DEDA32B}.Debug|x64.ActiveCfg = Debug|Win32
Expand Down
6 changes: 6 additions & 0 deletions VNOC/VNOC/VNOC.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,11 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\sha1\sha1.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='VldMemLeakCheck|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\TinyXML\tinystr.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='VldMemLeakCheck|Win32'">NotUsing</PrecompiledHeader>
Expand Down Expand Up @@ -267,6 +272,7 @@
<ClInclude Include="..\..\scintilla\include\Platform.h" />
<ClInclude Include="..\..\scintilla\include\SciLexer.h" />
<ClInclude Include="..\..\scintilla\include\Scintilla.h" />
<ClInclude Include="..\..\sha1\sha1.h" />
<ClInclude Include="..\..\TinyXML\tinystr.h" />
<ClInclude Include="..\..\TinyXML\tinyxml.h" />
<ClInclude Include="..\util\BLog.h" />
Expand Down
9 changes: 9 additions & 0 deletions VNOC/VNOC/VNOC.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@
<Filter Include="ErrorMessage">
<UniqueIdentifier>{b2fd2961-0b64-4e90-adc9-8ff245d8b7a6}</UniqueIdentifier>
</Filter>
<Filter Include="util\sha1">
<UniqueIdentifier>{c02f1cda-9213-4df7-932a-10b0be8ed19e}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="HyperLink.cpp">
Expand Down Expand Up @@ -159,6 +162,9 @@
<ClCompile Include="Error.cpp">
<Filter>ErrorMessage</Filter>
</ClCompile>
<ClCompile Include="..\..\sha1\sha1.cpp">
<Filter>util\sha1</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="HyperLink.h">
Expand Down Expand Up @@ -314,6 +320,9 @@
<ClInclude Include="ErrorBase.h">
<Filter>ErrorMessage</Filter>
</ClInclude>
<ClInclude Include="..\..\sha1\sha1.h">
<Filter>util\sha1</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="res\VNOC.ico">
Expand Down
25 changes: 19 additions & 6 deletions VNOC/VNOC/VNOCLoginDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include "Config.h"
#include "INet.h"

#include "../../sha1/sha1.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif
Expand All @@ -25,7 +27,7 @@ CVNOCLoginDlg::CVNOCLoginDlg(CWnd* pParent /*=NULL*/)
{
m_bVerifying = FALSE;
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
m_nlHelper.AddFilter(MSG_AVC_TYPE,this);
m_nlHelper.AddFilter(MSG_ALI_TYPE,this);
m_nlHelper.StartListen();
}

Expand Down Expand Up @@ -105,7 +107,7 @@ HCURSOR CVNOCLoginDlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hIcon);
}

#include <atlconv.h>

void CVNOCLoginDlg::OnBnClickedOk()
{
Expand All @@ -116,16 +118,27 @@ void CVNOCLoginDlg::OnBnClickedOk()
OnOK();
}

SHA1 shaer;
shaer.Reset();

CStringA pwdBuffer = CT2A(m_strPassword);
shaer.Input(pwdBuffer,pwdBuffer.GetLength());
UINT pResult[5];
shaer.Result(pResult);
pwdBuffer.Format("%08x%08x%08x%08x%08x"
,pResult[0],pResult[1],pResult[2],pResult[3],pResult[4]);
Global->Logf(LogFile_General,_T("SHA1后的密码为:%s\n"),CA2T(pwdBuffer));

INetCenter *pInet=NULL;
Global->GetINetCenter(&pInet);
ATLASSERT(pInet);
if (pInet)
{
MSG_RLI mRli;
mRli.SetAccountNumber((const byte*)(LPCTSTR)m_strUsername,m_strUsername.GetLength()*sizeof(TCHAR));
mRli.SetPassword((const byte*)(LPCTSTR)m_strPassword,m_strUsername.GetLength()*sizeof(TCHAR));
mRli.SetAccountNumber((byte*)(LPCTSTR)m_strUsername,m_strUsername.GetLength()*sizeof(TCHAR));
mRli.SetPassword((byte*)(LPCSTR)pwdBuffer,pwdBuffer.GetLength()*sizeof(TCHAR));
pInet->SendServer(mRli);
//mRli.SetVerificationCode()

_SetVerifyState(TRUE);
SetTimer(0,5000,NULL);
}
Expand Down Expand Up @@ -164,13 +177,13 @@ HRESULT CVNOCLoginDlg::OnMessage( const CMessage& msg )
const MSG_ALI* ma = dynamic_cast<const MSG_ALI*>(&msg);
if (ma->GetLoginResult() == 1)
{
_SetVerifyState(FALSE);
OnOK();
}
else
{
MessageBox(_T("登陆失败,服务器拒绝登陆 ."));
}
_SetVerifyState(FALSE);
}
return S_OK;
}
Expand Down
41 changes: 41 additions & 0 deletions sha1/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#
# Makefile
#
# Copyright (C) 1998, 2009
# Paul E. Jones <[email protected]>
# All Rights Reserved.
#
#############################################################################
# $Id: Makefile 12 2009-06-22 19:34:25Z paulej $
#############################################################################
#
# Description:
# This is a makefile for UNIX to build the programs sha, shacmp, and
# shatest
#
#

CC = g++

CFLAGS = -c -O2 -Wall -D_FILE_OFFSET_BITS=64

LIBS =

OBJS = sha1.o

all: sha shacmp shatest

sha: sha.o $(OBJS)
$(CC) -o $@ sha.o $(OBJS) $(LIBS)

shacmp: shacmp.o $(OBJS)
$(CC) -o $@ shacmp.o $(OBJS) $(LIBS)

shatest: shatest.o $(OBJS)
$(CC) -o $@ shatest.o $(OBJS) $(LIBS)

%.o: %.cpp
$(CC) $(CFLAGS) -o $@ $<

clean:
$(RM) *.o sha shacmp shatest
48 changes: 48 additions & 0 deletions sha1/Makefile.nt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#
# Makefile.nt
#
# Copyright (C) 1998, 2009
# Paul E. Jones <[email protected]>
# All Rights Reserved.
#
#############################################################################
# $Id: Makefile.nt 13 2009-06-22 20:20:32Z paulej $
#############################################################################
#
# Description:
# This is a makefile for Win32 to build the programs sha, shacmp, and
# shatest
#
# Portability Issues:
# Designed to work with Visual C++
#
#

.silent:

!include <win32.mak>

RM = del /q

LIBS = $(conlibs) setargv.obj

CFLAGS = -D _CRT_SECURE_NO_WARNINGS /EHsc /O2 /W3

OBJS = sha1.obj

all: sha.exe shacmp.exe shatest.exe

sha.exe: sha.obj $(OBJS)
$(link) $(conflags) -out:$@ sha.obj $(OBJS) $(LIBS)

shacmp.exe: shacmp.obj $(OBJS)
$(link) $(conflags) -out:$@ shacmp.obj $(OBJS) $(LIBS)

shatest.exe: shatest.obj $(OBJS)
$(link) $(conflags) -out:$@ shatest.obj $(OBJS) $(LIBS)

.cpp.obj:
$(cc) $(CFLAGS) $(cflags) $(cvars) $<

clean:
$(RM) *.obj sha.exe shacmp.exe shatest.exe
14 changes: 14 additions & 0 deletions sha1/license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Copyright (C) 1998, 2009
Paul E. Jones <[email protected]>

Freeware Public License (FPL)

This software is licensed as "freeware." Permission to distribute
this software in source and binary forms, including incorporation
into other products, is hereby granted without a fee. THIS SOFTWARE
IS PROVIDED 'AS IS' AND WITHOUT ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHOR SHALL NOT BE HELD
LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE, EITHER
DIRECTLY OR INDIRECTLY, INCLUDING, BUT NOT LIMITED TO, LOSS OF DATA
OR DATA BEING RENDERED INACCURATE.
Loading

0 comments on commit 6b12fde

Please sign in to comment.