91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

AgensGraph 是一個(gè)基于 PostgreSQL 的新一代多模型圖數(shù)據(jù)庫。它提供圖形分析環(huán)境,用戶可以同時(shí)編寫、編輯和執(zhí)行 SQL 和 Cypher 查詢。AgensGraph 帶有 PostgreSQL 兼容性和 PostgreSQL擴(kuò)展,能夠幫助PostgreSQL用戶擺脫數(shù)據(jù)遷移的痛苦,輕松開發(fā)提供高級數(shù)據(jù)分析的服務(wù)。

資源截圖

代碼片段和文件信息

/*-------------------------------------------------------------------------
?*
?*?adminpack.c
?*
?*
?*?Copyright?(c)?2002-2017?PostgreSQL?Global?Development?Group
?*
?*?Author:?Andreas?Pflug?
?*
?*?IDENTIFICATION
?* ??contrib/adminpack/adminpack.c
?*
?*-------------------------------------------------------------------------
?*/
#include?“postgres.h“

#include?
#include?
#include?

#include?“catalog/pg_type.h“
#include?“funcapi.h“
#include?“miscadmin.h“
#include?“postmaster/syslogger.h“
#include?“storage/fd.h“
#include?“utils/builtins.h“
#include?“utils/datetime.h“


#ifdef?WIN32

#ifdef?rename
#undef?rename
#endif

#ifdef?unlink
#undef?unlink
#endif
#endif

PG_MODULE_MAGIC;

PG_FUNCTION_INFO_V1(pg_file_write);
PG_FUNCTION_INFO_V1(pg_file_rename);
PG_FUNCTION_INFO_V1(pg_file_unlink);
PG_FUNCTION_INFO_V1(pg_logdir_ls);

typedef?struct
{
char ???*location;
DIR ???*dirdesc;
}?directory_fctx;

/*-----------------------
?*?some?helper?functions
?*/

/*
?*?Convert?a?“text“?filename?argument?to?C?string?and?check?it‘s?allowable.
?*
?*?Filename?may?be?absolute?or?relative?to?the?DataDir?but?we?only?allow
?*?absolute?paths?that?match?DataDir?or?Log_directory.
?*/
static?char?*
convert_and_check_filename(text?*arg?bool?logAllowed)
{
char ???*filename?=?text_to_cstring(arg);

canonicalize_path(filename); /*?filename?can?change?length?here?*/

if?(is_absolute_path(filename))
{
/*?Disallow?‘/a/b/data/..‘?*/
if?(path_contains_parent_reference(filename))
ereport(ERROR
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE)
?(errmsg(“reference?to?parent?directory?(\“..\“)?not?allowed“))));

/*
?*?Allow?absolute?paths?if?within?DataDir?or?Log_directory?even
?*?though?Log_directory?might?be?outside?DataDir.
?*/
if?(!path_is_prefix_of_path(DataDir?filename)?&&
(!logAllowed?||?!is_absolute_path(Log_directory)?||
?!path_is_prefix_of_path(Log_directory?filename)))
ereport(ERROR
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE)
?(errmsg(“absolute?path?not?allowed“))));
}
else?if?(!path_is_relative_and_below_cwd(filename))
ereport(ERROR
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE)
?(errmsg(“path?must?be?in?or?below?the?current?directory“))));

return?filename;
}


/*
?*?check?for?superuser?bark?if?not.
?*/
static?void
requireSuperuser(void)
{
if?(!superuser())
ereport(ERROR
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE)
?(errmsg(“only?superuser?may?access?generic?file?functions“))));
}



/*?------------------------------------
?*?generic?file?handling?functions
?*/

Datum
pg_file_write(PG_FUNCTION_ARGS)
{
FILE ???*f;
char ???*filename;
text ???*data;
int64 count?=?0;

requireSuperuser();

filename?=?convert_and_check_filename(PG_GETARG_TEXT_PP(0)?false);
data?=?PG_GETARG_TEXT_PP(1);

if?(!PG_GETARG_BOOL(2))
{
struct?stat?fst;

if?(stat(filename?&fst)?>=?0)
ereport(ERROR
(ERRCODE_DUPLICATE_FILE
?errmsg(“file?\“%s\“?exists

評論

共有 條評論