OSDN Git Service

gobex: make connection id check less strict
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Fri, 11 Nov 2011 14:29:06 +0000 (16:29 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 4 Dec 2012 21:22:04 +0000 (22:22 +0100)
OBEX spec says:

  Only the first packet in the request needs to contain the Connection
  Id header...

  If a Connection Id header is received with an invalid connection
  identifier, it is recommended that the operation be rejected with the
  response code (0xD3) “Service Unavailable”.

Since not all requests packets need to contain Connection Id header we
should only try to validate it in case a header is received.

Reported by Hendrik Sattler <post@hendrik-sattler.de>

gobex/gobex.c

index 8a23485..7840304 100644 (file)
@@ -694,7 +694,7 @@ static gboolean check_connid(GObex *obex, GObexPacket *pkt)
 
        hdr = g_obex_packet_get_header(pkt, G_OBEX_HDR_CONNECTION);
        if (hdr == NULL)
-               return FALSE;
+               return TRUE;
 
        g_obex_header_get_uint32(hdr, &id);