Header And Logo

PostgreSQL
| The world's most advanced open source database.

hba.h

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  * hba.h
00004  *    Interface to hba.c
00005  *
00006  *
00007  * src/include/libpq/hba.h
00008  *
00009  *-------------------------------------------------------------------------
00010  */
00011 #ifndef HBA_H
00012 #define HBA_H
00013 
00014 #include "libpq/pqcomm.h"   /* pgrminclude ignore */    /* needed for NetBSD */
00015 #include "nodes/pg_list.h"
00016 #include "regex/regex.h"
00017 
00018 
00019 typedef enum UserAuth
00020 {
00021     uaReject,
00022     uaImplicitReject,
00023     uaKrb5,
00024     uaTrust,
00025     uaIdent,
00026     uaPassword,
00027     uaMD5,
00028     uaGSS,
00029     uaSSPI,
00030     uaPAM,
00031     uaLDAP,
00032     uaCert,
00033     uaRADIUS,
00034     uaPeer
00035 } UserAuth;
00036 
00037 typedef enum IPCompareMethod
00038 {
00039     ipCmpMask,
00040     ipCmpSameHost,
00041     ipCmpSameNet,
00042     ipCmpAll
00043 } IPCompareMethod;
00044 
00045 typedef enum ConnType
00046 {
00047     ctLocal,
00048     ctHost,
00049     ctHostSSL,
00050     ctHostNoSSL
00051 } ConnType;
00052 
00053 typedef struct HbaLine
00054 {
00055     int         linenumber;
00056     char       *rawline;
00057     ConnType    conntype;
00058     List       *databases;
00059     List       *roles;
00060     struct sockaddr_storage addr;
00061     struct sockaddr_storage mask;
00062     IPCompareMethod ip_cmp_method;
00063     char       *hostname;
00064     UserAuth    auth_method;
00065 
00066     char       *usermap;
00067     char       *pamservice;
00068     bool        ldaptls;
00069     char       *ldapserver;
00070     int         ldapport;
00071     char       *ldapbinddn;
00072     char       *ldapbindpasswd;
00073     char       *ldapsearchattribute;
00074     char       *ldapbasedn;
00075     int         ldapscope;
00076     char       *ldapprefix;
00077     char       *ldapsuffix;
00078     bool        clientcert;
00079     char       *krb_server_hostname;
00080     char       *krb_realm;
00081     bool        include_realm;
00082     char       *radiusserver;
00083     char       *radiussecret;
00084     char       *radiusidentifier;
00085     int         radiusport;
00086 } HbaLine;
00087 
00088 typedef struct IdentLine
00089 {
00090     int         linenumber;
00091 
00092     char       *usermap;
00093     char       *ident_user;
00094     char       *pg_role;
00095     regex_t     re;
00096 } IdentLine;
00097 
00098 /* kluge to avoid including libpq/libpq-be.h here */
00099 typedef struct Port hbaPort;
00100 
00101 extern bool load_hba(void);
00102 extern bool load_ident(void);
00103 extern void hba_getauthmethod(hbaPort *port);
00104 extern int check_usermap(const char *usermap_name,
00105               const char *pg_role, const char *auth_user,
00106               bool case_sensitive);
00107 extern bool pg_isblank(const char c);
00108 
00109 #endif   /* HBA_H */