plugins BUGFIX properly check extension instance
... even when they are from different contexts.
Fixes sysrepo/sysrepo#1225
diff --git a/src/plugins.c b/src/plugins.c
index d239dee..4045fd5 100644
--- a/src/plugins.c
+++ b/src/plugins.c
@@ -442,8 +442,17 @@
/* search for the extension instance */
for (index = 0; index < ext_size; index++) {
- if (ext[index]->def == def) {
- return index;
+ if (ext[index]->module->ctx == def->module->ctx) {
+ /* from the same context */
+ if (ext[index]->def == def) {
+ return index;
+ }
+ } else {
+ /* from different contexts */
+ if (ly_strequal0(ext[index]->def->name, def->name)
+ && ly_strequal0(lys_main_module(ext[index]->def->module)->name, lys_main_module(def->module)->name)) {
+ return index;
+ }
}
}