X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=ircd%2Fircd_crypt.c;h=2f50fe04856cb78f2e7064b16d07a0b14c663506;hb=refs%2Fheads%2Fupstream;hp=c96c564538da52cee6bf2f22a9bf469bdb44b072;hpb=920d7ed630551844ee38eb2dcf1f1af168f84c4f;p=ircu2.10.12-pk.git diff --git a/ircd/ircd_crypt.c b/ircd/ircd_crypt.c index c96c564..2f50fe0 100644 --- a/ircd/ircd_crypt.c +++ b/ircd/ircd_crypt.c @@ -24,12 +24,12 @@ * @version $Id$ * * This is a new look crypto API for ircu, it can handle different - * password formats by the grace of magic tokens at the begining of the + * password formats by the grace of magic tokens at the beginning of the * password e.g. $SMD5 for Salted MD5, $CRYPT for native crypt(), etc. * * Currently crypt routines are implemented for: the native crypt() * function, Salted MD5 and a plain text mechanism which should only - * be used for testing. I intend to add Blowish, 3DES and possibly + * be used for testing. I intend to add Blowfish, 3DES and possibly * SHA1 support as well at some point, but I'll need to check the * possible problems that'll cause with stupid crypto laws. * @@ -47,6 +47,7 @@ #include "ircd_crypt.h" #include "ircd_alloc.h" #include "ircd_features.h" +#include "ircd_log.h" #include "ircd_string.h" #include "s_debug.h" @@ -55,7 +56,7 @@ #include "ircd_crypt_plain.h" #include "ircd_crypt_smd5.h" -#include +/* #include -- Now using assert in ircd_log.h */ #include #include @@ -73,7 +74,7 @@ int ircd_crypt_register_mech(crypt_mech_t* mechanism) { crypt_mechs_t* crypt_mech; - Debug((DEBUG_INFO, "ircd_crypt_register_mech: resistering mechanism: %s", mechanism->shortname)); + Debug((DEBUG_INFO, "ircd_crypt_register_mech: registering mechanism: %s", mechanism->shortname)); /* try to allocate some memory for the new mechanism */ if ((crypt_mech = (crypt_mechs_t*)MyMalloc(sizeof(crypt_mechs_t))) == NULL) @@ -103,7 +104,7 @@ crypt_mechs_t* crypt_mech; } /* we're done */ - Debug((DEBUG_INFO, "ircd_crypt_register_mech: resistered mechanism: %s, crypt_function is at 0x%X.", crypt_mech->mech->shortname, &crypt_mech->mech->crypt_function)); + Debug((DEBUG_INFO, "ircd_crypt_register_mech: registered mechanism: %s, crypt_function is at 0x%X.", crypt_mech->mech->shortname, &crypt_mech->mech->crypt_function)); Debug((DEBUG_INFO, "ircd_crypt_register_mech: %s: %s", crypt_mech->mech->shortname, crypt_mech->mech->description)); return 0; } @@ -190,7 +191,7 @@ crypt_mechs_t* crypt_mech; ircd_strncpy(hashed_pass + crypt_mech->mech->crypt_token_size, temp_hashed_pass, strlen(temp_hashed_pass)); Debug((DEBUG_DEBUG, "ircd_crypt: tagged pass is %s", hashed_pass)); } else { - Debug((DEBUG_DEBUG, "ircd_crypt: will try next mechansim at 0x%X", + Debug((DEBUG_DEBUG, "ircd_crypt: will try next mechanism at 0x%X", crypt_mech->next)); crypt_mech = crypt_mech->next; continue; @@ -201,9 +202,13 @@ crypt_mechs_t* crypt_mech; /* try to use native crypt for an old-style (untagged) password */ if (strlen(salt) > 2) { + char *s; temp_hashed_pass = (char*)ircd_crypt_native(key, salt); if (!ircd_strcmp(temp_hashed_pass, salt)) - return strdup(temp_hashed_pass); + { + DupString(s, temp_hashed_pass); + return s; + } } return NULL; @@ -231,8 +236,8 @@ void ircd_crypt_init(void) crypt_mechs_root->mech = NULL; crypt_mechs_root->next = crypt_mechs_root->prev = NULL; -/* temporary kludge until we're modular. manualy call the - register funtions for crypt mechanisms */ +/* temporary kludge until we're modular. manually call the + register functions for crypt mechanisms */ ircd_register_crypt_smd5(); ircd_register_crypt_plain(); ircd_register_crypt_native();