Skip to content

Commit 72e49af

Browse files
korydraughnalanking
authored andcommitted
[#170] Make plugin interface functions static.
Before this change, it was possible for other rule engine plugins to invoke the python rule engine plugin's interface functions. This is very bad because it can lead to sibling plugins not operating correctly and/or a broken server. Marking the interface functions as static makes them private to the implementation of the plugin. This means no other rule engine plugin will be able to invoke the python rule engine plugin's interface functions.
1 parent b1c8355 commit 72e49af

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

src/main.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ namespace
340340
}
341341
} // anonymous namespace
342342

343-
irods::error start(irods::default_re_ctx&, const std::string& _instance_name)
343+
static irods::error start(irods::default_re_ctx&, const std::string& _instance_name)
344344
{
345345
try {
346346
#if PY_VERSION_HEX < 0x03000000
@@ -449,15 +449,15 @@ irods::error start(irods::default_re_ctx&, const std::string& _instance_name)
449449
return ERROR(SYS_INVALID_INPUT_PARAM, msg.str());
450450
}
451451

452-
irods::error stop(irods::default_re_ctx&, const std::string&)
452+
static irods::error stop(irods::default_re_ctx&, const std::string&)
453453
{
454454
// Boost.Python's documentation advises not to call Py_Finalize
455455
// https://www.boost.org/doc/libs/1_78_0/libs/python/doc/html/tutorial/tutorial/embedding.html
456456
//Py_Finalize();
457457
return SUCCESS();
458458
}
459459

460-
irods::error rule_exists(const irods::default_re_ctx&, const std::string& rule_name, bool& _return)
460+
static irods::error rule_exists(const irods::default_re_ctx&, const std::string& rule_name, bool& _return)
461461
{
462462
_return = false;
463463
try {
@@ -484,7 +484,7 @@ irods::error rule_exists(const irods::default_re_ctx&, const std::string& rule_n
484484
return SUCCESS();
485485
}
486486

487-
irods::error list_rules(const irods::default_re_ctx&, std::vector<std::string>& rule_vec)
487+
static irods::error list_rules(const irods::default_re_ctx&, std::vector<std::string>& rule_vec)
488488
{
489489
try {
490490
std::lock_guard<std::recursive_mutex> lock{python_mutex};
@@ -544,10 +544,10 @@ irods::error list_rules(const irods::default_re_ctx&, std::vector<std::string>&
544544
return SUCCESS();
545545
}
546546

547-
irods::error exec_rule(const irods::default_re_ctx&,
548-
const std::string& rule_name,
549-
std::list<boost::any>& rule_arguments_cpp,
550-
irods::callback effect_handler)
547+
static irods::error exec_rule(const irods::default_re_ctx&,
548+
const std::string& rule_name,
549+
std::list<boost::any>& rule_arguments_cpp,
550+
irods::callback effect_handler)
551551
{
552552
try {
553553
std::lock_guard<std::recursive_mutex> lock{python_mutex};
@@ -627,11 +627,11 @@ irods::error exec_rule(const irods::default_re_ctx&,
627627
}
628628

629629
//irule
630-
irods::error exec_rule_text(const irods::default_re_ctx&,
631-
const std::string& rule_text,
632-
msParamArray_t* ms_params,
633-
const std::string& out_desc,
634-
irods::callback effect_handler)
630+
static irods::error exec_rule_text(const irods::default_re_ctx&,
631+
const std::string& rule_text,
632+
msParamArray_t* ms_params,
633+
const std::string& out_desc,
634+
irods::callback effect_handler)
635635
{
636636
// Because Python is not sandboxed, need to restrict irule to admin users only
637637
const auto rei = get_rei_from_effect_handler(effect_handler);
@@ -807,10 +807,10 @@ irods::error exec_rule_text(const irods::default_re_ctx&,
807807
}
808808

809809
//delay execution
810-
irods::error exec_rule_expression(irods::default_re_ctx&,
811-
const std::string& rule_text,
812-
msParamArray_t* ms_params,
813-
irods::callback effect_handler)
810+
static irods::error exec_rule_expression(irods::default_re_ctx&,
811+
const std::string& rule_text,
812+
msParamArray_t* ms_params,
813+
irods::callback effect_handler)
814814
{
815815
try {
816816
std::lock_guard<std::recursive_mutex> lock{python_mutex};

0 commit comments

Comments
 (0)