Monday, August 31, 2020

[389-users] Re: Plugin-in Guide for 1.4.0

Hi Mark,

On 8/28/20 2:51 PM, Mark Reynolds wrote:
> Sorry the plugin guide has not been maintained in a long time. There was
> a discussion to just remove it.  Can you provide the stack trace from
> the crash?  I'm sure we help get it straightened out...

you are very kind. My C knowledge is kinda outdated, it's about 20years
I last time created something bigger in C.

I'm fighting with gdb how to be able trace debug 389 ds with plugin loaded:

root@ldap33:~# gdb /usr/sbin/ns-slapd

>
> (gdb) run -d 65536 -D /etc/dirsrv/slapd-ldap33 -i /var/run/dirsrv/slapd-ldap33.pid
> Starting program: /usr/sbin/ns-slapd -d 65536 -D /etc/dirsrv/slapd-ldap33 -i /var/run/dirsrv/slapd-ldap33.pid
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
> [31/Aug/2020:11:14:36.396980567 +0200] - DEBUG - syntax-plugin - => bin_init
> ...
> [31/Aug/2020:11:15:11.443569660 +0200] - ERR - altpass-plugin - do_pre_bind: 1
> [31/Aug/2020:11:15:11.445011559 +0200] - ERR - altpass-plugin - do_pre_bind: 2
> [31/Aug/2020:11:15:11.446302153 +0200] - ERR - altpass-plugin - do_pre_bind: 3
> [31/Aug/2020:11:15:11.447546080 +0200] - ERR - altpass-plugin - do_pre_bind: 4
> [31/Aug/2020:11:15:11.448848356 +0200] - ERR - altpass-plugin - do_pre_bind: 5
> [31/Aug/2020:11:15:11.450387903 +0200] - ERR - altpass-plugin - do_pre_bind: 6
> [31/Aug/2020:11:15:11.451510488 +0200] - ERR - altpass-plugin - do_pre_bind: 7
> [31/Aug/2020:11:15:11.453559193 +0200] - ERR - altpass-plugin - do_pre_bind: 8
> [31/Aug/2020:11:15:11.454709087 +0200] - ERR - altpass-plugin - do_pre_bind: 9
> [31/Aug/2020:11:15:11.455636136 +0200] - ERR - altpass-plugin - do_pre_bind: 9a
> [31/Aug/2020:11:15:11.456657442 +0200] - ERR - altpass-plugin - do_pre_bind: 9a: filter=(memberNisNetgroup=2001:718:1:6::134:138)
>
> Thread 17 "ns-slapd" received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0x7fffd0ff9700 (LWP 28079)]
> 0x00007ffff4318b52 in do_pre_bind () from /usr/lib/x86_64-linux-gnu/dirsrv/plugins/altpass-plugin.so
> (gdb) bt
> #0 0x00007ffff4318b52 in do_pre_bind () at /usr/lib/x86_64-linux-gnu/dirsrv/plugins/altpass-plugin.so
> #1 0x00007ffff4318f3b in pre_bind () at /usr/lib/x86_64-linux-gnu/dirsrv/plugins/altpass-plugin.so
> #2 0x00007ffff7f0c409 in None () at /usr/lib/x86_64-linux-gnu/dirsrv/libslapd.so.0
> #3 0x00007ffff7f0c654 in plugin_call_plugins () at /usr/lib/x86_64-linux-gnu/dirsrv/libslapd.so.0
> #4 0x000055555556907e in None ()
> #5 0x000055555557045a in None ()
> #6 0x00007ffff7c13ec7 in None () at /usr/lib/x86_64-linux-gnu/libnspr4.so
> #7 0x00007ffff7bb3fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486
> #8 0x00007ffff77ed4cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

When I set breakpoint at start of do_pre_bind():

> (gdb) b do_pre_bind
> Breakpoint 1 at 0x7ffff431879a
> (gdb) r
> The program being debugged has been started already.
> Start it from the beginning? (y or n) y
>
> [Switching to Thread 0x7fffd0ff9700 (LWP 28116)]
>
> Thread 17 "ns-slapd" hit Breakpoint 1, 0x00007ffff431879a in do_pre_bind () from /usr/lib/x86_64-linux-gnu/dirsrv/plugins/altpass-plugin.so
> (gdb)
>
> (gdb) l
> 1 ../sysdeps/x86_64/crti.S: No such file or directory.
> (gdb)

Tips how to properly set debug environment would be very welcome. I was
unable to locate crti.S anywhere in debian packages
https://packages.debian.org/search?searchon=contents&keywords=x86_64%2Fcrti.S&mode=path&suite=stable&arch=any

Source code around SIGSEGV place:

> slapi_entry_free(user_entry);
> user_entry = NULL;
>
> log_fatal("do_pre_bind: 9\n");
> // Find corresponding service(s)
> char filter[200];
> snprintf(filter, sizeof(filter), "(memberNisNetgroup=%s)", clientIP);
> log_fatal("do_pre_bind: 9a\n");
> log_fatal("do_pre_bind: 9a: filter=%s\n", filter);
>
> find_entries(conf->group_suffix, filter, attributes, &matching_services);

function find_entries() is never entered.

Thanks
--
-----------------------
Jan Tomasek aka Semik
http://www.tomasek.cz/

No comments:

Post a Comment