Linux-Bluetooth Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH BlueZ] mesh: Allow to finish key refresh when no AppKeys are stored
@ 2020-02-05 22:53 Inga Stotland
  2020-02-07 17:22 ` Gix, Brian
  0 siblings, 1 reply; 2+ messages in thread
From: Inga Stotland @ 2020-02-05 22:53 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: brian.gix, Inga Stotland

This handles a case when a Key Refresh procedure is in place with
no application keys stored in the keyring. When KR procedure is
finalized, the check for the presence of AppKeys storage directory
does not return failure if the directory does not exist.

Also, remove duplicate include.
---
 mesh/keyring.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/mesh/keyring.c b/mesh/keyring.c
index 41cb2e980..4a6f9f27d 100644
--- a/mesh/keyring.c
+++ b/mesh/keyring.c
@@ -24,10 +24,10 @@
 #define _GNU_SOURCE
 #include <fcntl.h>
 #include <dirent.h>
+#include <errno.h>
 #include <limits.h>
 #include <stdio.h>
 #include <unistd.h>
-#include <dirent.h>
 
 #include <sys/stat.h>
 
@@ -166,7 +166,10 @@ bool keyring_finalize_app_keys(struct mesh_node *node, uint16_t net_idx)
 	snprintf(key_dir, PATH_MAX, "%s%s", node_path, app_key_dir);
 	dir = opendir(key_dir);
 	if (!dir) {
-		l_error("Failed to App Key storage directory: %s", key_dir);
+		if (errno == ENOENT)
+			return true;
+
+		l_error("Failed to open AppKey storage directory: %s", key_dir);
 		return false;
 	}
 
-- 
2.21.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH BlueZ] mesh: Allow to finish key refresh when no AppKeys are stored
  2020-02-05 22:53 [PATCH BlueZ] mesh: Allow to finish key refresh when no AppKeys are stored Inga Stotland
@ 2020-02-07 17:22 ` Gix, Brian
  0 siblings, 0 replies; 2+ messages in thread
From: Gix, Brian @ 2020-02-07 17:22 UTC (permalink / raw)
  To: linux-bluetooth, Stotland, Inga

Applied
On Wed, 2020-02-05 at 14:53 -0800, Inga Stotland wrote:
> This handles a case when a Key Refresh procedure is in place with
> no application keys stored in the keyring. When KR procedure is
> finalized, the check for the presence of AppKeys storage directory
> does not return failure if the directory does not exist.
> 
> Also, remove duplicate include.
> ---
>  mesh/keyring.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/mesh/keyring.c b/mesh/keyring.c
> index 41cb2e980..4a6f9f27d 100644
> --- a/mesh/keyring.c
> +++ b/mesh/keyring.c
> @@ -24,10 +24,10 @@
>  #define _GNU_SOURCE
>  #include <fcntl.h>
>  #include <dirent.h>
> +#include <errno.h>
>  #include <limits.h>
>  #include <stdio.h>
>  #include <unistd.h>
> -#include <dirent.h>
>  
>  #include <sys/stat.h>
>  
> @@ -166,7 +166,10 @@ bool keyring_finalize_app_keys(struct mesh_node *node, uint16_t net_idx)
>  	snprintf(key_dir, PATH_MAX, "%s%s", node_path, app_key_dir);
>  	dir = opendir(key_dir);
>  	if (!dir) {
> -		l_error("Failed to App Key storage directory: %s", key_dir);
> +		if (errno == ENOENT)
> +			return true;
> +
> +		l_error("Failed to open AppKey storage directory: %s", key_dir);
>  		return false;
>  	}
>  

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-05 22:53 [PATCH BlueZ] mesh: Allow to finish key refresh when no AppKeys are stored Inga Stotland
2020-02-07 17:22 ` Gix, Brian

Linux-Bluetooth Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-bluetooth/0 linux-bluetooth/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-bluetooth linux-bluetooth/ https://lore.kernel.org/linux-bluetooth \
		linux-bluetooth@vger.kernel.org
	public-inbox-index linux-bluetooth

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-bluetooth


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git