Re: [PATCH] totemconfig: enforce hmac config when crypto is enabled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ACK

Fabio M. Di Nitto napsal(a):
> From: "Fabio M. Di Nitto" <fdinitto@xxxxxxxxxx>
> 
> Signed-off-by: Fabio M. Di Nitto <fdinitto@xxxxxxxxxx>
> ---
>  exec/totemconfig.c |   14 ++++++++++++--
>  1 files changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/exec/totemconfig.c b/exec/totemconfig.c
> index 3257dd4..0e1e7c6 100644
> --- a/exec/totemconfig.c
> +++ b/exec/totemconfig.c
> @@ -114,7 +114,7 @@ static void totem_volatile_config_read (struct totem_config *totem_config)
>  }
>  
>  
> -static void totem_get_crypto(struct totem_config *totem_config)
> +static int totem_get_crypto(struct totem_config *totem_config)
>  {
>  	char *str;
>  	const char *tmp_cipher;
> @@ -172,11 +172,18 @@ static void totem_get_crypto(struct totem_config *totem_config)
>  		free(str);
>  	}
>  
> +	if ((strcmp(tmp_cipher, "none") != 0) &&
> +	    (strcmp(tmp_hash, "none") == 0)) {
> +		return -1;
> +	}
> +
>  	free(totem_config->crypto_cipher_type);
>  	free(totem_config->crypto_hash_type);
>  
>  	totem_config->crypto_cipher_type = strdup(tmp_cipher);
>  	totem_config->crypto_hash_type = strdup(tmp_hash);
> +
> +	return 0;
>  }
>  
>  static uint16_t generate_cluster_id (const char *cluster_name)
> @@ -454,7 +461,10 @@ extern int totem_config_read (
>  
>  	icmap_get_uint32("totem.version", (uint32_t *)&totem_config->version);
>  
> -	totem_get_crypto(totem_config);
> +	if (totem_get_crypto(totem_config) != 0) {
> +		*error_string = "crypto_cipher requires crypto_hash with value other than none";
> +		return -1;
> +	}
>  
>  	if (icmap_get_string("totem.rrp_mode", &str) == CS_OK) {
>  		strcpy (totem_config->rrp_mode, str);

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss


[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux