ispman/bin ispman-agent,1.61,1.62 ispman.addAdmin,1.2,1.3 ispman.addClient,1.2,1.3 ispman.addDomain,1.7,1.8 ispman.addDomainService,1.3,1.4 ispman.addDomainService2Domain,1.2,1.3 ispman.addHost,1.4,1.5 ispman.addHost2HostGroup,1.2,1.3 ispman.addHostGroup,1.1,1.2 ispman.addMailAliasForUser,1.2,1.3 ispman.addMailForwardForUser,1.2,1.3 ispman.addMailGroup,1.4,1.5 ispman.addMailGroupAttributeValues,1.1,1.2 ispman.addReseller,1.2,1.3 ispman.addSlaveDomain,1.2,1.3 ispman.addUser,1.9,1.10 ispman.addUserAttributeValues,1.2,1.3 ispman.addvhost,1.12,1.13 ispman.alias.mailgroup,1.1,1.2 ispman.bumpMailboxQuota,1.3,1.4 ispman.commitSession,1.3,1.4 ispman.createMailbox,1.4,1.5 ispman.createSubMailbox,1.1,1.2 ispman.deleteAdmin,1.1,1.2 ispman.deleteClient,1.1,1.2 ispman.deleteDomain,1.3,1.4 ispman.deleteDomainService,1.2,1.3 ispman.deleteHost,1.3,1.4 ispman.deleteHostGroup,1.3,1.4 ispman.del
Joerg Delker <[email protected]>
| Newsgroups | gmane.comp.isp.ispman.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/ispman/ispman/bin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30799/bin
Modified Files:
ispman-agent ispman.addAdmin ispman.addClient ispman.addDomain
ispman.addDomainService ispman.addDomainService2Domain
ispman.addHost ispman.addHost2HostGroup ispman.addHostGroup
ispman.addMailAliasForUser ispman.addMailForwardForUser
ispman.addMailGroup ispman.addMailGroupAttributeValues
ispman.addReseller ispman.addSlaveDomain ispman.addUser
ispman.addUserAttributeValues ispman.addvhost
ispman.alias.mailgroup ispman.bumpMailboxQuota
ispman.commitSession ispman.createMailbox
ispman.createSubMailbox ispman.deleteAdmin ispman.deleteClient
ispman.deleteDomain ispman.deleteDomainService
ispman.deleteHost ispman.deleteHostGroup ispman.deleteMailbox
ispman.deleteProcess ispman.deleteSession ispman.deleteUser
ispman.deleteVhostAlias ispman.deletevhost ispman.deltree
ispman.denyFTP ispman.dnsdump ispman.dnsload ispman.dnsset
ispman.dnsshow ispman.dnsunset ispman.domainHasService
ispman.domainInfo ispman.domainmail ispman.dumpAllUsers
ispman.dumpConf ispman.fixUsers ispman.getClientsCount
ispman.getConf ispman.getDomainAttribute
ispman.getHostGroupFirstMember ispman.getMailAliasesForUser
ispman.getMailForwardsForUser
ispman.getMailGroupAttributeValues ispman.getMailboxQuota
ispman.getProcessInfo ispman.getTemplate
ispman.getUserAttributeValues ispman.getUserCount
ispman.getUsersCount ispman.getVhostAttribute
ispman.getWebUsers ispman.imapAuthTest ispman.l10n
ispman.ldap2apache ispman.ldap2named ispman.ldifdump
ispman.ldifload ispman.listAdmins ispman.listClients
ispman.listHostGroupMembers ispman.listHostGroups
ispman.listHosts ispman.listMailGroups ispman.listMailboxes
ispman.listModules ispman.listOverQuotaMailboxes
ispman.listRadiusProfiles ispman.listResellers
ispman.listSessionProcesses ispman.listSessions
ispman.listUserQuotas ispman.listUsers ispman.listVars
ispman.listVhostAliases ispman.listvhosts ispman.loganalyzer
ispman.makeDomainDirectories ispman.makeHash ispman.makelogs
ispman.passwd.client ispman.passwd.domain
ispman.passwd.reseller ispman.passwd.user ispman.passwd.vhost
ispman.postfix.makemaps ispman.prepareBranchForDN
ispman.processdump ispman.processes ispman.removeEmptySessions
ispman.replaceMailAliasForUser
ispman.replaceMailForwardForUser
ispman.replaceUserAttributeValues ispman.setDomainAttribute
ispman.setDomainClient ispman.setDomainReseller
ispman.setMailboxQuota ispman.setVar ispman.setVhostAlias
ispman.setVhostAttribute ispman.setmailtransport
ispman.showdomains ispman.showmailtransport
ispman.smtpAuthTest ispman.userInfo
ispman.warnNearQuotaMailboxes ispman.zoneparse ldifdiff
ldifgrep ldifsort
Log Message:
code reformatting by perltidy conforming perl style guide
Index: ispman.ldap2apache
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.ldap2apache,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- ispman.ldap2apache 18 Apr 2004 18:48:37 -0000 1.7
+++ ispman.ldap2apache 30 May 2004 23:35:32 -0000 1.8
@@ -1,19 +1,23 @@
#!/usr/bin/perl
package ISPMan;
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopts('had:', \%opts);
- unless ($opts{'d'}){
- $opts{'d'}=0;
- }
-
- if ($opts{'h'}) {
- print "$0 -d debugLevel[1|2|3] [-a]\n";
- print "\t-a\tMake vhosts.conf will all vhosts and not just the ones where webhost is this host\n";
- print "\n";
- exit;
- }
+
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopts( 'had:', \%opts );
+ unless ( $opts{'d'} ) {
+ $opts{'d'} = 0;
+ }
+
+ if ( $opts{'h'} ) {
+ print "$0 -d debugLevel[1|2|3] [-a]\n";
+ print
+"\t-a\tMake vhosts.conf will all vhosts and not just the ones where webhost is this host\n";
+ print "\n";
+ exit;
+ }
}
use Sys::Hostname;
@@ -21,60 +25,52 @@
use File::Path;
use Data::Dumper;
use Fcntl;
-use POSIX qw(tmpnam);
-
-# defind log_message.
+use POSIX qw(tmpnam);
+
+# defind log_message.
# This is defined in ispman-agent and we should redefine here
sub log_message {
- my $message = join ' ' , @_;
- chomp ($message);
+ my $message = join ' ', @_;
+ chomp($message);
print "$message\n";
}
+$ispman = ISPMan->new();
+$ispman->setConfig( 'debug', $opts{'d'} );
-$ispman=ISPMan->new();
-$ispman->setConfig('debug', $opts{'d'});
-
-$ldapBaseDN=$ispman->getConf('ldapBaseDN');
-$install_dir=$ispman->getConf("installDir");
+$ldapBaseDN = $ispman->getConf('ldapBaseDN');
+$install_dir = $ispman->getConf("installDir");
require "$install_dir/lib/http.lib";
-$template=$ispman->getTemplate("$install_dir/templates/vhosts.conf.template");
-
-
-
-
-
-
-
-
+$template = $ispman->getTemplate("$install_dir/templates/vhosts.conf.template");
-my $filter="objectclass=ispmanVirtualHost";
+my $filter = "objectclass=ispmanVirtualHost";
-unless ($opts{'a'}) {
- require Sys::Hostname;
- import Sys::Hostname;
- $filter= sprintf ("&(objectclass=ispmanVirtualHost)(webHost=%s)" , hostname());
+unless ( $opts{'a'} ) {
+ require Sys::Hostname;
+ import Sys::Hostname;
+ $filter =
+ sprintf( "&(objectclass=ispmanVirtualHost)(webHost=%s)", hostname() );
}
print "Using $filter\n" if $ispman->{'Config'}{'debug'};
-$vhosts=$ispman->getEntriesAsHashRef($ldapBaseDN, $filter);
+$vhosts = $ispman->getEntriesAsHashRef( $ldapBaseDN, $filter );
-for (keys %$vhosts) {
- add_vhost( $vhosts->{$_}{'ispmanVhostName'}, $vhosts->{$_}{'ispmanDomain'});
+for ( keys %$vhosts ) {
+ add_vhost( $vhosts->{$_}{'ispmanVhostName'},
+ $vhosts->{$_}{'ispmanDomain'} );
}
&make_vhosts_conf($template);
-if ($ispman->getConf("apacheVhostsStyle") =~ /dir/m) {
- for (keys %$vhosts){
- &make_vhosts_conf($template, $vhosts->{$_}{'ispmanDomain'});
- }
-} else {
- &make_vhosts_conf($template);
+if ( $ispman->getConf("apacheVhostsStyle") =~ /dir/m ) {
+ for ( keys %$vhosts ) {
+ &make_vhosts_conf( $template, $vhosts->{$_}{'ispmanDomain'} );
+ }
+}
+else {
+ &make_vhosts_conf($template);
}
-
-
__END__
Index: ispman.setDomainAttribute
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.setDomainAttribute,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ispman.setDomainAttribute 17 Aug 2003 20:38:13 -0000 1.3
+++ ispman.setDomainAttribute 30 May 2004 23:35:32 -0000 1.4
@@ -1,15 +1,16 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- unless ($ARGV[2]){
- print "$0 domain attributename value\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ unless ( $ARGV[2] ) {
+ print "$0 domain attributename value\n";
+ exit;
+ }
}
-
use ISPMan;
-my $ispman=ISPMan->new();
+my $ispman = ISPMan->new();
$ispman->setDomainAttribute(@ARGV);
Index: ispman.deleteVhostAlias
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.deleteVhostAlias,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ispman.deleteVhostAlias 4 Aug 2003 06:10:16 -0000 1.1
+++ ispman.deleteVhostAlias 30 May 2004 23:35:31 -0000 1.2
@@ -1,19 +1,22 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('dv', \%opts);
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'dv', \%opts );
- unless ($opts{'d'} && $opts{'v'} && $ARGV[0]) {
- print "$FindBin::Script -d domain -v vhost alias\n";
- print "\n";
- exit;
- }
+ unless ( $opts{'d'} && $opts{'v'} && $ARGV[0] ) {
+ print "$FindBin::Script -d domain -v vhost alias\n";
+ print "\n";
+ exit;
+ }
}
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
-my $r=$ispman->delete_alias($opts{'d'}, $opts{'v'}, $ARGV[0]);
+$ispman = ISPMan->new();
+my $r = $ispman->delete_alias( $opts{'d'}, $opts{'v'}, $ARGV[0] );
+
#domain, vhost
Index: ispman.replaceUserAttributeValues
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.replaceUserAttributeValues,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.replaceUserAttributeValues 24 Apr 2003 21:31:41 -0000 1.2
+++ ispman.replaceUserAttributeValues 30 May 2004 23:35:32 -0000 1.3
@@ -1,22 +1,26 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('dua', \%opts);
- unless ($opts{'d'} && $opts{'u'} && $opts{'a'} && $ARGV[0]){
- print "Usage: $FindBin::Script -d domain -u username -a attribute value [value value]forward_address [forward_address forward_address]\n";
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'dua', \%opts );
+ unless ( $opts{'d'} && $opts{'u'} && $opts{'a'} && $ARGV[0] ) {
+ print
+"Usage: $FindBin::Script -d domain -u username -a attribute value [value value]forward_address [forward_address forward_address]\n";
- print "Note: This command deletes all previously values of the attribute and adds the new ones\n";
- exit;
- }
+ print
+"Note: This command deletes all previously values of the attribute and adds the new ones\n";
+ exit;
+ }
}
use ISPMan;
-my $ispman=ISPMan->new();
-$ispman->replaceUserAttributeValues($opts{'u'}, $opts{'d'}, $opts{'a'}, \@ARGV);
+my $ispman = ISPMan->new();
+$ispman->replaceUserAttributeValues( $opts{'u'}, $opts{'d'}, $opts{'a'},
+ \@ARGV );
print "OK\n";
-
Index: ispman.listSessions
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.listSessions,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- ispman.listSessions 18 Aug 2003 01:27:42 -0000 1.4
+++ ispman.listSessions 30 May 2004 23:35:32 -0000 1.5
@@ -1,23 +1,36 @@
#!/usr/bin/perl
BEGIN {
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
use ISPMan;
-my $ispman=ISPMan->new();
+my $ispman = ISPMan->new();
my $h;
-if (@ARGV){
- $session=shift @ARGV;
- $h={"ispmanSession=$session, ou=processes, $ispman->{'Config'}{'ldapBaseDN'}" =>''};
-} else {
- $h=$ispman->getEntriesAsHashRef("ou=processes, @{[$ispman->getConf('ldapBaseDN')]}", "objectClass=*", ["objectclass"], 'one');
+if (@ARGV) {
+ $session = shift @ARGV;
+ $h =
+ { "ispmanSession=$session, ou=processes, $ispman->{'Config'}{'ldapBaseDN'}"
+ => '' };
+}
+else {
+ $h =
+ $ispman->getEntriesAsHashRef(
+ "ou=processes, @{[$ispman->getConf('ldapBaseDN')]}",
+ "objectClass=*", ["objectclass"], 'one' );
}
-for (keys %$h){
- my $dnParts=$ispman->explodeDN($_);
- my $insession=$ispman->getCount($_, '&(objectClass=ispmanProcesses)(ispmanStatus=insession)');
- my $new=$ispman->getCount($_, '&(objectClass=ispmanProcesses)(ispmanStatus=new)');
- my $c=$insession+$new;
- print "$dnParts->{'ispmanSession'}: $c processes ($new new, $insession in session)\n";
+for ( keys %$h ) {
+ my $dnParts = $ispman->explodeDN($_);
+ my $insession =
+ $ispman->getCount( $_,
+ '&(objectClass=ispmanProcesses)(ispmanStatus=insession)' );
+ my $new =
+ $ispman->getCount( $_,
+ '&(objectClass=ispmanProcesses)(ispmanStatus=new)' );
+ my $c = $insession + $new;
+ print
+"$dnParts->{'ispmanSession'}: $c processes ($new new, $insession in session)\n";
}
__END__
Index: ispman.addSlaveDomain
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.addSlaveDomain,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.addSlaveDomain 24 Apr 2003 21:31:37 -0000 1.2
+++ ispman.addSlaveDomain 30 May 2004 23:35:31 -0000 1.3
@@ -1,49 +1,46 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- unless ($ARGV[1]){
- print "$0 domain masters password\n";
- print "multiple masters can be separated with ,\n";
- print "\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ unless ( $ARGV[1] ) {
+ print "$0 domain masters password\n";
+ print "multiple masters can be separated with ,\n";
+ print "\n";
+ exit;
+ }
}
-
use vars qw($ispman $r $domain );
-($domain, $masters, $password) =@ARGV;
+( $domain, $masters, $password ) = @ARGV;
# change these to meet your site specifics
-$d={
- 'ispmanDomainType' => 'slave',
-
- 'ispmanDomainMailDeliveryMethod' => 'local',
- 'ispmanDomainServices' => '',
- 'FTPStatus' => 'disabled',
- 'userPassword' => $password,
- 'masters' => $masters,
- };
+$d = {
+ 'ispmanDomainType' => 'slave',
+ 'ispmanDomainMailDeliveryMethod' => 'local',
+ 'ispmanDomainServices' => '',
+ 'FTPStatus' => 'disabled',
+ 'userPassword' => $password,
+ 'masters' => $masters,
+};
use lib qw(%%installDir%%/lib);
use ISPMan;
use CGI;
-$ispman=ISPMan->new();
-$r=new CGI();
-$r->param("domain", $domain);
-$r->param("ispmanDomain", $domain);
-
-
-
-
-$d->{'homeDirectory'} = join ('/', $ispman->getConf("defaultHomeDirectoryPath") , $domain);
+$ispman = ISPMan->new();
+$r = new CGI();
+$r->param( "domain", $domain );
+$r->param( "ispmanDomain", $domain );
+$d->{'homeDirectory'} =
+ join( '/', $ispman->getConf("defaultHomeDirectoryPath"), $domain );
-for (keys %$d) {
- $r->param($_, $d->{$_});
+for ( keys %$d ) {
+ $r->param( $_, $d->{$_} );
}
$ispman->addNewDomain($r);
Index: ispman.imapAuthTest
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.imapAuthTest,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ispman.imapAuthTest 30 Jul 2003 23:27:47 -0000 1.1
+++ ispman.imapAuthTest 30 May 2004 23:35:32 -0000 1.2
@@ -1,18 +1,20 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- unless ($ARGV[2]){
- print "$0 hostname username password\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ unless ( $ARGV[2] ) {
+ print "$0 hostname username password\n";
+ exit;
+ }
}
use Net::IMAP::Simple;
$server = new Net::IMAP::Simple( $ARGV[0] );
-if ($server->login( $ARGV[1], $ARGV[2] ) ) {
- print "OK\n";
-} else {
- print "Not OK\n";
-};
-
+if ( $server->login( $ARGV[1], $ARGV[2] ) ) {
+ print "OK\n";
+}
+else {
+ print "Not OK\n";
+}
Index: ispman.listRadiusProfiles
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.listRadiusProfiles,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.listRadiusProfiles 4 Jan 2004 18:56:13 -0000 1.2
+++ ispman.listRadiusProfiles 30 May 2004 23:35:32 -0000 1.3
@@ -1,21 +1,21 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
-
use lib qw(%%installDir%%/lib);
use ISPMan;
-my $ispman=ISPMan->new();
-my $profiles=$ispman->getRadiusProfiles();
+my $ispman = ISPMan->new();
+my $profiles = $ispman->getRadiusProfiles();
-for (keys %$profiles){
- $profile=$profiles->{$_};
- write();
+for ( keys %$profiles ) {
+ $profile = $profiles->{$_};
+ write();
}
-
format STDOUT_TOP =
RadiusProfiles:
@@ -23,7 +23,6 @@
--------------------------------------------------------------------------
.
-
format STDOUT =
@<<<<<<<<<<<<<<<<<<<<<<
$profile->{'cn'}
Index: ispman.listClients
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.listClients,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.listClients 24 Apr 2003 21:31:40 -0000 1.2
+++ ispman.listClients 30 May 2004 23:35:32 -0000 1.3
@@ -1,28 +1,27 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
-
use lib qw(%%installDir%%/lib);
use ISPMan;
-my $ispman=ISPMan->new();
-my $clients=$ispman->getClients();
+my $ispman = ISPMan->new();
+my $clients = $ispman->getClients();
-for (keys %$clients){
- $client=$clients->{$_};
- write();
+for ( keys %$clients ) {
+ $client = $clients->{$_};
+ write();
}
-
format STDOUT_TOP =
ClientID ResellerID ClientName CN
--------------------------------------------------------------------------
.
-
format STDOUT =
@<<<<<<< @<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<
$client->{'ispmanClientId'}, $client->{'ispmanResellerId'}, $client->{'ispmanClientName'}, $client->{'cn'}
Index: ispman.warnNearQuotaMailboxes
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.warnNearQuotaMailboxes,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ispman.warnNearQuotaMailboxes 28 Apr 2004 22:11:36 -0000 1.1
+++ ispman.warnNearQuotaMailboxes 30 May 2004 23:35:32 -0000 1.2
@@ -2,9 +2,10 @@
# Warn mailboxes who are near their quota, default is 60%
# Usage: ispman.warnNearQuotaMailboxes -h mailhost.example.com
-
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
#Customize these 2 lines and the message at the bottom of the script
@@ -15,39 +16,43 @@
use ISPMan;
use Mail::Sendmail;
use vars qw($ispman);
-$ispman=ISPMan->new();
-
+$ispman = ISPMan->new();
#Default to 60% of quota
-my $percent=60;
-my $multiplier=$percent /100;
-my $uid_filter="*";
-my $users=$ispman->getEntriesAsHashRef($ispman->{'Config'}{'ldapBaseDN'}, "&(objectclass=ispmanDomainUser)(uid=$uid_filter)");
+my $percent = 60;
+my $multiplier = $percent / 100;
+my $uid_filter = "*";
+my $users = $ispman->getEntriesAsHashRef( $ispman->{'Config'}{'ldapBaseDN'},
+ "&(objectclass=ispmanDomainUser)(uid=$uid_filter)" );
+USER: for ( keys %$users ) {
+ @uids = $ispman->as_array( $users->{$_}{'uid'} );
+
+ #We want the user_example_com uid
+ if ( $uids[0] =~ /@/ ) { $uid = $uids[1]; }
+ else { $uid = $uids[0]; }
+ $mailbox = join "", ( $mailbox_prefix, $uid );
+ @q = $imap->get_quota($mailbox);
+ next unless $q[2];
+ $threshold = $multiplier * $q[2];
+
+ #print "$uid used: $q[1] thresh: $threshold\n";
+ if ( $q[1] >= $threshold ) {
-USER: for (keys %$users) {
- @uids=$ispman->as_array($users->{$_}{'uid'});
- #We want the user_example_com uid
- if ($uids[0] =~ /@/) {$uid=$uids[1];}
- else { $uid=$uids[0]; }
- $mailbox=join "", ($mailbox_prefix, $uid);
- @q=$imap->get_quota($mailbox);
- next unless $q[2];
- $threshold=$multiplier * $q[2];
- #print "$uid used: $q[1] thresh: $threshold\n";
- if ($q[1]>=$threshold){
#Determine mailbox usage in simple xx% value as $percent
- $usage = ($q[1] / $q[2]) * 100;
- ($percent,$trailingjunk)=split(/\./, $usage);
+ $usage = ( $q[1] / $q[2] ) * 100;
+ ( $percent, $trailingjunk ) = split( /\./, $usage );
#Email settings
- @email=$ispman->as_array($users->{$_}{'mailLocalAddress'});
- $mail{to}=$email[0];
- $mail{subject}="MAILBOX $percent% FULL - From YourISP ";
+ @email = $ispman->as_array( $users->{$_}{'mailLocalAddress'} );
+ $mail{to} = $email[0];
+ $mail{subject} = "MAILBOX $percent% FULL - From YourISP ";
+
#Customize here, don't forget escapes amd put it all on one line
- $mail{message}="Your email box is at $percent% of your email quota.\nYour Quota is: $q[2] kilo bytes\nYou have Used: $q[1] kilobytes\n\nPlease dump your trash and erase unneeded email. If you need more space, please contact our office at hosting-support\@example.com. There may be an additional charge.\nOnce y our mailbox is full, no more mail will be delivered until some email is erased.\nNOTE: You will receive this alert once a day if your mailbox is in danger of being full.";
+ $mail{message} =
+"Your email box is at $percent% of your email quota.\nYour Quota is: $q[2] kilo bytes\nYou have Used: $q[1] kilobytes\n\nPlease dump your trash and erase unneeded email. If you need more space, please contact our office at hosting-support\@example.com. There may be an additional charge.\nOnce y our mailbox is full, no more mail will be delivered until some email is erased.\nNOTE: You will receive this alert once a day if your mailbox is in danger of being full.";
sendmail(%mail) or die $Mail::Sendmail::error;
- }
+ }
-}
+}
Index: ispman.deleteDomainService
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.deleteDomainService,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.deleteDomainService 19 May 2002 02:55:26 -0000 1.2
+++ ispman.deleteDomainService 30 May 2004 23:35:31 -0000 1.3
@@ -1,13 +1,15 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- unless ($ARGV[0]){
- print "usage: $0 servicename\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ unless ( $ARGV[0] ) {
+ print "usage: $0 servicename\n";
+ exit;
+ }
}
use lib qw("$FindBin::Bin/../lib");
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
+$ispman = ISPMan->new();
$ispman->deleteDomainService(@ARGV);
Index: ispman.getConf
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.getConf,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- ispman.getConf 13 Aug 2003 19:59:42 -0000 1.6
+++ ispman.getConf 30 May 2004 23:35:32 -0000 1.7
@@ -1,13 +1,15 @@
#!/usr/bin/perl
package ISPMan;
+
BEGIN {
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
-
use ISPMan;
-my $ispman=ISPMan->new();
-print $ispman->getConf($ARGV[0]), "\n";
+my $ispman = ISPMan->new();
+print $ispman->getConf( $ARGV[0] ), "\n";
__END__
Index: ispman.processes
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.processes,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ispman.processes 24 Apr 2003 21:31:41 -0000 1.3
+++ ispman.processes 30 May 2004 23:35:32 -0000 1.4
@@ -1,30 +1,36 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('hsd', \%opts);
- unless ($opts{'h'}){
- print "Usage: ispman.processes -h hostname [-d domain] [-s sortby]\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'hsd', \%opts );
+ unless ( $opts{'h'} ) {
+ print "Usage: ispman.processes -h hostname [-d domain] [-s sortby]\n";
+ exit;
+ }
}
use lib qw(%%installDir%%/lib);
-my $hostname=$opts{'h'} || $ENV{'HOSTNAME'};
+my $hostname = $opts{'h'} || $ENV{'HOSTNAME'};
use ISPMan;
-my $ispman=ISPMan->new();
+my $ispman = ISPMan->new();
-my $filter="ispmanHostName=$hostname";
-if ($opts{'d'}) {
-$filter="&(ispmanDomain=$opts{'d'})($filter)";
+my $filter = "ispmanHostName=$hostname";
+if ( $opts{'d'} ) {
+ $filter = "&(ispmanDomain=$opts{'d'})($filter)";
}
-my $processes=$ispman->getEntriesAsHashRef("ou=processes, @{[$ispman->getConf('ldapBaseDN')]}", "$filter" );
+my $processes =
+ $ispman->getEntriesAsHashRef(
+ "ou=processes, @{[$ispman->getConf('ldapBaseDN')]}", "$filter" );
-$opts{'s'}||="ispmanPid";
+$opts{'s'} ||= "ispmanPid";
-for (sort {$processes->{$a}{$opts{'s'}} cmp $processes->{$b}{$opts{'s'}}} keys %$processes){
- write();
+for ( sort { $processes->{$a}{ $opts{'s'} } cmp $processes->{$b}{ $opts{'s'} } }
+ keys %$processes )
+{
+ write();
}
format STDOUT =
@@ -32,8 +38,6 @@
$processes->{$_}{'ispmanPid'}, $processes->{$_}{'ispmanStatus'}, $processes->{$_}{'ispmanDomain'}, $processes->{$_}{'ispmanSession'},$processes->{$_}{'ispmanProcess'}
.
-
-
#print $ispman->dumper($processes);
__END__
Index: ispman.dumpAllUsers
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.dumpAllUsers,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ispman.dumpAllUsers 28 Aug 2003 12:29:09 -0000 1.1
+++ ispman.dumpAllUsers 30 May 2004 23:35:32 -0000 1.2
@@ -5,22 +5,21 @@
# example, this script can be used to set an attribute on all users
# ispman.dumpAllUsers | awk '{system("ispman.addUserAttribute -d " $1 " -u " $2 " -a mailHost someHost")}'
-
-
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
-
-
-my $users=$ispman->getEntriesAsHashRef($ispman->{'Config'}{'ldapBaseDN'}, "objectclass=ispmanDomainUser");
+$ispman = ISPMan->new();
+my $users = $ispman->getEntriesAsHashRef( $ispman->{'Config'}{'ldapBaseDN'},
+ "objectclass=ispmanDomainUser" );
-USER: for (keys %$users) {
- $dnParts=$ispman->explodeDN($_);
- print $dnParts->{'ispmanDomain'}, "\t", $dnParts->{'uid'}, "\n";
+USER: for ( keys %$users ) {
+ $dnParts = $ispman->explodeDN($_);
+ print $dnParts->{'ispmanDomain'}, "\t", $dnParts->{'uid'}, "\n";
}
Index: ispman.listModules
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.listModules,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ispman.listModules 24 Apr 2003 21:31:40 -0000 1.3
+++ ispman.listModules 30 May 2004 23:35:32 -0000 1.4
@@ -1,12 +1,13 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
use ISPMan;
-my $ispman=ISPMan->new();
-my $modules=$ispman->getConfModules();
-for (keys %$modules){
-print "$modules->{$_}{'ispmanModule'}\n";
+my $ispman = ISPMan->new();
+my $modules = $ispman->getConfModules();
+for ( keys %$modules ) {
+ print "$modules->{$_}{'ispmanModule'}\n";
}
-
Index: ispman.passwd.user
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.passwd.user,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.passwd.user 24 Apr 2003 21:31:41 -0000 1.2
+++ ispman.passwd.user 30 May 2004 23:35:32 -0000 1.3
@@ -1,26 +1,29 @@
#!/usr/bin/perl
BEGIN {
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopts('h:', \%opts);
- if ($opts{'h'} ||!$ARGV[1]){
- print "Usage: $FindBin::Script user\@domain new_password\n\n";
- print "Examples:\n";
- print "----------\n";
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopts( 'h:', \%opts );
+ if ( $opts{'h'} || !$ARGV[1] ) {
+ print "Usage: $FindBin::Script user\@domain new_password\n\n";
+ print "Examples:\n";
+ print "----------\n";
- print "$FindBin::Script atif\@ispman.org s3CreT \n\n# sets s3CreT as the password of user atif\@ispman.org\n";
- print "\n";
- exit;
- }
+ print
+"$FindBin::Script atif\@ispman.org s3CreT \n\n# sets s3CreT as the password of user atif\@ispman.org\n";
+ print "\n";
+ exit;
+ }
}
-
use ISPMan;
-my $ispman=ISPMan->new();
-my ($ispmanUserId, $domain)=split('@', $ARGV[0]);
-my $uid=join('_', ($ispmanUserId, $domain));
-$uid=~s/\./_/g;
-$ispman->changePassword($uid, $domain, $ARGV[1], $ispman->getConf('userPassHashMethod'));
+my $ispman = ISPMan->new();
+my ( $ispmanUserId, $domain ) = split( '@', $ARGV[0] );
+my $uid = join( '_', ( $ispmanUserId, $domain ) );
+$uid =~ s/\./_/g;
+$ispman->changePassword( $uid, $domain, $ARGV[1],
+ $ispman->getConf('userPassHashMethod') );
__END__
Index: ispman.l10n
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.l10n,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.l10n 24 Apr 2003 21:31:40 -0000 1.2
+++ ispman.l10n 30 May 2004 23:35:32 -0000 1.3
@@ -1,15 +1,15 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- unless ($ARGV[0]){
- print "$0 template\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ unless ( $ARGV[0] ) {
+ print "$0 template\n";
+ exit;
+ }
}
use ISPMan::L10N;
-$ENV{'LANGUAGE'}=shift @ARGV;
-print _(join " ", @ARGV);
+$ENV{'LANGUAGE'} = shift @ARGV;
+print _( join " ", @ARGV );
print "\n";
-
-
Index: ispman.commitSession
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.commitSession,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ispman.commitSession 28 Aug 2003 08:23:03 -0000 1.3
+++ ispman.commitSession 30 May 2004 23:35:31 -0000 1.4
@@ -1,15 +1,15 @@
#!/usr/bin/perl
BEGIN {
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
use ISPMan;
-my $ispman=ISPMan->new();
+my $ispman = ISPMan->new();
exit unless @ARGV;
-my $session=shift @ARGV;
+my $session = shift @ARGV;
print "Commiting session $session\n";
$ispman->releaseSession($session);
-
-
__END__
Index: ispman.domainHasService
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.domainHasService,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ispman.domainHasService 5 May 2003 14:17:48 -0000 1.1
+++ ispman.domainHasService 30 May 2004 23:35:31 -0000 1.2
@@ -2,24 +2,26 @@
# exaple script.
# shows users in domain
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('d', \%opts);
- unless ($opts{'d'} && $ARGV[0]){
- print "Usage: $0 -d domain service";
- print "\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'd', \%opts );
+ unless ( $opts{'d'} && $ARGV[0] ) {
+ print "Usage: $0 -d domain service";
+ print "\n";
+ exit;
+ }
}
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
-if ($ispman->domainHasService($opts{'d'}, $ARGV[0])){
- print "Yes\n";
-} else {
- print "No\n";
+$ispman = ISPMan->new();
+if ( $ispman->domainHasService( $opts{'d'}, $ARGV[0] ) ) {
+ print "Yes\n";
+}
+else {
+ print "No\n";
}
-;
Index: ispman.passwd.vhost
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.passwd.vhost,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ispman.passwd.vhost 14 May 2003 10:31:08 -0000 1.1
+++ ispman.passwd.vhost 30 May 2004 23:35:32 -0000 1.2
@@ -1,22 +1,22 @@
#!/usr/bin/perl
BEGIN {
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('dv', \%opts);
- unless ($opts{'d'} && $opts{"v"} && $ARGV[0]){
- print "Usage: $FindBin::Script -d domain -v vhost new_password\n\n";
- exit;
- }
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'dv', \%opts );
+ unless ( $opts{'d'} && $opts{"v"} && $ARGV[0] ) {
+ print "Usage: $FindBin::Script -d domain -v vhost new_password\n\n";
+ exit;
+ }
}
-
use ISPMan;
-my $ispman=ISPMan->new();
-if ($ispman->changeVhostPassword($opts{"v"}, $opts{"d"}, $ARGV[0])){
- print "Password changed\n";
+my $ispman = ISPMan->new();
+if ( $ispman->changeVhostPassword( $opts{"v"}, $opts{"d"}, $ARGV[0] ) ) {
+ print "Password changed\n";
}
-
__END__
Index: ispman.smtpAuthTest
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.smtpAuthTest,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.smtpAuthTest 25 Jul 2003 03:41:21 -0000 1.2
+++ ispman.smtpAuthTest 30 May 2004 23:35:32 -0000 1.3
@@ -1,17 +1,19 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- unless ($ARGV[2]){
- print "$0 hostname username password\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ unless ( $ARGV[2] ) {
+ print "$0 hostname username password\n";
+ exit;
+ }
}
use Net::SMTP;
-my $smtp = Net::SMTP->new($ARGV[0]);
-if ($smtp->auth($ARGV[1], $ARGV[2]) ) {
- print "OK\n";
-} else {
- print "Not OK\n";
-};
-
+my $smtp = Net::SMTP->new( $ARGV[0] );
+if ( $smtp->auth( $ARGV[1], $ARGV[2] ) ) {
+ print "OK\n";
+}
+else {
+ print "Not OK\n";
+}
Index: ispman.getUserAttributeValues
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.getUserAttributeValues,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.getUserAttributeValues 24 Apr 2003 21:31:39 -0000 1.2
+++ ispman.getUserAttributeValues 30 May 2004 23:35:32 -0000 1.3
@@ -1,24 +1,26 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('dua', \%opts);
- unless ($opts{'d'} && $opts{'u'} && $opts{'a'}){
- print "Usage: $FindBin::Script -d domain -u username -a attribute\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'dua', \%opts );
+ unless ( $opts{'d'} && $opts{'u'} && $opts{'a'} ) {
+ print "Usage: $FindBin::Script -d domain -u username -a attribute\n";
+ exit;
+ }
}
use ISPMan;
-my $ispman=ISPMan->new();
+my $ispman = ISPMan->new();
-my @list=$ispman->as_array($ispman->getUserAttributeValues($opts{'u'}, $opts{'d'}, $opts{'a'}));
+my @list =
+ $ispman->as_array(
+ $ispman->getUserAttributeValues( $opts{'u'}, $opts{'d'}, $opts{'a'} ) );
for (@list) {
- print "$_\n";
+ print "$_\n";
}
-
-
Index: ispman.addDomainService
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.addDomainService,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ispman.addDomainService 4 Jan 2004 18:56:13 -0000 1.3
+++ ispman.addDomainService 30 May 2004 23:35:31 -0000 1.4
@@ -1,29 +1,42 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- print "Name of the service: ";
- chomp($service->{'ispmanDomainServiceName'}=<>);
- print "Common display info for this service: ";
- chomp($service->{'ispmanDomainServiceAlias'}=<>);
- print "Optional description for this service: ";
- chomp($service->{'ispmanDomainServiceInfo'}=<>);
- while($service->{'ispmanDomainServiceDefault'}!~/(y|n)/i){
- print "Is the service active by default (y/n) :";
- chomp($service->{'ispmanDomainServiceDefault'}=<>);
- }
- $service->{'ispmanDomainServiceDefault'}=($service->{'ispmanDomainServiceDefault'} eq "y")?"YES":"NO";
- unless ($service->{'ispmanDomainServiceName'} && $service->{'ispmanDomainServiceDefault'}){
- print "Sorry, you did you fill the required fields\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ print "Name of the service: ";
+ chomp( $service->{'ispmanDomainServiceName'} = <> );
+ print "Common display info for this service: ";
+ chomp( $service->{'ispmanDomainServiceAlias'} = <> );
+ print "Optional description for this service: ";
+ chomp( $service->{'ispmanDomainServiceInfo'} = <> );
+
+ while ( $service->{'ispmanDomainServiceDefault'} !~ /(y|n)/i ) {
+ print "Is the service active by default (y/n) :";
+ chomp( $service->{'ispmanDomainServiceDefault'} = <> );
+ }
+ $service->{'ispmanDomainServiceDefault'} =
+ ( $service->{'ispmanDomainServiceDefault'} eq "y" ) ? "YES" : "NO";
+ unless ( $service->{'ispmanDomainServiceName'}
+ && $service->{'ispmanDomainServiceDefault'} )
+ {
+ print "Sorry, you did you fill the required fields\n";
+ exit;
+ }
}
use lib qw(%%installDir%%/lib);
use ISPMan;
-my $ispman=ISPMan->new();
-if ($ispman->addDomainService($service->{'ispmanDomainServiceName'}, $service->{'ispmanDomainServiceAlias'}, $service->{'ispmanDomainServiceDefault'}, $service->{'ispmanDomainServiceInfo'})){
- print "Service Added\n";
-};
-
+my $ispman = ISPMan->new();
+if (
+ $ispman->addDomainService(
+ $service->{'ispmanDomainServiceName'},
+ $service->{'ispmanDomainServiceAlias'},
+ $service->{'ispmanDomainServiceDefault'},
+ $service->{'ispmanDomainServiceInfo'}
+ )
+ )
+{
+ print "Service Added\n";
+}
Index: ispman.makelogs
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.makelogs,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- ispman.makelogs 4 Jan 2004 18:56:13 -0000 1.22
+++ ispman.makelogs 30 May 2004 23:35:32 -0000 1.23
@@ -1,7 +1,9 @@
#!/usr/bin/perl
BEGIN {
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use vars qw (
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use vars qw (
$domain
$domainVhosts
$servername
@@ -17,7 +19,7 @@
$webalizer
$rawDirectory
$logsDir
- );
+ );
}
use strict;
@@ -26,14 +28,13 @@
use lib qw(%%installDir%%/lib);
use ISPMan;
-my $ispman=ISPMan->new();
-
+my $ispman = ISPMan->new();
-$logsDir=$ispman->getConf("apacheLogsDirectory");
-$webalizer=$ispman->getConf("apacheWebalizerPath");
-my $apacheGracefulCommand=$ispman->getConf("apacheGracefulCommand");
-my $apacheGracefulTime=$ispman->getConf("apacheGracefulTime");
-$vhostsHashFile=join '.', ($ispman->getConf("apacheVhostsFile"), "hash");
+$logsDir = $ispman->getConf("apacheLogsDirectory");
+$webalizer = $ispman->getConf("apacheWebalizerPath");
+my $apacheGracefulCommand = $ispman->getConf("apacheGracefulCommand");
+my $apacheGracefulTime = $ispman->getConf("apacheGracefulTime");
+$vhostsHashFile = join '.', ( $ispman->getConf("apacheVhostsFile"), "hash" );
# Basic Password security
#our $protectLogs=$ispman->getConf("protectLogs");
@@ -46,8 +47,9 @@
# $protectLogs="yes";
#}
-unless ($apacheGracefulCommand){
- ($apacheGracefulCommand=$ispman->getConf("apacheStartCommand"))=~s!\w+$!graceful!g;
+unless ($apacheGracefulCommand) {
+ ( $apacheGracefulCommand = $ispman->getConf("apacheStartCommand") ) =~
+ s!\w+$!graceful!g;
print "!!!WARNING!!!!!\n";
print "---------------\n";
print "apacheGracefulCommand is missing.\n";
@@ -57,43 +59,45 @@
print "/configure\n";
print "make ldif\n";
print "$FindBin::Bin/ispman.loadldif -f tmp/ldif/ispman.ldif\n\n";
- print "At the moment I am guess this command to be $apacheGracefulCommand\n\n";
+ print
+ "At the moment I am guess this command to be $apacheGracefulCommand\n\n";
}
-unless ($apacheGracefulTime){
- $apacheGracefulTime=600;
+unless ($apacheGracefulTime) {
+ $apacheGracefulTime = 600;
}
-unless (-e $logsDir){
+unless ( -e $logsDir ) {
die "Logs directory $logsDir does not exists\n";
}
-unless (-e $webalizer){
- warn "Webalizer command does not exists\nI will split the files but no reports will be generated.";
+unless ( -e $webalizer ) {
+ warn
+"Webalizer command does not exists\nI will split the files but no reports will be generated.";
}
-if (-e $vhostsHashFile) {
+if ( -e $vhostsHashFile ) {
require $vhostsHashFile;
- $vhosts=$VAR1;
-} else {
+ $vhosts = $VAR1;
+}
+else {
die "No VhostsHash file found $vhostsHashFile\n";
}
-if ($ARGV[0]){
- print $ARGV[0], "\n" ;
- processAllServers($ARGV[0]);
- exit;
+if ( $ARGV[0] ) {
+ print $ARGV[0], "\n";
+ processAllServers( $ARGV[0] );
+ exit;
}
-
-
-
print "Moving actual log files to new filename for closing open connections\n";
processAllServers("moveLogsForClose");
print "Now we tell the Apache to start to write to new logfiles\n";
-print "Open connections will be logged to temporary logfiles for the next Minutes\n";
+print
+"Open connections will be logged to temporary logfiles for the next Minutes\n";
system($apacheGracefulCommand);
-print "Now lets hold the script for $apacheGracefulTime seconds to give apache a chance \n";
+print
+"Now lets hold the script for $apacheGracefulTime seconds to give apache a chance \n";
print "to close open connections. Please stand by...\n";
sleep($apacheGracefulTime);
print "OK. It\'s time to work!\n";
@@ -101,77 +105,78 @@
print "Now we generate the reports\n";
processAllServers("generateReports");
-
-sub processAllServers{
- my $whatCanIDoForYou=shift;
- no strict "refs";
- for $domain (keys %$vhosts) {
- $domainVhosts=$vhosts->{$domain};
- for $vhost (keys %$domainVhosts) {
- $servername=$domainVhosts->{$vhost}{'servername'};
- &{$whatCanIDoForYou};
- }
- }
+sub processAllServers {
+ my $whatCanIDoForYou = shift;
+ no strict "refs";
+ for $domain ( keys %$vhosts ) {
+ $domainVhosts = $vhosts->{$domain};
+ for $vhost ( keys %$domainVhosts ) {
+ $servername = $domainVhosts->{$vhost}{'servername'};
+ &{$whatCanIDoForYou};
+ }
+ }
}
-sub moveLogsForClose{
- my $logfile="$logsDir/vhosts/$servername\.access";
- my $closelogfile="$logsDir/vhosts/$servername\.access\.close";
- print "LogFile: $logfile: $logfile\n";
- if (-e $logfile) {
- print "Working on $servername\n";
- print "Log file found\n";
- print "Moving $logfile to $closelogfile now\n";
- move ($logfile, $closelogfile);
- }
+sub moveLogsForClose {
+ my $logfile = "$logsDir/vhosts/$servername\.access";
+ my $closelogfile = "$logsDir/vhosts/$servername\.access\.close";
+ print "LogFile: $logfile: $logfile\n";
+ if ( -e $logfile ) {
+ print "Working on $servername\n";
+ print "Log file found\n";
+ print "Moving $logfile to $closelogfile now\n";
+ move( $logfile, $closelogfile );
+ }
}
-sub moveLogsForParse{
- print "Working on $servername\n";
- my $logfile="$logsDir/vhosts/$servername\.access\.close";
- my $rawfile="$servername\.access";
- print "Logfile: $logfile\n";
- if (-e $logfile) {
- print "Log file found\n";
- my $rawDirectory="$logsDir/domains/$domain/$vhost/raw";
- my $reportDirectory="$logsDir/domains/$domain/$vhost/report";
- mkpath ($rawDirectory) unless (-d $rawDirectory);
- mkpath ($reportDirectory) unless (-d $reportDirectory);
- move ($logfile, "$rawDirectory/$rawfile");
- } else {
- print "No logfile found. Skipping this one\n";
- }
- print "\n";
+sub moveLogsForParse {
+ print "Working on $servername\n";
+ my $logfile = "$logsDir/vhosts/$servername\.access\.close";
+ my $rawfile = "$servername\.access";
+ print "Logfile: $logfile\n";
+ if ( -e $logfile ) {
+ print "Log file found\n";
+ my $rawDirectory = "$logsDir/domains/$domain/$vhost/raw";
+ my $reportDirectory = "$logsDir/domains/$domain/$vhost/report";
+ mkpath($rawDirectory) unless ( -d $rawDirectory );
+ mkpath($reportDirectory) unless ( -d $reportDirectory );
+ move( $logfile, "$rawDirectory/$rawfile" );
+ }
+ else {
+ print "No logfile found. Skipping this one\n";
+ }
+ print "\n";
}
-sub generateReports{
- my $logfile="$logsDir/domains/$domain/$vhost/raw/$servername\.access";
- if (-e $logfile) {
- $vhostDirectory="$logsDir/domains/$domain/$vhost";
- $rawDirectory="$logsDir/domains/$domain/$vhost/raw";
- open "FILE", "$logfile" || die "Cant open logFile";
- $lastDate="";
+sub generateReports {
+ my $logfile = "$logsDir/domains/$domain/$vhost/raw/$servername\.access";
+ if ( -e $logfile ) {
+ $vhostDirectory = "$logsDir/domains/$domain/$vhost";
+ $rawDirectory = "$logsDir/domains/$domain/$vhost/raw";
+ open "FILE", "$logfile" || die "Cant open logFile";
+ $lastDate = "";
- for (<FILE>) {
- m!(\d\d/\w+?/\d+)!;
- $date=$1;
- $date=~s/\//-/g;
- openFile("$rawDirectory/$date") unless $date eq $lastDate;
- print F $_;
- $lastDate=$date;
- }
- close (FILE);
- }
+ for (<FILE>) {
+ m!(\d\d/\w+?/\d+)!;
+ $date = $1;
+ $date =~ s/\//-/g;
+ openFile("$rawDirectory/$date") unless $date eq $lastDate;
+ print F $_;
+ $lastDate = $date;
+ }
+ close(FILE);
+ }
-# print "Generating .htaccess for $domain\n";
-# generateHtAccessFile();
+ # print "Generating .htaccess for $domain\n";
+ # generateHtAccessFile();
- if (-e $webalizer) {
- print "Making report for $servername\n";
- my $cmd="perl $FindBin::Bin/ispman.loganalyzer -c $webalizer -d $vhostDirectory";
- system($cmd);
- }
+ if ( -e $webalizer ) {
+ print "Making report for $servername\n";
+ my $cmd =
+"perl $FindBin::Bin/ispman.loganalyzer -c $webalizer -d $vhostDirectory";
+ system($cmd);
+ }
}
#sub generateHtAccessFile{
@@ -192,18 +197,18 @@
# }
#}
-
-sub openFile{
- my $file=shift;
- if (-e $file) {
+sub openFile {
+ my $file = shift;
+ if ( -e $file ) {
open F, ">>$file" || die "Cant open $file";
- } else {
+ }
+ else {
open F, ">$file" || die "Cant open $file";
}
}
sub touch {
- my $file=shift;
+ my $file = shift;
open "TFILE", ">$file";
close("TFILE");
}
Index: ispman.getTemplate
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.getTemplate,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.getTemplate 24 Apr 2003 21:31:39 -0000 1.2
+++ ispman.getTemplate 30 May 2004 23:35:32 -0000 1.3
@@ -1,17 +1,17 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- unless ($ARGV[0]){
- print "$0 template\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ unless ( $ARGV[0] ) {
+ print "$0 template\n";
+ exit;
+ }
}
use lib qw(%%installDir%%/lib);
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
-my $template=$ispman->getTemplate($ARGV[0]);
+$ispman = ISPMan->new();
+my $template = $ispman->getTemplate( $ARGV[0] );
print $template->fill_in();
-
-
Index: ispman.getUserCount
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.getUserCount,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.getUserCount 24 Apr 2003 21:31:40 -0000 1.2
+++ ispman.getUserCount 30 May 2004 23:35:32 -0000 1.3
@@ -1,21 +1,22 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('d', \%opts);
- unless ($opts{'d'}){
- print "Usage: $0 -d domain";
- print "\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'd', \%opts );
+ unless ( $opts{'d'} ) {
+ print "Usage: $0 -d domain";
+ print "\n";
+ exit;
+ }
}
-
use lib qw(%%installDir%%/lib);
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
+$ispman = ISPMan->new();
-print $ispman->getUserCount($opts{'d'}), "\n";
+print $ispman->getUserCount( $opts{'d'} ), "\n";
Index: ispman.loganalyzer
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.loganalyzer,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- ispman.loganalyzer 4 Jan 2004 18:56:13 -0000 1.8
+++ ispman.loganalyzer 30 May 2004 23:35:32 -0000 1.9
@@ -1,70 +1,70 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('c', \%opts);
- unless ($opts{'c'} && $ARGV[0]){
- print "$0 -c /path/to/webalizer vhost_directory";
- print "\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'c', \%opts );
+ unless ( $opts{'c'} && $ARGV[0] ) {
+ print "$0 -c /path/to/webalizer vhost_directory";
+ print "\n";
+ exit;
+ }
}
[email protected] = @ARGV;
+$webalizer = $opts{'c'};
[email protected]=@ARGV;
-$webalizer=$opts{'c'};
+$mon->{'Jan'} = 1;
+$mon->{'Feb'} = 2;
+$mon->{'Mar'} = 3;
+$mon->{'Apr'} = 4;
+$mon->{'May'} = 5;
+$mon->{'Jun'} = 6;
+$mon->{'Jul'} = 7;
+$mon->{'Aug'} = 8;
+$mon->{'Sep'} = 9;
+$mon->{'Oct'} = 10;
+$mon->{'Nov'} = 11;
+$mon->{'Dec'} = 12;
-$mon->{'Jan'}=1;
-$mon->{'Feb'}=2;
-$mon->{'Mar'}=3;
-$mon->{'Apr'}=4;
-$mon->{'May'}=5;
-$mon->{'Jun'}=6;
-$mon->{'Jul'}=7;
-$mon->{'Aug'}=8;
-$mon->{'Sep'}=9;
-$mon->{'Oct'}=10;
-$mon->{'Nov'}=11;
-$mon->{'Dec'}=12;
+for $dir (@dir) {
+ next unless -d $dir;
+ next unless -d "$dir/raw";
+ $sitename = $dir;
+ @sitename = split( "/", $dir );
+ $sitename =
+ join( '.', ( $sitename[$#sitename], $sitename[ $#sitename - 1 ] ) );
-for $dir(@dir){
- next unless -d $dir;
- next unless -d "$dir/raw";
- $sitename=$dir;
- @sitename=split("/", $dir);
- $sitename=join ('.', ($sitename[$#sitename], $sitename[$#sitename-1]));
-
- chdir "$dir/raw" or die "Cant chdir";
-
- my @files=<*>;
- for (@files){
- next unless /\d\d\-\w+?\-\d\d\d\d/;
- ($day, $month, $year) = $_ =~ /(\d\d)\-(\w+)?\-(\d\d\d\d)/;
- $date->{$year}{$month}{$day}++;
- }
-
- for $y(sort {$date->{$a} <=> $date->{$b}} keys %$date){
- for $m(sort {
- $mon->{$a} <=> $mon->{$b}
- } keys %{$date->{$y}}
- ) {
- for $d(sort {$a <=> $b} keys %{$date->{$y}{$m}}){
- $f = "$d-$m-$y";
- push @logs, $f;
- }
- }
- }
-
+ chdir "$dir/raw" or die "Cant chdir";
- for $log(@logs){
- $cmd="$webalizer -p -n $sitename -o $dir/report -t 'Log Report' $dir/raw/$log\n";
- if ($opts{'n'}) {
- print $cmd;
- next;
- } else {
- system($cmd);
- }
- }
+ my @files = <*>;
+ for (@files) {
+ next unless /\d\d\-\w+?\-\d\d\d\d/;
+ ( $day, $month, $year ) = $_ =~ /(\d\d)\-(\w+)?\-(\d\d\d\d)/;
+ $date->{$year}{$month}{$day}++;
+ }
+
+ for $y ( sort { $date->{$a} <=> $date->{$b} } keys %$date ) {
+ for $m ( sort { $mon->{$a} <=> $mon->{$b} } keys %{ $date->{$y} } ) {
+ for $d ( sort { $a <=> $b } keys %{ $date->{$y}{$m} } ) {
+ $f = "$d-$m-$y";
+ push @logs, $f;
+ }
+ }
+ }
+
+ for $log (@logs) {
+ $cmd =
+"$webalizer -p -n $sitename -o $dir/report -t 'Log Report' $dir/raw/$log\n";
+ if ( $opts{'n'} ) {
+ print $cmd;
+ next;
+ }
+ else {
+ system($cmd);
+ }
+ }
}
1;
exit(0);
Index: ispman.passwd.reseller
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.passwd.reseller,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ispman.passwd.reseller 14 May 2003 10:31:08 -0000 1.1
+++ ispman.passwd.reseller 30 May 2004 23:35:32 -0000 1.2
@@ -1,21 +1,21 @@
#!/usr/bin/perl
BEGIN {
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('r', \%opts);
- unless ($opts{'r'} && $ARGV[0]){
- print "Usage: $FindBin::Script -r resellerId new_password\n\n";
- exit;
- }
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'r', \%opts );
+ unless ( $opts{'r'} && $ARGV[0] ) {
+ print "Usage: $FindBin::Script -r resellerId new_password\n\n";
+ exit;
+ }
}
-
-
use ISPMan;
-my $ispman=ISPMan->new();
-if ( $ispman->changeResellerPassword($opts{"r"}, $ARGV[0])) {
- print "Password changed\n";
+my $ispman = ISPMan->new();
+if ( $ispman->changeResellerPassword( $opts{"r"}, $ARGV[0] ) ) {
+ print "Password changed\n";
}
__END__
Index: ispman.dnsshow
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.dnsshow,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- ispman.dnsshow 8 May 2003 13:20:12 -0000 1.8
+++ ispman.dnsshow 30 May 2004 23:35:31 -0000 1.9
@@ -1,54 +1,54 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('dt', \%opts);
- getopt('v:', \%opts);
- unless ($opts{'d'} && $opts{'t'}){
- print "$0 -d domain -t type [-v] \n";
- print " where type can be one of the following:\n";
- print " A List of host addresses\n";
- print " NS List of Name servers\n";
- print " MX List of Mail servers\n";
- print " CNAME List of Canonical names\n";
- print " ANY All of the above\n";
- print "\n";
- print "if you want to list for all domains, use -d all\n";
- print "Example: $0 -d all -t MX\n";
- print "\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'dt', \%opts );
+ getopt( 'v:', \%opts );
+ unless ( $opts{'d'} && $opts{'t'} ) {
+ print "$0 -d domain -t type [-v] \n";
+ print " where type can be one of the following:\n";
+ print " A List of host addresses\n";
+ print " NS List of Name servers\n";
+ print " MX List of Mail servers\n";
+ print " CNAME List of Canonical names\n";
+ print " ANY All of the above\n";
+ print "\n";
+ print "if you want to list for all domains, use -d all\n";
+ print "Example: $0 -d all -t MX\n";
+ print "\n";
+ exit;
+ }
}
use lib qw(%%installDir%%/lib);
-
use ISPMan;
use CGI;
use vars qw($ispman);
-$ispman=ISPMan->new();
-$opts{'t'}=lc($opts{'t'});
+$ispman = ISPMan->new();
+$opts{'t'} = lc( $opts{'t'} );
require "functions/dnsshow.functions.pl";
-if (lc($opts{'d'}) eq "all" || lc($opts{'d'}) eq "any" ) {
- my $domains=$ispman->makeDomainHash($ispman->getDomains("ispmanDomainType=primary"));
- for (keys %$domains) {
- print "$_\n" if defined $opts{'v'};
- &{"show_$opts{'t'}"}($_);
+if ( lc( $opts{'d'} ) eq "all" || lc( $opts{'d'} ) eq "any" ) {
+ my $domains =
+ $ispman->makeDomainHash(
+ $ispman->getDomains("ispmanDomainType=primary") );
+ for ( keys %$domains ) {
+ print "$_\n" if defined $opts{'v'};
+ &{"show_$opts{'t'}"}($_);
- }
- exit;
+ }
+ exit;
}
-unless ($ispman->branchExists($ispman->getDNSDN($opts{'d'}))){
- print "Domain $opts{'d'} not found\n";
- exit;
+unless ( $ispman->branchExists( $ispman->getDNSDN( $opts{'d'} ) ) ) {
+ print "Domain $opts{'d'} not found\n";
+ exit;
}
-
-&{"show_$opts{'t'}"}($opts{'d'});
-
-
+&{"show_$opts{'t'}"}( $opts{'d'} );
1;
__END__
Index: ispman.denyFTP
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.denyFTP,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ispman.denyFTP 31 May 2002 04:07:19 -0000 1.3
+++ ispman.denyFTP 30 May 2004 23:35:31 -0000 1.4
@@ -1,94 +1,92 @@
#!/usr/bin/perl
BEGIN {
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopts('r:h:', \%opts);
- if ($opts{'h'} ||!$ARGV[1]){
- print "Usage: $FindBin::Script [-r] user|vhost|domain name\n\n";
- print "Examples:\n";
- print "----------\n";
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopts( 'r:h:', \%opts );
+ if ( $opts{'h'} || !$ARGV[1] ) {
+ print "Usage: $FindBin::Script [-r] user|vhost|domain name\n\n";
+ print "Examples:\n";
+ print "----------\n";
- print "$FindBin::Script user atif\@ispman.org # deny ftp to user atif in domain ispman.org\n";
- print "$FindBin::Script vhost www\@ispman.org # deny ftp to vhost www in domain ispman.org\n";
- print "$FindBin::Script domain ispman.org # deny ftp to domain ispman.org\n";
- print "$FindBin::Script -r domain ispman.org # deny ftp to domain ispman.org and all users, vhosts under ispman.org\n";
- print "\n";
- exit;
- }
+ print
+"$FindBin::Script user atif\@ispman.org # deny ftp to user atif in domain ispman.org\n";
+ print
+"$FindBin::Script vhost www\@ispman.org # deny ftp to vhost www in domain ispman.org\n";
+ print
+"$FindBin::Script domain ispman.org # deny ftp to domain ispman.org\n";
+ print
+"$FindBin::Script -r domain ispman.org # deny ftp to domain ispman.org and all users, vhosts under ispman.org\n";
+ print "\n";
+ exit;
+ }
}
-
use vars qw ($ispman);
-
-my $obj=$ARGV[0];
-
+my $obj = $ARGV[0];
use ISPMan;
-$ispman=ISPMan->new();
+$ispman = ISPMan->new();
-if ($obj eq "user") {
- &denyUserFTP($ARGV[1]);
+if ( $obj eq "user" ) {
+ &denyUserFTP( $ARGV[1] );
}
-if ($obj eq "vhost") {
- &denyVhostFTP($ARGV[1]);
+if ( $obj eq "vhost" ) {
+ &denyVhostFTP( $ARGV[1] );
}
-if ($obj eq "domain") {
- &denyDomainFTP($ARGV[1]);
+if ( $obj eq "domain" ) {
+ &denyDomainFTP( $ARGV[1] );
}
-
-
-
-
-
-
-
sub denyUserFTP {
- my $user=shift;
- ($domain, $ispmanUserId)=split('@', $user);
- my $dn=&getUserDN($ispmanUserId, $domain);
- if ($ispman->entryExists($dn)){
- $self->updateEntryWithData($dn, {"FTPStatus" => "disabled"});
- }
+ my $user = shift;
+ ( $domain, $ispmanUserId ) = split( '@', $user );
+ my $dn = &getUserDN( $ispmanUserId, $domain );
+ if ( $ispman->entryExists($dn) ) {
+ $self->updateEntryWithData( $dn, { "FTPStatus" => "disabled" } );
+ }
}
-
-
sub getUserDN {
- my ($user, $domain)=@_;
- $uid=join('_', ($user, $domain));
- $uid=~ s/\./_/g;
- return join ',', ("uid=$uid" , "ou=users", "ispmanDomain=$domain", $ispman->{'Config'}{'ldapBaseDN'});
+ my ( $user, $domain ) = @_;
+ $uid = join( '_', ( $user, $domain ) );
+ $uid =~ s/\./_/g;
+ return join ',',
+ (
+ "uid=$uid", "ou=users", "ispmanDomain=$domain",
+ $ispman->{'Config'}{'ldapBaseDN'}
+ );
}
-
sub denyVhostFTP {
- my $vhost=shift;
- ($domain, $ispmanVhostName)=split('@', $vhost);
- my $dn=&getVhostDN($ispmanUserId, $domain);
- if ($ispman->entryExists($dn)){
- $self->updateEntryWithData($dn, {"FTPStatus" => "disabled"});
- }
+ my $vhost = shift;
+ ( $domain, $ispmanVhostName ) = split( '@', $vhost );
+ my $dn = &getVhostDN( $ispmanUserId, $domain );
+ if ( $ispman->entryExists($dn) ) {
+ $self->updateEntryWithData( $dn, { "FTPStatus" => "disabled" } );
+ }
}
-
-
sub getVhostDN {
- my ($vhost, $domain)=@_;
- return join ',', ("ispmanVhostName=$vhost" , "ou=httpdata", "ispmanDomain=$domain", $ispman->{'Config'}{'ldapBaseDN'});
+ my ( $vhost, $domain ) = @_;
+ return join ',',
+ (
+ "ispmanVhostName=$vhost", "ou=httpdata", "ispmanDomain=$domain",
+ $ispman->{'Config'}{'ldapBaseDN'}
+ );
}
-
-
sub denyDomainFTP {
- my $domain=shift;
- my $dn=join ',', ("ispmanDomain=$domain", $ispman->{'Config'}{'ldapBaseDN'});
- if ($ispman->entryExists($dn)){
- $self->updateEntryWithData($dn, {"FTPStatus" => "disabled"});
- }
+ my $domain = shift;
+ my $dn = join ',',
+ ( "ispmanDomain=$domain", $ispman->{'Config'}{'ldapBaseDN'} );
+ if ( $ispman->entryExists($dn) ) {
+ $self->updateEntryWithData( $dn, { "FTPStatus" => "disabled" } );
+ }
}
Index: ispman.prepareBranchForDN
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.prepareBranchForDN,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ispman.prepareBranchForDN 26 Apr 2003 16:54:38 -0000 1.1
+++ ispman.prepareBranchForDN 30 May 2004 23:35:32 -0000 1.2
@@ -1,16 +1,17 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- unless ($ARGV[0]){
- print "$0 DN";
- print "\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ unless ( $ARGV[0] ) {
+ print "$0 DN";
+ print "\n";
+ exit;
+ }
}
-
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
-$ispman->prepareBranchForDN(join "", @ARGV);
+$ispman = ISPMan->new();
+$ispman->prepareBranchForDN( join "", @ARGV );
Index: ispman.setDomainClient
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.setDomainClient,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.setDomainClient 24 Apr 2003 21:31:41 -0000 1.2
+++ ispman.setDomainClient 30 May 2004 23:35:32 -0000 1.3
@@ -1,25 +1,32 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('c', \%opts);
- unless ( $opts{'c'} && $ARGV[0]){
- print "$FindBin::Script -c ClientID DomainName [DomainName] [DomainName] ";
- print "\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'c', \%opts );
+ unless ( $opts{'c'} && $ARGV[0] ) {
+ print
+ "$FindBin::Script -c ClientID DomainName [DomainName] [DomainName] ";
+ print "\n";
+ exit;
+ }
}
use ISPMan;
-my $ispman=ISPMan->new();
-my $client=$ispman->getClientById($opts{'c'});
+my $ispman = ISPMan->new();
+my $client = $ispman->getClientById( $opts{'c'} );
for (@ARGV) {
- print "Setting ispmanClientId for $_ to ", $client->{'ispmanClientId'}, "\n";
+ print "Setting ispmanClientId for $_ to ", $client->{'ispmanClientId'},
+ "\n";
- $ispman->setDomainAttribute($_, "ispmanClientId", $client->{'ispmanClientId'});
- print "Setting ispmanClientName for $_ to ", $client->{'ispmanClientName'}, "\n";
- $ispman->setDomainAttribute($_, "ispmanClientName", $client->{'ispmanClientName'});
+ $ispman->setDomainAttribute( $_, "ispmanClientId",
+ $client->{'ispmanClientId'} );
+ print "Setting ispmanClientName for $_ to ", $client->{'ispmanClientName'},
+ "\n";
+ $ispman->setDomainAttribute( $_, "ispmanClientName",
+ $client->{'ispmanClientName'} );
}
print "\n";
Index: ispman.fixUsers
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.fixUsers,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.fixUsers 24 Apr 2003 21:31:39 -0000 1.2
+++ ispman.fixUsers 30 May 2004 23:35:32 -0000 1.3
@@ -17,31 +17,32 @@
# This wont work for Cyrus at the moment, but we can use
# perdition for the mail user mapping
-
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
use lib qw(%%installDir%%/lib);
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
-
-
-my $users=$ispman->getEntriesAsHashRef($ispman->{'Config'}{'ldapBaseDN'}, "objectclass=ispmanDomainUser");
+$ispman = ISPMan->new();
+my $users = $ispman->getEntriesAsHashRef( $ispman->{'Config'}{'ldapBaseDN'},
+ "objectclass=ispmanDomainUser" );
-USER: for (keys %$users) {
- @uids=$ispman->as_array($users->{$_}{'uid'});
- $mail=$users->{$_}{'mailLocalAddress'};
-
- if ($#uids==0) {
- $ispman->updateEntryWithData($_, {'uid' => [$uids[0], $mail]});
- printf ("Fixing this entry %s which had only one element\n" , $uids[0]);
- } else {
- print "Skipping entry $mail";
- }
- print "\n";
+USER: for ( keys %$users ) {
+ @uids = $ispman->as_array( $users->{$_}{'uid'} );
+ $mail = $users->{$_}{'mailLocalAddress'};
+ if ( $#uids == 0 ) {
+ $ispman->updateEntryWithData( $_, { 'uid' => [ $uids[0], $mail ] } );
+ printf( "Fixing this entry %s which had only one element\n",
+ $uids[0] );
+ }
+ else {
+ print "Skipping entry $mail";
+ }
+ print "\n";
}
Index: ispman.addUserAttributeValues
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.addUserAttributeValues,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.addUserAttributeValues 24 Apr 2003 21:31:37 -0000 1.2
+++ ispman.addUserAttributeValues 30 May 2004 23:35:31 -0000 1.3
@@ -1,22 +1,24 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('dua', \%opts);
- unless ($opts{'d'} && $opts{'u'} && $opts{'a'} && $ARGV[0]){
- print "Usage: $FindBin::Script -d domain -u username -a attribute value [value value]forward_address [forward_address forward_address]\n";
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'dua', \%opts );
+ unless ( $opts{'d'} && $opts{'u'} && $opts{'a'} && $ARGV[0] ) {
+ print
+"Usage: $FindBin::Script -d domain -u username -a attribute value [value value]forward_address [forward_address forward_address]\n";
- print "Note: This command adds the value to the attribute\n";
- exit;
- }
+ print "Note: This command adds the value to the attribute\n";
+ exit;
+ }
}
use ISPMan;
-my $ispman=ISPMan->new();
-$ispman->addUserAttributeValues($opts{'u'}, $opts{'d'}, $opts{'a'}, \@ARGV);
+my $ispman = ISPMan->new();
+$ispman->addUserAttributeValues( $opts{'u'}, $opts{'d'}, $opts{'a'}, \@ARGV );
print "OK\n";
-
Index: ispman.showmailtransport
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.showmailtransport,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- ispman.showmailtransport 31 May 2002 04:07:19 -0000 1.4
+++ ispman.showmailtransport 30 May 2004 23:35:32 -0000 1.5
@@ -1,28 +1,31 @@
#!/usr/bin/perl
BEGIN {
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
use lib qw(%%installDir%%/lib);
use ISPMan;
-my $ispman=ISPMan->new();
+my $ispman = ISPMan->new();
my $domains;
-if ($ARGV[0]) {
- $domains->{$ARGV[0]}="ispmanDomain=$ARGV[0], " . $ispman->getConf("ldapBaseDN");
-}else {
- $domains=$ispman->makeDomainHash($ispman->getDomains());
+if ( $ARGV[0] ) {
+ $domains->{ $ARGV[0] } =
+ "ispmanDomain=$ARGV[0], " . $ispman->getConf("ldapBaseDN");
}
-
-
-
-for $domain(keys %$domains) {
- next if ($ispman->getDomainAttribute($domain, "domaintype") =~/replica/);
- $transport=$ispman->getDomainAttribute($domain, "ispmanDomainMailDeliveryMethod")|| "local";
- print join "\t", ($domain, $transport);
- print "\n";
-
+else {
+ $domains = $ispman->makeDomainHash( $ispman->getDomains() );
}
+for $domain ( keys %$domains ) {
+ next
+ if ( $ispman->getDomainAttribute( $domain, "domaintype" ) =~ /replica/ );
+ $transport =
+ $ispman->getDomainAttribute( $domain, "ispmanDomainMailDeliveryMethod" )
+ || "local";
+ print join "\t", ( $domain, $transport );
+ print "\n";
+}
Index: ispman.dnsdump
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.dnsdump,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- ispman.dnsdump 28 Aug 2003 08:23:03 -0000 1.6
+++ ispman.dnsdump 30 May 2004 23:35:31 -0000 1.7
@@ -1,56 +1,53 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('dt', \%opts);
- getopt('v:', \%opts);
- unless ($opts{'d'} && $opts{'t'}){
- print "$0 -d domain -t type [-v] \n";
- print " where type can be one of the following:\n";
- print " A List of host addresses\n";
- print " NS List of Name servers\n";
- print " MX List of Mail servers\n";
- print " CNAME List of Canonical names\n";
- print " ANY All of the above\n";
- print "\n";
- print "if you want to list for all domains, use -d all\n";
- print "Example: $0 -d all -t MX\n";
- print "\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'dt', \%opts );
+ getopt( 'v:', \%opts );
+ unless ( $opts{'d'} && $opts{'t'} ) {
+ print "$0 -d domain -t type [-v] \n";
+ print " where type can be one of the following:\n";
+ print " A List of host addresses\n";
+ print " NS List of Name servers\n";
+ print " MX List of Mail servers\n";
+ print " CNAME List of Canonical names\n";
+ print " ANY All of the above\n";
+ print "\n";
+ print "if you want to list for all domains, use -d all\n";
+ print "Example: $0 -d all -t MX\n";
+ print "\n";
+ exit;
+ }
}
-
-
-
-
use ISPMan;
use CGI;
use vars qw($ispman);
-$ispman=ISPMan->new();
-$opts{'t'}=lc($opts{'t'});
+$ispman = ISPMan->new();
+$opts{'t'} = lc( $opts{'t'} );
require "functions/dnsdump.functions.pl";
-if (lc($opts{'d'}) eq "all" || lc($opts{'d'}) eq "any" ) {
- my $domains=$ispman->makeDomainHash($ispman->getDomains("ispmanDomainType=primary"));
- for (keys %$domains) {
- print "$_\n" if defined $opts{'v'};
- &{"dump_$opts{'t'}"}($_);
+if ( lc( $opts{'d'} ) eq "all" || lc( $opts{'d'} ) eq "any" ) {
+ my $domains =
+ $ispman->makeDomainHash(
+ $ispman->getDomains("ispmanDomainType=primary") );
+ for ( keys %$domains ) {
+ print "$_\n" if defined $opts{'v'};
+ &{"dump_$opts{'t'}"}($_);
- }
- exit;
+ }
+ exit;
}
-unless ($ispman->branchExists($ispman->getDNSDN($opts{'d'}))){
- print "Domain $opts{'d'} not found\n";
- exit;
+unless ( $ispman->branchExists( $ispman->getDNSDN( $opts{'d'} ) ) ) {
+ print "Domain $opts{'d'} not found\n";
+ exit;
}
-
-&{"dump_$opts{'t'}"}($opts{'d'});
-
-
+&{"dump_$opts{'t'}"}( $opts{'d'} );
1;
__END__
Index: ispman.getMailForwardsForUser
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.getMailForwardsForUser,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.getMailForwardsForUser 24 Apr 2003 21:31:39 -0000 1.2
+++ ispman.getMailForwardsForUser 30 May 2004 23:35:32 -0000 1.3
@@ -1,22 +1,25 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('du', \%opts);
- unless ($opts{'d'} && $opts{'u'}){
- print "Usage: $FindBin::Script -d domain -u username \n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'du', \%opts );
+ unless ( $opts{'d'} && $opts{'u'} ) {
+ print "Usage: $FindBin::Script -d domain -u username \n";
+ exit;
+ }
}
use ISPMan;
-my $ispman=ISPMan->new();
-my @list=$ispman->as_array($ispman->getMailForwardsForUser($opts{'u'}, $opts{'d'}));
+my $ispman = ISPMan->new();
+my @list =
+ $ispman->as_array(
+ $ispman->getMailForwardsForUser( $opts{'u'}, $opts{'d'} ) );
for (@list) {
- print "$_\n";
+ print "$_\n";
}
-
Index: ispman.addHost
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.addHost,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- ispman.addHost 28 Aug 2003 08:23:03 -0000 1.4
+++ ispman.addHost 30 May 2004 23:35:31 -0000 1.5
@@ -1,14 +1,15 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- unless ($ARGV[1]){
- print "$0 hostname ipAddress [Display Name] [Description]\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ unless ( $ARGV[1] ) {
+ print "$0 hostname ipAddress [Display Name] [Description]\n";
+ exit;
+ }
}
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
+$ispman = ISPMan->new();
$ispman->add_host(@ARGV);
-
Index: ispman.listUserQuotas
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.listUserQuotas,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.listUserQuotas 24 Apr 2003 21:31:40 -0000 1.2
+++ ispman.listUserQuotas 30 May 2004 23:35:32 -0000 1.3
@@ -2,31 +2,32 @@
# exaple script.
# shows users in domain
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
use lib qw(%%installDir%%/lib);
require "cyrusadmin.pm";
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
-
-
-my $uid_filter=$ARGV[0] || '*';
+$ispman = ISPMan->new();
-my $users=$ispman->getEntriesAsHashRef($ispman->{'Config'}{'ldapBaseDN'}, "&(objectclass=ispmanDomainUser)(uid=$uid_filter)");
+my $uid_filter = $ARGV[0] || '*';
+my $users = $ispman->getEntriesAsHashRef( $ispman->{'Config'}{'ldapBaseDN'},
+ "&(objectclass=ispmanDomainUser)(uid=$uid_filter)" );
-USER: for (keys %$users) {
- @uids=$ispman->as_array($users->{$_}{'uid'});
- $uid=$uids[0];
- $mailQuota=$users->{$_}{'mailQuota'};
- $ftpQuota=$users->{$_}{'FTPQuotaMBytes'};
- $mailbox=join "", ($mailbox_prefix, $uid);
- @q=$imap->get_quota($mailbox);
+USER: for ( keys %$users ) {
+ @uids = $ispman->as_array( $users->{$_}{'uid'} );
+ $uid = $uids[0];
+ $mailQuota = $users->{$_}{'mailQuota'};
+ $ftpQuota = $users->{$_}{'FTPQuotaMBytes'};
+ $mailbox = join "", ( $mailbox_prefix, $uid );
+ @q = $imap->get_quota($mailbox);
- write();
+ write();
}
@@ -36,7 +37,6 @@
-------------------------------------------------------------------------------
.
-
format STDOUT =
@<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<< @<<<<<<<<<< @<<<<<<<<<< @<<<<<<<<<<
$uid, $ftpQuota, $mailQuota , $q[2], $q[1]
Index: ispman.addHost2HostGroup
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.addHost2HostGroup,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.addHost2HostGroup 10 May 2002 18:02:45 -0000 1.2
+++ ispman.addHost2HostGroup 30 May 2004 23:35:31 -0000 1.3
@@ -1,10 +1,12 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- unless ($ARGV[1]){
- print "$0 hostgroup hostname\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ unless ( $ARGV[1] ) {
+ print "$0 hostgroup hostname\n";
+ exit;
+ }
}
#need to code it properly.
@@ -12,7 +14,6 @@
use lib qw(%%installDir%%/lib);
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
+$ispman = ISPMan->new();
$ispman->addHost2HostGroup(@ARGV);
-
Index: ispman.getMailGroupAttributeValues
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.getMailGroupAttributeValues,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ispman.getMailGroupAttributeValues 14 May 2003 10:31:07 -0000 1.1
+++ ispman.getMailGroupAttributeValues 30 May 2004 23:35:32 -0000 1.2
@@ -1,17 +1,20 @@
#!/usr/bin/perl
#USAGE: ScriptName domain mailGroup Attribute
-BEGIN{
- print "FOR DEVELOPERS ONLY\n\n";
- print "You may use this command if indicated as part of a support request's response\n";
- print "See source code for USAGE info\n";
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- exit unless $ARGV[2];
-
+BEGIN {
+ print "FOR DEVELOPERS ONLY\n\n";
+ print
+"You may use this command if indicated as part of a support request's response\n";
+ print "See source code for USAGE info\n";
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ exit unless $ARGV[2];
+
}
use ISPMan;
-my $ispman=ISPMan->new();
-print $ispman->dumper($ispman->getMailGroupAttributeValues(@ARGV));
+my $ispman = ISPMan->new();
+print $ispman->dumper( $ispman->getMailGroupAttributeValues(@ARGV) );
print "\n";
Index: ispman.dnsunset
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.dnsunset,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- ispman.dnsunset 11 Feb 2004 17:23:49 -0000 1.10
+++ ispman.dnsunset 30 May 2004 23:35:31 -0000 1.11
@@ -1,171 +1,186 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('dt', \%opts);
- getopt('f:', \%opts);
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'dt', \%opts );
+ getopt( 'f:', \%opts );
- unless ($opts{'d'} && $opts{'t'}){
- print "$0 -d domain -t type more parameters\n";
- print " Examples:\n";
- print " $0 [-v] [-f] -d example.com -t A hostname [ipaddress]\n";
- print " $0 [-v] [-f] -d example.com -t NS origin nameserver\n";
- print " $0 [-v] [-f] -d example.com -t MX origin weight mailserver\n";
- print " $0 [-v] [-f] -d example.com -t CNAME alias host\n";
- print " $0 [-v] [-f] -d example.com -t SOA primary rootmail refresh retry expire minimum\n";
- print "\n";
- exit;
- }
+ unless ( $opts{'d'} && $opts{'t'} ) {
+ print "$0 -d domain -t type more parameters\n";
+ print " Examples:\n";
+ print " $0 [-v] [-f] -d example.com -t A hostname [ipaddress]\n";
+ print " $0 [-v] [-f] -d example.com -t NS origin nameserver\n";
+ print " $0 [-v] [-f] -d example.com -t MX origin weight mailserver\n";
+ print " $0 [-v] [-f] -d example.com -t CNAME alias host\n";
+ print
+" $0 [-v] [-f] -d example.com -t SOA primary rootmail refresh retry expire minimum\n";
+ print "\n";
+ exit;
+ }
}
-
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
+$ispman = ISPMan->new();
-$opts{'t'}=lc($opts{'t'});
+$opts{'t'} = lc( $opts{'t'} );
-if (lc($opts{'d'}) eq "all" || lc($opts{'d'}) eq "any" ) {
- my $domains=$ispman->makeDomainHash($ispman->getDomains("ispmanDomainType=primary"));
- for (keys %$domains) {
- $opts{'d'}=$_;
- &{"unset_$opts{'t'}"}($_);
+if ( lc( $opts{'d'} ) eq "all" || lc( $opts{'d'} ) eq "any" ) {
+ my $domains =
+ $ispman->makeDomainHash(
+ $ispman->getDomains("ispmanDomainType=primary") );
+ for ( keys %$domains ) {
+ $opts{'d'} = $_;
+ &{"unset_$opts{'t'}"}($_);
- $ispman->modifyDnsProcess($_);
- }
+ $ispman->modifyDnsProcess($_);
+ }
-} else {
+}
+else {
- unless ($ispman->branchExists($ispman->getDNSDN($opts{'d'}))){
- print "Note: This domain branch did not exist.\n";
- print "You may still add domains to DNS. but it will not be managed by ispman\n";
- }
+ unless ( $ispman->branchExists( $ispman->getDNSDN( $opts{'d'} ) ) ) {
+ print "Note: This domain branch did not exist.\n";
+ print
+"You may still add domains to DNS. but it will not be managed by ispman\n";
+ }
- &{"unset_$opts{'t'}"};
- $ispman->modifyDnsProcess($opts{'d'});
+ &{"unset_$opts{'t'}"};
+ $ispman->modifyDnsProcess( $opts{'d'} );
}
+sub unset_ns {
+ my $domain = $opts{'d'};
+ my ( $origin, $host ) = @ARGV;
+ my $dn = $ispman->getnSRecordDn( $domain, $origin, $host );
+ if ( $ispman->entryExists($dn) ) {
+ print "$domain: deleting NS record $origin $host\n"
+ if defined $opts{'v'};
+ $ispman->deleteEntry($dn);
+ }
-sub unset_ns {
- my $domain=$opts{'d'};
- my ($origin, $host)=@ARGV;
- my $dn=$ispman->getnSRecordDn($domain, $origin, $host);
-
- if ($ispman->entryExists($dn)){
- print "$domain: deleting NS record $origin $host\n" if defined $opts{'v'};
- $ispman->deleteEntry($dn);
- };
+ #print "Lets see if the branch exists\n";
+ my $b = $ispman->getnSRecordBranchDn( $domain, $host );
+ if ( $ispman->entryExists($b) == 1 ) {
- #print "Lets see if the branch exists\n";
- my $b=$ispman->getnSRecordBranchDn($domain, $host);
- if ($ispman->entryExists($b) == 1){
- #print "Entry exists\n";
- $ispman->deleteEntry($b);
- };
+ #print "Entry exists\n";
+ $ispman->deleteEntry($b);
+ }
}
-
+
sub unset_mx {
- my $domain=$opts{'d'};
- my ($origin, $pref, $host)=@ARGV;
- my $dn=$ispman->getmXRecordDn($domain, $origin, $pref, $host);
-
- if ($ispman->entryExists($dn)){
- print "$domain: deleting MX record $origin $pref $host\n" if defined $opts{'v'};
- $ispman->deleteEntry($dn);
- };
+ my $domain = $opts{'d'};
+ my ( $origin, $pref, $host ) = @ARGV;
+ my $dn = $ispman->getmXRecordDn( $domain, $origin, $pref, $host );
- #print "Lets see if the branch exists\n";
- my $b=$ispman->getmXRecordBranchDn($domain, $pref, $host);
- if ($ispman->entryExists($b) == 1){
- #print "Entry exists\n";
- $ispman->deleteEntry($b);
- };
+ if ( $ispman->entryExists($dn) ) {
+ print "$domain: deleting MX record $origin $pref $host\n"
+ if defined $opts{'v'};
+ $ispman->deleteEntry($dn);
+ }
+
+ #print "Lets see if the branch exists\n";
+ my $b = $ispman->getmXRecordBranchDn( $domain, $pref, $host );
+ if ( $ispman->entryExists($b) == 1 ) {
+
+ #print "Entry exists\n";
+ $ispman->deleteEntry($b);
+ }
}
+sub unset_a {
+ my $domain = $opts{'d'};
+ my ( $host, $ip ) = @ARGV;
+ my $dn;
-sub unset_a {
- my $domain=$opts{'d'};
- my ($host, $ip)=@ARGV;
- my $dn;
-
- my $arecords;
- if ($ip){
- $arecords->[0]={
- 'host' => $host,
- 'ip' => $ip
- };
- } else {
- unless ($opts{'f'}){
- print "Sorry Cannot delete all records for this host\n";
- exit;
- }
- #get all A records for this host
- $arecords=$ispman->getDNSaRecords($domain, $host);
- }
-
- for (@$arecords) {
- $dn=$ispman->getARecordDn($domain, $host, $_->{'ip'});
- if ($ispman->entryExists($dn)){
- print "$domain: deleting A record $host $ip\n" if defined $opts{'v'};
- $ispman->deleteEntry($dn);
- };
+ my $arecords;
+ if ($ip) {
+ $arecords->[0] = {
+ 'host' => $host,
+ 'ip' => $ip
+ };
+ }
+ else {
+ unless ( $opts{'f'} ) {
+ print "Sorry Cannot delete all records for this host\n";
+ exit;
+ }
- #print "Lets see if the branch exists\n";
- my $b=$ispman->getARecordBranchDn($domain, $ip);
- if ($ispman->entryExists($b) == 1){
- #print "Entry exists\n";
- $ispman->deleteEntry($b);
- };
- }
-}
+ #get all A records for this host
+ $arecords = $ispman->getDNSaRecords( $domain, $host );
+ }
+
+ for (@$arecords) {
+ $dn = $ispman->getARecordDn( $domain, $host, $_->{'ip'} );
+ if ( $ispman->entryExists($dn) ) {
+ print "$domain: deleting A record $host $ip\n"
+ if defined $opts{'v'};
+ $ispman->deleteEntry($dn);
+ }
+
+ #print "Lets see if the branch exists\n";
+ my $b = $ispman->getARecordBranchDn( $domain, $ip );
+ if ( $ispman->entryExists($b) == 1 ) {
+ #print "Entry exists\n";
+ $ispman->deleteEntry($b);
+ }
+ }
+}
sub unset_cname {
- my $domain=$opts{'d'};
- my ($alias, $host)=@ARGV;
-
- my $dn;
-
- my $cnames;
- if ($host){
- $arecords->[0]={
- 'host' => $host,
- 'alias' => $alias
- };
- } else {
- unless ($opts{'f'}){
- print "Sorry Cannot delete all records for this cname\n";
- exit;
- }
- #get all A records for this host
- $cnames=$ispman->getDNScNAMERecords($domain);
- }
-
- for (@$cnames) {
- $dn=$ispman->getcNAMERecordDn($domain, $_->{'host'}, $_->{'alias'});
-
- if ($ispman->entryExists($dn)){
- print "$domain: deleting CNAME record $_->{'alias'} -> $_->{'host'}\n" if defined $opts{'v'};
- $ispman->deleteEntry($dn);
- };
+ my $domain = $opts{'d'};
+ my ( $alias, $host ) = @ARGV;
+
+ my $dn;
+
+ my $cnames;
+ if ($host) {
+ $arecords->[0] = {
+ 'host' => $host,
+ 'alias' => $alias
+ };
+ }
+ else {
+ unless ( $opts{'f'} ) {
+ print "Sorry Cannot delete all records for this cname\n";
+ exit;
+ }
+
+ #get all A records for this host
+ $cnames = $ispman->getDNScNAMERecords($domain);
+ }
+
+ for (@$cnames) {
+ $dn = $ispman->getcNAMERecordDn( $domain, $_->{'host'}, $_->{'alias'} );
+
+ if ( $ispman->entryExists($dn) ) {
+ print
+ "$domain: deleting CNAME record $_->{'alias'} -> $_->{'host'}\n"
+ if defined $opts{'v'};
+ $ispman->deleteEntry($dn);
+ }
+
+ #print "Lets see if the branch exists\n";
+ my $b = $ispman->getcNAMERecordBranchDn( $domain, $host );
+ if ( $ispman->entryExists($b) == 1 ) {
+
+ #print "Entry exists\n";
+ $ispman->deleteEntry($b);
+ }
+ }
- #print "Lets see if the branch exists\n";
- my $b=$ispman->getcNAMERecordBranchDn($domain, $host);
- if ($ispman->entryExists($b) == 1){
- #print "Entry exists\n";
- $ispman->deleteEntry($b);
- };
- }
-
}
sub unset_soa {
- print "Sorry deleting of SOA is not supported\n";
- #$ispman->setDNSsOARecord($opts{'d'}, join (" ", $ARGV[0], $ARGV[1], time(), $ARGV[2], $ARGV[3], $ARGV[4], $ARGV[5] ));
- #dns set SOA primary rootmail refresh retry expire minimum
-}
+ print "Sorry deleting of SOA is not supported\n";
+#$ispman->setDNSsOARecord($opts{'d'}, join (" ", $ARGV[0], $ARGV[1], time(), $ARGV[2], $ARGV[3], $ARGV[4], $ARGV[5] ));
+#dns set SOA primary rootmail refresh retry expire minimum
+}
1;
__END__
Index: ispman.getVhostAttribute
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.getVhostAttribute,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ispman.getVhostAttribute 21 Feb 2004 21:31:25 -0000 1.3
+++ ispman.getVhostAttribute 30 May 2004 23:35:32 -0000 1.4
@@ -1,23 +1,24 @@
#!/usr/bin/perl
# For expert use only
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- unless ($ARGV[2]){
- print "For expert use only\n";
-print "$0 domain vhost attributename\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ unless ( $ARGV[2] ) {
+ print "For expert use only\n";
+ print "$0 domain vhost attributename\n";
+ exit;
+ }
}
-
use ISPMan;
-my $ispman=ISPMan->new();
+my $ispman = ISPMan->new();
-my $vals=$ispman->as_arrayref($ispman->getVhostAttribute(@ARGV));
+my $vals = $ispman->as_arrayref( $ispman->getVhostAttribute(@ARGV) );
-for (@$vals){
- print "$_";
+for (@$vals) {
+ print "$_";
}
-
+
print "\n";
Index: ispman.dumpConf
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.dumpConf,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.dumpConf 24 Apr 2003 21:31:39 -0000 1.2
+++ ispman.dumpConf 30 May 2004 23:35:32 -0000 1.3
@@ -1,10 +1,12 @@
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
use ISPMan::Config;
use Data::Dumper;
-$Config=ISPMan::Config->new();
+$Config = ISPMan::Config->new();
print Dumper($Config);
Index: ispman.addMailGroup
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.addMailGroup,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- ispman.addMailGroup 14 Jan 2004 22:45:46 -0000 1.4
+++ ispman.addMailGroup 30 May 2004 23:35:31 -0000 1.5
@@ -1,30 +1,37 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('dfa', \%opts);
- unless ($opts{'d'} && $opts{'f'} && $ARGV[0]){
- print "$FindBin::Script -d domain -f forwardingAddress mailGroupName\n";
- print "\n";
- print "Example:\n";
- print "$FindBin::Script -d domain.tld -f postmaster\@domain.tld abuse\n";
- print "\nThis will create a mailGroup with the address abuse\@domain.tld\n";
- print " and all mails will be forwarded to the email address postmaster\@domain.tld\n\n";
- print "The forwarding address does not need to be in the same domain as the mailGroup\n";
- print "If you want more than one adress in the mailgroup, separate the adresses with two spaces\n";
- print "Like this: -f 'adress1 adress2' \n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'dfa', \%opts );
+ unless ( $opts{'d'} && $opts{'f'} && $ARGV[0] ) {
+ print "$FindBin::Script -d domain -f forwardingAddress mailGroupName\n";
+ print "\n";
+ print "Example:\n";
+ print
+ "$FindBin::Script -d domain.tld -f postmaster\@domain.tld abuse\n";
+ print
+ "\nThis will create a mailGroup with the address abuse\@domain.tld\n";
+ print
+" and all mails will be forwarded to the email address postmaster\@domain.tld\n\n";
+ print
+"The forwarding address does not need to be in the same domain as the mailGroup\n";
+ print
+"If you want more than one adress in the mailgroup, separate the adresses with two spaces\n";
+ print "Like this: -f 'adress1 adress2' \n";
+ exit;
+ }
}
use ISPMan;
use CGI;
-my $r=CGI->new();
-$r->param("ispmanDomain", $opts{"d"});
-$r->param("mailForwardingAddress", $opts{"f"});
-$r->param("cn", $ARGV[0]);
+my $r = CGI->new();
+$r->param( "ispmanDomain", $opts{"d"} );
+$r->param( "mailForwardingAddress", $opts{"f"} );
+$r->param( "cn", $ARGV[0] );
-my $ispman=ISPMan->new();
+my $ispman = ISPMan->new();
$ispman->addMailGroup($r);
-print $ispman->get_mail_groups($opts{'d'});
+print $ispman->get_mail_groups( $opts{'d'} );
Index: ispman.makeDomainDirectories
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.makeDomainDirectories,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- ispman.makeDomainDirectories 7 Oct 2003 15:09:53 -0000 1.4
+++ ispman.makeDomainDirectories 30 May 2004 23:35:32 -0000 1.5
@@ -1,66 +1,85 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('d', \%opts);
- unless ($opts{'d'}){
- print "$FindBin::Script -d domain_name|all \n";
- print " Examples:\n";
- print " $FindBin::Script -d test.dom (create directories for domain test.dom)\n";
- print " $FindBin::Script -d all (create directories for all domains)\n";
- print "\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'd', \%opts );
+ unless ( $opts{'d'} ) {
+ print "$FindBin::Script -d domain_name|all \n";
+ print " Examples:\n";
+ print
+" $FindBin::Script -d test.dom (create directories for domain test.dom)\n";
+ print
+ " $FindBin::Script -d all (create directories for all domains)\n";
+ print "\n";
+ exit;
+ }
}
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
+$ispman = ISPMan->new();
-# defind log_message.
+# defind log_message.
# This is defined in ispman-agent and we should redefine here
sub log_message {
- my $message = join ' ' , @_;
- chomp ($message);
+ my $message = join ' ', @_;
+ chomp($message);
print "$message\n";
}
-
require "create_domain_directories.lib";
require "create_vhost_directories.lib";
require "create_home_directory.lib";
my $domains;
-if (lc($opts{'d'}) eq "all") {
- $domains=$ispman->makeDomainHash($ispman->getDomains('|(ispmanDomainType=primary)(ispmanDomainType=slave)(ispmanDomainType=nodns)'));
-} else {
- $domains->{$opts{'d'}}++;
+if ( lc( $opts{'d'} ) eq "all" ) {
+ $domains = $ispman->makeDomainHash(
+ $ispman->getDomains(
+'|(ispmanDomainType=primary)(ispmanDomainType=slave)(ispmanDomainType=nodns)'
+ )
+ );
}
-
-for $domain (keys %$domains){
- my $domInfo=$ispman->getDomainInfo($domain);
- my $dn=$ispman->getDomainDN($domain);
- &create_domain_directories_handler($domInfo->{'homeDirectory'}, $domInfo->{'uidNumber'}, $domInfo->{'gidNumber'} );
- my $users=$ispman->getEntriesAsHashRef($dn, "objectClass=ispmanDomainUser");
- for $user(keys %$users) {
- my $userInfo=$ispman->getUserInfo($users->{$user}{'uid'});
- &create_home_directory_handler($users->{$user}{'homeDirectory'} , $users->{$user}{'uidNumber'} , $users->{$user}{'gidNumber'});
- }
- my $vhosts=$ispman->getEntriesAsHashRef($dn, "objectClass=ispmanVirtualHost");
- for $vhost(keys %$vhosts) {
- my $vhostInfo=$ispman->getVhostInfo($vhosts->{$vhost}{'ispmanVhostName'}, $vhosts->{$vhost}{'ispmanDomain'});
- &create_vhost_directories_handler(
- $vhosts->{$vhost}{'ispmanVhostName'},
- $domInfo->{'homeDirectory'},
- $vhosts->{$vhost}{'ispmanVhostDocumentRoot'},
- $vhosts->{$vhost}{'ispmanVhostScriptDir'},
- $vhosts->{$vhost}{'uidNumber'} || $domInfo->{'uidNumber'},
- $vhosts->{$vhost}{'gidNumber'} || $domInfo->{'gidNumber'}
- );
- }
+else {
+ $domains->{ $opts{'d'} }++;
}
-
+for $domain ( keys %$domains ) {
+ my $domInfo = $ispman->getDomainInfo($domain);
+ my $dn = $ispman->getDomainDN($domain);
+ &create_domain_directories_handler(
+ $domInfo->{'homeDirectory'},
+ $domInfo->{'uidNumber'},
+ $domInfo->{'gidNumber'}
+ );
+ my $users =
+ $ispman->getEntriesAsHashRef( $dn, "objectClass=ispmanDomainUser" );
+ for $user ( keys %$users ) {
+ my $userInfo = $ispman->getUserInfo( $users->{$user}{'uid'} );
+ &create_home_directory_handler(
+ $users->{$user}{'homeDirectory'},
+ $users->{$user}{'uidNumber'},
+ $users->{$user}{'gidNumber'}
+ );
+ }
+ my $vhosts =
+ $ispman->getEntriesAsHashRef( $dn, "objectClass=ispmanVirtualHost" );
+ for $vhost ( keys %$vhosts ) {
+ my $vhostInfo = $ispman->getVhostInfo(
+ $vhosts->{$vhost}{'ispmanVhostName'},
+ $vhosts->{$vhost}{'ispmanDomain'}
+ );
+ &create_vhost_directories_handler(
+ $vhosts->{$vhost}{'ispmanVhostName'},
+ $domInfo->{'homeDirectory'},
+ $vhosts->{$vhost}{'ispmanVhostDocumentRoot'},
+ $vhosts->{$vhost}{'ispmanVhostScriptDir'},
+ $vhosts->{$vhost}{'uidNumber'} || $domInfo->{'uidNumber'},
+ $vhosts->{$vhost}{'gidNumber'} || $domInfo->{'gidNumber'}
+ );
+ }
+}
1;
__END__
Index: ispman.deleteHostGroup
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.deleteHostGroup,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ispman.deleteHostGroup 28 Aug 2003 08:23:03 -0000 1.3
+++ ispman.deleteHostGroup 30 May 2004 23:35:31 -0000 1.4
@@ -1,9 +1,11 @@
#!/usr/bin/perl
BEGIN {
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
use ISPMan;
-my $ispman=ISPMan->new();
-$ispman->deleteHostGroup($ARGV[0]);
+my $ispman = ISPMan->new();
+$ispman->deleteHostGroup( $ARGV[0] );
Index: ispman.deleteUser
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.deleteUser,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.deleteUser 24 Apr 2003 21:31:38 -0000 1.2
+++ ispman.deleteUser 30 May 2004 23:35:31 -0000 1.3
@@ -1,30 +1,31 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('d', \%opts);
- unless ($ARGV[0] && $ARGV[0] =~ m/\w+@\w+\..*/ ){
- print "Usage: $FindBin::Script user\@domain.tld\n";
- print "\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'd', \%opts );
+ unless ( $ARGV[0] && $ARGV[0] =~ m/\w+@\w+\..*/ ) {
+ print "Usage: $FindBin::Script user\@domain.tld\n";
+ print "\n";
+ exit;
+ }
}
use lib qw(%%installDir%%/lib);
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
-
-($user,$domain)=split('@', $ARGV[0]);
-$ispmanDomain=$domain;
+$ispman = ISPMan->new();
-$domain=~s/\./_/g;
-$uid= join '_', ($user, $domain);
+( $user, $domain ) = split( '@', $ARGV[0] );
+$ispmanDomain = $domain;
+$domain =~ s/\./_/g;
+$uid = join '_', ( $user, $domain );
-my $dn=$ispman->getUserDN($ispmanDomain, $uid);
-if ($ispman->entryExists($dn)) {
- $ispman->killUser($dn);
+my $dn = $ispman->getUserDN( $ispmanDomain, $uid );
+if ( $ispman->entryExists($dn) ) {
+ $ispman->killUser($dn);
}
__END__
Index: ispman.listHostGroupMembers
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.listHostGroupMembers,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.listHostGroupMembers 10 May 2002 12:55:41 -0000 1.2
+++ ispman.listHostGroupMembers 30 May 2004 23:35:32 -0000 1.3
@@ -1,12 +1,14 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
use lib qw(%%installDir%%/lib);
use ISPMan;
-my $ispman=ISPMan->new();
-my $hostGroupMembers=$ispman->getGroupMembers($ARGV[0]);
-for (@$hostGroupMembers){
-print "$_ \n";
+my $ispman = ISPMan->new();
+my $hostGroupMembers = $ispman->getGroupMembers( $ARGV[0] );
+for (@$hostGroupMembers) {
+ print "$_ \n";
}
Index: ispman.dnsload
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.dnsload,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- ispman.dnsload 17 Apr 2004 16:52:15 -0000 1.5
+++ ispman.dnsload 30 May 2004 23:35:31 -0000 1.6
@@ -1,39 +1,38 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('df', \%opts);
- getopt('v:', \%opts);
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'df', \%opts );
+ getopt( 'v:', \%opts );
- unless ($opts{'f'}) {
- print "$0 -d domain -f file\n";
- print "\n";
- exit;
- }
+ unless ( $opts{'f'} ) {
+ print "$0 -d domain -f file\n";
+ print "\n";
+ exit;
+ }
}
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
+$ispman = ISPMan->new();
require "functions/dnsload.functions.pl";
open F, $opts{'f'};
-while (<F>){
-
- @opts=split(/\s\s*/, $_);
-
- if ($opts{'v'}) {
- print "Setting $opts[0] on $opts[1]\n";
- }
-
- $function=join "_", ("set", lc (shift @opts));
- &{$function}(@opts);
-
-}
+while (<F>) {
+ @opts = split( /\s\s*/, $_ );
+ if ( $opts{'v'} ) {
+ print "Setting $opts[0] on $opts[1]\n";
+ }
+ $function = join "_", ( "set", lc( shift @opts ) );
+ &{$function}(@opts);
+
+}
1;
__END__
Index: ispman.addUser
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.addUser,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- ispman.addUser 17 Apr 2004 16:51:10 -0000 1.9
+++ ispman.addUser 30 May 2004 23:35:31 -0000 1.10
@@ -1,106 +1,124 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('qdflmph', \%opts);
- unless ($opts{'d'} && $ARGV[0]){
- print "$FindBin::Script options username\n";
- print "\nRequired options:\n";
- print " -d domain\n";
- print "\nOther options:\n";
- print " -f firstname\n";
- print " -l lastname\n";
- print " -h filehost\tHost where the homeDirectory is created\n";
- print " -m mailhost\tHost where the mailbox is created\n";
- print " -q mailquota\tin MB\n";
- print " -p password\n";
- print "\n";
- print "If -h fileHost is not provided then the default fileserver for this domain will be used\n";
- print " If there is no default fileserver for this domain then the first from the list \n";
- print " of fileservers will be used\n\n";
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'qdflmph', \%opts );
+ unless ( $opts{'d'} && $ARGV[0] ) {
+ print "$FindBin::Script options username\n";
+ print "\nRequired options:\n";
+ print " -d domain\n";
+ print "\nOther options:\n";
+ print " -f firstname\n";
+ print " -l lastname\n";
+ print " -h filehost\tHost where the homeDirectory is created\n";
+ print " -m mailhost\tHost where the mailbox is created\n";
+ print " -q mailquota\tin MB\n";
+ print " -p password\n";
+ print "\n";
+ print
+"If -h fileHost is not provided then the default fileserver for this domain will be used\n";
+ print
+" If there is no default fileserver for this domain then the first from the list \n";
+ print " of fileservers will be used\n\n";
- print "If -m maildropserver is not provided then the default maildrop server for this domain will be used\n";
- print " If there is no default maildropserver for this domain then the first from the list \n";
- print " of maildropservers will be used\n";
- print "If you do not want to create a mailbox for this user then use -m none\n\n";
+ print
+"If -m maildropserver is not provided then the default maildrop server for this domain will be used\n";
+ print
+" If there is no default maildropserver for this domain then the first from the list \n";
+ print " of maildropservers will be used\n";
+ print
+"If you do not want to create a mailbox for this user then use -m none\n\n";
- print "if -p password is not provided then 'secret' will be used as the password\n";
- print "\n";
- exit;
- }
+ print
+"if -p password is not provided then 'secret' will be used as the password\n";
+ print "\n";
+ exit;
+ }
}
-
use ISPMan;
use CGI;
use vars qw($ispman);
-$ispman=ISPMan->new();
-$user =shift @ARGV;
+$ispman = ISPMan->new();
+$user = shift @ARGV;
-my $r=new CGI();
+my $r = new CGI();
# provide defaults when unset
-$opts{'f'}||=$user;
-$opts{'l'}||=$user;
-$opts{'p'}||="secret";
+$opts{'f'} ||= $user;
+$opts{'l'} ||= $user;
+$opts{'p'} ||= "secret";
# fill parameters for addUser
-$r->param("givenName", $opts{"f"});
-$r->param("sn", $opts{"l"});
-$r->param("ispmanDomain", $opts{"d"});
-$r->param("uid", $user);
-$r->param("userPassword", $opts{"p"});
-$r->param("mailQuota", $opts{"q"}) if $opts{"q"};
+$r->param( "givenName", $opts{"f"} );
+$r->param( "sn", $opts{"l"} );
+$r->param( "ispmanDomain", $opts{"d"} );
+$r->param( "uid", $user );
+$r->param( "userPassword", $opts{"p"} );
+$r->param( "mailQuota", $opts{"q"} ) if $opts{"q"};
# check domain
-my $domain=$ispman->getDomainInfo($opts{'d'});
+my $domain = $ispman->getDomainInfo( $opts{'d'} );
-unless ($domain){
+unless ($domain) {
print "unkown domain \"$opts{'d'}\"!\n";
exit 1;
}
# If we dont want to create a mailbox for this user we
# can specify -m none perhaps for just mailforwardings
-unless ($opts{"m"} eq "none") {
- if ($opts{"m"}){
- # there should be some checking here that value of -m is actually
- # a host defined in LDAP
- $r->param("mailHost", $opts{"m"});
+unless ( $opts{"m"} eq "none" ) {
+ if ( $opts{"m"} ) {
- } elsif ($_mailhost=$ispman->getDefaultMailHost($opts{'d'})){
- # see if there is a ispmanDomainDefaultMailDropHost defined
- # for this domain
- $r->param("mailHost", $_mailhost);
+ # there should be some checking here that value of -m is actually
+ # a host defined in LDAP
+ $r->param( "mailHost", $opts{"m"} );
+
+ }
+ elsif ( $_mailhost = $ispman->getDefaultMailHost( $opts{'d'} ) ) {
+
+ # see if there is a ispmanDomainDefaultMailDropHost defined
+ # for this domain
+ $r->param( "mailHost", $_mailhost );
- } else {
- # all failed. die with warning
- print "Automatic detection for mailhost failed\n";
- print "Please either define a mailhost for this user or define\n-m none\n";
- exit;
+ }
+ else {
+
+ # all failed. die with warning
+ print "Automatic detection for mailhost failed\n";
+ print
+ "Please either define a mailhost for this user or define\n-m none\n";
+ exit;
}
}
# We need to know on which host to create the homeDirectory for this user.
# We can have one or more fileservers.
-unless ($opts{"h"} eq "none") {
- if ($opts{"h"}){
- # there should be some checking here that value of -h is actually
- # a host defined in LDAP
- $r->param("fileHost", $opts{"h"});
+unless ( $opts{"h"} eq "none" ) {
+ if ( $opts{"h"} ) {
- } elsif ($_filehost=$ispman->getDefaultFileHost($opts{"d"})){
- # get fileHost suggestio
- $r->param("fileHost", $_filehost);
+ # there should be some checking here that value of -h is actually
+ # a host defined in LDAP
+ $r->param( "fileHost", $opts{"h"} );
- } else {
- # all failed. die with warning
- print "Please define a filehost for this user where the homedirectory should be created with the -h switch \n";
- exit;
}
-}
+ elsif ( $_filehost = $ispman->getDefaultFileHost( $opts{"d"} ) ) {
+
+ # get fileHost suggestio
+ $r->param( "fileHost", $_filehost );
+ }
+ else {
+
+ # all failed. die with warning
+ print
+"Please define a filehost for this user where the homedirectory should be created with the -h switch \n";
+ exit;
+ }
+}
$ispman->addUser($r);
Index: ispman.deletevhost
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.deletevhost,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ispman.deletevhost 10 May 2002 12:55:41 -0000 1.3
+++ ispman.deletevhost 30 May 2004 23:35:31 -0000 1.4
@@ -1,20 +1,22 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('d', \%opts);
- unless ($opts{'d'} && $ARGV[0]){
- print "$0 -d domain vhost";
- print "\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'd', \%opts );
+ unless ( $opts{'d'} && $ARGV[0] ) {
+ print "$0 -d domain vhost";
+ print "\n";
+ exit;
+ }
}
use lib qw(%%installDir%%/lib);
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
-$ispman->delete_vhost(shift @ARGV, $opts{'d'});
+$ispman = ISPMan->new();
+$ispman->delete_vhost( shift @ARGV, $opts{'d'} );
__END__
Index: ldifsort
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ldifsort,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ldifsort 6 May 2002 19:17:13 -0000 1.1
+++ ldifsort 30 May 2004 23:35:32 -0000 1.2
@@ -52,52 +52,53 @@
use strict;
my %args;
-getopts("k:nd", \%args);
+getopts( "k:nd", \%args );
-my $keyattr = $args{k};
+my $keyattr = $args{k};
my $ldiffile = $ARGV[0];
die "usage: $0 -k keyattr [-n] [-d] ldiffile\n"
- unless $keyattr && $ldiffile;
+ unless $keyattr && $ldiffile;
$/ = "";
-open(LDIFH, $ldiffile) || die "$ldiffile: $!\n";
+open( LDIFH, $ldiffile ) || die "$ldiffile: $!\n";
my $pos = 0;
my @valuepos;
while (<LDIFH>) {
- my $value;
- 1 while s/^($keyattr:.*)?\n /$1/im; # Handle line continuations
- if (/^$keyattr(::?) (.*)$/im) {
- $value = $2;
- $value = decode_base64($value) if $1 eq '::';
- }
- push @valuepos, [ $value, $pos ];
- $pos = tell;
+ my $value;
+ 1 while s/^($keyattr:.*)?\n /$1/im; # Handle line continuations
+ if (/^$keyattr(::?) (.*)$/im) {
+ $value = $2;
+ $value = decode_base64($value) if $1 eq '::';
+ }
+ push @valuepos, [ $value, $pos ];
+ $pos = tell;
}
-sub cmpattr { $a->[0] cmp $b->[0] }
+sub cmpattr { $a->[0] cmp $b->[0] }
sub cmpattrnum { $a->[0] <=> $b->[0] }
my %canonicaldns;
-sub cmpdn {
- my $cadn = ($canonicaldns{$a->[0]} ||= canonical_dn($a->[0]));
- my $cbdn = ($canonicaldns{$b->[0]} ||= canonical_dn($b->[0]));
- $cadn cmp $cbdn;
+
+sub cmpdn {
+ my $cadn = ( $canonicaldns{ $a->[0] } ||= canonical_dn( $a->[0] ) );
+ my $cbdn = ( $canonicaldns{ $b->[0] } ||= canonical_dn( $b->[0] ) );
+ $cadn cmp $cbdn;
}
my $cmpfunc;
-if ($args{d} || lc($keyattr) eq 'dn') { $cmpfunc = \&cmpdn }
-elsif ($args{n}) { $cmpfunc = \&cmpattrnum }
+if ( $args{d} || lc($keyattr) eq 'dn' ) { $cmpfunc = \&cmpdn }
+elsif ( $args{n} ) { $cmpfunc = \&cmpattrnum }
else { $cmpfunc = \&cmpattr; }
my @sorted;
@sorted = sort $cmpfunc @valuepos;
foreach my $valuepos (@sorted) {
- seek(LDIFH, $valuepos->[1], 0);
- my $entry = <LDIFH>;
- print $entry;
- print "\n" if $entry !~ /\n\n$/;
+ seek( LDIFH, $valuepos->[1], 0 );
+ my $entry = <LDIFH>;
+ print $entry;
+ print "\n" if $entry !~ /\n\n$/;
}
Index: ispman.deleteClient
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.deleteClient,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ispman.deleteClient 10 Feb 2004 18:28:40 -0000 1.1
+++ ispman.deleteClient 30 May 2004 23:35:31 -0000 1.2
@@ -1,13 +1,15 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- unless ($ARGV[0]){
- print "$0 ClientID\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ unless ( $ARGV[0] ) {
+ print "$0 ClientID\n";
+ exit;
+ }
}
use lib qw(%%installDir%%/lib);
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
-$ispman->DeleteClient($ARGV[0]);
+$ispman = ISPMan->new();
+$ispman->DeleteClient( $ARGV[0] );
Index: ispman.listHosts
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.listHosts,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ispman.listHosts 10 May 2002 12:55:41 -0000 1.3
+++ ispman.listHosts 30 May 2004 23:35:32 -0000 1.4
@@ -1,12 +1,14 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
use lib qw(%%installDir%%/lib);
use ISPMan;
-my $ispman=ISPMan->new();
-my $hosts=$ispman->getHosts();
-for (keys %$hosts){
- print "$hosts->{$_}{'ispmanHostName'}\n";
+my $ispman = ISPMan->new();
+my $hosts = $ispman->getHosts();
+for ( keys %$hosts ) {
+ print "$hosts->{$_}{'ispmanHostName'}\n";
}
Index: ispman.domainmail
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.domainmail,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.domainmail 9 May 2002 04:30:14 -0000 1.2
+++ ispman.domainmail 30 May 2004 23:35:32 -0000 1.3
@@ -1,105 +1,109 @@
#!/usr/bin/perl
package ISPMan;
+
BEGIN {
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopts('vns:f:d:m:', \%opts);
- unless ($opts{'d'} && $opts{'m'}){
- print "Usage: $FindBin::Script. [-v] -d domainName|all -s 'subject' -m file_with_the_email_text [-f 'Name <email>']\n";
- exit;
- }
- unless ($opts{'s'}) {
- print "Are you sure you want to send a mass email without a subject?\nI dont think so.\n";
- exit;
- }
- unless ($opts{'f'}) {
- print "You have not defined a sender address.\nI will use whatever email is defined in LDAP as rootEmail.\n";
- print "You can check this email with the command ispman.getConf rootEmail.\n";
- print "Are you sure you want to send this mail with the rootEmail address [y/N]: ";
- chomp (my $ans=<>);
- unless ($ans=~/^y/i){
- exit;
- }
- }
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopts( 'vns:f:d:m:', \%opts );
+ unless ( $opts{'d'} && $opts{'m'} ) {
+ print
+"Usage: $FindBin::Script. [-v] -d domainName|all -s 'subject' -m file_with_the_email_text [-f 'Name <email>']\n";
+ exit;
+ }
+ unless ( $opts{'s'} ) {
+ print
+"Are you sure you want to send a mass email without a subject?\nI dont think so.\n";
+ exit;
+ }
+ unless ( $opts{'f'} ) {
+ print
+"You have not defined a sender address.\nI will use whatever email is defined in LDAP as rootEmail.\n";
+ print
+"You can check this email with the command ispman.getConf rootEmail.\n";
+ print
+"Are you sure you want to send this mail with the rootEmail address [y/N]: ";
+ chomp( my $ans = <> );
+ unless ( $ans =~ /^y/i ) {
+ exit;
+ }
+ }
}
-
$|++;
undef $/;
use lib qw(%%installDir%%/lib);
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %opts $Config $from $subject $domain) ;
+use vars
+ qw($VERSION @ISA @EXPORT @EXPORT_OK %opts $Config $from $subject $domain);
use Net::SMTP;
use ISPMan::LDAP;
require "ispman.conf";
-
-
-
-open M , $opts{'m'};
-my $mailText=join "" , <M>;
+open M, $opts{'m'};
+my $mailText = join "", <M>;
close(M);
-
-
-
-
-
-
-my $ldap=ISPMan::LDAP->new($Config->{'ldapBaseDN'}, $Config->{'ldapHost'}, $Config->{'ldapRootDN'},$Config->{'ldapRootPass'});
-$ldap->setConfig($Config); #pass config to ISPMan::LDAP
-if (! $ldap->connected()){
- $ldap->connect();
+my $ldap = ISPMan::LDAP->new(
+ $Config->{'ldapBaseDN'}, $Config->{'ldapHost'},
+ $Config->{'ldapRootDN'}, $Config->{'ldapRootPass'}
+);
+$ldap->setConfig($Config); #pass config to ISPMan::LDAP
+if ( !$ldap->connected() ) {
+ $ldap->connect();
}
-my $domain=(lc($opts{'d'}) eq "all")? '*' : $opts{'d'};
-
-my $users=$ldap->getEntriesAsHashRef($Config->{"ldapBaseDN"}, "&(ispmanDomain=$domain)(objectclass=ispmanDomainUser)", ["uid", "cn", "mailLocalAddress", "mailAlias", "mailRoutingAddress"]);
+my $domain = ( lc( $opts{'d'} ) eq "all" ) ? '*' : $opts{'d'};
+my $users = $ldap->getEntriesAsHashRef(
+ $Config->{"ldapBaseDN"},
+ "&(ispmanDomain=$domain)(objectclass=ispmanDomainUser)",
+ [ "uid", "cn", "mailLocalAddress", "mailAlias", "mailRoutingAddress" ]
+);
-my $mailhost=$self->{'Config'}{"mailhost"}|| "localhost";
-my $smtp = Net::SMTP->new($mailhost);
+my $mailhost = $self->{'Config'}{"mailhost"} || "localhost";
+my $smtp = Net::SMTP->new($mailhost);
-$subject=$opts{'s'} || "No Subject";
-$from = $opts{'f'} || $ldap->getConf('rootEmail');
+$subject = $opts{'s'} || "No Subject";
+$from = $opts{'f'} || $ldap->getConf('rootEmail');
print "Sending email to users for $opts{'d'} domain\n";
print "Sending from $from\n";
+for ( keys %$users ) {
+ $mailAddress = $users->{$_}{'mailRoutingAddress'}
+ || $users->{$_}{'mailLocalAddressxx'};
+ $cn = $users->{$_}{'cn'};
-for (keys %$users) {
- $mailAddress=$users->{$_}{'mailRoutingAddress'} || $users->{$_}{'mailLocalAddressxx'};
- $cn=$users->{$_}{'cn'};
-
-
-
- if ($mailAddress) {
- print "Sending mail to $mailAddress for $users->{$_}{'cn'}\n" if $opts{'v'} || $opts{'n'};
- &send_user_mail($mailAddress, $mailText) unless $opts{'n'};
- } else {
- print STDERR "Not sending mail to ", $users->{$_}{'uid'} , " ($users->{$_}{'cn'}). No mailRoutingAddress or mailLocalAddress defined\n";
- }
+ if ($mailAddress) {
+ print "Sending mail to $mailAddress for $users->{$_}{'cn'}\n"
+ if $opts{'v'} || $opts{'n'};
+ &send_user_mail( $mailAddress, $mailText ) unless $opts{'n'};
+ }
+ else {
+ print STDERR "Not sending mail to ", $users->{$_}{'uid'},
+" ($users->{$_}{'cn'}). No mailRoutingAddress or mailLocalAddress defined\n";
+ }
}
-
sub send_user_mail {
- my ($to, $data)=@_;
+ my ( $to, $data ) = @_;
- $smtp->mail($from);
- $smtp->to($to);
- $smtp->data();
+ $smtp->mail($from);
+ $smtp->to($to);
+ $smtp->data();
- $smtp->datasend("From: $from\n");
- $smtp->datasend("To: $to \n");
- $smtp->datasend("Subject: $subject \n");
- $smtp->datasend("\n");
- $smtp->datasend($data);
- $smtp->dataend();
- $smtp->quit;
+ $smtp->datasend("From: $from\n");
+ $smtp->datasend("To: $to \n");
+ $smtp->datasend("Subject: $subject \n");
+ $smtp->datasend("\n");
+ $smtp->datasend($data);
+ $smtp->dataend();
+ $smtp->quit;
}
-sub log_event {1;};
-
+sub log_event { 1; }
__END__
Index: ispman.setVar
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.setVar,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- ispman.setVar 2 Aug 2003 05:50:21 -0000 1.5
+++ ispman.setVar 30 May 2004 23:35:32 -0000 1.6
@@ -1,23 +1,24 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('mh', \%opts);
- unless ($opts{'m'} && $ARGV[1] || $opts{'h'} ){
- print "USAGE: $0 -m module_name variable_name value\n\n";
- print "Example:\n";
- print "$0 -m sys_vars sleepSecondsBetweenRestart 2\n";
- print "\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'mh', \%opts );
+ unless ( $opts{'m'} && $ARGV[1] || $opts{'h'} ) {
+ print "USAGE: $0 -m module_name variable_name value\n\n";
+ print "Example:\n";
+ print "$0 -m sys_vars sleepSecondsBetweenRestart 2\n";
+ print "\n";
+ exit;
+ }
}
-
use lib qw(%%installDir%%/lib);
use ISPMan;
-my $ispman=ISPMan->new();
-my $var= shift @ARGV;
-$ispman->setConfVar($opts{'m'}, $var, join " ", @ARGV);
+my $ispman = ISPMan->new();
+my $var = shift @ARGV;
+$ispman->setConfVar( $opts{'m'}, $var, join " ", @ARGV );
__END__
Index: ispman.postfix.makemaps
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.postfix.makemaps,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- ispman.postfix.makemaps 8 Oct 2003 13:59:13 -0000 1.8
+++ ispman.postfix.makemaps 30 May 2004 23:35:32 -0000 1.9
@@ -1,41 +1,46 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
use ISPMan;
use vars qw($ispman $smtpServerConfDir);
-$ispman=ISPMan->new();
-
+$ispman = ISPMan->new();
-$smtpServerConfDir=$ispman->getConf("smtpServerConfDir");
-$smtp_lib=join "/", ($ispman->getConf("installDir"), "lib/smtp.lib");
+$smtpServerConfDir = $ispman->getConf("smtpServerConfDir");
+$smtp_lib = join "/", ( $ispman->getConf("installDir"), "lib/smtp.lib" );
require $smtp_lib;
-
showDomains($ispman);
sub showDomains {
- my $domains=$ispman->makeDomainHash($ispman->getDomains());
- my $canonical_map=();
- my $relay_map=();
- my $dest_map=();
- my $transport_map=();
- for (keys %$domains){
- next unless $_;
- $domain_info=$ispman->getDomainInfo($_);
- #$relay_map->{$_}=$_ if ($domain_info->{'ispmanDomainMailDeliveryMethod'} eq "smtp");
- #Allow relaying from these domains.
- $relay_map->{$_}=$_;
- $dest_map->{$_}=$_ if grep (/mail/, $ispman->as_array($domain_info->{'ispmanDomainService'}));
- $canonical_map->{"\@$_"}=join "", ('@', $domain_info->{'ispmanReplicaMaster'}) if $domain_info->{'ispmanReplicaMaster'};
- $transport_map->{$_}=$ispman->getTransportMap($_);
- }
- write_map("$smtpServerConfDir/canonical", $canonical_map);
- write_map("$smtpServerConfDir/relay_domains", $relay_map);
- write_map("$smtpServerConfDir/destination_domains", $dest_map);
- write_map("$smtpServerConfDir/transport_domains", $transport_map);
+ my $domains = $ispman->makeDomainHash( $ispman->getDomains() );
+ my $canonical_map = ();
+ my $relay_map = ();
+ my $dest_map = ();
+ my $transport_map = ();
+ for ( keys %$domains ) {
+ next unless $_;
+ $domain_info = $ispman->getDomainInfo($_);
+
+#$relay_map->{$_}=$_ if ($domain_info->{'ispmanDomainMailDeliveryMethod'} eq "smtp");
+#Allow relaying from these domains.
+ $relay_map->{$_} = $_;
+ $dest_map->{$_} = $_
+ if grep ( /mail/,
+ $ispman->as_array( $domain_info->{'ispmanDomainService'} ) );
+ $canonical_map->{"\@$_"} = join "",
+ ( '@', $domain_info->{'ispmanReplicaMaster'} )
+ if $domain_info->{'ispmanReplicaMaster'};
+ $transport_map->{$_} = $ispman->getTransportMap($_);
+ }
+ write_map( "$smtpServerConfDir/canonical", $canonical_map );
+ write_map( "$smtpServerConfDir/relay_domains", $relay_map );
+ write_map( "$smtpServerConfDir/destination_domains", $dest_map );
+ write_map( "$smtpServerConfDir/transport_domains", $transport_map );
}
1;
Index: ispman.listResellers
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.listResellers,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.listResellers 24 Apr 2003 21:31:40 -0000 1.2
+++ ispman.listResellers 30 May 2004 23:35:32 -0000 1.3
@@ -1,26 +1,26 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
use lib qw(%%installDir%%/lib);
use ISPMan;
-my $ispman=ISPMan->new();
-my $resellers=$ispman->getResellers();
+my $ispman = ISPMan->new();
+my $resellers = $ispman->getResellers();
-for (keys %$resellers){
- $reseller=$resellers->{$_};
- write();
+for ( keys %$resellers ) {
+ $reseller = $resellers->{$_};
+ write();
}
-
format STDOUT_TOP =
ResellerID UID ResellerName CN
--------------------------------------------------------------------------
.
-
format STDOUT =
@<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<
$reseller->{'ispmanResellerId'}, $reseller->{'uid'}, $reseller->{'ispmanResellerName'}, $reseller->{'cn'}
Index: ispman.deleteMailbox
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.deleteMailbox,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ispman.deleteMailbox 24 Apr 2003 21:31:38 -0000 1.3
+++ ispman.deleteMailbox 30 May 2004 23:35:31 -0000 1.4
@@ -1,25 +1,26 @@
#!/usr/bin/perl
use lib qw(%%installDir%%/lib);
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- unless (@ARGV) {
- $0=~s/.*\///;
- print "Usage: $0 -h host mailbox [mailbox] [mailbox] .. [mailbox]\n";
- exit;
- }
+
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ unless (@ARGV) {
+ $0 =~ s/.*\///;
+ print "Usage: $0 -h host mailbox [mailbox] [mailbox] .. [mailbox]\n";
+ exit;
+ }
}
require "cyrusadmin.pm";
[email protected]=@ARGV;
-
[email protected] = @ARGV;
-for $mailbox(@mailboxes){
- $mailbox="$mailbox_prefix$mailbox";
- try($imap->set_acl($mailbox, $admin, "lrswipdca"));
- try($imap->delete($mailbox));
+for $mailbox (@mailboxes) {
+ $mailbox = "$mailbox_prefix$mailbox";
+ try( $imap->set_acl( $mailbox, $admin, "lrswipdca" ) );
+ try( $imap->delete($mailbox) );
}
-
exit;
__END__
Index: ispman.setVhostAttribute
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.setVhostAttribute,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.setVhostAttribute 18 Jan 2004 13:04:10 -0000 1.2
+++ ispman.setVhostAttribute 30 May 2004 23:35:32 -0000 1.3
@@ -1,16 +1,17 @@
#!/usr/bin/perl
# For expert use only
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- unless ($ARGV[3]){
- print "For expert use only\n";
-print "$0 domain vhost attributename value [value]\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ unless ( $ARGV[3] ) {
+ print "For expert use only\n";
+ print "$0 domain vhost attributename value [value]\n";
+ exit;
+ }
}
-
use ISPMan;
-my $ispman=ISPMan->new();
+my $ispman = ISPMan->new();
$ispman->setVhostAttribute(@ARGV);
Index: ispman.getDomainAttribute
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.getDomainAttribute,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ispman.getDomainAttribute 17 Aug 2003 20:38:13 -0000 1.3
+++ ispman.getDomainAttribute 30 May 2004 23:35:32 -0000 1.4
@@ -1,16 +1,17 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- unless ($ARGV[1]){
- print "$0 domain attributename\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ unless ( $ARGV[1] ) {
+ print "$0 domain attributename\n";
+ exit;
+ }
}
-
use ISPMan;
-my $ispman=ISPMan->new();
+my $ispman = ISPMan->new();
print $ispman->getDomainAttribute(@ARGV);
print "\n";
Index: ispman.listMailGroups
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.listMailGroups,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ispman.listMailGroups 14 May 2003 10:31:07 -0000 1.1
+++ ispman.listMailGroups 30 May 2004 23:35:32 -0000 1.2
@@ -1,16 +1,18 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('d', \%opts);
- unless ($opts{'d'}){
- print "$0 -d domain";
- print "\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'd', \%opts );
+ unless ( $opts{'d'} ) {
+ print "$0 -d domain";
+ print "\n";
+ exit;
+ }
}
use ISPMan;
-my $ispman=ISPMan->new();
-print $ispman->dumper($ispman->get_mail_groups($opts{'d'}));
+my $ispman = ISPMan->new();
+print $ispman->dumper( $ispman->get_mail_groups( $opts{'d'} ) );
print "\n";
Index: ispman.createSubMailbox
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.createSubMailbox,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ispman.createSubMailbox 28 Aug 2003 07:25:56 -0000 1.1
+++ ispman.createSubMailbox 30 May 2004 23:35:31 -0000 1.2
@@ -5,55 +5,55 @@
# such as *_ispman_org : default: *
# and the name of the folder to create such as Junk, Spam etc
-
-
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- require "cyrusadmin.pm";
- unless ($ARGV[1]){
- print "I need 2 paramters\n";
- print "uid_filter: such as '*' or '*_some_domain'\n";
- print "mailbox: the submailbox to create under INBOX\n";
- exit;
- }
- if ($ARGV[1]=~/[^a-z0-9-_]/i) {
- print "bad mailbox syntax. Only a-z, A-Z, 0-9, - , _ allowed\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ require "cyrusadmin.pm";
+ unless ( $ARGV[1] ) {
+ print "I need 2 paramters\n";
+ print "uid_filter: such as '*' or '*_some_domain'\n";
+ print "mailbox: the submailbox to create under INBOX\n";
+ exit;
+ }
+ if ( $ARGV[1] =~ /[^a-z0-9-_]/i ) {
+ print "bad mailbox syntax. Only a-z, A-Z, 0-9, - , _ allowed\n";
+ exit;
+ }
}
-
-
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
+$ispman = ISPMan->new();
+my $uid_filter = $ARGV[0];
+my $folder = $ARGV[1];
-my $uid_filter=$ARGV[0];
-my $folder = $ARGV[1];
+my $users = $ispman->getEntriesAsHashRef( $ispman->{'Config'}{'ldapBaseDN'},
+ "&(objectclass=ispmanDomainUser)(uid=$uid_filter)" );
+USER: for ( keys %$users ) {
+ @uids = $ispman->as_array( $users->{$_}{'uid'} );
+ $uid = $uids[0];
+ $mailbox = join "", ( $mailbox_prefix, $uid );
+ if ( $imap->list($mailbox) ) {
-my $users=$ispman->getEntriesAsHashRef($ispman->{'Config'}{'ldapBaseDN'}, "&(objectclass=ispmanDomainUser)(uid=$uid_filter)");
+ # mailbox exists. Lets continue
+ if ( $imap->list( join '.', ( $mailbox, $folder ) ) ) {
-USER: for (keys %$users) {
- @uids=$ispman->as_array($users->{$_}{'uid'});
- $uid=$uids[0];
- $mailbox=join "", ($mailbox_prefix, $uid);
- if ($imap->list($mailbox)) {
- # mailbox exists. Lets continue
-
- if ($imap->list(join '.', ($mailbox, $folder))) {
- # Already Exists
- print "$folder on $mailbox already exists. Skipping\n";
- } else {
- try($imap->set_acl($mailbox, $admin, "lrswipdca"));
- print "Creating $folder on $mailbox\n";
- try($imap->create(join '.', ($mailbox, $folder)));
- }
-
- } else {
- print "Skipping $mailbox. It does not exists\n";
- }
+ # Already Exists
+ print "$folder on $mailbox already exists. Skipping\n";
+ }
+ else {
+ try( $imap->set_acl( $mailbox, $admin, "lrswipdca" ) );
+ print "Creating $folder on $mailbox\n";
+ try( $imap->create( join '.', ( $mailbox, $folder ) ) );
+ }
+
+ }
+ else {
+ print "Skipping $mailbox. It does not exists\n";
+ }
}
Index: ispman.getClientsCount
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.getClientsCount,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.getClientsCount 24 Apr 2003 21:31:39 -0000 1.2
+++ ispman.getClientsCount 30 May 2004 23:35:32 -0000 1.3
@@ -1,19 +1,20 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('r', \%opts);
- unless ( $opts{'r'}){
- print "$FindBin::Script -r ResellerID ";
- print "\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'r', \%opts );
+ unless ( $opts{'r'} ) {
+ print "$FindBin::Script -r ResellerID ";
+ print "\n";
+ exit;
+ }
}
use lib qw(%%installDir%%/lib);
use ISPMan;
-my $ispman=ISPMan->new();
+my $ispman = ISPMan->new();
print $ispman->getClientsCount("ispmanResellerId=$opts{'r'}");
print "\n";
-
Index: ispman.getUsersCount
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.getUsersCount,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.getUsersCount 24 Apr 2003 21:31:40 -0000 1.2
+++ ispman.getUsersCount 30 May 2004 23:35:32 -0000 1.3
@@ -1,14 +1,15 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
-
use lib qw(%%installDir%%/lib);
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
+$ispman = ISPMan->new();
print $ispman->getUsersCount(), "\n";
Index: ispman.addMailAliasForUser
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.addMailAliasForUser,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.addMailAliasForUser 24 Apr 2003 21:31:37 -0000 1.2
+++ ispman.addMailAliasForUser 30 May 2004 23:35:31 -0000 1.3
@@ -1,20 +1,22 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('du', \%opts);
- unless ($opts{'d'} && $opts{'u'} && $ARGV[0]){
- print "Usage: $FindBin::Script -d domain -u username alias alias alias\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'du', \%opts );
+ unless ( $opts{'d'} && $opts{'u'} && $ARGV[0] ) {
+ print
+ "Usage: $FindBin::Script -d domain -u username alias alias alias\n";
+ exit;
+ }
}
use ISPMan;
-my $ispman=ISPMan->new();
-$ispman->addMailAliasForUser($opts{'u'}, $opts{'d'}, \@ARGV);
+my $ispman = ISPMan->new();
+$ispman->addMailAliasForUser( $opts{'u'}, $opts{'d'}, \@ARGV );
print "OK\n";
-
Index: ispman.replaceMailAliasForUser
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.replaceMailAliasForUser,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.replaceMailAliasForUser 24 Apr 2003 21:31:41 -0000 1.2
+++ ispman.replaceMailAliasForUser 30 May 2004 23:35:32 -0000 1.3
@@ -1,21 +1,24 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('du', \%opts);
- unless ($opts{'d'} && $opts{'u'} && $ARGV[0]){
- print "Usage: $FindBin::Script -d domain -u username alias alias alias\n";
- print "Note: This command deletes all Aliases and adds the alias(es) specified\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'du', \%opts );
+ unless ( $opts{'d'} && $opts{'u'} && $ARGV[0] ) {
+ print
+ "Usage: $FindBin::Script -d domain -u username alias alias alias\n";
+ print
+"Note: This command deletes all Aliases and adds the alias(es) specified\n";
+ exit;
+ }
}
use ISPMan;
-my $ispman=ISPMan->new();
-$ispman->replaceMailAliasForUser($opts{'u'}, $opts{'d'}, \@ARGV);
+my $ispman = ISPMan->new();
+$ispman->replaceMailAliasForUser( $opts{'u'}, $opts{'d'}, \@ARGV );
print "OK\n";
-
Index: ispman.createMailbox
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.createMailbox,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- ispman.createMailbox 5 May 2003 14:17:48 -0000 1.4
+++ ispman.createMailbox 30 May 2004 23:35:31 -0000 1.5
@@ -1,35 +1,35 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- unless (@ARGV) {
- $0=~s/.*\///;
- print "Usage: $0 -h host mailbox [mailbox] [mailbox] .. [mailbox]\n";
- print "Example: $FindBin::Script -h localhost user_domain_tld\n";
- print "Example: $FindBin::Script -h localhost user\@domain.tld\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ unless (@ARGV) {
+ $0 =~ s/.*\///;
+ print "Usage: $0 -h host mailbox [mailbox] [mailbox] .. [mailbox]\n";
+ print "Example: $FindBin::Script -h localhost user_domain_tld\n";
+ print "Example: $FindBin::Script -h localhost user\@domain.tld\n";
+ exit;
+ }
}
require "cyrusadmin.pm";
use lib qw(%%installDir%%/lib);
[email protected] = @ARGV;
[email protected]=@ARGV;
-
-for (@mailboxes){
- $mailbox=join '', ($mailbox_prefix, email2uid($_));
- try($imap->create($mailbox));
+for (@mailboxes) {
+ $mailbox = join '', ( $mailbox_prefix, email2uid($_) );
+ try( $imap->create($mailbox) );
}
-
sub email2uid {
- my $str=shift;
- ($uid,$domain)=split('@', $str);
- if ($domain) {
- $domain=~s/\./_/g;
- $str = join '_', ($uid, $domain);
- }
- return $str;
+ my $str = shift;
+ ( $uid, $domain ) = split( '@', $str );
+ if ($domain) {
+ $domain =~ s/\./_/g;
+ $str = join '_', ( $uid, $domain );
+ }
+ return $str;
}
exit;
Index: ispman.setMailboxQuota
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.setMailboxQuota,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ispman.setMailboxQuota 28 Aug 2003 08:23:03 -0000 1.3
+++ ispman.setMailboxQuota 30 May 2004 23:35:32 -0000 1.4
@@ -1,20 +1,19 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- unless (@ARGV) {
- $0=~s/.*\///;
- print "Usage: $0 -h host mailbox quota\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ unless (@ARGV) {
+ $0 =~ s/.*\///;
+ print "Usage: $0 -h host mailbox quota\n";
+ exit;
+ }
}
require "cyrusadmin.pm";
-
-
-$mailbox=join "", ($mailbox_prefix, $ARGV[0]);
+$mailbox = join "", ( $mailbox_prefix, $ARGV[0] );
$quota = $ARGV[1];
-try ($imap->set_quota($mailbox, $quota));
-
+try( $imap->set_quota( $mailbox, $quota ) );
exit;
Index: ispman.listAdmins
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.listAdmins,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ispman.listAdmins 10 May 2002 12:46:42 -0000 1.1
+++ ispman.listAdmins 30 May 2004 23:35:32 -0000 1.2
@@ -1,19 +1,19 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
-
use lib qw(%%installDir%%/lib);
-
use ISPMan;
-my $ispman=ISPMan->new();
-$admins=$ispman->getAdmins();
+my $ispman = ISPMan->new();
+$admins = $ispman->getAdmins();
-for (sort keys %$admins){
- $admin=$admins->{$_};
- write();
+for ( sort keys %$admins ) {
+ $admin = $admins->{$_};
+ write();
}
format STDOUT_TOP =
@@ -22,7 +22,6 @@
---------------------------------------------------------------------------
.
-
format STDOUT =
@<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<< @<<<
$admin->{'uid'}, $admin->{'cn'}, $admin->{'ispmanSysadminMail'}, $admin->{'ispmanSysadminLevel'}
Index: ispman.deleteSession
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.deleteSession,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- ispman.deleteSession 1 Oct 2003 15:13:08 -0000 1.4
+++ ispman.deleteSession 30 May 2004 23:35:31 -0000 1.5
@@ -1,20 +1,20 @@
#!/usr/bin/perl
BEGIN {
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
use lib qw(%%installDir%%/lib);
use ISPMan;
-my $ispman=ISPMan->new();
+my $ispman = ISPMan->new();
exit unless @ARGV;
-for $session(@ARGV){
- my $dn="ispmanSession=$session, ou=processes, $ispman->{'Config'}{'ldapBaseDN'}";
- print "Deleting tree $dn\n";
- $ispman->delTree($dn);
+for $session (@ARGV) {
+ my $dn =
+ "ispmanSession=$session, ou=processes, $ispman->{'Config'}{'ldapBaseDN'}";
+ print "Deleting tree $dn\n";
+ $ispman->delTree($dn);
}
-
-
-
__END__
Index: ispman.addMailGroupAttributeValues
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.addMailGroupAttributeValues,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ispman.addMailGroupAttributeValues 14 May 2003 10:31:07 -0000 1.1
+++ ispman.addMailGroupAttributeValues 30 May 2004 23:35:31 -0000 1.2
@@ -1,19 +1,22 @@
#!/usr/bin/perl
#USAGE: ScriptName domain mailGroup Attribute
-BEGIN{
- print "FOR DEVELOPERS ONLY\n\n";
- print "You may use this command if indicated as part of a support request's response\n";
- print "See source code for USAGE info\n";
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- exit unless $ARGV[3];
-
+BEGIN {
+ print "FOR DEVELOPERS ONLY\n\n";
+ print
+"You may use this command if indicated as part of a support request's response\n";
+ print "See source code for USAGE info\n";
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ exit unless $ARGV[3];
+
}
use ISPMan;
-my $ispman=ISPMan->new();
-print $ispman->dumper($ispman->addMailGroupAttributeValues(@ARGV));
+my $ispman = ISPMan->new();
+print $ispman->dumper( $ispman->addMailGroupAttributeValues(@ARGV) );
print "\n";
-print $ispman->dumper($ispman->getMailGroupAttributeValues(@ARGV));
+print $ispman->dumper( $ispman->getMailGroupAttributeValues(@ARGV) );
print "\n";
Index: ispman.addClient
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.addClient,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.addClient 24 Apr 2003 21:31:37 -0000 1.2
+++ ispman.addClient 30 May 2004 23:35:31 -0000 1.3
@@ -1,13 +1,16 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('flcmr', \%opts);
- unless ( $opts{'r'} && $ARGV[0]){
- print "$FindBin::Script -r ResellerID [-f firstname] [-l lastname] [-m maxdomains] [-c displayname] ClientName ";
- print "\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'flcmr', \%opts );
+ unless ( $opts{'r'} && $ARGV[0] ) {
+ print
+"$FindBin::Script -r ResellerID [-f firstname] [-l lastname] [-m maxdomains] [-c displayname] ClientName ";
+ print "\n";
+ exit;
+ }
}
use lib qw(%%installDir%%/lib);
@@ -15,31 +18,25 @@
use CGI;
use vars qw($ispman);
-$ispman=ISPMan->new();
-$user =shift @ARGV;
-
-my $r=new CGI();
-
-$opts{'f'}||=$user;
-$opts{'l'}||=$user;
-$opts{'p'}||="secret";
-$opts{'c'}||= join " ", ($opts{'f'}, $opts{'l'});
-
-
-
+$ispman = ISPMan->new();
+$user = shift @ARGV;
+my $r = new CGI();
+$opts{'f'} ||= $user;
+$opts{'l'} ||= $user;
+$opts{'p'} ||= "secret";
+$opts{'c'} ||= join " ", ( $opts{'f'}, $opts{'l'} );
-$r->param("givenName", $opts{"f"});
-$r->param("sn", $opts{"l"});
-$r->param("cn", $opts{"c"});
-$r->param("uid", $user);
-$r->param("userPassword", $opts{"p"});
-$r->param("ispmanResellerId", $opts{'r'});
-$r->param("ispmanClientName", $user);
-$r->param("ispmanClientMaxDomains", $opts{'m'}) if $opts{'m'};
+$r->param( "givenName", $opts{"f"} );
+$r->param( "sn", $opts{"l"} );
+$r->param( "cn", $opts{"c"} );
+$r->param( "uid", $user );
+$r->param( "userPassword", $opts{"p"} );
+$r->param( "ispmanResellerId", $opts{'r'} );
+$r->param( "ispmanClientName", $user );
+$r->param( "ispmanClientMaxDomains", $opts{'m'} ) if $opts{'m'};
$ispman->addClient($r);
print $ispman->{'message'}, "\n";
-
Index: ispman.zoneparse
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.zoneparse,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- ispman.zoneparse 12 Jul 2002 16:42:44 -0000 1.4
+++ ispman.zoneparse 30 May 2004 23:35:32 -0000 1.5
@@ -1,17 +1,18 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('df', \%opts);
- unless ($opts{'f'} && $opts{'d'}){
- print "$FindBin::Script -d domain -f zonefile\n";
- print "A utility to load dns info for a domain from zone file\n\n";
- print "\n\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'df', \%opts );
+ unless ( $opts{'f'} && $opts{'d'} ) {
+ print "$FindBin::Script -d domain -f zonefile\n";
+ print "A utility to load dns info for a domain from zone file\n\n";
+ print "\n\n";
+ exit;
+ }
}
-
# DNS::ZoneParse
# Parse and Manipulate DNS Zonefiles
# Version 0.8
@@ -25,10 +26,10 @@
sub new {
my $class = shift;
-
+
croak "No filename or string specified" unless @_;
croak "Too many arguments" if @_ > 1;
-
+
my $self = {};
bless $self, $class;
$self->load_file(@_);
@@ -39,63 +40,63 @@
# Accessor Methods
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-sub DESTROY {}
+sub DESTROY { }
-sub AUTOLOAD
-{
- my $self = shift;
- (my $method = $DNS::ZoneParse::AUTOLOAD) =~ s/.*:://;
-
- my @accessors = map { lc } keys ( %{$self->{_Zone}} );
- croak "Invalid method called: $method"
- unless grep { $_ eq $method } @accessors, qw(origin zonefile);
-
- return $self->{Identity}->{ZoneFile} if $method eq "zonefile";
- return $self->{Identity}->{Origin} if $method eq "origin";
-
- return $self->{_Zone}->{uc $method};
+sub AUTOLOAD {
+ my $self = shift;
+ ( my $method = $DNS::ZoneParse::AUTOLOAD ) =~ s/.*:://;
+
+ my @accessors = map { lc } keys( %{ $self->{_Zone} } );
+ croak "Invalid method called: $method"
+ unless grep { $_ eq $method } @accessors, qw(origin zonefile);
+
+ return $self->{Identity}->{ZoneFile} if $method eq "zonefile";
+ return $self->{Identity}->{Origin} if $method eq "origin";
+
+ return $self->{_Zone}->{ uc $method };
}
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Public OO Methods
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-sub Dump
-{
- # returns a HOH for use with XML modules, etc
- return $_[0]->{_Zone};
+sub Dump {
+
+ # returns a HOH for use with XML modules, etc
+ return $_[0]->{_Zone};
}
sub newSerial {
- my $self = shift;
- my $incriment = shift || 0;
- if ($incriment > 0) {
- $self->{_Zone}->{SOA}->{serial} += $incriment;
- } else {
- my ($hour, $day,$mon,$year) = ( localtime() )[2 .. 5];
- my $newserial = sprintf("%d%02d%02d%02d01", $year + 1900, $mon+1, $day, $hour);
-
- for (1..10)
- {
- if ($newserial > $self->{_Zone}->{SOA}->{serial})
- {
- $self->{_Zone}->{SOA}->{serial} = $newserial;
- return 1;
- } else {
- $newserial++;
- }
- }
+ my $self = shift;
+ my $incriment = shift || 0;
+ if ( $incriment > 0 ) {
+ $self->{_Zone}->{SOA}->{serial} += $incriment;
+ }
+ else {
+ my ( $hour, $day, $mon, $year ) = ( localtime() )[ 2 .. 5 ];
+ my $newserial =
+ sprintf( "%d%02d%02d%02d01", $year + 1900, $mon + 1, $day, $hour );
- $self->{_Zone}->{SOA}->{serial}++;
- }
- return 1;
+ for ( 1 .. 10 ) {
+ if ( $newserial > $self->{_Zone}->{SOA}->{serial} ) {
+ $self->{_Zone}->{SOA}->{serial} = $newserial;
+ return 1;
+ }
+ else {
+ $newserial++;
+ }
+ }
+
+ $self->{_Zone}->{SOA}->{serial}++;
+ }
+ return 1;
}
sub PrintZone {
- my $self = shift;
- my @quick_classes = qw(A CNAME);
- my $temp_zone_file = "";
- $temp_zone_file .= <<ZONEHEADER;
+ my $self = shift;
+ my @quick_classes = qw(A CNAME);
+ my $temp_zone_file = "";
+ $temp_zone_file .= <<ZONEHEADER;
;
; Database file $self->{Identity}->{ZoneFile} for $self->{Identity}->{Origin} zone.
; Zone version: $self->{_Zone}->{SOA}->{serial}
@@ -114,179 +115,225 @@
ZONEHEADER
- foreach my $rr (@{$self->{_Zone}->{NS}}) {
- $temp_zone_file .= "$rr->{name} $rr->{ttl} $rr->{class} NS $rr->{host}\n";
- }
+ foreach my $rr ( @{ $self->{_Zone}->{NS} } ) {
+ $temp_zone_file .=
+ "$rr->{name} $rr->{ttl} $rr->{class} NS $rr->{host}\n";
+ }
- $temp_zone_file .= "\n\;\n\; Zone Records\n\;\n\n";
+ $temp_zone_file .= "\n\;\n\; Zone Records\n\;\n\n";
- foreach my $class (@quick_classes) {
- foreach my $rr (@{$self->{_Zone}->{$class}}) {
- $temp_zone_file .= "$rr->{name} $rr->{ttl} $rr->{class} $class $rr->{host}\n";
- }
- }
+ foreach my $class (@quick_classes) {
+ foreach my $rr ( @{ $self->{_Zone}->{$class} } ) {
+ $temp_zone_file .=
+ "$rr->{name} $rr->{ttl} $rr->{class} $class $rr->{host}\n";
+ }
+ }
- foreach my $rr (@{$self->{_Zone}->{MX}}) {
- $temp_zone_file .= "$rr->{name} $rr->{ttl} $rr->{class} MX $rr->{priority} $rr->{host}\n";
- }
+ foreach my $rr ( @{ $self->{_Zone}->{MX} } ) {
+ $temp_zone_file .=
+"$rr->{name} $rr->{ttl} $rr->{class} MX $rr->{priority} $rr->{host}\n";
+ }
- $self->{ZoneFile} = $temp_zone_file;
- return $self->{ZoneFile};
+ $self->{ZoneFile} = $temp_zone_file;
+ return $self->{ZoneFile};
}
-
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Private Methods
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
sub _initialize {
- my $self = shift;
- $self->{_Zone} = { SOA => {},
- AAAA => [],
- A => [],
- NS => [],
- CNAME => [],
- MX => [],
- PTR => [],
- TXT => [],
- };
- $self->{Identity} = {};
- return 1;
+ my $self = shift;
+ $self->{_Zone} = {
+ SOA => {},
+ AAAA => [],
+ A => [],
+ NS => [],
+ CNAME => [],
+ MX => [],
+ PTR => [],
+ TXT => [],
+ };
+ $self->{Identity} = {};
+ return 1;
}
-
-sub load_file {
- my ($self, $zonefile) = @_;
- if(ref($zonefile) eq "SCALAR")
- {
- $self->{ZoneFile} = $$zonefile;
- } else {
- if (open(inZONE, "$zonefile")) {
- while (<inZONE>) { $self->{ZoneFile} .= $_; }
- close(inZONE);
- } else {
- croak "DNS::ParseZone Could not open input file: \"$zonefile\" $!\n";
- }
- }
- if ($self->_parse()) { return 1; }
+sub load_file {
+ my ( $self, $zonefile ) = @_;
+ if ( ref($zonefile) eq "SCALAR" ) {
+ $self->{ZoneFile} = $$zonefile;
+ }
+ else {
+ if ( open( inZONE, "$zonefile" ) ) {
+ while (<inZONE>) { $self->{ZoneFile} .= $_; }
+ close(inZONE);
+ }
+ else {
+ croak
+ "DNS::ParseZone Could not open input file: \"$zonefile\" $!\n";
+ }
+ }
+ if ( $self->_parse() ) { return 1; }
}
-
sub _parse {
- my $self=shift;
+ my $self = shift;
$self->_initialize();
-
- my $chars = qr/[a-z\-\.0-9]+/i;
- $self->{ZoneFile} =~ /Database file ($chars)( dns)? for ($chars) zone/si;
- $self->{Identity} = { ZoneFile => $1, Origin => $3};
- $self->{RRs} = [];
- $self->_clean_records();
- my $valid_name = qr/[\@a-z\-\.0-9\*]+/i;
- my $rr_class = qr/in|hs|ch/i;
- my $rr_types = qr/ns|a|cname/i;
- my $rr_ttl = qr/\d{1,}\w{0,1}/;
-
- foreach my $RR (@{$self->{RRs}}) {
-
- if ($RR =~ /($valid_name)?\s+($rr_ttl)?\s*?($rr_class)?\s*?($rr_types)\s+($valid_name)/i)
- {
- my $class = uc $4;
- push (@{$self->{_Zone}->{$class}}, {name => $1.'', class=> $3.'', host => $5.'',
- ttl => $2.''});
- }
- elsif ($RR =~ /($valid_name)\s+($rr_ttl)?\s*?($rr_class)?\s*?mx\s(\d+)\s($valid_name)/i)
- {
- push (@{$self->{_Zone}->{MX}}, {name => $1.'', priority => $4.'', host => $5.'',
- ttl => $2.'', class => $3});
- }
- elsif ($RR =~ /($valid_name)\s+($rr_ttl)?\s*?($rr_class)?\s*?SOA\s+($valid_name)\s+($valid_name)\s*?\(?\s*?($rr_ttl)\s+($rr_ttl)\s+($rr_ttl)\s+($rr_ttl)\s+($rr_ttl)\s*\)?/i) {
- $self->{_Zone}->{SOA} = {origin => $1.'', ttl => $2.'', primary => $4.'',
- email =>$5.'', serial => $6.'', refresh=> $7.'',
- retry=> $8.'', expire=> $9.'', minimumTTL => $10.''};
- }
- elsif ($RR =~ /([\d\.]+)\s+($rr_ttl)?\s*?($rr_class)?\s*?PTR\s+($valid_name)/i) {
- push (@{$self->{_Zone}->{PTR}}, {name => $1.'', class => $2.'', ttl => $3.'',
- host => $4.''});
- }
- elsif ($RR =~ /($valid_name)\s+($rr_ttl)?\s*?($rr_class)?\s*?TXT\s+\"([^\"]*)\"/i) {
- push (@{$self->{_Zone}->{TXT}}, {name => $1.'', ttl => $2.'', class => $3.'',
- text=> $4.''});
- }
- }
- # comment the next two lines for debugging.
- undef $self->{ZoneFile};
- undef $self->{RRs};
- return 1;
+ my $chars = qr/[a-z\-\.0-9]+/i;
+ $self->{ZoneFile} =~ /Database file ($chars)( dns)? for ($chars) zone/si;
+ $self->{Identity} = { ZoneFile => $1, Origin => $3 };
+
+ $self->{RRs} = [];
+ $self->_clean_records();
+ my $valid_name = qr/[\@a-z\-\.0-9\*]+/i;
+ my $rr_class = qr/in|hs|ch/i;
+ my $rr_types = qr/ns|a|cname/i;
+ my $rr_ttl = qr/\d{1,}\w{0,1}/;
+
+ foreach my $RR ( @{ $self->{RRs} } ) {
+
+ if ( $RR =~
+/($valid_name)?\s+($rr_ttl)?\s*?($rr_class)?\s*?($rr_types)\s+($valid_name)/i
+ )
+ {
+ my $class = uc $4;
+ push(
+ @{ $self->{_Zone}->{$class} },
+ {
+ name => $1 . '',
+ class => $3 . '',
+ host => $5 . '',
+ ttl => $2 . ''
+ }
+ );
+ }
+ elsif ( $RR =~
+/($valid_name)\s+($rr_ttl)?\s*?($rr_class)?\s*?mx\s(\d+)\s($valid_name)/i
+ )
+ {
+ push(
+ @{ $self->{_Zone}->{MX} },
+ {
+ name => $1 . '',
+ priority => $4 . '',
+ host => $5 . '',
+ ttl => $2 . '',
+ class => $3
+ }
+ );
+ }
+ elsif ( $RR =~
+/($valid_name)\s+($rr_ttl)?\s*?($rr_class)?\s*?SOA\s+($valid_name)\s+($valid_name)\s*?\(?\s*?($rr_ttl)\s+($rr_ttl)\s+($rr_ttl)\s+($rr_ttl)\s+($rr_ttl)\s*\)?/i
+ )
+ {
+ $self->{_Zone}->{SOA} = {
+ origin => $1 . '',
+ ttl => $2 . '',
+ primary => $4 . '',
+ email => $5 . '',
+ serial => $6 . '',
+ refresh => $7 . '',
+ retry => $8 . '',
+ expire => $9 . '',
+ minimumTTL => $10 . ''
+ };
+ }
+ elsif ( $RR =~
+ /([\d\.]+)\s+($rr_ttl)?\s*?($rr_class)?\s*?PTR\s+($valid_name)/i )
+ {
+ push(
+ @{ $self->{_Zone}->{PTR} },
+ {
+ name => $1 . '',
+ class => $2 . '',
+ ttl => $3 . '',
+ host => $4 . ''
+ }
+ );
+ }
+ elsif ( $RR =~
+ /($valid_name)\s+($rr_ttl)?\s*?($rr_class)?\s*?TXT\s+\"([^\"]*)\"/i
+ )
+ {
+ push(
+ @{ $self->{_Zone}->{TXT} },
+ {
+ name => $1 . '',
+ ttl => $2 . '',
+ class => $3 . '',
+ text => $4 . ''
+ }
+ );
+ }
+ }
+
+ # comment the next two lines for debugging.
+ undef $self->{ZoneFile};
+ undef $self->{RRs};
+ return 1;
}
sub _clean_records {
- my $self = shift;
+ my $self = shift;
- my $zone = $self->{ZoneFile};
- $zone =~ s/\;.{0,}$//mg; # Remove comments
- $zone =~ s/^\s*?$//mg; # Remove empty lines
- $zone =~ s#$/{2,}#$/#g; # Remove double carriage returns
-
- # Concatenate everything split over multiple lines i.e. elements surrounded by parentheses can be
- # split over multiple lines. See RFC 1035 section 5.1
- $zone=~ s{(\([^\)]*?\))}{_concatenate( $1)}egs;
+ my $zone = $self->{ZoneFile};
+ $zone =~ s/\;.{0,}$//mg; # Remove comments
+ $zone =~ s/^\s*?$//mg; # Remove empty lines
+ $zone =~ s#$/{2,}#$/#g; # Remove double carriage returns
- @{$self->{RRs}} = split (m#$/#, $zone);
- foreach (@{$self->{RRs}}) { s/\s+/\t/g; }
+# Concatenate everything split over multiple lines i.e. elements surrounded by parentheses can be
+# split over multiple lines. See RFC 1035 section 5.1
+ $zone =~ s{(\([^\)]*?\))}{_concatenate( $1)}egs;
- return 1;
+ @{ $self->{RRs} } = split( m#$/#, $zone );
+ foreach ( @{ $self->{RRs} } ) { s/\s+/\t/g; }
+
+ return 1;
}
sub _concatenate {
- my $text_in_parenth= shift;
- $text_in_parenth=~ s{$/}{}g;
- return $text_in_parenth;
+ my $text_in_parenth = shift;
+ $text_in_parenth =~ s{$/}{}g;
+ return $text_in_parenth;
}
-
package main;
use vars qw (%opts);
-my $dnsfile = DNS::ZoneParse->new($opts{'f'});
-my $domain = $opts{'d'};
+my $dnsfile = DNS::ZoneParse->new( $opts{'f'} );
+my $domain = $opts{'d'};
-my $a=$dnsfile->a();
-my $mx=$dnsfile->mx();
-my $ns=$dnsfile->ns();
-my $c=$dnsfile->cname();
+my $a = $dnsfile->a();
+my $mx = $dnsfile->mx();
+my $ns = $dnsfile->ns();
+my $c = $dnsfile->cname();
use Data::Dumper;
+
#print Dumper($c);
#exit;
for (@$a) {
- print join " ", ("A", $domain, $_->{'name'}, $_->{'host'});
- print "\n";
+ print join " ", ( "A", $domain, $_->{'name'}, $_->{'host'} );
+ print "\n";
}
for (@$ns) {
- $_->{'name'}||='@';
+ $_->{'name'} ||= '@';
- print join " ", ("NS", $domain, $_->{'name'}, $_->{'host'});
- print "\n";
+ print join " ", ( "NS", $domain, $_->{'name'}, $_->{'host'} );
+ print "\n";
}
for (@$mx) {
- $_->{'name'}||='@';
- print join " ", ("MX", $domain, $_->{'name'}, $_->{'priority'} , $_->{'host'});
- print "\n";
+ $_->{'name'} ||= '@';
+ print join " ",
+ ( "MX", $domain, $_->{'name'}, $_->{'priority'}, $_->{'host'} );
+ print "\n";
}
for (@$c) {
- print join " ", ("CNAME", $domain, $_->{'name'}, $_->{'host'});
- print "\n";
+ print join " ", ( "CNAME", $domain, $_->{'name'}, $_->{'host'} );
+ print "\n";
}
-
-
-
-
-
-
-
-
Index: ispman.addDomainService2Domain
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.addDomainService2Domain,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.addDomainService2Domain 19 May 2002 02:55:26 -0000 1.2
+++ ispman.addDomainService2Domain 30 May 2004 23:35:31 -0000 1.3
@@ -1,16 +1,17 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- unless ($ARGV[1]){
- print "usage: $0 domain service\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ unless ( $ARGV[1] ) {
+ print "usage: $0 domain service\n";
+ exit;
+ }
}
use lib qw("$FindBin::Bin/../lib");
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
+$ispman = ISPMan->new();
$ispman->addDomainService2Domain(@ARGV);
-
Index: ispman.addDomain
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.addDomain,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- ispman.addDomain 8 Aug 2003 18:38:35 -0000 1.7
+++ ispman.addDomain 30 May 2004 23:35:31 -0000 1.8
@@ -1,112 +1,115 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('dfmw', \%opts);
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'dfmw', \%opts );
+ # 2003-08-06
+ # Adding -d switch because almost all command use it except this one
+ # This may lead to accidents if an admin try to create a domain and by
+ # habbit types
+ # ispman.addDomain -d example.com examplePassword
+ # this would have created a domain called "-d" and all sort of wierd
+ # behaviours will be seen
- # 2003-08-06
- # Adding -d switch because almost all command use it except this one
- # This may lead to accidents if an admin try to create a domain and by
- # habbit types
- # ispman.addDomain -d example.com examplePassword
- # this would have created a domain called "-d" and all sort of wierd
- # behaviours will be seen
+ unless ( $opts{'d'} ) {
- unless ($opts{'d'}){
- # perhaps using old syntax.
- # check if there are atleast two arguments
- # and that the first one looks like a doamain
- # if yes then feed it to $opts{'d'}
+ # perhaps using old syntax.
+ # check if there are atleast two arguments
+ # and that the first one looks like a doamain
+ # if yes then feed it to $opts{'d'}
+ if ( $ARGV[1] ) {
- if ($ARGV[1]){
- # Yes we have atlease 2 arguments 0 and 1
- unless ($ARGV[0]=~m/\w+?\.?\w+/){
- print "First argument does not look like a domain\n";
- print "A domain should have atleast a dot in it\n";
- exit;
- }
- print "\nReminder: \nNew usage is $FindBin::Script -d domain [-w defaultWebHost] [-f defaultFileHost] [-m defaultMailHost] domainPassword\n";
- print "Note the -d switch. Please use that next time\n";
- $opts{'d'}=shift @ARGV;
- } else {
- print "\nUsage:\n";
- print "$FindBin::Script -d domain [-w defaultWebHost] [-f defaultFileHost] [-m defaultMailHost] domainPassword";
- print "\n";
+ # Yes we have atlease 2 arguments 0 and 1
+ unless ( $ARGV[0] =~ m/\w+?\.?\w+/ ) {
+ print "First argument does not look like a domain\n";
+ print "A domain should have atleast a dot in it\n";
exit;
- }
- }
+ }
+ print
+"\nReminder: \nNew usage is $FindBin::Script -d domain [-w defaultWebHost] [-f defaultFileHost] [-m defaultMailHost] domainPassword\n";
+ print "Note the -d switch. Please use that next time\n";
+ $opts{'d'} = shift @ARGV;
+ }
+ else {
+ print "\nUsage:\n";
+ print
+"$FindBin::Script -d domain [-w defaultWebHost] [-f defaultFileHost] [-m defaultMailHost] domainPassword";
+ print "\n";
+ exit;
+ }
+ }
}
use vars qw($ispman $r $domain );
-$domain=$opts{'d'};
-$password=shift @ARGV;
-
+$domain = $opts{'d'};
+$password = shift @ARGV;
use ISPMan;
use CGI;
-$ispman=ISPMan->new();
-$r=new CGI();
-$r->param("domain", $domain);
-$r->param("ispmanDomain", $domain);
-
-
+$ispman = ISPMan->new();
+$r = new CGI();
+$r->param( "domain", $domain );
+$r->param( "ispmanDomain", $domain );
#($domain, $password) =@ARGV;
# change these to meet your site specifics
-$d={
- 'ispmanDomainType' => 'primary',
- 'ispmanDomainMailDeliveryMethod' => 'local',
- 'ispmanDomainServices' => 'web,mail',
- 'FTPStatus' => 'enabled',
- 'FTPQuotaMBytes' => 25,
- 'userPassword' => $password,
- };
-
-
+$d = {
+ 'ispmanDomainType' => 'primary',
+ 'ispmanDomainMailDeliveryMethod' => 'local',
+ 'ispmanDomainServices' => 'web,mail',
+ 'FTPStatus' => 'enabled',
+ 'FTPQuotaMBytes' => 25,
+ 'userPassword' => $password,
+};
-if ($opts{'w'}){
- $d->{'ispmanDomainDefaultWebHost'}=$opts{'w'};
-}else {
- if (my $defaultWebHost=$ispman->getHostGroupFirstMember('httpgroup')) {
- $d->{'ispmanDomainDefaultWebHost'}=$defaultWebHost;
- }
+if ( $opts{'w'} ) {
+ $d->{'ispmanDomainDefaultWebHost'} = $opts{'w'};
}
-
-if ($opts{'f'}){
- $d->{'ispmanDomainDefaultFileServer'}=$opts{'f'};
-}else {
- if (my $ispmanDomainDefaultFileServer=$ispman->getHostGroupFirstMember('fileservergroup')) {
- $d->{'ispmanDomainDefaultFileServer'}=$ispmanDomainDefaultFileServer;
- } else {
- print "No host in fileserver group found. You cannot add domains untill you define some hosts in the fileservergroup\n";
- exit;
- }
+else {
+ if ( my $defaultWebHost = $ispman->getHostGroupFirstMember('httpgroup') ) {
+ $d->{'ispmanDomainDefaultWebHost'} = $defaultWebHost;
+ }
}
-if ($opts{'m'}){
- $d->{'ispmanDomainDefaultMailDropHost'}=$opts{'m'};
-}else {
- if (my $ispmanDomainDefaultMailDropHost=$ispman->getHostGroupFirstMember('mailstoregroup')) {
- $d->{'ispmanDomainDefaultMailDropHost'}=$ispmanDomainDefaultMailDropHost;
- }
+if ( $opts{'f'} ) {
+ $d->{'ispmanDomainDefaultFileServer'} = $opts{'f'};
+}
+else {
+ if ( my $ispmanDomainDefaultFileServer =
+ $ispman->getHostGroupFirstMember('fileservergroup') )
+ {
+ $d->{'ispmanDomainDefaultFileServer'} = $ispmanDomainDefaultFileServer;
+ }
+ else {
+ print
+"No host in fileserver group found. You cannot add domains untill you define some hosts in the fileservergroup\n";
+ exit;
+ }
}
+if ( $opts{'m'} ) {
+ $d->{'ispmanDomainDefaultMailDropHost'} = $opts{'m'};
+}
+else {
+ if ( my $ispmanDomainDefaultMailDropHost =
+ $ispman->getHostGroupFirstMember('mailstoregroup') )
+ {
+ $d->{'ispmanDomainDefaultMailDropHost'} =
+ $ispmanDomainDefaultMailDropHost;
+ }
+}
+$d->{'homeDirectory'} =
+ join( '/', $ispman->getConf("defaultHomeDirectoryPath"), $domain );
-
-
-
-
-
-$d->{'homeDirectory'} = join ('/', $ispman->getConf("defaultHomeDirectoryPath") , $domain);
-
-
-for (keys %$d) {
- $r->param($_, $d->{$_});
+for ( keys %$d ) {
+ $r->param( $_, $d->{$_} );
}
$ispman->addNewDomain($r);
Index: ispman.addHostGroup
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.addHostGroup,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ispman.addHostGroup 17 Aug 2003 20:29:16 -0000 1.1
+++ ispman.addHostGroup 30 May 2004 23:35:31 -0000 1.2
@@ -1,17 +1,18 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- unless ($ARGV[0]){
- print "$0 hostgroupname [Description]\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ unless ( $ARGV[0] ) {
+ print "$0 hostgroupname [Description]\n";
+ exit;
+ }
}
use ISPMan;
use vars qw($ispman);
-$hosgroupname=shift @ARGV;
-$hosgroupdescription=join " ", @ARGV;
-
-$ispman=ISPMan->new();
-$ispman->add_host_group($hosgroupname, $hosgroupdescription);
+$hosgroupname = shift @ARGV;
+$hosgroupdescription = join " ", @ARGV;
+$ispman = ISPMan->new();
+$ispman->add_host_group( $hosgroupname, $hosgroupdescription );
Index: ispman.ldap2named
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.ldap2named,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- ispman.ldap2named 7 Oct 2003 15:09:53 -0000 1.7
+++ ispman.ldap2named 30 May 2004 23:35:32 -0000 1.8
@@ -1,19 +1,23 @@
#!/usr/bin/perl
package ISPMan;
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopts('had:', \%opts);
- unless ($opts{'d'}){
- $opts{'d'}=0;
- }
-
- if ($opts{'h'}) {
- print "$0 -d debugLevel[1|2|3] [-a]\n";
- print "\t-a\tMake postfix maps for all domains and not just the ones where smtpHost is this host\n";
- print "\n";
- exit;
- }
+
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopts( 'had:', \%opts );
+ unless ( $opts{'d'} ) {
+ $opts{'d'} = 0;
+ }
+
+ if ( $opts{'h'} ) {
+ print "$0 -d debugLevel[1|2|3] [-a]\n";
+ print
+"\t-a\tMake postfix maps for all domains and not just the ones where smtpHost is this host\n";
+ print "\n";
+ exit;
+ }
}
use Sys::Hostname;
@@ -21,49 +25,42 @@
use ISPMan;
-
-# defind log_message.
+# defind log_message.
# This is defined in ispman-agent and we should redefine here
sub log_message {
- my $message = join ' ' , @_;
- chomp ($message);
+ my $message = join ' ', @_;
+ chomp($message);
print "$message\n";
}
-
-
-$ispman=ISPMan->new();
-$ispman->setConfig('debug', $opts{'d'});
-my $install_dir=$ispman->getConf("installDir");
+$ispman = ISPMan->new();
+$ispman->setConfig( 'debug', $opts{'d'} );
+my $install_dir = $ispman->getConf("installDir");
require "$install_dir/lib/dns.lib";
+$namedConfFile = $ispman->getConf('namedConfFile');
+$namedConfHeaderFile = $ispman->getConf('namedConfHeaderFile');
+$namedConfFooterFile = $ispman->getConf('namedConfFooterFile');
-$namedConfFile=$ispman->getConf('namedConfFile');
-$namedConfHeaderFile=$ispman->getConf('namedConfHeaderFile');
-$namedConfFooterFile=$ispman->getConf('namedConfFooterFile');
-
-$namedDir=join "/", ($ispman->getConf('namedDir'), $ispman->getConf('namedIspmanSubDir'));
-$namedRevDir=join "/", ($namedDir, $ispman->getConf('namedRevDir'));
-$namedPriDir=join "/", ($namedDir, $ispman->getConf('namedPriDir'));
-$namedSecDir=join "/", ($namedDir, $ispman->getConf('namedSecDir'));
-
-$namedDir=~s!//!/!g;
-$namedRevDir=~s!//!/!g;
-$namedPriDir=~s!//!/!g;
-$namedSecDir=~s!//!/!g;
-
+$namedDir = join "/",
+ ( $ispman->getConf('namedDir'), $ispman->getConf('namedIspmanSubDir') );
+$namedRevDir = join "/", ( $namedDir, $ispman->getConf('namedRevDir') );
+$namedPriDir = join "/", ( $namedDir, $ispman->getConf('namedPriDir') );
+$namedSecDir = join "/", ( $namedDir, $ispman->getConf('namedSecDir') );
+$namedDir =~ s!//!/!g;
+$namedRevDir =~ s!//!/!g;
+$namedPriDir =~ s!//!/!g;
+$namedSecDir =~ s!//!/!g;
-my $filter="objectclass=ispmanDomain";
-unless ($opts{'a'}) {
- require Sys::Hostname;
- import Sys::Hostname;
- $filter= sprintf ("&(objectclass=ispmanDomain)(dnsHost=%s)" , hostname());
+my $filter = "objectclass=ispmanDomain";
+unless ( $opts{'a'} ) {
+ require Sys::Hostname;
+ import Sys::Hostname;
+ $filter = sprintf( "&(objectclass=ispmanDomain)(dnsHost=%s)", hostname() );
}
-
-
-make_named_conf("ALL", $filter);
+make_named_conf( "ALL", $filter );
exit:
__END__
Index: ispman.passwd.domain
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.passwd.domain,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ispman.passwd.domain 14 May 2003 10:31:08 -0000 1.1
+++ ispman.passwd.domain 30 May 2004 23:35:32 -0000 1.2
@@ -1,19 +1,20 @@
#!/usr/bin/perl
BEGIN {
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('d', \%opts);
- unless ($opts{'d'} ||!$ARGV[0]){
- print "Usage: $FindBin::Script domain new_password\n\n";
- exit;
- }
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'd', \%opts );
+ unless ( $opts{'d'} || !$ARGV[0] ) {
+ print "Usage: $FindBin::Script domain new_password\n\n";
+ exit;
+ }
}
-
use ISPMan;
-my $ispman=ISPMan->new();
-print $ispman->changeDomainPassword($opts{"d"}, $ARGV[0]);
+my $ispman = ISPMan->new();
+print $ispman->changeDomainPassword( $opts{"d"}, $ARGV[0] );
print "\n";
__END__
Index: ispman.addReseller
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.addReseller,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.addReseller 24 Apr 2003 21:31:37 -0000 1.2
+++ ispman.addReseller 30 May 2004 23:35:31 -0000 1.3
@@ -1,43 +1,40 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('flcm', \%opts);
- unless ( $ARGV[0]){
- print "$FindBin::Script [-f firstname] [-l lastname] [-m maxclients] [-c displayname] resellerName ";
- print "\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'flcm', \%opts );
+ unless ( $ARGV[0] ) {
+ print
+"$FindBin::Script [-f firstname] [-l lastname] [-m maxclients] [-c displayname] resellerName ";
+ print "\n";
+ exit;
+ }
}
-
use lib qw(%%installDir%%/lib);
use ISPMan;
use CGI;
use vars qw($ispman);
-$ispman=ISPMan->new();
-$user =shift @ARGV;
-
-my $r=new CGI();
-
-$opts{'f'}||=$user;
-$opts{'l'}||=$user;
-$opts{'p'}||="secret";
-$opts{'c'}||= join " ", ($opts{'f'}, $opts{'l'});
-
-
+$ispman = ISPMan->new();
+$user = shift @ARGV;
+my $r = new CGI();
+$opts{'f'} ||= $user;
+$opts{'l'} ||= $user;
+$opts{'p'} ||= "secret";
+$opts{'c'} ||= join " ", ( $opts{'f'}, $opts{'l'} );
-$r->param("givenName", $opts{"f"});
-$r->param("sn", $opts{"l"});
-$r->param("cn", $opts{"c"});
-$r->param("uid", $user);
-$r->param("userPassword", $opts{"p"});
-$r->param("ispmanResellerName", $user);
-$r->param("ispmanResellerMaxClients", $opts{'m'}) if $opts{'m'};
+$r->param( "givenName", $opts{"f"} );
+$r->param( "sn", $opts{"l"} );
+$r->param( "cn", $opts{"c"} );
+$r->param( "uid", $user );
+$r->param( "userPassword", $opts{"p"} );
+$r->param( "ispmanResellerName", $user );
+$r->param( "ispmanResellerMaxClients", $opts{'m'} ) if $opts{'m'};
$ispman->addReseller($r);
print $ispman->{'message'}, "\n";
-
Index: ispman.listMailboxes
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.listMailboxes,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ispman.listMailboxes 24 Apr 2003 21:31:40 -0000 1.3
+++ ispman.listMailboxes 30 May 2004 23:35:32 -0000 1.4
@@ -1,15 +1,17 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
$|++;
-require"cyrusadmin.pm";
+require "cyrusadmin.pm";
-$mailboxes=$ARGV[0]||'*';
+$mailboxes = $ARGV[0] || '*';
@list = $imap->list($mailboxes);
-for (@list){
- s/^$mailbox_prefix//;
- print "$_\n";
+for (@list) {
+ s/^$mailbox_prefix//;
+ print "$_\n";
}
exit;
Index: ispman.passwd.client
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.passwd.client,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ispman.passwd.client 14 May 2003 10:31:08 -0000 1.1
+++ ispman.passwd.client 30 May 2004 23:35:32 -0000 1.2
@@ -1,21 +1,21 @@
#!/usr/bin/perl
BEGIN {
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('c', \%opts);
- unless ($opts{'c'} && $ARGV[0]){
- print "Usage: $FindBin::Script -c clientID new_password\n\n";
- exit;
- }
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'c', \%opts );
+ unless ( $opts{'c'} && $ARGV[0] ) {
+ print "Usage: $FindBin::Script -c clientID new_password\n\n";
+ exit;
+ }
}
-
-
use ISPMan;
-my $ispman=ISPMan->new();
-if ( $ispman->changeClientPassword($opts{"c"}, $ARGV[0])) {
- print "Password changed\n";
+my $ispman = ISPMan->new();
+if ( $ispman->changeClientPassword( $opts{"c"}, $ARGV[0] ) ) {
+ print "Password changed\n";
}
__END__
Index: ispman.getMailboxQuota
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.getMailboxQuota,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ispman.getMailboxQuota 28 Aug 2003 08:23:03 -0000 1.3
+++ ispman.getMailboxQuota 30 May 2004 23:35:32 -0000 1.4
@@ -1,24 +1,24 @@
#!/usr/bin/perl
use Data::Dumper;
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- unless (@ARGV) {
- $0=~s/.*\///;
- print "Usage: $0 -h host mailbox [mailbox] [mailbox] .. [mailbox]\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ unless (@ARGV) {
+ $0 =~ s/.*\///;
+ print "Usage: $0 -h host mailbox [mailbox] [mailbox] .. [mailbox]\n";
+ exit;
+ }
}
require "cyrusadmin.pm";
[email protected] = @ARGV;
-
[email protected]=@ARGV;
-
-for (@mailboxes){
- $_="$mailbox_prefix$_";
- try(@q=$imap->get_quota($_));
- print Dumper(\@q)
+for (@mailboxes) {
+ $_ = "$mailbox_prefix$_";
+ try( @q = $imap->get_quota($_) );
+ print Dumper( \@q );
}
exit;
Index: ispman.domainInfo
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.domainInfo,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- ispman.domainInfo 8 Oct 2003 04:41:16 -0000 1.4
+++ ispman.domainInfo 30 May 2004 23:35:32 -0000 1.5
@@ -1,23 +1,24 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('d', \%opts);
- unless ($opts{'d'}){
- print "$0 -d domain";
- print "\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'd', \%opts );
+ unless ( $opts{'d'} ) {
+ print "$0 -d domain";
+ print "\n";
+ exit;
+ }
}
-
use ISPMan;
-my $self=ISPMan->new();
+my $self = ISPMan->new();
#my $domain_info=$self->getDomainInfo($opts{'d'});
-my $dn=$self->makeDomainDN($opts{'d'});
-my $entry=$self->getEntry($dn);
+my $dn = $self->makeDomainDN( $opts{'d'} );
+my $entry = $self->getEntry($dn);
$self->dumpEntry($entry);
-
+
Index: ispman.setDomainReseller
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.setDomainReseller,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.setDomainReseller 24 Apr 2003 21:31:41 -0000 1.2
+++ ispman.setDomainReseller 30 May 2004 23:35:32 -0000 1.3
@@ -1,24 +1,31 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('r', \%opts);
- unless ( $opts{'r'} && $ARGV[0]){
- print "$FindBin::Script -r ResellerID DomainName [DomainName] [DomainName] ";
- print "\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'r', \%opts );
+ unless ( $opts{'r'} && $ARGV[0] ) {
+ print
+"$FindBin::Script -r ResellerID DomainName [DomainName] [DomainName] ";
+ print "\n";
+ exit;
+ }
}
use ISPMan;
-my $ispman=ISPMan->new();
-my $reseller=$ispman->getResellerById($opts{'r'});
+my $ispman = ISPMan->new();
+my $reseller = $ispman->getResellerById( $opts{'r'} );
for (@ARGV) {
- print "Setting ispmanResellerId for $_ to ", $reseller->{'ispmanResellerId'}, "\n";
- $ispman->setDomainAttribute($_, "ispmanResellerId", $reseller->{'ispmanResellerId'});
- print "Setting ispmanResellerName for $_ to ", $reseller->{'ispmanResellerName'}, "\n";
- $ispman->setDomainAttribute($_, "ispmanResellerName", $reseller->{'ispmanResellerName'});
+ print "Setting ispmanResellerId for $_ to ",
+ $reseller->{'ispmanResellerId'}, "\n";
+ $ispman->setDomainAttribute( $_, "ispmanResellerId",
+ $reseller->{'ispmanResellerId'} );
+ print "Setting ispmanResellerName for $_ to ",
+ $reseller->{'ispmanResellerName'}, "\n";
+ $ispman->setDomainAttribute( $_, "ispmanResellerName",
+ $reseller->{'ispmanResellerName'} );
}
print "\n";
Index: ispman.setmailtransport
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.setmailtransport,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ispman.setmailtransport 10 May 2002 12:55:41 -0000 1.3
+++ ispman.setmailtransport 30 May 2004 23:35:32 -0000 1.4
@@ -1,16 +1,18 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('d', \%opts);
- unless ($opts{'d'} && $ARGV[0]){
- print "$0 -d domain transport";
- print "\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'd', \%opts );
+ unless ( $opts{'d'} && $ARGV[0] ) {
+ print "$0 -d domain transport";
+ print "\n";
+ exit;
+ }
}
use lib qw(%%installDir%%/lib);
use ISPMan;
-my $ispman=ISPMan->new();
-$ispman->setMailTransport($opts{'d'}, @ARGV);
+my $ispman = ISPMan->new();
+$ispman->setMailTransport( $opts{'d'}, @ARGV );
Index: ispman.deltree
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.deltree,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.deltree 24 Apr 2003 21:31:38 -0000 1.2
+++ ispman.deltree 30 May 2004 23:35:31 -0000 1.3
@@ -1,13 +1,15 @@
#!/usr/bin/perl
-BEGIN{
- print "ispman.deltree: Example of the deltree function.\nGive it a node and it will recursively delete it.\nFor example: ispman.deltree ou=admins,o=ispman\n";
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- exit unless $ARGV[0];
+BEGIN {
+ print
+"ispman.deltree: Example of the deltree function.\nGive it a node and it will recursively delete it.\nFor example: ispman.deltree ou=admins,o=ispman\n";
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ exit unless $ARGV[0];
}
-
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
-$ispman->delTree($ARGV[0]);
+$ispman = ISPMan->new();
+$ispman->delTree( $ARGV[0] );
Index: ispman.processdump
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.processdump,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.processdump 24 Apr 2003 21:31:41 -0000 1.2
+++ ispman.processdump 30 May 2004 23:35:32 -0000 1.3
@@ -2,26 +2,27 @@
#ispman.processdump
#utility to debug processes
-
package ISPMan;
+
BEGIN {
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
use lib qw(%%installDir%%/lib %%installDir%%//conf);
$|++;
-
#use strict;
use vars qw(
- $VERSION @ISA @EXPORT @EXPORT_OK
- $name $hostname $hostnames $ispman $pid_file $log_file $domains
- );
+ $VERSION @ISA @EXPORT @EXPORT_OK
+ $name $hostname $hostnames $ispman $pid_file $log_file $domains
+);
require Exporter;
--dfGzR35o/[email protected] = qw(Exporter AutoLoader);
[email protected] = qw();
+-dfGzR35o/[email protected] = qw(Exporter AutoLoader);
[email protected] = qw();
$VERSION = '0.01';
use Data::Dumper;
@@ -29,73 +30,59 @@
require "ispman.conf";
-
-
-
-
-$name="ispman-agent";
-$install_dir=$Config->{'installDir'};
-
-
+$name = "ispman-agent";
+$install_dir = $Config->{'installDir'};
#chomp($hostname=$ENV{'HOSTNAME'}); #NO You cannot remove this.
# but I could :)
-$hostname=hostname(); # find hostname using Sys::Hostname. -End-Of-Story-
-#If you dont have Sys::Hostname, you probably cant run ispman anyway,
-
+$hostname = hostname(); # find hostname using Sys::Hostname. -End-Of-Story-
+#If you dont have Sys::Hostname, you probably cant run ispman anyway,
--WI0L6dQK/[email protected]=split(/\s*,\s*/, $Config->{'hostnames'});
+-WI0L6dQK/[email protected] = split( /\s*,\s*/, $Config->{'hostnames'} );
push @hostnames, $hostname;
-
require ISPMan;
import ISPMan;
-$ispman=ISPMan->new();
-
-$ldapBaseDN=$ispman->getConf('ldapBaseDN');
+$ispman = ISPMan->new();
+$ldapBaseDN = $ispman->getConf('ldapBaseDN');
+$ispman = ISPMan->new();
-$ispman=ISPMan->new();
#if (!$ispman || !$ispman->ldap_ping()){
# print "Creating new connection";
# $ispman=ISPMan->new() || (print "Could not create an ISPMan instance" && die);
#}
-$processes=$ispman->getProcessesForHost(\@hostnames);
+$processes = $ispman->getProcessesForHost( \@hostnames );
my $processHash;
-my ($domain, $params, $process);
-my $message="";
-
-
+my ( $domain, $params, $process );
+my $message = "";
print "Hash dump processes before pushing\n";
print Dumper($processes);
-
-for (keys %$processes){
- $domain=$processes->{$_}{'ispmanDomain'};
- $params=$processes->{$_}{'ispmanParams'};
- $process=$processes->{$_}{'ispmanProcess'};
- $pid=$_;
- push @{$processHash->{$domain}{$process}{$params}}, $pid;
+for ( keys %$processes ) {
+ $domain = $processes->{$_}{'ispmanDomain'};
+ $params = $processes->{$_}{'ispmanParams'};
+ $process = $processes->{$_}{'ispmanProcess'};
+ $pid = $_;
+ push @{ $processHash->{$domain}{$process}{$params} }, $pid;
}
print "Hash dump processHash after pushing\n";
print Dumper($processHash) if $processHash;
-for $domain (keys %$processHash){
- for $job(keys %{$processHash->{$domain}}){
- for $params(keys %{$processHash->{$domain}{$job}}){
- print "Doing $job on $domain with parameters $params\n";
- }
+for $domain ( keys %$processHash ) {
+ for $job ( keys %{ $processHash->{$domain} } ) {
+ for $params ( keys %{ $processHash->{$domain}{$job} } ) {
+ print "Doing $job on $domain with parameters $params\n";
+ }
}
}
-
-
Index: ispman.addvhost
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.addvhost,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- ispman.addvhost 1 May 2004 18:30:23 -0000 1.12
+++ ispman.addvhost 30 May 2004 23:35:31 -0000 1.13
@@ -2,47 +2,59 @@
# Changes:
# 01-08-2003: Atif: Making -w webhost mandatory otherwise no corresponding A record will be created
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('dawp', \%opts);
- unless ($opts{'d'} && $opts{'d'} && $ARGV[0]){
- print "$0 -d domain vhost [-w webhost1, ... ,webhostn] [-a alias] [-p password]";
- print "\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'dawp', \%opts );
+ unless ( $opts{'d'} && $opts{'d'} && $ARGV[0] ) {
+ print
+"$0 -d domain vhost [-w webhost1, ... ,webhostn] [-a alias] [-p password]";
+ print "\n";
+ exit;
+ }
}
use ISPMan;
use CGI;
use vars qw($ispman);
-$ispman=ISPMan->new();
-$vhost =shift @ARGV;
-
-my $r=new CGI();
+$ispman = ISPMan->new();
+$vhost = shift @ARGV;
+my $r = new CGI();
# check if domain exists
-if ($ispman->getDomainInfo($opts{"d"})) {
- $r->param("ispmanDomain", $opts{"d"});
-} else {
+if ( $ispman->getDomainInfo( $opts{"d"} ) ) {
+ $r->param( "ispmanDomain", $opts{"d"} );
+}
+else {
print "Domain \"" . $opts{"d"} . "\" does not exist!\n";
exit;
}
-$r->param("ispmanVhostName", $vhost);
-$r->param("ispmanVhostServerAlias", $opts{'a'}) if $opts{'a'};
-$r->param("userPassword", $opts{'p'}) if $opts{'p'};
+$r->param( "ispmanVhostName", $vhost );
+$r->param( "ispmanVhostServerAlias", $opts{'a'} ) if $opts{'a'};
+$r->param( "userPassword", $opts{'p'} ) if $opts{'p'};
-if ($opts{'w'}){
- $r->param("webHost", split(",", $opts{'w'}));
-} elsif (@_webhost=$ispman->as_array($ispman->getDomainAttribute($opts{'d'}, "ispmanDomainDefaultWebHost"))){
- $r->param("webHost", @_webhost);
-}elsif ($_webhost=$ispman->getHostGroupFirstMember('httpgroup')) {
- $r->param("webHost", $_webhost);
-} else {
- print "No host in webserver is the group found. \nYou cannot add vhosts untill you define some hosts in the httpgroup\n";
- exit;
+if ( $opts{'w'} ) {
+ $r->param( "webHost", split( ",", $opts{'w'} ) );
+}
+elsif (
+ @_webhost = $ispman->as_array(
+ $ispman->getDomainAttribute( $opts{'d'}, "ispmanDomainDefaultWebHost" )
+ )
+ )
+{
+ $r->param( "webHost", @_webhost );
+}
+elsif ( $_webhost = $ispman->getHostGroupFirstMember('httpgroup') ) {
+ $r->param( "webHost", $_webhost );
+}
+else {
+ print
+"No host in webserver is the group found. \nYou cannot add vhosts untill you define some hosts in the httpgroup\n";
+ exit;
}
# adding vhost
Index: ispman.listSessionProcesses
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.listSessionProcesses,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.listSessionProcesses 24 Apr 2003 21:31:40 -0000 1.2
+++ ispman.listSessionProcesses 30 May 2004 23:35:32 -0000 1.3
@@ -1,23 +1,29 @@
#!/usr/bin/perl
BEGIN {
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
-my $session=$ARGV[0];
+my $session = $ARGV[0];
use lib qw(%%installDir%%/lib);
-my $hostname=$opts{'h'} || $ENV{'HOSTNAME'};
+my $hostname = $opts{'h'} || $ENV{'HOSTNAME'};
use ISPMan;
-my $ispman=ISPMan->new();
+my $ispman = ISPMan->new();
-my $filter="ispmanSession=$session";
+my $filter = "ispmanSession=$session";
-my $processes=$ispman->getEntriesAsHashRef("ou=processes, @{[$ispman->getConf('ldapBaseDN')]}", "$filter" );
+my $processes =
+ $ispman->getEntriesAsHashRef(
+ "ou=processes, @{[$ispman->getConf('ldapBaseDN')]}", "$filter" );
-$opts{'s'}||="ispmanPid";
+$opts{'s'} ||= "ispmanPid";
-for (sort {$processes->{$a}{$opts{'s'}} cmp $processes->{$b}{$opts{'s'}}} keys %$processes){
- write();
+for ( sort { $processes->{$a}{ $opts{'s'} } cmp $processes->{$b}{ $opts{'s'} } }
+ keys %$processes )
+{
+ write();
}
format STDOUT_TOP =
@@ -25,14 +31,11 @@
-------------------------------------------------------------------------------
.
-
format STDOUT =
@<<<<< @<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<< @*
$processes->{$_}{'ispmanPid'}, $processes->{$_}{'ispmanStatus'}, $processes->{$_}{'ispmanDomain'}, $processes->{$_}{'ispmanHostName'},$processes->{$_}{'ispmanProcess'}
.
-
-
#print $ispman->dumper($processes);
__END__
Index: ispman.setVhostAlias
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.setVhostAlias,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ispman.setVhostAlias 3 Jun 2002 00:05:00 -0000 1.1
+++ ispman.setVhostAlias 30 May 2004 23:35:32 -0000 1.2
@@ -1,19 +1,22 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('dv', \%opts);
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'dv', \%opts );
- unless ($opts{'d'} && $opts{'v'} && $ARGV[0]) {
- print "$FindBin::Script -d domain -v vhost alias\n";
- print "\n";
- exit;
- }
+ unless ( $opts{'d'} && $opts{'v'} && $ARGV[0] ) {
+ print "$FindBin::Script -d domain -v vhost alias\n";
+ print "\n";
+ exit;
+ }
}
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
-my $r=$ispman->add_alias($opts{'d'}, $opts{'v'}, $ARGV[0]);
+$ispman = ISPMan->new();
+my $r = $ispman->add_alias( $opts{'d'}, $opts{'v'}, $ARGV[0] );
+
#domain, vhost
Index: ispman.listUsers
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.listUsers,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ispman.listUsers 28 Aug 2003 06:23:06 -0000 1.3
+++ ispman.listUsers 30 May 2004 23:35:32 -0000 1.4
@@ -2,40 +2,41 @@
# exaple script.
# shows users in domain
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('d', \%opts);
- unless ($opts{'d'}){
- print "Usage: $FindBin::Script -d domain";
- print "\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'd', \%opts );
+ unless ( $opts{'d'} ) {
+ print "Usage: $FindBin::Script -d domain";
+ print "\n";
+ exit;
+ }
}
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
-
+$ispman = ISPMan->new();
-if (lc($opts{'d'}) eq "all" || lc($opts{'d'}) eq "any" ) {
- my $domains=$ispman->makeDomainHash($ispman->getDomains());
- for (keys %$domains) {
- showUsers( $_);
- }
- exit;
-} else {
- showUsers($opts{'d'});
+if ( lc( $opts{'d'} ) eq "all" || lc( $opts{'d'} ) eq "any" ) {
+ my $domains = $ispman->makeDomainHash( $ispman->getDomains() );
+ for ( keys %$domains ) {
+ showUsers($_);
+ }
+ exit;
+}
+else {
+ showUsers( $opts{'d'} );
}
-
-
-
sub showUsers {
- my $domain=shift;
- print "Users for $domain\n";
- my $users=$ispman->getUsers("ispmanDomain=$domain , $ispman->{'Config'}{'ldapBaseDN'}");
- print join "\n", keys %$users;
- print "\n";
+ my $domain = shift;
+ print "Users for $domain\n";
+ my $users =
+ $ispman->getUsers(
+ "ispmanDomain=$domain , $ispman->{'Config'}{'ldapBaseDN'}");
+ print join "\n", keys %$users;
+ print "\n";
}
Index: ispman.ldifload
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.ldifload,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ispman.ldifload 28 Aug 2003 08:23:03 -0000 1.3
+++ ispman.ldifload 30 May 2004 23:35:32 -0000 1.4
@@ -1,63 +1,58 @@
#!/usr/bin/perl
package ISPMan;
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('f', \%opts);
- unless ($opts{'f'}){
- my ($script)= reverse split ("/", $0);
- print "$script. A utility to load data from ldif to ldap\n\n";
- print "Usage: $script -f filename";
- print "\n\n";
- exit;
- }
-}
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'f', \%opts );
+ unless ( $opts{'f'} ) {
+ my ($script) = reverse split( "/", $0 );
+ print "$script. A utility to load data from ldif to ldap\n\n";
+ print "Usage: $script -f filename";
+ print "\n\n";
+ exit;
+ }
+}
use vars qw($Config);
-
use Net::LDAP::LDIF;
use ISPMan::LDAP;
-require "ispman.conf" || die "Cant require ispman.conf"; # this will get us all the Config->{} variables.
-
-
-$ldif = Net::LDAP::LDIF->new( $opts{'f'});
-
+require "ispman.conf"
+ || die
+ "Cant require ispman.conf"; # this will get us all the Config->{} variables.
+$ldif = Net::LDAP::LDIF->new( $opts{'f'} );
# Dont want to log for just this. So lets make ISPMan::LDAP happy.
-sub log_event {1;};
+sub log_event { 1; }
print "$Config->{'ldapHost'}\n";
-
-my $ldap=ISPMan::LDAP->new($Config->{'ldapBaseDN'}, $Config->{'ldapHost'}, $Config->{'ldapRootDN'},$Config->{'ldapRootPass'});
-$ldap->setConfig($Config); #pass config to ISPMan::LDAP
-if (! $ldap->connected()){
- $ldap->connect();
- print "Connected";
+my $ldap = ISPMan::LDAP->new(
+ $Config->{'ldapBaseDN'}, $Config->{'ldapHost'},
+ $Config->{'ldapRootDN'}, $Config->{'ldapRootPass'}
+);
+$ldap->setConfig($Config); #pass config to ISPMan::LDAP
+if ( !$ldap->connected() ) {
+ $ldap->connect();
+ print "Connected";
}
-
-
-
-
-
-while( not $ldif->eof() ) {
- $entry = $ldif->read_entry();
- if ( $ldif->error() ) {
- print "Error msg: ",$ldif->error(),"\n";
- print "Error lines:\n",$ldif->error_lines(),"\n";
- }
- else {
+while ( not $ldif->eof() ) {
+ $entry = $ldif->read_entry();
+ if ( $ldif->error() ) {
+ print "Error msg: ", $ldif->error(), "\n";
+ print "Error lines:\n", $ldif->error_lines(), "\n";
+ }
+ else {
$entry->changetype("add");
print $entry->dn(), "\n";
- ISPMan::LDAP::try($entry->update($ISPMan::LDAP::LDAP));
- }
- }
- $ldif->done();
-
-
+ ISPMan::LDAP::try( $entry->update($ISPMan::LDAP::LDAP) );
+ }
+}
+$ldif->done();
__END__
Index: ispman.deleteDomain
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.deleteDomain,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ispman.deleteDomain 28 Apr 2003 14:40:55 -0000 1.3
+++ ispman.deleteDomain 30 May 2004 23:35:31 -0000 1.4
@@ -1,25 +1,26 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('d', \%opts);
- unless ($opts{'d'}){
- print "$0 -d domain";
- print "\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'd', \%opts );
+ unless ( $opts{'d'} ) {
+ print "$0 -d domain";
+ print "\n";
+ exit;
+ }
}
use lib qw(%%installDir%%/lib);
use ISPMan;
use CGI;
use vars qw($ispman);
-$ispman=ISPMan->new();
-$vhost =shift @ARGV;
-
-my $r=new CGI();
+$ispman = ISPMan->new();
+$vhost = shift @ARGV;
+my $r = new CGI();
-$r->param("ispmanDomain", $opts{"d"});
+$r->param( "ispmanDomain", $opts{"d"} );
$ispman->deleteDomain($r);
Index: ispman.makeHash
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.makeHash,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ispman.makeHash 25 Jun 2003 20:06:52 -0000 1.1
+++ ispman.makeHash 30 May 2004 23:35:32 -0000 1.2
@@ -1,22 +1,23 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('mh', \%opts);
- unless ($opts{'m'} && $ARGV[0] || $opts{'h'} ){
- print "USAGE: $0 -m method clearstring\n\n";
- print "Example:\n";
- print "$0 -m sha secret\n";
- print "\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'mh', \%opts );
+ unless ( $opts{'m'} && $ARGV[0] || $opts{'h'} ) {
+ print "USAGE: $0 -m method clearstring\n\n";
+ print "Example:\n";
+ print "$0 -m sha secret\n";
+ print "\n";
+ exit;
+ }
}
-
use lib qw(%%installDir%%/lib);
use ISPMan;
-my $ispman=ISPMan->new();
-print $ispman->encryptPassWithMethod($ARGV[0], $opts{'m'},) . "\n";
+my $ispman = ISPMan->new();
+print $ispman->encryptPassWithMethod( $ARGV[0], $opts{'m'}, ) . "\n";
__END__
Index: ispman.listvhosts
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.listvhosts,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- ispman.listvhosts 17 Jun 2003 18:53:33 -0000 1.5
+++ ispman.listvhosts 30 May 2004 23:35:32 -0000 1.6
@@ -1,23 +1,25 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('d', \%opts);
- unless ($opts{'d'}){
- print "$0 -d domain";
- print "\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'd', \%opts );
+ unless ( $opts{'d'} ) {
+ print "$0 -d domain";
+ print "\n";
+ exit;
+ }
}
use lib qw(%%installDir%%/lib);
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
-if (%{$ispman->getApacheVhosts($opts{'d'})}) {
- for (keys %{$ispman->getApacheVhosts($opts{'d'})}){
- print "$_\.$opts{'d'}\n";
- }
+$ispman = ISPMan->new();
+if ( %{ $ispman->getApacheVhosts( $opts{'d'} ) } ) {
+ for ( keys %{ $ispman->getApacheVhosts( $opts{'d'} ) } ) {
+ print "$_\.$opts{'d'}\n";
+ }
}
__END__
Index: ispman.ldifdump
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.ldifdump,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- ispman.ldifdump 8 Feb 2004 20:14:11 -0000 1.7
+++ ispman.ldifdump 30 May 2004 23:35:32 -0000 1.8
@@ -1,121 +1,122 @@
#!/usr/bin/perl
package ISPMan;
+
BEGIN {
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopts('hvn', \%opts);
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopts( 'hvn', \%opts );
- if ($opts{'h'}) {
- print "$FindBin::Script [-h] [-v] [-n]\n\n";
- print "-h\tPrint this help screen\n";
- print "-v\tBe Verbose\n";
- print "-n\tDry run. Just show what will happen\n";
- exit;
- }
+ if ( $opts{'h'} ) {
+ print "$FindBin::Script [-h] [-v] [-n]\n\n";
+ print "-h\tPrint this help screen\n";
+ print "-v\tBe Verbose\n";
+ print "-n\tDry run. Just show what will happen\n";
+ exit;
+ }
}
-
-
use vars qw($Config);
$|++;
-
-# In this small program, we dont need to load all the ISPMan::* modules
+# In this small program, we dont need to load all the ISPMan::* modules
# which are loaded when we call use ISPMan
# instead we just require the conf file and load only ISPMan::LDAP module
-
use ISPMan::LDAP;
-require "ispman.conf"; # this will get us all the Config->{} variables.
+require "ispman.conf"; # this will get us all the Config->{} variables.
use Net::LDAP::LDIF;
-my $out = Net::LDAP::LDIF->new("-", "w");
-
-
+my $out = Net::LDAP::LDIF->new( "-", "w" );
# Dont want to log for just this. So lets make ISPMan::LDAP happy.
-sub log_event {1;};
+sub log_event { 1; }
-my $ldap=ISPMan::LDAP->new($Config->{'ldapBaseDN'}, $Config->{'ldapHost'}, $Config->{'ldapRootDN'},$Config->{'ldapRootPass'});
-$ldap->setConfig($Config); #pass config to ISPMan::LDAP
-if (! $ldap->connected()){
- $ldap->connect();
+my $ldap = ISPMan::LDAP->new(
+ $Config->{'ldapBaseDN'}, $Config->{'ldapHost'},
+ $Config->{'ldapRootDN'}, $Config->{'ldapRootPass'}
+);
+$ldap->setConfig($Config); #pass config to ISPMan::LDAP
+if ( !$ldap->connected() ) {
+ $ldap->connect();
}
-
-
[email protected]=();
-
[email protected] = ();
#get base.
-
-print STDERR "Dumping Base: $Config->{'ldapBaseDN'}\n" if $opts{'n'} || $opts{'v'};
-$entry=$ldap->getEntry($Config->{'ldapBaseDN'});
+print STDERR "Dumping Base: $Config->{'ldapBaseDN'}\n"
+ if $opts{'n'} || $opts{'v'};
+$entry = $ldap->getEntry( $Config->{'ldapBaseDN'} );
push @entries, $entry unless $opts{'n'};
-
#get conf
-push @entries, $ldap->getEntries(join ",", ("ou=conf", $Config->{'ldapBaseDN'}));
-
+push @entries,
+ $ldap->getEntries( join ",", ( "ou=conf", $Config->{'ldapBaseDN'} ) );
#get admins
-push @entries, $ldap->getEntries(join ",", ("ou=admins", $Config->{'ldapBaseDN'}));
+push @entries,
+ $ldap->getEntries( join ",", ( "ou=admins", $Config->{'ldapBaseDN'} ) );
#get counters
-push @entries, $ldap->getEntries(join ",", ("ou=counters", $Config->{'ldapBaseDN'}));
+push @entries,
+ $ldap->getEntries( join ",", ( "ou=counters", $Config->{'ldapBaseDN'} ) );
#get hosts
-push @entries, $ldap->getEntries(join ",", ("ou=hosts", $Config->{'ldapBaseDN'}));
+push @entries,
+ $ldap->getEntries( join ",", ( "ou=hosts", $Config->{'ldapBaseDN'} ) );
#get hostgroups
-push @entries, $ldap->getEntries(join ",", ("ou=hostgroups", $Config->{'ldapBaseDN'}));
+push @entries,
+ $ldap->getEntries( join ",", ( "ou=hostgroups", $Config->{'ldapBaseDN'} ) );
#get domainServices
-push @entries, $ldap->getEntries(join ",", ("ou=domainServices", $Config->{'ldapBaseDN'}));
+push @entries,
+ $ldap->getEntries( join ",",
+ ( "ou=domainServices", $Config->{'ldapBaseDN'} ) );
#get processes
-push @entries, $ldap->getEntries(join ",", ("ou=processes", $Config->{'ldapBaseDN'}));
-
+push @entries,
+ $ldap->getEntries( join ",", ( "ou=processes", $Config->{'ldapBaseDN'} ) );
#get DNS
-push @entries, $ldap->getEntries(join ",", ("ou=DNS", $Config->{'ldapBaseDN'}));
-
+push @entries,
+ $ldap->getEntries( join ",", ( "ou=DNS", $Config->{'ldapBaseDN'} ) );
#get Resellers and clients
-push @entries, $ldap->getEntries(join ",", ("ou=xispman", $Config->{'ldapBaseDN'}));
-
+push @entries,
+ $ldap->getEntries( join ",", ( "ou=xispman", $Config->{'ldapBaseDN'} ) );
#get domains
[email protected]=$ldap->getEntries($Config->{'ldapBaseDN'}, "objectclass=ispmanDomain", [], "one");
[email protected] = $ldap->getEntries( $Config->{'ldapBaseDN'},
+ "objectclass=ispmanDomain", [], "one" );
#push @entries, @domains;
-for $domain(@domains) {
- push @entries, $domain;
- print STDERR "Adding Domain: ", $domain->dn(), "\n" if $opts{'n'} || $opts{'v'};
- @branches=$ldap->getEntries($domain->dn(), undef, undef, "one");
- for $branch(@branches) {
- print STDERR "Adding Branch: ", $branch->dn(), "\n" if $opts{'n'} || $opts{'v'};
- @branchedata=$ldap->getEntries($branch->dn());
- push @entries, @branchedata;
- for $bd(@branchedata) {
- print STDERR "Branch Child: " , $bd->dn() , "\n" if $opts{'n'} || $opts{'v'};
- }
- }
+for $domain (@domains) {
+ push @entries, $domain;
+ print STDERR "Adding Domain: ", $domain->dn(), "\n"
+ if $opts{'n'} || $opts{'v'};
+ @branches = $ldap->getEntries( $domain->dn(), undef, undef, "one" );
+ for $branch (@branches) {
+ print STDERR "Adding Branch: ", $branch->dn(), "\n"
+ if $opts{'n'} || $opts{'v'};
+ @branchedata = $ldap->getEntries( $branch->dn() );
+ push @entries, @branchedata;
+ for $bd (@branchedata) {
+ print STDERR "Branch Child: ", $bd->dn(), "\n"
+ if $opts{'n'} || $opts{'v'};
+ }
+ }
}
-
-
-
$out->write_entry(@entries);
-
sub getBranches {
}
-
__END__
Index: ispman.getMailAliasesForUser
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.getMailAliasesForUser,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.getMailAliasesForUser 24 Apr 2003 21:31:39 -0000 1.2
+++ ispman.getMailAliasesForUser 30 May 2004 23:35:32 -0000 1.3
@@ -1,22 +1,24 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('du', \%opts);
- unless ($opts{'d'} && $opts{'u'}){
- print "Usage: $FindBin::Script -d domain -u username \n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'du', \%opts );
+ unless ( $opts{'d'} && $opts{'u'} ) {
+ print "Usage: $FindBin::Script -d domain -u username \n";
+ exit;
+ }
}
use ISPMan;
-my $ispman=ISPMan->new();
-my @list=$ispman->as_array($ispman->getMailAliasesForUser($opts{'u'}, $opts{'d'}));
+my $ispman = ISPMan->new();
+my @list =
+ $ispman->as_array( $ispman->getMailAliasesForUser( $opts{'u'}, $opts{'d'} ) );
for (@list) {
- print "$_\n";
+ print "$_\n";
}
-
Index: ispman.alias.mailgroup
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.alias.mailgroup,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ispman.alias.mailgroup 14 May 2003 10:31:07 -0000 1.1
+++ ispman.alias.mailgroup 30 May 2004 23:35:31 -0000 1.2
@@ -1,16 +1,18 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('dg', \%opts);
- unless ($opts{'d'} && $opts{'g'}){
- print "$FindBin::Script -d domain -g mailgroup alias";
- print "\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'dg', \%opts );
+ unless ( $opts{'d'} && $opts{'g'} ) {
+ print "$FindBin::Script -d domain -g mailgroup alias";
+ print "\n";
+ exit;
+ }
}
use ISPMan;
-my $ispman=ISPMan->new();
-print $ispman->dumper($ispman->get_mail_groups($opts{'d'}));
+my $ispman = ISPMan->new();
+print $ispman->dumper( $ispman->get_mail_groups( $opts{'d'} ) );
print "\n";
Index: ldifgrep
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ldifgrep,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ldifgrep 10 May 2002 12:55:41 -0000 1.2
+++ ldifgrep 30 May 2004 23:35:32 -0000 1.3
@@ -1,60 +1,56 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
use Getopt::Std;
getopts('v');
- unless ($ARGV[1]){
+ unless ( $ARGV[1] ) {
print "USAGE: $0 [-v] attribute value <infile [>outfile]\n\n";
exit;
}
}
-
-
use Net::LDAP::LDIF;
use Net::LDAP::Entry;
use vars qw($ldif $out);
-$ldif = Net::LDAP::LDIF->new(\*STDIN, "r");
-$out = Net::LDAP::LDIF->new("-", "w");
-
-
-$function=($opt_v)?"has_not":"has";
-
-
-
+$ldif = Net::LDAP::LDIF->new( \*STDIN, "r" );
+$out = Net::LDAP::LDIF->new( "-", "w" );
+$function = ($opt_v) ? "has_not" : "has";
[email protected]=();
[email protected] = ();
while ( not $ldif->eof() ) {
$entry = $ldif->read_entry();
if ( $ldif->error() ) {
- print "Error msg: ",$ldif->error(),"\n";
- print "Error lines:\n",$ldif->error_lines(),"\n";
- } else {
-
- push @entries, $entry if &{$function}($entry, @ARGV);
+ print "Error msg: ", $ldif->error(), "\n";
+ print "Error lines:\n", $ldif->error_lines(), "\n";
+ }
+ else {
+
+ push @entries, $entry if &{$function}( $entry, @ARGV );
}
}
$out->write_entry(@entries);
-
sub has {
- my ($e, $attr, $val)=@_;
- if ($attr eq "dn") {
- return 1 if $e->dn ()=~ /$val/;
- } else {
- @vals= $e->get_value($attr);
- return 1 if grep (/$val/, @vals);
+ my ( $e, $attr, $val ) = @_;
+ if ( $attr eq "dn" ) {
+ return 1 if $e->dn() =~ /$val/;
}
- return 0;
+ else {
+ @vals = $e->get_value($attr);
+ return 1 if grep ( /$val/, @vals );
+ }
+ return 0;
}
sub has_not {
- return ! &has(@_);
+ return !&has(@_);
}
__END__
Index: ispman.addAdmin
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.addAdmin,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.addAdmin 10 May 2002 12:36:52 -0000 1.2
+++ ispman.addAdmin 30 May 2004 23:35:31 -0000 1.3
@@ -1,21 +1,22 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('flmp', \%opts);
- unless ($opts{'l'} && $opts{'p'} && $ARGV[0]){
- print "$0 -l level [-f fullname] [-m email] -p password uid";
- print "\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'flmp', \%opts );
+ unless ( $opts{'l'} && $opts{'p'} && $ARGV[0] ) {
+ print "$0 -l level [-f fullname] [-m email] -p password uid";
+ print "\n";
+ exit;
+ }
}
-
use lib qw(%%installDir%%/lib);
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
+$ispman = ISPMan->new();
-$ispman->_addAdmin($ARGV[0], map {$opts{$_}} qw(p l f m))
+$ispman->_addAdmin( $ARGV[0], map { $opts{$_} } qw(p l f m) )
Index: ispman.userInfo
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.userInfo,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ispman.userInfo 3 Oct 2003 15:58:01 -0000 1.3
+++ ispman.userInfo 30 May 2004 23:35:32 -0000 1.4
@@ -1,19 +1,21 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('du', \%opts);
- unless ($opts{'d'} && $opts{'u'}){
- print "Usage: $FindBin::Script -d domain -u username \n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'du', \%opts );
+ unless ( $opts{'d'} && $opts{'u'} ) {
+ print "Usage: $FindBin::Script -d domain -u username \n";
+ exit;
+ }
}
use ISPMan;
-my $ispman=ISPMan->new();
+my $ispman = ISPMan->new();
-my $dn=$ispman->getUserDN($opts{'d'}, $opts{'u'});
-my $entry=$ispman->getEntry($dn);
+my $dn = $ispman->getUserDN( $opts{'d'}, $opts{'u'} );
+my $entry = $ispman->getEntry($dn);
$ispman->dumpEntry($entry);
Index: ispman-agent
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman-agent,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- ispman-agent 30 May 2004 19:50:46 -0000 1.61
+++ ispman-agent 30 May 2004 23:35:31 -0000 1.62
@@ -7,24 +7,25 @@
# example /opt/ispman/bin/ispman-agent nodetach
package ISPMan;
+
BEGIN {
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
$|++;
-
-
#use strict;
use vars qw(
- $VERSION @ISA @EXPORT @EXPORT_OK $TEST
- $name $hostname $hostnames $ispman $domains $log
- );
+ $VERSION @ISA @EXPORT @EXPORT_OK $TEST
+ $name $hostname $hostnames $ispman $domains $log
+);
require Exporter;
--dfGzR35o/[email protected] = qw(Exporter AutoLoader);
[email protected] = qw();
+-dfGzR35o/[email protected] = qw(Exporter AutoLoader);
[email protected] = qw();
$VERSION = '0.01';
use Data::Dumper;
@@ -34,24 +35,16 @@
use Sys::Hostname;
use Log::FileSimple;
-
-
require "ispman.conf";
+$name = "ispman-agent";
+$install_dir = $Config->{'installDir'};
+$TEST = $Config->{'TEST'};
+$hostname = hostname(); # find hostname using Sys::Hostname. -End-Of-Story-
-
-
-$name="ispman-agent";
-$install_dir=$Config->{'installDir'};
-$TEST=$Config->{'TEST'};
-
-
-
-$hostname=hostname(); # find hostname using Sys::Hostname. -End-Of-Story-
#If you dont have Sys::Hostname, you probably cant run ispman anyway,
-
######## Additional hostnames by which this agent will ################
######## recognize processes for this host. ################
##########################################################################
@@ -67,36 +60,40 @@
# will find
# Use the script ispman.myhostname to see how ispman-agent will see the hostname
-my $pid_file = ($Config->{"pid_file"}=~/\S/)? $Config->{"pid_file"} : join "/", ($Config->{"installDir"}, "var/$hostname.ispman-agent.pid");
-my $log_file = ($Config->{"log_file"}=~/\S/)? $Config->{"log_file"} : join "/", ($Config->{"installDir"}, "var/$hostname.ispman-agent.log");
+my $pid_file =
+ ( $Config->{"pid_file"} =~ /\S/ ) ? $Config->{"pid_file"} : join "/",
+ ( $Config->{"installDir"}, "var/$hostname.ispman-agent.pid" );
+my $log_file =
+ ( $Config->{"log_file"} =~ /\S/ ) ? $Config->{"log_file"} : join "/",
+ ( $Config->{"installDir"}, "var/$hostname.ispman-agent.log" );
-my ($pid, $job);
+my ( $pid, $job );
-if ($ARGV[0]=~/stop|restart|forcerestart/i){
- unless (-e $pid_file){
- print "pid file $pid_file not found\n";
- print "No ispman-agent processes running?\n";
- print "Instead use $FindBin::Script start\n";
- exit(0);
- }
+if ( $ARGV[0] =~ /stop|restart|forcerestart/i ) {
+ unless ( -e $pid_file ) {
+ print "pid file $pid_file not found\n";
+ print "No ispman-agent processes running?\n";
+ print "Instead use $FindBin::Script start\n";
+ exit(0);
+ }
- my $pid=`cat $pid_file`;
- chomp $pid;
- print "Shutting down $name\n";
- kill 15, $pid;
- print "killed process $pid\n";
- print "Shutdown complete\n";
- unlink $pid_file && exit(0) if $ARGV[0] =~/stop/i;
- unlink $pid_file if $ARGV[0] =~ /forcerestart/i;
- sleep (1) if $ARGV[0] =~/restart/i;
+ my $pid = `cat $pid_file`;
+ chomp $pid;
+ print "Shutting down $name\n";
+ kill 15, $pid;
+ print "killed process $pid\n";
+ print "Shutdown complete\n";
+ unlink $pid_file && exit(0) if $ARGV[0] =~ /stop/i;
+ unlink $pid_file if $ARGV[0] =~ /forcerestart/i;
+ sleep(1) if $ARGV[0] =~ /restart/i;
}
- if ($ARGV[0] && ($ARGV[0] =~ /stop|restart|forcerestart/i)) {
- unless (-e $pid_file) {
- print "pid file $pid_file not found\n";
- print "No ispman-agent processes running?\n";
- print "Instead use $FindBin::Script start\n";
- exit(1);
+if ( $ARGV[0] && ( $ARGV[0] =~ /stop|restart|forcerestart/i ) ) {
+ unless ( -e $pid_file ) {
+ print "pid file $pid_file not found\n";
+ print "No ispman-agent processes running?\n";
+ print "Instead use $FindBin::Script start\n";
+ exit(1);
}
$pid = `cat $pid_file`;
chomp($pid);
@@ -104,410 +101,430 @@
kill 15, $pid;
print "killed process $pid\n";
print "Shutdown complete\n";
- unlink $pid_file && exit(0) if lc($ARGV[0]) eq "stop";
- unlink $pid_file if lc($ARGV[0]) eq "forcerestart";
- sleep(1) if lc($ARGV[0]) eq "restart";
- }
+ unlink $pid_file && exit(0) if lc( $ARGV[0] ) eq "stop";
+ unlink $pid_file if lc( $ARGV[0] ) eq "forcerestart";
+ sleep(1) if lc( $ARGV[0] ) eq "restart";
+}
$SIG{TERM} = sub {
- unlink $pid_file;
- exit(0);
+ unlink $pid_file;
+ exit(0);
};
-if (-e $pid_file){
- print "pid file already exists? unclean shudown?\n";
- # This shouldn't exit here but it should perhaps use a killall $name ?
- #exit(1);
-}
+if ( -e $pid_file ) {
+ print "pid file already exists? unclean shudown?\n";
+ # This shouldn't exit here but it should perhaps use a killall $name ?
+ #exit(1);
+}
sub open_log {
+
# obsolete. Do nothing.
}
-
sub init_log {
- $log = new Log::FileSimple(
- name => 'ispman-agent',
+ $log = new Log::FileSimple(
+ name => 'ispman-agent',
file => $log_file,
mask => -1,
autoflush => 1,
- );
+ );
}
-
-
sub daemonize {
- open_log;
- defined(my $pid = fork) or die "Can't fork: $!";
- if ($pid) {
- open ("PID", ">$pid_file");
- print PID "$pid\n";
- close("PID");
- print "Process forked. ";
- print "pid is $pid\nUsing pidfile $pid_file\n";
- setsid or die "Can't start a new session: $!";
- exit 0; # I am the parent
- }
+ open_log;
+ defined( my $pid = fork ) or die "Can't fork: $!";
+ if ($pid) {
+ open( "PID", ">$pid_file" );
+ print PID "$pid\n";
+ close("PID");
+ print "Process forked. ";
+ print "pid is $pid\nUsing pidfile $pid_file\n";
+ setsid or die "Can't start a new session: $!";
+ exit 0; # I am the parent
+ }
}
-
-if ($ARGV[0] eq "nodetach"){
- open_log();
-} else {
- daemonize();
+if ( $ARGV[0] eq "nodetach" ) {
+ open_log();
+}
+else {
+ daemonize();
}
-
-
-
-
-
-
-
require ISPMan;
import ISPMan;
-$ispman=ISPMan->new();
+$ispman = ISPMan->new();
-$agentFrequency=$ispman->getConf("agentFrequency") || 1;
-$ldapBaseDN=$ispman->getConf('ldapBaseDN');
-$namedConfFile = $ispman->getConf('namedConfFile');
-$namedConfHeaderFile = $ispman->getConf('namedConfHeaderFile');
-$namedConfFooterFile = $ispman->getConf('namedConfFooterFile');
+$agentFrequency = $ispman->getConf("agentFrequency") || 1;
+$ldapBaseDN = $ispman->getConf('ldapBaseDN');
+$namedConfFile = $ispman->getConf('namedConfFile');
+$namedConfHeaderFile = $ispman->getConf('namedConfHeaderFile');
+$namedConfFooterFile = $ispman->getConf('namedConfFooterFile');
-$namedDir=join "/", ($ispman->getConf('namedDir'), $ispman->getConf('namedIspmanSubDir'));
-$namedRevDir=join "/", ($namedDir, $ispman->getConf('namedRevDir'));
-$namedPriDir=join "/", ($namedDir, $ispman->getConf('namedPriDir'));
-$namedSecDir=join "/", ($namedDir, $ispman->getConf('namedSecDir'));
+$namedDir = join "/",
+ ( $ispman->getConf('namedDir'), $ispman->getConf('namedIspmanSubDir') );
+$namedRevDir = join "/", ( $namedDir, $ispman->getConf('namedRevDir') );
+$namedPriDir = join "/", ( $namedDir, $ispman->getConf('namedPriDir') );
+$namedSecDir = join "/", ( $namedDir, $ispman->getConf('namedSecDir') );
-$namedDir =~ s!//!/!g;
-$namedRevDir =~ s!//!/!g;
-$namedPriDir =~ s!//!/!g;
-$namedSecDir =~ s!//!/!g;
+$namedDir =~ s!//!/!g;
+$namedRevDir =~ s!//!/!g;
+$namedPriDir =~ s!//!/!g;
+$namedSecDir =~ s!//!/!g;
# get all host aliases
--WI0L6dQK/[email protected]=$ispman->as_array($ispman->getHostInfo($hostname)->{'ispmanHostAlias'});
-push @hostnames,$hostname;
+-WI0L6dQK/[email protected] =
+ $ispman->as_array( $ispman->getHostInfo($hostname)->{'ispmanHostAlias'} );
+push @hostnames, $hostname;
# Stanislav Sinyagin <ssinyagin-/[email protected]>
# Jobs are ordered by priority. #1 goes first.
# Default priority is 100.
-%jobPriorities = ('createMailbox' => 1);
+%jobPriorities = ( 'createMailbox' => 1 );
-sub jobPriority{
- my $job = shift;
- return( defined($jobPriorities{$job}) ?
- $jobPriorities{$job} : 100 );
+sub jobPriority {
+ my $job = shift;
+ return ( defined( $jobPriorities{$job} ) ? $jobPriorities{$job} : 100 );
}
+while (true) {
+ $ispman = ISPMan->new();
-while (true){
- $ispman=ISPMan->new();
- #if (!$ispman || !$ispman->ldap_ping()){
- # print "Creating new connection";
- # $ispman=ISPMan->new() || (print "Could not create an ISPMan instance" && die);
- #}
+#if (!$ispman || !$ispman->ldap_ping()){
+# print "Creating new connection";
+# $ispman=ISPMan->new() || (print "Could not create an ISPMan instance" && die);
+#}
- $processes=$ispman->getProcessesForHost(\@hostnames);
- my $processHash;
- my ($domain, $params, $process);
- my $message = "";
+ $processes = $ispman->getProcessesForHost( \@hostnames );
+ my $processHash;
+ my ( $domain, $params, $process );
+ my $message = "";
- for (keys %$processes) {
- $domain = $processes->{$_}{'ispmanDomain'};
- $params = $processes->{$_}{'ispmanParams'} || "";
- $process = $processes->{$_}{'ispmanProcess'};
- $pid = $_;
- push @{$processHash->{$domain}{$process}{$params}}, $pid;
- }
+ for ( keys %$processes ) {
+ $domain = $processes->{$_}{'ispmanDomain'};
+ $params = $processes->{$_}{'ispmanParams'} || "";
+ $process = $processes->{$_}{'ispmanProcess'};
+ $pid = $_;
+ push @{ $processHash->{$domain}{$process}{$params} }, $pid;
+ }
- #Only Dump the process data if debug is more than 2
- print Dumper($processHash) if $processHash && $ispman->{'Config'}{'debug'}>2;
+ #Only Dump the process data if debug is more than 2
+ print Dumper($processHash)
+ if $processHash && $ispman->{'Config'}{'debug'} > 2;
- for $domain (keys %$processHash) {
- for $job(sort {jobPriority($a) <=> jobPriority($b)} keys %{$processHash->{$domain}}) {
- for $params(keys %{$processHash->{$domain}{$job}}) {
- log_message("Doing $job on $domain with parameters $params\n");
- $message = &{$job}($domain, $params);
- if ($message==1) {
- $ispman->deleteProcesses($processHash->{$domain}{$job}{$params});
- } else {
- $ispman->updateProcess($processHash->{$domain}{$job}{$params}, "error", $message);
+ for $domain ( keys %$processHash ) {
+ for $job ( sort { jobPriority($a) <=> jobPriority($b) }
+ keys %{ $processHash->{$domain} } )
+ {
+ for $params ( keys %{ $processHash->{$domain}{$job} } ) {
+ log_message("Doing $job on $domain with parameters $params\n");
+ $message = &{$job}( $domain, $params );
+ if ( $message == 1 ) {
+ $ispman->deleteProcesses(
+ $processHash->{$domain}{$job}{$params} );
+ }
+ else {
+ $ispman->updateProcess(
+ $processHash->{$domain}{$job}{$params},
+ "error", $message );
+ }
+ }
}
- }
}
- }
+ if ($TEST) {
+ log_message( "Sleeping for ", 2 * $agentFrequency, " seconds" );
+ sleep( 2 * $agentFrequency );
- if ($TEST){
- log_message("Sleeping for " ,2 * $agentFrequency, " seconds");
- sleep (2 * $agentFrequency);
-
- } else {
- sleep (60 * $agentFrequency);
-}
+ }
+ else {
+ sleep( 60 * $agentFrequency );
+ }
}
-
-
sub modifyDomain {
- my $domain = shift;
- log_message( "Modifying $domain\n" );
+ my $domain = shift;
+ log_message("Modifying $domain\n");
- my $module = "$install_dir/lib/dns.lib";
- do $module;
+ my $module = "$install_dir/lib/dns.lib";
+ do $module;
- ### FIXME
- ### Commented out for now as this break dns, dnsHost needs to be added
- ### to objectclass=ispmanDomain first
- my $filter = sprintf ("&(objectclass=ispmanDomain)"); #(dnsHost=%s)" , $hostname);
- &make_named_conf($domain, $filter);
- return 1;
+ ### FIXME
+ ### Commented out for now as this break dns, dnsHost needs to be added
+ ### to objectclass=ispmanDomain first
+ my $filter =
+ sprintf("&(objectclass=ispmanDomain)"); #(dnsHost=%s)" , $hostname);
+ &make_named_conf( $domain, $filter );
+ return 1;
}
sub createMailbox {
- my ($domain, $mailbox) = @_;
+ my ( $domain, $mailbox ) = @_;
- my $module = "$install_dir/lib/create_mailbox.lib";
- do $module;
+ my $module = "$install_dir/lib/create_mailbox.lib";
+ do $module;
- &create_mailbox_handler($mailbox);
- return 1;
+ &create_mailbox_handler($mailbox);
+ return 1;
}
sub setMailboxQuota {
- my ($domain, $params) = @_;
+ my ( $domain, $params ) = @_;
- my ($mailbox, $quota) = split(",", $params);
+ my ( $mailbox, $quota ) = split( ",", $params );
- my $module = "$install_dir/lib/set_mailbox_quota.lib";
- do $module;
+ my $module = "$install_dir/lib/set_mailbox_quota.lib";
+ do $module;
- &set_mailbox_quota_handler($mailbox, $quota);
- return 1;
+ &set_mailbox_quota_handler( $mailbox, $quota );
+ return 1;
}
sub deleteMailbox {
- my ($domain, $mailbox) = @_;
+ my ( $domain, $mailbox ) = @_;
- my $module = "$install_dir/lib/delete_mailbox.lib";
- do $module;
+ my $module = "$install_dir/lib/delete_mailbox.lib";
+ do $module;
- &delete_mailbox_handler($mailbox);
- return 1;
+ &delete_mailbox_handler($mailbox);
+ return 1;
}
sub createHomeDirectory {
- my ($domain, $user) = @_;
+ my ( $domain, $user ) = @_;
- my $module = "$install_dir/lib/create_home_directory.lib";
- do $module;
+ my $module = "$install_dir/lib/create_home_directory.lib";
+ do $module;
- my $user_info = $ispman->getUserInfo($user);
- &create_home_directory_handler($user_info->{'homeDirectory'}, $user_info->{'uidNumber'}, $user_info->{'gidNumber'});
- return 1;
+ my $user_info = $ispman->getUserInfo($user);
+ &create_home_directory_handler(
+ $user_info->{'homeDirectory'},
+ $user_info->{'uidNumber'},
+ $user_info->{'gidNumber'}
+ );
+ return 1;
}
sub deleteHomeDirectory {
- my ($domain, $params) = @_;
- my ($user, $home_directory, $owner, $group) = split(",", $params);
+ my ( $domain, $params ) = @_;
+ my ( $user, $home_directory, $owner, $group ) = split( ",", $params );
- my $module = "$install_dir/lib/delete_home_directory.lib";
- do $module;
+ my $module = "$install_dir/lib/delete_home_directory.lib";
+ do $module;
- &delete_home_directory_handler($home_directory, $owner, $group);
- return 1;
+ &delete_home_directory_handler( $home_directory, $owner, $group );
+ return 1;
}
sub DeleteVirtualHostDirectories {
- my ($domain, $params) = @_;
- my ($vhost, $home_directory, $htdocs_dir, $cgibin_dir, $log_dir, $stats_dir) = split(",", $params);
+ my ( $domain, $params ) = @_;
+ my ( $vhost, $home_directory, $htdocs_dir, $cgibin_dir, $log_dir,
+ $stats_dir )
+ = split( ",", $params );
- my $module = "$install_dir/lib/delete_vhost_directories.lib";
- do $module;
+ my $module = "$install_dir/lib/delete_vhost_directories.lib";
+ do $module;
- &delete_vhost_directories_handler($vhost, $home_directory, $htdocs_dir, $cgibin_dir, $log_dir, $stats_dir);
- return 1;
+ &delete_vhost_directories_handler( $vhost, $home_directory, $htdocs_dir,
+ $cgibin_dir, $log_dir, $stats_dir );
+ return 1;
}
sub createDomainDirectories {
- my ($domain) = @_;
+ my ($domain) = @_;
- my $module = "$install_dir/lib/create_domain_directories.lib";
- do $module;
-
- my $domain_info = $ispman->getDomainInfo($domain);
- &create_domain_directories_handler($domain_info->{'homeDirectory'}, $domain_info->{'uidNumber'}, $domain_info->{'gidNumber'});
- return 1;
+ my $module = "$install_dir/lib/create_domain_directories.lib";
+ do $module;
+
+ my $domain_info = $ispman->getDomainInfo($domain);
+ &create_domain_directories_handler(
+ $domain_info->{'homeDirectory'},
+ $domain_info->{'uidNumber'},
+ $domain_info->{'gidNumber'}
+ );
+ return 1;
}
sub deleteDomainDirectories {
- my ($domain, $params) = @_;
- my ($home_directory, $owner, $group) = split(",", $params);
+ my ( $domain, $params ) = @_;
+ my ( $home_directory, $owner, $group ) = split( ",", $params );
- my $module = "$install_dir/lib/delete_domain_directories.lib";
- do $module;
+ my $module = "$install_dir/lib/delete_domain_directories.lib";
+ do $module;
- &delete_domain_directories_handler($home_directory, $owner, $group);
- return 1;
+ &delete_domain_directories_handler( $home_directory, $owner, $group );
+ return 1;
}
sub makeCanonicalMaps {
- my ($domain, $params) = @_;
- # Atif. 2003-10-07: Where did this come from?
- # my ($home_directory, $owner, $group) = split(",", $params);
+ my ( $domain, $params ) = @_;
- my $module = "$install_dir/lib/smtp.lib";
- do $module;
+ # Atif. 2003-10-07: Where did this come from?
+ # my ($home_directory, $owner, $group) = split(",", $params);
- &make_canonical_maps($home_directory, $owner, $group);
- return 1;
+ my $module = "$install_dir/lib/smtp.lib";
+ do $module;
+
+ &make_canonical_maps( $home_directory, $owner, $group );
+ return 1;
}
sub AddCanonicalMapEntry {
- my ($domain, $params) = @_;
+ my ( $domain, $params ) = @_;
- my $module = "$install_dir/lib/smtp.lib";
- do $module;
+ my $module = "$install_dir/lib/smtp.lib";
+ do $module;
- &add_canonical_map_entry($domain, $params);
- return 1;
+ &add_canonical_map_entry( $domain, $params );
+ return 1;
}
sub AddRelayDomainEntry {
- my ($domain, $params) = @_;
+ my ( $domain, $params ) = @_;
- my $module = "$install_dir/lib/smtp.lib";
- do $module;
+ my $module = "$install_dir/lib/smtp.lib";
+ do $module;
- &add_relay_domain_entry($domain);
- return 1;
+ &add_relay_domain_entry($domain);
+ return 1;
}
sub AddDestinationDomainEntry {
- my ($domain, $params) = @_;
+ my ( $domain, $params ) = @_;
- my $module = "$install_dir/lib/smtp.lib";
- do $module;
+ my $module = "$install_dir/lib/smtp.lib";
+ do $module;
- &add_destination_domain_entry($domain);
- return 1;
+ &add_destination_domain_entry($domain);
+ return 1;
}
sub RemoveCanonicalMapEntry {
- my ($domain, $params) = @_;
+ my ( $domain, $params ) = @_;
- my $module = "$install_dir/lib/smtp.lib";
- do $module;
+ my $module = "$install_dir/lib/smtp.lib";
+ do $module;
- &remove_canonical_map_entry($domain);
- return 1;
+ &remove_canonical_map_entry($domain);
+ return 1;
}
sub RemoveRelayDomainEntry {
- my ($domain, $params) = @_;
+ my ( $domain, $params ) = @_;
- my $module = "$install_dir/lib/smtp.lib";
- do $module;
+ my $module = "$install_dir/lib/smtp.lib";
+ do $module;
- &remove_relay_domain_entry($domain);
- return 1;
+ &remove_relay_domain_entry($domain);
+ return 1;
}
sub RemoveDestinationDomainEntry {
- my ($domain, $params) = @_;
+ my ( $domain, $params ) = @_;
- my $module = "$install_dir/lib/smtp.lib";
- do $module;
+ my $module = "$install_dir/lib/smtp.lib";
+ do $module;
- &remove_destination_domain_entry($domain);
- return 1;
+ &remove_destination_domain_entry($domain);
+ return 1;
}
sub AddVirtualHost {
- my ($domain, $params) = @_;
+ my ( $domain, $params ) = @_;
- my $module = "$install_dir/lib/http.lib";
- do $module;
+ my $module = "$install_dir/lib/http.lib";
+ do $module;
- my $vhost = $params;
- my $template = $ispman->getTemplate("$install_dir/templates/vhosts.conf.template");
- return 1 if (add_vhost($vhost, $domain) && make_vhosts_conf($template, $domain) && reloadApache());
+ my $vhost = $params;
+ my $template =
+ $ispman->getTemplate("$install_dir/templates/vhosts.conf.template");
+ return 1
+ if ( add_vhost( $vhost, $domain )
+ && make_vhosts_conf( $template, $domain )
+ && reloadApache() );
}
sub ModifyVirtualHost {
- my ($domain, $params) = @_;
+ my ( $domain, $params ) = @_;
- my $module = "$install_dir/lib/http.lib";
- do $module;
+ my $module = "$install_dir/lib/http.lib";
+ do $module;
- my $vhost = $params;
- my $template = $ispman->getTemplate("$install_dir/templates/vhosts.conf.template");
- return 1 if (modify_vhost($vhost, $domain) && make_vhosts_conf($template, $domain) && reloadApache());
+ my $vhost = $params;
+ my $template =
+ $ispman->getTemplate("$install_dir/templates/vhosts.conf.template");
+ return 1
+ if ( modify_vhost( $vhost, $domain )
+ && make_vhosts_conf( $template, $domain )
+ && reloadApache() );
}
sub DeleteVirtualHost {
- my ($domain, $params) = @_;
+ my ( $domain, $params ) = @_;
- my $module = "$install_dir/lib/http.lib";
- do $module;
+ my $module = "$install_dir/lib/http.lib";
+ do $module;
- my $vhost = $params;
- my $template = $ispman->getTemplate("$install_dir/templates/vhosts.conf.template");
- return 1 if (delete_vhost($vhost, $domain) && make_vhosts_conf($template, $domain) && reloadApache());
+ my $vhost = $params;
+ my $template =
+ $ispman->getTemplate("$install_dir/templates/vhosts.conf.template");
+ return 1
+ if ( delete_vhost( $vhost, $domain )
+ && make_vhosts_conf( $template, $domain )
+ && reloadApache() );
}
sub AddVirtualHostDirectories {
- my ($domain, $params) = @_;
+ my ( $domain, $params ) = @_;
- my $module = "$install_dir/lib/create_vhost_directories.lib";
- do $module;
+ my $module = "$install_dir/lib/create_vhost_directories.lib";
+ do $module;
- return 1 if (&create_vhost_directories_handler(split(",", $params)));
+ return 1 if ( &create_vhost_directories_handler( split( ",", $params ) ) );
}
sub modifyTransport {
- my ($domain, $params) = @_;
+ my ( $domain, $params ) = @_;
- my $module = "$install_dir/lib/smtp.lib";
- do $module;
+ my $module = "$install_dir/lib/smtp.lib";
+ do $module;
- &modify_transport_map_entry($domain, $ispman->getTransportMap($domain));
- return 1;
+ &modify_transport_map_entry( $domain, $ispman->getTransportMap($domain) );
+ return 1;
}
+
sub NotifyUsers {
- my ($domain, $params) = @_;
+ my ( $domain, $params ) = @_;
- my $module = "$install_dir/lib/send_email_to_domain.lib";
- do $module;
+ my $module = "$install_dir/lib/send_email_to_domain.lib";
+ do $module;
- &sendEmailToDomain($ispman, $domain, $params);
- return 1;
+ &sendEmailToDomain( $ispman, $domain, $params );
+ return 1;
}
-
-
sub AUTOLOAD {
- my $error="";
- $error.= "Function $AUTOLOAD is missing. Called by ";
- $error.= join " ", caller;
- return $error;
+ my $error = "";
+ $error .= "Function $AUTOLOAD is missing. Called by ";
+ $error .= join " ", caller;
+ return $error;
}
sub log_message {
- $message=join " " , @_;
- unless ( $log && ref($log) eq "Log::FileSimple"){
- init_log();
+ $message = join " ", @_;
+ unless ( $log && ref($log) eq "Log::FileSimple" ) {
+ init_log();
}
- $log->log( message => $message);
+ $log->log( message => $message );
}
-
sub DESTROY {
- close("STDERR");
+ close("STDERR");
}
__END__
Index: ispman.bumpMailboxQuota
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.bumpMailboxQuota,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ispman.bumpMailboxQuota 28 Aug 2003 07:06:33 -0000 1.3
+++ ispman.bumpMailboxQuota 30 May 2004 23:35:31 -0000 1.4
@@ -7,38 +7,37 @@
# such as *_ispman_org : default: *
# and number is bytes to bump up to : default: 1024
-
-
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
-
require "cyrusadmin.pm";
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
-
-
-my $uid_filter=$ARGV[0] || '*';
-my $bytes = $ARGV[1] || 1024;
+$ispman = ISPMan->new();
-my $users=$ispman->getEntriesAsHashRef($ispman->{'Config'}{'ldapBaseDN'}, "&(objectclass=ispmanDomainUser)(uid=$uid_filter)");
+my $uid_filter = $ARGV[0] || '*';
+my $bytes = $ARGV[1] || 1024;
+my $users = $ispman->getEntriesAsHashRef( $ispman->{'Config'}{'ldapBaseDN'},
+ "&(objectclass=ispmanDomainUser)(uid=$uid_filter)" );
-USER: for (keys %$users) {
- @uids=$ispman->as_array($users->{$_}{'uid'});
- $uid=$uids[0];
- $mailbox=join "", ($mailbox_prefix, $uid);
- @q=$imap->get_quota($mailbox);
- next unless $q[2];
- if ($q[1]>=$q[2]){
- print "$uid is overquota. Quota: $q[2] , Used: $q[1], Over @{[$q[1]-$q[2]]}.\n";
- print "Bumping up $bytes bytes\n";
- $newQuota=$q[2]+$bytes;
- print "New Quota: $newQuota\n";
- try ($imap->set_quota($mailbox, $newQuota));
- }
+USER: for ( keys %$users ) {
+ @uids = $ispman->as_array( $users->{$_}{'uid'} );
+ $uid = $uids[0];
+ $mailbox = join "", ( $mailbox_prefix, $uid );
+ @q = $imap->get_quota($mailbox);
+ next unless $q[2];
+ if ( $q[1] >= $q[2] ) {
+ print
+"$uid is overquota. Quota: $q[2] , Used: $q[1], Over @{[$q[1]-$q[2]]}.\n";
+ print "Bumping up $bytes bytes\n";
+ $newQuota = $q[2] + $bytes;
+ print "New Quota: $newQuota\n";
+ try( $imap->set_quota( $mailbox, $newQuota ) );
+ }
}
Index: ispman.listHostGroups
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.listHostGroups,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.listHostGroups 10 May 2002 12:55:41 -0000 1.2
+++ ispman.listHostGroups 30 May 2004 23:35:32 -0000 1.3
@@ -1,12 +1,14 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
use lib qw(%%installDir%%/lib);
use ISPMan;
-my $ispman=ISPMan->new();
-my $hostGroups=$ispman->getHostGroups();
-for (keys %$hostGroups){
- print "$hostGroups->{$_}{'ispmanHostGroupName'}\n";
+my $ispman = ISPMan->new();
+my $hostGroups = $ispman->getHostGroups();
+for ( keys %$hostGroups ) {
+ print "$hostGroups->{$_}{'ispmanHostGroupName'}\n";
}
Index: ispman.getProcessInfo
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.getProcessInfo,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ispman.getProcessInfo 18 Sep 2003 08:15:53 -0000 1.1
+++ ispman.getProcessInfo 30 May 2004 23:35:32 -0000 1.2
@@ -1,17 +1,18 @@
#!/usr/bin/perl
BEGIN {
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- unless ($ARGV[0]){
- print "Please provide a process id\n";
- exit;
- }
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ unless ( $ARGV[0] ) {
+ print "Please provide a process id\n";
+ exit;
+ }
}
-
use ISPMan;
-my $ispman=ISPMan->new();
-my $pid=$ARGV[0];
-my $entry=$ispman->getEntry($ispman->getProcessesBranchDN(), "ispmanPid=$pid", [], "sub");
+my $ispman = ISPMan->new();
+my $pid = $ARGV[0];
+my $entry = $ispman->getEntry( $ispman->getProcessesBranchDN(),
+ "ispmanPid=$pid", [], "sub" );
$entry->dump() if $entry;
-
Index: ispman.showdomains
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.showdomains,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- ispman.showdomains 28 Apr 2003 14:40:57 -0000 1.7
+++ ispman.showdomains 30 May 2004 23:35:32 -0000 1.8
@@ -1,29 +1,31 @@
#!/usr/bin/perl
BEGIN {
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
use Getopt::Std;
use lib qw(%%installDir%%/lib);
use ISPMan;
-getopt('t', \%opts);
+getopt( 't', \%opts );
-my $ispman=ISPMan->new();
-showDomains($ispman, $opts{'t'});
+my $ispman = ISPMan->new();
+showDomains( $ispman, $opts{'t'} );
sub showDomains {
- my $self=shift;
- my $type=shift;
- $filters={
- 'primary' => 'ispmanDomainType=primary',
- 'slave' => 'ispmanDomainType=slave',
- 'nodns' => 'ispmanDomainType=nodns',
- 'replica' => 'ispmanDomainType=replica'
- };
-
+ my $self = shift;
+ my $type = shift;
+ $filters = {
+ 'primary' => 'ispmanDomainType=primary',
+ 'slave' => 'ispmanDomainType=slave',
+ 'nodns' => 'ispmanDomainType=nodns',
+ 'replica' => 'ispmanDomainType=replica'
+ };
- my $domains=$self->makeDomainHash($self->getDomains($filters->{$type}));
- for (keys %$domains){
- print "$_\n";
- }
+ my $domains =
+ $self->makeDomainHash( $self->getDomains( $filters->{$type} ) );
+ for ( keys %$domains ) {
+ print "$_\n";
+ }
}
Index: ispman.listVars
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.listVars,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- ispman.listVars 21 Feb 2004 21:31:25 -0000 1.7
+++ ispman.listVars 30 May 2004 23:35:32 -0000 1.8
@@ -1,60 +1,51 @@
#!/usr/bin/perl
BEGIN {
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
-
use ISPMan;
-my $ispman=ISPMan->new();
+my $ispman = ISPMan->new();
my $modules;
my $module;
-my ($var,$val);
+my ( $var, $val );
-if ($ARGV[0]){
- push @$modules, $ARGV[0];
-} else {
- my $all_modules=$ispman->getConfModules();
- for (keys %$all_modules){
- push @$modules, $all_modules->{$_}{'ispmanModule'};
- }
+if ( $ARGV[0] ) {
+ push @$modules, $ARGV[0];
}
-
-my $ispmanVars;
-
-
-for $module(@$modules){
- print "Module: $module\n\n";
- my $vars=$ispman->getConfVars($module);
- for (keys %$vars){
- $ispmanVars->{$vars->{$_}{'ispmanVar'}}{'ispmanQuestion'}=$vars->{$_}{'ispmanQuestion'};
- $ispmanVars->{$vars->{$_}{'ispmanVar'}}{'ispmanVal'}=$vars->{$_}{'ispmanVal'};
- }
-
-
-
- my @ispmanVars;
- my $varDN;
-
-
- if ($ispman->{'Config'}{'ispmanVarSort'}{$module}){
- my $varSort=$ispman->{'Config'}{'ispmanVarSort'}{$module};
- for (@$varSort){
- $var=$_;
- $val=$ispmanVars->{$var}{'ispmanVal'};
- write();
- }
- }
+else {
+ my $all_modules = $ispman->getConfModules();
+ for ( keys %$all_modules ) {
+ push @$modules, $all_modules->{$_}{'ispmanModule'};
+ }
}
-
-
-
-
-
+my $ispmanVars;
+for $module (@$modules) {
+ print "Module: $module\n\n";
+ my $vars = $ispman->getConfVars($module);
+ for ( keys %$vars ) {
+ $ispmanVars->{ $vars->{$_}{'ispmanVar'} }{'ispmanQuestion'} =
+ $vars->{$_}{'ispmanQuestion'};
+ $ispmanVars->{ $vars->{$_}{'ispmanVar'} }{'ispmanVal'} =
+ $vars->{$_}{'ispmanVal'};
+ }
+ my @ispmanVars;
+ my $varDN;
+ if ( $ispman->{'Config'}{'ispmanVarSort'}{$module} ) {
+ my $varSort = $ispman->{'Config'}{'ispmanVarSort'}{$module};
+ for (@$varSort) {
+ $var = $_;
+ $val = $ispmanVars->{$var}{'ispmanVal'};
+ write();
+ }
+ }
+}
format STDOUT =
@>>>>>>>>>>>>>>>>>>>>>>>>>> |=| @*
Index: ispman.replaceMailForwardForUser
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.replaceMailForwardForUser,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.replaceMailForwardForUser 24 Apr 2003 21:31:41 -0000 1.2
+++ ispman.replaceMailForwardForUser 30 May 2004 23:35:32 -0000 1.3
@@ -1,21 +1,24 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('du', \%opts);
- unless ($opts{'d'} && $opts{'u'} && $ARGV[0]){
- print "Usage: $FindBin::Script -d domain -u username forward_address [forward_address forward_address]\n";
- print "Note: This command deletes all previously added forward addresses and adds the new ones specified\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'du', \%opts );
+ unless ( $opts{'d'} && $opts{'u'} && $ARGV[0] ) {
+ print
+"Usage: $FindBin::Script -d domain -u username forward_address [forward_address forward_address]\n";
+ print
+"Note: This command deletes all previously added forward addresses and adds the new ones specified\n";
+ exit;
+ }
}
use ISPMan;
-my $ispman=ISPMan->new();
-$ispman->replaceMailForwardForUser($opts{'u'}, $opts{'d'}, \@ARGV);
+my $ispman = ISPMan->new();
+$ispman->replaceMailForwardForUser( $opts{'u'}, $opts{'d'}, \@ARGV );
print "OK\n";
-
Index: ispman.deleteAdmin
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.deleteAdmin,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ispman.deleteAdmin 10 May 2002 12:55:41 -0000 1.1
+++ ispman.deleteAdmin 30 May 2004 23:35:31 -0000 1.2
@@ -1,15 +1,16 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- unless ($ARGV[0]){
- print "$0 uid\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ unless ( $ARGV[0] ) {
+ print "$0 uid\n";
+ exit;
+ }
}
use lib qw(%%installDir%%/lib);
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
-$ispman->_deleteAdmin($ARGV[0]);
-
+$ispman = ISPMan->new();
+$ispman->_deleteAdmin( $ARGV[0] );
Index: ispman.deleteHost
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.deleteHost,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ispman.deleteHost 10 May 2002 12:55:41 -0000 1.3
+++ ispman.deleteHost 30 May 2004 23:35:31 -0000 1.4
@@ -1,15 +1,16 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- unless ($ARGV[0]){
- print "$0 hostname\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ unless ( $ARGV[0] ) {
+ print "$0 hostname\n";
+ exit;
+ }
}
use lib qw(%%installDir%%/lib);
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
-$ispman->delete_host($ARGV[0]);
-
+$ispman = ISPMan->new();
+$ispman->delete_host( $ARGV[0] );
Index: ldifdiff
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ldifdiff,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ldifdiff 6 May 2002 19:27:58 -0000 1.1
+++ ldifdiff 30 May 2004 23:35:32 -0000 1.2
@@ -57,205 +57,211 @@
use strict;
my %args;
-getopts("a:c:k:", \%args);
-
-my $keyattr = $args{k};
-my @sourceattrs = split(/,/, $args{a});
-my %ciscmp = (objectclass => 1, manager => 1, owner => 1);
-foreach (split(/,/, $args{c})) { $ciscmp{$_} = 1 }
+getopts( "a:c:k:", \%args );
+my $keyattr = $args{k};
+my @sourceattrs = split( /,/, $args{a} );
+my %ciscmp = ( objectclass => 1, manager => 1, owner => 1 );
+foreach ( split( /,/, $args{c} ) ) { $ciscmp{$_} = 1 }
-my ($sourcefile, $targetfile);
-$sourcefile = shift; $targetfile = shift;
+my ( $sourcefile, $targetfile );
+$sourcefile = shift;
+$targetfile = shift;
die "usage: $0 -k keyattr [-a attr1,attr2,...] sourcefile targetfile\n"
- unless $keyattr && $sourcefile && $targetfile;
+ unless $keyattr && $sourcefile && $targetfile;
my $source = Net::LDAP::LDIF->new($sourcefile)
- or die "Can't open LDIF file $sourcefile\n: $!\n";
+ or die "Can't open LDIF file $sourcefile\n: $!\n";
my $target = Net::LDAP::LDIF->new($targetfile)
- or die "Can't open LDIF file $targetfile: $!\n";
+ or die "Can't open LDIF file $targetfile: $!\n";
-my $ldifout = Net::LDAP::LDIF->new('-', 'w');
+my $ldifout = Net::LDAP::LDIF->new( '-', 'w' );
$ldifout->{change} = 1;
-$ldifout->{wrap} = 78;
-
-
-diff($source, $target);
+$ldifout->{wrap} = 78;
+diff( $source, $target );
# Gets the relative distinguished name (RDN) attribute
-sub rdnattr { ($_[0]->dn =~ /^(.*?)=/)[0] }
+sub rdnattr { ( $_[0]->dn =~ /^(.*?)=/ )[0] }
# Gets the relative distinguished name (RDN) value
-sub rdnval { my $rv = ($_[0]->dn =~ /=(.*)/)[0]; $rv =~ s/(?<!\\),.*//; $rv }
+sub rdnval { my $rv = ( $_[0]->dn =~ /=(.*)/ )[0]; $rv =~ s/(?<!\\),.*//; $rv }
-sub cmpEntries
-{
- my ($a, $b) = @_;
+sub cmpEntries {
+ my ( $a, $b ) = @_;
- if ($keyattr =~ /^dn$/i) {
- return lc(canonical_dn($a->dn)) cmp lc(canonical_dn($b->dn))
- }
+ if ( $keyattr =~ /^dn$/i ) {
+ return lc( canonical_dn( $a->dn ) ) cmp lc( canonical_dn( $b->dn ) );
+ }
else { return $a->get_value($keyattr) cmp $b->get_value($keyattr) }
}
-
# Diffs two LDIF data sources
-sub diff
-{
- my ($source, $target) = @_;
- my ($sourceentry, $targetentry, $incr_source, $incr_target, @ldifchanges);
+sub diff {
+ my ( $source, $target ) = @_;
+ my ( $sourceentry, $targetentry, $incr_source, $incr_target, @ldifchanges );
- $sourceentry = $source->read_entry();
- $targetentry = $target->read_entry();
+ $sourceentry = $source->read_entry();
+ $targetentry = $target->read_entry();
- while () {
- # End of all data
- last if !$sourceentry && !$targetentry;
+ while () {
- # End of source data, but more target data. Delete.
- if (!$sourceentry && $targetentry) {
- $targetentry->delete;
- $ldifout->write_entry($targetentry);
- $incr_target = 1, next;
- }
+ # End of all data
+ last if !$sourceentry && !$targetentry;
- # End of target data, but more data in source. Add.
- if ($sourceentry && !$targetentry) {
- $ldifout->write_entry($sourceentry);
+ # End of source data, but more target data. Delete.
+ if ( !$sourceentry && $targetentry ) {
+ $targetentry->delete;
+ $ldifout->write_entry($targetentry);
+ $incr_target = 1, next;
+ }
+
+ # End of target data, but more data in source. Add.
+ if ( $sourceentry && !$targetentry ) {
+ $ldifout->write_entry($sourceentry);
$incr_source = 1, next;
- }
+ }
- # Check if the current source entry has a higher sort position than
- # the current target. If so, we interpret this to mean that the
- # target entry no longer exists on the source. Issue a delete to LDAP.
- if (cmpEntries($sourceentry, $targetentry) > 0) {
- $targetentry->delete;
- $ldifout->write_entry($targetentry);
+ # Check if the current source entry has a higher sort position than
+ # the current target. If so, we interpret this to mean that the
+ # target entry no longer exists on the source. Issue a delete to LDAP.
+ if ( cmpEntries( $sourceentry, $targetentry ) > 0 ) {
+ $targetentry->delete;
+ $ldifout->write_entry($targetentry);
$incr_target = 1, next;
- }
+ }
- # Check if the current target entry has a higher sort position than
- # the current source entry. If so, we interpret this to mean that the
- # source entry doesn't exist on the target. Issue an add to LDAP.
- if (cmpEntries($targetentry, $sourceentry) > 0) {
- $ldifout->write_entry($sourceentry);
+ # Check if the current target entry has a higher sort position than
+ # the current source entry. If so, we interpret this to mean that the
+ # source entry doesn't exist on the target. Issue an add to LDAP.
+ if ( cmpEntries( $targetentry, $sourceentry ) > 0 ) {
+ $ldifout->write_entry($sourceentry);
$incr_source = 1, next;
- }
+ }
- # When we get here, we're dealing with the same person in $sourceentry
- # and $targetentry. Compare the data and generate the update.
+ # When we get here, we're dealing with the same person in $sourceentry
+ # and $targetentry. Compare the data and generate the update.
- # If a modRDN is necessary, it needs to happen before other mods
- if (lc(canonical_dn($sourceentry->dn))
- ne lc(canonical_dn($targetentry->dn))) {
- my $rdnattr = rdnattr($sourceentry);
- my $rdnval = rdnval($sourceentry);
+ # If a modRDN is necessary, it needs to happen before other mods
+ if (
+ lc( canonical_dn( $sourceentry->dn ) ) ne
+ lc( canonical_dn( $targetentry->dn ) ) )
+ {
+ my $rdnattr = rdnattr($sourceentry);
+ my $rdnval = rdnval($sourceentry);
- $targetentry->{changetype} = 'modrdn';
- $targetentry->add(newrdn => "$rdnattr=$rdnval",
- deleteoldrdn => '1');
- $ldifout->write_entry($targetentry);
- $targetentry->delete('newrdn');
- $targetentry->delete('deleteoldrdn');
- delete($targetentry->{changetype});
-
- $targetentry->dn($sourceentry->dn);
- $targetentry->{$rdnattr} = $sourceentry->{$rdnattr}
- if $sourceentry->exists($rdnattr);
+ $targetentry->{changetype} = 'modrdn';
+ $targetentry->add(
+ newrdn => "$rdnattr=$rdnval",
+ deleteoldrdn => '1'
+ );
+ $ldifout->write_entry($targetentry);
+ $targetentry->delete('newrdn');
+ $targetentry->delete('deleteoldrdn');
+ delete( $targetentry->{changetype} );
- }
+ $targetentry->dn( $sourceentry->dn );
+ $targetentry->{$rdnattr} = $sourceentry->{$rdnattr}
+ if $sourceentry->exists($rdnattr);
- # Check for differences and generate LDIF as appropriate
- updateFromEntry($sourceentry, $targetentry, @sourceattrs);
- $ldifout->write_entry($targetentry) if @{$targetentry->{changes}};
- $incr_source = 1, $incr_target = 1, next;
+ }
- } continue {
- if ($incr_source) {
- $sourceentry = $source->read_entry(); $incr_source = 0;
- }
- if ($incr_target) {
- $targetentry = $target->read_entry(); $incr_target = 0;
- }
+ # Check for differences and generate LDIF as appropriate
+ updateFromEntry( $sourceentry, $targetentry, @sourceattrs );
+ $ldifout->write_entry($targetentry) if @{ $targetentry->{changes} };
+ $incr_source = 1, $incr_target = 1, next;
+
+ }
+ continue {
+ if ($incr_source) {
+ $sourceentry = $source->read_entry();
+ $incr_source = 0;
+ }
+ if ($incr_target) {
+ $targetentry = $target->read_entry();
+ $incr_target = 0;
+ }
}
}
-sub grepval
-{
- my ($val, $vals, $ciscmp) = @_;
+sub grepval {
+ my ( $val, $vals, $ciscmp ) = @_;
- return $ciscmp ? grep(/^\Q$val\E$/i, @$vals)
- : grep(/^\Q$val\E$/, @$vals);
+ return $ciscmp
+ ? grep( /^\Q$val\E$/i, @$vals )
+ : grep( /^\Q$val\E$/, @$vals );
}
-
# Generate LDIF to update $target with information in $source.
# Optionally restrict the set of attributes to consider.
-sub updateFromEntry
-{
- my ($source, $target, @attrs) = @_;
- my (%modhash, $attr, $val, $ldifstr);
+sub updateFromEntry {
+ my ( $source, $target, @attrs ) = @_;
+ my ( %modhash, $attr, $val, $ldifstr );
- my %sharedattrs = (objectclass => 1);
+ my %sharedattrs = ( objectclass => 1 );
- unless (@attrs) {
- # add all source entry attributes
- @attrs = $source->attributes;
- # add any other attributes we haven't seen from the target entry
- foreach my $tattr ($target->attributes) {
- push(@attrs, $tattr) unless grep(/^$tattr$/i, @attrs)
- }
- }
+ unless (@attrs) {
- $target->{changetype} = 'modify';
+ # add all source entry attributes
+ @attrs = $source->attributes;
- foreach $attr (@attrs) {
- my $lcattr = lc $attr;
- next if $lcattr eq 'dn'; # Can't handle modrdn here
- if (!$source->exists($attr) && !$sharedattrs{$lcattr}) {
- # Source doesn't have this attribute, delete it from the target
- # if necessary.
- $target->delete($attr) if $target->exists($attr);
- }
- else {
- my $replaceattr;
- my @sourcevals = $source->get_value($attr);
- my @targetvals = $target->get_value($attr);
+ # add any other attributes we haven't seen from the target entry
+ foreach my $tattr ( $target->attributes ) {
+ push( @attrs, $tattr ) unless grep( /^$tattr$/i, @attrs );
+ }
+ }
- # For 'shared' attributes (e.g. objectclass) where $source may not
- # be a sole authoritative source, we issue issue 'delete' and
- # 'add' modifications instead of a single 'replace'.
- foreach $val (@targetvals) {
- next if $val eq ''; # Skip attributes with empty values
- if (!grepval($val, \@sourcevals, $ciscmp{$lcattr} ? 1 : 0)) {
- if ($sharedattrs{$lcattr}) {
- $target->delete($attr => [$val]);
- }
- else { $replaceattr = 1 }
- }
- }
- foreach $val (@sourcevals) {
- next if $val eq ''; # Skip attributes with empty values
- if (!grepval($val, \@targetvals, $ciscmp{$lcattr} ? 1 : 0)) {
- if ($sharedattrs{$lcattr}) {
- $target->add($attr => $val);
- }
- else { $replaceattr = 1 }
- }
- }
- # source is authoritative for this attribute, issue a replace.
- $target->replace($attr => [ @sourcevals ])
- if !$sharedattrs{$lcattr} && $replaceattr;
- }
- }
+ $target->{changetype} = 'modify';
- # Get rid of the "changetype: modify" if there were no changes
- delete($target->{changetype}) unless @{$target->{changes}};
-}
+ foreach $attr (@attrs) {
+ my $lcattr = lc $attr;
+ next if $lcattr eq 'dn'; # Can't handle modrdn here
+ if ( !$source->exists($attr) && !$sharedattrs{$lcattr} ) {
+ # Source doesn't have this attribute, delete it from the target
+ # if necessary.
+ $target->delete($attr) if $target->exists($attr);
+ }
+ else {
+ my $replaceattr;
+ my @sourcevals = $source->get_value($attr);
+ my @targetvals = $target->get_value($attr);
+
+ # For 'shared' attributes (e.g. objectclass) where $source may not
+ # be a sole authoritative source, we issue issue 'delete' and
+ # 'add' modifications instead of a single 'replace'.
+ foreach $val (@targetvals) {
+ next if $val eq ''; # Skip attributes with empty values
+ if ( !grepval( $val, \@sourcevals, $ciscmp{$lcattr} ? 1 : 0 ) )
+ {
+ if ( $sharedattrs{$lcattr} ) {
+ $target->delete( $attr => [$val] );
+ }
+ else { $replaceattr = 1 }
+ }
+ }
+ foreach $val (@sourcevals) {
+ next if $val eq ''; # Skip attributes with empty values
+ if ( !grepval( $val, \@targetvals, $ciscmp{$lcattr} ? 1 : 0 ) )
+ {
+ if ( $sharedattrs{$lcattr} ) {
+ $target->add( $attr => $val );
+ }
+ else { $replaceattr = 1 }
+ }
+ }
+
+ # source is authoritative for this attribute, issue a replace.
+ $target->replace( $attr => [@sourcevals] )
+ if !$sharedattrs{$lcattr} && $replaceattr;
+ }
+ }
+
+ # Get rid of the "changetype: modify" if there were no changes
+ delete( $target->{changetype} ) unless @{ $target->{changes} };
+}
=back
Index: ispman.deleteProcess
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.deleteProcess,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ispman.deleteProcess 28 Aug 2003 08:23:03 -0000 1.3
+++ ispman.deleteProcess 30 May 2004 23:35:31 -0000 1.4
@@ -1,12 +1,13 @@
#!/usr/bin/perl
BEGIN {
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
use ISPMan;
-my $ispman=ISPMan->new();
+my $ispman = ISPMan->new();
-for (@ARGV){
- $ispman->deleteProcessByPID($_);
+for (@ARGV) {
+ $ispman->deleteProcessByPID($_);
}
-
Index: ispman.addMailForwardForUser
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.addMailForwardForUser,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ispman.addMailForwardForUser 24 Apr 2003 21:31:37 -0000 1.2
+++ ispman.addMailForwardForUser 30 May 2004 23:35:31 -0000 1.3
@@ -1,20 +1,22 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('du', \%opts);
- unless ($opts{'d'} && $opts{'u'} && $ARGV[0]){
- print "Usage: $FindBin::Script -d domain -u username forwardingAddress\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'du', \%opts );
+ unless ( $opts{'d'} && $opts{'u'} && $ARGV[0] ) {
+ print
+ "Usage: $FindBin::Script -d domain -u username forwardingAddress\n";
+ exit;
+ }
}
use ISPMan;
-my $ispman=ISPMan->new();
-$ispman->addMailForwardForUser($opts{'u'}, $opts{'d'}, $ARGV[0]);
+my $ispman = ISPMan->new();
+$ispman->addMailForwardForUser( $opts{'u'}, $opts{'d'}, $ARGV[0] );
print "OK\n";
-
Index: ispman.dnsset
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.dnsset,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- ispman.dnsset 11 Feb 2004 17:23:49 -0000 1.11
+++ ispman.dnsset 30 May 2004 23:35:31 -0000 1.12
@@ -1,54 +1,61 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('dt', \%opts);
- getopt('p:', \%opts);
- getopt('v:', \%opts);
- unless ($opts{'d'} && $opts{'t'}){
- print "$FindBin::Script -d domain -t type more parameters\n";
- print " Examples:\n";
- print " $FindBin::Script -d example.com -t A [-p] hostname ipaddress\n";
- print " -p add also PTR record\n";
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'dt', \%opts );
+ getopt( 'p:', \%opts );
+ getopt( 'v:', \%opts );
+ unless ( $opts{'d'} && $opts{'t'} ) {
+ print "$FindBin::Script -d domain -t type more parameters\n";
+ print " Examples:\n";
+ print " $FindBin::Script -d example.com -t A [-p] hostname ipaddress\n";
+ print " -p add also PTR record\n";
- print " $FindBin::Script -d example.com -t NS origin nameserver\n";
- print " $FindBin::Script -d example.com -t MX origin weight mailserver\n";
- print " $FindBin::Script -d example.com -t CNAME alias host\n";
- print " $FindBin::Script -d example.com -t SOA primary rootmail refresh retry expire minimum\n";
- print "\n";
- exit;
- }
+ print " $FindBin::Script -d example.com -t NS origin nameserver\n";
+ print
+ " $FindBin::Script -d example.com -t MX origin weight mailserver\n";
+ print " $FindBin::Script -d example.com -t CNAME alias host\n";
+ print
+" $FindBin::Script -d example.com -t SOA primary rootmail refresh retry expire minimum\n";
+ print "\n";
+ exit;
+ }
}
use lib qw(%%installDir%%/lib);
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
+$ispman = ISPMan->new();
-$opts{'t'}=lc($opts{'t'});
+$opts{'t'} = lc( $opts{'t'} );
require "functions/dnsset.functions.pl";
-if (lc($opts{'d'}) eq "all" || lc($opts{'d'}) eq "any" ) {
- my $domains=$ispman->makeDomainHash($ispman->getDomains("ispmanDomainType=primary"));
- for (keys %$domains) {
- $opts{'d'}=$_;
- &{"set_$opts{'t'}"}($_);
+if ( lc( $opts{'d'} ) eq "all" || lc( $opts{'d'} ) eq "any" ) {
+ my $domains =
+ $ispman->makeDomainHash(
+ $ispman->getDomains("ispmanDomainType=primary") );
+ for ( keys %$domains ) {
+ $opts{'d'} = $_;
+ &{"set_$opts{'t'}"}($_);
- $ispman->modifyDnsProcess($_);
- }
-} else {
+ $ispman->modifyDnsProcess($_);
+ }
+}
+else {
- unless ($ispman->branchExists($ispman->getDNSDN($opts{'d'}))){
- print "Note: This domain branch did not exist.\n";
- print "You may still add domains to DNS. but it will not be managed by ispman\n";
- }
+ unless ( $ispman->branchExists( $ispman->getDNSDN( $opts{'d'} ) ) ) {
+ print "Note: This domain branch did not exist.\n";
+ print
+"You may still add domains to DNS. but it will not be managed by ispman\n";
+ }
- &{"set_$opts{'t'}"};
+ &{"set_$opts{'t'}"};
- $ispman->modifyDnsProcess($opts{'d'});
+ $ispman->modifyDnsProcess( $opts{'d'} );
}
-
1;
__END__
Index: ispman.listOverQuotaMailboxes
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.listOverQuotaMailboxes,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ispman.listOverQuotaMailboxes 28 Aug 2003 06:42:26 -0000 1.3
+++ ispman.listOverQuotaMailboxes 30 May 2004 23:35:32 -0000 1.4
@@ -3,29 +3,31 @@
# As paramater, it can accept uid_filter
# such as *_ispman_org
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
require "cyrusadmin.pm";
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
-
-
-my $uid_filter=$ARGV[0] || '*';
+$ispman = ISPMan->new();
-my $users=$ispman->getEntriesAsHashRef($ispman->{'Config'}{'ldapBaseDN'}, "&(objectclass=ispmanDomainUser)(uid=$uid_filter)");
+my $uid_filter = $ARGV[0] || '*';
+my $users = $ispman->getEntriesAsHashRef( $ispman->{'Config'}{'ldapBaseDN'},
+ "&(objectclass=ispmanDomainUser)(uid=$uid_filter)" );
-USER: for (keys %$users) {
- @uids=$ispman->as_array($users->{$_}{'uid'});
- $uid=$uids[0];
- $mailbox=join "", ($mailbox_prefix, $uid);
- @q=$imap->get_quota($mailbox);
- next unless $q[2];
- if ($q[1]>=$q[2]){
- print "$uid is overquota. Quota: $q[2] , Used: $q[1], Over @{[$q[1]-$q[2]]}.\n";
- }
+USER: for ( keys %$users ) {
+ @uids = $ispman->as_array( $users->{$_}{'uid'} );
+ $uid = $uids[0];
+ $mailbox = join "", ( $mailbox_prefix, $uid );
+ @q = $imap->get_quota($mailbox);
+ next unless $q[2];
+ if ( $q[1] >= $q[2] ) {
+ print
+"$uid is overquota. Quota: $q[2] , Used: $q[1], Over @{[$q[1]-$q[2]]}.\n";
+ }
}
Index: ispman.getWebUsers
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.getWebUsers,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ispman.getWebUsers 18 Jan 2004 13:06:31 -0000 1.1
+++ ispman.getWebUsers 30 May 2004 23:35:32 -0000 1.2
@@ -2,32 +2,30 @@
# exaple script.
# shows web users in domain
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('d', \%opts);
- unless ($opts{'d'}){
- print "Usage: $FindBin::Script -d domain";
- print "\n";
- exit;
- }
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'd', \%opts );
+ unless ( $opts{'d'} ) {
+ print "Usage: $FindBin::Script -d domain";
+ print "\n";
+ exit;
+ }
}
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
-
-
-showWebUsers($opts{'d'});
-
-
+$ispman = ISPMan->new();
+showWebUsers( $opts{'d'} );
sub showWebUsers {
- my $domain=shift;
- print "Web Users for $domain\n";
- my $users=$ispman->getWebusers($domain);
- print join "\n", keys %$users;
- print "\n";
+ my $domain = shift;
+ print "Web Users for $domain\n";
+ my $users = $ispman->getWebusers($domain);
+ print join "\n", keys %$users;
+ print "\n";
}
Index: ispman.listVhostAliases
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.listVhostAliases,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ispman.listVhostAliases 3 Jun 2002 00:02:15 -0000 1.1
+++ ispman.listVhostAliases 30 May 2004 23:35:32 -0000 1.2
@@ -1,20 +1,23 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
- use Getopt::Std;
- getopt('dv', \%opts);
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
+ use Getopt::Std;
+ getopt( 'dv', \%opts );
- unless ($opts{'d'} && $opts{'v'}) {
- print "$FindBin::Script -d domain -v vhost\n";
- print "\n";
- exit;
- }
+ unless ( $opts{'d'} && $opts{'v'} ) {
+ print "$FindBin::Script -d domain -v vhost\n";
+ print "\n";
+ exit;
+ }
}
use ISPMan;
use vars qw($ispman);
-$ispman=ISPMan->new();
-my $r=$ispman->getAliases($opts{'d'}, $opts{'v'});
+$ispman = ISPMan->new();
+my $r = $ispman->getAliases( $opts{'d'}, $opts{'v'} );
+
#domain, vhost
print $ispman->dumper($r);
Index: ispman.getHostGroupFirstMember
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.getHostGroupFirstMember,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ispman.getHostGroupFirstMember 8 Aug 2003 18:44:37 -0000 1.1
+++ ispman.getHostGroupFirstMember 30 May 2004 23:35:32 -0000 1.2
@@ -1,14 +1,16 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
use ISPMan;
-my $ispman=ISPMan->new();
-if (my $member=$ispman->getHostGroupFirstMember($ARGV[0])){
- print "$member\n";
-} else {
- print "No members in HostGroup: $ARGV[0] found\n";
+my $ispman = ISPMan->new();
+if ( my $member = $ispman->getHostGroupFirstMember( $ARGV[0] ) ) {
+ print "$member\n";
+}
+else {
+ print "No members in HostGroup: $ARGV[0] found\n";
}
-
Index: ispman.removeEmptySessions
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.removeEmptySessions,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- ispman.removeEmptySessions 25 Jun 2003 21:24:17 -0000 1.4
+++ ispman.removeEmptySessions 30 May 2004 23:35:32 -0000 1.5
@@ -1,15 +1,20 @@
#!/usr/bin/perl
-BEGIN{
- use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../lib", "$FindBin::Bin/../conf");
+BEGIN {
+ use FindBin;
+ unshift @INC,
+ ( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}
use ISPMan;
-my $ispman=ISPMan->new();
-my $h=$ispman->getEntriesAsHashRef("ou=processes, @{[$ispman->getConf('ldapBaseDN')]}", "objectClass=ispmanBranch");
-for (keys %$h){
- next unless /^ispmanSession/;
- if ($ispman->getCount($_)<2){
- print "Deleting $_\n";
- $ispman->deleteEntry($_);
- }
+my $ispman = ISPMan->new();
+my $h =
+ $ispman->getEntriesAsHashRef(
+ "ou=processes, @{[$ispman->getConf('ldapBaseDN')]}",
+ "objectClass=ispmanBranch" );
+for ( keys %$h ) {
+ next unless /^ispmanSession/;
+ if ( $ispman->getCount($_) < 2 ) {
+ print "Deleting $_\n";
+ $ispman->deleteEntry($_);
+ }
}
__END__
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click