obex: Resolve SRM issue for PTS testcases
authorAmisha Jain <quic_amisjain@quicinc.com>
Wed, 23 Oct 2024 07:14:48 +0000 (12:44 +0530)
committerWootak Jung <wootak.jung@samsung.com>
Thu, 20 Feb 2025 07:43:24 +0000 (16:43 +0900)
Add check for unknown/undefined srm value.

This fix is required to pass the below the PTS testcases :
1. OPP/SR/GOEP/SRM/BI-02-C
2. FTP/SR/GOEP/SRM/BI-02-C
3. PBAP/PSE/GOEP/SRM/BI-05-C

Description - Verify that the Server ignores a SRM header with an
invalid value in the PUT/GET request and carries on with the
PUT/GET operation with SRM disabled.

Current Behaviour - Server is sending SRM enable in the response even
though receiving the unknown SRM value.

To fix this, I have added the check to verify the valid SRM values
before continuing with SRM enable.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
gobex/gobex.c

index b8fcf2c1e15c5ddf1685891bcc728b663cddb5b3..f6f18f5c8f3adb61da1e006626b623576351dd0d 100644 (file)
@@ -317,6 +317,15 @@ static void set_srm(GObex *obex, guint8 op, guint8 srm)
        struct srm_config *config = obex->srm;
        gboolean enable;
 
+       switch (srm) {
+       case G_OBEX_SRM_ENABLE:
+       case G_OBEX_SRM_DISABLE:
+       case G_OBEX_SRM_INDICATE:
+               break;
+       default:
+               return;
+       }
+
        if (config == NULL) {
                if (srm == G_OBEX_SRM_DISABLE)
                        return;