Nostradamus
Technical User
I'm trying to do the following.
Connect to an ldap server and modify an object (objectclass=groupofuniquenames).
The object has an attribute called uniquemember and it's value (multivalued attribute) are several distinguished names (DN).
I want to update these uniquemembers with a list of dn's that I have in an external file.
I'm no programmer and after this day, I'm sure I'll never will be.
I manage to connect without any problem. I can also do ldap-modify to delete and add values of my attribute.
BUT, only if I specify them manually. I can't manage to change my values automatically from the input file.
This is my code.
It prints my entries beautifully but I can't get is
What I want to do is run ldap->modify on the admingroup and add uniquemember from the input-file called dn.
I know I'm close and that this is easily fixed. However I've spent the whole day trying to find a sollution to this. I've searched the internet and changed the code way to many times.
Any help on this would be very grateful.
/Sören
Connect to an ldap server and modify an object (objectclass=groupofuniquenames).
The object has an attribute called uniquemember and it's value (multivalued attribute) are several distinguished names (DN).
I want to update these uniquemembers with a list of dn's that I have in an external file.
I'm no programmer and after this day, I'm sure I'll never will be.
I manage to connect without any problem. I can also do ldap-modify to delete and add values of my attribute.
BUT, only if I specify them manually. I can't manage to change my values automatically from the input file.
This is my code.
Code:
my $DISTNAME = 'cn=admin,ou=unit,o=organisation,l=locality,c=country';
open (FILE, "dn");
while (<FILE>) {
my $diffdn = "$_";
print $diffdn;
$ldap->modify( $DISTNAME, add => {uniqueMember => '$diffdn'} );
}
close FILE;
What I want to do is run ldap->modify on the admingroup and add uniquemember from the input-file called dn.
I know I'm close and that this is easily fixed. However I've spent the whole day trying to find a sollution to this. I've searched the internet and changed the code way to many times.
Any help on this would be very grateful.
/Sören