summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorHeikki Linnakangas2017-05-03 08:19:07 +0000
committerHeikki Linnakangas2017-05-03 08:19:07 +0000
commit8f8b9be51fd788bb11276df89606bc653163524e (patch)
tree4d2daef287c2adb74da34bd6fcdbd47febbb47df /src/include
parentaf2c5aa88d38573724e40fa029499b4db20b0eb2 (diff)
Add PQencryptPasswordConn function to libpq, use it in psql and createuser.
The new function supports creating SCRAM verifiers, in addition to md5 hashes. The algorithm is chosen based on password_encryption, by default. This fixes the issue reported by Jeff Janes, that there was previously no way to create a SCRAM verifier with "\password". Michael Paquier and me Discussion: https://www.postgresql.org/message-id/CAMkU%3D1wfBgFPbfAMYZQE78p%3DVhZX7nN86aWkp0QcCp%3D%2BKxZ%3Dbg%40mail.gmail.com
Diffstat (limited to 'src/include')
-rw-r--r--src/include/common/scram-common.h3
-rw-r--r--src/include/libpq/scram.h4
2 files changed, 4 insertions, 3 deletions
diff --git a/src/include/common/scram-common.h b/src/include/common/scram-common.h
index 656d9e1e6b..307f92b54a 100644
--- a/src/include/common/scram-common.h
+++ b/src/include/common/scram-common.h
@@ -53,4 +53,7 @@ extern void scram_H(const uint8 *str, int len, uint8 *result);
extern void scram_ClientKey(const uint8 *salted_password, uint8 *result);
extern void scram_ServerKey(const uint8 *salted_password, uint8 *result);
+extern char *scram_build_verifier(const char *salt, int saltlen, int iterations,
+ const char *password);
+
#endif /* SCRAM_COMMON_H */
diff --git a/src/include/libpq/scram.h b/src/include/libpq/scram.h
index e373f0c07e..060b8af69e 100644
--- a/src/include/libpq/scram.h
+++ b/src/include/libpq/scram.h
@@ -27,9 +27,7 @@ extern int pg_be_scram_exchange(void *opaq, char *input, int inputlen,
char **output, int *outputlen, char **logdetail);
/* Routines to handle and check SCRAM-SHA-256 verifier */
-extern char *scram_build_verifier(const char *username,
- const char *password,
- int iterations);
+extern char *pg_be_scram_build_verifier(const char *password);
extern bool is_scram_verifier(const char *verifier);
extern bool scram_verify_plain_password(const char *username,
const char *password, const char *verifier);