214
214
SECU_FilePasswd(PK11SlotInfo *slot, PRBool retry, void *arg)
216
unsigned char phrase[200];
216
char* phrases, *phrase;
219
219
char *pwFile = arg;
221
const long maxPwdFileSize = 4096;
222
char* tokenName = NULL;
226
229
return 0; /* no good retrying - the files contents will be the same */
232
phrases = PORT_ZAlloc(maxPwdFileSize);
235
return 0; /* out of memory */
229
238
fd = PR_Open(pwFile, PR_RDONLY, 0);
231
240
fprintf(stderr, "No password file \"%s\" exists.\n", pwFile);
235
nb = PR_Read(fd, phrase, sizeof(phrase));
245
nb = PR_Read(fd, phrases, maxPwdFileSize);
238
/* handle the Windows EOL case */
250
fprintf(stderr,"password file contains no data\n");
256
tokenName = PK11_GetTokenName(slot);
258
tokenLen = PORT_Strlen(tokenName);
240
while (phrase[i] != '\r' && phrase[i] != '\n' && i < nb) i++;
243
fprintf(stderr,"password file contains no data\n");
246
return (char*) PORT_Strdup((char*)phrase);
267
/* handle the Windows EOL case */
268
while (phrases[i] != '\r' && phrases[i] != '\n' && i < nb) i++;
269
/* terminate passphrase */
271
/* clean up any EOL before the start of the next passphrase */
272
while ( (i<nb) && (phrases[i] == '\r' || phrases[i] == '\n')) {
275
/* now analyze the current passphrase */
276
phrase = &phrases[startphrase];
279
if (PORT_Strncmp(phrase, tokenName, tokenLen)) continue;
280
phraseLen = PORT_Strlen(phrase);
281
if (phraseLen < (tokenLen+1)) continue;
282
if (phrase[tokenLen] != ':') continue;
283
phrase = &phrase[tokenLen+1];
288
phrase = PORT_Strdup((char*)phrase);
1998
2042
int snPresent = (kid->authCertSerialNumber.data &&
1999
2043
kid->authCertSerialNumber.len);
2001
if ((keyIDPresent && !issuerPresent && !snPresent) ||
2002
(!keyIDPresent && issuerPresent && snPresent)) {
2005
SECU_Indent(out, level);
2007
"Error: KeyID OR (Issuer AND Serial) must be present, not both.\n");
2009
2045
if (keyIDPresent)
2010
2046
SECU_PrintAsHex(out, &kid->keyID, "Key ID", level);
2011
2047
if (issuerPresent)
2065
2101
pPoint->distPoint.fullName != NULL) {
2066
2102
secu_PrintGeneralNames(out, pPoint->distPoint.fullName, NULL,
2069
} else if (pPoint->distPointType == relativeDistinguishedName) {
2070
/* print the relative name */
2104
} else if (pPoint->distPointType == relativeDistinguishedName &&
2105
pPoint->distPoint.relativeName.avas) {
2106
SECU_PrintRDN(out, &pPoint->distPoint.relativeName, "RDN",
2072
2108
} else if (pPoint->derDistPoint.data) {
2073
2109
SECU_PrintAny(out, &pPoint->derDistPoint, "Point", level);
2334
/* An RDN is a subset of a DirectoryName, and we already know how to
2335
* print those, so make a directory name out of the RDN, and print it.
2338
SECU_PrintRDN(FILE *out, CERTRDN *rdn, char *msg, int level)
2347
SECU_PrintName(out, &name, msg, level);
2300
2351
SECU_PrintName(FILE *out, CERTName *name, char *msg, int level)