[Cppcms-users] dbixx::sql truncates string!
Brought to you by:
artyom-beilis
From: augustin <aug...@ov...> - 2010-11-01 06:40:45
|
Hello, I get a username and a password from a user and hash the password using md5(): std::string pass_md5 = md5(password); memset (password, '*', 100); // Erase the password from memory. cout << "The md5 is: " << pass_md5 << endl; sql << "SELECT * FROM users WHERE name = ? AND pass = ?", username, pass_md5; if (sql.single(r)) { /* Login successful...*/ } The (critical) problem is that the login is never successful because in the above query, the pass_md5 is truncated. The md5 hash is 32 characters long, but only the 20 first characters are kept in the query. ??? Is this a bug in the API, or am I doing wrong? Also, for debugging purposes, how can I access the actual query sent to the sql server? Augustin. -- Friends: http://www.reuniting.info/ http://activistsolutions.org/ My projects: http://astralcity.org/ http://3enjeux.overshoot.tv/ http://linux.overshoot.tv/ http://overshoot.tv/ http://charityware.info/ http://masquilier.org/ http://openteacher.info/ http://minguo.info/ http://www.wechange.org/ http://searching911.info/ . |