/* apps/crl.c */
-/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
#undef POSTFIX
#define POSTFIX ".rvk"
-#define FORMAT_UNDEF 0
-#define FORMAT_ASN1 1
-#define FORMAT_TEXT 2
-#define FORMAT_PEM 3
-
static char *crl_usage[]={
"usage: crl args\n",
"\n",
BIO *out=NULL;
int informat,outformat;
char *infile=NULL,*outfile=NULL;
- char *str=NULL;
int hash=0,issuer=0,lastupdate=0,nextupdate=0,noout=0;
char **pp,buf[256];
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err,stderr,BIO_NOCLOSE);
+ BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
if (bio_out == NULL)
if ((bio_out=BIO_new(BIO_s_file())) != NULL)
if (issuer == i)
{
X509_NAME_oneline(x->crl->issuer,buf,256);
- fprintf(stdout,"issuer= %s\n",str);
+ fprintf(stdout,"issuer= %s\n",buf);
}
if (hash == i)
if (nextupdate == i)
{
fprintf(stdout,"nextUpdate=");
- ASN1_UTCTIME_print(bio_out,x->crl->nextUpdate);
+ if (x->crl->nextUpdate != NULL)
+ ASN1_UTCTIME_print(bio_out,x->crl->nextUpdate);
+ else
+ fprintf(stdout,"NONE");
fprintf(stdout,"\n");
}
}
else if (outformat == FORMAT_TEXT)
{
X509_REVOKED *r;
+ STACK *sk;
- while ((r=(X509_REVOKED *)sk_pop(x->crl->revoked)) != NULL)
+ sk=sk_dup(x->crl->revoked);
+ while ((r=(X509_REVOKED *)sk_pop(sk)) != NULL)
{
fprintf(stdout,"revoked: serialNumber=");
i2a_ASN1_INTEGER(out,r->serialNumber);
ASN1_UTCTIME_print(bio_out,r->revocationDate);
fprintf(stdout,"\n");
}
+ sk_free(sk);
i=1;
}
else