From 7cad7b41a0b661c38ae5f6239aaf58361788edc9 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 8 Dec 2005 17:00:08 +0100 Subject: Clearer seperation between crypting and generic password code --- crypting.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) (limited to 'crypting.c') diff --git a/crypting.c b/crypting.c index 50967e91..8f43d3af 100644 --- a/crypting.c +++ b/crypting.c @@ -51,8 +51,6 @@ typedef struct irc #include #include -#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]; -- cgit v1.2.3