diff options
| author | Franklin Wei <git@fwei.tk> | 2016-01-17 20:15:31 -0500 |
|---|---|---|
| committer | Franklin Wei <git@fwei.tk> | 2016-01-17 20:15:31 -0500 |
| commit | 7c98d81dafd9b8bc8745d897603a424aee328c1c (patch) | |
| tree | 01986b70644af5a80f963fcfc8d99b5239d6718d /src/auth.c | |
| parent | 9a98c157ebdc6e400f076485a4d78e9026ea1a16 (diff) | |
| download | netcosm-7c98d81dafd9b8bc8745d897603a424aee328c1c.zip netcosm-7c98d81dafd9b8bc8745d897603a424aee328c1c.tar.gz netcosm-7c98d81dafd9b8bc8745d897603a424aee328c1c.tar.bz2 netcosm-7c98d81dafd9b8bc8745d897603a424aee328c1c.tar.xz | |
rewrite message-passing, no signals needed!
Diffstat (limited to 'src/auth.c')
| -rw-r--r-- | src/auth.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -59,7 +59,6 @@ static char *hash_pass_hex(const char *pass, const char *salt) for(unsigned int i = 0; i < hash_len; ++i, ptr += 2) snprintf(ptr, 3, "%02x", hash[i]); hex[hash_len * 2] = '\0'; - sig_debugf("hash is %s\n", hex); gcry_free(hash); @@ -199,19 +198,24 @@ struct userdata_t *auth_check(const char *name2, const char *pass2) sig_debugf("auth module: user %s found\n", name2); char *new_hash_hex = hash_pass_hex(pass, salt); - memset(pass, 0, strlen(pass)); - free(pass); - /* hashes are in HEX to avoid the Trucha bug */ bool success = !memcmp(new_hash_hex, hash, strlen(hash)); free(new_hash_hex); if(success) + { + memset(pass, 0, strlen(pass)); + free(pass); + return data; + } } - sig_debugf("auth failure: username not found\n"); + sig_debugf("auth failure for user %s\n", name2); + + memset(pass, 0, strlen(pass)); + free(pass); /* failure */ sleep(2); |