I am trying to move a password file into an LDAP tree (to use with ispman) but the insert hangs when I try to update the ldap server. No activity appears to be happening - the script simply stops running. Ctrl-C stops the script, but there is no sign of error messages. Does anyone see something wrong here?

I included the code that populates a large HoH, which appears to be sane when I look at it from Data::Dumper. I can successfully add smaller records with Net:LDAP, so I know my ldap server works, and I know the module is installed right.

open P, "/mnt/p/etc/passwd"; while (<P>) { chop; my ($username,$x,$uid,$gid,$name,$home,$shell) = split ":"; next if exists ($admaccounts{$username}); $petra{$username} = [ userPassword => undef, uidNumber => $uidcounter++, gidNumber => "501", cn => $name eq "" ? "Osprey User" : $name +, homeDirectory => "/ispman/domains/osprey. +net/users/${username}_osprey_net/", loginShell => "/bin/bash", objectClass => [qw(top inetOrgPerson person +posixAccount ispmanDomainUser PureFTPdUser)], ispmanStatus => "active", ispmanCreateTimestamp => "1", #fixme uid => "${username}_osprey_net", ispmanUserId => $username, givenName => $name eq "" ? "Osprey User" : $ +name, sn => $name eq "" ? "Osprey User" : $name, mailHost => "freedom", FTPStatus => "enabled", FTPQuotaMBytes => "10", mailLocalAddress => "${username}\@osprey.net +", mailQuota => "10000", mailRoutingAddress => "${username}_osprey_ne +t\@osprey.net", ]; } close P; open P, "/mnt/p/etc/shadow"; while (<P>) { chop; my ($username, $pass, @rest) = split ':'; next if exists ($admaccounts{$username}); $petra{$username}[1] = "{crypt}$pass"; if ($pass eq "*") { $petra{$username}[15] = "inactive"; } } close P; use Net::LDAP; use Net::LDAP::Entry; my $ldap = Net::LDAP->new('localhost'); $ldap->bind ( # bind to a directory with dn and password dn => 'cn=Manager, dc=domain,dc=com', password => 'secret' ); my $entry=Net::LDAP::Entry->new(); $entry->changetype("add"); my $dn = "uid=user_domain_com, ou=users, ispmanDomain=domain.com, dc=d +omain,dc=com"; $entry->dn($dn); $entry->add( @{$petra{user}} ); my $result = $entry->update($ldap); $result->code && warn "$dn" ."failed to add entry: ", $result->error ;
When I try to debug it, everything works fine until the $entry->update() call. I haven't been able to step into the update call yet, though it seems that might provide some more information. In the meantime, does anyone see any problems?

In reply to perl-LDAP process hangs by Notromda

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.