mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
ctdb-protocol: Fix marshalling of ctdb_req_header
Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
This commit is contained in:
parent
2e14d4e4e3
commit
79d1507c16
@ -76,7 +76,9 @@ void ctdb_req_header_fill(struct ctdb_req_header *h, uint32_t generation,
|
||||
uint32_t operation, uint32_t destnode,
|
||||
uint32_t srcnode, uint32_t reqid);
|
||||
|
||||
int ctdb_req_header_pull(uint8_t *pkt, size_t pkt_len,
|
||||
size_t ctdb_req_header_len(struct ctdb_req_header *h);
|
||||
void ctdb_req_header_push(struct ctdb_req_header *h, uint8_t *buf);
|
||||
int ctdb_req_header_pull(uint8_t *buf, size_t buflen,
|
||||
struct ctdb_req_header *h);
|
||||
|
||||
int ctdb_req_header_verify(struct ctdb_req_header *h, uint32_t operation);
|
||||
|
@ -61,13 +61,23 @@ void ctdb_req_header_fill(struct ctdb_req_header *h, uint32_t generation,
|
||||
h->reqid = reqid;
|
||||
}
|
||||
|
||||
int ctdb_req_header_pull(uint8_t *pkt, size_t pkt_len,
|
||||
size_t ctdb_req_header_len(struct ctdb_req_header *h)
|
||||
{
|
||||
return sizeof(struct ctdb_req_header);
|
||||
}
|
||||
|
||||
void ctdb_req_header_push(struct ctdb_req_header *h, uint8_t *buf)
|
||||
{
|
||||
memcpy(buf, h, sizeof(struct ctdb_req_header));
|
||||
}
|
||||
|
||||
int ctdb_req_header_pull(uint8_t *buf, size_t buflen,
|
||||
struct ctdb_req_header *h)
|
||||
{
|
||||
if (pkt_len < sizeof(struct ctdb_req_header)) {
|
||||
if (buflen < sizeof(struct ctdb_req_header)) {
|
||||
return EMSGSIZE;
|
||||
}
|
||||
|
||||
memcpy(h, pkt, sizeof(struct ctdb_req_header));
|
||||
memcpy(h, buf, sizeof(struct ctdb_req_header));
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user