[dovecot/core | refs/heads/master] 148519bd: lib-oauth2: Provide a unit test for the JSON response payload parser.

noreply at dovecot.org noreply at dovecot.org
Mon Mar 4 15:00:11 EET 2019


  Branch: refs/heads/master
  Home:   https://github.com/dovecot/core
  Commit: 148519bdf58d2c1cb14c4b513f5a647112b5add9
      https://github.com/dovecot/core/commit/148519bdf58d2c1cb14c4b513f5a647112b5add9
  Author: Stephan Bosch <stephan.bosch at dovecot.fi>
  Date:   2019-03-04 (Mon, 04 Mar 2019)

  Changed paths:
    M src/lib-oauth2/Makefile.am
    A src/lib-oauth2/test-oauth2-json.c

  Log Message:
  -----------
  lib-oauth2: Provide a unit test for the JSON response payload parser.

  Commit: ae9512110dd4df5015c4343bcf0695bc0fa84de1
      https://github.com/dovecot/core/commit/ae9512110dd4df5015c4343bcf0695bc0fa84de1
  Author: Stephan Bosch <stephan.bosch at dovecot.fi>
  Date:   2019-03-04 (Mon, 04 Mar 2019)

  Changed paths:
    M src/lib-oauth2/oauth2.c

  Log Message:
  -----------
  lib-oauth2: Fix assert panic occurring while skipping ignored object and array fields.

Fixed by using json_parse_skip(), rather than json_parse_skip_next(). The latter
is not suitable for skipping a value that is already partially parsed by
json_parse_next().

Panic was:

Panic: file json-parser.c: line 668 (json_parse_skip_next): assertion failed: (parser->state == JSON_STATE_OBJECT_COLON || parser->state == JSON_STATE_OBJECT_VALUE || parser->state == JSON_STATE_ARRAY_VALUE || parser->state == JSON_STATE_ARRAY_NEXT)

  Commit: c68a0ef1e39c7652f83300240a570f8c769d8fde
      https://github.com/dovecot/core/commit/c68a0ef1e39c7652f83300240a570f8c769d8fde
  Author: Stephan Bosch <stephan.bosch at dovecot.fi>
  Date:   2019-03-04 (Mon, 04 Mar 2019)

  Changed paths:
    M src/lib-oauth2/oauth2-introspect.c
    M src/lib-oauth2/oauth2-refresh.c
    M src/lib-oauth2/oauth2-token-validate.c
    M src/lib-oauth2/oauth2.c

  Log Message:
  -----------
  lib-oauth2: Fix asynchronous parsing of JSON response payload.

The problem was caused by the fact that req->field_name was reset in the
beginning of oauth2_parse_json(), which is continuously called when more payload
can be read from the input stream. This leads to corruption of the parser state
machine each time parsing is continued.

To fix this issue, the field_name is now reset only when the parsing commences.

  Commit: dbc7e7a2ddab526d358d9414f8b6911a7128caca
      https://github.com/dovecot/core/commit/dbc7e7a2ddab526d358d9414f8b6911a7128caca
  Author: Stephan Bosch <stephan.bosch at dovecot.fi>
  Date:   2019-03-04 (Mon, 04 Mar 2019)

  Changed paths:
    M src/lib/test-json-parser.c

  Log Message:
  -----------
  lib: json-parser: Add unit test on skipping various object member fields.

This both tests skipping fields based on their member key and based on their
value types; i.e., after calling json_parse_next() for the object member value.

  Commit: b8c1ea7f24fce8c841ca5f9170989504d1d87b11
      https://github.com/dovecot/core/commit/b8c1ea7f24fce8c841ca5f9170989504d1d87b11
  Author: Stephan Bosch <stephan.bosch at dovecot.fi>
  Date:   2019-03-04 (Mon, 04 Mar 2019)

  Changed paths:
    M src/lib/json-parser.c
    M src/lib/json-parser.h

  Log Message:
  -----------
  lib: json-parser: Add support for skipping a value that is already partially parsed.

Adds json_parse_skip(), which skips the remainder of the value parsed earlier by
json_parse_next(). This is needed when values need to be skipped by their value
type rather than their object member key.

  Patch: https://github.com/dovecot/core/compare/f3020c168385...148519bdf58d.patch


More information about the dovecot-cvs mailing list