summaryrefslogtreecommitdiff
path: root/librpc
diff options
context:
space:
mode:
authorDavid Disseldorp <ddiss@samba.org>2014-03-24 16:46:10 +0100
committerJeremy Allison <jra@samba.org>2014-03-24 21:46:39 +0100
commit95d9f163625b99687fc996edd829373034941dd9 (patch)
tree33fe86c1e8bb2cae178a9472c0bcd967db3beeff /librpc
parent5ccecec3ca5068f39194a1472ae492c06cf3213a (diff)
downloadsamba-95d9f163625b99687fc996edd829373034941dd9.tar.gz
librpc: inline CHECK_SYNTAX macro logic
The CHECK_SYNTAX macro is currently used to compare ndr_syntax_ids and return false on mismatch. Macros affecting control flow are evil! Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Mon Mar 24 21:46:39 CET 2014 on sn-devel-104
Diffstat (limited to 'librpc')
-rw-r--r--librpc/rpc/dcerpc_util.c51
1 files changed, 31 insertions, 20 deletions
diff --git a/librpc/rpc/dcerpc_util.c b/librpc/rpc/dcerpc_util.c
index 416e8b56dad..a4dd56986ae 100644
--- a/librpc/rpc/dcerpc_util.c
+++ b/librpc/rpc/dcerpc_util.c
@@ -513,19 +513,6 @@ done:
return ret;
}
-#define CHECK_SYNTAX(msg, s1, s2) \
-do { \
- if (!ndr_syntax_id_equal(&s1, &s2)) { \
- TALLOC_CTX *frame = talloc_stackframe(); \
- DEBUG(10, ("SEC_VT check %s failed: %s vs. %s\n", msg, \
- ndr_syntax_id_to_string(frame, &s1), \
- ndr_syntax_id_to_string(frame, &s2))); \
- TALLOC_FREE(frame); \
- return false; \
- } \
-} while(0)
-
-
static bool dcerpc_sec_vt_bitmask_check(const uint32_t *bitmask1,
struct dcerpc_sec_vt *c)
{
@@ -551,6 +538,9 @@ static bool dcerpc_sec_vt_bitmask_check(const uint32_t *bitmask1,
static bool dcerpc_sec_vt_pctx_check(const struct dcerpc_sec_vt_pcontext *pcontext,
struct dcerpc_sec_vt *c)
{
+ TALLOC_CTX *mem_ctx;
+ bool ok;
+
if (pcontext == NULL) {
if (c->command & DCERPC_SEC_VT_MUST_PROCESS) {
DEBUG(10, ("SEC_VT check Pcontext must_process_command "
@@ -561,13 +551,34 @@ static bool dcerpc_sec_vt_pctx_check(const struct dcerpc_sec_vt_pcontext *pconte
return true;
}
- CHECK_SYNTAX("Pcontect abstract_syntax",
- pcontext->abstract_syntax,
- c->u.pcontext.abstract_syntax);
- CHECK_SYNTAX("Pcontext transfer_syntax",
- pcontext->transfer_syntax,
- c->u.pcontext.transfer_syntax);
- return true;
+ mem_ctx = talloc_stackframe();
+ ok = ndr_syntax_id_equal(&pcontext->abstract_syntax,
+ &c->u.pcontext.abstract_syntax);
+ if (!ok) {
+ DEBUG(10, ("SEC_VT check pcontext abstract_syntax failed: "
+ "%s vs. %s\n",
+ ndr_syntax_id_to_string(mem_ctx,
+ &pcontext->abstract_syntax),
+ ndr_syntax_id_to_string(mem_ctx,
+ &c->u.pcontext.abstract_syntax)));
+ goto err_ctx_free;
+ }
+ ok = ndr_syntax_id_equal(&pcontext->transfer_syntax,
+ &c->u.pcontext.transfer_syntax);
+ if (!ok) {
+ DEBUG(10, ("SEC_VT check pcontext transfer_syntax failed: "
+ "%s vs. %s\n",
+ ndr_syntax_id_to_string(mem_ctx,
+ &pcontext->transfer_syntax),
+ ndr_syntax_id_to_string(mem_ctx,
+ &c->u.pcontext.transfer_syntax)));
+ goto err_ctx_free;
+ }
+
+ ok = true;
+err_ctx_free:
+ talloc_free(mem_ctx);
+ return ok;
}
static bool dcerpc_sec_vt_hdr2_check(const struct dcerpc_sec_vt_header2 *header2,