Author: metze Date: 2007-02-23 07:32:13 +0000 (Fri, 23 Feb 2007) New Revision: 21510
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=21510 Log: make it possible to push tags with length > 0xFFFFFF metze Modified: branches/SAMBA_4_0/source/libcli/util/asn1.c Changeset: Modified: branches/SAMBA_4_0/source/libcli/util/asn1.c =================================================================== --- branches/SAMBA_4_0/source/libcli/util/asn1.c 2007-02-22 23:12:36 UTC (rev 21509) +++ branches/SAMBA_4_0/source/libcli/util/asn1.c 2007-02-23 07:32:13 UTC (rev 21510) @@ -89,7 +89,18 @@ /* yes, this is ugly. We don't know in advance how many bytes the length of a tag will take, so we assumed 1 byte. If we were wrong then we need to correct our mistake */ - if (len > 0xFFFF) { + if (len > 0xFFFFFF) { + data->data[nesting->start] = 0x84; + if (!asn1_write_uint8(data, 0)) return False; + if (!asn1_write_uint8(data, 0)) return False; + if (!asn1_write_uint8(data, 0)) return False; + if (!asn1_write_uint8(data, 0)) return False; + memmove(data->data+nesting->start+5, data->data+nesting->start+1, len); + data->data[nesting->start+1] = (len>>24) & 0xFF; + data->data[nesting->start+2] = (len>>16) & 0xFF; + data->data[nesting->start+3] = (len>>8) & 0xFF; + data->data[nesting->start+4] = len&0xff; + } else if (len > 0xFFFF) { data->data[nesting->start] = 0x83; if (!asn1_write_uint8(data, 0)) return False; if (!asn1_write_uint8(data, 0)) return False;