зеркало из https://github.com/mozilla/pjs.git
Fix solaris signed/unsigned warnings.
On updating nicknames, create a nickname record if one doesn't exist (that is somehow the database got corrupted).
This commit is contained in:
Родитель
30662a236f
Коммит
40f89278ca
|
@ -34,7 +34,7 @@
|
|||
/*
|
||||
* Certificate handling code
|
||||
*
|
||||
* $Id: lowcert.c,v 1.9 2002-06-24 21:54:39 relyea%netscape.com Exp $
|
||||
* $Id: lowcert.c,v 1.10 2002-07-13 02:45:04 relyea%netscape.com Exp $
|
||||
*/
|
||||
|
||||
#include "seccomon.h"
|
||||
|
@ -175,7 +175,7 @@ nsslowcert_GetDefaultCertDB(void)
|
|||
*/
|
||||
static unsigned char *
|
||||
nsslowcert_dataStart(unsigned char *buf, int length,
|
||||
int *data_length, PRBool includeTag) {
|
||||
unsigned int *data_length, PRBool includeTag) {
|
||||
unsigned char tag;
|
||||
int used_length= 0;
|
||||
|
||||
|
@ -228,9 +228,9 @@ nsslowcert_GetCertFields(unsigned char *cert,int cert_length,
|
|||
SECItem *valid, SECItem *subjkey)
|
||||
{
|
||||
unsigned char *buf;
|
||||
int buf_length;
|
||||
unsigned int buf_length;
|
||||
unsigned char *dummy;
|
||||
int dummylen;
|
||||
unsigned int dummylen;
|
||||
|
||||
/* get past the signature wrap */
|
||||
buf = nsslowcert_dataStart(cert,cert_length,&buf_length,PR_FALSE);
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
/*
|
||||
* Permanent Certificate database handling code
|
||||
*
|
||||
* $Id: pcertdb.c,v 1.26 2002-07-10 01:04:10 relyea%netscape.com Exp $
|
||||
* $Id: pcertdb.c,v 1.27 2002-07-13 02:45:04 relyea%netscape.com Exp $
|
||||
*/
|
||||
#include "prtime.h"
|
||||
|
||||
|
@ -755,7 +755,8 @@ DecodeDBCertEntry(certDBEntryCert *entry, SECItem *dbentry)
|
|||
if ( nnlen > 1 ) {
|
||||
entry->nickname = (char *)pkcs11_copyStaticData(
|
||||
&dbentry->data[headerlen+entry->derCert.len], nnlen,
|
||||
entry->nicknameSpace, sizeof(entry->nicknameSpace));
|
||||
(unsigned char *)entry->nicknameSpace,
|
||||
sizeof(entry->nicknameSpace));
|
||||
if ( entry->nickname == NULL ) {
|
||||
PORT_SetError(SEC_ERROR_NO_MEMORY);
|
||||
goto loser;
|
||||
|
@ -3160,6 +3161,7 @@ nsslowcert_AddPermNickname(NSSLOWCERTCertDBHandle *dbhandle,
|
|||
{
|
||||
SECStatus rv = SECFailure;
|
||||
certDBEntrySubject *entry = NULL;
|
||||
certDBEntryNickname *nicknameEntry = NULL;
|
||||
|
||||
nsslowcert_LockDB(dbhandle);
|
||||
|
||||
|
@ -3174,7 +3176,6 @@ nsslowcert_AddPermNickname(NSSLOWCERTCertDBHandle *dbhandle,
|
|||
if (entry == NULL) goto loser;
|
||||
|
||||
if ( entry->nickname == NULL ) {
|
||||
certDBEntryNickname *nicknameEntry = NULL;
|
||||
|
||||
/* no nickname for subject */
|
||||
rv = AddNicknameToSubject(dbhandle, cert, nickname);
|
||||
|
@ -3200,6 +3201,21 @@ nsslowcert_AddPermNickname(NSSLOWCERTCertDBHandle *dbhandle,
|
|||
if ( rv != SECSuccess ) {
|
||||
goto loser;
|
||||
}
|
||||
/* make sure nickname entry exists. If the database was corrupted,
|
||||
* we may have lost the nickname entry. Add it back now */
|
||||
nicknameEntry = ReadDBNicknameEntry(dbhandle, entry->nickname);
|
||||
if (nicknameEntry == NULL ) {
|
||||
nicknameEntry = NewDBNicknameEntry(entry->nickname,
|
||||
&cert->derSubject, 0);
|
||||
if ( nicknameEntry == NULL ) {
|
||||
goto loser;
|
||||
}
|
||||
|
||||
rv = WriteDBNicknameEntry(dbhandle, nicknameEntry);
|
||||
if ( rv != SECSuccess ) {
|
||||
goto loser;
|
||||
}
|
||||
}
|
||||
}
|
||||
rv = SECSuccess;
|
||||
|
||||
|
@ -3207,6 +3223,9 @@ loser:
|
|||
if (entry) {
|
||||
DestroyDBEntry((certDBEntry *)entry);
|
||||
}
|
||||
if (nicknameEntry) {
|
||||
DestroyDBEntry((certDBEntry *)nicknameEntry);
|
||||
}
|
||||
nsslowcert_UnlockDB(dbhandle);
|
||||
return(rv);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
/*
|
||||
* certt.h - public data structures for the certificate library
|
||||
*
|
||||
* $Id: pcertt.h,v 1.6 2002-06-24 21:54:40 relyea%netscape.com Exp $
|
||||
* $Id: pcertt.h,v 1.7 2002-07-13 02:45:04 relyea%netscape.com Exp $
|
||||
*/
|
||||
#ifndef _PCERTT_H_
|
||||
#define _PCERTT_H_
|
||||
|
@ -154,7 +154,7 @@ struct NSSLOWCERTCertificateStr {
|
|||
int referenceCount;
|
||||
|
||||
char nicknameSpace[200];
|
||||
char certKeySpace[512];
|
||||
unsigned char certKeySpace[512];
|
||||
};
|
||||
|
||||
#define SEC_CERTIFICATE_VERSION_1 0 /* default created */
|
||||
|
|
Загрузка…
Ссылка в новой задаче