Closed michaelrsweet closed 8 months ago
[master bf38abb60] Fix encoding of extension values (Issue #80)
Changes are basically to just pack the whole extension value as a binary string, and to make the ippGet/SetOctetString functions support reading/setting the value. You can't directly add an extension value, you need to first create an octetString and then set the value tag, e.g.:
ipp_attribute_t *attr = ippAddOctetString(ipp, IPP_TAG_..., "name", data, datalen);
ippSetValueTag(ipp, &attr, IPP_TAG_EXTENSION);
Copying the value also works.
Note: There are no known implementations that use extension values, so this is more to ensure that CUPS can handle them properly.
IPP_TAG_EXTENSION is used to indicate value tags greater than 127. While these have never seen usage in the wild (whether standards-based or for a vendor implementartion), the current CUPS code will incorrectly place the vendor tag outside the value, causing all sorts of problems. Instead, tag 0x7f should just be a binary value whose first four bytes make a big-endian integer holding the extension tag value.