Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

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?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (15)
As of 2018-06-22 15:29 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (124 votes). Check out past polls.