Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1241497

Summary: crash in ns-slapd when deleting winSyncSubtreePair from sync agreement
Product: Red Hat Enterprise Linux 7 Reporter: German Parente <gparente>
Component: 389-ds-baseAssignee: Noriko Hosoi <nhosoi>
Status: CLOSED ERRATA QA Contact: Viktor Ashirov <vashirov>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.1CC: nkinder, rmeggins
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 389-ds-base-1.3.4.0-6.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 11:43:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description German Parente 2015-07-09 10:43:27 UTC
Description of problem:

if we delete winSyncSubtreePair attribute from sync agreement, server crashes


Version-Release number of selected component (if applicable):

389-ds-base-1.3.3.1-16.el7_1.x86_64


How reproducible: always


Steps to Reproduce:
1. Create any sync agreement. For instance:

dn: cn=any,cn=replica,cn=dc\3Dexample\2Cdc\3Dorg,cn=mapping tree,cn=config
objectClass: top
objectClass: nsDSWindowsReplicationAgreement
description: sync agreement
cn: any
nsds7WindowsReplicaSubtree: cn=Users,dc=anytree
nsds7DirectoryReplicaSubtree: ou=People, dc=example,dc=org
nsds7NewWinUserSyncEnabled: on
nsds7NewWinGroupSyncEnabled: on
nsds7WindowsDomain: any.domain
nsDS5ReplicaRoot: dc=anytree    
nsDS5ReplicaHost: test.ad
nsDS5ReplicaPort: 389
nsDS5ReplicaBindDN: cn=Dirsyn,cn=Users,dc=anytree
nsDS5ReplicaBindMethod: SIMPLE
nsDS5ReplicaCredentials: secret12
oneWaySync: fromWindows
winSyncSubtreePair: ou=People,dc=anytree:ou=other,dc=anytree


2. start server

systemctl start dirsrv@EXAMPLE-ORG

3. delete winSyncSubtreePair

 ldapmodify -D "cn=directory manager" -w 'RedHat1!'
dn: cn=any,cn=replica,cn=dc\3Dexample\2Cdc\3Dorg,cn=mapping tree,cn=config
changetype: modify
delete: winSyncSubtreePair 

modifying entry "cn=any,cn=replica,cn=dc\3Dexample\2Cdc\3Dorg,cn=mapping tree,cn=config"
ldap_result: Can't contact LDAP server (-1)


Actual results:

crash


Additional info:
#0  slapi_sdn_free (sdn=sdn@entry=0x7f0086e86e88)
    at ldap/servers/slapd/dn.c:2351
2351		    is_allocated = slapi_isbitset_uchar((*sdn)->flag, FLAG_ALLOCATED);

#0  slapi_sdn_free (sdn=sdn@entry=0x7f0086e86e88)
    at ldap/servers/slapd/dn.c:2351
#1  0x00007f00794dee91 in free_subtree_pairs (pairs=0x7f0086e86d70)
    at ldap/servers/plugins/replication/windows_private.c:994
#2  windows_private_set_subtreepairs (ra=ra@entry=0x7f0086e85f70, 
    parray=parray@entry=0x0)
    at ldap/servers/plugins/replication/windows_private.c:930
#3  0x00007f00794e05ac in windows_parse_config_entry (
    ra=ra@entry=0x7f0086e85f70, type=<optimized out>, e=e@entry=0x7f006c007540)
    at ldap/servers/plugins/replication/windows_private.c:331
#4  0x00007f00794e0902 in windows_handle_modify_agreement (
    ra=ra@entry=0x7f0086e85f70, type=<optimized out>, e=e@entry=0x7f006c007540)
    at ldap/servers/plugins/replication/windows_private.c:348
#5  0x00007f00794b13e5 in agmtlist_modify_callback (pb=<optimized out>, 
    entryBefore=<optimized out>, e=0x7f006c007540, returncode=0x7f0054ff4528, 
    returntext=0x7f0054ff4560 "", arg=<optimized out>)
    at ldap/servers/plugins/replication/repl5_agmtlist.c:577
#6  0x00007f00851e274b in dse_call_callback (pb=pb@entry=0x7f0054ff8ae0, 
    operation=operation@entry=8, flags=flags@entry=1, 
    entryBefore=entryBefore@entry=0x7f006c001af0, 
    entryAfter=entryAfter@entry=0x7f006c007540, 
    returncode=returncode@entry=0x7f0054ff4528, 
    returntext=returntext@entry=0x7f0054ff4560 "", pdse=<optimized out>)
---Type <return> to continue, or q <return> to quit---

In fact, sdn is already corrupt:

(gdb) frame 1
#1  0x00007f00794dee91 in free_subtree_pairs (pairs=0x7f0086e86d70)
    at ldap/servers/plugins/replication/windows_private.c:994
994			slapi_sdn_free(&(p->DSsubtree));
(gdb) print p->DSsubtree
$1 = (Slapi_DN *) 0x31
(gdb)

Comment 2 German Parente 2015-07-09 12:39:09 UTC
Workaround:

delete the attribute by editing dse.ldif when server down and restart it.

Comment 3 Noriko Hosoi 2015-07-10 00:44:10 UTC
Steps to verify:

1. Setup Windows Sync (just setting up replica/agreement would be good enough).
2. add a subtreepair
ldapmodify << EOF
dn: cn=WinSyncAgmt,cn=replica,cn="<SUFFIX>",cn=mapping tree,cn=config
changetype: modify
add: winSyncSubtreePair
winSyncSubtreePair: ou=A,dc=anytreeX:ou=B,dc=anytreeY
EOF
3. replace the subtreepair
ldapmodify << EOF
dn: cn=WinSyncAgmt,cn=replica,cn="<SUFFIX>",cn=mapping tree,cn=config
changetype: modify
replace: winSyncSubtreePair
winSyncSubtreePair: ou=AA,dc=anytreeX:ou=BB,dc=anytreeY
EOF
4. delete the subtreepair
ldapmodify << EOF
dn: cn=WinSyncAgmt,cn=replica,cn="<SUFFIX>",cn=mapping tree,cn=config
changetype: modify
delete: winSyncSubtreePair
winSyncSubtreePair: ou=AA,dc=anytreeX:ou=BB,dc=anytreeY
EOF
If the server is still up, the fix for the original bug is verified.

Additionally,
5. add an invalid subtreepair.
ldapmodify << EOF
dn: cn=WinSyncAgmt,cn=replica,cn="<SUFFIX>",cn=mapping tree,cn=config
changetype: modify
add: winSyncSubtreePair
winSyncSubtreePair: ou=A,dc=anytreeX:
EOF
Check an error message in the error log:
create_subtree_pairs: Ignoring invalid subtree pairs "ou=A,dc=anytreeX:".

Comment 5 Viktor Ashirov 2015-07-15 11:34:46 UTC
Build tested: 389-ds-base-1.3.4.0-6.el7.x86_64

Server is running after deleting winSyncSubtreePair from winsync agreement. 

If I set its value to an invalid one, it complains in the errors log:
[15/Jul/2015:13:32:45 +0200] - create_subtree_pairs: Ignoring invalid subtree pairs "ou=A,dc=anytreeX".
[15/Jul/2015:13:32:45 +0200] - windows_private_set_windows_treetop: winSyncSubtreePair contains inconsistent Windows subtrees.
[15/Jul/2015:13:32:45 +0200] - windows_private_set_directory_treetop: winSyncSubtreePair contains inconsistent Windows subtrees.

Marking as VERIFIED.

Comment 6 errata-xmlrpc 2015-11-19 11:43:00 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.

https://rhn.redhat.com/errata/RHBA-2015-2351.html