#50899 Ticket 50898 - ldclt core dumped when run with -e genldif option
Closed 3 years ago by spichugi. Opened 4 years ago by tbordaz.
tbordaz/389-ds-base ticket_50898  into  master

@@ -1529,12 +1529,18 @@ 

      nbAttribs = 0;   /* No attributes yet */

      attribute.mod_op = LDAP_MOD_ADD;

      attribute.mod_type = "objectclass";

+     attribute.mod_values = NULL;

      if (mctx.mode & OC_PERSON)

          attribute.mod_values = strList1("person");

      if (mctx.mode & OC_EMAILPERSON)

          attribute.mod_values = strList1("emailPerson");

      if (mctx.mode & OC_INETORGPRSON)                      /*JLS 07-11-00*/

          attribute.mod_values = strList1("inetOrgPerson"); /*JLS 07-11-00*/

+     if (attribute.mod_values == NULL) {

+         printf("ldclt[%d]: T%03d: attribute objectclass not defined (supported values are person/emailPerson/inetOrgPerson)\n",

+                    mctx.pid, tttctx->thrdNum);

+         return -1;

+     }

      if (addAttrib(attrs, nbAttribs++, &attribute) < 0)

          return (-1);

  

Bug Description:
ldctl can generate ldif file. If the template file or option
-e <objectclass> (person/InetOrgPerson/emailPerson) is missing,
then the attribute value is not set.
When dereferencing attribute.mod_values it crashes

Fix Description:
Test that attribute.mod_values is set. If it is not (tha
means the objectclass value was not provided) and return an error

https://pagure.io/389-ds-base/issue/50898

Reviewed by: ?

Platforms tested: F29

Flag Day: no

Doc impact: no

Pull-Request has been merged by tbordaz

4 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/3952

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

3 years ago
Metadata