X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=licom.cgi;h=70398b26f0a9d7cfaab059ee4c6c28577a216b79;hb=HEAD;hp=190a9b6f7c0ed02d9e1345409d6c439c4aaf8521;hpb=e3e82a4771bf51037237e9aafa7cb4c89a9be964;p=licom.git diff --git a/licom.cgi b/licom.cgi index 190a9b6..70398b2 100755 --- a/licom.cgi +++ b/licom.cgi @@ -20,6 +20,7 @@ use strict; use warnings; use lib (qw(lib)); +use Encode (qw(encode decode is_utf8)); use CGI (':cgi'); use CGI::Carp (qw(fatalsToBrowser)); use URI::Escape; @@ -48,7 +49,7 @@ our %FieldNames = our $MySelf = $ENV{'SCRIPT_NAME'}; -our $Action = param ('action'); +our $Action = param_utf8 ('action'); $Action ||= 'default'; our %Actions = @@ -63,16 +64,18 @@ our %Actions = verify => [\&html_start, \&action_verify, \&html_end], delete => [\&html_start, \&action_ask_del, \&html_end], expunge => [\&html_start, \&action_do_del, \&html_end], - vcard => \&action_vcard + vcard => \&action_vcard, + edit_group => [\&html_start, \&action_edit_group, \&html_end], + save_group => [\&html_start, \&action_save_group, \&html_end] ); read_config (); # make sure AuthLDAPRemoteUserIsDN is enabled. die unless ($ENV{'REMOTE_USER'}); -set_config ('base_dn', $ENV{'REMOTE_USER'}); +#set_config ('base_dn', $ENV{'REMOTE_USER'}); -die unless (defined (get_config ('uri')) +die ("Configuration is incomplete") unless (defined (get_config ('uri')) and defined (get_config ('base_dn')) and defined (get_config ('bind_dn')) and defined (get_config ('password'))); @@ -82,7 +85,7 @@ LiCoM::Connection->connect uri => get_config ('uri'), bind_dn => get_config ('bind_dn'), password => get_config ('password') -) or die; +) or die ("Unable to connect to LDAP directory server " . get_config ('uri')); our ($UserCN, $UserID) = LiCoM::Person->get_user ($ENV{'REMOTE_USER'}); @@ -93,12 +96,12 @@ if (!$UserID and $Action ne 'save') if (!$UserCN) { - die; + die ("No such user in the LDAP directory: " . $ENV{'REMOTE_USER'}); } if (!defined ($Actions{$Action})) { - die; + die ("No such action: $Action"); } if (ref ($Actions{$Action}) eq 'CODE') @@ -121,7 +124,7 @@ exit (0); sub action_browse { - my $group = param ('group'); + my $group = param_utf8 ('group'); $group = shift if (@_); $group ||= ''; @@ -129,17 +132,17 @@ sub action_browse { my @groups = LiCoM::Group->all (); - print qq(\t\t

Contact Groups

\n\t\t