summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorHeikki Linnakangas2012-09-21 14:41:22 +0000
committerHeikki Linnakangas2012-09-21 14:54:39 +0000
commit7c45e3a3c682f855ecda7fd671969ee5e91929bf (patch)
treef628dd13c557744ef33ef6e01e897323079efabc /src/include
parent9d5e9730e5c2aa912778b9e8728c0b5ebd807d9a (diff)
Parse pg_ident.conf when it's loaded, keeping it in memory in parsed format.
Similar changes were done to pg_hba.conf earlier already, this commit makes pg_ident.conf to behave the same as pg_hba.conf. This has two user-visible effects. First, if pg_ident.conf contains multiple errors, the whole file is parsed at postmaster startup time and all the errors are immediately reported. Before this patch, the file was parsed and the errors were reported only when someone tries to connect using an authentication method that uses the file, and the parsing stopped on first error. Second, if you SIGHUP to reload the config files, and the new pg_ident.conf file contains an error, the error is logged but the old file stays in effect. Also, regular expressions in pg_ident.conf are now compiled only once when the file is loaded, rather than every time the a user is authenticated. That should speed up authentication if you have a lot of regexps in the file. Amit Kapila
Diffstat (limited to 'src/include')
-rw-r--r--src/include/libpq/hba.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/include/libpq/hba.h b/src/include/libpq/hba.h
index f3b8be6a0cc..408d26263a9 100644
--- a/src/include/libpq/hba.h
+++ b/src/include/libpq/hba.h
@@ -13,6 +13,7 @@
#include "libpq/pqcomm.h" /* pgrminclude ignore */ /* needed for NetBSD */
#include "nodes/pg_list.h"
+#include "regex/regex.h"
typedef enum UserAuth
@@ -82,11 +83,21 @@ typedef struct HbaLine
int radiusport;
} HbaLine;
+typedef struct IdentLine
+{
+ int linenumber;
+
+ char *usermap;
+ char *ident_user;
+ char *pg_role;
+ regex_t re;
+} IdentLine;
+
/* kluge to avoid including libpq/libpq-be.h here */
typedef struct Port hbaPort;
extern bool load_hba(void);
-extern void load_ident(void);
+extern bool load_ident(void);
extern void hba_getauthmethod(hbaPort *port);
extern int check_usermap(const char *usermap_name,
const char *pg_role, const char *auth_user,