[Kolab-devel] server/utilities send_aliasadd.pl,NONE,1.1 send_aliasmodify.pl,NONE,1.1 send_aliasremove.pl,NONE,1.1 update_directory.pl,NONE,1.1 by stephan at doto.intevation.de

root at intevation.de root at intevation.de
Thu Jul 31 22:48:13 CEST 2003


Update of /kolabrepository/server/utilities
In directory doto:/tmp/cvs-serv14314

Added Files:
	send_aliasadd.pl send_aliasmodify.pl send_aliasremove.pl 
	update_directory.pl 
Log Message:
Add directory replication utilities


--- NEW FILE: send_aliasadd.pl ---
#!/kolab/bin/perl -w 
use strict;
#use Kolab::Admin;
use Getopt::Long;
use URI;
use Net::LDAP;
use Net::LDAP::LDIF;
use Net::LDAP::Entry;
use Kolab::Config qw(%kolab_config);
use Kolab::DirServ;

my $name;
GetOptions("name=s" => \$name); 

my $ldapuri = URI->new($kolab_config{'ldap_uri'}) || die "error: could not parse given uri";
my $ldap = Net::LDAP->new($ldapuri->host, port=> $ldapuri->port) || die "could not connect ldap server";
$ldap->bind($kolab_config{'bind_dn'}, password=> $kolab_config{'bind_pw'}) || die "could not bind to ldap";

my $mesg = $ldap->search(base=> $kolab_config{'base_dn'}, scope=> 'one', filter=> "(&(cn=$name)(mail=*))");
$mesg->code && die $mesg->error;
  
my $max = $mesg->count;
$max || die "Nothing to do!";

for(my $i = 0 ; $i < $max ; $i++) {
	my $entry = $mesg->entry($i);
	print "sending alias notifications\n";
	notify_new_alias($entry);
		    
}


--- NEW FILE: send_aliasmodify.pl ---
#!/kolab/bin/perl -w 
use strict;
#use Kolab::Admin;
use Getopt::Long;
use URI;
use Net::LDAP;
use Net::LDAP::LDIF;
use Net::LDAP::Entry;
use Kolab::Config qw(%kolab_config);
use Kolab::DirServ;

my $name;
GetOptions("name=s" => \$name); 

my $ldapuri = URI->new($kolab_config{'ldap_uri'}) || die "error: could not parse given uri";
my $ldap = Net::LDAP->new($ldapuri->host, port=> $ldapuri->port) || die "could not connect ldap server";
$ldap->bind($kolab_config{'bind_dn'}, password=> $kolab_config{'bind_pw'}) || die "could not bind to ldap";

my $mesg = $ldap->search(base=> $kolab_config{'base_dn'}, scope=> 'one', filter=> "(&(cn=$name)(mail=*))");
$mesg->code && die $mesg->error;
  
my $max = $mesg->count;
$max || die "Nothing to do!";

for(my $i = 0 ; $i < $max ; $i++) {
	my $entry = $mesg->entry($i);
	print "sending alias notifications\n";
	notify_modify_alias($entry);
		    
}


--- NEW FILE: send_aliasremove.pl ---
#!/kolab/bin/perl -w 
use strict;
#use Kolab::Admin;
use Getopt::Long;
use URI;
use Net::LDAP;
use Net::LDAP::LDIF;
use Net::LDAP::Entry;
use Kolab::Config qw(%kolab_config);
use Kolab::DirServ;

my $name;
GetOptions("name=s" => \$name); 

my $ldapuri = URI->new($kolab_config{'ldap_uri'}) || die "error: could not parse given uri";
my $ldap = Net::LDAP->new($ldapuri->host, port=> $ldapuri->port) || die "could not connect ldap server";
$ldap->bind($kolab_config{'bind_dn'}, password=> $kolab_config{'bind_pw'}) || die "could not bind to ldap";

my $mesg = $ldap->search(base=> $kolab_config{'base_dn'}, scope=> 'one', filter=> "(&(cn=$name)(mail=*))");
$mesg->code && die $mesg->error;
  
my $max = $mesg->count;
$max || die "Nothing to do!";

for(my $i = 0 ; $i < $max ; $i++) {
	my $entry = $mesg->entry($i);
	print "sending alias notifications\n";
	notify_remove_alias($entry);
		    
}


--- NEW FILE: update_directory.pl ---
#!/kolab/bin/perl -w 
use strict;

use Getopt::Long;
use Kolab::DirServ;
use Kolab::Config qw(%kolab_config);
use Kolab::Util;

my ($server, $user, $password);

GetOptions("server=s" => \$server, 
	   "user=s" => \$user,
	   "password=s" => \$password);

#easy default values for development
$server = $server || "127.0.0.1";
$user = $user || "kolab\@kolabtest.co.za";
$password=$password || "kolab";

handle_notifications($server,$user,$password); 





More information about the devel mailing list