From 3068271d6e2c60a28f0eaaf630c99c3f3850cf3d Mon Sep 17 00:00:00 2001 From: lars Date: Mon, 10 Apr 2006 14:26:25 +0000 Subject: [PATCH] update gnupg options implemented gpg-ezmlm: config update bug fixed --- ezmlm-web.cgi | 38 ++++++++++++++++++++++++++++++++++---- lang/de.hdf | 4 ++-- lang/en.hdf | 4 ++-- template/gnupg_public.cs | 2 +- template/gnupg_secret.cs | 2 +- 5 files changed, 40 insertions(+), 10 deletions(-) diff --git a/ezmlm-web.cgi b/ezmlm-web.cgi index f2230a9..44b16a1 100755 --- a/ezmlm-web.cgi +++ b/ezmlm-web.cgi @@ -205,7 +205,11 @@ elsif ($action eq '' || $action eq 'list_select') { $pagename = ''; } if ($pagename ne '') { - $success = 'UpdateConfig' if (($action eq 'config_do') && &update_config()); + if (&is_list_gnupg($q->param('list'))) { + $success = 'UpdateConfig' if (($action eq 'config_do') && &update_gnupg()); + } else { + $success = 'UpdateConfig' if (($action eq 'config_do') && &update_config()); + } } else { $error = 'UnknownConfigPage'; warn "missing config page: $subset"; @@ -225,7 +229,7 @@ elsif ($action eq '' || $action eq 'list_select') { $pagename = ''; } if ($pagename ne '') { - $success = 'UpdateGnupg' if (($action eq 'gnupg_do') && &update_gnupg()); + $success = 'UpdateGnupg' if (($action eq 'gnupg_do') && &manage_gnupg_keys()); } else { $error = 'UnknownGnupgPage'; warn "missing gnupg page: $subset"; @@ -1204,20 +1208,46 @@ sub extract_options_from_params() # ------------------------------------------------------------------------ -sub update_gnupg { +sub manage_gnupg_keys() +# manage gnupg keys +{ + return (1==0) unless ($GPG_SUPPORT); return (0==0); } # ------------------------------------------------------------------------ +sub update_gnupg { + # save the new gnupg configuration + # TODO: add headeradd and so on ... + + my ($list, %switches); + return (1==0) unless ($GPG_SUPPORT); + + $list = new Mail::Ezmlm::Gpg("$LIST_DIR/" . $q->param('list')); + + my ($one_switch, $one_value, $key); + my @all_params = $q->param; + foreach $one_switch (@all_params) { + if ($one_switch =~ /^available_option_gnupg_(\w*)$/) { + $key = $1; + $switches{$key} = (defined($q->param('option_gnupg_' . $key))) ? 1 : 0; + } + } + $list->update(%switches) && return (0==0); + return (1==0); +} + +# ------------------------------------------------------------------------ + sub update_config { # Save the new user entered config ... my ($list, $options, @inlocal, @inhost, $dir_of_list); my ($old_msgsize); - $list = new Mail::Ezmlm("$LIST_DIR/" . $q->param('list')); $dir_of_list = $LIST_DIR . '/' . $q->param('list'); + $list = new Mail::Ezmlm($dir_of_list); $options = &extract_options_from_params(); diff --git a/lang/de.hdf b/lang/de.hdf index 12f575b..0b90996 100644 --- a/lang/de.hdf +++ b/lang/de.hdf @@ -210,8 +210,8 @@ Lang { ListLanguage = Sprache der Liste ListCharset = Zeichensatz der Liste ModSubOverridesRemote = Hinweis: falls sowohl die Datenbank der Einsende-ModeratorInnen als auch die der Fern-AdministratorInnen in einem nicht-Standard-Verzeichnis liegen, dann wird die Einsende-ModeratorInnen-Datenbank für beides verwendet - NoPublicKeys = Es sind keine öffentlichen Schlüssel vorhanden. - NoSecretKeys = Es sind keine privaten Schlüssel vorhanden. + GnupgNoPublicKeys = Es sind keine öffentlichen Schlüssel vorhanden. + GnupgNoSecretKeys = Es sind keine privaten Schlüssel vorhanden. GnupgImportKey = Schlüssel aus einer Datei importieren: GnupgKeyName = Die Bezeichung des Schlüssels GnupgKeyComment = Ein Kommentar (optional) diff --git a/lang/en.hdf b/lang/en.hdf index 808810f..e434a91 100644 --- a/lang/en.hdf +++ b/lang/en.hdf @@ -210,8 +210,8 @@ Lang { ListLanguage = Language of the list ListCharset = Charset of the list ModSubOverridesRemote = Hint: if both the database of subscripton moderators and of remote administrators use customized locations, then the database of subscription moderators will be used for both of them - NoPublicKeys = There are no public keys available. - NoSecretKeys = There are no secret keys available. + GnupgNoPublicKeys = There are no public keys available. + GnupgNoSecretKeys = There are no secret keys available. GnupgImportKey = Import a new key from a file: GnupgKeyName = Name of the key GnupgKeyComment = Comment (optional) diff --git a/template/gnupg_public.cs b/template/gnupg_public.cs index f66a7ff..5b4ff0a 100644 --- a/template/gnupg_public.cs +++ b/template/gnupg_public.cs @@ -39,7 +39,7 @@ -

+

diff --git a/template/gnupg_secret.cs b/template/gnupg_secret.cs index 16b206b..bb71e66 100644 --- a/template/gnupg_secret.cs +++ b/template/gnupg_secret.cs @@ -39,7 +39,7 @@ -

+