diff -Nru zentyal-captiveportal-3.1.5/ChangeLog zentyal-captiveportal-3.1.6/ChangeLog --- zentyal-captiveportal-3.1.5/ChangeLog 2013-09-10 21:16:04.000000000 +0000 +++ zentyal-captiveportal-3.1.6/ChangeLog 2013-09-18 12:43:30.000000000 +0000 @@ -1,3 +1,5 @@ +3.1.6 + + Allow login when accessing an HTTPS page 3.1.5 + Improved reload icon + Fixed regression trying to access redis after users API changes diff -Nru zentyal-captiveportal-3.1.5/debian/changelog zentyal-captiveportal-3.1.6/debian/changelog --- zentyal-captiveportal-3.1.5/debian/changelog 2013-09-10 21:16:04.000000000 +0000 +++ zentyal-captiveportal-3.1.6/debian/changelog 2013-09-18 12:43:31.000000000 +0000 @@ -1,3 +1,9 @@ +zentyal-captiveportal (3.1.6) precise; urgency=low + + * New upstream release + + -- José A. Calvo Wed, 18 Sep 2013 14:43:31 +0200 + zentyal-captiveportal (3.1.5) precise; urgency=low * New upstream release diff -Nru zentyal-captiveportal-3.1.5/src/EBox/CaptivePortal/CGI/Login.pm zentyal-captiveportal-3.1.6/src/EBox/CaptivePortal/CGI/Login.pm --- zentyal-captiveportal-3.1.5/src/EBox/CaptivePortal/CGI/Login.pm 2013-09-10 21:16:04.000000000 +0000 +++ zentyal-captiveportal-3.1.6/src/EBox/CaptivePortal/CGI/Login.pm 2013-09-18 12:43:30.000000000 +0000 @@ -27,97 +27,96 @@ sub new # (error=?, msg=?, cgi=?) { - my $class = shift; - my $self = $class->SUPER::new('title' => '', - 'template' => '/captiveportal/login.mas', - @_); - bless($self, $class); - return $self; + my $class = shift; + my $self = $class->SUPER::new('title' => '', + 'template' => '/captiveportal/login.mas', + @_); + bless($self, $class); + return $self; } sub _print { - my $self = shift; - print($self->cgi()->header(-charset=>'utf-8')); - $self->_body; + my $self = shift; + print($self->cgi()->header(-charset=>'utf-8')); + $self->_body; } sub _process { - my $self = shift; - my $r = Apache2::RequestUtil->request; - my $envre; - my $authreason; - - if ($r->prev){ - $envre = $r->prev->subprocess_env("LoginReason"); - $authreason = $r->prev->subprocess_env('AuthCookieReason'); - } - - my $destination = _requestDestination($r); - - my $reason; - if ( (defined ($envre) ) and ($envre eq 'Script active') ) { - $reason = __('There is a script which has asked to run in Zentyal exclusively. ' . - 'Please, wait patiently until it is done'); - } - elsif ((defined $authreason) and ($authreason eq 'bad_credentials')){ - $reason = __('Incorrect password'); - } - elsif ((defined $envre) and ($envre eq 'Expired')){ - $reason = __('For security reasons your session ' . - 'has expired due to inactivity'); - }elsif ((defined $envre and $envre eq 'Already')){ - $reason = __('You have been logged out because ' . - 'a new session has been opened'); - }elsif ((defined $envre and $envre eq 'NotLoggedIn')){ - $reason = __('You are not logged in'); - } - - my @htmlParams = ( - 'destination' => $destination, - 'reason' => $reason, - ); + my $self = shift; + my $r = Apache2::RequestUtil->request; + my $envre; + my $authreason; + + if ($r->prev){ + $envre = $r->prev->subprocess_env("LoginReason"); + $authreason = $r->prev->subprocess_env('AuthCookieReason'); + } + + my $destination = _requestDestination($r); + + my $reason; + if ( (defined ($envre) ) and ($envre eq 'Script active') ) { + $reason = __('There is a script which has asked to run in Zentyal exclusively. ' . + 'Please, wait patiently until it is done'); + } + elsif ((defined $authreason) and ($authreason eq 'bad_credentials')){ + $reason = __('Incorrect password'); + } + elsif ((defined $envre) and ($envre eq 'Expired')){ + $reason = __('For security reasons your session ' . + 'has expired due to inactivity'); + }elsif ((defined $envre and $envre eq 'Already')){ + $reason = __('You have been logged out because ' . + 'a new session has been opened'); + }elsif ((defined $envre and $envre eq 'NotLoggedIn')){ + $reason = __('You are not logged in'); + } + + my @htmlParams = ( + 'destination' => $destination, + 'reason' => $reason, + ); - $self->{params} = \@htmlParams; + $self->{params} = \@htmlParams; } sub _requestDestination { - my ($r) = @_; + my ($r) = @_; - if ($r->prev) { - return _requestDestination($r->prev); - } - - my $request = $r->the_request; - my $method = $r->method; - my $protocol = $r->protocol; - EBox::info("REQUESt $request METHOD $method PROT $protocol"); # DDD - - my ($destination) = ($request =~ m/$method\s*(.*?)\s*$protocol/ ); - defined $destination or return DEFAULT_DESTINATION; - - if ($destination =~ m{^/*zentyal/+Login$}) { - # /Login is the standard location from login, his destination must be the default destination - return DEFAULT_DESTINATION; - } - elsif (not $destination =~ m{^/*zentyal}) { - # url wich does not follow the normal zentyal pattern must use the default - # destination - my $dstUrl = $destination; - $dstUrl =~ s{^.*redirect=}{}; - $dstUrl =~ s{%3f}{?}; - if ($protocol =~ m/HTTPS/i) { - $dstUrl = 'https://' . $dstUrl; - } else { - $dstUrl = 'http://' . $dstUrl; - } + if ($r->prev) { + return _requestDestination($r->prev); + } + + my $request = $r->the_request; + my $method = $r->method; + my $protocol = $r->protocol; + + my ($destination) = ($request =~ m/$method\s*(.*?)\s*$protocol/ ); + defined $destination or return DEFAULT_DESTINATION; + + if ($destination =~ m{^/*zentyal/+Login$}) { + # /Login is the standard location from login, his destination must be the default destination + return DEFAULT_DESTINATION; + } + elsif (not $destination =~ m{^/*zentyal}) { + # url wich does not follow the normal zentyal pattern must use the default + # destination + my $dstUrl = $destination; + $dstUrl =~ s{^.*redirect=}{}; + $dstUrl =~ s{%3f}{?}; + if ($protocol =~ m/HTTPS/i) { + $dstUrl = 'https://' . $dstUrl; + } else { + $dstUrl = 'http://' . $dstUrl; + } - return DEFAULT_DESTINATION . "?dst=$dstUrl"; - } + return DEFAULT_DESTINATION . "?dst=$dstUrl"; + } - return $destination; + return $destination; } sub _validateReferer @@ -136,12 +135,12 @@ sub _loggedIn { - return 1; + return 1; } sub _menu { - return; + return; } 1; diff -Nru zentyal-captiveportal-3.1.5/src/EBox/CaptivePortalFirewall.pm zentyal-captiveportal-3.1.6/src/EBox/CaptivePortalFirewall.pm --- zentyal-captiveportal-3.1.5/src/EBox/CaptivePortalFirewall.pm 2013-09-10 21:16:04.000000000 +0000 +++ zentyal-captiveportal-3.1.6/src/EBox/CaptivePortalFirewall.pm 2013-09-18 12:43:30.000000000 +0000 @@ -57,8 +57,9 @@ my ($self) = @_; my @rules = (); - # Redirect HTTP traffic to redirecter + # Redirect HTTP and HTTPS traffic to redirecter my $port = $self->{captiveportal}->httpPort(); + my $captiveport = $self->{captiveportal}->httpsPort(); my $ifaces = $self->{captiveportal}->ifaces(); my @exRules = @{$self->_exceptionsRules('captive')}; @@ -77,6 +78,8 @@ $r = "$input -p tcp --dport 80 -j REDIRECT --to-ports $port"; push(@rules, { 'rule' => $r, 'chain' => 'captive' }); + $r = "$input -p tcp --dport 443 -j REDIRECT --to-ports $captiveport"; + push(@rules, { 'rule' => $r, 'chain' => 'captive' }); } return \@rules; } @@ -87,6 +90,7 @@ my @rules = (); my $port = $self->{captiveportal}->httpPort(); + my $captiveport = $self->{captiveportal}->httpsPort(); my $ifaces = $self->{captiveportal}->ifaces(); my $net = $self->{network}; @@ -97,6 +101,8 @@ my $ip = $add->{'address'}; my $r = "$input -p tcp --sport $port -j SNAT --to-source $ip:$port"; push(@rules, $r); + $r = "$input -p tcp --sport $captiveport -j SNAT --to-source $ip:$captiveport"; + push(@rules, $r); } } @@ -147,8 +153,6 @@ my ($self) = @_; my @rules = (); - my $port = $self->{captiveportal}->httpPort(); - my $captiveport = $self->{captiveportal}->httpPort(); my $ifaces = $self->{captiveportal}->ifaces(); my @exRules = @{$self->_exceptionsRules('fcaptive')}; diff -Nru zentyal-captiveportal-3.1.5/src/templates/popup.mas zentyal-captiveportal-3.1.6/src/templates/popup.mas --- zentyal-captiveportal-3.1.5/src/templates/popup.mas 2013-09-10 21:16:04.000000000 +0000 +++ zentyal-captiveportal-3.1.6/src/templates/popup.mas 2013-09-18 12:43:30.000000000 +0000 @@ -34,7 +34,7 @@