mirror of https://github.com/openssl/openssl.git
apps_ui.c: Improve error handling and return value of setup_ui_method()
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/12493)
This commit is contained in:
parent
9a62ccbe8a
commit
f84de16f39
|
@ -106,11 +106,13 @@ int setup_ui_method(void)
|
||||||
ui_fallback_method = UI_OpenSSL();
|
ui_fallback_method = UI_OpenSSL();
|
||||||
#endif
|
#endif
|
||||||
ui_method = UI_create_method("OpenSSL application user interface");
|
ui_method = UI_create_method("OpenSSL application user interface");
|
||||||
UI_method_set_opener(ui_method, ui_open);
|
return ui_method != NULL
|
||||||
UI_method_set_reader(ui_method, ui_read);
|
&& 0 == UI_method_set_opener(ui_method, ui_open)
|
||||||
UI_method_set_writer(ui_method, ui_write);
|
&& 0 == UI_method_set_reader(ui_method, ui_read)
|
||||||
UI_method_set_closer(ui_method, ui_close);
|
&& 0 == UI_method_set_writer(ui_method, ui_write)
|
||||||
return 0;
|
&& 0 == UI_method_set_closer(ui_method, ui_close)
|
||||||
|
&& 0 == UI_method_set_prompt_constructor(ui_method,
|
||||||
|
ui_prompt_construct);
|
||||||
}
|
}
|
||||||
|
|
||||||
void destroy_ui_method(void)
|
void destroy_ui_method(void)
|
||||||
|
|
|
@ -68,7 +68,7 @@ static int apps_startup(void)
|
||||||
| OPENSSL_INIT_LOAD_CONFIG, NULL))
|
| OPENSSL_INIT_LOAD_CONFIG, NULL))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
setup_ui_method();
|
(void)setup_ui_method();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NOTE: This is an undocumented feature required for testing only.
|
* NOTE: This is an undocumented feature required for testing only.
|
||||||
|
|
|
@ -78,7 +78,7 @@ static int test_new_ui(void)
|
||||||
char pass[16];
|
char pass[16];
|
||||||
int ok = 0;
|
int ok = 0;
|
||||||
|
|
||||||
setup_ui_method();
|
(void)setup_ui_method();
|
||||||
if (TEST_int_gt(password_callback(pass, sizeof(pass), 0, &cb_data), 0)
|
if (TEST_int_gt(password_callback(pass, sizeof(pass), 0, &cb_data), 0)
|
||||||
&& TEST_str_eq(pass, cb_data.password))
|
&& TEST_str_eq(pass, cb_data.password))
|
||||||
ok = 1;
|
ok = 1;
|
||||||
|
|
Loading…
Reference in New Issue