diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-12-08 17:00:08 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2005-12-08 17:00:08 +0100 |
commit | 7cad7b41a0b661c38ae5f6239aaf58361788edc9 (patch) | |
tree | 213ab238ece2ab120b7ec25f62b19224b37d6856 /crypting.c | |
parent | 09adf08684c62fff0f507304ed37680137de4637 (diff) |
Clearer seperation between crypting and generic password code
Diffstat (limited to 'crypting.c')
-rw-r--r-- | crypting.c | 26 |
1 files changed, 4 insertions, 22 deletions
@@ -51,8 +51,6 @@ typedef struct irc #include <stdio.h> #include <stdlib.h> -#define irc_usermsg - #endif /*\ @@ -61,21 +59,7 @@ typedef struct irc * correctness. \*/ -/* USE WITH CAUTION! - Sets pass without checking */ -void setpassnc (irc_t *irc, const char *pass) -{ - if (irc->password) g_free (irc->password); - - if (pass) { - irc->password = g_strdup (pass); - irc_usermsg (irc, "Password successfully changed"); - } else { - irc->password = NULL; - } -} - -int setpass (irc_t *irc, const char *pass, const char* md5sum) +int checkpass (const char *pass, const char *md5sum) { md5_state_t md5state; md5_byte_t digest[16]; @@ -93,13 +77,11 @@ int setpass (irc_t *irc, const char *pass, const char* md5sum) if (digits[0] != md5sum[j]) return (-1); if (digits[1] != md5sum[j + 1]) return (-1); } - - /* If pass is correct, we end up here and we set the pass */ - setpassnc (irc, pass); - - return (0); + + return( 0 ); } + char *hashpass (irc_t *irc) { md5_state_t md5state; md5_byte_t digest[16]; |