diff options
author | Antoine Ginies <aginies@mandriva.com> | 2005-07-05 04:05:45 +0000 |
---|---|---|
committer | Antoine Ginies <aginies@mandriva.com> | 2005-07-05 04:05:45 +0000 |
commit | 11a02e3046e3b05081865cf639585ef2d08537aa (patch) | |
tree | 614996b84fafb42bb12a02813cf24f8ad58426be | |
parent | a67add758e814996236a6a389210779720af90c7 (diff) | |
download | drakwizard-11a02e3046e3b05081865cf639585ef2d08537aa.tar drakwizard-11a02e3046e3b05081865cf639585ef2d08537aa.tar.gz drakwizard-11a02e3046e3b05081865cf639585ef2d08537aa.tar.bz2 drakwizard-11a02e3046e3b05081865cf639585ef2d08537aa.tar.xz drakwizard-11a02e3046e3b05081865cf639585ef2d08537aa.zip |
fix user_mod
-rwxr-xr-x | web_wizard/Apache.pm | 60 |
1 files changed, 41 insertions, 19 deletions
diff --git a/web_wizard/Apache.pm b/web_wizard/Apache.pm index e43af1d6..876c7bb1 100755 --- a/web_wizard/Apache.pm +++ b/web_wizard/Apache.pm @@ -31,7 +31,7 @@ use MDK::Wizard::Varspaceval; my $wiz = new MDK::Wizard::Wizcommon; -my $file; +my $file = "/etc/httpd/conf/httpd.conf"; my $root; my $config; @@ -44,7 +44,7 @@ my $o = { user_dir => '', shared_dir => '' }, - needed_rpm => [ 'apache-mpm-prefork' ], + needed_rpm => [ 'apache-mpm-prefork', 'apache-mod_userdir' ], defaultimage => "/usr/share/wizards/web_wizard/images/apache.png", init => sub { if (-f $file) { @@ -97,7 +97,12 @@ $o->{pages} = { }, user_dir => { name => N("Type the name of the directory users should create in their homes (without ~/) to get it available via http://www.yourserver.com/~user"), - pre => sub { $o->{var}{user_dir} ||= 'public_html' }, + pre => sub { + $o->{var}{user_dir} = get_user_dir(); + if ($o->{var}{user_dir} =~ /disabled/) { + $o->{var}{user_dir} = 'public_html'; + } + }, data => [ { label => N("user http sub-directory: ~/"), help => N("Type the name of the directory users should create in their homes (without ~/) to get it available via http://www.yourserver.com/~user"), val => \$o->{var}{user_dir} }, ], @@ -170,11 +175,11 @@ sub chg_docroot { substInFile { s|^\s*<Directory\s*$old/?>|<Directory $o->{var}{shared_dir}>|; - } "/etc/httpd/conf/commonhttpd.conf" if $old; + } $file if $old; substInFile { s|^\s*<Directory\s*/var/www/html/?>|<Directory $o->{var}{shared_dir}>|; - } "/etc/httpd/conf/httpd.conf"; + } $file; } sub is_user_mod { @@ -192,25 +197,44 @@ sub is_last_user_mod { } sub get_user_dir { - my %conf = MDK::Wizard::Varspaceval->get("/etc/httpd/conf/httpd.conf"); + my %conf = MDK::Wizard::Varspaceval->get($file); $conf{UserDir}; } sub chg_user_dir { - my $root = get_user_dir(); + # disable by default user_mod + if (! any { /<IfModule mod_userdir.c>/ } cat_($file)) { + append_to_file($file, <<EOF); +# add usermod dir support +<IfModule mod_userdir.c> + UserDir disabled +</IfModule> + +<Directory /home/*/> + AllowOverride FileInfo AuthConfig Limit + Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec + <Limit GET POST OPTIONS PROPFIND> + Order allow,deny + Allow from all + </Limit> + <LimitExcept GET POST OPTIONS PROPFIND> + Order deny,allow + Deny from all + </LimitExcept> +</Directory> +EOF + } + + $root = get_user_dir(); if ($o->{var}{user_mod}) { substInFile { - s|(/home/\*/)$root(/?)|$1$o->{var}{user_dir}$2|g; - } "/etc/httpd/conf/httpd.conf"; + s|(\s*)UserDir.*|$1UserDir $o->{var}{user_dir}|g; + s|<Directory\s+/home/\*/.*|<Directory /home/\*/$o->{var}{user_dir}>|g; + } $file; + } else { substInFile { - s|(\s*)UserDir\s*$root(/?)|$1UserDir $o->{var}{user_dir}$2|g; - s|(/home/\*/)$root(/?)|$1$o->{var}{user_dir}$2|g; - } "/etc/httpd/conf/httpd.conf"; - } - else { - substInFile { - s|(\s*)UserDir\s*$root(/?)|$1UserDir disabled$2|g; - } "/etc/httpd/conf/httpd.conf"; + s|(\s*)UserDir\s*$root|$1UserDir disabled|g; + } $file; } } @@ -219,9 +243,7 @@ sub do_it { my $in = 'interactive'->vnew('su', 'Apache'); my $w = $in->wait_message(N("Apache server"), N("Configuring your system as Apache server ...")); - my $file = "/etc/httpd/conf/httpd.conf"; my $that = "localhost"; - if ($o->{var}{web_external} eq "1") { $that = "all"; } |