odyssey/third_party/kiwi
Roman Khapov a7049a26d9
several fixes (#723)
* sources/hba_reader.c: fix list of keywords

It must contain {0,0,0} at the end.

Signed-off-by: rkhapov <r.khapov@ya.ru>

* context.c: fix warn

This patch fixes warnings about writing function
pointer into data pointer

Signed-off-by: rkhapov <r.khapov@ya.ru>

* sources/macro.h: fix warn

about signed vs unsiged comparison

Signed-off-by: rkhapov <r.khapov@ya.ru>

* sources/rules.c: remove unused func

Signed-off-by: rkhapov <r.khapov@ya.ru>

* sources/counter.c: fix warn

About memcpy to volatile variable

Signed-off-by: rkhapov <r.khapov@ya.ru>

* sources/rules.c: fix warn

And remove useless if's

Signed-off-by: rkhapov <r.khapov@ya.ru>

* sources/rules.c: remove unused var

Signed-off-by: rkhapov <r.khapov@ya.ru>

* sources/console.c: remove unused vars

Signed-off-by: rkhapov <r.khapov@ya.ru>

* sources/frontend.c: remove unsed var

Signed-off-by: rkhapov <r.khapov@ya.ru>

* sources/rules.c: fix warns

Signed-off-by: rkhapov <r.khapov@ya.ru>

* sources/backend.c: remove unused count

From functions od_backend_query*, count arg is not used

Signed-off-by: rkhapov <r.khapov@ya.ru>

* sources/odyssey.h: add backend_sync

To fix warn about implicit declaration of od_backend_request_sync_point

Signed-off-by: rkhapov <r.khapov@ya.ru>

* sources/address.c: fix implicit inet_pton

Signed-off-by: rkhapov <r.khapov@ya.ru>

* sources/address.c: fix warn

Signed-off-by: rkhapov <r.khapov@ya.ru>

* sources/clock.c: fix warn

Signed-off-by: rkhapov <r.khapov@ya.ru>

* sources/rules.c: fix uninitialized var

Signed-off-by: rkhapov <r.khapov@ya.ru>

* sources/frontend.c: fix warn

Signed-off-by: rkhapov <r.khapov@ya.ru>

* sources/scram.c: return instead of free

goto in this place will lead to free on unitialized ptr

Signed-off-by: rkhapov <r.khapov@ya.ru>

* sources/scram.c: fix warn

Case when size + 1 >= INT_MAX is extremely unlikely

Signed-off-by: rkhapov <r.khapov@ya.ru>

* test/odyssey: use test macro instead of assert

More informative + do not produce warnings

Signed-off-by: rkhapov <r.khapov@ya.ru>

* thread.c: fix warn about implicit func

Signed-off-by: rkhapov <r.khapov@ya.ru>

* docker/bin/ody-stop: SIGTERM wait

This is more useful for tests: will help to find out
if gracefully termination in odyssey doestn't work.

Signed-off-by: rkhapov <r.khapov@ya.ru>

* docker/Dockerfile: update libasan

This will possibly fix infinite DEADLYSIGNAL error

Signed-off-by: rkhapov <r.khapov@ya.ru>

* docker/entrypoint.sh: disable addr randomization

There is some bug with asan we currently using
This bug leads to infinite DEADLYSIGNAL message
on odyssey-asan runs sometimes

This patch adds some simple workaround about it

Signed-off-by: rkhapov <r.khapov@ya.ru>

* soureces/hba.c: fix reloading

It was broken, because it sets new rules list at the stack.

Signed-off-by: rkhapov <r.khapov@ya.ru>

* sources/rules.c: fix router closing

It should be closed after every usage.
This patch moves closing after every logging,
otherwise there will be use-after-free.

Signed-off-by: rkhapov <r.khapov@ya.ru>

---------

Signed-off-by: rkhapov <r.khapov@ya.ru>
Co-authored-by: rkhapov <r.khapov@ya.ru>
2024-12-10 00:41:45 +05:00
..
kiwi Add SHOW HELP; command (#669) 2024-08-17 13:17:02 +05:00
CMakeLists.txt change default compiler standart (#233) 2020-11-23 16:42:44 +05:00
README.md Add storage watchdog with standby lag polling support (#380) 2021-12-08 15:54:43 +05:00
kiwi.h several fixes (#723) 2024-12-10 00:41:45 +05:00

README.md

Kiwi

PostgreSQL protocol-level C library.

Library is designed to provide most of the functionality needed to write or read PostgreSQL protocol messages. Both Frontend (client to server) and Backend (server to client) messages are supported, making it possible to write client or server simulation applications.

No network part is supported. Only buffer management and packet validation.

Library is intedend to work in pair with the machinarium framework.

PostgreSQL packet readers

/* Read initial message (StartupMessage, CancelRequest, SSLRequest) */
kiwi_read_startup()

/* Read any other PostgreSQL packet */
kiwi_read()

FRONTEND

Write messages to Backend

/* StartupMessage */
kiwi_fe_write_startup_message()

/* CancelRequest */
kiwi_fe_write_cancel()

/* SSLRequest */
kiwi_fe_write_ssl_request()

/* Terminate */
kiwi_fe_write_terminate()

/* PasswordMessage */
kiwi_fe_write_password()

/* Query */
kiwi_fe_write_query()

/* Query for prep stmt */
kiwi_fe_write_prep_stmt()

/* Parse */
kiwi_fe_write_parse()

/* Bind */
kiwi_fe_write_bind()

/* Describe */
kiwi_fe_write_describe();

/* Execute */
kiwi_fe_write_execute();

/* Sync */
kiwi_fe_write_sync();

Read messages from Backend

/* ReadyForQuery */
kiwi_fe_read_ready();

/* BackendKeyData */
kiwi_fe_read_key();

/* Authentication messages */
kiwi_fe_read_auth();

/* ParameterStatus */
kiwi_fe_read_parameter();

/* ErrorResponse */
kiwi_fe_read_error();

BACKEND

Write messages to Frontend

/* ErrorResponse */
kiwi_be_write_error()
kiwi_be_write_error_fatal()
kiwi_be_write_error_panic()

/* NoticeResponse */
kiwi_be_write_notice()

/* AuthenticationOk */
kiwi_be_write_authentication_ok()

/* AuthenticationCleartextPassword */
kiwi_be_write_authentication_clear_text()

/* AuthenticationMD5Password */
kiwi_be_write_authentication_md5()

/* BackendKeyData */
kiwi_be_write_backend_key_data()

/* ParameterStatus */
kiwi_be_write_parameter_status()

/* EmptyQueryResponse */
kiwi_be_write_empty_query()

/* CommandComplete */
kiwi_be_write_complete()

/* ReadyForQuery */
kiwi_be_write_ready()

/* ParseComplete */
kiwi_be_write_parse_complete()

/* BindComplete */
kiwi_be_write_bind_complete()

/* PortalSuspended */
kiwi_be_write_portal_suspended()

/* NoData */
kiwi_be_write_no_data()

/* RowDescription */
kiwi_be_write_row_description()
kiwi_be_write_row_description_add()

/* DataRow */
kiwi_be_write_data_row()
kiwi_be_write_data_row_add()

Read messages from Frontend

/* Read StartupMessage, CancelRequest or SSLRequest */
kiwi_be_read_startup();

/* PasswordMessage */
kiwi_be_read_password();