View | Details | Raw Unified | Return to bug 121146
Collapse All | Expand All

(-)pw_user.c (-3 / +5 lines)
Lines 1029-1050 pw_shellpolicy(struct userconf * cnf, st Link Here
1029
	return shell_path(cnf->shelldir, cnf->shells, sh ? sh : cnf->shell_default);
1029
	return shell_path(cnf->shelldir, cnf->shells, sh ? sh : cnf->shell_default);
1030
}
1030
}
1031
1031
1032
#define SALTSIZE	32
1033
1032
static char const chars[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.";
1034
static char const chars[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.";
1033
1035
1034
char           *
1036
char           *
1035
pw_pwcrypt(char *password)
1037
pw_pwcrypt(char *password)
1036
{
1038
{
1037
	int             i;
1039
	int             i;
1038
	char            salt[12];
1040
	char            salt[SALTSIZE + 1];
1039
1041
1040
	static char     buf[256];
1042
	static char     buf[256];
1041
1043
1042
	/*
1044
	/*
1043
	 * Calculate a salt value
1045
	 * Calculate a salt value
1044
	 */
1046
	 */
1045
	for (i = 0; i < 8; i++)
1047
	for (i = 0; i < SALTSIZE; i++)
1046
		salt[i] = chars[arc4random() % 63];
1048
		salt[i] = chars[arc4random() % 63];
1047
	salt[i] = '\0';
1049
	salt[SALTSIZE] = '\0';
1048
1050
1049
	return strcpy(buf, crypt(password, salt));
1051
	return strcpy(buf, crypt(password, salt));
1050
}
1052
}

Return to bug 121146