From 6c28aa2a6a6799e609e72457f30d4225e597937d Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Tue, 2 Sep 2014 14:16:40 -0400 Subject: [PATCH] asn1 enums vs values --- asn1.h | 19 +++++++++++++++++++ smb.c | 15 ++++++++------- 2 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 asn1.h diff --git a/asn1.h b/asn1.h new file mode 100644 index 0000000..5df20da --- /dev/null +++ b/asn1.h @@ -0,0 +1,19 @@ +#ifndef __ASN1_H__ +#define __ASN1_H__ + +enum { + ASN1_BOOLEAN = 0x01, + ASN1_INTEGER = 0x02, + ASN1_BIT_STRING = 0x03, + ASN1_OCTECT_STRING = 0x04, + ASN1_NULL = 0x05, + ASN1_OID = 0x06, + ASN1_ENUMERATED = 0x0a, + ASN1_SET = 0x31, + ASN1_SEQUENCE = 0x30, + ASN1_APPLICATION = 0x60, + ASN1_CONTEXT = 0xa0 + +}; + +#endif diff --git a/smb.c b/smb.c index ddb0d1b..5dc7b5c 100644 --- a/smb.c +++ b/smb.c @@ -23,6 +23,7 @@ #include "prototypes.h" #include "smb.h" #include "smb.errors.h" +#include "asn1.h" static struct smb2_header_sync header; @@ -393,22 +394,22 @@ restart: switch(tag) { - case 0x30: // sequence - case 0x60: // application + case ASN1_SEQUENCE: // sequence + case ASN1_APPLICATION: // application while (offset < length) offset = scan_asn1(data, offset, length); break; - case 0xa0: - case 0xa1: - case 0xa2: - case 0xa3: + case ASN1_CONTEXT: + case ASN1_CONTEXT+1: + case ASN1_CONTEXT+2: + case ASN1_CONTEXT+3: // jump back to the start? //return scan_asn1(data, offset, length); goto restart; break; - case 0x06: // oid + case ASN1_OID: // oid if (len == 6 && memcmp(data + offset, kSPNEGO, 6) == 0) { //fprintf(stdout, "spnego!\n");