Display certificate subject in list rather than issuer
svn path=/trunk/netsurf/; revision=2760
This commit is contained in:
parent
2ebc9d2c50
commit
dc612b767c
|
@ -49,8 +49,8 @@ static wimp_window *dialog_cert_template;
|
|||
static wimp_window *dialog_display_template;
|
||||
|
||||
struct session_data {
|
||||
struct session_cert *certs;
|
||||
unsigned long num;
|
||||
struct session_cert *certs;
|
||||
unsigned long num;
|
||||
struct browser_window *bw;
|
||||
char *url;
|
||||
struct tree *tree;
|
||||
|
@ -76,7 +76,7 @@ void ro_gui_cert_init(void)
|
|||
dialog_tree_template = ro_gui_dialog_load_template("tree");
|
||||
dialog_cert_template = ro_gui_dialog_load_template("sslcert");
|
||||
dialog_display_template = ro_gui_dialog_load_template("ssldisplay");
|
||||
|
||||
|
||||
dialog_tree_template->flags &= ~(wimp_WINDOW_MOVEABLE |
|
||||
wimp_WINDOW_BACK_ICON |
|
||||
wimp_WINDOW_CLOSE_ICON |
|
||||
|
@ -114,7 +114,7 @@ void gui_cert_verify(struct browser_window *bw, struct content *c,
|
|||
}
|
||||
data->url = strdup(c->url);
|
||||
if (!data->url) {
|
||||
free(data);
|
||||
free(data);
|
||||
warn_user("NoMemory", 0);
|
||||
return;
|
||||
}
|
||||
|
@ -122,28 +122,28 @@ void gui_cert_verify(struct browser_window *bw, struct content *c,
|
|||
data->num = num;
|
||||
data->certs = calloc(num, sizeof(struct session_cert));
|
||||
if (!data->certs) {
|
||||
free(data->url);
|
||||
free(data);
|
||||
free(data->url);
|
||||
free(data);
|
||||
warn_user("NoMemory", 0);
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < (long)num; i++) {
|
||||
to = &data->certs[i];
|
||||
from = &certs[i];
|
||||
to->subject_t = strdup(from->subject);
|
||||
to->issuer_t = strdup(from->issuer);
|
||||
if ((!to->subject_t) || (!to->issuer_t)) {
|
||||
for (; i >= 0; i--) {
|
||||
to = &data->certs[i];
|
||||
free(to->subject_t);
|
||||
free(to->issuer_t);
|
||||
}
|
||||
free(data->certs);
|
||||
free(data->url);
|
||||
free(data);
|
||||
to = &data->certs[i];
|
||||
from = &certs[i];
|
||||
to->subject_t = strdup(from->subject);
|
||||
to->issuer_t = strdup(from->issuer);
|
||||
if ((!to->subject_t) || (!to->issuer_t)) {
|
||||
for (; i >= 0; i--) {
|
||||
to = &data->certs[i];
|
||||
free(to->subject_t);
|
||||
free(to->issuer_t);
|
||||
}
|
||||
free(data->certs);
|
||||
free(data->url);
|
||||
free(data);
|
||||
warn_user("NoMemory", 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
snprintf(to->version, sizeof data->certs->version, "%ld",
|
||||
from->version);
|
||||
snprintf(to->valid_from, sizeof data->certs->valid_from, "%s",
|
||||
|
@ -159,14 +159,14 @@ void gui_cert_verify(struct browser_window *bw, struct content *c,
|
|||
/* create the SSL window */
|
||||
error = xwimp_create_window(dialog_cert_template, &ssl_w);
|
||||
if (error) {
|
||||
free(data->certs);
|
||||
free(data->url);
|
||||
free(data);
|
||||
free(data->certs);
|
||||
free(data->url);
|
||||
free(data);
|
||||
LOG(("xwimp_create_window: 0x%x: %s",
|
||||
error->errnum, error->errmess));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* automated SSL window event handling */
|
||||
ro_gui_wimp_event_set_user_data(ssl_w, data);
|
||||
ro_gui_wimp_event_register_cancel(ssl_w, ICON_SSL_REJECT);
|
||||
|
@ -176,20 +176,20 @@ void gui_cert_verify(struct browser_window *bw, struct content *c,
|
|||
/* create a tree window (styled as a list) */
|
||||
error = xwimp_create_window(dialog_tree_template, &w);
|
||||
if (error) {
|
||||
ro_gui_cert_close(ssl_w);
|
||||
ro_gui_cert_close(ssl_w);
|
||||
LOG(("xwimp_create_window: 0x%x: %s",
|
||||
error->errnum, error->errmess));
|
||||
return;
|
||||
}
|
||||
tree = calloc(sizeof(struct tree), 1);
|
||||
if (!tree) {
|
||||
ro_gui_cert_close(ssl_w);
|
||||
ro_gui_cert_close(ssl_w);
|
||||
warn_user("NoMemory", 0);
|
||||
return;
|
||||
}
|
||||
tree->root = tree_create_folder_node(NULL, "Root");
|
||||
if (!tree->root) {
|
||||
ro_gui_cert_close(ssl_w);
|
||||
ro_gui_cert_close(ssl_w);
|
||||
warn_user("NoMemory", 0);
|
||||
free(tree);
|
||||
tree = NULL;
|
||||
|
@ -204,13 +204,13 @@ void gui_cert_verify(struct browser_window *bw, struct content *c,
|
|||
|
||||
/* put the SSL names in the tree */
|
||||
for (i = 0; i < (long)num; i++) {
|
||||
node = tree_create_leaf_node(tree->root, certs[i].issuer);
|
||||
if (node) {
|
||||
node->data.data = TREE_ELEMENT_SSL;
|
||||
tree_set_node_sprite(node, "small_xxx", "small_xxx");
|
||||
}
|
||||
node = tree_create_leaf_node(tree->root, certs[i].subject);
|
||||
if (node) {
|
||||
node->data.data = TREE_ELEMENT_SSL;
|
||||
tree_set_node_sprite(node, "small_xxx", "small_xxx");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* automated treeview event handling */
|
||||
ro_gui_wimp_event_set_user_data(w, tree);
|
||||
ro_gui_wimp_event_register_keypress(w, ro_gui_tree_keypress);
|
||||
|
@ -223,7 +223,7 @@ void gui_cert_verify(struct browser_window *bw, struct content *c,
|
|||
state.w = ssl_w;
|
||||
error = xwimp_get_window_state(&state);
|
||||
if (error) {
|
||||
ro_gui_cert_close(ssl_w);
|
||||
ro_gui_cert_close(ssl_w);
|
||||
LOG(("xwimp_get_window_state: 0x%x: %s",
|
||||
error->errnum, error->errmess));
|
||||
return;
|
||||
|
@ -233,7 +233,7 @@ void gui_cert_verify(struct browser_window *bw, struct content *c,
|
|||
istate.i = ICON_SSL_PANE;
|
||||
error = xwimp_get_icon_state(&istate);
|
||||
if (error) {
|
||||
ro_gui_cert_close(ssl_w);
|
||||
ro_gui_cert_close(ssl_w);
|
||||
LOG(("xwimp_get_icon_state: 0x%x: %s",
|
||||
error->errnum, error->errmess));
|
||||
return;
|
||||
|
@ -254,7 +254,7 @@ void gui_cert_verify(struct browser_window *bw, struct content *c,
|
|||
wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
|
||||
<< wimp_CHILD_RS_EDGE_SHIFT);
|
||||
if (error) {
|
||||
ro_gui_cert_close(ssl_w);
|
||||
ro_gui_cert_close(ssl_w);
|
||||
LOG(("xwimp_open_window_nested: 0x%x: %s",
|
||||
error->errnum, error->errmess));
|
||||
return;
|
||||
|
@ -273,9 +273,9 @@ void ro_gui_cert_open(struct tree *tree, struct node *node)
|
|||
wimp_w w;
|
||||
unsigned long i;
|
||||
os_error *error;
|
||||
|
||||
|
||||
assert(tree->root);
|
||||
|
||||
|
||||
/* firstly we need to get our node index in the list */
|
||||
for (n = tree->root->child, i = 0; n; i++, n = n->next)
|
||||
if (n == node)
|
||||
|
@ -285,7 +285,7 @@ void ro_gui_cert_open(struct tree *tree, struct node *node)
|
|||
/* now we get the handle of our list window */
|
||||
child = (wimp_w)tree->handle;
|
||||
assert(child);
|
||||
|
||||
|
||||
/* now we can get the linked parent handle */
|
||||
state.w = child;
|
||||
error = xwimp_get_window_state_and_nesting(&state, &parent, 0);
|
||||
|
@ -296,12 +296,12 @@ void ro_gui_cert_open(struct tree *tree, struct node *node)
|
|||
return;
|
||||
}
|
||||
assert(parent);
|
||||
|
||||
|
||||
/* from this we can get our session data */
|
||||
data = (struct session_data *)ro_gui_wimp_event_get_user_data(parent);
|
||||
assert(data);
|
||||
assert(data->tree == tree);
|
||||
|
||||
|
||||
/* and finally the nodes session certificate data */
|
||||
session = &data->certs[i];
|
||||
assert(session);
|
||||
|
@ -372,7 +372,7 @@ void ro_gui_cert_close(wimp_w w)
|
|||
|
||||
data = (struct session_data *)ro_gui_wimp_event_get_user_data(w);
|
||||
assert(data);
|
||||
|
||||
|
||||
for (i = 0; i < data->num; i++) {
|
||||
if (data->certs[i].subject)
|
||||
textarea_destroy(data->certs[i].subject);
|
||||
|
@ -382,16 +382,16 @@ void ro_gui_cert_close(wimp_w w)
|
|||
free(data->certs);
|
||||
free(data->url);
|
||||
free(data);
|
||||
|
||||
|
||||
if (data->tree) {
|
||||
tree_delete_node(data->tree, data->tree->root, false);
|
||||
tree_delete_node(data->tree, data->tree->root, false);
|
||||
xwimp_delete_window((wimp_w)data->tree->handle);
|
||||
free(data->tree);
|
||||
}
|
||||
xwimp_delete_window(w);
|
||||
|
||||
|
||||
ro_gui_wimp_event_finalise(w);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -412,7 +412,7 @@ bool ro_gui_cert_apply(wimp_w w)
|
|||
bool ro_gui_cert_click(wimp_pointer *pointer)
|
||||
{
|
||||
struct tree *tree;
|
||||
|
||||
|
||||
tree = (struct tree *)ro_gui_wimp_event_get_user_data(pointer->w);
|
||||
ro_gui_tree_click(pointer, tree);
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue