389ds / 389-ds-base

The enterprise-class Open Source LDAP server for Linux
https://www.port389.org/
Other
212 stars 91 forks source link

adminutil crashes during debug session #1212

Closed 389-ds-bot closed 4 years ago

389-ds-bot commented 4 years ago

Cloned from Pagure issue: https://pagure.io/389-ds-base/issue/47881


Encountered a crash when debugging adminutil, which appears to be caused by an uninitialized pointer. I can not reproduce it anymore, the fix is quite simple and it shouldn't hurt to add it:

diff --git a/lib/libadminutil/admutil.c b/lib/libadminutil/admutil.c
index 839ab2d..1ab0151 100644
--- a/lib/libadminutil/admutil.c
+++ b/lib/libadminutil/admutil.c
@@ -1210,7 +1210,7 @@ admldapBuildInfoOnly(char* configRoot, int *errorcode)
   char           buf[MAX_LEN],
                  *name= NULL, *password=NULL;
   int            status;
-  LDAPURLDesc    *ldapInfo;
+  LDAPURLDesc    *ldapInfo = NULL;

   *errorcode = ADMUTIL_OP_OK;
389-ds-bot commented 4 years ago

Comment from mreynolds (@mreynolds389) at 2014-08-27 20:28:16

attachment 0001-Ticket-47881-crash-during-debug-session-in-adminutil.patch

389-ds-bot commented 4 years ago

Comment from mreynolds (@mreynolds389) at 2014-08-27 20:34:06

To ssh://git.fedorahosted.org/git/389/adminutil.git 9b3cfce..069de33 master -> master

commit 069de33671fd49732c9baeb7fb0007eb7518d97e Author: Mark Reynolds mreynolds389@redhat.com Date: Wed Aug 27 10:25:30 2014 -0400

389-ds-bot commented 4 years ago

Comment from mreynolds (@mreynolds389) at 2014-08-28 00:29:46

I was able to reproduce the crash, here is the stack:

Program received signal SIGSEGV, Segmentation fault.
0x00007f2a9bddd607 in admutil_ldap_url_parse (url=<optimized out>, ludpp=ludpp@entry=0x7fff4b995758, require_dn=require_dn@entry=0, secure=secure@entry=0x7f2aa24966b8)
    at lib/libadminutil/admutil.c:2185
2185        *secure = (*ludpp)->lud_scheme && !strcmp((*ludpp)->lud_scheme, "ldaps");

(gdb) where
0  0x00007f2a9bddd607 in admutil_ldap_url_parse (url=<optimized out>, ludpp=ludpp@entry=0x7fff4b995758, require_dn=require_dn@entry=0, secure=secure@entry=0x7f2aa24966b8)
    at lib/libadminutil/admutil.c:2185
1  0x00007f2a9bddd8ee in admldapBuildInfoOnly (configRoot=0x7f2aa2468c48 "/etc/dirsrv/admin-serv", errorcode=errorcode@entry=0x7fff4b995a88) at lib/libadminutil/admutil.c:1261
2  0x00007f2a9bdde214 in admldapBuildInfoCbk (configRoot=<optimized out>, cbk=0x7f2a9bddd2a0 <cachedPwdCbk>, errorcode=0x7fff4b995a88) at lib/libadminutil/admutil.c:1344
3  0x00007f2a9c42f706 in do_admserv_post_config (p=0x7f2aa23f6158, plog=0x7f2aa2423378, ptemp=0x7f2aa2425388, base_server=0x7f2aa2421f28) at ../admin/mod_admserv/mod_admserv.c:2411
4  0x00007f2a9c42fe72 in mod_admserv_post_config (p=0x7f2aa23f6158, plog=0x7f2aa2423378, ptemp=0x7f2aa2425388, base_server=0x7f2aa2421f28) at ../admin/mod_admserv/mod_admserv.c:2544
5  0x00007f2aa1cc8529 in ap_run_post_config (pconf=0x7f2aa23f6158, plog=0x7f2aa2423378, ptemp=0x7f2aa2425388, s=0x7f2aa2421f28) at config.c:103
6  0x00007f2aa1ca7748 in main (argc=5, argv=0x7fff4b996568) at main.c:696
389-ds-bot commented 4 years ago

Comment from rmeggins (@richm) at 2014-08-28 00:34:25

This could definitely be related to mixing mozldap and openldap in the same binary. The LDAPURLDesc size and layout is different for mozldap and openldap, and mixing the two will cause strange crashes.

389-ds-bot commented 4 years ago

Comment from mreynolds (@mreynolds389) at 2017-02-11 23:02:32

Metadata Update from @mreynolds389: