linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] obexd/pbap: clear cache if name header is present
@ 2016-06-30 14:06 Biman Paul
  2016-09-01 17:37 ` Biman Paul
  2016-09-04  6:50 ` Biman Paul
  0 siblings, 2 replies; 4+ messages in thread
From: Biman Paul @ 2016-06-30 14:06 UTC (permalink / raw)
  To: linux-bluetooth

Remote device is not able to fetch call logs from different folder.
It always returns the call logs requested in first request.

Considering a situation to fetch from och and then from cch,
there are two ways to request x-bt/vcard-listing:
Case I:
1. SetPhoneBook to /telecom/och (absolute path)
2. PullvCardListing with name header '' (empty)
Remote devices using this method always calls SetPhoneBook with absolute path
to set the path and we clear the cache when new path is set.
Case II:
1. SetPhoneBook to /telecom (relative path)
2. PullvCardListing with name header 'och'
Remote devices using this method calls SetPhoneBook with '/telecom' only once
and cache is not cleared when second PullvCardListing is made with name header.
This results in cached incorrect list sent to remote device.

Clear cache if name header is present would prevent sending of
cache list as it is not present. Instead it would request to
create new cache based on new name header.
---
 obexd/plugins/pbap.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/obexd/plugins/pbap.c b/obexd/plugins/pbap.c
