summaryrefslogtreecommitdiff
path: root/src/include/commands
diff options
context:
space:
mode:
authorHeikki Linnakangas2016-09-28 09:22:44 +0000
committerHeikki Linnakangas2016-09-28 09:22:44 +0000
commitbabe05bc2b781eb3eb84a18d7010d08277e2e399 (patch)
tree4d692b0ef2fa74186aafc97d4d46748ea63aff07 /src/include/commands
parent72daabc7a3e75788df862104b8f723513c2471ae (diff)
Turn password_encryption GUC into an enum.
This makes the parameter easier to extend, to support other password-based authentication protocols than MD5. (SCRAM is being worked on.) The GUC still accepts on/off as aliases for "md5" and "plain", although we may want to remove those once we actually add support for another password hash type. Michael Paquier, reviewed by David Steele, with some further edits by me. Discussion: <CAB7nPqSMXU35g=W9X74HVeQp0uvgJxvYOuA4A-A3M+0wfEBv-w@mail.gmail.com>
Diffstat (limited to 'src/include/commands')
-rw-r--r--src/include/commands/user.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/include/commands/user.h b/src/include/commands/user.h
index 1f0cfcc86f..102c2a5861 100644
--- a/src/include/commands/user.h
+++ b/src/include/commands/user.h
@@ -16,10 +16,19 @@
#include "parser/parse_node.h"
-/* Hook to check passwords in CreateRole() and AlterRole() */
-#define PASSWORD_TYPE_PLAINTEXT 0
-#define PASSWORD_TYPE_MD5 1
+/*
+ * Types of password, for Password_encryption GUC and the password_type
+ * argument of the check-password hook.
+ */
+typedef enum PasswordType
+{
+ PASSWORD_TYPE_PLAINTEXT = 0,
+ PASSWORD_TYPE_MD5
+} PasswordType;
+extern int Password_encryption; /* GUC */
+
+/* Hook to check passwords in CreateRole() and AlterRole() */
typedef void (*check_password_hook_type) (const char *username, const char *password, int password_type, Datum validuntil_time, bool validuntil_null);
extern PGDLLIMPORT check_password_hook_type check_password_hook;