RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1007452 - Under specific values of nsDS5ReplicaName, replication may get broken or updates missing
Summary: Under specific values of nsDS5ReplicaName, replication may get broken or upda...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: 389-ds-base
Version: 6.4
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Rich Megginson
QA Contact: Sankar Ramalingam
URL:
Whiteboard:
Depends On:
Blocks: 1007988
TreeView+ depends on / blocked
 
Reported: 2013-09-12 14:07 UTC by Rich Megginson
Modified: 2020-09-13 20:43 UTC (History)
3 users (show)

Fixed In Version: 389-ds-base-1.2.11.15-25.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1007988 (view as bug list)
Environment:
Last Closed: 2013-11-21 21:12:01 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github 389ds 389-ds-base issues 826 0 None None None 2020-09-13 20:43:09 UTC
Red Hat Product Errata RHBA-2013:1653 0 normal SHIPPED_LIVE 389-ds-base bug fix update 2013-11-20 21:53:19 UTC

Description Rich Megginson 2013-09-12 14:07:48 UTC
This bug is created as a clone of upstream ticket:
https://fedorahosted.org/389/ticket/47489

In a replication environment, if the changelog db file name contains extension string multiple times in the file name, the change log file is getting recreated if we perform the db2ldif and ldif2db on the master/hub instance.

Ex: d736e482-198111e1-8d7bedb4-8c53b85f_502ce263000000020000.db4
    In this file name "db4"  is present twice, once as the extension and other one is in the replica name string ("8d7bedb4").

There is a logic problem in the below function where it is trying to find the filename ends with extension. It calls strstr()function to search the "ext" and which returns the first occurrence of the "ext" string in the filename. if the the "ext" string exist multiple times in the file name it returns false always, which result in creating multiple changelog db file. 

====
filename: cl5_api.c

/*
 * return 1: true (the "filename" ends with "ext")
 * return 0: false
 */
static int _cl5FileEndsWith(const char *filename, const char *ext)
{
	char *p = NULL;
	int flen = strlen(filename);
	int elen = strlen(ext);
	if (0 == flen || 0 == elen)
	{
		 return 0;
	}
	p = strstr(filename, ext);
	if (NULL == p)
 	{
		 return 0;
	}
	if (p - filename + elen == flen)
        {
		 return 1;
	}
 	return 0;
}
=====

I have modified this function to fix this issue. Could you please verify the same and include the fix in the master branch?

/*
 * return 1: true (the "filename" ends with "ext")
 * return 0: false
 */
static int _cl5FileEndsWith(const char *filename, const char *ext)
{
	char *p = NULL;
	int flen = strlen(filename);
	int elen = strlen(ext);
	if (0 == flen || 0 == elen)
	{
		return 0;
	}
	p = strstr(filename, ext);
	if (NULL == p)
	{
		return 0;
	}
        
        do {
	    if (p - filename + elen == flen)
	    {
		return 1;
	    }
            p = strstr(p+elen, ext);
        } while ( p != NULL );
 
	return 0;
}
=====

Thanks and Regards,
Jyoti

Comment 1 Rich Megginson 2013-09-12 14:09:56 UTC
This issue seems serious enough to warrant inclusion in RHEL 6.5.

Comment 2 Jenny Severance 2013-09-16 15:42:31 UTC
Steps to reproduce are
	Create Master, C1, C2
        Create ReplAgreement M->C1 and M->C2

        <before doing any update>
        Stop Master
        Identify database suffix like db4 (e.g. /var/lib/dirsrv/slapd-master/db/userRoot/id2entry.db4)
        Edit master dse.ldif. 
              Look for cn=replica,cn=<suffix>,cn=mapping tree,cn=config
	      Update nsDS5ReplicaName to add database suffix in the name like
                before: afbf227b-1ca411e3-8cdaf60b-fc2f2a5a
                after : afbf227b-1ca411e3-8cdafdb4-fc2f2a5a
        Start Master

        # The following steps will created the changelog file that contains 'db4'
	Create user t1
	Create user t2
	<check replication is working>

        # The following steps create entry t3 on M and C1 but not on C2.
        # t3 is also recorded in the changelog
	Stop C2
	Create user t3
	<check t3 is replicated on C1>

        # The following step will corrupt the t3 entry in the changelog, so that
        # the entry ADD can no longer be replicated
	Stop Master, C1
	export Master (-r)
	import C1 (this step can likely be skipped)
	Start Master, C1, C2

        # The following step triggers that C2 will miss t3
	Create user t4

		-> On Master: t1, t2, t3, t4
		-> On Cons.1: t1, t2, t3, t4
		-> On Cons.2: t1, t2,     t4

        # An update on t3, should break replication

Comment 4 Sankar Ramalingam 2013-10-23 13:06:49 UTC
Marking it as Verified since Master, C1 and C2 contains the same number of entries after following the steps mentioned in Comment #2.

Comment 5 errata-xmlrpc 2013-11-21 21:12:01 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-1653.html


Note You need to log in before you can comment on or make changes to this bug.