r418@erker: lars | 2008-09-28 11:32:49 +0200

encryption support:
 * renamed "GPG_SUPPORT" to "ENCRYPTION_SUPPORT"
 * populate a hash for supported features (%FEATURES)
 * specific gui options for encryption now depend on specific features
 * defined Config.Features.GpgKeyRing
This commit is contained in:
lars 2008-09-29 20:44:31 +00:00
parent e295e6d4d6
commit d12f1e716f
3 changed files with 34 additions and 34 deletions

View file

@ -122,7 +122,7 @@ $HTML_LANGUAGE = "en";
# enabled support for encrypted mailing lists - defaults to 0 (off) # enabled support for encrypted mailing lists - defaults to 0 (off)
# This include keyring management and mailing list handling in general. # This include keyring management and mailing list handling in general.
#$GPG_SUPPORT = 0; #$ENCRYPTION_SUPPORT = 0;
# Define the default location of gnupg keyrings used for mailing list # Define the default location of gnupg keyrings used for mailing list
# encryption. If the location starts with a slash ('/'), then it is considered # encryption. If the location starts with a slash ('/'), then it is considered

View file

@ -103,11 +103,13 @@ use vars qw[@INTERFACE_OPTIONS_BLACKLIST];
# default interface template (basic/normal/expert) # default interface template (basic/normal/expert)
use vars qw[$DEFAULT_INTERFACE_TYPE]; use vars qw[$DEFAULT_INTERFACE_TYPE];
# some settings for encrypted mailing lists # some settings for encrypted mailing lists
use vars qw[$GPG_SUPPORT $GPG_KEYRING_DEFAULT_LOCATION]; use vars qw[$ENCRYPTION_SUPPORT $GPG_KEYRING_DEFAULT_LOCATION];
# settings for multi-domain setups # settings for multi-domain setups
use vars qw[%DOMAINS $CURRENT_DOMAIN]; use vars qw[%DOMAINS $CURRENT_DOMAIN];
# cached data # cached data
use vars qw[%CACHED_DATA]; use vars qw[%CACHED_DATA];
# available features
use vars qw[%FEATURES];
# some deprecated configuration settings - they have to be registered # some deprecated configuration settings - they have to be registered
# otherwise old configuration files would break # otherwise old configuration files would break
@ -149,18 +151,18 @@ unless (my $return = do $config_file) {
####### validate configuration and apply some default settings ########## ####### validate configuration and apply some default settings ##########
# do we support encrypted mailing lists an keyring management? # do we support encrypted mailing lists an keyring management?
$GPG_SUPPORT = 0 unless defined($GPG_SUPPORT); $ENCRYPTION_SUPPORT = 0 unless defined($ENCRYPTION_SUPPORT);
if ($GPG_SUPPORT) { if ($ENCRYPTION_SUPPORT) {
my @crypto_modules = ( $FEATURES{GPGEZMLM} = (0==0)
"Mail::Ezmlm::GpgKeyRing", if (&safely_import_module("Mail::Ezmlm::GpgEzmlm"));
"Mail::Ezmlm::GpgEzmlm", $FEATURES{GPGKEYRING} = (0==0)
); if (&safely_import_module("Mail::Ezmlm::GpgKeyRing"));
for my $module_name (@crypto_modules) { # did we load any modules?
unless (&safely_import_module($module_name)) { if (scalar keys %FEATURES == 0) {
$GPG_SUPPORT = 0; warn "WARNING: all of the supported encryption modules "
warn "WARNING: Support for encryption features is disabled, " . "(Mail::Ezmlm::GpgEzmlm and Mail::Ezmlm::GpgKeyRing) failed "
. "because the module '$module_name' failed to load!"; . "to load. Encryption support is disabled.";
} $ENCRYPTION_SUPPORT = 0;
} }
} }
@ -426,9 +428,9 @@ if (defined($action) && ($action eq 'show_mime_examples')) {
$error = 'ParameterMissing'; $error = 'ParameterMissing';
$pagename = 'list_select'; $pagename = 'list_select';
} }
} elsif ($GPG_SUPPORT && ($action eq 'gpgezmlm_convert_ask')) { } elsif ($FEATURES{GPGEZMLM} && ($action eq 'gpgezmlm_convert_ask')) {
$pagename = 'gpgezmlm_convert'; $pagename = 'gpgezmlm_convert';
} elsif ($GPG_SUPPORT && ($action eq 'gpgezmlm_convert_enable')) { } elsif ($FEATURES{GPGEZMLM} && ($action eq 'gpgezmlm_convert_enable')) {
if (ref($list) && $list->isa("Mail::Ezmlm::GpgEzmlm")) { if (ref($list) && $list->isa("Mail::Ezmlm::GpgEzmlm")) {
$pagename = 'gpgezmlm_convert'; $pagename = 'gpgezmlm_convert';
$warning = 'GpgEzmlmConvertAlreadyEnabled'; $warning = 'GpgEzmlmConvertAlreadyEnabled';
@ -451,7 +453,7 @@ if (defined($action) && ($action eq 'show_mime_examples')) {
$warning = 'GpgEzmlmConvertEnable'; $warning = 'GpgEzmlmConvertEnable';
} }
} }
} elsif ($GPG_SUPPORT && ($action eq 'gpgezmlm_convert_disable')) { } elsif ($FEATURES{GPGEZMLM} && ($action eq 'gpgezmlm_convert_disable')) {
if ($list && $list->isa("Mail::Ezmlm::GpgEzmlm")) { if ($list && $list->isa("Mail::Ezmlm::GpgEzmlm")) {
if ($list->convert_to_plaintext()) { if ($list->convert_to_plaintext()) {
$list = $_; $list = $_;
@ -465,7 +467,7 @@ if (defined($action) && ($action eq 'show_mime_examples')) {
$pagename = 'gpgezmlm_convert'; $pagename = 'gpgezmlm_convert';
$warning = 'GpgEzmlmConvertAlreadyDisabled'; $warning = 'GpgEzmlmConvertAlreadyDisabled';
} }
} elsif ($GPG_SUPPORT && (($action eq 'gnupg_ask') || } elsif ($FEATURES{GPGKEYRING} && (($action eq 'gnupg_ask') ||
($action eq 'gnupg_do'))) { ($action eq 'gnupg_do'))) {
# User wants to manage keys (only for encrypted mailing lists) # User wants to manage keys (only for encrypted mailing lists)
my $subset = $q->param('gnupg_subset'); my $subset = $q->param('gnupg_subset');
@ -487,7 +489,7 @@ if (defined($action) && ($action eq 'show_mime_examples')) {
$error = 'ParameterMissing'; $error = 'ParameterMissing';
$pagename = 'list_select'; $pagename = 'list_select';
} }
} elsif ($GPG_SUPPORT && ($action eq 'gnupg_export')) { } elsif ($FEATURES{GPGKEYRING} && ($action eq 'gnupg_export')) {
if ($list && is_list_encrypted($list) if ($list && is_list_encrypted($list)
&& defined($q->param('gnupg_keyid'))) { && defined($q->param('gnupg_keyid'))) {
if (&gnupg_export_key($list, $q->param('gnupg_keyid'))) { if (&gnupg_export_key($list, $q->param('gnupg_keyid'))) {
@ -653,8 +655,9 @@ sub init_hdf {
$i++; $i++;
} }
# support for encrypted mailing lists? # support for encryption?
$hdf->setValue("Config.Features.GpgEzmlm", 1) if ($GPG_SUPPORT); $hdf->setValue("Config.Features.GpgEzmlm", 1) if ($FEATURES{GPGEZMLM});
$hdf->setValue("Config.Features.GpgKeyRing", 1) if ($FEATURES{GPGKEYRING});
# enable some features that are only available for specific versions # enable some features that are only available for specific versions
# of ezmlm-idx # of ezmlm-idx
@ -720,15 +723,14 @@ sub get_list_object {
my $listname = shift; my $listname = shift;
my ($list, @module_order, $one_module); my ($list, @module_order, $one_module);
if ($GPG_SUPPORT) { @module_order = ();
# TODO: add more encryption modules here
@module_order = ( # gpg-ezmlm
"Mail::Ezmlm::GpgEzmlm", push(@module_order, "Mail::Ezmlm::GpgEzmlm")
"Mail::Ezmlm", if ($FEATURES{GPGEZMLM});
);
} else { # default
@module_order = ("Mail::Ezmlm",); push(@module_order, "Mail::Ezmlm");
}
for $one_module (@module_order) { for $one_module (@module_order) {
$list = $one_module->new("$LIST_DIR/$listname"); $list = $one_module->new("$LIST_DIR/$listname");
@ -962,7 +964,7 @@ sub set_pagedata4list {
&set_pagedata_options_blacklist($list); &set_pagedata_options_blacklist($list);
# do we support encryption? Show a possible keyring ... # do we support encryption? Show a possible keyring ...
&set_pagedata_keyring($list) if ($GPG_SUPPORT); &set_pagedata_keyring($list) if ($FEATURES{GPGKEYRING});
# is this a moderation/administration list? # is this a moderation/administration list?
&set_pagedata4part_list($list, $part_type) if ($part_type ne ''); &set_pagedata4part_list($list, $part_type) if ($part_type ne '');
@ -1406,8 +1408,6 @@ sub get_list_part {
sub is_list_encrypted { sub is_list_encrypted {
my $list = shift; my $list = shift;
return (1==0) unless ($GPG_SUPPORT);
if ($list->isa("Mail::Ezmlm::GpgEzmlm")) { if ($list->isa("Mail::Ezmlm::GpgEzmlm")) {
return (0==0); return (0==0);
} else { } else {

View file

@ -115,7 +115,7 @@ It just hides the visible interface items. Anyone can still craft a manual
http request, that could change the specified options. http request, that could change the specified options.
See the list of filenames below \fI$TEMPLATE_DIR/config_options/\fR. The See the list of filenames below \fI$TEMPLATE_DIR/config_options/\fR. The
blacklist may contain any of these filenames (without '.cs' extension). blacklist may contain any of these filenames (without '.cs' extension).
.IP \fB$GPG_SUPPORT\fR .IP \fB$ENCRYPTION_SUPPORT\fR
Enable support for encrypted mailing lists. Currently this feature is still Enable support for encrypted mailing lists. Currently this feature is still
considered as beta quality. User reports are warmly welcome! considered as beta quality. User reports are warmly welcome!
.IP \fB$GPG_KEYRING_DEFAULT_LOCATION\fR .IP \fB$GPG_KEYRING_DEFAULT_LOCATION\fR