summaryrefslogtreecommitdiff
path: root/crypto/ui
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2016-12-09 23:35:53 +0100
committerRichard Levitte <levitte@openssl.org>2016-12-10 10:16:41 +0100
commitc922ebe23247ff9ee07310fa30647623c0547cd9 (patch)
treec4bedd44de6b0fc509c1a0fe152b520d9dbe871e /crypto/ui
parent18edbe6519bd5b738bf410b23f437df3005526e3 (diff)
downloadopenssl-new-c922ebe23247ff9ee07310fa30647623c0547cd9.tar.gz
VMS UI_OpenSSL: generate OpenSSL errors when things go wrong.
Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2063)
Diffstat (limited to 'crypto/ui')
-rw-r--r--crypto/ui/ui_err.c6
-rw-r--r--crypto/ui/ui_openssl.c40
2 files changed, 42 insertions, 4 deletions
diff --git a/crypto/ui/ui_err.c b/crypto/ui/ui_err.c
index eaaa4f58e9..c8640feaf1 100644
--- a/crypto/ui/ui_err.c
+++ b/crypto/ui/ui_err.c
@@ -19,8 +19,11 @@
# define ERR_REASON(reason) ERR_PACK(ERR_LIB_UI,0,reason)
static ERR_STRING_DATA UI_str_functs[] = {
+ {ERR_FUNC(UI_F_CLOSE_CONSOLE), "close_console"},
+ {ERR_FUNC(UI_F_ECHO_CONSOLE), "echo_console"},
{ERR_FUNC(UI_F_GENERAL_ALLOCATE_BOOLEAN), "general_allocate_boolean"},
{ERR_FUNC(UI_F_GENERAL_ALLOCATE_PROMPT), "general_allocate_prompt"},
+ {ERR_FUNC(UI_F_NOECHO_CONSOLE), "noecho_console"},
{ERR_FUNC(UI_F_OPEN_CONSOLE), "open_console"},
{ERR_FUNC(UI_F_UI_CREATE_METHOD), "UI_create_method"},
{ERR_FUNC(UI_F_UI_CTRL), "UI_ctrl"},
@@ -45,6 +48,9 @@ static ERR_STRING_DATA UI_str_reasons[] = {
{ERR_REASON(UI_R_PROCESSING_ERROR), "processing error"},
{ERR_REASON(UI_R_RESULT_TOO_LARGE), "result too large"},
{ERR_REASON(UI_R_RESULT_TOO_SMALL), "result too small"},
+ {ERR_REASON(UI_R_SYSASSIGN_ERROR), "sys$assign error"},
+ {ERR_REASON(UI_R_SYSDASSGN_ERROR), "sys$dassgn error"},
+ {ERR_REASON(UI_R_SYSQIOW_ERROR), "sys$qiow error"},
{ERR_REASON(UI_R_UNKNOWN_CONTROL_COMMAND), "unknown control command"},
{ERR_REASON(UI_R_UNKNOWN_TTYGET_ERRNO_VALUE),
"unknown ttyget errno value"},
diff --git a/crypto/ui/ui_openssl.c b/crypto/ui/ui_openssl.c
index 90e39a21f7..400b0562f4 100644
--- a/crypto/ui/ui_openssl.c
+++ b/crypto/ui/ui_openssl.c
@@ -452,8 +452,14 @@ static int open_console(UI *ui)
status = sys$assign(&terminal, &channel, 0, 0);
/* if there isn't a TT device, something is very wrong */
- if (status != SS$_NORMAL)
+ if (status != SS$_NORMAL) {
+ char tmp_num[12];
+
+ BIO_snprintf(tmp_num, sizeof(tmp_num) - 1, "%%X%08X", status);
+ UIerr(UI_F_OPEN_CONSOLE, UI_R_SYSASSIGN_ERROR);
+ ERR_add_error_data(2, "status=", tmp_num);
return 0;
+ }
status = sys$qiow(0, channel, IO$_SENSEMODE, &iosb, 0, 0, tty_orig, 12,
0, 0, 0, 0);
@@ -483,8 +489,18 @@ static int noecho_console(UI *ui)
tty_new[2] = tty_orig[2];
status = sys$qiow(0, channel, IO$_SETMODE, &iosb, 0, 0, tty_new, 12,
0, 0, 0, 0);
- if ((status != SS$_NORMAL) || (iosb.iosb$w_value != SS$_NORMAL))
+ if ((status != SS$_NORMAL) || (iosb.iosb$w_value != SS$_NORMAL)) {
+ char tmp_num[2][12];
+
+ BIO_snprintf(tmp_num[0], sizeof(tmp_num[0]) - 1, "%%X%08X",
+ status);
+ BIO_snprintf(tmp_num[1], sizeof(tmp_num[1]) - 1, "%%X%08X",
+ iosb.iosb$w_value);
+ UIerr(UI_F_NOECHO_CONSOLE, UI_R_SYSQIOW_ERROR);
+ ERR_add_error_data(5, "status=", tmp_num[0],
+ ",", "iosb.iosb$w_value=", tmp_num[1]);
return 0;
+ }
}
#endif
#if defined(_WIN32) && !defined(_WIN32_WCE)
@@ -515,8 +531,18 @@ static int echo_console(UI *ui)
tty_new[2] = tty_orig[2];
status = sys$qiow(0, channel, IO$_SETMODE, &iosb, 0, 0, tty_new, 12,
0, 0, 0, 0);
- if ((status != SS$_NORMAL) || (iosb.iosb$w_value != SS$_NORMAL))
+ if ((status != SS$_NORMAL) || (iosb.iosb$w_value != SS$_NORMAL)) {
+ char tmp_num[2][12];
+
+ BIO_snprintf(tmp_num[0], sizeof(tmp_num[0]) - 1, "%%X%08X",
+ status);
+ BIO_snprintf(tmp_num[1], sizeof(tmp_num[1]) - 1, "%%X%08X",
+ iosb.iosb$w_value);
+ UIerr(UI_F_ECHO_CONSOLE, UI_R_SYSQIOW_ERROR);
+ ERR_add_error_data(5, "status=", tmp_num[0],
+ ",", "iosb.iosb$w_value=", tmp_num[1]);
return 0;
+ }
}
#endif
#if defined(_WIN32) && !defined(_WIN32_WCE)
@@ -537,8 +563,14 @@ static int close_console(UI *ui)
fclose(tty_out);
#ifdef OPENSSL_SYS_VMS
status = sys$dassgn(channel);
- if (status != SS$_NORMAL)
+ if (status != SS$_NORMAL) {
+ char tmp_num[12];
+
+ BIO_snprintf(tmp_num, sizeof(tmp_num) - 1, "%%X%08X", status);
+ UIerr(UI_F_CLOSE_CONSOLE, UI_R_SYSDASSGN_ERROR);
+ ERR_add_error_data(2, "status=", tmp_num);
return 0;
+ }
#endif
CRYPTO_THREAD_unlock(ui->lock);