From: Kurt Zeilenga Date: Sat, 20 Jan 2001 01:15:28 +0000 (+0000) Subject: Provide extra salt for crypt(3) X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~1550 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=90c9d543a8b99360a6e2513eab868ea36a862cb0;p=openldap Provide extra salt for crypt(3) --- diff --git a/libraries/liblutil/passwd.c b/libraries/liblutil/passwd.c index 3fcfc3c271..e7262115c7 100644 --- a/libraries/liblutil/passwd.c +++ b/libraries/liblutil/passwd.c @@ -1176,7 +1176,7 @@ static struct berval *hash_crypt( const struct berval *passwd ) { struct berval hash; - unsigned char salt[3]; + unsigned char salt[9]; /* salt suitable for anything */ int i; for( i=0; ibv_len; i++) { @@ -1189,13 +1189,14 @@ static struct berval *hash_crypt( return NULL; /* passwd must behave like a string */ } - if( lutil_entropy( salt, sizeof(salt)) < 0 ) { + if( lutil_entropy( salt, 8) < 0 ) { return NULL; } - salt[0] = crypt64[ salt[0] % (sizeof(crypt64)-1) ]; - salt[1] = crypt64[ salt[1] % (sizeof(crypt64)-1) ]; - salt[2] = '\0'; + for( i=0; i<8; i++ ) { + salt[i] = crypt64[ salt[i] % (sizeof(crypt64)-1) ]; + } + salt[8] = '\0'; hash.bv_val = crypt( passwd->bv_val, salt );