changed: when winix demonizes it creates a three new descriptors (0, 1 and 3)
pointing to /dev/null
added: DbBase::AssertValueBin(PGresult * r, int row, int col, std::string & result)
it reads binary (bytea) data
added: DbTextStream can handle 'bool' types now
(is puts 'true' of 'false' to the stream)
changed: now passwords can be stored either as plain text, a hash or can be encrypted
with RSA
currently we have following hashes:
md4, md5, sha1, sha224, sha256, sha384, sha512
we are using openssl to manage them
(look at config options for more info)
changed: winix version to 0.4.7
added: class Run - you can run any program from os and send a buffer to its standard input
and read what the program put on its standard output
added: class Crypt (in System) - calculating hashes, and crypting/decrypting
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@734 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* Copyright (c) 2008-2011, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
@@ -35,7 +35,7 @@ bool AddUser::CheckAddUserVars(const std::wstring & login, const std::wstring &
|
||||
return false;
|
||||
}
|
||||
|
||||
if( pass.size() < config->password_min_size )
|
||||
if( pass.size() < config->pass_min_size )
|
||||
{
|
||||
cur->request->status = WINIX_ERR_PASSWORD_TOO_SHORT;
|
||||
return false;
|
||||
@@ -61,7 +61,7 @@ User user;
|
||||
|
||||
const std::wstring & login = cur->request->PostVar(L"login");
|
||||
const std::wstring & pass = cur->request->PostVar(L"password");
|
||||
const std::wstring & conf_pass = cur->request->PostVar(L"confirmpassword");
|
||||
const std::wstring & conf_pass = cur->request->PostVar(L"passwordconfirm");
|
||||
|
||||
if( !CheckAddUserVars(login, pass, conf_pass) )
|
||||
return;
|
||||
@@ -69,7 +69,10 @@ User user;
|
||||
user.name = login;
|
||||
user.email = cur->request->PostVar(L"email");
|
||||
|
||||
cur->request->status = db->AddUser(user, pass);
|
||||
up.pass = pass;
|
||||
system->crypt.PassHashCrypt(up);
|
||||
|
||||
cur->request->status = db->AddUser(user, up.pass, up.pass_encrypted, up.pass_type, up.pass_hash_salted);
|
||||
|
||||
if( cur->request->status == WINIX_ERR_OK )
|
||||
{
|
||||
@@ -91,6 +94,36 @@ User user;
|
||||
}
|
||||
|
||||
|
||||
void AddUser::MakeGet()
|
||||
{
|
||||
Run s;
|
||||
std::string out;
|
||||
|
||||
/*
|
||||
s.Env("PATH=/home/tomek/mybin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin");
|
||||
s.Env("PWD=/home/tomek");
|
||||
s.Env("SHELL=/bin/tcsh");
|
||||
s.Env("USER=tomek");
|
||||
s.Env("GROUP=wheel");
|
||||
s.Env("HOME=/home/tomek");
|
||||
*/
|
||||
|
||||
s.Par("dgst");
|
||||
s.Par("-sha512");
|
||||
s.Cmd("/usr/bin/openssl");
|
||||
|
||||
if( s.Go("swinka", out) == 0 )
|
||||
log << log1 << "odpowiedz: " << out << logend;
|
||||
|
||||
if( s.Go("cosik", out) == 0 )
|
||||
log << log1 << "odpowiedz: " << out << logend;
|
||||
|
||||
if( s.Go("ktosik", out) == 0 )
|
||||
log << log1 << "odpowiedz: " << out << logend;
|
||||
|
||||
if( s.Go("", out) == 0 )
|
||||
log << log1 << "odpowiedz: " << out << logend;
|
||||
}
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user