This is a multi-part message in MIME format.
------_=_NextPart_001_01CBA7B8.A7EC1D62 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
I created a function to support conversion from DER BitString encoded data to RFC4517 Bit String Format.
I tested it alone and it seems to work fine with normal and abnormal situations.
=20
I also wrote a proposal to the call that must be included at ldap_X509dn2bv() function.
=20
First comes the conversion function and after comes the proposal.
=20
=20
/*****************************************************/
=20
#define BITS_PER_BYTE 8
#define SQUOTE_LENGTH 1
#define B_CHAR_LENGTH 1
#define STR_OVERHEAD (2*SQUOTE_LENGTH + B_CHAR_LENGTH)
=20
int ldap_der_to_rfc4517_BitString (struct berval *berValue,
struct berval *rfc4517Value) {
ber_len_t bitPadding=3D0;
ber_len_t bits, maxBits;
char *tmpStr;
unsigned char byte;
ber_len_t bitLength;
ber_len_t valLen;
unsigned char* valPtr;
=20
rfc4517Value->bv_len=3D0;
rfc4517Value->bv_val=3DNULL;
=20
/* Gets padding and points to binary data */
valLen=3DberValue->bv_len;
valPtr=3D(unsigned char*)berValue->bv_val;
if (valLen) {
bitPadding=3D(ber_len_t)(valPtr[0]);
valLen--;
valPtr++;
}
/* If Block is non DER encoding fixes to DER encoding */
if (bitPadding >=3D BITS_PER_BYTE) {
if (valLen*BITS_PER_BYTE > bitPadding ) {
valLen-=3D(bitPadding/BITS_PER_BYTE);
bitPadding%=3DBITS_PER_BYTE;
} else {
valLen=3D0;
bitPadding=3D0;
}
}
/* Just in case bad encoding */
if (valLen*BITS_PER_BYTE < bitPadding ) {
bitPadding=3D0;
valLen=3D0;
}
=20
/* Gets buffer to hold RFC4517 Bit String format */
bitLength=3DvalLen*BITS_PER_BYTE-bitPadding;
tmpStr=3DLDAP_MALLOC(bitLength + STR_OVERHEAD + 1);
=20
if (!tmpStr)
return LDAP_NO_MEMORY;
=20
rfc4517Value->bv_val=3DtmpStr;
rfc4517Value->bv_len=3DbitLength + STR_OVERHEAD;
=20
/* Formatting in '*binary-digit'B format */
maxBits=3DBITS_PER_BYTE;
*tmpStr=3D''';
tmpStr++;
while(valLen) {
byte=3D*valPtr;
if (valLen=3D=3D1)
maxBits-=3DbitPadding;
for (bits=3D0; bits<maxBits; bits++) {
if (0x80 & byte)
*tmpStr=3D'1';
else
*tmpStr=3D'0';
tmpStr++;
byte<<=3D1;
}
valPtr++;
valLen--;
}
*tmpStr=3D''';
tmpStr++;
*tmpStr=3D'B';
tmpStr++;
*tmpStr=3D0;
=20
return LDAP_SUCCESS;
}
=20
=20
/*****************************************************/
/*****************************************************/
=20
=20
/*
* Other tags found in AVAs (X.520)
*/
#define LBER_TAG_BITSTRING ((ber_tag_t) 0x03UL)
=20
=20
ldap_X509dn2bv function updated:
=20
switch(tag) {
case LBER_TAG_UNIVERSAL:
/* This uses 32-bit ISO 10646-1 */
csize =3D 4; goto to_utf8;
case LBER_TAG_BMP:
/* This uses 16-bit ISO 10646-1 */
csize =3D 2; goto to_utf8;
case LBER_TAG_BITSTRING:
/* X.690 bitString value converted to RFC4517 Bit String */
rc =3D ldap_der_to_rfc4517_BitString( &Val, &newAVA->la_value );
goto after_utf8;
case LBER_TAG_TELETEX:
/* This uses 8-bit, assume ISO 8859-1 */
csize =3D 1;
to_utf8: rc =3D ldap_ucs_to_utf8s( &Val, csize, &newAVA->la_value );
after_utf8: newAVA->la_flags |=3D LDAP_AVA_FREE_VALUE;
if (rc !=3D LDAP_SUCCESS) goto nomem;
newAVA->la_flags =3D LDAP_AVA_NONPRINTABLE;
break;
case LBER_TAG_UTF8:
newAVA->la_flags =3D LDAP_AVA_NONPRINTABLE;
/* This is already in UTF-8 encoding */
case LBER_TAG_IA5:
case LBER_TAG_PRINTABLE:
/* These are always 7-bit strings */
newAVA->la_value =3D Val;
default:
;
}
=20
------_=_NextPart_001_01CBA7B8.A7EC1D62 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
<html xmlns:v=3D"urn:schemas-microsoft-com:vml" = xmlns:o=3D"urn:schemas-microsoft-com:office:office" = xmlns:w=3D"urn:schemas-microsoft-com:office:word" = xmlns:x=3D"urn:schemas-microsoft-com:office:excel" = xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" = xmlns=3D"http://www.w3.org/TR/REC-html40%22%3E<head><meta = http-equiv=3DContent-Type content=3D"text/html; = charset=3Dus-ascii"><meta name=3DGenerator content=3D"Microsoft Word 12 = (filtered medium)"><style><!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4;} @font-face {font-family:Tahoma; panose-1:2 11 6 4 3 5 4 4 2 4;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm; margin-bottom:.0001pt; font-size:11.0pt; font-family:"Calibri","sans-serif";} a:link, span.MsoHyperlink {mso-style-priority:99; color:blue; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {mso-style-priority:99; color:purple; text-decoration:underline;} p.MsoAcetate, li.MsoAcetate, div.MsoAcetate {mso-style-priority:99; mso-style-link:"Balloon Text Char"; margin:0cm; margin-bottom:.0001pt; font-size:8.0pt; font-family:"Tahoma","sans-serif";} span.EmailStyle17 {mso-style-type:personal-compose; font-family:"Calibri","sans-serif"; color:windowtext;} span.BalloonTextChar {mso-style-name:"Balloon Text Char"; mso-style-priority:99; mso-style-link:"Balloon Text"; font-family:"Tahoma","sans-serif";} .MsoChpDefault {mso-style-type:export-only;} @page WordSection1 {size:612.0pt 792.0pt; margin:70.85pt 3.0cm 70.85pt 3.0cm;} div.WordSection1 {page:WordSection1;} --></style><!--[if gte mso 9]><xml> <o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" /> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext=3D"edit"> <o:idmap v:ext=3D"edit" data=3D"1" /> </o:shapelayout></xml><![endif]--></head><body lang=3DES-MX link=3Dblue = vlink=3Dpurple><div class=3DWordSection1><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier New"'>I created a function to = support conversion from DER BitString encoded data to RFC4517 Bit String = Format.<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier New"'>I tested it alone and it seems to = work fine with normal and abnormal situations.<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'><o:p> </o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier New"'>I also wrote a proposal = to the call that must be included at ldap_X509dn2bv() = function.<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier New"'><o:p> </o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'>First comes the conversion function and after comes the = proposal.<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier New"'><o:p> </o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'><o:p> </o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier = New"'>/*****************************************************/<o:p></o:p><= /span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier New"'><o:p> </o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'>#define BITS_PER_BYTE = 8<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier New"'>#define = SQUOTE_LENGTH 1<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'>#define B_CHAR_LENGTH = 1<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier New"'>#define = STR_OVERHEAD (2*SQUOTE_LENGTH + = B_CHAR_LENGTH)<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier = New"'><o:p> </o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier New"'>int = ldap_der_to_rfc4517_BitString (struct berval = *berValue,<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier = New"'> = &= nbsp; &n= bsp; struct berval *rfc4517Value) = { = &= nbsp; <o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'>ber_len_t bitPadding=3D0;<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'>ber_len_t bits, maxBits;<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'>char *tmpStr;<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier New"'>unsigned char = byte;<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier New"'>ber_len_t = bitLength;<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier New"'>ber_len_t = valLen;<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier New"'>unsigned char* = valPtr;<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier New"'><o:p> </o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> rfc4517Value->bv_len=3D0;<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> = rfc4517Value->bv_val=3DNULL;<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'><o:p> </o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier New"'> /* Gets = padding and points to binary data */<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> valLen=3DberValue->bv_len;<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> valPtr=3D(unsigned = char*)berValue->bv_val;<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> if (valLen) {<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> = bitPadding=3D(ber_len_t)(valPtr[0]);<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> valLen--;<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> valPtr++;<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> }<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier New"'> /* If = Block is non DER encoding fixes to DER encoding = */<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier New"'> if (bitPadding >=3D = BITS_PER_BYTE) {<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier = New"'> if (valLen*BITS_PER_BYTE > = bitPadding ) {<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier = New"'> = valLen-=3D(bitPadding/BITS_PER_BYTE);<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> = bitPadding%=3DBITS_PER_BYTE;<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> } else {<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> = valLen=3D0;<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier = New"'> = bitPadding=3D0;<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier = New"'> }<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> }<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier New"'> /* Just in = case bad encoding */<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier New"'> if = (valLen*BITS_PER_BYTE < bitPadding ) {<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> = bitPadding=3D0;<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier = New"'> valLen=3D0;<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> }<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier = New"'><o:p> </o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier New"'> /* Gets = buffer to hold RFC4517 Bit String format */<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> = bitLength=3DvalLen*BITS_PER_BYTE-bitPadding;<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> tmpStr=3DLDAP_MALLOC(bitLength + STR_OVERHEAD + = 1);<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier New"'> = <o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier New"'> if = (!tmpStr)<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier New"'> = return LDAP_NO_MEMORY;<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier = New"'><o:p> </o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier New"'> = rfc4517Value->bv_val=3DtmpStr;<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> rfc4517Value->bv_len=3DbitLength + = STR_OVERHEAD;<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier = New"'><o:p> </o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier New"'> /* = Formatting in '*binary-digit'B format */<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> maxBits=3DBITS_PER_BYTE;<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> *tmpStr=3D''';<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> tmpStr++;<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> while(valLen) {<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> = byte=3D*valPtr;<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier = New"'> if = (valLen=3D=3D1)<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier = New"'> = maxBits-=3DbitPadding;<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier = New"'> for (bits=3D0; bits<maxBits; = bits++) {<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier = New"'> if (0x80 & = byte)<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier = New"'> = *tmpStr=3D'1';<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier = New"'> = else<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier = New"'> = *tmpStr=3D'0';<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier = New"'> = tmpStr++;<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier = New"'> = byte<<=3D1;<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier = New"'> }<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> valPtr++;<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> valLen--;<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> }<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier New"'> = *tmpStr=3D''';<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier New"'> = tmpStr++;<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier New"'> = *tmpStr=3D'B';<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier New"'> = tmpStr++;<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier New"'> = *tmpStr=3D0;<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier = New"'><o:p> </o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier New"'> return = LDAP_SUCCESS;<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier = New"'>}<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier New"'><o:p> </o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'><o:p> </o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier = New"'>/*****************************************************/<o:p></o:p><= /span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier = New"'>/*****************************************************/<o:p></o:p><= /span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier New"'><o:p> </o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'><o:p> </o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier = New";color:red'>/*<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier New";color:red'> * Other tags = found in AVAs (X.520)<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier New";color:red'> = */<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier New";color:red'>#define = LBER_TAG_BITSTRING ((ber_tag_t) = 0x03UL)<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier New"'><o:p> </o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'><o:p> </o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier New"'>ldap_X509dn2bv function = updated:<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier New"'><o:p> </o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> &= nbsp; switch(tag) {<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> &= nbsp; case LBER_TAG_UNIVERSAL:<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> &= nbsp; /* This uses = 32-bit ISO 10646-1 */<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier = New"'> &= nbsp; csize =3D 4; goto = to_utf8;<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier = New"'> &= nbsp; case LBER_TAG_BMP:<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> &= nbsp; /* This uses = 16-bit ISO 10646-1 */<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier = New"'> &= nbsp; csize =3D 2; goto = to_utf8;<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier = New";color:red'> &nb= sp; case = LBER_TAG_BITSTRING:<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier = New";color:red'> &nb= sp; /* X.690 = bitString value converted to RFC4517 Bit String = */<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier = New";color:red'> &nb= sp; rc =3D = ldap_der_to_rfc4517_BitString( &Val, &newAVA->la_value = );<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier = New";color:red'> &nb= sp; goto = after_utf8;<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier = New"'> &= nbsp; case LBER_TAG_TELETEX:<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> &= nbsp; /* This uses = 8-bit, assume ISO 8859-1 */<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> &= nbsp; csize =3D = 1;<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier = New"'>to_utf8:  = ; rc =3D ldap_ucs_to_utf8s( &Val, csize, = &newAVA->la_value );<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New";color:red'>after_utf8:</span><span lang=3DEN-US = style=3D'font-family:"Courier = New"'> = newAVA->la_flags |=3D LDAP_AVA_FREE_VALUE;<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> &= nbsp; if (rc !=3D = LDAP_SUCCESS) goto nomem;<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> &= nbsp; </span><span = style=3D'font-family:"Courier New"'>newAVA->la_flags =3D = LDAP_AVA_NONPRINTABLE;<o:p></o:p></span></p><p class=3DMsoNormal><span = style=3D'font-family:"Courier = New"'> &= nbsp; </span><span = lang=3DEN-US style=3D'font-family:"Courier = New"'>break;<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier = New"'> &= nbsp; case LBER_TAG_UTF8:<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> &= nbsp; </span><span = style=3D'font-family:"Courier New"'>newAVA->la_flags =3D = LDAP_AVA_NONPRINTABLE;<o:p></o:p></span></p><p class=3DMsoNormal><span = style=3D'font-family:"Courier = New"'> &= nbsp; </span><span = lang=3DEN-US style=3D'font-family:"Courier New"'>/* This is already in = UTF-8 encoding */<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier = New"'> &= nbsp; case LBER_TAG_IA5:<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> &= nbsp; case LBER_TAG_PRINTABLE:<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US style=3D'font-family:"Courier = New"'> &= nbsp; /* These are = always 7-bit strings */<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US style=3D'font-family:"Courier = New"'> &= nbsp; </span><span = style=3D'font-family:"Courier New"'>newAVA->la_value =3D = Val;<o:p></o:p></span></p><p class=3DMsoNormal><span = style=3D'font-family:"Courier = New"'> &= nbsp; default:<o:p></o:p></span></p><p = class=3DMsoNormal><span style=3D'font-family:"Courier = New"'> &= nbsp; </span><span = lang=3DEN-US style=3D'font-family:"Courier = New"'>;<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US = style=3D'font-family:"Courier = New"'> &= nbsp; }<o:p></o:p></span></p><p = class=3DMsoNormal><span = lang=3DEN-US><o:p> </o:p></span></p></div></body></html> ------_=_NextPart_001_01CBA7B8.A7EC1D62--