Permalink
Browse files

use current methods and parameters, add binmode where necessary

  • Loading branch information...
1 parent 5e6eda1 commit 0188e7127c931c5534568584bf8e0917fe7d5811 @marschap marschap committed Apr 1, 2004
Showing with 10 additions and 8 deletions.
  1. +3 −2 contrib/jpegDisplay.pl
  2. +3 −2 contrib/jpegLoad.pl
  3. +4 −4 contrib/ldapmodify.pl
View
@@ -87,7 +87,7 @@
#
# Bind to directory.
#
-$ldap->ldapbind(password => "$opt{'w'}", dn => "$opt{'D'}", version => $opt{'V'}) or die $@;
+$ldap->bind($opt{'D'}, password => "$opt{'w'}", version => $opt{'V'}) or die $@;
#
# Search directory for record that matches filter
@@ -119,7 +119,7 @@
$dn = $entry->dn();
- my $attr = $entry->get_attribute("jpegPhoto");
+ my $attr = $entry->get_value("jpegPhoto");
if(ref($attr))
{
$picture = @$attr[0];
@@ -139,6 +139,7 @@
# Store the jpeg data to a temp file.
#
open(TMP, "+>$jpegFile");
+binmode(TMP);
$| = 1;
print TMP $picture;
View
@@ -88,6 +88,7 @@
# Slurp all of the jpeg file in at once.
#
open(IN, "<$opt{'f'}");
+binmode(IN);
$_ = <IN>;
close(IN);
@@ -112,7 +113,7 @@
#
# Bind to directory.
#
-$ldap->ldapbind(password => "$opt{'w'}", dn => "$opt{'D'}", version => $opt{'V'}) or die $@;
+$ldap->bind($opt{'D'}, password => "$opt{'w'}", version => $opt{'V'}) or die $@;
#
# Search directory for record that matches filter
@@ -156,7 +157,7 @@
push( @addMember, "jpegphoto" ); # attribute name
push( @addMember, $_ ); # attribute value
-my $attr = $entry->get_attribute("jpegPhoto");
+my $attr = $entry->get_value("jpegPhoto");
if(ref($attr))
{
#
View
@@ -31,24 +31,24 @@ =head1 SYNOPSIS
getopts('acD:e:f:h:p:P:w:', \%opt);
$opt{h} ||= 'localhost';
my $conn = Net::LDAP->new($opt{h}) or die "$opt{h}: $!\n";
-my $result = $conn->bind(dn => $opt{D}, password => $opt{w});
+my $result = $conn->bind($opt{D}, password => $opt{w});
$result->code && die("$opt{h}: bind: ", $result->error, "\n");
my $ldif = Net::LDAP::LDIF->new($opt{f}, "r");
$ldif->{changetype} = 'add' if $opt{a};
my $ldiferr;
-while (my $change = $ldif->read_cmd()) {
+while (my $change = $ldif->read_entry()) {
print "dn: ", $change->dn, "\n";
my $result = $change->update($conn);
if ($result->code) {
print STDERR "ldapmodify: ", $result->error, "\n";
if ($opt{e}) {
if (!$ldiferr) {
- $ldiferr = Net::LDAP::LDIF->new($opt{e}, 'a')
+ $ldiferr = Net::LDAP::LDIF->new($opt{e}, 'a', change => 1)
or die "$opt{e}: $!\n";
}
print { $ldiferr->{fh} } "# Error: ", $result->error;
- $ldiferr->write_cmd($change);
+ $ldiferr->write_entry($change);
print { $ldiferr->{fh} } "\n";
}
last unless $opt{c};

0 comments on commit 0188e71

Please sign in to comment.