librpc: add dcerpc_get_auth_length() helper function
authorStefan Metzmacher <metze@samba.org>
Wed, 31 Oct 2018 15:44:11 +0000 (16:44 +0100)
committerJeremy Allison <jra@samba.org>
Sat, 12 Jan 2019 02:13:31 +0000 (03:13 +0100)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
librpc/rpc/dcerpc_util.c
librpc/rpc/rpc_common.h

index 0808131..6cd3e38 100644 (file)
@@ -59,6 +59,15 @@ void dcerpc_set_auth_length(DATA_BLOB *blob, uint16_t v)
        }
 }
 
+uint16_t dcerpc_get_auth_length(const DATA_BLOB *blob)
+{
+       if (CVAL(blob->data,DCERPC_DREP_OFFSET) & DCERPC_DREP_LE) {
+               return SVAL(blob->data, DCERPC_AUTH_LEN_OFFSET);
+       } else {
+               return RSVAL(blob->data, DCERPC_AUTH_LEN_OFFSET);
+       }
+}
+
 uint8_t dcerpc_get_endian_flag(DATA_BLOB *blob)
 {
        return blob->data[DCERPC_DREP_OFFSET];
index cdc9fe8..d5b5d59 100644 (file)
@@ -168,6 +168,7 @@ enum dcerpc_transport_t dcerpc_transport_by_tower(const struct epm_tower *tower)
 void dcerpc_set_frag_length(DATA_BLOB *blob, uint16_t v);
 uint16_t dcerpc_get_frag_length(const DATA_BLOB *blob);
 void dcerpc_set_auth_length(DATA_BLOB *blob, uint16_t v);
+uint16_t dcerpc_get_auth_length(const DATA_BLOB *blob);
 uint8_t dcerpc_get_endian_flag(DATA_BLOB *blob);
 const char *dcerpc_default_transport_endpoint(TALLOC_CTX *mem_ctx,
                                              enum dcerpc_transport_t transport,