#include "postgres.h"
#include "common/string.h"
+#include "mb/pg_wchar.h"
#include "miscadmin.h"
#include "px-crypt.h"
PGCRYPTO_SHA_UNKOWN
} PGCRYPTO_SHA_t;
-static unsigned char _crypt_itoa64[64 + 1] =
+static const char _crypt_itoa64[64 + 1] =
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
/*
if (*ep != '$')
{
- if (isalpha(*ep) || isdigit(*ep) || (*ep == '.') || (*ep == '/'))
+ if (strchr(_crypt_itoa64, *ep) != NULL)
appendStringInfoCharMacro(decoded_salt, *ep);
else
- elog(ERROR, "invalid character in salt string: \"%c\"", *ep);
+ ereport(ERROR,
+ errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("invalid character in salt string: \"%.*s\"",
+ pg_mblen(ep), ep));
}
else
{
elog(ERROR, "unsupported digest length");
}
- *cp = '\0';
-
/*
* Copy over result to specified buffer.
*