[openssl-commits] [openssl] master update

Richard Levitte levitte at openssl.org
Thu Dec 8 12:34:56 UTC 2016


The branch master has been updated
       via  4984448648f69ed4425df68900b1fd6f17c6c271 (commit)
      from  57c0f378b8fdbdc55dba783e9b744b8ed2132819 (commit)


- Log -----------------------------------------------------------------
commit 4984448648f69ed4425df68900b1fd6f17c6c271
Author: Richard Levitte <levitte at openssl.org>
Date:   Thu Dec 8 11:16:37 2016 +0100

    In UI_OpenSSL's open(), generate an error on unknown errno
    
    TTY_get() sometimes surprises us with new errno values to determine if
    we have a controling terminal or not.  This generated error is a
    helpful tool to figure out that this was what happened and what the
    unknown value is.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/2043)

-----------------------------------------------------------------------

Summary of changes:
 crypto/err/err.c       |  1 +
 crypto/ui/ui_err.c     |  3 +++
 crypto/ui/ui_openssl.c | 10 +++++++++-
 include/openssl/ui.h   |  2 ++
 4 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/crypto/err/err.c b/crypto/err/err.c
index 29e5a03..44a293a 100644
--- a/crypto/err/err.c
+++ b/crypto/err/err.c
@@ -52,6 +52,7 @@ static ERR_STRING_DATA ERR_str_libraries[] = {
     {ERR_PACK(ERR_LIB_TS, 0, 0), "time stamp routines"},
     {ERR_PACK(ERR_LIB_ENGINE, 0, 0), "engine routines"},
     {ERR_PACK(ERR_LIB_OCSP, 0, 0), "OCSP routines"},
+    {ERR_PACK(ERR_LIB_UI, 0, 0), "UI routines"},
     {ERR_PACK(ERR_LIB_FIPS, 0, 0), "FIPS routines"},
     {ERR_PACK(ERR_LIB_CMS, 0, 0), "CMS routines"},
     {ERR_PACK(ERR_LIB_HMAC, 0, 0), "HMAC routines"},
diff --git a/crypto/ui/ui_err.c b/crypto/ui/ui_err.c
index b89f9ae..eaaa4f5 100644
--- a/crypto/ui/ui_err.c
+++ b/crypto/ui/ui_err.c
@@ -21,6 +21,7 @@
 static ERR_STRING_DATA UI_str_functs[] = {
     {ERR_FUNC(UI_F_GENERAL_ALLOCATE_BOOLEAN), "general_allocate_boolean"},
     {ERR_FUNC(UI_F_GENERAL_ALLOCATE_PROMPT), "general_allocate_prompt"},
+    {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"},
     {ERR_FUNC(UI_F_UI_DUP_ERROR_STRING), "UI_dup_error_string"},
@@ -45,6 +46,8 @@ static ERR_STRING_DATA UI_str_reasons[] = {
     {ERR_REASON(UI_R_RESULT_TOO_LARGE), "result too large"},
     {ERR_REASON(UI_R_RESULT_TOO_SMALL), "result too small"},
     {ERR_REASON(UI_R_UNKNOWN_CONTROL_COMMAND), "unknown control command"},
+    {ERR_REASON(UI_R_UNKNOWN_TTYGET_ERRNO_VALUE),
+     "unknown ttyget errno value"},
     {0, NULL}
 };
 
diff --git a/crypto/ui/ui_openssl.c b/crypto/ui/ui_openssl.c
index bdd07f9..a9acd98 100644
--- a/crypto/ui/ui_openssl.c
+++ b/crypto/ui/ui_openssl.c
@@ -8,6 +8,7 @@
  */
 
 #include <openssl/e_os2.h>
+#include <openssl/err.h>
 
 /*
  * need for #define _POSIX_C_SOURCE arises whenever you pass -ansi to gcc
@@ -428,7 +429,14 @@ static int open_console(UI *ui)
             is_a_tty = 0;
         else
 # endif
-            return 0;
+            {
+                char tmp_num[10];
+                BIO_snprintf(tmp_num, sizeof(tmp_num) - 1, "%d", errno);
+                UIerr(UI_F_OPEN_CONSOLE, UI_R_UNKNOWN_TTYGET_ERRNO_VALUE);
+                ERR_add_error_data(2, "errno=", tmp_num);
+
+                return 0;
+            }
     }
 #endif
 #ifdef OPENSSL_SYS_VMS
diff --git a/include/openssl/ui.h b/include/openssl/ui.h
index c62c05d..4337e91 100644
--- a/include/openssl/ui.h
+++ b/include/openssl/ui.h
@@ -341,6 +341,7 @@ int ERR_load_UI_strings(void);
 /* Function codes. */
 # define UI_F_GENERAL_ALLOCATE_BOOLEAN                    108
 # define UI_F_GENERAL_ALLOCATE_PROMPT                     109
+# define UI_F_OPEN_CONSOLE                                114
 # define UI_F_UI_CREATE_METHOD                            112
 # define UI_F_UI_CTRL                                     111
 # define UI_F_UI_DUP_ERROR_STRING                         101
@@ -362,6 +363,7 @@ int ERR_load_UI_strings(void);
 # define UI_R_RESULT_TOO_LARGE                            100
 # define UI_R_RESULT_TOO_SMALL                            101
 # define UI_R_UNKNOWN_CONTROL_COMMAND                     106
+# define UI_R_UNKNOWN_TTYGET_ERRNO_VALUE                  108
 
 #  ifdef  __cplusplus
 }


More information about the openssl-commits mailing list