From 14b82c899092f8fc17b8e42beb6543cdf2cfacb5 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Jul 19 2012 01:02:53 +0000 Subject: Ticket #410 - Referential integrity plug-in does not work when update interval is not zero https://fedorahosted.org/389/ticket/410 Resolves: Ticket #410 Bug Description: Referential integrity plug-in does not work when update interval is not zero Reviewed by: nhosoi (Thanks!) Branch: 389-ds-base-1.2.11 Fix Description: Checking for newsuperior == NULL is not sufficient - also have to check for slapi_sdn_get_dn(newsuperior) == NULL as well. Otherwise we write the string "(null)" to the referint log and that blows up the code that attempt to apply the change. Platforms tested: RHEL6 x86_64 Flag Day: no Doc impact: no --- diff --git a/ldap/servers/plugins/referint/referint.c b/ldap/servers/plugins/referint/referint.c index 1929cd5..7aee564 100644 --- a/ldap/servers/plugins/referint/referint.c +++ b/ldap/servers/plugins/referint/referint.c @@ -1119,6 +1119,7 @@ writeintegritylog(Slapi_PBlock *pb, char *logfilename, Slapi_DN *sdn, int len_to_write = 0; int rc; const char *requestordn = NULL; + const char *newsuperiordn = NULL; size_t reqdn_len = 0; /* write this record to the file */ @@ -1153,7 +1154,8 @@ writeintegritylog(Slapi_PBlock *pb, char *logfilename, Slapi_DN *sdn, /* add the length of the newrdn */ len_to_write += strlen(newrdn); } - if(NULL == newsuperior) + newsuperiordn = slapi_sdn_get_dn(newsuperior); + if(NULL == newsuperiordn) { /* add the length of "NULL" */ len_to_write += 4; @@ -1179,8 +1181,7 @@ writeintegritylog(Slapi_PBlock *pb, char *logfilename, Slapi_DN *sdn, PR_snprintf(buffer, MAX_LINE, "%s\t%s\t%s\t%s\t\n", slapi_sdn_get_dn(sdn), (newrdn != NULL) ? newrdn : "NULL", - (newsuperior != NULL) ? slapi_sdn_get_dn(newsuperior) : - "NULL", + (newsuperiordn != NULL) ? newsuperiordn : "NULL", requestordn ? requestordn : "NULL"); if (PR_Write(prfd,buffer,strlen(buffer)) < 0){ slapi_log_error(SLAPI_LOG_FATAL,REFERINT_PLUGIN_SUBSYSTEM,