/usr/include/gnucash/gnc-keyring.h is in gnucash-common 1:2.6.15-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | /*
* gnc-keyring.h -- utility functions to store and retrieve passwords.
*
* Copyright (C) 2010 Geert Janssens <janssens.geert@telenet.be>
*
* 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, contact:
*
* Free Software Foundation Voice: +1-617-542-5942
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
* Boston, MA 02110-1301, USA gnu@gnu.org
*/
/** @addtogroup GUI
@{ */
/** @addtogroup GUIUtility
@{ */
/** @file gnc-keyring.h
@brief Functions to save and retrieve passwords.
@author Copyright (C) 2010 Geert Janssens <janssens-geert@telenet.be>
GnuCash needs passwords for some of the services it uses, like
connecting to a remote database, or bank. For security these passwords
shouldn't be stored unless in an encrypted password store. This is
implemented for example in Gnome's keyring or Mac OS X' keychain.
This file defines some convenience functions to store a password
or to retrieve one.
*/
#ifndef KEYRING_H_
#define KEYRING_H_
#include <glib.h>
#include <gtk/gtk.h>
/** Attempt to store a password in some trusted keystore. At this point
* that can be Gnome's keyring or Mac OS X' keychain. If no
* such keystore is available, this function does nothing.
*
* All the parameters passed (except for the password) will be
* used to create a unique key, so the password can later be
* retrieved again with the same parameters.
*
* @param access_method Service type the user attempts to access. Can
* things like 'mysql', 'postgres' and so on.
* @param server Server the user wishes to connect to.
* @param port Port the service listens on. If set to 0, it will
* be ignored in the search for a password.
* @param service The service the user wishes to access on the server.
* This can be a database name or a path.
* @param user The username to access the service.
* @param password The password to access the service.
*/
void gnc_keyring_set_password ( const gchar *access_method,
const gchar *server,
guint32 port,
const gchar *service,
const gchar *user,
const gchar* password );
/** Attempt to retrieve a password to connect to
* a remote service. This is deliberately generic: the remote
* service can be a database, website, anything.
*
* If a trusted keystore infrastructure is found (such as the
* Gnome's keyring or Mac OS X' keychain) this infrastructure
* will be queried first.
*
* If no such infrastructure is available or the query didn't
* return a valid result, the user will be prompted for his
* password.
*
* @warning When the user is prompted for a password, he can also
* change the username. So whenever you call this function, read
* both the username and password values before you continue !
*
* @param parent Used to transition from in case the user is prompted
* for a password.
* @param access_method Service type the user attempts to access. Can
* things like 'mysql', 'postgres' and so on.
* @param server Server the user wishes to connect to.
* @param port Port the service listens on. If set to 0, it will
* be ignored in the search for a password.
* @param service The service the user wishes to access on the server.
* This can be a database name or a path.
* @param user The user name to access the service. Remember, although
* you pass it to search for the password, it can have
* changed when the function returns.
* @param password The password to access the service.
* @return a boolean indicating whether or not a valid password
* has been retrieved. The function will return FALSE
* when the user explicitly cancels the password dialog or
* if it wasn't called properly. Otherwise it wil return
* TRUE.
*
* access_method, server, port, service and user will be the parameters
* passed to the trusted keystore (if available) to find the unique
* password for this service.
*/
gboolean gnc_keyring_get_password ( GtkWidget *parent,
const gchar *access_method,
const gchar *server,
guint32 port,
const gchar *service,
gchar **user,
gchar **password );
/* @} */
/* @} */
#endif /* KEYRING_H_ */
|