Re: Plugin-in Guide for 1.4.0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On 1 Sep 2020, at 23:35, Jan Tomasek <jan@xxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to 389-users-leave@xxxxxxxxxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxxxxxxxxx




[Index of Archives]     [Fedora User Discussion]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora News]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora QA]     [Fedora Triage]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Yosemite Photos]     [Linux Apps]     [Maemo Users]     [Gnome Users]     [KDE Users]     [Fedora Tools]     [Fedora Art]     [Fedora Docs]     [Maemo Users]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Fedora ARM]

  Powered by Linux