forked from github/server
Merge pull request #509 from ennorehling/hotfix-passwords
fixing the password saving test.
This commit is contained in:
commit
400bca30b1
|
@ -231,21 +231,25 @@ static void test_read_password_external(CuTest *tc) {
|
||||||
CuAssertPtrNotNull(tc, f->_password);
|
CuAssertPtrNotNull(tc, f->_password);
|
||||||
data = gamedata_open(path, "wb");
|
data = gamedata_open(path, "wb");
|
||||||
CuAssertPtrNotNull(tc, data);
|
CuAssertPtrNotNull(tc, data);
|
||||||
WRITE_TOK(data->store, (const char *)f->_password);
|
WRITE_TOK(data->store, "newpassword");
|
||||||
WRITE_TOK(data->store, (const char *)f->_password);
|
WRITE_TOK(data->store, "secret");
|
||||||
|
WRITE_TOK(data->store, "$brokenhash");
|
||||||
gamedata_close(data);
|
gamedata_close(data);
|
||||||
data = gamedata_open(path, "rb");
|
data = gamedata_open(path, "rb");
|
||||||
CuAssertPtrNotNull(tc, data);
|
CuAssertPtrNotNull(tc, data);
|
||||||
|
data->version = NOCRYPT_VERSION;
|
||||||
|
_test_read_password(data, f);
|
||||||
|
CuAssertStrEquals(tc, "newpassword", f->_password);
|
||||||
data->version = BADCRYPT_VERSION;
|
data->version = BADCRYPT_VERSION;
|
||||||
_test_read_password(data, f);
|
_test_read_password(data, f);
|
||||||
CuAssertPtrEquals(tc, 0, f->_password);
|
CuAssertStrEquals(tc, "secret", f->_password);
|
||||||
F = fopen(pwfile, "wt");
|
F = fopen(pwfile, "wt");
|
||||||
fprintf(F, "%s:secret\n", itoa36(f->no));
|
fprintf(F, "%s:pwfile\n", itoa36(f->no));
|
||||||
fclose(F);
|
fclose(F);
|
||||||
_test_read_password(data, f);
|
_test_read_password(data, f);
|
||||||
CuAssertPtrNotNull(tc, f->_password);
|
CuAssertStrEquals(tc, "pwfile", f->_password);
|
||||||
|
CuAssertTrue(tc, checkpasswd(f, "pwfile"));
|
||||||
gamedata_close(data);
|
gamedata_close(data);
|
||||||
CuAssertTrue(tc, checkpasswd(f, "secret"));
|
|
||||||
CuAssertIntEquals(tc, 0, remove(path));
|
CuAssertIntEquals(tc, 0, remove(path));
|
||||||
CuAssertIntEquals(tc, 0, remove(pwfile));
|
CuAssertIntEquals(tc, 0, remove(pwfile));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#include <platform.h>
|
||||||
#include <CuTest.h>
|
#include <CuTest.h>
|
||||||
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
|
@ -5,7 +5,9 @@ CD ..
|
||||||
SET ERESSEA=%CD%
|
SET ERESSEA=%CD%
|
||||||
|
|
||||||
CD %SRCDIR%
|
CD %SRCDIR%
|
||||||
|
IF exist build-vs%VSVERSION% goto HAVEDIR
|
||||||
mkdir build-vs%VSVERSION%
|
mkdir build-vs%VSVERSION%
|
||||||
|
:HAVEDIR
|
||||||
cd build-vs%VSVERSION%
|
cd build-vs%VSVERSION%
|
||||||
"%ProgramFiles(x86)%\CMake\bin\cmake.exe" -G "Visual Studio %VSVERSION%" -DCMAKE_PREFIX_PATH="%ProgramFiles(x86)%/Lua/5.1;%ERESSEA%/dependencies-win32" -DCMAKE_MODULE_PATH="%SRCDIR%/cmake/Modules" -DCMAKE_SUPPRESS_REGENERATION=TRUE ..
|
"%ProgramFiles(x86)%\CMake\bin\cmake.exe" -G "Visual Studio %VSVERSION%" -DCMAKE_PREFIX_PATH="%ProgramFiles(x86)%/Lua/5.1;%ERESSEA%/dependencies-win32" -DCMAKE_MODULE_PATH="%SRCDIR%/cmake/Modules" -DCMAKE_SUPPRESS_REGENERATION=TRUE ..
|
||||||
PAUSE
|
PAUSE
|
||||||
|
|
Loading…
Reference in New Issue