[pve-devel] [Patch V2 acme 04/12] Add funtion to set DNSAPI variable

Wolfgang Bumiller w.bumiller at proxmox.com
Wed Apr 1 15:03:32 CEST 2020


On Tue, Mar 31, 2020 at 12:08:38PM +0200, Wolfgang Link wrote:
> acme.sh DNS plugins expect a configuration in which the login information
> is stored.
> We pass the credentials with the command.
> This function supports the expected behavior of the plugins.
> 
> Signed-off-by: Wolfgang Link <w.link at proxmox.com>
> ---
>  src/proxmox-acme | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/src/proxmox-acme b/src/proxmox-acme
> index 662c39a..f7a6757 100644
> --- a/src/proxmox-acme
> +++ b/src/proxmox-acme
> @@ -568,3 +568,16 @@ _source_plugin_config() {
>    return
>  }
>  
> +# Proxmox implementation to inject the DNSAPI variables
> +_load_plugin_config() {
> +    tmp_str="${plugin_conf_sting//[^,]}"

Typo here and follow-up patches: plugin_conf_st<r>ing

> +    index="$(_math ${#tmp_str} + 1)"
> +    while [ "$index" -gt "0" ]
> +    do
> +	field=$(_getfield $plugin_conf_sting "$index" ",")
> +	key=$(_getfield $field 1 "=")
> +	value=$(_getfield $field 2 "=")
> +	eval "$key"="$value"

IF you do this, you must include a long comment explaining how that
could ever be safe, where those values come from, where, when and how
they are checked, and why you feel the need to not quote anything here.
Remember, you're basically executing whatever code is contained in $key
and $value here, that '=' there doesn't necessarily do anything.

Or preferably not do this at all.

> +	index="$(_math "$index" - 1)"
> +    done
> +}
> -- 
> 2.20.1




More information about the pve-devel mailing list