--- req.c.orig.0.9.6	Fri Nov  3 09:58:00 2000
+++ req.c	Fri Nov  3 09:58:00 2000
@@ -105,6 +105,7 @@
  * -rand file(s) - load the file(s) into the PRNG.
  * -newkey	- make a key and a request.
  * -modulus	- print RSA modulus.
+ * -subject	- print subject DN.
  * -x509	- output a self signed X509 structure instead.
  * -asn1-kludge	- output new certificate request in a format that some CA's
  *		  require.  This format is wrong
@@ -155,7 +156,7 @@
 	char *extensions = NULL;
 	char *req_exts = NULL;
 	EVP_CIPHER *cipher=NULL;
-	int modulus=0;
+	int modulus=0, subject=0;
 	char *inrand=NULL;
 	char *passargin = NULL, *passargout = NULL;
 	char *passin = NULL, *passout = NULL;
@@ -314,6 +315,8 @@
 			}
 		else if (strcmp(*argv,"-newhdr") == 0)
 			newhdr=1;
+		else if (strcmp(*argv,"-subject") == 0)
+			subject=1;
 		else if (strcmp(*argv,"-modulus") == 0)
 			modulus=1;
 		else if (strcmp(*argv,"-verify") == 0)
@@ -374,6 +377,7 @@
 		BIO_printf(bio_err," -noout         do not output REQ\n");
 		BIO_printf(bio_err," -verify        verify signature on REQ\n");
 		BIO_printf(bio_err," -modulus       RSA modulus\n");
+		BIO_printf(bio_err," -subject       Subject DN\n");
 		BIO_printf(bio_err," -nodes         don't encrypt the output key\n");
 		BIO_printf(bio_err," -key file	use the private key contained in file\n");
 		BIO_printf(bio_err," -keyform arg   key file format\n");
@@ -803,7 +807,7 @@
 			BIO_printf(bio_err,"verify OK\n");
 		}
 
-	if (noout && !text && !modulus)
+	if (noout && !text && !modulus && !subject)
 		{
 		ex=0;
 		goto end;
@@ -862,6 +866,15 @@
 			fprintf(stdout,"Wrong Algorithm type");
 		fprintf(stdout,"\n");
 		}
+
+	if (subject)
+		{
+		char sn[1024];
+
+		X509_NAME_oneline(X509_REQ_get_subject_name(req),sn,sizeof(sn));
+		fprintf(stdout,"subject=%s\n",sn);
+		}
+
 
 	if (!noout && !x509)
 		{
