|
|
|
@ -20,8 +20,557 @@
|
|
|
|
|
*
|
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
|
|
// NOTE TODO: We need to check for null pointers on all callbacks.
|
|
|
|
|
|
|
|
|
|
#include "ad_gk.h"
|
|
|
|
|
|
|
|
|
|
// START FOR DYNAMIC LINKING
|
|
|
|
|
#include <micasa_types.h>
|
|
|
|
|
#include <dlfcn.h>
|
|
|
|
|
|
|
|
|
|
// handle to gnome-keyring library
|
|
|
|
|
static void *gnomeIDK = NULL;
|
|
|
|
|
static char *GNOME_KEYRING_NDK = "libgnome-keyring.so";
|
|
|
|
|
|
|
|
|
|
// function typedefs
|
|
|
|
|
SSCS_TYPEDEF_LIBCALL(gpointer, GNOME_KEYRING_UNLOCK_T)
|
|
|
|
|
(const char *keyring,
|
|
|
|
|
const char *password,
|
|
|
|
|
GnomeKeyringOperationDoneCallback callback,
|
|
|
|
|
gpointer data,
|
|
|
|
|
GDestroyNotify destroy_data);
|
|
|
|
|
|
|
|
|
|
SSCS_TYPEDEF_LIBCALL(gpointer, GNOME_KEYRING_ITEM_CREATE_T)
|
|
|
|
|
(const char *keyring,
|
|
|
|
|
GnomeKeyringItemType type,
|
|
|
|
|
const char *display_name,
|
|
|
|
|
GnomeKeyringAttributeList *attributes,
|
|
|
|
|
const char *secret,
|
|
|
|
|
gboolean update_if_exists,
|
|
|
|
|
GnomeKeyringOperationGetIntCallback callback,
|
|
|
|
|
gpointer data,
|
|
|
|
|
GDestroyNotify destroy_data);
|
|
|
|
|
|
|
|
|
|
SSCS_TYPEDEF_LIBCALL(gpointer, GNOME_KEYRING_CREATE_T)
|
|
|
|
|
(const char *keyring_name,
|
|
|
|
|
const char *password,
|
|
|
|
|
GnomeKeyringOperationDoneCallback callback,
|
|
|
|
|
gpointer data,
|
|
|
|
|
GDestroyNotify destroy_data);
|
|
|
|
|
|
|
|
|
|
SSCS_TYPEDEF_LIBCALL(gpointer, GNOME_KEYRING_LIST_KEYRING_NAMES_T)
|
|
|
|
|
(GnomeKeyringOperationGetListCallback callback,
|
|
|
|
|
gpointer data,
|
|
|
|
|
GDestroyNotify destroy_data);
|
|
|
|
|
|
|
|
|
|
SSCS_TYPEDEF_LIBCALL(gpointer, GNOME_KEYRING_GET_INFO_T)
|
|
|
|
|
(const char *keyring,
|
|
|
|
|
GnomeKeyringOperationGetKeyringInfoCallback callback,
|
|
|
|
|
gpointer data,
|
|
|
|
|
GDestroyNotify destroy_data);
|
|
|
|
|
SSCS_TYPEDEF_LIBCALL(gpointer, GNOME_KEYRING_SET_INFO_T)
|
|
|
|
|
(const char *keyring,
|
|
|
|
|
GnomeKeyringInfo *info,
|
|
|
|
|
GnomeKeyringOperationDoneCallback callback,
|
|
|
|
|
gpointer data,
|
|
|
|
|
GDestroyNotify destroy_data);
|
|
|
|
|
|
|
|
|
|
SSCS_TYPEDEF_LIBCALL(gpointer, GNOME_KEYRING_LIST_ITEM_IDS_T)
|
|
|
|
|
(const char *keyring,
|
|
|
|
|
GnomeKeyringOperationGetListCallback callback,
|
|
|
|
|
gpointer data,
|
|
|
|
|
GDestroyNotify destroy_data);
|
|
|
|
|
SSCS_TYPEDEF_LIBCALL(gpointer, GNOME_KEYRING_ITEM_GET_INFO_T)
|
|
|
|
|
(const char *keyring,
|
|
|
|
|
guint32 id,
|
|
|
|
|
GnomeKeyringOperationGetItemInfoCallback callback,
|
|
|
|
|
gpointer data,
|
|
|
|
|
GDestroyNotify destroy_data);
|
|
|
|
|
SSCS_TYPEDEF_LIBCALL(gpointer, GNOME_KEYRING_ITEM_SET_INFO_T)
|
|
|
|
|
(const char *keyring,
|
|
|
|
|
guint32 id,
|
|
|
|
|
GnomeKeyringItemInfo *info,
|
|
|
|
|
GnomeKeyringOperationDoneCallback callback,
|
|
|
|
|
gpointer data,
|
|
|
|
|
GDestroyNotify destroy_data);
|
|
|
|
|
SSCS_TYPEDEF_LIBCALL(gpointer, GNOME_KEYRING_ITEM_GET_ATTRIBUTES_T)
|
|
|
|
|
(const char *keyring,
|
|
|
|
|
guint32 id,
|
|
|
|
|
GnomeKeyringOperationGetAttributesCallback callback,
|
|
|
|
|
gpointer data,
|
|
|
|
|
GDestroyNotify destroy_data);
|
|
|
|
|
SSCS_TYPEDEF_LIBCALL(gpointer, GNOME_KEYRING_ITEM_SET_ATTRIBUTES_T)
|
|
|
|
|
(const char *keyring,
|
|
|
|
|
guint32 id,
|
|
|
|
|
GnomeKeyringAttributeList *attributes,
|
|
|
|
|
GnomeKeyringOperationDoneCallback callback,
|
|
|
|
|
gpointer data,
|
|
|
|
|
GDestroyNotify destroy_data);
|
|
|
|
|
SSCS_TYPEDEF_LIBCALL(gpointer, GNOME_KEYRING_ITEM_DELETE_T)
|
|
|
|
|
(const char *keyring,
|
|
|
|
|
guint32 id,
|
|
|
|
|
GnomeKeyringOperationDoneCallback callback,
|
|
|
|
|
gpointer data,
|
|
|
|
|
GDestroyNotify destroy_data);
|
|
|
|
|
|
|
|
|
|
SSCS_TYPEDEF_LIBCALL_PTR(GnomeKeyringItemInfo, GNOME_KEYRING_ITEM_INFO_NEW_T)
|
|
|
|
|
();
|
|
|
|
|
|
|
|
|
|
// check this
|
|
|
|
|
SSCS_TYPEDEF_LIBCALL(void, GNOME_KEYRING_ITEM_INFO_SET_SECRET_T)
|
|
|
|
|
(GnomeKeyringItemInfo *item_info,
|
|
|
|
|
const char *value);
|
|
|
|
|
|
|
|
|
|
SSCS_TYPEDEF_LIBCALL_PTR(char, GNOME_KEYRING_ITEM_INFO_GET_SECRET_T)
|
|
|
|
|
(GnomeKeyringItemInfo *item_info);
|
|
|
|
|
|
|
|
|
|
SSCS_TYPEDEF_LIBCALL(void, GNOME_KEYRING_ITEM_INFO_FREE_T)
|
|
|
|
|
(GnomeKeyringItemInfo *item_info);
|
|
|
|
|
|
|
|
|
|
SSCS_TYPEDEF_LIBCALL(void, GNOME_KEYRING_ATTRIBUTE_LIST_FREE_T)
|
|
|
|
|
(GnomeKeyringAttributeList *attributes);
|
|
|
|
|
|
|
|
|
|
SSCS_TYPEDEF_LIBCALL(time_t, GNOME_KEYRING_INFO_GET_MTIME_T)
|
|
|
|
|
(GnomeKeyringInfo *keyring_info);
|
|
|
|
|
|
|
|
|
|
SSCS_TYPEDEF_LIBCALL(time_t, GNOME_KEYRING_INFO_GET_CTIME_T)
|
|
|
|
|
(GnomeKeyringInfo *keyring_info);
|
|
|
|
|
|
|
|
|
|
SSCS_TYPEDEF_LIBCALL(gboolean, GNOME_KEYRING_INFO_GET_IS_LOCKED_T)
|
|
|
|
|
(GnomeKeyringInfo *keyring_info);
|
|
|
|
|
|
|
|
|
|
SSCS_TYPEDEF_LIBCALL(guint32, GNOME_KEYRING_INFO_GET_LOCK_TIMEOUT_T)
|
|
|
|
|
(GnomeKeyringInfo *keyring_info);
|
|
|
|
|
|
|
|
|
|
SSCS_TYPEDEF_LIBCALL(gboolean, GNOME_KEYRING_INFO_GET_LOCK_ON_IDLE_T)
|
|
|
|
|
(GnomeKeyringInfo *keyring_info);
|
|
|
|
|
|
|
|
|
|
SSCS_TYPEDEF_LIBCALL(time_t, GNOME_KEYRING_ITEM_INFO_GET_MTIME_T)
|
|
|
|
|
(GnomeKeyringItemInfo *item_info);
|
|
|
|
|
|
|
|
|
|
SSCS_TYPEDEF_LIBCALL(time_t, GNOME_KEYRING_ITEM_INFO_GET_CTIME_T)
|
|
|
|
|
(GnomeKeyringItemInfo *item_info);
|
|
|
|
|
|
|
|
|
|
SSCS_TYPEDEF_LIBCALL_PTR(char, GNOME_KEYRING_ITEM_INFO_GET_DISPLAY_NAME_T)
|
|
|
|
|
(GnomeKeyringItemInfo *item_info);
|
|
|
|
|
|
|
|
|
|
SSCS_TYPEDEF_LIBCALL(GnomeKeyringItemType, GNOME_KEYRING_ITEM_INFO_GET_TYPE_T)
|
|
|
|
|
(GnomeKeyringItemInfo *item_info);
|
|
|
|
|
|
|
|
|
|
static GNOME_KEYRING_UNLOCK_T p_gnome_keyring_unlock = NULL;
|
|
|
|
|
static GNOME_KEYRING_ITEM_CREATE_T p_gnome_keyring_item_create = NULL;
|
|
|
|
|
static GNOME_KEYRING_CREATE_T p_gnome_keyring_create = NULL;
|
|
|
|
|
static GNOME_KEYRING_LIST_KEYRING_NAMES_T p_gnome_keyring_list_keyring_names = NULL;
|
|
|
|
|
static GNOME_KEYRING_GET_INFO_T p_gnome_keyring_get_info = NULL;
|
|
|
|
|
static GNOME_KEYRING_SET_INFO_T p_gnome_keyring_set_info = NULL;
|
|
|
|
|
static GNOME_KEYRING_LIST_ITEM_IDS_T p_gnome_keyring_list_item_ids = NULL;
|
|
|
|
|
static GNOME_KEYRING_ITEM_GET_INFO_T p_gnome_keyring_item_get_info = NULL;
|
|
|
|
|
static GNOME_KEYRING_ITEM_SET_INFO_T p_gnome_keyring_item_set_info = NULL;
|
|
|
|
|
static GNOME_KEYRING_ITEM_GET_ATTRIBUTES_T p_gnome_keyring_item_get_attributes = NULL;
|
|
|
|
|
static GNOME_KEYRING_ITEM_SET_ATTRIBUTES_T p_gnome_keyring_item_set_attributes = NULL;
|
|
|
|
|
static GNOME_KEYRING_ITEM_DELETE_T p_gnome_keyring_item_delete = NULL;
|
|
|
|
|
static GNOME_KEYRING_ITEM_INFO_NEW_T p_gnome_keyring_item_info_new = NULL;
|
|
|
|
|
static GNOME_KEYRING_ITEM_INFO_SET_SECRET_T p_gnome_keyring_item_info_set_secret = NULL;
|
|
|
|
|
static GNOME_KEYRING_ITEM_INFO_GET_SECRET_T p_gnome_keyring_item_info_get_secret = NULL;
|
|
|
|
|
static GNOME_KEYRING_ITEM_INFO_FREE_T p_gnome_keyring_item_info_free = NULL;
|
|
|
|
|
static GNOME_KEYRING_ATTRIBUTE_LIST_FREE_T p_gnome_keyring_attribute_list_free = NULL;
|
|
|
|
|
static GNOME_KEYRING_INFO_GET_MTIME_T p_gnome_keyring_info_get_mtime = NULL;
|
|
|
|
|
static GNOME_KEYRING_INFO_GET_CTIME_T p_gnome_keyring_info_get_ctime = NULL;
|
|
|
|
|
static GNOME_KEYRING_INFO_GET_IS_LOCKED_T p_gnome_keyring_info_get_is_locked = NULL;
|
|
|
|
|
static GNOME_KEYRING_INFO_GET_LOCK_TIMEOUT_T p_gnome_keyring_info_get_lock_timeout = NULL;
|
|
|
|
|
static GNOME_KEYRING_INFO_GET_LOCK_ON_IDLE_T p_gnome_keyring_info_get_lock_on_idle = NULL;
|
|
|
|
|
static GNOME_KEYRING_ITEM_INFO_GET_MTIME_T p_gnome_keyring_item_info_get_mtime = NULL;
|
|
|
|
|
static GNOME_KEYRING_ITEM_INFO_GET_CTIME_T p_gnome_keyring_item_info_get_ctime = NULL;
|
|
|
|
|
static GNOME_KEYRING_ITEM_INFO_GET_DISPLAY_NAME_T p_gnome_keyring_item_info_get_display_name = NULL;
|
|
|
|
|
static GNOME_KEYRING_ITEM_INFO_GET_TYPE_T p_gnome_keyring_item_info_get_type = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// functions
|
|
|
|
|
//***********************************************************************************************
|
|
|
|
|
gpointer casa_gnome_keyring_list_keyring_names(
|
|
|
|
|
GnomeKeyringOperationGetListCallback callback,
|
|
|
|
|
gpointer data,
|
|
|
|
|
GDestroyNotify destroy_data)
|
|
|
|
|
{
|
|
|
|
|
if ((!gnomeIDK)
|
|
|
|
|
|| ((p_gnome_keyring_list_keyring_names = (GNOME_KEYRING_LIST_KEYRING_NAMES_T)dlsym(gnomeIDK, "gnome_keyring_list_keyring_names")) == NULL))
|
|
|
|
|
return NULL;
|
|
|
|
|
else
|
|
|
|
|
return(p_gnome_keyring_list_keyring_names (callback, data, destroy_data));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//***********************************************************************************************
|
|
|
|
|
gpointer casa_gnome_keyring_unlock
|
|
|
|
|
(const char *keyring,
|
|
|
|
|
const char *password,
|
|
|
|
|
GnomeKeyringOperationDoneCallback callback,
|
|
|
|
|
gpointer data,
|
|
|
|
|
GDestroyNotify destroy_data)
|
|
|
|
|
{
|
|
|
|
|
if ((!gnomeIDK)
|
|
|
|
|
|| ((p_gnome_keyring_unlock = (GNOME_KEYRING_UNLOCK_T)dlsym(gnomeIDK, "gnome_keyring_unlock")) == NULL))
|
|
|
|
|
return NULL;
|
|
|
|
|
else
|
|
|
|
|
return(p_gnome_keyring_unlock (keyring, password, callback, data, destroy_data));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//***********************************************************************************************
|
|
|
|
|
gpointer casa_gnome_keyring_item_create(
|
|
|
|
|
const char *keyring,
|
|
|
|
|
GnomeKeyringItemType type,
|
|
|
|
|
const char *display_name,
|
|
|
|
|
GnomeKeyringAttributeList *attributes,
|
|
|
|
|
const char *secret,
|
|
|
|
|
gboolean update_if_exists,
|
|
|
|
|
GnomeKeyringOperationGetIntCallback callback,
|
|
|
|
|
gpointer data,
|
|
|
|
|
GDestroyNotify destroy_data)
|
|
|
|
|
{
|
|
|
|
|
if ((!gnomeIDK)
|
|
|
|
|
|| ((p_gnome_keyring_item_create = (GNOME_KEYRING_ITEM_CREATE_T)dlsym(gnomeIDK, "gnome_keyring_item_create")) == NULL))
|
|
|
|
|
return NULL;
|
|
|
|
|
else
|
|
|
|
|
return(p_gnome_keyring_item_create (keyring, type, display_name, attributes, secret, update_if_exists, callback, data, destroy_data));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//***********************************************************************************************
|
|
|
|
|
gpointer casa_gnome_keyring_create(
|
|
|
|
|
const char *keyring_name,
|
|
|
|
|
const char *password,
|
|
|
|
|
GnomeKeyringOperationDoneCallback callback,
|
|
|
|
|
gpointer data,
|
|
|
|
|
GDestroyNotify destroyData)
|
|
|
|
|
{
|
|
|
|
|
if ((!gnomeIDK)
|
|
|
|
|
|| ((p_gnome_keyring_create = (GNOME_KEYRING_CREATE_T)dlsym(gnomeIDK, "gnome_keyring_create")) == NULL))
|
|
|
|
|
return NULL;
|
|
|
|
|
else
|
|
|
|
|
return(p_gnome_keyring_create (keyring_name, password, callback, data, destroyData));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//***********************************************************************************************
|
|
|
|
|
gpointer casa_gnome_keyring_get_info(
|
|
|
|
|
const char *keyring,
|
|
|
|
|
GnomeKeyringOperationGetKeyringInfoCallback callback,
|
|
|
|
|
gpointer data,
|
|
|
|
|
GDestroyNotify destroy_data)
|
|
|
|
|
{
|
|
|
|
|
if ((!gnomeIDK)
|
|
|
|
|
|| ((p_gnome_keyring_get_info = (GNOME_KEYRING_GET_INFO_T)dlsym(gnomeIDK, "gnome_keyring_get_info")) == NULL))
|
|
|
|
|
return NULL;
|
|
|
|
|
else
|
|
|
|
|
return(p_gnome_keyring_get_info (keyring, callback, data, destroy_data));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//***********************************************************************************************
|
|
|
|
|
gpointer casa_gnome_keyring_set_info(
|
|
|
|
|
const char *keyring,
|
|
|
|
|
GnomeKeyringInfo *info,
|
|
|
|
|
GnomeKeyringOperationDoneCallback callback,
|
|
|
|
|
gpointer data,
|
|
|
|
|
GDestroyNotify destroy_data)
|
|
|
|
|
{
|
|
|
|
|
if ((!gnomeIDK)
|
|
|
|
|
|| ((p_gnome_keyring_set_info = (GNOME_KEYRING_SET_INFO_T)dlsym(gnomeIDK, "gnome_keyring_set_info")) == NULL))
|
|
|
|
|
return NULL;
|
|
|
|
|
else
|
|
|
|
|
return(p_gnome_keyring_set_info (keyring, info, callback, data, destroy_data));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//***********************************************************************************************
|
|
|
|
|
gpointer casa_gnome_keyring_list_item_ids(
|
|
|
|
|
const char *keyring,
|
|
|
|
|
GnomeKeyringOperationGetListCallback callback,
|
|
|
|
|
gpointer data,
|
|
|
|
|
GDestroyNotify destroy_data)
|
|
|
|
|
{
|
|
|
|
|
if ((!gnomeIDK)
|
|
|
|
|
|| ((p_gnome_keyring_list_item_ids = (GNOME_KEYRING_LIST_ITEM_IDS_T)dlsym(gnomeIDK, "gnome_keyring_list_item_ids")) == NULL))
|
|
|
|
|
return NULL;
|
|
|
|
|
else
|
|
|
|
|
return(p_gnome_keyring_list_item_ids (keyring, callback, data, destroy_data));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//***********************************************************************************************
|
|
|
|
|
gpointer casa_gnome_keyring_item_get_info(
|
|
|
|
|
const char *keyring,
|
|
|
|
|
guint32 id,
|
|
|
|
|
GnomeKeyringOperationGetItemInfoCallback callback,
|
|
|
|
|
gpointer data,
|
|
|
|
|
GDestroyNotify destroy_data)
|
|
|
|
|
{
|
|
|
|
|
if ((!gnomeIDK)
|
|
|
|
|
|| ((p_gnome_keyring_item_get_info = (GNOME_KEYRING_ITEM_GET_INFO_T)dlsym(gnomeIDK, "gnome_keyring_item_get_info")) == NULL))
|
|
|
|
|
return NULL;
|
|
|
|
|
else
|
|
|
|
|
return(p_gnome_keyring_item_get_info (keyring, id, callback, data, destroy_data));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//***********************************************************************************************
|
|
|
|
|
gpointer casa_gnome_keyring_item_set_info(
|
|
|
|
|
const char *keyring,
|
|
|
|
|
guint32 id,
|
|
|
|
|
GnomeKeyringItemInfo *info,
|
|
|
|
|
GnomeKeyringOperationDoneCallback callback,
|
|
|
|
|
gpointer data,
|
|
|
|
|
GDestroyNotify destroy_data)
|
|
|
|
|
{
|
|
|
|
|
if ((!gnomeIDK)
|
|
|
|
|
|| ((p_gnome_keyring_item_set_info = (GNOME_KEYRING_ITEM_SET_INFO_T)dlsym(gnomeIDK, "gnome_keyring_item_set_info")) == NULL))
|
|
|
|
|
return NULL;
|
|
|
|
|
else
|
|
|
|
|
return(p_gnome_keyring_item_set_info (keyring, id, info, callback, data, destroy_data));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//***********************************************************************************************
|
|
|
|
|
gpointer casa_gnome_keyring_item_get_attributes(
|
|
|
|
|
const char *keyring,
|
|
|
|
|
guint32 id,
|
|
|
|
|
GnomeKeyringOperationGetAttributesCallback callback,
|
|
|
|
|
gpointer data,
|
|
|
|
|
GDestroyNotify destroy_data)
|
|
|
|
|
{
|
|
|
|
|
if ((!gnomeIDK)
|
|
|
|
|
|| ((p_gnome_keyring_item_get_attributes = (GNOME_KEYRING_ITEM_GET_ATTRIBUTES_T)dlsym(gnomeIDK, "gnome_keyring_item_get_attributes")) == NULL))
|
|
|
|
|
return NULL;
|
|
|
|
|
else
|
|
|
|
|
return(p_gnome_keyring_item_get_attributes (keyring, id, callback, data, destroy_data));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//***********************************************************************************************
|
|
|
|
|
gpointer casa_gnome_keyring_item_set_attributes(
|
|
|
|
|
const char *keyring,
|
|
|
|
|
guint32 id,
|
|
|
|
|
GnomeKeyringAttributeList *attributes,
|
|
|
|
|
GnomeKeyringOperationDoneCallback callback,
|
|
|
|
|
gpointer data,
|
|
|
|
|
GDestroyNotify destroy_data)
|
|
|
|
|
{
|
|
|
|
|
if ((!gnomeIDK)
|
|
|
|
|
|| ((p_gnome_keyring_item_set_attributes = (GNOME_KEYRING_ITEM_SET_ATTRIBUTES_T)dlsym(gnomeIDK, "gnome_keyring_item_set_attributes")) == NULL))
|
|
|
|
|
return NULL;
|
|
|
|
|
else
|
|
|
|
|
return(p_gnome_keyring_item_set_attributes (keyring, id, attributes, callback, data, destroy_data));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//***********************************************************************************************
|
|
|
|
|
gpointer casa_gnome_keyring_item_delete(
|
|
|
|
|
const char *keyring,
|
|
|
|
|
guint32 id,
|
|
|
|
|
GnomeKeyringOperationDoneCallback callback,
|
|
|
|
|
gpointer data,
|
|
|
|
|
GDestroyNotify destroy_data)
|
|
|
|
|
{
|
|
|
|
|
if ((!gnomeIDK)
|
|
|
|
|
|| ((p_gnome_keyring_item_delete = (GNOME_KEYRING_ITEM_DELETE_T)dlsym(gnomeIDK, "gnome_keyring_item_delete")) == NULL))
|
|
|
|
|
return NULL;
|
|
|
|
|
else
|
|
|
|
|
return(p_gnome_keyring_item_delete (keyring, id, callback, data, destroy_data));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//***********************************************************************************************
|
|
|
|
|
GnomeKeyringItemInfo* casa_gnome_keyring_item_info_new()
|
|
|
|
|
{
|
|
|
|
|
if ((!gnomeIDK)
|
|
|
|
|
|| ((p_gnome_keyring_item_info_new = (GNOME_KEYRING_ITEM_INFO_NEW_T)dlsym(gnomeIDK, "gnome_keyring_item_info_new")) == NULL))
|
|
|
|
|
return NULL;
|
|
|
|
|
else
|
|
|
|
|
return(p_gnome_keyring_item_info_new ());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//***********************************************************************************************
|
|
|
|
|
void casa_gnome_keyring_item_info_set_secret(GnomeKeyringItemInfo *item_info,
|
|
|
|
|
const char *value)
|
|
|
|
|
{
|
|
|
|
|
if ((!gnomeIDK)
|
|
|
|
|
|| ((p_gnome_keyring_item_info_set_secret = (GNOME_KEYRING_ITEM_INFO_SET_SECRET_T)dlsym(gnomeIDK, "gnome_keyring_item_info_set_secret")) == NULL))
|
|
|
|
|
return;
|
|
|
|
|
else
|
|
|
|
|
return(p_gnome_keyring_item_info_set_secret (item_info, value));
|
|
|
|
|
}
|
|
|
|
|
//***********************************************************************************************
|
|
|
|
|
char * casa_gnome_keyring_item_info_get_secret(GnomeKeyringItemInfo *item_info)
|
|
|
|
|
{
|
|
|
|
|
if ((!gnomeIDK)
|
|
|
|
|
|| ((p_gnome_keyring_item_info_get_secret = (GNOME_KEYRING_ITEM_INFO_GET_SECRET_T)dlsym(gnomeIDK, "gnome_keyring_item_info_get_secret")) == NULL))
|
|
|
|
|
return NULL;
|
|
|
|
|
else
|
|
|
|
|
return(p_gnome_keyring_item_info_get_secret (item_info));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//***********************************************************************************************
|
|
|
|
|
void casa_gnome_keyring_item_info_free(GnomeKeyringItemInfo *item_info)
|
|
|
|
|
{
|
|
|
|
|
if ((!gnomeIDK)
|
|
|
|
|
|| ((p_gnome_keyring_item_info_free = (GNOME_KEYRING_ITEM_INFO_FREE_T)dlsym(gnomeIDK, "gnome_keyring_item_info_free")) == NULL))
|
|
|
|
|
return;
|
|
|
|
|
else
|
|
|
|
|
return(p_gnome_keyring_item_info_free (item_info));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//***********************************************************************************************
|
|
|
|
|
void casa_gnome_keyring_attribute_list_free(GnomeKeyringAttributeList *attributes)
|
|
|
|
|
{
|
|
|
|
|
if ((!gnomeIDK)
|
|
|
|
|
|| ((p_gnome_keyring_attribute_list_free = (GNOME_KEYRING_ATTRIBUTE_LIST_FREE_T)dlsym(gnomeIDK, "gnome_keyring_attribute_list_free")) == NULL))
|
|
|
|
|
return;
|
|
|
|
|
else
|
|
|
|
|
return(p_gnome_keyring_attribute_list_free (attributes));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//***********************************************************************************************
|
|
|
|
|
time_t casa_gnome_keyring_info_get_mtime(GnomeKeyringInfo *keyring_info)
|
|
|
|
|
{
|
|
|
|
|
if ((!gnomeIDK)
|
|
|
|
|
|| ((p_gnome_keyring_info_get_mtime = (GNOME_KEYRING_INFO_GET_MTIME_T)dlsym(gnomeIDK, "gnome_keyring_info_get_mtime")) == NULL))
|
|
|
|
|
return 0;
|
|
|
|
|
else
|
|
|
|
|
return(p_gnome_keyring_info_get_mtime (keyring_info));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//***********************************************************************************************
|
|
|
|
|
time_t casa_gnome_keyring_info_get_ctime(GnomeKeyringInfo *keyring_info)
|
|
|
|
|
{
|
|
|
|
|
if ((!gnomeIDK)
|
|
|
|
|
|| ((p_gnome_keyring_info_get_ctime = (GNOME_KEYRING_INFO_GET_CTIME_T)dlsym(gnomeIDK, "gnome_keyring_info_get_ctime")) == NULL))
|
|
|
|
|
return 0;
|
|
|
|
|
else
|
|
|
|
|
return(p_gnome_keyring_info_get_ctime (keyring_info));
|
|
|
|
|
}
|
|
|
|
|
//***********************************************************************************************
|
|
|
|
|
gboolean casa_gnome_keyring_info_get_is_locked(GnomeKeyringInfo *keyring_info)
|
|
|
|
|
{
|
|
|
|
|
if ((!gnomeIDK)
|
|
|
|
|
|| ((p_gnome_keyring_info_get_is_locked = (GNOME_KEYRING_INFO_GET_IS_LOCKED_T)dlsym(gnomeIDK, "gnome_keyring_info_get_is_locked")) == NULL))
|
|
|
|
|
return TRUE;
|
|
|
|
|
else
|
|
|
|
|
return(p_gnome_keyring_info_get_is_locked (keyring_info));
|
|
|
|
|
}
|
|
|
|
|
//***********************************************************************************************
|
|
|
|
|
guint32 casa_gnome_keyring_info_get_lock_timeout(GnomeKeyringInfo *keyring_info)
|
|
|
|
|
{
|
|
|
|
|
if ((!gnomeIDK)
|
|
|
|
|
|| ((p_gnome_keyring_info_get_lock_timeout = (GNOME_KEYRING_INFO_GET_LOCK_TIMEOUT_T)dlsym(gnomeIDK, "gnome_keyring_info_get_lock_timeout")) == NULL))
|
|
|
|
|
return TRUE;
|
|
|
|
|
else
|
|
|
|
|
return(p_gnome_keyring_info_get_lock_timeout (keyring_info));
|
|
|
|
|
}
|
|
|
|
|
//***********************************************************************************************
|
|
|
|
|
gboolean casa_gnome_keyring_info_get_lock_on_idle(GnomeKeyringInfo *keyring_info)
|
|
|
|
|
{
|
|
|
|
|
if ((!gnomeIDK)
|
|
|
|
|
|| ((p_gnome_keyring_info_get_lock_on_idle = (GNOME_KEYRING_INFO_GET_LOCK_ON_IDLE_T)dlsym(gnomeIDK, "gnome_keyring_info_get_lock_on_idle")) == NULL))
|
|
|
|
|
return FALSE;
|
|
|
|
|
else
|
|
|
|
|
return(p_gnome_keyring_info_get_lock_on_idle (keyring_info));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//***********************************************************************************************
|
|
|
|
|
time_t casa_gnome_keyring_item_info_get_mtime(GnomeKeyringItemInfo *item_info)
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
if ((!gnomeIDK)
|
|
|
|
|
|| ((p_gnome_keyring_item_info_get_mtime = (GNOME_KEYRING_ITEM_INFO_GET_MTIME_T)dlsym(gnomeIDK, "gnome_keyring_item_info_get_mtime")) == NULL))
|
|
|
|
|
return 0;
|
|
|
|
|
else
|
|
|
|
|
return(p_gnome_keyring_item_info_get_mtime (item_info));
|
|
|
|
|
}
|
|
|
|
|
//***********************************************************************************************
|
|
|
|
|
|
|
|
|
|
time_t casa_gnome_keyring_item_info_get_ctime(GnomeKeyringItemInfo *item_info)
|
|
|
|
|
{
|
|
|
|
|
if ((!gnomeIDK)
|
|
|
|
|
|| ((p_gnome_keyring_item_info_get_ctime = (GNOME_KEYRING_ITEM_INFO_GET_CTIME_T)dlsym(gnomeIDK, "gnome_keyring_item_info_get_ctime")) == NULL))
|
|
|
|
|
return 0;
|
|
|
|
|
else
|
|
|
|
|
return(p_gnome_keyring_item_info_get_ctime (item_info));
|
|
|
|
|
}
|
|
|
|
|
//***********************************************************************************************
|
|
|
|
|
|
|
|
|
|
char * casa_gnome_keyring_item_info_get_display_name (GnomeKeyringItemInfo *item_info)
|
|
|
|
|
{
|
|
|
|
|
if ((!gnomeIDK)
|
|
|
|
|
|| ((p_gnome_keyring_item_info_get_display_name = (GNOME_KEYRING_ITEM_INFO_GET_DISPLAY_NAME_T)dlsym(gnomeIDK, "gnome_keyring_item_info_get_display_name")) == NULL))
|
|
|
|
|
return NULL;
|
|
|
|
|
else
|
|
|
|
|
return(p_gnome_keyring_item_info_get_display_name (item_info));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//***********************************************************************************************
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GnomeKeyringItemType casa_gnome_keyring_item_info_get_type (GnomeKeyringItemInfo *item_info)
|
|
|
|
|
{
|
|
|
|
|
if ((!gnomeIDK)
|
|
|
|
|
|| ((p_gnome_keyring_item_info_get_type = (GNOME_KEYRING_ITEM_INFO_GET_TYPE_T)dlsym(gnomeIDK, "gnome_keyring_item_info_get_type")) == NULL))
|
|
|
|
|
return(GNOME_KEYRING_ITEM_NO_TYPE);
|
|
|
|
|
else
|
|
|
|
|
return(p_gnome_keyring_item_info_get_type (item_info));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//***********************************************************************************************
|
|
|
|
|
|
|
|
|
|
#define gnome_keyring_unlock casa_gnome_keyring_unlock
|
|
|
|
|
#define gnome_keyring_item_create casa_gnome_keyring_item_create
|
|
|
|
|
#define gnome_keyring_create casa_gnome_keyring_create
|
|
|
|
|
#define gnome_keyring_list_keyring_names casa_gnome_keyring_list_keyring_names
|
|
|
|
|
#define gnome_keyring_get_info casa_gnome_keyring_get_info
|
|
|
|
|
#define gnome_keyring_set_info casa_gnome_keyring_set_info
|
|
|
|
|
#define gnome_keyring_list_item_ids casa_gnome_keyring_list_item_ids
|
|
|
|
|
#define gnome_keyring_item_get_info casa_gnome_keyring_item_get_info
|
|
|
|
|
#define gnome_keyring_item_set_info casa_gnome_keyring_item_set_info
|
|
|
|
|
#define gnome_keyring_item_get_attributes casa_gnome_keyring_item_get_attributes
|
|
|
|
|
#define gnome_keyring_item_set_attributes casa_gnome_keyring_item_set_attributes
|
|
|
|
|
#define gnome_keyring_item_delete casa_gnome_keyring_item_delete
|
|
|
|
|
#define gnome_keyring_item_info_new casa_gnome_keyring_item_info_new
|
|
|
|
|
#define gnome_keyring_info_get_mtime casa_gnome_keyring_info_get_mtime
|
|
|
|
|
#define gnome_keyring_info_get_ctime casa_gnome_keyring_info_get_ctime
|
|
|
|
|
#define gnome_keyring_info_get_is_locked casa_gnome_keyring_info_get_is_locked
|
|
|
|
|
#define gnome_keyring_info_get_lock_timeout casa_gnome_keyring_info_get_lock_timeout
|
|
|
|
|
#define gnome_keyring_info_get_lock_on_idle casa_gnome_keyring_info_get_lock_on_idle
|
|
|
|
|
#define gnome_keyring_item_info_get_secret casa_gnome_keyring_item_info_get_secret
|
|
|
|
|
#define gnome_keyring_item_info_set_secret casa_gnome_keyring_item_info_set_secret
|
|
|
|
|
#define gnome_keyring_item_info_free casa_gnome_keyring_item_info_free
|
|
|
|
|
#define gnome_keyring_item_info_get_mtime casa_gnome_keyring_item_info_get_mtime
|
|
|
|
|
#define gnome_keyring_item_info_get_ctime casa_gnome_keyring_item_info_get_ctime
|
|
|
|
|
#define gnome_keyring_item_info_get_display_name casa_gnome_keyring_item_info_get_display_name
|
|
|
|
|
#define gnome_keyring_item_info_get_type casa_gnome_keyring_item_info_get_type
|
|
|
|
|
#define gnome_keyring_attribute_list_free casa_gnome_keyring_attribute_list_free
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//***********************************************************************************************
|
|
|
|
|
static int
|
|
|
|
|
LoadGnomeKeyringLibrary()
|
|
|
|
|
{
|
|
|
|
|
if (!gnomeIDK)
|
|
|
|
|
{
|
|
|
|
|
if ((gnomeIDK = dlopen(GNOME_KEYRING_NDK, RTLD_LAZY)) == NULL)
|
|
|
|
|
return FAILURE;
|
|
|
|
|
}
|
|
|
|
|
return SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
ReleaseGnomeKeyringLibrary()
|
|
|
|
|
{
|
|
|
|
|
if (!gnomeIDK)
|
|
|
|
|
{
|
|
|
|
|
dlclose(GNOME_KEYRING_NDK);
|
|
|
|
|
gnomeIDK = NULL;
|
|
|
|
|
}
|
|
|
|
|
return SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// END DYNAMIC LINKING
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//***********************************************************************************************
|
|
|
|
|
GMainLoop *loop = NULL;
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
@ -261,8 +810,6 @@ void ItemGetAttributesCb(GnomeKeyringResult result,
|
|
|
|
|
|
|
|
|
|
int GetKeyrings(GList **keyringList)
|
|
|
|
|
{
|
|
|
|
|
GList *l = NULL;
|
|
|
|
|
|
|
|
|
|
GetKeyringsCbData cbData;
|
|
|
|
|
cbData.loop = g_main_loop_new (NULL, FALSE);
|
|
|
|
|
cbData.keyringList = keyringList;
|
|
|
|
@ -286,8 +833,6 @@ int GetKeyringInfo(char *keyring,KeyringInfo *info)
|
|
|
|
|
|
|
|
|
|
int GetItems(char *keyring, GList **itemList)
|
|
|
|
|
{
|
|
|
|
|
GList *l = NULL;
|
|
|
|
|
gint itemId;
|
|
|
|
|
GetItemsCbData cbData;
|
|
|
|
|
cbData.loop = g_main_loop_new (NULL, FALSE);
|
|
|
|
|
cbData.itemList = itemList;
|
|
|
|
@ -310,7 +855,6 @@ int GetItemInfo(char *keyring, int itemId, ItemInfo *info)
|
|
|
|
|
|
|
|
|
|
int GetAttributeList(char *keyring, int itemId, GList **attrList)
|
|
|
|
|
{
|
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
|
|
GetAttributeListCbData cbData;
|
|
|
|
|
cbData.loop = g_main_loop_new (NULL, FALSE);
|
|
|
|
@ -397,7 +941,7 @@ SetPassword (char *keyring, guint32 itemid, char *secret)
|
|
|
|
|
loop = g_main_loop_new (NULL, FALSE);
|
|
|
|
|
|
|
|
|
|
cbData.OperationName = "Set Item Secret";
|
|
|
|
|
info = gnome_keyring_item_info_new ();
|
|
|
|
|
info = gnome_keyring_item_info_new();
|
|
|
|
|
gnome_keyring_item_info_set_secret (info, secret);
|
|
|
|
|
gnome_keyring_item_set_info (keyring, itemid, info,
|
|
|
|
|
OperationCompletedCb, &cbData, NULL);
|
|
|
|
|