diff options
author | Guilhem Moulin <guilhem.moulin@fripost.org> | 2012-09-27 03:32:46 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem.moulin@fripost.org> | 2012-09-27 03:32:46 +0200 |
commit | aa3340e58fc5b993bfc88070edf543a2ed82ef94 (patch) | |
tree | c2befe421e70971fd89be72073833b208b919ef2 /lib/Fripost | |
parent | 7672946edb73d485e5eb0ffd75964f2cea2caaa0 (diff) |
Fixing unicode.
Diffstat (limited to 'lib/Fripost')
-rw-r--r-- | lib/Fripost/Panel/Interface.pm | 19 | ||||
-rw-r--r-- | lib/Fripost/Panel/Login.pm | 2 | ||||
-rw-r--r-- | lib/Fripost/Schema.pm | 7 | ||||
-rw-r--r-- | lib/Fripost/Schema/Alias.pm | 2 | ||||
-rw-r--r-- | lib/Fripost/Schema/Domain.pm | 2 | ||||
-rw-r--r-- | lib/Fripost/Schema/List.pm | 6 | ||||
-rw-r--r-- | lib/Fripost/Schema/Local.pm | 2 | ||||
-rw-r--r-- | lib/Fripost/Schema/Mailbox.pm | 2 | ||||
-rw-r--r-- | lib/Fripost/Schema/Misc.pm | 7 |
9 files changed, 26 insertions, 23 deletions
diff --git a/lib/Fripost/Panel/Interface.pm b/lib/Fripost/Panel/Interface.pm index db6752e..f150a39 100644 --- a/lib/Fripost/Panel/Interface.pm +++ b/lib/Fripost/Panel/Interface.pm @@ -12,10 +12,12 @@ Interface.pm - =cut use parent 'Fripost::Panel::Login'; + use Fripost::Schema; use Fripost::Password; use HTML::Entities; -use Net::IDN::Encode qw/email_to_unicode/; +use Net::IDN::Encode qw/email_to_unicode domain_to_ascii/; +use CGI::Util qw/escape unescape/; # This method is called right before the 'setup' method below. It @@ -117,7 +119,9 @@ sub ListLocals : Runmode { $template->param( listAliases => $#aliases >= 0 || $domain{permissions} =~ /[aop]/ ); $template->param( aliases => [ - map { { alias => encode_entities($_->{alias}) + map { my $a = escape(encode_entities($_->{alias})); # TODO + { aliasurl => escape($a) + , alias => $a , description => join ("\n", @{$_->{description}}) , isactive => $_->{isactive} , destinations => [ map { {destination => encode_entities($_)} } @@ -139,7 +143,7 @@ sub ListLocals : Runmode { , description => join ("\n", @{$_->{description}}) , isactive => $_->{isactive} , transport => $_->{transport} - , listurl => $CFG{'listurl_'.$_->{transport}}.$_->{list}.'@'.$d + , listurl => $CFG{'listurl_'.$_->{transport}}.$_->{list}.'@'.domain_to_ascii($d) }; } @lists @@ -189,7 +193,7 @@ sub EditDomain : Runmode { $template->param( isactive => $q->param('isactive') , description => $q->param('description') , catchalls => $q->param('catchalls') - , error => encode_entities ($error, "‘‘") ); + , error => encode_entities ($error) ); } else { $template->param( isactive => $domain{isactive} @@ -267,8 +271,7 @@ sub EditLocal : Runmode { $q->param('oldpw'), ldap_uri => $CFG{ldap_uri}, ldap_suffix => $CFG{ldap_suffix}, - -die => "Wrong password (for ‘" - .encode_entities($u)."‘)." ); + -die => "Wrong password (for ‘".$u."’)." ); }; $error = $@ || $fp->mailbox->passwd( $entry{user}, @@ -336,7 +339,7 @@ sub EditLocal : Runmode { my $news = (defined $q->param('submit') or (defined $q->param('a') and $q->param('a') eq 'delete')); $template->param( newChanges => $news ); - $template->param( error => encode_entities ($error, "‘‘") ) if $error; + $template->param( error => encode_entities ($error) ) if $error; $template->param( canDelete => 1 ) if $t eq 'alias'; # TODO $template->param( listurl => $CFG{'listurl_'.$local{transport}}.$l.'@'.$d ) if $t eq 'list'; @@ -445,7 +448,7 @@ sub AddLocal : Runmode { } $template->param( isactive => $q->param('isactive') , description => $q->param('description') - , error => encode_entities ($error, "‘‘") ); + , error => encode_entities ($error) ); } else { $template->param( isactive => 1 ); diff --git a/lib/Fripost/Panel/Login.pm b/lib/Fripost/Panel/Login.pm index 8132310..86b3e66 100644 --- a/lib/Fripost/Panel/Login.pm +++ b/lib/Fripost/Panel/Login.pm @@ -208,7 +208,7 @@ sub error_rm : ErrorRunmode { $mesg = 'Not Found' } $template->param( code => $error ); - $template->param( message => encode_entities ($mesg, "‘‘") ); + $template->param( message => encode_entities ($mesg) ); return $template->output; } diff --git a/lib/Fripost/Schema.pm b/lib/Fripost/Schema.pm index a0730f9..bb1f3f5 100644 --- a/lib/Fripost/Schema.pm +++ b/lib/Fripost/Schema.pm @@ -19,7 +19,7 @@ use warnings; use utf8; use Net::LDAP; -use Authen::SASL; +use Authen::SASL 'Cyrus'; use Fripost::Schema::Domain; use Fripost::Schema::Mailbox; use Fripost::Schema::Alias; @@ -53,10 +53,9 @@ sub SASLauth { my $sasl = Authen::SASL::->new( mechanism => 'GSSAPI', - callback => { user => 'dn:'.$self->whoami - , authname => $cfg{krb5_principal} } + callback => { user => 'dn:'.$self->whoami } ); - my $conn = $sasl->client_new('ldap', $cfg{krb5_host} ); + my $conn = $sasl->client_new('ldap', $cfg{krb5_service_instance} ); die $conn->error if $conn->code; my $mesg = $self->ldap->bind( '', sasl => $conn ); diff --git a/lib/Fripost/Schema/Alias.pm b/lib/Fripost/Schema/Alias.pm index f111d7f..07ae84f 100644 --- a/lib/Fripost/Schema/Alias.pm +++ b/lib/Fripost/Schema/Alias.pm @@ -114,7 +114,7 @@ sub add { my ($l,$d) = split /\@/, email_to_ascii($a->{alias}), 2; die "Missing alias name\n" if $l eq ''; &_is_valid($a); - die "‘".$a->{alias}."‘ alread exists\n" + die "‘".$a->{alias}."’ already exists\n" if $self->local->exists($a->{alias},%options); my %attrs = ( objectClass => 'FripostVirtualAlias' diff --git a/lib/Fripost/Schema/Domain.pm b/lib/Fripost/Schema/Domain.pm index 8017e00..64a8932 100644 --- a/lib/Fripost/Schema/Domain.pm +++ b/lib/Fripost/Schema/Domain.pm @@ -94,7 +94,7 @@ sub get { my $domain = $domains->pop_entry; unless (defined $domain) { die $options{'-die'}."\n" if defined $options{'-die'}; - die "No such such domain ‘$d‘.\n"; + die "No such such domain: ‘$d’\n"; } return ( domain => domain_to_unicode($domain->get_value('fvd')) diff --git a/lib/Fripost/Schema/List.pm b/lib/Fripost/Schema/List.pm index edf9d24..87876f6 100644 --- a/lib/Fripost/Schema/List.pm +++ b/lib/Fripost/Schema/List.pm @@ -117,7 +117,7 @@ sub add { die "Missing list name\n" if $l eq ''; must_attrs( $l, 'transport' ); &_is_valid($l); - die "‘".$l->{list}."‘ already exists\n" + die "‘".$l->{list}."’ already exists\n" if $self->local->exists($l->{list},%options); my %attrs = ( objectClass => 'FripostVirtualList' @@ -177,7 +177,7 @@ sub is_pending { scope => 'base', deref => 'never', filter => 'objectClass=FripostVirtualList', - attrs => [ 'fvl', 'fripostIsStatusPending' ] + attrs => [ 'fripostIsStatusPending' ] ); die "Error: ".$l.'@'.$d.": No such object in the LDAP directory\n" if $mesg->code == 32; # No such object; a common error here. @@ -265,7 +265,7 @@ sub _is_valid { must_attrs( $l, qw/list isactive/ ); $l->{list} = email_valid( $l->{list}, -exact => 1 ); - die "Invalid transport: ‘".$l->{transport}."‘\n" + die "Invalid transport: ‘".$l->{transport}."’\n" if defined $l->{transport} and $l->{transport} !~ /^(schleuder|mailman)$/; # TODO: check commands diff --git a/lib/Fripost/Schema/Local.pm b/lib/Fripost/Schema/Local.pm index bf92555..9efff91 100644 --- a/lib/Fripost/Schema/Local.pm +++ b/lib/Fripost/Schema/Local.pm @@ -68,7 +68,7 @@ sub get { unless (defined $local) { die $options{'-die'}."\n" if defined $options{'-die'}; - die "No such such entry ‘".$loc."‘.\n"; + die "No such such entry ‘".$loc."’.\n"; } my %ret; diff --git a/lib/Fripost/Schema/Mailbox.pm b/lib/Fripost/Schema/Mailbox.pm index 0f2ff53..95e2d10 100644 --- a/lib/Fripost/Schema/Mailbox.pm +++ b/lib/Fripost/Schema/Mailbox.pm @@ -137,7 +137,7 @@ sub add { my ($l,$d) = split /\@/, email_to_ascii($m->{user}), 2; die "Missing user name\n" if $l eq ''; &_is_valid($m); - die "‘".$m->{user}."‘ alread exists\n" + die "‘".$m->{user}."’ already exists\n" if $self->local->exists($m->{user},%options); my %attrs = ( objectClass => 'FripostVirtualMailbox' diff --git a/lib/Fripost/Schema/Misc.pm b/lib/Fripost/Schema/Misc.pm index 745a20b..114e01b 100644 --- a/lib/Fripost/Schema/Misc.pm +++ b/lib/Fripost/Schema/Misc.pm @@ -82,7 +82,7 @@ sub get_perms { sub must_attrs { my $h = shift; foreach (@_) { - die '‘'.$_."‘: Missing attribute.\n" + die 'Missing attribute: ‘'.$_."’\n" unless defined $h->{$_} and (ref $h->{$_} eq 'ARRAY' ? @{$h->{$_}} : $h->{$_} ne '') } @@ -102,14 +102,15 @@ sub email_valid { my $mesg = $options{'-error'} // "Invalid e-mail"; $in = $options{'-prefix'}.$i if defined $options{'-prefix'}; Encode::_utf8_on($in); + Encode::_utf8_on($i); $in = Net::IDN::Encode::email_to_ascii($in); my $addr = Email::Valid::->address( -address => $in, -tldcheck => 1, -fqdn => 1 ); my $match = defined $addr; - $match &&= $addr eq $in if $options{'-exact'}; - die $mesg." ‘".$i."‘\n" unless $match; + $match &&= $addr eq $in if $options{'-exact'}; + die $mesg." ‘".$i."’\n" unless $match; $addr =~ s/^$options{'-prefix'}// if defined $options{'-prefix'}; return $addr; } |