gooderp18绿色标准版
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

135 行
2.5KB

  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. /*
  17. * The following enum represents the authentication methods that
  18. * are supported by PostgreSQL.
  19. *
  20. * Note: keep this in sync with the UserAuthName array in hba.c.
  21. */
  22. typedef enum UserAuth
  23. {
  24. uaReject,
  25. uaImplicitReject, /* Not a user-visible option */
  26. uaTrust,
  27. uaIdent,
  28. uaPassword,
  29. uaMD5,
  30. uaSCRAM,
  31. uaGSS,
  32. uaSSPI,
  33. uaPAM,
  34. uaBSD,
  35. uaLDAP,
  36. uaCert,
  37. uaRADIUS,
  38. uaPeer
  39. #define USER_AUTH_LAST uaPeer /* Must be last value of this enum */
  40. } UserAuth;
  41. typedef enum IPCompareMethod
  42. {
  43. ipCmpMask,
  44. ipCmpSameHost,
  45. ipCmpSameNet,
  46. ipCmpAll
  47. } IPCompareMethod;
  48. typedef enum ConnType
  49. {
  50. ctLocal,
  51. ctHost,
  52. ctHostSSL,
  53. ctHostNoSSL,
  54. ctHostGSS,
  55. ctHostNoGSS,
  56. } ConnType;
  57. typedef enum ClientCertMode
  58. {
  59. clientCertOff,
  60. clientCertCA,
  61. clientCertFull
  62. } ClientCertMode;
  63. typedef struct HbaLine
  64. {
  65. int linenumber;
  66. char *rawline;
  67. ConnType conntype;
  68. List *databases;
  69. List *roles;
  70. struct sockaddr_storage addr;
  71. struct sockaddr_storage mask;
  72. IPCompareMethod ip_cmp_method;
  73. char *hostname;
  74. UserAuth auth_method;
  75. char *usermap;
  76. char *pamservice;
  77. bool pam_use_hostname;
  78. bool ldaptls;
  79. char *ldapscheme;
  80. char *ldapserver;
  81. int ldapport;
  82. char *ldapbinddn;
  83. char *ldapbindpasswd;
  84. char *ldapsearchattribute;
  85. char *ldapsearchfilter;
  86. char *ldapbasedn;
  87. int ldapscope;
  88. char *ldapprefix;
  89. char *ldapsuffix;
  90. ClientCertMode clientcert;
  91. char *krb_realm;
  92. bool include_realm;
  93. bool compat_realm;
  94. bool upn_username;
  95. List *radiusservers;
  96. char *radiusservers_s;
  97. List *radiussecrets;
  98. char *radiussecrets_s;
  99. List *radiusidentifiers;
  100. char *radiusidentifiers_s;
  101. List *radiusports;
  102. char *radiusports_s;
  103. } HbaLine;
  104. typedef struct IdentLine
  105. {
  106. int linenumber;
  107. char *usermap;
  108. char *ident_user;
  109. char *pg_role;
  110. regex_t re;
  111. } IdentLine;
  112. /* kluge to avoid including libpq/libpq-be.h here */
  113. typedef struct Port hbaPort;
  114. extern bool load_hba(void);
  115. extern bool load_ident(void);
  116. extern void hba_getauthmethod(hbaPort *port);
  117. extern int check_usermap(const char *usermap_name,
  118. const char *pg_role, const char *auth_user,
  119. bool case_sensitive);
  120. extern bool pg_isblank(const char c);
  121. #endif /* HBA_H */
上海开阖软件有限公司 沪ICP备12045867号-1