int setup_ui_method(void);
void destroy_ui_method(void);
-UI_METHOD *get_ui_method(void);
+int set_base_ui_method(const UI_METHOD *ui_method);
+const UI_METHOD *get_ui_method(void);
extern BIO *bio_err;
#include "apps_ui.h"
static UI_METHOD *ui_method = NULL;
-static const UI_METHOD *ui_fallback_method = NULL;
+static const UI_METHOD *ui_base_method = NULL;
static int ui_open(UI *ui)
{
- int (*opener)(UI *ui) = UI_method_get_opener(ui_fallback_method);
+ int (*opener)(UI *ui) = UI_method_get_opener(ui_base_method);
if (opener != NULL)
return opener(ui);
}
}
- reader = UI_method_get_reader(ui_fallback_method);
+ reader = UI_method_get_reader(ui_base_method);
if (reader != NULL)
return reader(ui, uis);
/* Default to the empty password if we've got nothing better */
}
}
- writer = UI_method_get_writer(ui_fallback_method);
+ writer = UI_method_get_writer(ui_base_method);
if (writer != NULL)
return writer(ui, uis);
return 1;
static int ui_close(UI *ui)
{
- int (*closer)(UI *ui) = UI_method_get_closer(ui_fallback_method);
+ int (*closer)(UI *ui) = UI_method_get_closer(ui_base_method);
if (closer != NULL)
return closer(ui);
return UI_construct_prompt(NULL, phrase_desc, object_name);
}
+int set_base_ui_method(const UI_METHOD *ui_meth)
+{
+ if (ui_meth == NULL)
+ ui_meth = UI_null();
+ ui_base_method = ui_meth;
+ return 1;
+}
+
int setup_ui_method(void)
{
- ui_fallback_method = UI_null();
+ ui_base_method = UI_null();
#ifndef OPENSSL_NO_UI_CONSOLE
- ui_fallback_method = UI_OpenSSL();
+ ui_base_method = UI_OpenSSL();
#endif
ui_method = UI_create_method("OpenSSL application user interface");
return ui_method != NULL
}
}
-UI_METHOD *get_ui_method(void)
+const UI_METHOD *get_ui_method(void)
{
return ui_method;
}