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 1183820

Summary: Windows Sync accidentally cleared raw_entry
Product: Red Hat Enterprise Linux 6 Reporter: Noriko Hosoi <nhosoi>
Component: 389-ds-baseAssignee: Noriko Hosoi <nhosoi>
Status: CLOSED ERRATA QA Contact: Viktor Ashirov <vashirov>
Severity: medium Docs Contact:
Priority: high    
Version: 6.0CC: jgalipea, nhosoi, nkinder, rmeggins, vashirov
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 389-ds-base-1.2.11.15-51.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-22 06:36:51 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Noriko Hosoi 2015-01-19 22:20:08 UTC
This bug is created as a clone of upstream ticket:
https://fedorahosted.org/389/ticket/47989

commit f6397113666f06848412bb12f754f04258cfa5fa added the following clean up call to windows_search_entry_ext, which set NULL before the stashed raw_entry is refered in the winsync callbacks.
+               /* clear it here in case the search fails and
+                  we are left with a bogus old entry */
+               windows_private_set_raw_entry(conn->agmt, NULL);

Comment 1 Sankar Ramalingam 2015-01-20 09:34:50 UTC
Please add verification steps.

Comment 2 Noriko Hosoi 2015-01-20 18:39:41 UTC
(In reply to Sankar Ramalingam from comment #1)
> Please add verification steps.

Test cases run by Viktor:
https://bugzilla.redhat.com/show_bug.cgi?id=1118060#c5

[2.1] Disable account on DS: 
$ sudo ns-inactivate.pl -Z M1  -D "cn=Directory Manager" -w Secret123 -I uid=posixusr0,ou=dswinsync,dc=example,dc=com
ldap_add: Already exists (68)
ldap_add: Already exists (68)
ldap_add: Already exists (68)
ldap_add: Already exists (68)
ldap_add: Already exists (68)
uid=posixusr0,ou=dswinsync,dc=example,dc=com inactivated.

On AD it becomes disabled:
$ ldapsearch -o ldif-wrap=no -LLL -D "cn=Administrator,cn=users,dc=adrelm,dc=com" -w Secret123  -H ldap://win2k8.adrelm.com -b dc=adrelm,dc=com cn=posixusr0 userAccountControl
dn: CN=posixusr0,OU=adsync,DC=adrelm,DC=com
userAccountControl: 514

Enable account on DS: 
$ sudo ns-activate.pl -Z M1  -D "cn=Directory Manager" -w Secret123 -I uid=posixusr0,ou=dswinsync,dc=example,dc=com
uid=posixusr0,ou=dswinsync,dc=example,dc=com activated.

On AD it's still disabled:
$ ldapsearch -o ldif-wrap=no -LLL -D "cn=Administrator,cn=users,dc=adrelm,dc=com" -w Secret123  -H ldap://win2k8.adrelm.com -b dc=adrelm,dc=com cn=posixusr0 userAccountControl
dn: CN=posixusr0,OU=adsync,DC=adrelm,DC=com
userAccountControl: 514

And after sync, on DS:
$ sudo ns-accountstatus.pl -Z M1  -D "cn=Directory Manager" -w Secret123 -I uid=posixusr1,ou=dswinsync,dc=example,dc=com
uid=posixusr1,ou=dswinsync,dc=example,dc=com inactivated (probably directly).

In other words, if account was inactivated on DS, it cannot be reactivated again from DS.
<== this issue should have been fixed.

[2.2] Disable account on AD: 
Before change:
$ sudo ns-accountstatus.pl -Z M1  -D "cn=Directory Manager" -w Secret123 -I uid=posixusr0,ou=dswinsync,dc=example,dc=com
uid=posixusr0,ou=dswinsync,dc=example,dc=com  activated.

Disable account on AD: 
$ ldapmodify -D "cn=Administrator,cn=users,dc=adrelm,dc=com" -w Secret123  -H ldap://win2k8.adrelm.com << EOF
dn: CN=posixusr0,OU=adsync,DC=adrelm,DC=com
changetype: modify
replace: userAccountControl
userAccountControl: 514
EOF
modifying entry "CN=posixusr0,OU=adsync,DC=adrelm,DC=com"

After sync, on DS:
$ sudo ns-accountstatus.pl -Z M1  -D "cn=Directory Manager" -w Secret123 -I uid=posixusr0,ou=dswinsync,dc=example,dc=com
uid=posixusr0,ou=dswinsync,dc=example,dc=com inactivated (probably directly).

Enable account on AD:
$ ldapmodify -D "cn=Administrator,cn=users,dc=adrelm,dc=com" -w Secret123  -H ldap://win2k8.adrelm.com << EOF
dn: CN=posixusr0,OU=adsync,DC=adrelm,DC=com
changetype: modify
replace: userAccountControl
userAccountControl: 512 
EOF

After sync, on DS:
$ sudo ns-accountstatus.pl -Z M1  -D "cn=Directory Manager" -w Secret123 -I uid=posixusr0,ou=dswinsync,dc=example,dc=com
uid=posixusr0,ou=dswinsync,dc=example,dc=com  activated.

Comment 4 Viktor Ashirov 2015-04-12 15:28:44 UTC
Build tested:                                                                                                                                                                                                                                                                     
389-ds-base-1.2.11.15-53.el6.x86_64                                                                                                                                                                                                                                               
                                                                                                                                                                                                                                                                                  
[2.1] Disable account on DS:                                                                                                                                                                                                                                                      
# ./ns-inactivate.pl -D "cn=Directory Manager" -w Secret123 -I uid=posixusr0,ou=dswinsync,dc=example,dc=com                                                                                                                                                                       
uid=posixusr0,ou=dswinsync,dc=example,dc=com inactivated.                                                                                                                                                                                                                         
                                                                                                                                                                                                                                                                                  
On AD it becomes disabled:                                                                                                                                                                                                                                                        
# ldapsearch -o ldif-wrap=no -LLL -D "cn=Administrator,cn=users,dc=adrelm,dc=com" -w Secret123  -H ldap://win2k8.adrelm.com -b dc=adrelm,dc=com cn=posixusr0 userAccountControl                                                                                                   
dn: CN=posixusr0,CN=Users,DC=adrelm,DC=com                                                                                                                                                                                                                                        
userAccountControl: 546                                                                                                                                                                                                                                                           
                                                                                                                                                                                                                                                                                  
Enable account on DS:                                                                                                                                                                                                                                                             
# ./ns-activate.pl -D "cn=Directory Manager" -w Secret123 -I uid=posixusr0,ou=dswinsync,dc=example,dc=com                                                                                                                                                                         
uid=posixusr0,ou=dswinsync,dc=example,dc=com activated.                                                                                                                                                                                                                           
                                                                                                                                                                                                                                                                                  
On AD it's also enabled:                                                                                                                                                                                                                                                          
# ldapsearch -o ldif-wrap=no -LLL -D "cn=Administrator,cn=users,dc=adrelm,dc=com" -w Secret123  -H ldap://win2k8.adrelm.com -b dc=adrelm,dc=com cn=posixusr0 userAccountControl                                                                                                   
dn: CN=posixusr0,CN=Users,DC=adrelm,DC=com                                                                                                                                                                                                                                        
userAccountControl: 544                                                                                                                                                                                                                                                           
                                                                                                                                                                                                                                                                                  
And after sync, on DS:                                                                                                                                                                                                                                                            
# ./ns-accountstatus.pl -D "cn=Directory Manager" -w Secret123 -I uid=posixusr0,ou=dswinsync,dc=example,dc=com                                                                                                                                                                    
uid=posixusr0,ou=dswinsync,dc=example,dc=com  activated.                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                  
Issue has been fixed.                                                                                                                                                                                                                                                             
                                                                                                                                                                                                                                                                                  
[2.2] Disable account on AD:                                                                                                                                                                                                                                                      
Before change:                                                                                                                                                                                                                                                                    
# ./ns-accountstatus.pl -D "cn=Directory Manager" -w Secret123 -I uid=posixusr0,ou=dswinsync,dc=example,dc=com                                                                                                                                                                    
uid=posixusr0,ou=dswinsync,dc=example,dc=com  activated.                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                  
Disable account on AD:                                                                                                                                                                                                                                                            
# ldapmodify -D "cn=Administrator,cn=users,dc=adrelm,dc=com" -w Secret123  -H ldap://win2k8.adrelm.com << EOF                                                                                                                                                                     
dn: CN=posixusr0,CN=Users,DC=adrelm,DC=com                                                                                                                                                                                                                                        
changetype: modify                                                                                                                                                                                                                                                                
replace: userAccountControl                                                                                                                                                                                                                                                       
userAccountControl: 514                                                                                                                                                                                                                                                           
EOF                                                                                                                                                                                                                                                                               
modifying entry "CN=posixusr0,CN=Users,DC=adrelm,DC=com"                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                  
After sync, on DS:                                                                                                                                                                                                                                                                
# ./ns-accountstatus.pl  -D "cn=Directory Manager" -w Secret123 -I uid=posixusr0,ou=dswinsync,dc=example,dc=com                                                                                                                                                                   
uid=posixusr0,ou=dswinsync,dc=example,dc=com inactivated (probably directly).                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                  
Enable account on AD:                                                                                                                                                                                                                                                             
# ldapmodify -D "cn=Administrator,cn=users,dc=adrelm,dc=com" -w Secret123  -H ldap://win2k8.adrelm.com << EOF                                                                                                                                                                     
dn: CN=posixusr0,CN=Users,DC=adrelm,DC=com                                                                                                                                                                                                                                        
changetype: modify                                                                                                                                                                                                                                                                
replace: userAccountControl                                                                                                                                                                                                                                                       
userAccountControl: 512                                                                                                                                                                                                                                                           
EOF                                                                                                                                                                                                                                                                               
modifying entry "CN=posixusr0,CN=Users,DC=adrelm,DC=com"                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                  
After sync, on DS:                                                                                                                                                                                                                                                                
# ./ns-accountstatus.pl  -D "cn=Directory Manager" -w Secret123 -I uid=posixusr0,ou=dswinsync,dc=example,dc=com                                                                                                                                                                   
uid=posixusr0,ou=dswinsync,dc=example,dc=com  activated.                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                  
Issue in [2.1] has been fixed, marking as VERIFIED.

Comment 5 errata-xmlrpc 2015-07-22 06:36:51 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-1326.html