* [including the GNU Public Licence.]
*/
+/* With IPv6, it looks like Digital has mixed up the proper order of
+ recursive header file inclusion, resulting in the compiler complaining
+ that u_int isn't defined, but only if _POSIX_C_SOURCE is defined, which
+ is needed to have fileno() declared correctly... So let's define u_int */
+#if defined(__DECC) && !defined(__U_INT)
+#define __U_INT
+typedef unsigned int u_int;
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <openssl/pem.h>
#include "s_apps.h"
+#if (defined(VMS) && __VMS_VER < 70000000)
+/* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */
+#undef FIONBIO
+#endif
+
+#if defined(NO_RSA) && !defined(NO_SSL2)
+#define NO_SSL2
+#endif
+
#undef PROG
#define PROG s_client_main
static int c_debug=0;
static int c_showcerts=0;
-#ifndef NOPROTO
static void sc_usage(void);
static void print_stuff(BIO *berr,SSL *con,int full);
-#else
-static void sc_usage();
-static void print_stuff();
-#endif
-
static BIO *bio_c_out=NULL;
static int c_quiet=0;
/* printf("mode tty(%d %d%d) ssl(%d%d)\n",
tty_on,read_tty,write_tty,read_ssl,write_ssl);*/
- i=select(width,&readfds,&writefds,NULL,NULL);
+ /* Note: under VMS with SOCKETSHR the second parameter
+ * is currently of type (int *) whereas under other
+ * systems it is (void *) if you don't have a cast it
+ * will choke the compiler: if you do have a cast then
+ * you can either go for (int *) or (void *).
+ */
+ i=select(width,(void *)&readfds,(void *)&writefds,
+ NULL,NULL);
if ( i < 0)
{
BIO_printf(bio_err,"bad select %d\n",
if (full)
{
+ int got_a_chain = 0;
+
sk=SSL_get_peer_cert_chain(s);
if (sk != NULL)
{
+ got_a_chain = 1; /* we don't have it for SSL2 (yet) */
+
BIO_printf(bio,"---\nCertificate chain\n");
for (i=0; i<sk_X509_num(sk); i++)
{
if (peer != NULL)
{
BIO_printf(bio,"Server certificate\n");
- if (!c_showcerts) /* Redundant if we showed the whole chain */
+ if (!(c_showcerts && got_a_chain)) /* Redundant if we showed the whole chain */
PEM_write_bio_X509(bio,peer);
X509_NAME_oneline(X509_get_subject_name(peer),
buf,BUFSIZ);
p=SSL_get_shared_ciphers(s,buf,BUFSIZ);
if (p != NULL)
{
+ /* This works only for SSL 2. In later protocol
+ * versions, the client does not know what other
+ * ciphers (in addition to the one to be used
+ * in the current connection) the server supports. */
+
BIO_printf(bio,"---\nCiphers common between both SSL endpoints:\n");
j=i=0;
while (*p)