OpenLDAP 从 2.4 更新到 2.6.1 后,slapi 插件不起作用
我们从源代码开始构建并在 Linux 上运行 OpenLDAP 和 SLAPI 插件。 SLAPI 插件用 C 语言编写,将 LDAP 更改(添加、修改、删除)发布到身份管理系统 (IDM)。该插件在 slapd.conf 中配置为
plugin postoperation /opt/openldap-2.6.1/lib64/idm.so idm_init "IDM Plugin" 10.23.33.52 3001
函数 idm_init() 注册静态 C 函数以按预期方式添加、修改和删除(此处仅显示修改)
int idm_init(Slapi_PBlock * pb)
{
int rc = LDAP_SUCCESS;
log("idm-plugin:","now in idm_init()\n");
// first call, create new list and register the functions
...
rc |=
slapi_pblock_set( /* Plug-in API version */ pb,
SLAPI_PLUGIN_VERSION,
SLAPI_PLUGIN_CURRENT_VERSION);
rc |=
slapi_pblock_set( /* Plug-in description */ pb,
SLAPI_PLUGIN_DESCRIPTION, (void *) &desc);
rc |=
slapi_pblock_set( /* Modify function */ pb,
SLAPI_PLUGIN_POST_MODIFY_FN,
(void *) modify_user);
...
// read arguments and add list entry
rc |= read_arguments(pb);
log("idm-plugin", "idm_init() return rc:%d\n", rc);
return rc;
}
: modify_user()
的函数应该在修改数据后从 LDAP 服务器调用,稍后将通过网络发布更改,并且无需详细说明该函数的开头如下所示:
static int modify_user(Slapi_PBlock * pb)
{
Slapi_Entry *entry;
log("idm-plugin:", "now in modify_user\n");
if (slapi_pblock_get(pb, SLAPI_SEARCH_TARGET, &entry) != LDAP_SUCCESS) {
log("IDM-Connector Plugin",
"entry modified, but couldn't get entry");
return -1;
}
...
问题是,在 LDAP 更新后此功能不被调用。日志 仅显示插件的附加和初始化,但没有进一步的操作:
03/16/22 10:52:26 idm-plugin:: now in idm_init()
03/16/22 10:52:26 IDM-Connector Plugin: idm_init: Initializing plugin
03/16/22 10:52:26 idm-plugin:: now in read_arguments()
03/16/22 10:52:26 IDM Plugin: added idm connector: ip=10.23.33.52, port=3001
03/16/22 10:52:26 idm-plugin: idm_init() returns rc:0
03/16/22 10:52:26 plugin_pblock_new: Registered plugin OCLC-IDM-Connector-Notifier 1.0 [OCLC.org] (Notify the OCLC IDM-Connector of changes)
正如主题所说,使用 OpenLDAP 2.4 可以正常工作。它不再适用于 2.6.1。
SLAPI 接口是否有一些我们不知道的变化?
我已经设置了完整日志级别any
,但没有记录有关函数调用的任何内容。有什么想法吗?
We build from source and run OpenLDAP and the SLAPI plugin since ages on Linux. The SLAPI plugin, written in C, publishes LDAP changes (add, modify, delete) to an Identity Management System (IDM). The plugin is configured in slapd.conf
as
plugin postoperation /opt/openldap-2.6.1/lib64/idm.so idm_init "IDM Plugin" 10.23.33.52 3001
The function idm_init()
registers static C functions for add, modify and delete the supposed way (here only shown for modify):
int idm_init(Slapi_PBlock * pb)
{
int rc = LDAP_SUCCESS;
log("idm-plugin:","now in idm_init()\n");
// first call, create new list and register the functions
...
rc |=
slapi_pblock_set( /* Plug-in API version */ pb,
SLAPI_PLUGIN_VERSION,
SLAPI_PLUGIN_CURRENT_VERSION);
rc |=
slapi_pblock_set( /* Plug-in description */ pb,
SLAPI_PLUGIN_DESCRIPTION, (void *) &desc);
rc |=
slapi_pblock_set( /* Modify function */ pb,
SLAPI_PLUGIN_POST_MODIFY_FN,
(void *) modify_user);
...
// read arguments and add list entry
rc |= read_arguments(pb);
log("idm-plugin", "idm_init() return rc:%d\n", rc);
return rc;
}
The function for modify_user()
which should be called from the LDAP server after modification of data, will later publish the change via network and without going into the details the start of the function looks like this:
static int modify_user(Slapi_PBlock * pb)
{
Slapi_Entry *entry;
log("idm-plugin:", "now in modify_user\n");
if (slapi_pblock_get(pb, SLAPI_SEARCH_TARGET, &entry) != LDAP_SUCCESS) {
log("IDM-Connector Plugin",
"entry modified, but couldn't get entry");
return -1;
}
...
The problem is, that after an update in LDAP this function is not called. The log
shows only the attach and initialisation of the plugin but no further actions:
03/16/22 10:52:26 idm-plugin:: now in idm_init()
03/16/22 10:52:26 IDM-Connector Plugin: idm_init: Initializing plugin
03/16/22 10:52:26 idm-plugin:: now in read_arguments()
03/16/22 10:52:26 IDM Plugin: added idm connector: ip=10.23.33.52, port=3001
03/16/22 10:52:26 idm-plugin: idm_init() returns rc:0
03/16/22 10:52:26 plugin_pblock_new: Registered plugin OCLC-IDM-Connector-Notifier 1.0 [OCLC.org] (Notify the OCLC IDM-Connector of changes)
As the subject sais, with OpenLDAP 2.4 this works fine. It does not work anymore with 2.6.1.
Is there some change in the SLAPI interface of which we are not aware of?
I already set full log level any
but there is nothing logged about the function call. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
终止该线程: 该问题是由 slapd.conf 中的错误配置引起的。
插件线位于错误的位置。详细信息可以在这里查看:
https://bugs.openldap.org/show_bug.cgi?id=9812
To terminate this thread: The problem was caused by a misconfiguration in our slapd.conf.
The plugin line was at the wrong place. Details can be seen here:
https://bugs.openldap.org/show_bug.cgi?id=9812