When we force, we should preserve the NULL nickname semantics.

This commit is contained in:
relyea%netscape.com 2002-05-10 18:10:26 +00:00
Родитель 678e5a7cea
Коммит fb8c9f6813
1 изменённых файлов: 15 добавлений и 11 удалений

Просмотреть файл

@ -32,7 +32,7 @@
*/
#ifdef DEBUG
static const char CVS_ID[] = "@(#) $RCSfile: pki3hack.c,v $ $Revision: 1.53 $ $Date: 2002-05-09 22:42:23 $ $Name: $";
static const char CVS_ID[] = "@(#) $RCSfile: pki3hack.c,v $ $Revision: 1.54 $ $Date: 2002-05-10 18:10:26 $ $Name: $";
#endif /* DEBUG */
/*
@ -586,7 +586,6 @@ fill_CERTCertificateFields(NSSCertificate *c, CERTCertificate *cc, PRBool forced
int nicklen, tokenlen, len;
NSSUTF8 *tokenName = NULL;
char *nick;
nicklen = nssUTF8_Size(stanNick, &nssrv);
if (instance && !PK11_IsInternal(instance->token->pk11slot)) {
tokenName = nssToken_GetName(instance->token);
tokenlen = nssUTF8_Size(tokenName, &nssrv);
@ -594,16 +593,21 @@ fill_CERTCertificateFields(NSSCertificate *c, CERTCertificate *cc, PRBool forced
/* don't use token name for internal slot; 3.3 didn't */
tokenlen = 0;
}
len = tokenlen + nicklen;
cc->nickname = PORT_ArenaAlloc(cc->arena, len);
nick = cc->nickname;
if (tokenName) {
memcpy(nick, tokenName, tokenlen-1);
nick += tokenlen-1;
*nick++ = ':';
if (stanNick) {
nicklen = nssUTF8_Size(stanNick, &nssrv);
len = tokenlen + nicklen;
cc->nickname = PORT_ArenaAlloc(cc->arena, len);
nick = cc->nickname;
if (tokenName) {
memcpy(nick, tokenName, tokenlen-1);
nick += tokenlen-1;
*nick++ = ':';
}
memcpy(nick, stanNick, nicklen-1);
cc->nickname[len-1] = '\0';
} else {
cc->nickname = NULL;
}
memcpy(nick, stanNick, nicklen-1);
cc->nickname[len-1] = '\0';
}
if (context) {
/* trust */