#47560 fixup memberof task does not work: task entry not added
Closed: wontfix Opened by tbordaz.

memberof plugins supports fixup tasks. A task can be created with the perl script /usr/lib64/dirsrv/slapd-/fixup-memberof.pl. It calls /usr/sbin/fixup-memberof.pl to open a connection with the DS instances, bind and create a task entry.

The ldap task entry is not created because '$entry' is not initialized (1.3.1 and after)


A possible fix is:

git diff ldap/admin/src/scripts/fixup-memberof.pl.in
diff --git a/ldap/admin/src/scripts/fixup-memberof.pl.in b/ldap/admin/src/scripts/fixup-memberof.pl.in
index c7038f6..2355455 100644
--- a/ldap/admin/src/scripts/fixup-memberof.pl.in
+++ b/ldap/admin/src/scripts/fixup-memberof.pl.in
@@ -135,6 +135,7 @@ if ( $filter_arg ne "" )
$filter = "filter: $filter_arg\n";
}

+$entry = "${dn}${misc}${cn}${basedn}${filter}";
$rc = DSUtil::ldapmod($entry, %info);

$dn =~ s/^dn: //;

Ticket has been cloned to Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1018914

Your fix looks good to me.

This commit accidentally removed the line?
commit d2e68d7b002a6d57343829c9c1e7f681b3f28b84

Steps to reproduce: Rapid

create instance - stop instance - enable mbo - start instance
/usr/lib64/dirsrv/slapd-/fixup-memberof.pl -D "cn=directory manager" -w xxx -P LDAP -b "dc=com"

With the fix (check access log to see the ADD):
[15/Oct/2013:10:58:20 +0200] conn=4 fd=65 slot=65 connection from 192.168.1.2 to 192.168.1.2
[15/Oct/2013:10:58:20 +0200] conn=4 op=0 BIND dn="cn=directory manager" method=128 version=3
[15/Oct/2013:10:58:20 +0200] conn=4 op=0 RESULT err=0 tag=97 nentries=0 etime=0 dn="cn=directory manager"
[15/Oct/2013:10:58:20 +0200] conn=4 op=1 ADD dn="cn=memberOf_fixup_2013_10_15_10_58_20,cn=memberOf task,cn=tasks,cn=config"
[15/Oct/2013:10:58:20 +0200] conn=4 op=1 RESULT err=0 tag=105 nentries=0 etime=0
[15/Oct/2013:10:58:20 +0200] conn=4 op=2 UNBIND
[15/Oct/2013:10:58:20 +0200] conn=4 op=2 fd=65 closed - U1

Without the fix:
[15/Oct/2013:10:59:03 +0200] conn=5 fd=65 slot=65 connection from 192.168.1.2 to 192.168.1.2
[15/Oct/2013:10:59:03 +0200] conn=5 op=0 BIND dn="cn=directory manager" method=128 version=3
[15/Oct/2013:10:59:03 +0200] conn=5 op=0 RESULT err=0 tag=97 nentries=0 etime=0 dn="cn=directory manager"
[15/Oct/2013:10:59:03 +0200] conn=5 op=1 UNBIND
[15/Oct/2013:10:59:03 +0200] conn=5 op=1 fd=65 closed - U1

Others steps to reproduce:
create instance
add the following entries:

{{{
dn: uid=x4,dc=com
uid: x4
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetorgperson
objectClass: inetuser
sn: x4
cn: x4

dn: cn=RedHat,dc=com
objectClass: top
objectClass: groupOfNames
objectClass: inetuser
cn: RedHat
}}}

Make x4 memberof group 'redhat'

{{{
ldapmodify -h localhost -p xxx -D "cn=directory manager" -w Secret123
dn: uid=x4,dc=com
changetype: modify
add: memberof
memberof: cn=RedHat,dc=com
}}}

stop instance - enable mbo - start instance

without the fix:

{{{
/usr/lib64/dirsrv/slapd-/fixup-memberof.pl -D "cn=directory manager" -w xxx -P LDAP -b "dc=com"

ldapsearch -LLL -h localhost -p 47398 -D "cn=directory manager" -w xxx -b "dc=com" "cn=redhat*"
dn: cn=RedHat,dc=com
objectClass: top
objectClass: groupOfNames
objectClass: inetuser
cn: RedHat

ldapsearch -LLL -h localhost -p 47398 -D "cn=directory manager" -w xxx -b "dc=com" "uid=x4"
dn: uid=x4,dc=com
uid: x4
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetorgperson
objectClass: inetuser
sn: x4
cn: x4
memberOf: cn=RedHat,dc=com
}}}

With the fix (entry x4 has no longer the memberof value):
{{{
/usr/lib64/dirsrv/slapd-/fixup-memberof.pl -D "cn=directory manager" -w xxx -P LDAP -b "dc=com"

ldapsearch -LLL -h localhost -p 47398 -D "cn=directory manager" -w xxx -b "dc=com" "cn=redhat*"
dn: cn=RedHat,dc=com
objectClass: top
objectClass: groupOfNames
objectClass: inetuser
cn: RedHat

ldapsearch -LLL -h localhost -p 47398 -D "cn=directory manager" -w xxx -b "dc=com" "uid=x4"
dn: uid=x4,dc=com
uid: x4
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetorgperson
objectClass: inetuser
sn: x4
cn: x4
}}}

Push in master

git merge ticket47560
Updating da3e4aa..3902f69
Fast-forward
ldap/admin/src/scripts/fixup-memberof.pl.in | 1 +
1 file changed, 1 insertion(+)

git push origin master
Counting objects: 13, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (7/7), 840 bytes, done.
Total 7 (delta 5), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
da3e4aa..3902f69 master -> master

commit 3902f691d88823a9f2f8b839120e9365f6643f2d
Author: Thierry bordaz (tbordaz) tbordaz@redhat.com
Date: Mon Oct 21 16:55:11 2013 +0200

Push in 1.3.1

git cherry-pick 3902f691d88823a9f2f8b839120e9365f6643f2d
[389-ds-base-1.3.1 05950d0] Ticket 47560: fixup memberof task does not work: task entry not added
1 file changed, 1 insertion(+)

git push origin 389-ds-base-1.3.1
Counting objects: 13, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (7/7), 845 bytes, done.
Total 7 (delta 5), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
8a7ee90..05950d0 389-ds-base-1.3.1 -> 389-ds-base-1.3.1

commit 05950d062b866fb7f590b19734b2eedccd1a2a2a
Author: Thierry bordaz (tbordaz) tbordaz@redhat.com
Date: Mon Oct 21 16:55:11 2013 +0200

Push in 1.3.2

git cherry-pick 3902f691d88823a9f2f8b839120e9365f6643f2d
[389-ds-base-1.3.2 9b0e6a3] Ticket 47560: fixup memberof task does not work: task entry not added
1 file changed, 1 insertion(+)

git push origin 389-ds-base-1.3.2
Counting objects: 13, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (7/7), 845 bytes, done.
Total 7 (delta 5), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
7b3b2fe..9b0e6a3 389-ds-base-1.3.2 -> 389-ds-base-1.3.2

commit 9b0e6a3c3add3a4e8f4493f9317d52fa84374c91
Author: Thierry bordaz (tbordaz) tbordaz@redhat.com
Date: Mon Oct 21 16:55:11 2013 +0200

Metadata Update from @tbordaz:
- Issue set to the milestone: 1.3.1.13

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 issue has been cloned to Github and is available here:
- https://github.com/389ds/389-ds-base/issues/897

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Metadata Update from @spichugi:
- Issue close_status updated to: wontfix (was: Fixed)

Metadata