a slew of AIX build fixes (bug fixes, for that matter)

This commit is contained in:
ian.mcgreer%sun.com 2001-10-15 15:01:59 +00:00
parent 7c087e8898
commit f9be08f9df

View File

@ -32,7 +32,7 @@
*/ */
#ifdef DEBUG #ifdef DEBUG
static const char CVS_ID[] = "@(#) $RCSfile: atav.c,v $ $Revision: 1.2 $ $Date: 2001/07/19 20:40:42 $ $Name: $"; static const char CVS_ID[] = "@(#) $RCSfile: atav.c,v $ $Revision: 1.3 $ $Date: 2001/10/15 15:01:59 $ $Name: $";
#endif /* DEBUG */ #endif /* DEBUG */
/* /*
@ -810,6 +810,7 @@ nss_attr_to_utf8
*stringForm = nssStringType_Unknown; /* force exact comparison */ *stringForm = nssStringType_Unknown; /* force exact comparison */
} else { } else {
PRStatus status;
rv = nssUTF8_CreateFromBER(arenaOpt, which->stringType, rv = nssUTF8_CreateFromBER(arenaOpt, which->stringType,
(NSSBER *)item); (NSSBER *)item);
@ -817,7 +818,8 @@ nss_attr_to_utf8
return (NSSUTF8 *)NULL; return (NSSUTF8 *)NULL;
} }
if( PR_SUCCESS != nssUTF8_Length(rv, &len) ) { len = nssUTF8_Length(rv, &status);
if( PR_SUCCESS != status || len == 0 ) {
nss_ZFreeIf(rv); nss_ZFreeIf(rv);
return (NSSUTF8 *)NULL; return (NSSUTF8 *)NULL;
} }
@ -1070,10 +1072,10 @@ nssATAV_CreateFromUTF8
} }
} else { } else {
for( i = 0; i < nss_attribute_type_alias_count; i++ ) { for( i = 0; i < nss_attribute_type_alias_count; i++ ) {
PRStatus status;
const nssAttributeTypeAliasTable *e = &nss_attribute_type_aliases[i]; const nssAttributeTypeAliasTable *e = &nss_attribute_type_aliases[i];
PRBool match = PR_FALSE; PRBool match = nssUTF8_CaseIgnoreMatch(type, e->alias, &status);
if( PR_SUCCESS != nssUTF8_CaseIgnoreMatch(type, e->alias, if( PR_SUCCESS != status ) {
&match) ) {
nss_ZFreeIf(type); nss_ZFreeIf(type);
return (NSSATAV *)NULL; return (NSSATAV *)NULL;
} }
@ -1105,6 +1107,7 @@ nssATAV_CreateFromUTF8
PRUint32 len; PRUint32 len;
PRUint8 *c; PRUint8 *c;
PRUint8 *d; PRUint8 *d;
PRStatus status;
/* It's in hex */ /* It's in hex */
value++; value++;
@ -1114,7 +1117,8 @@ nssATAV_CreateFromUTF8
return (NSSATAV *)NULL; return (NSSATAV *)NULL;
} }
if( PR_SUCCESS != nssUTF8_Size(value, &size) ) { size = nssUTF8_Size(value, &status);
if( PR_SUCCESS != status ) {
/* /*
* Only returns an error on bad pointer (nope) or string * Only returns an error on bad pointer (nope) or string
* too long. The defined limits for known attributes are * too long. The defined limits for known attributes are
@ -1151,6 +1155,7 @@ nssATAV_CreateFromUTF8
*c = 0; *c = 0;
} else { } else {
PRStatus status;
PRUint32 i, len; PRUint32 i, len;
PRUint8 *s; PRUint8 *s;
@ -1165,7 +1170,8 @@ nssATAV_CreateFromUTF8
return (NSSATAV *)NULL; return (NSSATAV *)NULL;
} }
if( PR_SUCCESS != nssUTF8_Size(rv->value, &len) ) { len = nssUTF8_Size(rv->value, &status);
if( PR_SUCCESS != status ) {
(void)nss_ZFreeIf(rv->value); (void)nss_ZFreeIf(rv->value);
(void)nss_ZFreeIf(rv); (void)nss_ZFreeIf(rv);
return (NSSATAV *)NULL; return (NSSATAV *)NULL;
@ -1229,8 +1235,8 @@ nssATAV_CreateFromUTF8
return (NSSATAV *)NULL; return (NSSATAV *)NULL;
} }
vitem = nssASN1_EncodeDER(a, (NSSDER *)NULL, &xitem, vitem = nssASN1_EncodeItem(a, (NSSDER *)NULL, &xitem,
nssASN1Template_OctetString); nssASN1Template_OctetString, NSSASN1DER);
if( (NSSItem *)NULL == vitem ) { if( (NSSItem *)NULL == vitem ) {
(void)NSSArena_Destroy(a); (void)NSSArena_Destroy(a);
(void)nss_ZFreeIf(rv->value); (void)nss_ZFreeIf(rv->value);
@ -1241,8 +1247,10 @@ nssATAV_CreateFromUTF8
rv->stringForm = nssStringType_Unknown; rv->stringForm = nssStringType_Unknown;
} else { } else {
PRUint32 length = 0; PRUint32 length = 0;
PRStatus stat;
if( PR_SUCCESS != nssUTF8_Length(rv->value, &length) ) { length = nssUTF8_Length(rv->value, &stat);
if( PR_SUCCESS != stat ) {
(void)NSSArena_Destroy(a); (void)NSSArena_Destroy(a);
(void)nss_ZFreeIf(rv->value); (void)nss_ZFreeIf(rv->value);
(void)nss_ZFreeIf(rv); (void)nss_ZFreeIf(rv);
@ -1278,8 +1286,8 @@ nssATAV_CreateFromUTF8
ah.oid = *oidder; ah.oid = *oidder;
ah.value = *vitem; ah.value = *vitem;
status = nssASN1_EncodeDER(arenaOpt, &rv->ber, &ah, status = nssASN1_EncodeItem(arenaOpt, &rv->ber, &ah,
nss_atav_template); nss_atav_template, NSSASN1DER);
if( (NSSDER *)NULL == status ) { if( (NSSDER *)NULL == status ) {
(void)NSSArena_Destroy(a); (void)NSSArena_Destroy(a);
@ -1479,6 +1487,7 @@ nssATAV_GetUTF8Encoding
PRUint32 oidlen; PRUint32 oidlen;
PRUint32 valuelen; PRUint32 valuelen;
PRUint32 totallen; PRUint32 totallen;
PRStatus status;
#ifdef NSSDEBUG #ifdef NSSDEBUG
if( PR_SUCCESS != nssATAV_verifyPointer(atav) ) { if( PR_SUCCESS != nssATAV_verifyPointer(atav) ) {
@ -1499,12 +1508,14 @@ nssATAV_GetUTF8Encoding
return (NSSUTF8 *)NULL; return (NSSUTF8 *)NULL;
} }
if( PR_SUCCESS != nssUTF8_Size(oid, &oidlen) ) { oidlen = nssUTF8_Size(oid, &status);
if( PR_SUCCESS != status ) {
(void)nss_ZFreeIf(oid); (void)nss_ZFreeIf(oid);
return (NSSUTF8 *)NULL; return (NSSUTF8 *)NULL;
} }
} else { } else {
if( PR_SUCCESS != nssUTF8_Size(alias, &oidlen) ) { oidlen = nssUTF8_Size(alias, &status);
if( PR_SUCCESS != status ) {
return (NSSUTF8 *)NULL; return (NSSUTF8 *)NULL;
} }
oid = (NSSUTF8 *)NULL; oid = (NSSUTF8 *)NULL;
@ -1516,7 +1527,8 @@ nssATAV_GetUTF8Encoding
return (NSSUTF8 *)NULL; return (NSSUTF8 *)NULL;
} }
if( PR_SUCCESS != nssUTF8_Size(value, &valuelen) ) { valuelen = nssUTF8_Size(value, &status);
if( PR_SUCCESS != status ) {
(void)nss_ZFreeIf(value); (void)nss_ZFreeIf(value);
(void)nss_ZFreeIf(oid); (void)nss_ZFreeIf(oid);
return (NSSUTF8 *)NULL; return (NSSUTF8 *)NULL;
@ -1654,6 +1666,7 @@ nssATAV_Compare
nssStringType comparison; nssStringType comparison;
PRUint32 len1; PRUint32 len1;
PRUint32 len2; PRUint32 len2;
PRStatus status;
#ifdef DEBUG #ifdef DEBUG
if( PR_SUCCESS != nssATAV_verifyPointer(atav1) ) { if( PR_SUCCESS != nssATAV_verifyPointer(atav1) ) {
@ -1696,8 +1709,8 @@ nssATAV_Compare
case nssStringType_TeletexString: case nssStringType_TeletexString:
break; break;
case nssStringType_PrintableString: case nssStringType_PrintableString:
return nssUTF8_PrintableMatch(atav1->value, atav2->value, *equalp = nssUTF8_PrintableMatch(atav1->value, atav2->value, &status);
equalp); return status;
/* Case-insensitive, with whitespace reduction */ /* Case-insensitive, with whitespace reduction */
break; break;
case nssStringType_UniversalString: case nssStringType_UniversalString:
@ -1708,17 +1721,19 @@ nssATAV_Compare
break; break;
case nssStringType_PHGString: case nssStringType_PHGString:
/* Case-insensitive (XXX fgmr, actually see draft-11 pg. 21) */ /* Case-insensitive (XXX fgmr, actually see draft-11 pg. 21) */
return nssUTF8_CaseIgnoreMatch(atav1->value, atav2->value, *equalp = nssUTF8_CaseIgnoreMatch(atav1->value, atav2->value, &status);
equalp); return status;
case nssStringType_Unknown: case nssStringType_Unknown:
break; break;
} }
if( PR_SUCCESS != nssUTF8_Size(atav1->value, &len1) ) { len1 = nssUTF8_Size(atav1->value, &status);
if( PR_SUCCESS != status ) {
return PR_FAILURE; return PR_FAILURE;
} }
if( PR_SUCCESS != nssUTF8_Size(atav2->value, &len2) ) { len2 = nssUTF8_Size(atav2->value, &status);
if( PR_SUCCESS != status ) {
return PR_FAILURE; return PR_FAILURE;
} }