24static const char restrict_chars[] =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
27 const char *
name,
const char *
subname,
int remoteVersion,
62 for (s = result; *s !=
'\0'; s++)
64 if (*s ==
'\n' || *s ==
'\r')
106 const char *owner,
const char *prefix,
int remoteVersion,
135 if (owner && *owner ==
'\0')
225 if (nspname && *nspname)
276 if (grantor->
len == 0 && owner)
288 && (!owner ||
strcmp(owner, grantor->
data) != 0))
296 if (nspname && *nspname)
310 if (nspname && *nspname)
323 && (!owner ||
strcmp(owner, grantor->
data) != 0))
393 prefix->
data, remoteVersion, sql))
424 const char *
name,
const char *
subname,
int remoteVersion,
464#define CONVERT_PRIV(code, keywd) \
466 if ((pos = strchr(eqpos + 1, code))) \
468 if (*(pos + 1) == '*' && privswgo != NULL) \
470 AddAcl(privswgo, keywd, subname); \
471 all_without_go = false; \
475 AddAcl(privs, keywd, subname); \
476 all_with_go = false; \
480 all_with_go = all_without_go = false; \
538 else if (
strcmp(
type,
"FOREIGN DATA WRAPPER") == 0)
590 for (src =
input; *src; src++)
593 if (!
isalnum((
unsigned char) *src) && *src !=
'_')
601 for (src =
input; *src; src++)
635 while (!(*
input ==
'"' && *(
input + 1) !=
'"'))
682 "SELECT provider, label FROM pg_catalog.pg_shseclabel "
683 "WHERE classoid = 'pg_catalog.%s'::pg_catalog.regclass "
697 const char *objtype,
const char *objname)
708 "SECURITY LABEL FOR %s ON %s",
833 else if (*
nextp ==
'\0')
948 pg_fatal(
"could not open directory \"%s\": %m", dirname);
953 pg_fatal(
"could not create directory \"%s\": %m", dirname);
958 pg_fatal(
"could not change permissions of directory \"%s\": %m",
963 pg_fatal(
"directory \"%s\" is not empty", dirname);
981 for (
int i = 0;
i <
sizeof(
buf) - 1;
i++)
987 ret[
sizeof(
buf) - 1] =
'\0';
Datum idx(PG_FUNCTION_ARGS)
Acl * acldefault(ObjectType objtype, Oid ownerId)
char * generate_restrict_key(void)
bool buildACLCommands(const char *name, const char *subname, const char *nspname, const char *type, const char *acls, const char *baseacls, const char *owner, const char *prefix, int remoteVersion, PQExpBuffer sql)
static char * dequoteAclUserName(PQExpBuffer output, char *input)
bool valid_restrict_key(const char *restrict_key)
void buildShSecLabelQuery(const char *catalog_name, Oid objectId, PQExpBuffer sql)
void makeAlterConfigCommand(PGconn *conn, const char *configitem, const char *type, const char *name, const char *type2, const char *name2, PQExpBuffer buf)
bool buildDefaultACLCommands(const char *type, const char *nspname, const char *acls, const char *acldefault, const char *owner, int remoteVersion, PQExpBuffer sql)
char * sanitize_line(const char *str, bool want_hyphen)
void create_or_open_dir(const char *dirname)
bool variable_is_guc_list_quote(const char *name)
void quoteAclUserName(PQExpBuffer output, const char *input)
static bool parseAclItem(const char *item, const char *type, const char *name, const char *subname, int remoteVersion, PQExpBuffer grantee, PQExpBuffer grantor, PQExpBuffer privs, PQExpBuffer privswgo)
static void AddAcl(PQExpBuffer aclbuf, const char *keyword, const char *subname)
void emitShSecLabels(PGconn *conn, PGresult *res, PQExpBuffer buffer, const char *objtype, const char *objname)
static const char restrict_chars[]
bool SplitGUCList(char *rawstring, char separator, char ***namelist)
#define CONVERT_PRIV(code, keywd)
void * pg_malloc(size_t size)
char * pg_strdup(const char *in)
static char * restrict_key
static char buf[DEFAULT_XLOG_SEG_SIZE]
bool pg_strong_random(void *buf, size_t len)
int pg_strcasecmp(const char *s1, const char *s2)
int pg_check_dir(const char *dir)
void printfPQExpBuffer(PQExpBuffer str, const char *fmt,...)
PQExpBuffer createPQExpBuffer(void)
void resetPQExpBuffer(PQExpBuffer str)
void appendPQExpBuffer(PQExpBuffer str, const char *fmt,...)
void destroyPQExpBuffer(PQExpBuffer str)
void appendPQExpBufferChar(PQExpBuffer str, char ch)
void appendPQExpBufferStr(PQExpBuffer str, const char *data)
const char * fmtId(const char *rawid)
void appendStringLiteralConn(PQExpBuffer buf, const char *str, PGconn *conn)
bool parsePGArray(const char *atext, char ***itemarray, int *nitems)