Fix RISC OS build
svn path=/trunk/netsurf/; revision=10405
This commit is contained in:
parent
a4503a1574
commit
b5b280dc96
|
@ -45,9 +45,9 @@
|
||||||
|
|
||||||
static void ro_gui_401login_close(wimp_w w);
|
static void ro_gui_401login_close(wimp_w w);
|
||||||
static bool ro_gui_401login_apply(wimp_w w);
|
static bool ro_gui_401login_apply(wimp_w w);
|
||||||
static void ro_gui_401login_open(struct browser_window *bw, const char *host,
|
static void ro_gui_401login_open(const char *url, const char *host,
|
||||||
const char *realm, const char *fetchurl);
|
const char *realm,
|
||||||
|
nserror (*cb)(bool proceed, void *pw), void *cbpw);
|
||||||
|
|
||||||
static wimp_window *dialog_401_template;
|
static wimp_window *dialog_401_template;
|
||||||
|
|
||||||
|
@ -57,7 +57,8 @@ struct session_401 {
|
||||||
char uname[256]; /**< Buffer for username */
|
char uname[256]; /**< Buffer for username */
|
||||||
char *url; /**< URL being fetched */
|
char *url; /**< URL being fetched */
|
||||||
char pwd[256]; /**< Buffer for password */
|
char pwd[256]; /**< Buffer for password */
|
||||||
struct browser_window *bwin; /**< Browser window handle */
|
nserror (*cb)(bool proceed, void *pw); /**< Continuation callback */
|
||||||
|
void *cbpw; /**< Continuation callback data */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,18 +75,16 @@ void ro_gui_401login_init(void)
|
||||||
/**
|
/**
|
||||||
* Open the login dialog
|
* Open the login dialog
|
||||||
*/
|
*/
|
||||||
void gui_401login_open(struct browser_window *bw, hlcache_handle *c,
|
void gui_401login_open(const char *url, const char *realm,
|
||||||
const char *realm)
|
nserror (*cb)(bool proceed, void *pw), void *cbpw)
|
||||||
{
|
{
|
||||||
const char *murl;
|
|
||||||
char *host;
|
char *host;
|
||||||
url_func_result res;
|
url_func_result res;
|
||||||
|
|
||||||
murl = content_get_url(c);
|
res = url_host(url, &host);
|
||||||
res = url_host(murl, &host);
|
|
||||||
assert(res == URL_FUNC_OK);
|
assert(res == URL_FUNC_OK);
|
||||||
|
|
||||||
ro_gui_401login_open(bw, host, realm, murl);
|
ro_gui_401login_open(url, host, realm, cb, cbpw);
|
||||||
|
|
||||||
free(host);
|
free(host);
|
||||||
}
|
}
|
||||||
|
@ -95,8 +94,8 @@ void gui_401login_open(struct browser_window *bw, hlcache_handle *c,
|
||||||
* Open a 401 login window.
|
* Open a 401 login window.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void ro_gui_401login_open(struct browser_window *bw, const char *host,
|
void ro_gui_401login_open(const char *url, const char *host, const char *realm,
|
||||||
const char *realm, const char *fetchurl)
|
nserror (*cb)(bool proceed, void *pw), void *cbpw)
|
||||||
{
|
{
|
||||||
struct session_401 *session;
|
struct session_401 *session;
|
||||||
wimp_w w;
|
wimp_w w;
|
||||||
|
@ -108,7 +107,7 @@ void ro_gui_401login_open(struct browser_window *bw, const char *host,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
session->url = strdup(fetchurl);
|
session->url = strdup(url);
|
||||||
if (!session->url) {
|
if (!session->url) {
|
||||||
free(session);
|
free(session);
|
||||||
warn_user("NoMemory", 0);
|
warn_user("NoMemory", 0);
|
||||||
|
@ -136,7 +135,9 @@ void ro_gui_401login_open(struct browser_window *bw, const char *host,
|
||||||
}
|
}
|
||||||
session->host = strdup(host);
|
session->host = strdup(host);
|
||||||
session->realm = strdup(realm);
|
session->realm = strdup(realm);
|
||||||
session->bwin = bw;
|
session->cb = cb;
|
||||||
|
session->cbpw = cbpw;
|
||||||
|
|
||||||
if ((!session->host) || (!session->realm)) {
|
if ((!session->host) || (!session->realm)) {
|
||||||
free(session->host);
|
free(session->host);
|
||||||
free(session->realm);
|
free(session->realm);
|
||||||
|
@ -174,7 +175,7 @@ void ro_gui_401login_open(struct browser_window *bw, const char *host,
|
||||||
ro_gui_wimp_event_register_close_window(w, ro_gui_401login_close);
|
ro_gui_wimp_event_register_close_window(w, ro_gui_401login_close);
|
||||||
ro_gui_wimp_event_set_user_data(w, session);
|
ro_gui_wimp_event_set_user_data(w, session);
|
||||||
|
|
||||||
ro_gui_dialog_open_persistent(bw->window->window, w, false);
|
ro_gui_dialog_open_persistent(NULL, w, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -189,6 +190,10 @@ void ro_gui_401login_close(wimp_w w)
|
||||||
|
|
||||||
assert(session);
|
assert(session);
|
||||||
|
|
||||||
|
/* If ok didn't happen, send failure response */
|
||||||
|
if (session->cb != NULL)
|
||||||
|
session->cb(false, session->cbpw);
|
||||||
|
|
||||||
free(session->host);
|
free(session->host);
|
||||||
free(session->realm);
|
free(session->realm);
|
||||||
free(session->url);
|
free(session->url);
|
||||||
|
@ -229,7 +234,12 @@ bool ro_gui_401login_apply(wimp_w w)
|
||||||
|
|
||||||
free(auth);
|
free(auth);
|
||||||
|
|
||||||
browser_window_go(session->bwin, session->url, 0, true);
|
session->cb(true, session->cbpw);
|
||||||
|
|
||||||
|
/* Flag that we sent response by invalidating callback details */
|
||||||
|
session->cb = NULL;
|
||||||
|
session->cbpw = NULL;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,9 +62,11 @@ static wimp_window *dialog_display_template;
|
||||||
struct session_data {
|
struct session_data {
|
||||||
struct session_cert *certs;
|
struct session_cert *certs;
|
||||||
unsigned long num;
|
unsigned long num;
|
||||||
struct browser_window *bw;
|
|
||||||
char *url;
|
char *url;
|
||||||
struct tree *tree;
|
struct tree *tree;
|
||||||
|
|
||||||
|
nserror (*cb)(bool proceed, void *pw);
|
||||||
|
void *cbpw;
|
||||||
};
|
};
|
||||||
struct session_cert {
|
struct session_cert {
|
||||||
char version[16], valid_from[32], valid_to[32], type[8], serial[32];
|
char version[16], valid_from[32], valid_to[32], type[8], serial[32];
|
||||||
|
@ -100,8 +102,9 @@ void ro_gui_cert_init(void)
|
||||||
* Open the certificate verification dialog
|
* Open the certificate verification dialog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void gui_cert_verify(struct browser_window *bw, hlcache_handle *c,
|
void gui_cert_verify(const char *url,
|
||||||
const struct ssl_cert_info *certs, unsigned long num)
|
const struct ssl_cert_info *certs, unsigned long num,
|
||||||
|
nserror (*cb)(bool proceed, void *pw), void *cbpw)
|
||||||
{
|
{
|
||||||
wimp_w w;
|
wimp_w w;
|
||||||
wimp_w ssl_w;
|
wimp_w ssl_w;
|
||||||
|
@ -115,7 +118,7 @@ void gui_cert_verify(struct browser_window *bw, hlcache_handle *c,
|
||||||
os_error *error;
|
os_error *error;
|
||||||
long i;
|
long i;
|
||||||
|
|
||||||
assert(bw && c && certs);
|
assert(certs);
|
||||||
|
|
||||||
/* copy the certificate information */
|
/* copy the certificate information */
|
||||||
data = calloc(1, sizeof(struct session_data));
|
data = calloc(1, sizeof(struct session_data));
|
||||||
|
@ -123,13 +126,14 @@ void gui_cert_verify(struct browser_window *bw, hlcache_handle *c,
|
||||||
warn_user("NoMemory", 0);
|
warn_user("NoMemory", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
data->url = strdup(content_get_url(c));
|
data->url = strdup(url);
|
||||||
if (!data->url) {
|
if (!data->url) {
|
||||||
free(data);
|
free(data);
|
||||||
warn_user("NoMemory", 0);
|
warn_user("NoMemory", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
data->bw = bw;
|
data->cb = cb;
|
||||||
|
data->cbpw = cbpw;
|
||||||
data->num = num;
|
data->num = num;
|
||||||
data->certs = calloc(num, sizeof(struct session_cert));
|
data->certs = calloc(num, sizeof(struct session_cert));
|
||||||
if (!data->certs) {
|
if (!data->certs) {
|
||||||
|
@ -182,7 +186,7 @@ void gui_cert_verify(struct browser_window *bw, hlcache_handle *c,
|
||||||
ro_gui_wimp_event_set_user_data(ssl_w, data);
|
ro_gui_wimp_event_set_user_data(ssl_w, data);
|
||||||
ro_gui_wimp_event_register_cancel(ssl_w, ICON_SSL_REJECT);
|
ro_gui_wimp_event_register_cancel(ssl_w, ICON_SSL_REJECT);
|
||||||
ro_gui_wimp_event_register_ok(ssl_w, ICON_SSL_ACCEPT, ro_gui_cert_apply);
|
ro_gui_wimp_event_register_ok(ssl_w, ICON_SSL_ACCEPT, ro_gui_cert_apply);
|
||||||
ro_gui_dialog_open_persistent(bw->window->window, ssl_w, false);
|
ro_gui_dialog_open_persistent(NULL, ssl_w, false);
|
||||||
|
|
||||||
/* create a tree window (styled as a list) */
|
/* create a tree window (styled as a list) */
|
||||||
error = xwimp_create_window(dialog_tree_template, &w);
|
error = xwimp_create_window(dialog_tree_template, &w);
|
||||||
|
@ -391,6 +395,10 @@ void ro_gui_cert_close(wimp_w w)
|
||||||
data = (struct session_data *)ro_gui_wimp_event_get_user_data(w);
|
data = (struct session_data *)ro_gui_wimp_event_get_user_data(w);
|
||||||
assert(data);
|
assert(data);
|
||||||
|
|
||||||
|
/* If we didn't accept the certificate, send failure response */
|
||||||
|
if (data->cb != NULL)
|
||||||
|
data->cb(false, data->cbpw);
|
||||||
|
|
||||||
for (i = 0; i < data->num; i++) {
|
for (i = 0; i < data->num; i++) {
|
||||||
if (data->certs[i].subject)
|
if (data->certs[i].subject)
|
||||||
ro_textarea_destroy(data->certs[i].subject);
|
ro_textarea_destroy(data->certs[i].subject);
|
||||||
|
@ -434,7 +442,12 @@ bool ro_gui_cert_apply(wimp_w w)
|
||||||
assert(session);
|
assert(session);
|
||||||
|
|
||||||
urldb_set_cert_permissions(session->url, true);
|
urldb_set_cert_permissions(session->url, true);
|
||||||
browser_window_go(session->bw, session->url, 0, true);
|
session->cb(true, session->cbpw);
|
||||||
|
|
||||||
|
/* Flag that we sent response by invalidating callback details */
|
||||||
|
session->cb = NULL;
|
||||||
|
session->cbpw = NULL;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue