- Increase the size of the salt in pw(8) from 8 to 32 (same as in pam_unix(8)).
This makes blowfish password hashes look normal when set using pw(8)/adduser(8). [1] - Make it possible to have a '/' in the salt. PR: 121146 [1] Submitted by: Jaakko Heinonen [1] Approved by: rwatson (mentor) MFC after: 1 month
This commit is contained in:
parent
3c669ce6e6
commit
e8e8c216d0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=179365
@ -1029,22 +1029,24 @@ pw_shellpolicy(struct userconf * cnf, struct cargs * args, char *newshell)
|
||||
return shell_path(cnf->shelldir, cnf->shells, sh ? sh : cnf->shell_default);
|
||||
}
|
||||
|
||||
static char const chars[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.";
|
||||
#define SALTSIZE 32
|
||||
|
||||
static char const chars[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ./";
|
||||
|
||||
char *
|
||||
pw_pwcrypt(char *password)
|
||||
{
|
||||
int i;
|
||||
char salt[12];
|
||||
char salt[SALTSIZE + 1];
|
||||
|
||||
static char buf[256];
|
||||
|
||||
/*
|
||||
* Calculate a salt value
|
||||
*/
|
||||
for (i = 0; i < 8; i++)
|
||||
salt[i] = chars[arc4random() % 63];
|
||||
salt[i] = '\0';
|
||||
for (i = 0; i < SALTSIZE; i++)
|
||||
salt[i] = chars[arc4random() % (sizeof(chars) - 1)];
|
||||
salt[SALTSIZE] = '\0';
|
||||
|
||||
return strcpy(buf, crypt(password, salt));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user