PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
hba.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * hba.h
4  * Interface to hba.c
5  *
6  *
7  * src/include/libpq/hba.h
8  *
9  *-------------------------------------------------------------------------
10  */
11 #ifndef HBA_H
12 #define HBA_H
13 
14 #include "libpq/pqcomm.h" /* pgrminclude ignore */ /* needed for NetBSD */
15 #include "nodes/pg_list.h"
16 #include "regex/regex.h"
17 
18 
19 /*
20  * The following enum represents the authentication methods that
21  * are supported by PostgreSQL.
22  *
23  * Note: keep this in sync with the UserAuthName array in hba.c.
24  */
25 typedef enum UserAuth
26 {
28  uaImplicitReject, /* Not a user-visible option */
41  uaPeer
42 #define USER_AUTH_LAST uaPeer /* Must be last value of this enum */
43 } UserAuth;
44 
45 typedef enum IPCompareMethod
46 {
52 
53 typedef enum ConnType
54 {
59 } ConnType;
60 
61 typedef struct HbaLine
62 {
64  char *rawline;
71  char *hostname;
73 
74  char *usermap;
75  char *pamservice;
77  bool ldaptls;
78  char *ldapserver;
79  int ldapport;
80  char *ldapbinddn;
83  char *ldapbasedn;
84  int ldapscope;
85  char *ldapprefix;
86  char *ldapsuffix;
87  bool clientcert;
88  char *krb_realm;
100 } HbaLine;
101 
102 typedef struct IdentLine
103 {
105 
106  char *usermap;
107  char *ident_user;
108  char *pg_role;
110 } IdentLine;
111 
112 /* kluge to avoid including libpq/libpq-be.h here */
113 typedef struct Port hbaPort;
114 
115 extern bool load_hba(void);
116 extern bool load_ident(void);
117 extern void hba_getauthmethod(hbaPort *port);
118 extern int check_usermap(const char *usermap_name,
119  const char *pg_role, const char *auth_user,
120  bool case_sensitive);
121 extern bool pg_isblank(const char c);
122 
123 #endif /* HBA_H */
int ldapscope
Definition: hba.h:84
UserAuth
Definition: hba.h:25
List * databases
Definition: hba.h:66
char * radiusports_s
Definition: hba.h:99
Definition: hba.h:61
Definition: hba.h:30
char * ldapserver
Definition: hba.h:78
struct sockaddr_storage mask
Definition: hba.h:69
Definition: hba.h:38
struct IdentLine IdentLine
int ldapport
Definition: hba.h:79
void hba_getauthmethod(hbaPort *port)
Definition: hba.c:2987
char * ldapbasedn
Definition: hba.h:83
Definition: hba.h:32
char * pamservice
Definition: hba.h:75
regex_t re
Definition: hba.h:109
Definition: hba.h:47
Definition: hba.h:35
Definition: libpq-be.h:116
struct HbaLine HbaLine
bool load_hba(void)
Definition: hba.c:2094
List * radiussecrets
Definition: hba.h:94
int check_usermap(const char *usermap_name, const char *pg_role, const char *auth_user, bool case_sensitive)
Definition: hba.c:2821
char * ldapsuffix
Definition: hba.h:86
int linenumber
Definition: hba.h:104
Definition: hba.h:34
Definition: hba.h:31
ConnType conntype
Definition: hba.h:65
char * radiusservers_s
Definition: hba.h:93
Definition: hba.h:57
bool pam_use_hostname
Definition: hba.h:76
Definition: hba.h:39
struct sockaddr_storage addr
Definition: hba.h:68
char * usermap
Definition: hba.h:106
char * usermap
Definition: hba.h:74
List * radiusports
Definition: hba.h:98
Definition: hba.h:27
List * radiusservers
Definition: hba.h:92
bool include_realm
Definition: hba.h:89
Definition: hba.h:29
char * c
ConnType
Definition: hba.h:53
char * ldapbinddn
Definition: hba.h:80
char * krb_realm
Definition: hba.h:88
int linenumber
Definition: hba.h:63
IPCompareMethod
Definition: hba.h:45
char * ldapbindpasswd
Definition: hba.h:81
bool load_ident(void)
Definition: hba.c:2876
char * ldapprefix
Definition: hba.h:85
Definition: hba.h:55
static int port
Definition: pg_regress.c:89
Definition: hba.h:33
Definition: hba.h:50
char * hostname
Definition: hba.h:71
char * radiusidentifiers_s
Definition: hba.h:97
List * radiusidentifiers
Definition: hba.h:96
Definition: hba.h:37
char * radiussecrets_s
Definition: hba.h:95
List * roles
Definition: hba.h:67
Definition: hba.h:102
bool ldaptls
Definition: hba.h:77
char * ldapsearchattribute
Definition: hba.h:82
char * rawline
Definition: hba.h:64
bool upn_username
Definition: hba.h:91
char * ident_user
Definition: hba.h:107
bool pg_isblank(const char c)
Definition: hba.c:160
bool clientcert
Definition: hba.h:87
IPCompareMethod ip_cmp_method
Definition: hba.h:70
Definition: pg_list.h:45
Definition: hba.h:36
bool compat_realm
Definition: hba.h:90
Definition: regex.h:55
Definition: hba.h:56
char * pg_role
Definition: hba.h:108
UserAuth auth_method
Definition: hba.h:72
Definition: hba.h:40