diff options
author | Chris Toshok <toshok@ximian.com> | 2004-01-06 04:49:44 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2004-01-06 04:49:44 +0800 |
commit | 135e1d6968e7205611aea943496f1fd3f5ba04fc (patch) | |
tree | ff25a0c6d048796fad7ea3ca9044169219e0e1d3 /smime/gui/component.c | |
parent | b43eee1113b480b13bcfb51bd5188133ed8f0c1b (diff) | |
download | gsoc2013-evolution-135e1d6968e7205611aea943496f1fd3f5ba04fc.tar.gz gsoc2013-evolution-135e1d6968e7205611aea943496f1fd3f5ba04fc.tar.zst gsoc2013-evolution-135e1d6968e7205611aea943496f1fd3f5ba04fc.zip |
new function, implement the password dialog for PK11 slot authentication.
2004-01-05 Chris Toshok <toshok@ximian.com>
* gui/component.c (smime_pk11_passwd): new function, implement the
password dialog for PK11 slot authentication.
(smime_component_init): new function, initialize any gui related
signals that the backend exposes.
* gui/certificate-manager.c (import_your): use
e_cert_db_import_pkcs12_file.
(delete_your): new function, implement.
(view_your): same.
(backup_your): new function, stub out.
(backup_all_your): same.
(create_yourcerts_treemodel): new function.
(initialize_yourcerts_ui): do all the sorting foo, and hook up all
the signals.
(ainitialize_contactcerts_ui): same.
(initialize_authoritycerts_ui): same.
(view_contact): treemodel -> streemodel.
(view_ca): same.
(delete_contact): same, and convert from the sort iter to the
child iter before we remove.
(delete_ca): same.
(import_contact): call gtk_tree_view_expand_all.
(import_ca): same.
(add_user_cert): append to the child model, not the sort model.
(add_contact_cert): same.
(add_ca_cert): same.
(unload_certs): implement the E_CERT_USER case, and fix the
USER/CA stuff to use the sorted treemodels.
(load_certs): remove spew.
(populate_ui): expand all the tree views.
* lib/.cvsignore: ignore the generated marshalling files.
* lib/Makefile.am: add the marshalling foo.
* lib/smime-marshal.list (BOOL): new file.
* lib/e-cert-db.c (pk11_password): new function, emit the
pk11_passwd signal.
(initialize_nss): new function, split out all the nss init code
here, and add all the PKCS12 cipers.
(install_loadable_roots): new function, split this code out from
the class_init.
(e_cert_db_class_init): call initialize_nss() and
install_loadable_roots(). also register our pk11_passwd signal.
(e_cert_db_import_pkcs12_file): implement.
(e_cert_db_login_to_slot): new function, implement.
* lib/e-cert-db.h (struct _ECertDBClass): add pk11_passwd signal,
and add prototype for e_cert_db_login_to_slot.
* lib/e-pkcs12.c (input_to_decoder): remove spew.
(prompt_for_password): fix this.
(import_from_file_helper): fix fix fix, and remove spew.
(write_export_file): nuke, we don't need this.
svn path=/trunk/; revision=24058
Diffstat (limited to 'smime/gui/component.c')
-rw-r--r-- | smime/gui/component.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/smime/gui/component.c b/smime/gui/component.c new file mode 100644 index 0000000000..7c9658b9d1 --- /dev/null +++ b/smime/gui/component.c @@ -0,0 +1,61 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Authors: Chris Toshok <toshok@ximian.com> + * + * Copyright (C) 2004 Novell, Inc. (www.novell.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. + * + */ + +#include <libgnome/gnome-i18n.h> +#include "e-cert-db.h" +#include "e-util/e-passwords.h" +#include "pk11func.h" + +static gboolean +smime_pk11_passwd (ECertDB *db, PK11SlotInfo* slot, gboolean retry, char **passwd, gpointer arg) +{ + char *prompt; + char *slot_name = g_strdup (PK11_GetSlotName (slot)); + + g_strchomp (slot_name); + + prompt = g_strdup_printf (_("Enter the password for `%s'"), slot_name); + g_free (slot_name); + + *passwd = e_passwords_ask_password (_("Enter password"), NULL, NULL, + prompt, TRUE, + E_PASSWORDS_DO_NOT_REMEMBER, NULL, + NULL); + + g_free (prompt); + + /* this should return FALSE if they canceled. */ + return TRUE; +} + +void +smime_component_init (void) +{ + static gboolean init_done = FALSE; + if (init_done) + return; + + init_done = TRUE; + g_signal_connect (e_cert_db_peek (), + "pk11_passwd", + G_CALLBACK (smime_pk11_passwd), NULL); +} |