Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Net::LDAP::Entry, modify multiple attributes within one DN

by noname (Sexton)
on Oct 09, 2017 at 14:42 UTC ( #1201004=perlquestion: print w/replies, xml ) Need Help??
noname has asked for the wisdom of the Perl Monks concerning the following question:

I use Net::Ldap::Entry for generating ldif's which I later feed to the ldap server with ldapadd ( well not the most elegant solution, but I like to check the ldif before executing it on the server)

So for example the code like that works just fine:
sub mkgrp{ my $ldapgrp = Net::LDAP::Entry->new; my $group_dn = 'cn='.$group.',ou=group,'.$topdn; my $description = $descr || $group; $ldapgrp->dn($group_dn); $ldapgrp->add( objectClass => [ qw(sambaGroupMapping posixGroup )], displayName => $group, sambaGroupType => '2', sambaSID => 'S--blablabla-'.${groupSID}, description => $description, gidNumber => $gid, cn => $group, memberUID => [ @memberUID ], ); return $ldapgrp; } my $ldif = Net::LDAP::LDIF->new( "$ldifpath", "w+", onerror => 'warn' + ); $ldifpath = "/tmp/${group}.ldif"; $ldif->write_entry($ldapgrp);

What I can not achieve with this module is to create an ldif with multiple changes to the same DN

For example I see no way to generate such ldif:

print $fh <<"END"; dn: $dn changetype: modify add: mail mail: $maillist - add: mailAlternateAddress mailAlternateAddress: - add: mailMessageStore mailMessageStore: - replace: objectClass objectClass: posixGroup objectClass: qmailGroup objectClass: sambaGroupMapping END
Is there a way to do that with Net::LDAP::Entry or any other module or shell I just give up?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1201004]
Approved by haukex
Front-paged by Corion
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2017-12-14 15:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (396 votes). Check out past polls.

    Notices?