diff options
author | Michael Adam <obnox@samba.org> | 2011-03-09 00:56:25 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2011-03-14 13:35:49 +0100 |
commit | 77d4d156d3948182f23b683d6f9953bfed3435e1 (patch) | |
tree | 943b5e7674fd4523f1befa30fcec936aeb52dcdf | |
parent | a5cb53774561b367866703ce08dea298dfa9ec43 (diff) | |
download | samba-77d4d156d3948182f23b683d6f9953bfed3435e1.tar.gz samba-77d4d156d3948182f23b683d6f9953bfed3435e1.tar.xz samba-77d4d156d3948182f23b683d6f9953bfed3435e1.zip |
control: add macro CHECK_CONTROL_MIN_DATA_SIZE.
This is for the control dispatcher to check whether the input data has
a required minimum size.
(This used to be ctdb commit 2038e745db33cc5c3b4e2db8a00a57ede03906a2)
-rw-r--r-- | ctdb/include/ctdb_private.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h index f960e205ee..ede1df8552 100644 --- a/ctdb/include/ctdb_private.h +++ b/ctdb/include/ctdb_private.h @@ -842,6 +842,14 @@ ctdb_control_send(struct ctdb_context *ctdb, } \ } while (0) +#define CHECK_CONTROL_MIN_DATA_SIZE(size) do { \ + if (indata.dsize < size) { \ + DEBUG(0,(__location__ " Invalid data size in opcode %u. Got %u expected >= %u\n", \ + opcode, (unsigned)indata.dsize, (unsigned)size)); \ + return -1; \ + } \ + } while (0) + int ctdb_control_getvnnmap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indata, TDB_DATA *outdata); int ctdb_control_setvnnmap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indata, TDB_DATA *outdata); int ctdb_control_getdbmap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indata, TDB_DATA *outdata); |