Skip to content

Commit 12b2158

Browse files
committed
Fixed access restrictions to private routines in packages
1 parent c62f060 commit 12b2158

5 files changed

Lines changed: 11 additions & 4 deletions

File tree

src/dsql/dsql.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,7 +1445,8 @@ dsql_prc::dsql_prc(MemoryPool& p, const jrd_prc* jproc)
14451445
prc_in_count(jproc->getInputFields().getCount()),
14461446
prc_def_count(jproc->getDefaultCount()),
14471447
prc_out_count(jproc->getOutputFields().getCount()),
1448-
prc_id(jproc->getId())
1448+
prc_id(jproc->getId()),
1449+
prc_private(jproc->flPrivate)
14491450
{ }
14501451

14511452
dsql_fld* dsql_prc::cpFields(MemoryPool& p, const Array<NestConst<Parameter>>& fields)
@@ -1495,7 +1496,8 @@ dsql_fld::dsql_fld(MemoryPool& p, const dsc& desc, dsql_fld*** prev)
14951496

14961497
dsql_udf::dsql_udf(MemoryPool& p, const class Function* jfun)
14971498
: udf_name(p, jfun->getName()),
1498-
udf_arguments(p)
1499+
udf_arguments(p),
1500+
udf_private(jfun->flPrivate)
14991501
{
15001502
// return value
15011503
fb_assert(jfun->getOutputFields().getCount() == 1);

src/dsql/metd.epp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ dsql_udf* METD_get_function(jrd_tra* transaction, DsqlCompilerScratch* dsqlScrat
572572

573573
if (userFunc->udf_private && name.getSchemaAndPackage() != dsqlScratch->package)
574574
{
575-
status_exception::raise(Arg::Gds(isc_private_procedure) <<
575+
status_exception::raise(Arg::Gds(isc_private_function) <<
576576
Arg::Str(name.object) << Arg::Str(name.package));
577577
}
578578

src/jrd/Function.epp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ ScanResult Function::scan(thread_db* tdbb, ObjectBase::Flag flags)
271271
fun_return_arg = X.RDB$RETURN_ARGUMENT;
272272
fun_temp_length = length;
273273

274+
flPrivate = !X.RDB$PRIVATE_FLAG.NULL && X.RDB$PRIVATE_FLAG != 0;
275+
274276
// Prepare the exception message to be used in case this function ever
275277
// causes an exception. This is done at this time to save us from preparing
276278
// (thus allocating) this message every time the function is called.

src/jrd/Routine.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ namespace Jrd
162162

163163
void afterDecrement(Jrd::thread_db*);
164164
void releaseStatement(thread_db* tdbb);
165-
//void remove(thread_db* tdbb);
165+
166166
virtual void releaseExternal()
167167
{
168168
}
@@ -188,6 +188,7 @@ namespace Jrd
188188
public:
189189
bool flReload;
190190
bool compiling = false; // Do not try to load routine's BLR in scan/reload during compile
191+
bool flPrivate = false; // Private routine in a package
191192

192193
public:
193194
Jrd::UserId* invoker; // Invoker ID

src/jrd/met.epp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2820,6 +2820,8 @@ ScanResult jrd_prc::scan(thread_db* tdbb, ObjectBase::Flag flags)
28202820
prc_type = P.RDB$PROCEDURE_TYPE.NULL ?
28212821
prc_legacy : (prc_t) P.RDB$PROCEDURE_TYPE;
28222822

2823+
flPrivate = !P.RDB$PRIVATE_FLAG.NULL && P.RDB$PRIVATE_FLAG != 0;
2824+
28232825
if (external || !P.RDB$PROCEDURE_BLR.NULL)
28242826
{
28252827
MemoryPool* const csb_pool = dbb->createPool();

0 commit comments

Comments
 (0)