]> git.proxmox.com Git - pve-manager.git/commitdiff
acme: encode plugin data in proxmox-acme-perl
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 17 Apr 2020 13:10:15 +0000 (15:10 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sun, 3 May 2020 12:10:17 +0000 (14:10 +0200)
when reading/writing plugin config

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
PVE/API2/ACMEPlugin.pm
PVE/CLI/pvenode.pm

index 6b789a1dc8a1a040208938685f9da533d637ed9d..0a2a0b769a850cad3bfa6c8433a8b569163cfb78 100644 (file)
@@ -44,20 +44,6 @@ __PACKAGE__->register_method({
        return  load_config();
     }});
 
-my $encode_data_field = sub {
-    my ($data) = @_;
-
-    my $encoded_data;
-    while ($data) {
-       $data =~ /^([a-zA-Z]\w*=)([\w.,-]*)(,([a-zA-Z]\w*=.*))?$/;
-       $encoded_data .= $1;
-       $encoded_data .= MIME::Base64::encode_base64($2, '');
-       $encoded_data .= "," if $4;
-       $data = $4 ? $4 : undef;
-    }
-    return $encoded_data;
-};
-
 my $update_config = sub {
     my ($id, $op, $type, $param) = @_;
 
@@ -66,18 +52,13 @@ my $update_config = sub {
     if ( $op eq "add" ) {
        die "Section with ID: $id already exists\n"
            if defined($conf->{ids}->{$id});
+
+       $conf->{ids}->{$id} = $param;
        $conf->{ids}->{$id}->{type} = $type;
     } elsif ($op eq "del") {
        delete $conf->{ids}->{$id};
     }
 
-    foreach my $opt (keys %$param) {
-       my $value = $param->{$opt};
-       if ($opt eq 'data'){
-           $value = &$encode_data_field($value);
-       }
-       $conf->{ids}->{$id}->{$opt} = $value;
-    }
 
     PVE::Cluster::cfs_write_file($FILENAME, $conf);
 };
index ba01b7a428f72c3025be7ab0e7746221de53b01f..fd706a91e4683937d21f33bbd471d9c884d885d8 100644 (file)
@@ -46,6 +46,9 @@ sub param_mapping {
            'certificates',
            'key',
        ],
+       'add_plugin' => [
+           'data',
+       ],
     };
 
     return $mapping->{$name};