mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
Add option to bgworkers to allow the bypass of role login check
This adds a new option called BGWORKER_BYPASS_ROLELOGINCHECK to the
flags available to BackgroundWorkerInitializeConnection() and
BackgroundWorkerInitializeConnectionByOid().
This gives the possibility to bgworkers to bypass the role login check,
making possible the use of a role that has no login rights while not
being a superuser. PostgresInit() gains a new flag called
INIT_PG_OVERRIDE_ROLE_LOGIN, taking advantage of the refactoring done in
4800a5dfb4
.
Regression tests are added to worker_spi to check the behavior of this
new option with bgworkers.
Author: Bertrand Drouvot
Reviewed-by: Nathan Bossart, Michael Paquier, Bharath Rupireddy
Discussion: https://postgr.es/m/bcc36259-7850-4882-97ef-d6b905d2fc51@gmail.com
This commit is contained in:
@ -364,7 +364,8 @@ extern bool InSecurityRestrictedOperation(void);
|
||||
extern bool InNoForceRLSOperation(void);
|
||||
extern void GetUserIdAndContext(Oid *userid, bool *sec_def_context);
|
||||
extern void SetUserIdAndContext(Oid userid, bool sec_def_context);
|
||||
extern void InitializeSessionUserId(const char *rolename, Oid roleid);
|
||||
extern void InitializeSessionUserId(const char *rolename, Oid roleid,
|
||||
bool bypass_login_check);
|
||||
extern void InitializeSessionUserIdStandalone(void);
|
||||
extern void SetSessionAuthorization(Oid userid, bool is_superuser);
|
||||
extern Oid GetCurrentRoleId(void);
|
||||
@ -466,6 +467,7 @@ extern PGDLLIMPORT AuxProcType MyAuxProcType;
|
||||
/* flags for InitPostgres() */
|
||||
#define INIT_PG_LOAD_SESSION_LIBS 0x0001
|
||||
#define INIT_PG_OVERRIDE_ALLOW_CONNS 0x0002
|
||||
#define INIT_PG_OVERRIDE_ROLE_LOGIN 0x0004
|
||||
extern void pg_split_opts(char **argv, int *argcp, const char *optstr);
|
||||
extern void InitializeMaxBackends(void);
|
||||
extern void InitPostgres(const char *in_dbname, Oid dboid,
|
||||
|
Reference in New Issue
Block a user