diff --git a/c_adlib/GKEngine.cs b/c_adlib/GKEngine.cs index 50989de5..221b2321 100644 --- a/c_adlib/GKEngine.cs +++ b/c_adlib/GKEngine.cs @@ -52,6 +52,11 @@ namespace Novell.CASA.DataEngines public GKEngine() { + } + + ~GKEngine() + { + GnomeKeyring.ReleaseGnomeKeyringLib(); } public XmlNode Aggregate() @@ -292,8 +297,11 @@ namespace Novell.CASA.DataEngines { try { - System.Runtime.InteropServices.Marshal.PrelinkAll(typeof(GnomeKeyring)); - return true; + System.Runtime.InteropServices.Marshal.PrelinkAll(typeof(GnomeKeyring)); + if (GnomeKeyring.IsGnomeKeyringInstalled()) + return true; + else + return false; } catch(DllNotFoundException d) { diff --git a/c_adlib/ad_gk/GnomeKeyring.cs b/c_adlib/ad_gk/GnomeKeyring.cs index c4d08a0c..055dbcc5 100644 --- a/c_adlib/ad_gk/GnomeKeyring.cs +++ b/c_adlib/ad_gk/GnomeKeyring.cs @@ -102,15 +102,32 @@ namespace Novell.CASA.DataEngines.GK [DllImport("libad_gk.so")] public static extern int FreeAttributeList(IntPtr attrList); [DllImport("libad_gk.so")] - public static extern int SetPassword (string keyring, int itemid, string password); - [DllImport("libad_gk.so")] - public static extern int RemoveItem (string keyring, int itemid); - [DllImport("libad_gk.so")] - public static extern int SetItemAttributes (string keyring, int itemid, IntPtr[] attrs, int length); - [DllImport("libad_gk.so")] - public static extern int CreateItem(string keyringName, int itemType, string displayName, string password, IntPtr[] arrptr, int attrCount); - [DllImport("libad_gk.so")] - public static extern int UnlockRing(string sKeyringName, string sPassword); + public static extern int SetPassword (string keyring, int itemid, string password); + [DllImport("libad_gk.so")] + public static extern int RemoveItem (string keyring, int itemid); + [DllImport("libad_gk.so")] + public static extern int SetItemAttributes (string keyring, int itemid, IntPtr[] attrs, int length); + [DllImport("libad_gk.so")] + public static extern int CreateItem(string keyringName, int itemType, string displayName, string password, IntPtr[] arrptr, int attrCount); + [DllImport("libad_gk.so")] + public static extern int UnlockRing(string sKeyringName, string sPassword); + [DllImport("libad_gk.so")] + public static extern int LoadGnomeKeyringLibrary(); + [DllImport("libad_gk.so")] + public static extern int ReleaseGnomeKeyringLibrary(); + + public static bool IsGnomeKeyringInstalled() + { + if (0 == LoadGnomeKeyringLibrary()) + return true; + else + return false; + } + + public static void ReleaseGnomeKeyringLib() + { + ReleaseGnomeKeyringLibrary(); + } public static void AttemptGKUnlock(string sPassword) { diff --git a/c_adlib/ad_gk/native/ad_gk.c b/c_adlib/ad_gk/native/ad_gk.c index 1e97306a..e7022da9 100644 --- a/c_adlib/ad_gk/native/ad_gk.c +++ b/c_adlib/ad_gk/native/ad_gk.c @@ -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 +#include + +// 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 @@ -260,9 +809,7 @@ void ItemGetAttributesCb(GnomeKeyringResult result, } int GetKeyrings(GList **keyringList) -{ - GList *l = NULL; - +{ GetKeyringsCbData cbData; cbData.loop = g_main_loop_new (NULL, FALSE); cbData.keyringList = keyringList; @@ -285,9 +832,7 @@ 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); diff --git a/c_adlib/ad_gk/native/ad_gk.h b/c_adlib/ad_gk/native/ad_gk.h index e2667774..3af8cb13 100644 --- a/c_adlib/ad_gk/native/ad_gk.h +++ b/c_adlib/ad_gk/native/ad_gk.h @@ -75,6 +75,8 @@ int GetItems(char *keyring, GList **itemList); int GetItemInfo(char *keyring, int itemId, ItemInfo *info); int GetAttributeList(char *keyring, int itemId, GList **); int FreeAttributeList(GList *attrList); +static int LoadGnomeKeyringLibrary(); +static int ReleaseGnomeKeyringLibrary(); int UnlockRing(char *keyring, char *password); diff --git a/c_adlib/ad_gk/native/link.lux b/c_adlib/ad_gk/native/link.lux index 9aadf4fe..4798177b 100644 --- a/c_adlib/ad_gk/native/link.lux +++ b/c_adlib/ad_gk/native/link.lux @@ -5,7 +5,7 @@ LINK = $(CPP) \ -O2 -fno-exceptions -fno-check-new\ -Wl,-rpath -Wl,/usr/lib$(ARC) \ -L/usr/lib$(ARC) -lpthread -lc -ldl \ - -L/opt/gnome/lib$(ARC) -lgnome-keyring -lglib-2.0 \ + -L/opt/gnome/lib$(ARC) -lglib-2.0 \ -Wl,-soname -Wl,lib$(TARGET).so.$(PROD_NUM) \ -o $(LIBDIR)$(XTRA)/lib$(TARGET).so.$(BLD_VER) \ -L$(LIBDIR)$(XTRA) \ diff --git a/make/global.mak b/make/global.mak index 1358e30a..c7163c74 100644 --- a/make/global.mak +++ b/make/global.mak @@ -61,8 +61,7 @@ incdir = i"." i"$(ROOT)/include" i"$(NWSDK)include" i"$(NWCLIENT)include" i"$(XT endif ifeq ($(PLAT),lux) -#incdir = i"." i"$(ROOT)/include" i"$(CCS)include" i"$(DHOST)include/unix" i"$(DHOST)include" i"$(DCLIENT)include/unix" i"$(DCLIENT)include/unix/Linux" i"$(DCLIENT)include/public" i"$(NLDAP)include" i"$(NLDAP)inc" i"$(NETWARE)include" i"$(NWSDK)include" -incdir = i"." i"$(ROOT)/include" i"$(NETWARE)include" i"$(NWSDK)include" +incdir = i"." i"$(ROOT)/include" i"/opt/gnome/include/gnome-keyring-1/" O = o endif diff --git a/shsrc/lshsrc/mk-micasa_gk-dl b/shsrc/lshsrc/mk-micasa_gk-dl index acf5356d..5500a857 100644 --- a/shsrc/lshsrc/mk-micasa_gk-dl +++ b/shsrc/lshsrc/mk-micasa_gk-dl @@ -26,7 +26,7 @@ export PKG_CONFIG_PATH=/usr/lib$ARCH_LIB/pkgconfig:/opt/gnome/lib$ARCH_LIB/pkgco #COMMON_FILES=$(ls) #(ln -f $COMMON_FILES $PR/c_micasadk) cd $PR/c_adlib/ad_gk/native -(make -I $PR/make -f Makefile ROOT=$PR PLAT=lux MODULE=shared MIN_NUM=\"$MIN_SSS_NO\" PROD_NUM=\"$MAJ_SSS_NO\" BLD_VER=\"$BLD_NO\" ARC=\"$ARCH_LIB\" XTRA=dbg XTRA_CFLAGS="`pkg-config --cflags gnome-keyring-1` `pkg-config --libs gnome-keyring-1` `pkg-config --cflags glib-2.0` `pkg-config --libs glib-2.0`" $2 $3 $4 $5) +(make -I $PR/make -f Makefile ROOT=$PR PLAT=lux MODULE=shared MIN_NUM=\"$MIN_SSS_NO\" PROD_NUM=\"$MAJ_SSS_NO\" BLD_VER=\"$BLD_NO\" ARC=\"$ARCH_LIB\" XTRA=dbg XTRA_CFLAGS="`pkg-config --cflags glib-2.0` `pkg-config --libs glib-2.0`" $2 $3 $4 $5) RCODE=$? rm -f $COMMON_FILES if(test $RCODE != 0) diff --git a/shsrc/lshsrc/mk-micasa_gk-ol b/shsrc/lshsrc/mk-micasa_gk-ol index 55aaa154..d98d6351 100644 --- a/shsrc/lshsrc/mk-micasa_gk-ol +++ b/shsrc/lshsrc/mk-micasa_gk-ol @@ -22,7 +22,7 @@ fi export PKG_CONFIG_PATH=/usr/lib$ARCH_LIB/pkgconfig:/opt/gnome/lib$ARCH_LIB/pkgconfig:/usr/local/lib$ARCH_LIB/pkgconfig cd $PR/c_adlib/ad_gk/native -(make -I $PR/make -f Makefile ROOT=$PR PLAT=lux MODULE=shared MIN_NUM=\"$MIN_SSS_NO\" PROD_NUM=\"$MAJ_SSS_NO\" BLD_VER=\"$BLD_NO\" ARC=\"$ARCH_LIB\" XTRA=ndbg XTRA_CFLAGS="`pkg-config --cflags gnome-keyring-1` `pkg-config --libs gnome-keyring-1` `pkg-config --cflags glib-2.0` `pkg-config --libs glib-2.0` -O2 -fmessage-length=0 -Wall -fstack-protector" $2 $3 $4 $5) +(make -I $PR/make -f Makefile ROOT=$PR PLAT=lux MODULE=shared MIN_NUM=\"$MIN_SSS_NO\" PROD_NUM=\"$MAJ_SSS_NO\" BLD_VER=\"$BLD_NO\" ARC=\"$ARCH_LIB\" XTRA=ndbg XTRA_CFLAGS="`pkg-config --cflags glib-2.0` `pkg-config --libs glib-2.0` -O2 -fmessage-length=0 -Wall -fstack-protector" $2 $3 $4 $5) RCODE=$? rm -f $COMMON_FILES if(test $RCODE != 0)