Fixes for dgst tool. Initialize md_name, sig_name properly. Return error code

on failure. Keep output format consistent with previous versions.

Also flush stdout after printing ACCEPT in s_server.
This commit is contained in:
Dr. Stephen Henson 2007-05-21 15:53:30 +00:00
parent 9aba74e55a
commit 9c54e18bf0
2 changed files with 12 additions and 15 deletions

View File

@ -85,7 +85,7 @@ int MAIN(int argc, char **argv)
{ {
ENGINE *e = NULL; ENGINE *e = NULL;
unsigned char *buf=NULL; unsigned char *buf=NULL;
int i,err=0; int i,err=1;
const EVP_MD *md=NULL,*m; const EVP_MD *md=NULL,*m;
BIO *in=NULL,*inp; BIO *in=NULL,*inp;
BIO *bmd=NULL; BIO *bmd=NULL;
@ -234,7 +234,6 @@ int MAIN(int argc, char **argv)
if(do_verify && !sigfile) { if(do_verify && !sigfile) {
BIO_printf(bio_err, "No signature to verify: use the -signature option\n"); BIO_printf(bio_err, "No signature to verify: use the -signature option\n");
err = 1;
goto end; goto end;
} }
@ -288,7 +287,6 @@ int MAIN(int argc, char **argv)
SN_whirlpool,SN_whirlpool); SN_whirlpool,SN_whirlpool);
#endif #endif
err=1; err=1;
goto end;
} }
in=BIO_new(BIO_s_file()); in=BIO_new(BIO_s_file());
@ -313,8 +311,10 @@ int MAIN(int argc, char **argv)
} }
if(out_bin == -1) { if(out_bin == -1) {
if(keyfile) out_bin = 1; if(keyfile)
else out_bin = 0; out_bin = 1;
else
out_bin = 0;
} }
if(randfile) if(randfile)
@ -494,13 +494,8 @@ int MAIN(int argc, char **argv)
} }
else else
{ {
const char *md_name, *sig_name; const char *md_name = NULL, *sig_name = NULL;
if(out_bin) if(!out_bin)
{
md_name = NULL;
sig_name = NULL;
}
else
{ {
if (sigkey) if (sigkey)
{ {
@ -512,6 +507,7 @@ int MAIN(int argc, char **argv)
} }
md_name = EVP_MD_name(md); md_name = EVP_MD_name(md);
} }
err = 0;
for (i=0; i<argc; i++) for (i=0; i<argc; i++)
{ {
int r; int r;

View File

@ -1447,6 +1447,7 @@ bad:
} }
BIO_printf(bio_s_out,"ACCEPT\n"); BIO_printf(bio_s_out,"ACCEPT\n");
BIO_flush(bio_s_out);
if (www) if (www)
do_server(port,socket_type,&accept_socket,www_body, context); do_server(port,socket_type,&accept_socket,www_body, context);
else else