summaryrefslogtreecommitdiff
path: root/apps/s_server.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/s_server.c')
-rw-r--r--apps/s_server.c76
1 files changed, 68 insertions, 8 deletions
diff --git a/apps/s_server.c b/apps/s_server.c
index 7038998963..a835db0081 100644
--- a/apps/s_server.c
+++ b/apps/s_server.c
@@ -197,6 +197,11 @@ typedef unsigned int u_int;
#include "s_apps.h"
#include "timeouts.h"
+#ifdef OPENSSL_SYS_VMS
+# include "vms_term_sock.h"
+#endif
+
+
#if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000)
/* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */
# undef FIONBIO
@@ -2187,6 +2192,10 @@ static int sv_body(char *hostname, int s, int stype, unsigned char *context)
#else
struct timeval *timeoutp;
#endif
+#if defined(OPENSSL_SYS_VMS)
+ int stdin_sock;
+ TerminalSocket (TERM_SOCK_CREATE, &stdin_sock);
+#endif
if ((buf = OPENSSL_malloc(bufsize)) == NULL) {
BIO_printf(bio_err, "out of memory\n");
@@ -2194,7 +2203,19 @@ static int sv_body(char *hostname, int s, int stype, unsigned char *context)
}
#ifdef FIONBIO
if (s_nbio) {
+# if defined(OPENSSL_SYS_VMS) && defined(__VMS_VER) && (__VMS_VER >= 70000000)
+ /* For 64-bit --> 32-bit restricted APIs (IOCTL) */
+# if __INITIAL_POINTER_SIZE == 64
+# pragma __required_pointer_size __save
+# pragma __required_pointer_size 32
+# endif
+ unsigned int sl =1;
+# if __INITIAL_POINTER_SIZE == 64
+# pragma __required_pointer_size __restore
+# endif
+# else
unsigned long sl = 1;
+# endif /* OPENSSL_SYS_VMS */
if (!s_quiet)
BIO_printf(bio_err, "turning on non blocking io\n");
@@ -2307,7 +2328,15 @@ static int sv_body(char *hostname, int s, int stype, unsigned char *context)
}
#endif
- width = s + 1;
+
+#if defined(OPENSSL_SYS_VMS)
+ if (stdin_sock > s)
+ width = stdin_sock + 1;
+ else
+ width=s+1;
+#else
+ width=s+1;
+#endif
for (;;) {
int read_from_terminal;
int read_from_sslcon;
@@ -2318,7 +2347,11 @@ static int sv_body(char *hostname, int s, int stype, unsigned char *context)
if (!read_from_sslcon) {
FD_ZERO(&readfds);
#if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_NETWARE) && !defined(OPENSSL_SYS_BEOS_R5)
- openssl_fdset(fileno(stdin), &readfds);
+ # if defined(OPENSSL_SYS_VMS)
+ openssl_fdset(stdin_sock,&readfds);
+ # else
+ openssl_fdset(stdin),&readfds);
+ #endif
#endif
openssl_fdset(s, &readfds);
/*
@@ -2369,7 +2402,11 @@ static int sv_body(char *hostname, int s, int stype, unsigned char *context)
if (i <= 0)
continue;
- if (FD_ISSET(fileno(stdin), &readfds))
+#if defined(OPENSSL_SYS_VMS)
+ if (FD_ISSET(stdin_sock,&readfds))
+#else
+ if (FD_ISSET(fileno(stdin),&readfds))
+#endif
read_from_terminal = 1;
#endif
if (FD_ISSET(s, &readfds))
@@ -2379,8 +2416,12 @@ static int sv_body(char *hostname, int s, int stype, unsigned char *context)
if (s_crlf) {
int j, lf_num;
- i = raw_read_stdin(buf, bufsize / 2);
- lf_num = 0;
+ #if defined(OPENSSL_SYS_VMS)
+ i=recv(stdin_sock, buf, bufsize/2, 0);
+ #else
+ i = raw_read_stdin(buf, bufsize / 2)
+ #endif
+ lf_num = 0;
/* both loops are skipped when i <= 0 */
for (j = 0; j < i; j++)
if (buf[j] == '\n')
@@ -2395,7 +2436,11 @@ static int sv_body(char *hostname, int s, int stype, unsigned char *context)
}
assert(lf_num == 0);
} else
- i = raw_read_stdin(buf, bufsize);
+#if defined(OPENSSL_SYS_VMS)
+ i=recv(stdin_sock,buf,bufsize, 0);
+#else
+ i = raw_read_stdin(buf, bufsize);
+#endif
if (!s_quiet && !s_brief) {
if ((i <= 0) || (buf[0] == 'Q')) {
BIO_printf(bio_s_out, "DONE\n");
@@ -2476,7 +2521,7 @@ static int sv_body(char *hostname, int s, int stype, unsigned char *context)
srp_callback_parm.user =
SRP_VBASE_get1_by_user(srp_callback_parm.vb,
srp_callback_parm.login);
- if (srp_callback_parm.user)
+ if (srp_callback_parm.user)
BIO_printf(bio_s_out, "LOOKUP done %s\n",
srp_callback_parm.user->info);
else
@@ -2585,6 +2630,9 @@ static int sv_body(char *hostname, int s, int stype, unsigned char *context)
}
if (ret >= 0)
BIO_printf(bio_s_out, "ACCEPT\n");
+#if defined(OPENSSL_SYS_VMS)
+ TerminalSocket (TERM_SOCK_DELETE, &stdin_sock);
+#endif
return (ret);
}
@@ -2802,8 +2850,20 @@ static int www_body(char *hostname, int s, int stype, unsigned char *context)
#ifdef FIONBIO
if (s_nbio) {
- unsigned long sl = 1;
+# if defined(OPENSSL_SYS_VMS) && defined(__VMS_VER) && (__VMS_VER >= 70000000)
+ /* For 64-bit --> 32-bit restricted APIs (IOCTL) */
+# if __INITIAL_POINTER_SIZE == 64
+# pragma __required_pointer_size __save
+# pragma __required_pointer_size 32
+# endif
+ unsigned int sl ;
+# if __INITIAL_POINTER_SIZE == 64
+# pragma __required_pointer_size __restore
+# endif
+# else
+ unsigned long sl=1;
+# endif /* OPENSSL_SYS_VMS */
if (!s_quiet)
BIO_printf(bio_err, "turning on non blocking io\n");
if (BIO_socket_ioctl(s, FIONBIO, &sl) < 0)