ispman/lib/ISPMan ApacheMan.pm,1.45.2.4,1.45.2.5 DomainMan.pm,1.55.2.2,1.55.2.3
Joerg Delker <[email protected]>
| Newsgroups | gmane.comp.isp.ispman.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/ispman/ispman/lib/ISPMan
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5304/lib/ISPMan
Modified Files:
Tag: rel_1_1-bugfixes
ApacheMan.pm DomainMan.pm
Log Message:
fixing bug [ 940099 ] and related
reseller/client is now limited to defaultHomedirectoryPath when creating domains
and limited to domain's Homedir when creating vhosts
Index: ApacheMan.pm
===================================================================
RCS file: /cvsroot/ispman/ispman/lib/ISPMan/ApacheMan.pm,v
retrieving revision 1.45.2.4
retrieving revision 1.45.2.5
diff -u -d -r1.45.2.4 -r1.45.2.5
--- ApacheMan.pm 26 Apr 2004 20:46:49 -0000 1.45.2.4
+++ ApacheMan.pm 30 Apr 2004 23:37:55 -0000 1.45.2.5
@@ -72,9 +72,9 @@
addVhostProcess
addVirtualHostDirectoriesProcess
changeVhostPassword
-suggestHostForVhost
-getVhostAttribute
-setVhostAttribute
+suggestHostForVhost
+getVhostAttribute
+setVhostAttribute
);
$VERSION = '0.01';
@@ -269,17 +269,25 @@
my $documentrootoptions=$self->as_arrayref($r->param("ispmanVhostDocumentRootOption"));
my $scriptdiroptions=$self->as_arrayref($r->param("ispmanVhostScriptDirOption"));;
- my $webhosts=$self->as_arrayref($r->param("webHost"));
- if ($self->isEmpty($webhosts)){
- # This can happen. For example from CCP
+ my $webhosts=$self->as_arrayref($r->param("webHost"));
+ if ($self->isEmpty($webhosts)){
+ # This can happen. For example from CCP
if (my $_webhost=$self->suggestHostForVhost($domain)){
- $webhosts=$self->as_arrayref($_webhost);
- }
- } else {
- # Atif 2003/01/13
- # Should there be a check and stop here?
- }
+ $webhosts=$self->as_arrayref($_webhost);
+ }
+ } else {
+ # Atif 2003/01/13
+ # Should there be a check and stop here?
+ }
+ #check homeDirectory for reseller/client
+ if ($self->{'session'} && $self->{'session'}->param("logintype") =~m/reseller|client/) {
+ my $domainHomeDirectoryPath=$domain_info->{"homeDirectory"};
+ if ($r->param("homeDirectory")!~m/^$domainHomeDirectoryPath/) {
+ print "Add Vhost aborted!\nHomeDirectory must be subdir of $domainHomeDirectoryPath.\n";
+ return;
+ }
+ }
if ($r->param("ispmanVhostServerAlias")) {
@@ -533,42 +541,42 @@
my $self=shift;
my ($domain, $vhost, $process, $param)=@_;
my $vhostInfo=$self->getVhostInfo($vhost, $domain);
- my @webHosts=$self->as_array($vhostInfo->{'webHost'});
+ my @webHosts=$self->as_array($vhostInfo->{'webHost'});
- unless (@webHosts){
- # No webHosts defined.
-
- my $_webhost;
-
+ unless (@webHosts){
+ # No webHosts defined.
+
+ my $_webhost;
+
if ($_webhost=$self->suggestHostForVhost($domain)){
- push @webHosts, $_webhost;
+ push @webHosts, $_webhost;
} else {
print "No host in webserver is the group found. \nYou cannot add vhosts untill you define some hosts in the httpgroup\n";
- return;
+ return;
}
- }
+ }
- foreach (@webHosts){
+ foreach (@webHosts){
$self->addProcessToHost($domain, $_, $process, $param);
}
}
-
-sub suggestHostForVhost {
- my $self=shift;
-
+
+sub suggestHostForVhost {
+ my $self=shift;
+
my ($domain)=@_;
-
- my $_webhost;
-
+
+ my $_webhost;
+
if ($_webhost=$self->getDomainAttribute($domain, "ispmanDomainDefaultWebHost")){
- return $_webhost;
+ return $_webhost;
}elsif ($_webhost=$self->getHostGroupFirstMember('httpgroup')) {
- return $_webhost;
+ return $_webhost;
} else {
- return 0;
+ return 0;
}
-}
+}
sub addVirtualHostDirectoriesProcess {
# The admin can choose where the files for this vhost live.
@@ -602,8 +610,8 @@
}
-
-
+
+
sub getVhostAttribute {
my $self=shift;
my ($domain, $vhost, $attribute)=@_;
@@ -615,15 +623,15 @@
return $self->get_attr_value($entry, $attribute);
-}
-
+}
+
sub setVhostAttribute {
- my $self=shift;
- my ($domain, $vhost, $attribute, @values)=@_;
+ my $self=shift;
+ my ($domain, $vhost, $attribute, @values)=@_;
my $value=$self->as_arrayref(@values);
my $dn=$self->getVhostDN($domain, $vhost);
$self->modifyAttribute($dn, $attribute, $value);
-}
+}
1;
Index: DomainMan.pm
===================================================================
RCS file: /cvsroot/ispman/ispman/lib/ISPMan/DomainMan.pm,v
retrieving revision 1.55.2.2
retrieving revision 1.55.2.3
diff -u -d -r1.55.2.2 -r1.55.2.3
--- DomainMan.pm 18 Feb 2004 21:47:14 -0000 1.55.2.2
+++ DomainMan.pm 30 Apr 2004 23:37:55 -0000 1.55.2.3
@@ -221,6 +221,12 @@
my $ispmanClientMaxDomainsLimit=$ispmanClientInfo->{'ispmanClientMaxDomains'};
my $ispmanClientDomains=$self->getDomainsCount(sprintf("ispmanClientId=%s" , $r->param("ispmanClientId")));
+ # check if homeDirectory lies in defaultHomeDirectoryPath
+ my $defaultHomeDirectoryPath=$self->getConf("defaultHomeDirectoryPath");
+ if ($r->param("homeDirectory")!~m/^$defaultHomeDirectoryPath/) {
+ print "Add Domain aborted!\nHomeDirectory must be subdir of $defaultHomeDirectoryPath.\n";
+ return
+ }
unless ($ispmanClientDomains < $ispmanClientMaxDomainsLimit) {
-------------------------------------------------------
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