1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

ctdb-protocol: Fix marshalling for ctdb_event_request_status

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
This commit is contained in:
Amitay Isaacs 2017-07-27 01:33:45 +10:00 committed by Martin Schwenke
parent 67174ebfd9
commit 98715abef3
2 changed files with 14 additions and 5 deletions

View File

@ -317,7 +317,7 @@ static size_t ctdb_event_request_status_len(
static void ctdb_event_request_status_push(
struct ctdb_event_request_status *in,
uint8_t *buf)
uint8_t *buf, size_t *npush)
{
size_t offset = 0, np;
@ -325,12 +325,16 @@ static void ctdb_event_request_status_push(
offset += np;
ctdb_event_status_state_push(in->state, buf+offset, &np);
offset += np;
*npush = offset;
}
static int ctdb_event_request_status_pull(
uint8_t *buf, size_t buflen,
TALLOC_CTX *mem_ctx,
struct ctdb_event_request_status **out)
struct ctdb_event_request_status **out,
size_t *npull)
{
struct ctdb_event_request_status *rdata;
size_t offset = 0, np;
@ -354,8 +358,10 @@ static int ctdb_event_request_status_pull(
talloc_free(rdata);
return ret;
}
offset += np;
*out = rdata;
*npull = offset;
return 0;
}
@ -483,7 +489,8 @@ static void ctdb_event_request_data_push(struct ctdb_event_request_data *in,
break;
case CTDB_EVENT_COMMAND_STATUS:
ctdb_event_request_status_push(in->data.status, buf+offset);
ctdb_event_request_status_push(in->data.status, buf+offset,
&np);
break;
case CTDB_EVENT_COMMAND_SCRIPT_LIST:
@ -527,7 +534,8 @@ static int ctdb_event_request_data_pull(uint8_t *buf, size_t buflen,
case CTDB_EVENT_COMMAND_STATUS:
ret = ctdb_event_request_status_pull(
buf+offset, buflen-offset,
mem_ctx, &out->data.status);
mem_ctx, &out->data.status,
&np);
break;
case CTDB_EVENT_COMMAND_SCRIPT_LIST:

View File

@ -262,7 +262,8 @@ static void test_ctdb_event_reply(void)
}
PROTOCOL_TYPE3_TEST(struct ctdb_event_request_run, ctdb_event_request_run);
DEFINE_TEST(struct ctdb_event_request_status, ctdb_event_request_status);
PROTOCOL_TYPE3_TEST(struct ctdb_event_request_status,
ctdb_event_request_status);
DEFINE_TEST(struct ctdb_event_request_script_enable,
ctdb_event_request_script_enable);
DEFINE_TEST(struct ctdb_event_request_script_disable,