Display certificate subject in list rather than issuer

svn path=/trunk/netsurf/; revision=2760
This commit is contained in:
John Mark Bell 2006-07-16 00:47:20 +00:00
parent 2ebc9d2c50
commit dc612b767c

View File

@ -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;
@ -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,9 +159,9 @@ 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;
@ -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,11 +204,11 @@ 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 */
@ -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;
@ -384,7 +384,7 @@ void ro_gui_cert_close(wimp_w w)
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);
}