[svn-commits] dlee: branch dlee/ari-authn r393039 - /team/dlee/ari-authn/main/utils.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed Jun 26 22:18:35 CDT 2013
Author: dlee
Date: Wed Jun 26 22:18:34 2013
New Revision: 393039
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=393039
Log:
Fixed salt generation
Modified:
team/dlee/ari-authn/main/utils.c
Modified: team/dlee/ari-authn/main/utils.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-authn/main/utils.c?view=diff&rev=393039&r1=393038&r2=393039
==============================================================================
--- team/dlee/ari-authn/main/utils.c (original)
+++ team/dlee/ari-authn/main/utils.c Wed Jun 26 22:18:34 2013
@@ -2289,7 +2289,8 @@
/*! Randomly select a character for a salt string */
static char gen_salt_char(void)
{
- return salt_chars[ast_random() % ARRAY_LEN(salt_chars)];
+ int which = ast_random_double() * 64;
+ return salt_chars[which];
}
/*!
@@ -2309,6 +2310,7 @@
static int gen_salt(char *current_salt, size_t maxlen)
{
int i;
+
if (maxlen < MAX_SALT_LEN || current_salt == NULL) {
return -1;
}
@@ -2426,7 +2428,6 @@
char *ast_crypt_encrypt(const char *key)
{
char salt[MAX_SALT_LEN] = {};
- SCOPED_MUTEX(lock, &crypt_mutex);
while (gen_salt(salt, sizeof(salt)) == 0) {
char *crypted = ast_crypt(key, salt);
if (crypted) {
More information about the svn-commits
mailing list