#50654 Issue 50653 - objectclass parsing fails to log error message text
Closed 2 years ago by spichugi. Opened 2 years ago by mreynolds.
mreynolds/389-ds-base issue50653  into  master

file modified
+7 -3
@@ -124,7 +124,7 @@ 

  

  static void oc_add_nolock(struct objclass *newoc);

  static int oc_delete_nolock(char *ocname);

- static int oc_replace_nolock(const char *ocname, struct objclass *newoc);

+ static int oc_replace_nolock(const char *ocname, struct objclass *newoc, char *errorbuf, size_t errorbufsize);

  static int oc_check_required(Slapi_PBlock *, Slapi_Entry *, struct objclass *);

  static int oc_check_allowed_sv(Slapi_PBlock *, Slapi_Entry *e, const char *type, struct objclass **oclist);

  static int schema_delete_objectclasses(Slapi_Entry *entryBefore,
@@ -1003,7 +1003,7 @@ 

  */

  

  static int

- oc_replace_nolock(const char *ocname, struct objclass *newoc)

+ oc_replace_nolock(const char *ocname, struct objclass *newoc, char *errorbuf, size_t errorbufsize)

  {

      struct objclass *oc, *pnext;

      int rc = LDAP_SUCCESS;
@@ -1023,6 +1023,8 @@ 

          for (pnext = oc; pnext != NULL;

               oc = pnext, pnext = pnext->oc_next) {

              if (pnext->oc_name == NULL) {

+                 schema_create_errormsg(errorbuf, errorbufsize, schema_errprefix_oc,

+                                        ocname, "Failed to replace objectclass");

                  rc = LDAP_OPERATIONS_ERROR;

                  break;

              }
@@ -1039,6 +1041,8 @@ 

                      break;

  

                  } else {

+                     schema_create_errormsg(errorbuf, errorbufsize, schema_errprefix_oc,

+                                            ocname, "Can not replace objectclass that already exists");

                      rc = LDAP_TYPE_OR_VALUE_EXISTS;

                      break;

                  }
@@ -2699,7 +2703,7 @@ 

      /* insert new objectclass exactly where the old one one in the linked list*/

      if (!rc && redefined_oc) {

          pnew_oc->oc_flags |= OC_FLAG_REDEFINED_OC;

-         rc = oc_replace_nolock(pnew_oc->oc_name, pnew_oc);

+         rc = oc_replace_nolock(pnew_oc->oc_name, pnew_oc, errorbuf, errorbufsize);

      }

  

      if (!rc && !redefined_oc) {

Description:

When replacing an objectclass, if it already exists we log an error but we do not log what objectclass it is. This commit adds the error message text.

relates: https://pagure.io/389-ds-base/issue/50653

rebased onto cc1c946

2 years ago

Pull-Request has been merged by mreynolds

2 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/3709

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

2 years ago
Metadata