CVS: ispman/lib/ISPMan ApacheMan.pm,1.32,1.32.2.1
Tarjei Huse <[email protected]>
| Newsgroups | gmane.comp.isp.ispman.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/ispman/ispman/lib/ISPMan
In directory sc8-pr-cvs1:/tmp/cvs-serv30245/lib/ISPMan
Modified Files:
Tag: ALTVHOSTS
ApacheMan.pm
Log Message:
This should be everything for the ALTVHOSTbranch to be functional.
The todolist is long, but at least it's all commited now.
Index: ApacheMan.pm
===================================================================
RCS file: /cvsroot/ispman/ispman/lib/ISPMan/ApacheMan.pm,v
retrieving revision 1.32
retrieving revision 1.32.2.1
diff -C2 -r1.32 -r1.32.2.1
*** ApacheMan.pm 31 Jul 2003 00:03:58 -0000 1.32
--- ApacheMan.pm 8 Sep 2003 16:19:18 -0000 1.32.2.1
***************
*** 120,123 ****
--- 120,124 ----
my $vhosts;
for (keys %$vhostsHash) {
+
$vhosts->{$vhostsHash->{$_}{'ispmanVhostName'}}=$_;
}
***************
*** 171,174 ****
--- 172,199 ----
my $self=shift;
my $r=shift;
+ my $data;
+
+ my $ispmanVhostBaseName = $r->param('ispmanVhostName'); # this one is w/o the port in it!
+ $ispmanVhostBaseName =~s/(.+?):(.+)/$1/;
+
+ my $ispmanVhostName = $r->param('ispmanVhostName');
+ my $ispmanVhostPort = $r->param('ispmanVhostPort');
+
+ # some hosttypes cannot be changed after they have been created. Make sure this doesn't happen:
+ #
+
+ my $oldTypes= { split " " , $r->param('ispmanVhostOldType')};
+ my @notChange = qw|$self->getConf('ispmanVhostTypeNotChange'))|;
+ my $newTypes = {$r->param('ispmanVhostType')};
+
+ for (@notChange) {
+ if (exists %{$oldTypes}->{$_} && !exists %{$newTypes}->{$_}) {
+ %{$newTypes}->{$_} ="";
+ }
+ }
+ $r->param('ispmanVhostType',keys %{$newTypes});
+
+
+
my $dn=$self->getVhostDN($r->param("ispmanDomain"), $r->param("ispmanVhostName"));
***************
*** 185,197 ****
}
- my $data;
$data ={
! "ispmanVhostName" => $r->param("ispmanVhostName"),
! "cn" => $r->param("ispmanVhostName"),
'uidNumber' => $domain_info->{'uidNumber'},
'gidNumber' => $domain_info->{'gidNumber'},
"ispmanDomain" => $domain,
};
! $data->{'uid'}=join '.' , ($r->param("ispmanVhostName"), $r->param("ispmanDomain"));
$data->{'homeDirectory'}=join '/' , ($domain_info->{'homeDirectory'}, "vhosts", $r->param("ispmanVhostName"));
--- 210,220 ----
}
$data ={
! "cn" => $ispmanVhostBaseName,
'uidNumber' => $domain_info->{'uidNumber'},
'gidNumber' => $domain_info->{'gidNumber'},
"ispmanDomain" => $domain,
};
! $data->{'uid'}=join '.' , ($ispmanVhostBaseName, $r->param("ispmanDomain"));
$data->{'homeDirectory'}=join '/' , ($domain_info->{'homeDirectory'}, "vhosts", $r->param("ispmanVhostName"));
***************
*** 199,203 ****
ispmanVhostDocumentRoot ispmanVhostScriptDir
FTPQuotaMBytes FTPStatus ispmanVhostStats ispmanVhostLogdir
! ispmanVhostStatdir)) {
if ($r->param($_)) {
$data->{$_}=$r->param($_);
--- 222,226 ----
ispmanVhostDocumentRoot ispmanVhostScriptDir
FTPQuotaMBytes FTPStatus ispmanVhostStats ispmanVhostLogdir
! ispmanVhostStatdir ispmanVhostType)) {
if ($r->param($_)) {
$data->{$_}=$r->param($_);
***************
*** 206,215 ****
$data->{'userPassword'}=$self->encryptPassWithMethod($r->param("userPassword"),$self->getConf('userPassHashMethod'));
! #update the objectclasses if they are different
$data->{'objectClass'}=$self->{'Config'}{'ispmanVhostObjectclasses'};
! for (qw(ispmanVhostDocumentRootOption ispmanVhostScriptDirOption)) {
if ($r->param($_)) {
$data->{$_}=[$r->param($_)];
--- 229,238 ----
$data->{'userPassword'}=$self->encryptPassWithMethod($r->param("userPassword"),$self->getConf('userPassHashMethod'));
! #update the objectclasses if they are different
$data->{'objectClass'}=$self->{'Config'}{'ispmanVhostObjectclasses'};
! for (qw(ispmanVhostDocumentRootOption ispmanVhostScriptDirOption )) {
if ($r->param($_)) {
$data->{$_}=[$r->param($_)];
***************
*** 218,225 ****
}
}
-
-
-
-
if ($self->{'ldap'}->updateEntryWithData($dn, $data)) {
$self->addVhostProcess($r->param("ispmanDomain"), $r->param("ispmanVhostName"), "ModifyVirtualHost" , $r->param("ispmanVhostName"));
--- 241,244 ----
***************
*** 266,275 ****
# Vhostname can have a-z . and -
$ispmanVhostName=~s/[^a-zA-Z0-9\.-]//g;
! $r->param("ispmanVhostName", $ispmanVhostName);
my $domain=$r->param("ispmanDomain");
my $domain_info=$self->getDomainInfo($domain);
! my $dn=$self->getVhostDN($domain, $ispmanVhostName);
! $r->param("dn", $dn);
$self->prepareBranchForDN($self->getVhostsBranchDN($domain));
--- 285,316 ----
# Vhostname can have a-z . and -
$ispmanVhostName=~s/[^a-zA-Z0-9\.-]//g;
! # This is done farther down :)
! #$r->param("ispmanVhostName", $ispmanVhostName);
!
my $domain=$r->param("ispmanDomain");
my $domain_info=$self->getDomainInfo($domain);
! my $ispmanVhostBaseName = $r->param('ispmanVhostName');
! # Update the portnumber if the hosttype is defined:
! # This overrides the portparameter!
! my $ispmanVhostPort = $r->param('ispmanVhostPort');
! if ($r->param('ispmanVhostType')) {
! for ($r->param('ispmanVhostType')) {
! # You cannot choose both midgardLive and midgard staging!
! if ($_ eq 'MidgardStaging' ) { $ispmanVhostPort = 8001; }
! elsif ($_ eq 'MidgardLive') { $ispmanVhostPort = 80; }
! # SSL should override the two!
! if ($_ eq 'SSL' ) { $ispmanVhostPort = 443; }
! if ($_ eq 'Webmail') {} # do nothing for now (you should use this with SSL!)!
! }
! }
! if ($ispmanVhostPort ne '' && $ispmanVhostPort != 80) {
! $r->param("ispmanVhostName", $ispmanVhostName. ":" . $ispmanVhostPort);
! } else {
! $r->param("ispmanVhostName", $ispmanVhostName);
! }
! my $dn=$self->getVhostDN($r->param("ispmanDomain"), $r->param("ispmanVhostName"));
+ $r->param("dn", $dn);
+
$self->prepareBranchForDN($self->getVhostsBranchDN($domain));
***************
*** 277,299 ****
my $scriptdiroptions=$self->as_arrayref($r->param("ispmanVhostScriptDirOption"));;
! if ($r->param("ispmanVhostServerAlias")) {
!
! my $serveralias=[split(/\s\s*/, $r->param("ispmanVhostServerAlias"))];
! $r->param("ispmanVhostServerAlias", $serveralias) if $serveralias;
! } else {
! $r->param("ispmanVhostServerAlias", " ");
! }
my $data;
$data ={
- "ispmanVhostName" => $r->param("ispmanVhostName"),
- "cn" => $r->param("ispmanVhostName"),
'uidNumber' => $domain_info->{'uidNumber'},
'gidNumber' => $domain_info->{'gidNumber'},
"ispmanDomain" => $domain,
"ispmanVhostServerAlias" => $r->param("ispmanVhostServerAlias") || "",
};
- $data->{'uid'}=join '.' , ($r->param("ispmanVhostName"), $r->param("ispmanDomain"));
$data->{'objectClass'}=$self->{'Config'}{'ispmanVhostObjectclasses'};
$data->{'homeDirectory'}=join '/' , ($domain_info->{'homeDirectory'}, "vhosts", $r->param("ispmanVhostName"));
--- 318,339 ----
my $scriptdiroptions=$self->as_arrayref($r->param("ispmanVhostScriptDirOption"));;
! if ($r->param("ispmanVhostServerAlias")) {
+ my $serveralias=[split(/\s\s*/, $r->param("ispmanVhostServerAlias"))];
+ $r->param("ispmanVhostServerAlias", $serveralias) if $serveralias;
+ } else {
+ $r->param("ispmanVhostServerAlias", " ");
+ }
my $data;
$data ={
'uidNumber' => $domain_info->{'uidNumber'},
'gidNumber' => $domain_info->{'gidNumber'},
"ispmanDomain" => $domain,
"ispmanVhostServerAlias" => $r->param("ispmanVhostServerAlias") || "",
+ "ispmanVhostPort" => $ispmanVhostPort,
};
+ $data->{'ispmanVhostName'} = $r->param("ispmanVhostName");
+ $data->{'uid'}=join '.' , ($ispmanVhostBaseName, $r->param("ispmanDomain"));
$data->{'objectClass'}=$self->{'Config'}{'ispmanVhostObjectclasses'};
$data->{'homeDirectory'}=join '/' , ($domain_info->{'homeDirectory'}, "vhosts", $r->param("ispmanVhostName"));
***************
*** 302,311 ****
$data->{"ispmanVhostStats"} = $r->param("ispmanVhostStats");
$data->{"FTPQuotaMBytes"} = $r->param("FTPQuotaMBytes");
! $data->{"cn"} = join '.', ($r->param("ispmanVhostName"), $domain);
-
$data->{"ispmanVhostExtraConf"} = $r->param("ispmanVhostExtraConf") if $r->param("ispmanVhostExtraConf");
!
$data->{"ispmanVhostDocumentRootOption"} = $documentrootoptions;
$data->{"ispmanVhostScriptDirOption"} = $scriptdiroptions;
--- 342,353 ----
$data->{"ispmanVhostStats"} = $r->param("ispmanVhostStats");
$data->{"FTPQuotaMBytes"} = $r->param("FTPQuotaMBytes");
! $data->{"cn"} = join '.', ($ispmanVhostBaseName, $domain);
!
$data->{"ispmanVhostExtraConf"} = $r->param("ispmanVhostExtraConf") if $r->param("ispmanVhostExtraConf");
!
! # and hosttype:
! $data->{'ispmanVhostType'} = $self->as_arrayref($r->param("ispmanVhostType"));
$data->{"ispmanVhostDocumentRootOption"} = $documentrootoptions;
$data->{"ispmanVhostScriptDirOption"} = $scriptdiroptions;
***************
*** 343,354 ****
$data->{"fileHost"} = $r->param("fileHost") || $domain_info->{'ispmanDomainDefaultFileServer'};
my $IpAddress;
! if ($data->{"ispmanVhostIpAddress"} eq "*") {
! $IpAddress = $self->getHostIp($data->{'webHost'});
! } else {
! $IpAddress = $data->{"ispmanVhostIpAddress"};
}
-
-
if ($data->{"webHost"}){
if ($self->addNewEntryWithData($dn, $data)){
--- 385,394 ----
$data->{"fileHost"} = $r->param("fileHost") || $domain_info->{'ispmanDomainDefaultFileServer'};
my $IpAddress;
! if ($data->{"ispmanVhostIpAddress"} eq "*") {
! $IpAddress = $self->getHostIp($data->{'webHost'});
! } else {
! $IpAddress = $data->{"ispmanVhostIpAddress"};
}
if ($data->{"webHost"}){
if ($self->addNewEntryWithData($dn, $data)){
***************
*** 357,373 ****
}
$self->addProcessToHost($r->param("ispmanDomain"), $data->{"webHost"}, "AddVirtualHost", $r->param("ispmanVhostName"));
!
$self->addVirtualHostDirectoriesProcess(
! $r->param("ispmanDomain"),
! $r->param("ispmanVhostName"),
"AddVirtualHostDirectories",
join ",", (
! $r->param("ispmanVhostName"),
! $domain_info->{'homeDirectory'},
! $data->{"ispmanVhostDocumentRoot"},
! $data->{"ispmanVhostScriptDir"},
$data->{"ispmanVhostLogdir"},
$data->{"ispmanVhostStatdir"},
! $domain_info->{'uidNumber'},
$domain_info->{'gidNumber'}
)
--- 397,413 ----
}
$self->addProcessToHost($r->param("ispmanDomain"), $data->{"webHost"}, "AddVirtualHost", $r->param("ispmanVhostName"));
!
$self->addVirtualHostDirectoriesProcess(
! $r->param("ispmanDomain"),
! $r->param("ispmanVhostName"),
"AddVirtualHostDirectories",
join ",", (
! $r->param("ispmanVhostName"),
! $domain_info->{'homeDirectory'},
! $data->{"ispmanVhostDocumentRoot"},
! $data->{"ispmanVhostScriptDir"},
$data->{"ispmanVhostLogdir"},
$data->{"ispmanVhostStatdir"},
! $domain_info->{'uidNumber'},
$domain_info->{'gidNumber'}
)
***************
*** 375,379 ****
return 1;
}
! }
}
--- 415,421 ----
return 1;
}
! } else {
! print "Add vHost failed. <br>This may be because you have not defined your webhosts yet!";
! }
}
***************
*** 384,387 ****
--- 426,430 ----
my $self=shift;
my ($domain, $vhost)=@_;
+ # add the portnumber to the hostdn if needed.
return join ",", ("ispmanVhostName=$vhost", $self->getVhostsBranchDN($domain));
***************
*** 391,394 ****
--- 434,438 ----
my $self=shift;
my $domain=shift;
+ my $port = shift;
return join (",", "ou=httpdata", "ispmanDomain=$domain", $self->getConf('ldapBaseDN'));
}
***************
*** 535,542 ****
# The admin can choose where the files for this vhost live.
# The can be on the fileserver, webserver etc.
! # so according to fileHost, we
# create web directory
# delete web direcory
!
my $self=shift;
my ($domain, $vhost, $process, $param)=@_;
--- 579,586 ----
# The admin can choose where the files for this vhost live.
# The can be on the fileserver, webserver etc.
! # so according to fileHost, we
# create web directory
# delete web direcory
!
my $self=shift;
my ($domain, $vhost, $process, $param)=@_;
***************
*** 557,561 ****
my $dn=$self->getVhostDN($domain, $vhost);
!
my $data={};
$data->{'userPassword'}=$self->encryptPassWithMethod($pass,$self->getConf('userPassHashMethod'));
--- 601,605 ----
my $dn=$self->getVhostDN($domain, $vhost);
!
my $data={};
$data->{'userPassword'}=$self->encryptPassWithMethod($pass,$self->getConf('userPassHashMethod'));
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf