hba.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. #include "libpq/pqcomm.h" /* pgrminclude ignore */ /* needed for NetBSD */
  14. #include "nodes/pg_list.h"
  15. #include "regex/regex.h"
  16. typedef enum UserAuth
  17. {
  18. uaReject,
  19. uaImplicitReject,
  20. uaTrust,
  21. uaIdent,
  22. uaPassword,
  23. uaMD5,
  24. uaGSS,
  25. uaSSPI,
  26. uaPAM,
  27. uaBSD,
  28. uaLDAP,
  29. uaCert,
  30. uaRADIUS,
  31. uaPeer
  32. } UserAuth;
  33. typedef enum IPCompareMethod
  34. {
  35. ipCmpMask,
  36. ipCmpSameHost,
  37. ipCmpSameNet,
  38. ipCmpAll
  39. } IPCompareMethod;
  40. typedef enum ConnType
  41. {
  42. ctLocal,
  43. ctHost,
  44. ctHostSSL,
  45. ctHostNoSSL
  46. } ConnType;
  47. typedef struct HbaLine
  48. {
  49. int linenumber;
  50. char *rawline;
  51. ConnType conntype;
  52. List *databases;
  53. List *roles;
  54. struct sockaddr_storage addr;
  55. struct sockaddr_storage mask;
  56. IPCompareMethod ip_cmp_method;
  57. char *hostname;
  58. UserAuth auth_method;
  59. char *usermap;
  60. char *pamservice;
  61. bool pam_use_hostname;
  62. bool ldaptls;
  63. char *ldapserver;
  64. int ldapport;
  65. char *ldapbinddn;
  66. char *ldapbindpasswd;
  67. char *ldapsearchattribute;
  68. char *ldapbasedn;
  69. int ldapscope;
  70. char *ldapprefix;
  71. char *ldapsuffix;
  72. bool clientcert;
  73. char *krb_realm;
  74. bool include_realm;
  75. bool compat_realm;
  76. bool upn_username;
  77. char *radiusserver;
  78. char *radiussecret;
  79. char *radiusidentifier;
  80. int radiusport;
  81. } HbaLine;
  82. typedef struct IdentLine
  83. {
  84. int linenumber;
  85. char *usermap;
  86. char *ident_user;
  87. char *pg_role;
  88. regex_t re;
  89. } IdentLine;
  90. /* kluge to avoid including libpq/libpq-be.h here */
  91. typedef struct Port hbaPort;
  92. extern bool load_hba(void);
  93. extern bool load_ident(void);
  94. extern void hba_getauthmethod(hbaPort *port);
  95. extern int check_usermap(const char *usermap_name,
  96. const char *pg_role, const char *auth_user,
  97. bool case_sensitive);
  98. extern bool pg_isblank(const char c);
  99. #endif /* HBA_H */