forked from github/server
Merge branch 'feature/crypt-passwords' of https://github.com/ennorehling/eressea.git
This commit is contained in:
commit
0e30f392c4
2 changed files with 8 additions and 2 deletions
|
@ -382,6 +382,12 @@ static int tolua_faction_create(lua_State * L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int tolua_faction_get_password(lua_State * L)
|
||||||
|
{
|
||||||
|
unused_arg(L);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int tolua_faction_set_password(lua_State * L)
|
static int tolua_faction_set_password(lua_State * L)
|
||||||
{
|
{
|
||||||
faction *self = (faction *)tolua_tousertype(L, 1, 0);
|
faction *self = (faction *)tolua_tousertype(L, 1, 0);
|
||||||
|
@ -557,7 +563,7 @@ void tolua_faction_open(lua_State * L)
|
||||||
tolua_variable(L, TOLUA_CAST "heroes", tolua_faction_get_heroes, NULL);
|
tolua_variable(L, TOLUA_CAST "heroes", tolua_faction_get_heroes, NULL);
|
||||||
tolua_variable(L, TOLUA_CAST "maxheroes", tolua_faction_get_maxheroes,
|
tolua_variable(L, TOLUA_CAST "maxheroes", tolua_faction_get_maxheroes,
|
||||||
NULL);
|
NULL);
|
||||||
tolua_variable(L, TOLUA_CAST "password", NULL,
|
tolua_variable(L, TOLUA_CAST "password", tolua_faction_get_password,
|
||||||
tolua_faction_set_password);
|
tolua_faction_set_password);
|
||||||
tolua_variable(L, TOLUA_CAST "email", tolua_faction_get_email,
|
tolua_variable(L, TOLUA_CAST "email", tolua_faction_get_email,
|
||||||
tolua_faction_set_email);
|
tolua_faction_set_email);
|
||||||
|
|
|
@ -34,7 +34,7 @@ char *password_gensalt(void) {
|
||||||
char *cp = salt;
|
char *cp = salt;
|
||||||
int buflen = SALTLEN;
|
int buflen = SALTLEN;
|
||||||
while (buflen) {
|
while (buflen) {
|
||||||
unsigned long ul = genrand_int32() & time(0);
|
unsigned long ul = genrand_int32() & (unsigned long)time(0);
|
||||||
b64_from_24bit((char)(ul & 0xFF), (char)((ul>>8)&0xff), (char)((ul>>16)&0xFF), 4);
|
b64_from_24bit((char)(ul & 0xFF), (char)((ul>>8)&0xff), (char)((ul>>16)&0xFF), 4);
|
||||||
}
|
}
|
||||||
salt[SALTLEN] = 0;
|
salt[SALTLEN] = 0;
|
||||||
|
|
Loading…
Reference in a new issue