> On 1 Sep 2020, at 23:35, Jan Tomasek <j...@tomasek.cz> wrote:
> 
> Hi William,
> 
>> Reading this trace, it looks like you are missing debug symbols or devel 
>> information. Honestly, I'm not sure how to get this on debian, maybe 
>> "pkgname-dbgsym" aka 389-ds-dbgsym or similar needs to be installed?
> 
> Debian way is to add an extra repository, which contains all -dbgsym 
> packages. It is described here: https://wiki.debian.org/HowToGetABacktrace
> 
> The problem was in the declaration of variable method:
> 
> static int do_pre_bind(Slapi_PBlock *pb, char* errmsg)
> {
>    static const char* attributes[] = {"cn", NULL};
> 
>    plugin_config_t* conf;
>    int rc, method;
> ...
>    conf = &s_conf;
> ...
>    if (slapi_pblock_get(pb, SLAPI_BIND_TARGET, &dn) != 0
>        || slapi_pblock_get(pb, SLAPI_BIND_METHOD, &method) != 0
>        ...
> 
> Calling 'slapi_pblock_get(pb, SLAPI_BIND_METHOD, &method)' causes overwrite 
> of conf.
> 
> In 
> https://access.redhat.com/documentation/en-us/red_hat_directory_server/10/html-single/plug-in_guide/index#Plugin_Programming_Guide-Processing_an_LDAP_Bind_Operation-Getting_and_Setting_Parameters_for_the_Bind_Operation
>  is return of 'slapi_pblock_get(pb, SLAPI_BIND_METHOD, &method)' still 'int'
> 
> But in the source:
> https://pagure.io/389-ds-base/blob/master/f/ldap/servers/slapd/pblock.c#_1578
> 
> is used ber_tag_t
> 
> After I changed the declaration:
>    ber_tag_t method;
> 
> Plugin started work. I need to deeply test it, but it looks good.

Ahhhhhh I suspect ber_tag_t is 8 bytes not 4 then. You might find that building 
your plugins with address sanitiser would help pick up this kind of thing. We 
use ASAN during development to detect exactly this kind of problem, and it's 
really helped us improve the quality of our code, so if you have plugins it 
could be well worth your time to get that working.

One of the awful parts about the problem you hit here is that slapi_pblock_get 
transforms everything to void * pointers, which means that in pblock.c, if the 
input pointer was the wrong size/width, we'll just blast it with out thought - 
exactly what happened to you here. The pblock has long been something I want to 
change in the project, but so much relies on it, it's hard to see it being 
changed to be safer.

As well, if your plugins are generic or could be broadly applicable, they could 
be contributed too, but that's up to you :) 

> 
> I appreciate your kind way of helping me.

Any time mate, if you ever have questions please let us know! 

> 
> Thanks a lot!
> -- 
> -----------------------
> Jan Tomasek aka Semik
> http://www.tomasek.cz/
> 

—
Sincerely,

William Brown

Senior Software Engineer, 389 Directory Server
SUSE Labs
_______________________________________________
389-users mailing list -- 389-users@lists.fedoraproject.org
To unsubscribe send an email to 389-users-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/389-users@lists.fedoraproject.org

Reply via email to