diff options
author | Luke Leighton <lkcl@samba.org> | 1999-10-15 20:00:30 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1999-10-15 20:00:30 +0000 |
commit | 003f7364fd54ccdd190d447e275b70b0f76e95f7 (patch) | |
tree | 6e5813745c5aff1966dee4a575a9f9842b10000a /source3/include | |
parent | 65df690dcd78ce240e1e1789822e3d3f1c6ac36c (diff) | |
download | samba-003f7364fd54ccdd190d447e275b70b0f76e95f7.tar.gz samba-003f7364fd54ccdd190d447e275b70b0f76e95f7.tar.bz2 samba-003f7364fd54ccdd190d447e275b70b0f76e95f7.zip |
adding error checking in parsing code
(This used to be commit 4c98d71ebd3f1cdaef664d46c998c864af34632a)
Diffstat (limited to 'source3/include')
-rw-r--r-- | source3/include/ntdomain.h | 1 | ||||
-rw-r--r-- | source3/include/proto.h | 4 | ||||
-rw-r--r-- | source3/include/rpc_misc.h | 108 |
3 files changed, 91 insertions, 22 deletions
diff --git a/source3/include/ntdomain.h b/source3/include/ntdomain.h index 6f4e78d370..110901ec3e 100644 --- a/source3/include/ntdomain.h +++ b/source3/include/ntdomain.h @@ -57,6 +57,7 @@ typedef struct uint32 offset; /* offset currently being accessed in memory buffer */ uint8 align; /* data alignment */ BOOL io; /* parsing in or out of data stream */ + BOOL error; /* error occurred */ } prs_struct; diff --git a/source3/include/proto.h b/source3/include/proto.h index 18ce894582..57a81c9abf 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1806,7 +1806,7 @@ BOOL do_reg_open_hku(struct cli_state *cli, uint16 fnum, uint16 unknown_0, uint3 POLICY_HND *hnd); BOOL do_reg_flush_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd); BOOL do_reg_query_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, - char *class, uint32 *class_len, + char *key_class, uint32 *class_len, uint32 *num_subkeys, uint32 *max_subkeylen, uint32 *max_subkeysize, uint32 *num_values, uint32 *max_valnamelen, uint32 *max_valbufsize, @@ -2323,7 +2323,7 @@ BOOL make_reg_q_flush_key(REG_Q_FLUSH_KEY *q_u, POLICY_HND *pol); BOOL reg_io_q_flush_key(char *desc, REG_Q_FLUSH_KEY *r_q, prs_struct *ps, int depth); BOOL reg_io_r_flush_key(char *desc, REG_R_FLUSH_KEY *r_r, prs_struct *ps, int depth); BOOL make_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, - char *name, char *class, + char *key_name, char *key_class, SEC_ACCESS *sam_access, SEC_DESC_BUF *sec_buf, int sec_len, SEC_DESC *sec); diff --git a/source3/include/rpc_misc.h b/source3/include/rpc_misc.h index ae1e3bf7d8..ed8cbd96bb 100644 --- a/source3/include/rpc_misc.h +++ b/source3/include/rpc_misc.h @@ -28,39 +28,107 @@ * macros to wrap prs_xxxx routines. */ #define prs_uint8(name, ps, depth, data8) \ - if (!_prs_uint8(name, ps, depth, data8)) return False + if (!_prs_uint8(name, ps, depth, data8)) \ + {\ + ps->offset = 0;\ + return False;\ + } #define prs_uint16(name, ps, depth, data16) \ - if (!_prs_uint16(name, ps, depth, data16)) return False -#define prs_hash1(ps, offset, sess_key) \ - if (!_prs_hash1(ps, offset, sess_key)) return False + if (!_prs_uint16(name, ps, depth, data16)) \ + {\ + ps->offset = 0;\ + return False;\ + } +#define prs_hash1(x_ps, x_offset, x_sess_key) \ + if (!_prs_hash1(x_ps, x_offset, x_sess_key)) \ + {\ + x_ps->offset = 0;\ + return False;\ + } #define prs_uint32(name, ps, depth, data32) \ - if (!_prs_uint32(name, ps, depth, data32)) return False + if (!_prs_uint32(name, ps, depth, data32)) \ + {\ + ps->offset = 0;\ + return False;\ + } #define prs_uint8s(charmode, name, ps, depth, data8s, len) \ - if (!_prs_uint8s(charmode, name, ps, depth, data8s, len)) return False + if (!_prs_uint8s(charmode, name, ps, depth, data8s, len)) \ + {\ + ps->offset = 0;\ + return False;\ + } #define prs_uint16s(charmode, name, ps, depth, data16s, len) \ - if (!_prs_uint16s(charmode, name, ps, depth, data16s, len)) return False + if (!_prs_uint16s(charmode, name, ps, depth, data16s, len)) \ + {\ + ps->offset = 0;\ + return False;\ + } #define prs_uint32s(charmode, name, ps, depth, data32s, len) \ - if (!_prs_uint32s(charmode, name, ps, depth, data32s, len)) return False + if (!_prs_uint32s(charmode, name, ps, depth, data32s, len)) \ + {\ + ps->offset = 0;\ + return False;\ + } #define prs_buffer2(charmode, name, ps, depth, str) \ - if (!_prs_buffer2(charmode, name, ps, depth, str)) return False + if (!_prs_buffer2(charmode, name, ps, depth, str)) \ + {\ + ps->offset = 0;\ + return False;\ + } #define prs_string2(charmode, name, ps, depth, str) \ - if (!_prs_string2(charmode, name, ps, depth, str)) return False + if (!_prs_string2(charmode, name, ps, depth, str)) \ + {\ + ps->offset = 0;\ + return False;\ + } #define prs_unistr2(charmode, name, ps, depth, str) \ - if (!_prs_unistr2(charmode, name, ps, depth, str)) return False + if (!_prs_unistr2(charmode, name, ps, depth, str)) \ + {\ + ps->offset = 0;\ + return False;\ + } #define prs_unistr3(charmode, name, str, ps, depth) \ - if (!_prs_unistr3(charmode, name, str, ps, depth)) return False + if (!_prs_unistr3(charmode, name, str, ps, depth)) \ + {\ + ps->offset = 0;\ + return False;\ + } #define prs_unistr(name, ps, depth, str) \ - if (!_prs_unistr(name, ps, depth, str)) return False + if (!_prs_unistr(name, ps, depth, str)) \ + {\ + ps->offset = 0;\ + return False;\ + } #define prs_string(name, ps, depth, str, len, max_buf_size) \ - if (!_prs_string(name, ps, depth, str, len, max_buf_size)) return False -#define prs_uint16_pre(name, ps, depth, data16, offset) \ - if (!_prs_uint16_pre(name, ps, depth, data16, offset)) return False + if (!_prs_string(name, ps, depth, str, len, max_buf_size)) \ + {\ + ps->offset = 0;\ + return False;\ + } +#define prs_uint16_pre(x_name, x_ps, x_depth, x_data16, x_offset) \ + if (!_prs_uint16_pre(x_name, x_ps, x_depth, x_data16, x_offset)) \ + {\ + x_ps->offset = 0;\ + return False;\ + } #define prs_uint16_post(name, ps, depth, data16, ptr_uint16, data_size) \ - if (!_prs_uint16_post(name, ps, depth, data16, ptr_uint16, data_size)) return False -#define prs_uint32_pre(name, ps, depth, data32, offset) \ - if (!_prs_uint32_pre(name, ps, depth, data32, offset)) return False + if (!_prs_uint16_post(name, ps, depth, data16, ptr_uint16, data_size)) \ + {\ + ps->offset = 0;\ + return False;\ + } +#define prs_uint32_pre(x_name, x_ps, x_depth, x_data32, x_offset) \ + if (!_prs_uint32_pre(x_name, x_ps, x_depth, x_data32, x_offset)) \ + {\ + x_ps->offset = 0;\ + return False;\ + } #define prs_uint32_post(name, ps, depth, data32, ptr_uint32, data_size) \ - if (!_prs_uint32_post(name, ps, depth, data32, ptr_uint32, data_size)) return False + if (!_prs_uint32_post(name, ps, depth, data32, ptr_uint32, data_size)) \ + {\ + ps->offset = 0;\ + return False;\ + } #include "rpc_dce.h" |