#############################################################
## This sub will pass in an entry to be adjusted and a value
## to adjust with. It will only work on a single directory
## and a single task.
#############################################################
sub add_dir_one{
my ($dn, $entry_to_modify) = @_;
my $ldap = Net::LDAP->new($directory)
or die "Couldn't connect: $@\n";
my $mesg = $ldap->bind("cn=directory manager, ou=a really long dn", password => "password" )
or die "Could not bind $@\n";;
$ldap -> modify ($dn, add => {attribute_to_be_adjusted => $entry_to_beadded})
or die "Ya screwed up again!";}
}
#############################################################
## This sub will pass in an entry to be adjusted and a value
## to adjust with. It will only work on a second directory
## and a single task.
#############################################################
sub add_dir_2{
my ($dn2, $entry_to_modify) = @_;
my $ldap = Net::LDAP->new($directory2)
or die "Couldn't connect: $@\n";
my $mesg = $ldap->bind("cn=directory manager2, ou=a really long dn", password => "password2" )
or die "Could not bind $@\n";;
$ldap -> modify ($dn2, add => {attribute_to_be_adjusted => $entry_to_beadded})
or die "Ya screwed up again!";}
}
####
#############################################################
## This sub will pass in an directory name, binding usre/password,
## action to be taken, entry to be adjusted and a value
## to adjust with. It will only work on a single directory
## and a single task.
#############################################################
sub modify_generic_directory{
my ($dir, $dir_manager, $pass, $action_to_be_taken, $entry_to_be_adjusted, $attribute_to_be_adjusted, $value_to_adjust_with) = @_;
my $ldap = Net::LDAP->new($dir)
or die "Couldn't connect: $@\n";
my $mesg = $ldap->bind($dir_manager, password => $pass)
or die "Could not bind $@\n";
$ldap -> modify ($entry_to_be_adjusted, $action_to_be_taken => {$attribute_to_be_adjusted => $entry_to_be_adjusted})
or die "Ya screwed up again!";}
}
##
##
&add_dir_one($entry_to_modify, $variable_that_is_adjusting);
&modify_dir_two($entry_to_modify, $variable_that_is_adjusting);
##
##
&modify_generic_directory($dir, $dir_manager, $pass, $action_to_be_taken, $entry_to_be_adjusted, $attribute_to_be_adjusted, $value_to_adjust_with);
&modify_generic_directory($dir2, $dir_manager2, $pass2, $action_to_be_taken2, $entry_to_be_adjusted, $attribute_to_be_adjusted, $value_to_adjust_with);