mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Further cleanup from the strong-random patch.
Also use the new facility for generating RADIUS authenticator requests, and salt in chkpass extension. Reword the error messages to be nicer. Fix bogus error code used in the message in BackendStartup.
This commit is contained in:
@ -17,6 +17,7 @@
|
||||
#endif
|
||||
|
||||
#include "fmgr.h"
|
||||
#include "utils/backend_random.h"
|
||||
#include "utils/builtins.h"
|
||||
|
||||
PG_MODULE_MAGIC;
|
||||
@ -77,8 +78,12 @@ chkpass_in(PG_FUNCTION_ARGS)
|
||||
|
||||
result = (chkpass *) palloc0(sizeof(chkpass));
|
||||
|
||||
mysalt[0] = salt_chars[random() & 0x3f];
|
||||
mysalt[1] = salt_chars[random() & 0x3f];
|
||||
if (!pg_backend_random(mysalt, 2))
|
||||
ereport(ERROR,
|
||||
(errmsg("could not generate random salt")));
|
||||
|
||||
mysalt[0] = salt_chars[mysalt[0] & 0x3f];
|
||||
mysalt[1] = salt_chars[mysalt[1] & 0x3f];
|
||||
mysalt[2] = 0; /* technically the terminator is not necessary
|
||||
* but I like to play safe */
|
||||
|
||||
|
Reference in New Issue
Block a user