index bab691c..ad93208 100644
--- a/obexd/plugins/pbap.c
+++ b/obexd/plugins/pbap.c
@@ -543,13 +543,18 @@ static int pbap_get(struct obex_session *os, void *user_data)
 
 	} else if (g_ascii_strcasecmp(type, VCARDLISTING_TYPE) == 0) {
 		/* Always relative */
-		if (!name || strlen(name) == 0)
+		if (!name || strlen(name) == 0) {
 			/* Current folder */
 			path = g_strdup(pbap->folder);
-		else
+		} else {
 			/* Current folder + relative path */
 			path = g_build_filename(pbap->folder, name, NULL);
 
+			/* clear cache */
+			pbap->cache.valid = FALSE;
+			pbap->cache.index = 0;
+			cache_clear(&pbap->cache);
+		}
 	} else if (g_ascii_strcasecmp(type, VCARDENTRY_TYPE) == 0) {
 		/* File name only */
 		path = g_strdup(name);
-- 
1.7.9.5


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

* Re: [PATCH 1/1] obexd/pbap: clear cache if name header is present
  2016-06-30 14:06 [PATCH 1/1] obexd/pbap: clear cache if name header is present Biman Paul
@ 2016-09-01 17:37 ` Biman Paul
  2016-09-04  6:50 ` Biman Paul
  1 sibling, 0 replies; 4+ messages in thread
From: Biman Paul @ 2016-09-01 17:37 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Biman Paul

On Thu, Jun 30, 2016 at 7:36 PM, Biman Paul <biman.paul@samsung.com> wrote:
> Remote device is not able to fetch call logs from different folder.
> It always returns the call logs requested in first request.
>
> Considering a situation to fetch from och and then from cch,
> there are two ways to request x-bt/vcard-listing:
> Case I:
> 1. SetPhoneBook to /telecom/och (absolute path)
> 2. PullvCardListing with name header '' (empty)
> Remote devices using this method always calls SetPhoneBook with absolute path
> to set the path and we clear the cache when new path is set.
> Case II:
> 1. SetPhoneBook to /telecom (relative path)
> 2. PullvCardListing with name header 'och'
> Remote devices using this method calls SetPhoneBook with '/telecom' only once
> and cache is not cleared when second PullvCardListing is made with name header.
> This results in cached incorrect list sent to remote device.
>
> Clear cache if name header is present would prevent sending of
> cache list as it is not present. Instead it would request to
> create new cache based on new name header.
> ---
>  obexd/plugins/pbap.c |    9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/obexd/plugins/pbap.c b/obexd/plugins/pbap.c
> index bab691c..ad93208 100644
> --- a/obexd/plugins/pbap.c
> +++ b/obexd/plugins/pbap.c
> @@ -543,13 +543,18 @@ static int pbap_get(struct obex_session *os, void *user_data)
>
>         } else if (g_ascii_strcasecmp(type, VCARDLISTING_TYPE) == 0) {
>                 /* Always relative */
> -               if (!name || strlen(name) == 0)
> +               if (!name || strlen(name) == 0) {
>                         /* Current folder */
>                         path = g_strdup(pbap->folder);
> -               else
> +               } else {
>                         /* Current folder + relative path */
>                         path = g_build_filename(pbap->folder, name, NULL);
>
> +                       /* clear cache */
> +                       pbap->cache.valid = FALSE;
> +                       pbap->cache.index = 0;
> +                       cache_clear(&pbap->cache);
> +               }
>         } else if (g_ascii_strcasecmp(type, VCARDENTRY_TYPE) == 0) {
>                 /* File name only */
>                 path = g_strdup(name);
> --
> 1.7.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Ping

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

* Re: [PATCH 1/1] obexd/pbap: clear cache if name header is present
  2016-06-30 14:06 [PATCH 1/1] obexd/pbap: clear cache if name header is present Biman Paul
  2016-09-01 17:37 ` Biman Paul
@ 2016-09-04  6:50 ` Biman Paul
  2016-09-05 12:17   ` Luiz Augusto von Dentz
  1 sibling, 1 reply; 4+ messages in thread
From: Biman Paul @ 2016-09-04  6:50 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Biman Paul



On Thursday 30 June 2016 07:36 PM, Biman Paul wrote:
> Remote device is not able to fetch call logs from different folder.
> It always returns the call logs requested in first request.
>
> Considering a situation to fetch from och and then from cch,
> there are two ways to request x-bt/vcard-listing:
> Case I:
> 1. SetPhoneBook to /telecom/och (absolute path)
> 2. PullvCardListing with name header '' (empty)
> Remote devices using this method always calls SetPhoneBook with absolute path
> to set the path and we clear the cache when new path is set.
> Case II:
> 1. SetPhoneBook to /telecom (relative path)
> 2. PullvCardListing with name header 'och'
> Remote devices using this method calls SetPhoneBook with '/telecom' only once
> and cache is not cleared when second PullvCardListing is made with name header.
> This results in cached incorrect list sent to remote device.
>
> Clear cache if name header is present would prevent sending of
> cache list as it is not present. Instead it would request to
> create new cache based on new name header.
> ---
>  obexd/plugins/pbap.c |    9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/obexd/plugins/pbap.c b/obexd/plugins/pbap.c
> index bab691c..ad93208 100644
> --- a/obexd/plugins/pbap.c
> +++ b/obexd/plugins/pbap.c
> @@ -543,13 +543,18 @@ static int pbap_get(struct obex_session *os, void *user_data)
>
>  	} else if (g_ascii_strcasecmp(type, VCARDLISTING_TYPE) == 0) {
>  		/* Always relative */
> -		if (!name || strlen(name) == 0)
> +		if (!name || strlen(name) == 0) {
>  			/* Current folder */
>  			path = g_strdup(pbap->folder);
> -		else
> +		} else {
>  			/* Current folder + relative path */
>  			path = g_build_filename(pbap->folder, name, NULL);
>
> +			/* clear cache */
> +			pbap->cache.valid = FALSE;
> +			pbap->cache.index = 0;
> +			cache_clear(&pbap->cache);
> +		}
>  	} else if (g_ascii_strcasecmp(type, VCARDENTRY_TYPE) == 0) {
>  		/* File name only */
>  		path = g_strdup(name);
>

Ping

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

* Re: [PATCH 1/1] obexd/pbap: clear cache if name header is present
  2016-09-04  6:50 ` Biman Paul
@ 2016-09-05 12:17   ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2016-09-05 12:17 UTC (permalink / raw)
  To: Biman Paul; +Cc: linux-bluetooth@vger.kernel.org, Biman Paul

Hi Paul,

On Sun, Sep 4, 2016 at 9:50 AM, Biman Paul <biman.innovative@gmail.com> wrote:
>
>
> On Thursday 30 June 2016 07:36 PM, Biman Paul wrote:
>>
>> Remote device is not able to fetch call logs from different folder.
>> It always returns the call logs requested in first request.
>>
>> Considering a situation to fetch from och and then from cch,
>> there are two ways to request x-bt/vcard-listing:
>> Case I:
>> 1. SetPhoneBook to /telecom/och (absolute path)
>> 2. PullvCardListing with name header '' (empty)
>> Remote devices using this method always calls SetPhoneBook with absolute
>> path
>> to set the path and we clear the cache when new path is set.
>> Case II:
>> 1. SetPhoneBook to /telecom (relative path)
>> 2. PullvCardListing with name header 'och'
>> Remote devices using this method calls SetPhoneBook with '/telecom' only
>> once
>> and cache is not cleared when second PullvCardListing is made with name
>> header.
>> This results in cached incorrect list sent to remote device.
>>
>> Clear cache if name header is present would prevent sending of
>> cache list as it is not present. Instead it would request to
>> create new cache based on new name header.
>> ---
>>  obexd/plugins/pbap.c |    9 +++++++--
>>  1 file changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/obexd/plugins/pbap.c b/obexd/plugins/pbap.c
>> index bab691c..ad93208 100644
>> --- a/obexd/plugins/pbap.c
>> +++ b/obexd/plugins/pbap.c
>> @@ -543,13 +543,18 @@ static int pbap_get(struct obex_session *os, void
>> *user_data)
>>
>>         } else if (g_ascii_strcasecmp(type, VCARDLISTING_TYPE) == 0) {
>>                 /* Always relative */
>> -               if (!name || strlen(name) == 0)
>> +               if (!name || strlen(name) == 0) {
>>                         /* Current folder */
>>                         path = g_strdup(pbap->folder);
>> -               else
>> +               } else {
>>                         /* Current folder + relative path */
>>                         path = g_build_filename(pbap->folder, name, NULL);
>>
>> +                       /* clear cache */
>> +                       pbap->cache.valid = FALSE;
>> +                       pbap->cache.index = 0;
>> +                       cache_clear(&pbap->cache);
>> +               }
>>         } else if (g_ascii_strcasecmp(type, VCARDENTRY_TYPE) == 0) {
>>                 /* File name only */
>>                 path = g_strdup(name);
>>
>
> Ping

Applied, thanks.

-- 
Luiz Augusto von Dentz

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

end of thread, other threads:[~2016-09-05 12:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-30 14:06 [PATCH 1/1] obexd/pbap: clear cache if name header is present Biman Paul
2016-09-01 17:37 ` Biman Paul
2016-09-04  6:50 ` Biman Paul
2016-09-05 12:17   ` Luiz Augusto von Dentz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).