Linux bluetooth development
 help / color / mirror / Atom feed
From: Rafal Michalski <michalski.raf@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Rafal Michalski <michalski.raf@gmail.com>
Subject: [PATCH obexd] Fix pulling single vCard for parameters header missing
Date: Thu, 20 Oct 2011 10:34:48 +0200	[thread overview]
Message-ID: <1319099688-4427-1-git-send-email-michalski.raf@gmail.com> (raw)

According to PBAP specification (ANNEX A), all application-parameters
are optional in case of pulling single vCard entry, so header for
application-parameters can be omitted, and it would be valid as well.
Previously pulling single vCard was always failing with "Bad Request"
status in such a circumstance.
This patch fixes that issue and pulling single vCard is done successfully
with "OK" status. Output vCard would contain all fields under 2.1 format
(as for default settings).
---
 plugins/pbap.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/plugins/pbap.c b/plugins/pbap.c
index a03f07c..066e37e 100644
--- a/plugins/pbap.c
+++ b/plugins/pbap.c
@@ -643,8 +643,12 @@ static int pbap_get(struct obex_session *os, obex_object_t *obj,
 		return -EBADR;
 
 	rsize = obex_aparam_read(os, obj, &buffer);
-	if (rsize < 0)
-		return -EBADR;
+	if (rsize < 0) {
+		if (g_ascii_strcasecmp(type, VCARDENTRY_TYPE) != 0)
+			return -EBADR;
+
+		rsize = 0;
+	}
 
 	params = parse_aparam(buffer, rsize);
 	if (params == NULL)
-- 
1.6.3.3


             reply	other threads:[~2011-10-20  8:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-20  8:34 Rafal Michalski [this message]
2011-10-20 10:18 ` [PATCH obexd] Fix pulling single vCard for parameters header missing Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1319099688-4427-1-git-send-email-michalski.raf@gmail.com \
    --to=michalski.raf@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox