Hi Amisha, On Wed, Oct 30, 2024 at 4:38 AM Amisha Jain <quic_amisjain@xxxxxxxxxxx> wrote: > > This change is required for passing below PTS testcases - > 1. PBAP/PSE/PBD/BV-02-C > 2. PBAP/PSE/PBD/BV-03-C > 3. PBAP/PSE/PBD/BI-01-C > 4. PBAP/PSE/PBD/BV-13-C > 5. PBAP/PSE/PBD/BV-14-C > 6. PBAP/PSE/PBD/BV-17-C > > For all the GET phonebook request sent by PTS has no extra params > added in it, therefore PBAP server is rejecting the request > by sending 'Bad Request' as response. > So appending few default params in GET request to avoid > testcase failure. > This params are already added for Vcardlisting and Vcardentry > operations. > > --- > obexd/plugins/pbap.c | 22 +++++++++++++++++++++- > 1 file changed, 21 insertions(+), 1 deletion(-) > > diff --git a/obexd/plugins/pbap.c b/obexd/plugins/pbap.c > index 4175f9de8..ae39d25b6 100644 > --- a/obexd/plugins/pbap.c > +++ b/obexd/plugins/pbap.c > @@ -511,7 +511,22 @@ static int pbap_get(struct obex_session *os, void *user_data) > rsize = 0; > } > > - /* Workaround for PTS client not sending mandatory apparams */ > + /* Workaround for PTS client not sending mandatory apparams > + * > + * Add MaxListCount attribute, description as per PBAP spec > + * > + * 5.1.4.3 MaxListCount : > + * This header is used to indicate the maximum number of > + * entries of the <x-bt/phonebook> object that the PCE > + * can handle. The value 65535 means that the number of > + * entries is not restricted. The maximum number of entries > + * shall be 65,535 if this header is not specified. > + * > + * 0x04 - Tag id > + * 0x02 - length > + * next 2 bytes are value - 0xffff > + * */ > + > if (!rsize && g_ascii_strcasecmp(type, VCARDLISTING_TYPE) == 0) { > static const uint8_t default_apparams[] = { > 0x04, 0x02, 0xff, 0xff > @@ -524,6 +539,11 @@ static int pbap_get(struct obex_session *os, void *user_data) > }; > buffer = default_apparams; > rsize = sizeof(default_apparams); > + } else if (!rsize && g_ascii_strcasecmp(type, PHONEBOOK_TYPE) == 0) { > + static const uint8_t default_apparams[] = { > + 0x04, 0x02, 0xff, 0xff }; > + buffer = default_apparams; > + rsize = sizeof(default_apparams); > } > > params = parse_aparam(buffer, rsize); > -- > 2.34.1 I'm thinking we should do this a little differently: https://gist.github.com/Vudentz/4fd0ec9cff098a0470869bc99264d7c0 We had already been setting params->maxlistcount: /* * As per spec when client doesn't include MAXLISTCOUNT_TAG then it * should be assume as Maximum value in vcardlisting 65535 */ param->maxlistcount = UINT16_MAX But this code didn't account for not having any header and then we introduced: commit bb27e5e1be7cbaac09aef5ff7a79f71a2ad8d113 Author: Hannu Mallat <hmallat@xxxxxxxxx> Date: Fri Jul 23 15:58:24 2021 +0200 obexd: phonebook: Set default apparams for PTS clients Some PTS clients do not send all the mandatory apparams when retrieving the phonebook. Clients such as car multimedia systems cannot be fixed, therefore working around this issue by inserting default apparams which makes these clients work as well. Looking in retrospect was the wrong call since we shouldn't need to fabricate the headers if PBAP says they are the default then it is parse_aparam that needs fixing so we just don't fail if there are no headers. Now the only thing I don't get is why we introduce the default to vCard 3.0 rather than vCard 2.1, or does PTS require that for some reason? -- Luiz Augusto von Dentz