Fixed the 'use' line in the examples. Removed a few lines from api.pl

and added a configuration option to set the number of adds.
This commit is contained in:
clayton 1998-07-31 21:16:32 +00:00
Родитель 596999789b
Коммит 0f5af04003
3 изменённых файлов: 13 добавлений и 14 удалений

Просмотреть файл

@ -1,6 +1,6 @@
#!/usr/bin/perl -w #!/usr/bin/perl -w
############################################################################# #############################################################################
# $Id: api.pl,v 1.2 1998-07-24 19:01:49 clayton Exp $ # $Id: api.pl,v 1.3 1998-07-31 21:16:30 clayton Exp $
# #
# The contents of this file are subject to the Mozilla Public License # The contents of this file are subject to the Mozilla Public License
# Version 1.0 (the "License"); you may not use this file except in # Version 1.0 (the "License"); you may not use this file except in
@ -29,7 +29,7 @@
# #
############################################################################# #############################################################################
use Mozilla::LDAP::API (:api :constant); use Mozilla::LDAP::API qw(:api :constant);
use strict; use strict;
my $BASE = "ou=Test,o=Motorola,c=US"; my $BASE = "ou=Test,o=Motorola,c=US";
@ -38,7 +38,8 @@ my $PASS = "abcd1234";
my $HOST = "localhost"; my $HOST = "localhost";
my $PORT = 389; my $PORT = 389;
system("/usr/ucb/ps -auxw | grep $$ | grep -v grep"); $howmany = 50;
# Initialize the Connection # Initialize the Connection
{ {
my $ld = ldap_init($HOST,$PORT); my $ld = ldap_init($HOST,$PORT);
@ -109,7 +110,7 @@ if (ldap_add_s($ld,$BASE,$entry) != LDAP_SUCCESS)
# Add People # Add People
foreach my $number (1..50) foreach my $number (1..$howmany)
{ {
$entry = { $entry = {
"objectclass" => ["top","person"], "objectclass" => ["top","person"],
@ -126,7 +127,7 @@ foreach my $number (1..50)
} }
# Modify People # Modify People
foreach my $number (1..5) foreach my $number (1..$howmany)
{ {
$entry = { $entry = {
"sn" => {"a",["Test"]}, "sn" => {"a",["Test"]},
@ -155,7 +156,7 @@ if (ldap_search_s($ld,$BASE,LDAP_SCOPE_SUBTREE,$filter,$attrs,0,$res)
} }
# Count Results # Count Results
if (ldap_count_entries($ld,$res) != 5) if (ldap_count_entries($ld,$res) != $howmany)
{ {
print "count_res - Failed!\n"; print "count_res - Failed!\n";
} else { } else {
@ -238,7 +239,7 @@ ldap_ber_free($ber,0);
ldap_msgfree($res); ldap_msgfree($res);
# Compare Attribute Values # Compare Attribute Values
foreach my $number (1..10) foreach my $number (1..$howmany)
{ {
if(ldap_compare_s($ld,"cn=Mozilla $number,$BASE","sn",$number) if(ldap_compare_s($ld,"cn=Mozilla $number,$BASE","sn",$number)
!= LDAP_COMPARE_TRUE) != LDAP_COMPARE_TRUE)
@ -250,7 +251,7 @@ foreach my $number (1..10)
} }
# Delete Users # Delete Users
foreach my $number (1..50) foreach my $number (1..$howmany)
{ {
if (ldap_delete_s($ld,"cn=Mozilla $number,$BASE") != LDAP_SUCCESS) if (ldap_delete_s($ld,"cn=Mozilla $number,$BASE") != LDAP_SUCCESS)
{ {
@ -270,5 +271,3 @@ if (ldap_delete_s($ld,"$BASE") != LDAP_SUCCESS)
# Unbind # Unbind
ldap_unbind($ld); ldap_unbind($ld);
} }
system("/usr/ucb/ps -auxw | grep $$ | grep -v grep");

Просмотреть файл

@ -1,6 +1,6 @@
#!/usr/bin/perl #!/usr/bin/perl
############################################################################# #############################################################################
# $Id: search.pl,v 1.2 1998-07-24 19:01:50 clayton Exp $ # $Id: search.pl,v 1.3 1998-07-31 21:16:31 clayton Exp $
# #
# The contents of this file are subject to the Mozilla Public License # The contents of this file are subject to the Mozilla Public License
# Version 1.0 (the "License"); you may not use this file except in # Version 1.0 (the "License"); you may not use this file except in
@ -25,7 +25,7 @@
# #
############################################################################# #############################################################################
use Mozilla::LDAP::API (:api :constant); use Mozilla::LDAP::API qw(:api :constant);
use strict; use strict;

Просмотреть файл

@ -1,6 +1,6 @@
#!/usr/bin/perl -w #!/usr/bin/perl -w
############################################################################# #############################################################################
# $Id: write.pl,v 1.2 1998-07-24 19:01:51 clayton Exp $ # $Id: write.pl,v 1.3 1998-07-31 21:16:32 clayton Exp $
# #
# The contents of this file are subject to the Mozilla Public License # The contents of this file are subject to the Mozilla Public License
# Version 1.0 (the "License"); you may not use this file except in # Version 1.0 (the "License"); you may not use this file except in
@ -30,7 +30,7 @@
############################################################################# #############################################################################
use strict; use strict;
use Mozilla::LDAP::API (:constant :api); use Mozilla::LDAP::API qw(:constant :api);
# This is the entry we will be adding. Do not use a pre-existing entry. # This is the entry we will be adding. Do not use a pre-existing entry.