ereport(LOG,
errmsg("connection authenticated: identity=\"%s\" method=%s "
"(%s:%d)",
- port->authn_id, hba_authname(port), HbaFileName,
+ port->authn_id, hba_authname(port->hba->auth_method), HbaFileName,
port->hba->linenumber));
}
}
else
nulls[index++] = true;
- /*
- * Make sure UserAuthName[] tracks additions to the UserAuth enum
- */
- StaticAssertStmt(lengthof(UserAuthName) == USER_AUTH_LAST + 1,
- "UserAuthName[] must match the UserAuth enum");
-
/* auth_method */
- values[index++] = CStringGetTextDatum(UserAuthName[hba->auth_method]);
+ values[index++] = CStringGetTextDatum(hba_authname(hba->auth_method));
/* options */
options = gethba_options(hba);
* should not be freed.
*/
const char *
-hba_authname(hbaPort *port)
+hba_authname(UserAuth auth_method)
{
- UserAuth auth_method;
-
- Assert(port->hba);
- auth_method = port->hba->auth_method;
-
- if (auth_method < 0 || USER_AUTH_LAST < auth_method)
- {
- /* Should never happen. */
- elog(FATAL, "port has out-of-bounds UserAuth: %d", auth_method);
- }
+ /*
+ * Make sure UserAuthName[] tracks additions to the UserAuth enum
+ */
+ StaticAssertStmt(lengthof(UserAuthName) == USER_AUTH_LAST + 1,
+ "UserAuthName[] must match the UserAuth enum");
return UserAuthName[auth_method];
}
extern bool load_hba(void);
extern bool load_ident(void);
-extern const char *hba_authname(hbaPort *port);
+extern const char *hba_authname(UserAuth auth_method);
extern void hba_getauthmethod(hbaPort *port);
extern int check_usermap(const char *usermap_name,
const char *pg_role, const char *auth_user,