/* Process a Licensing packet */ void licence_process(rdpLicence * licence, STREAM s) { uint8 tag; uint16 wMsgSize; uint8* license_start = s->p; /* Licensing Preamble */ in_uint8(s, tag); /* bMsgType */ in_uint8s(s, 1); /* Ignoring bVersion */ in_uint16_le(s, wMsgSize); /* Now pointing at LicensingMessage */ switch (tag) { case LICENSE_REQUEST: DEBUG("LICENSE_REQUEST\n"); licence_process_request(licence, s); ASSERT(s->p == license_start + wMsgSize); break; case LICENSE_PLATFORM_CHALLENGE: DEBUG("LICENCE PLATFORM_CHALLENGE\n"); licence_process_platform_challenge(licence, s); break; case NEW_LICENSE: DEBUG("NEW_LICENSE\n"); licence_process_new_license(licence, s); break; case UPGRADE_LICENSE: DEBUG("UPGRADE_LICENSE\n"); break; case LICENCE_ERROR_ALERT: DEBUG("LICENCE ERROR_ALERT - assuming it is a license grant\n"); { uint32 dwErrorCode, dwStateTransition; uint32 wBlobType, wBlobLen; in_uint32_le(s, dwErrorCode); in_uint32_le(s, dwStateTransition); DEBUG("dwErrorCode %x dwStateTransition %x\n", dwErrorCode, dwStateTransition); in_uint16_le(s, wBlobType); in_uint16_le(s, wBlobLen); DEBUG("bbErrorInfo: wBlobType %x wBlobLen %x\n", wBlobType, wBlobLen); /* hexdump(s->p, wBlobLen); */ } licence->licence_issued = True; /* TODO ... */ break; default: ui_unimpl(licence->sec->rdp->inst, "Unknown licence tag 0x%x\n", tag); } s->p = license_start + wMsgSize; /* FIXME: Shouldn't be necessary if parsed properly */ ASSERT(s->p <= s->end); }
/* Process a licence packet */ void licence_process(STREAM s) { uint8 tag; in_uint8(s, tag); in_uint8s(s, 3); /* version, length */ logger(Protocol, Debug, "license_process(), processing licensing PDU (message type 0x%02x)", tag); switch (tag) { case LICENCE_TAG_REQUEST: licence_process_request(s); break; case LICENCE_TAG_PLATFORM_CHALLENGE: licence_process_platform_challenge(s); break; case LICENCE_TAG_NEW_LICENCE: case LICENCE_TAG_UPGRADE_LICENCE: /* we can handle new and upgrades of licences the same way. */ licence_process_new_license(s); break; case LICENCE_TAG_ERROR_ALERT: licence_process_error_alert(s); break; default: logger(Protocol, Warning, "license_process(), unhandled license PDU tag 0x%02", tag); } }