Unlock support
This commit is contained in:
parent
7880ab744b
commit
bed0ba9d0f
@ -87,6 +87,32 @@ namespace Novell.CASA.DataEngines.GK
|
||||
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 void AttemptGKUnlock(string sPassword)
|
||||
{
|
||||
ArrayList alKeyRings = GKGetKeyrings();
|
||||
IEnumerator kEtor = alKeyRings.GetEnumerator();
|
||||
while (kEtor.MoveNext())
|
||||
{
|
||||
string sKeyring = (string)(kEtor.Current);
|
||||
try
|
||||
{
|
||||
UnlockGnomeKeyring(sKeyring, sPassword);
|
||||
}
|
||||
catch {}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static int UnlockGnomeKeyring(string sKeyringName, string sPassword)
|
||||
{
|
||||
int rcode = UnlockRing(sKeyringName, sPassword);
|
||||
return rcode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static KeyringInfo GKGetKeyringInfo(string name)
|
||||
|
@ -12,7 +12,6 @@ OperationCompletedCb (GnomeKeyringResult result,
|
||||
g_main_loop_quit (loop);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
CreateItemCb (GnomeKeyringResult result,
|
||||
guint32 id,
|
||||
@ -28,6 +27,21 @@ CreateItemCb (GnomeKeyringResult result,
|
||||
g_main_loop_quit (loop);
|
||||
}
|
||||
|
||||
int
|
||||
UnlockRing(char *keyring,
|
||||
char *password)
|
||||
{
|
||||
|
||||
// unlock the named keyring
|
||||
OperationCompleted cbData;
|
||||
cbData.OperationName = "Unlock Ring";
|
||||
|
||||
loop = g_main_loop_new (NULL, FALSE);
|
||||
gnome_keyring_unlock(keyring, password, OperationCompletedCb, &cbData, NULL);
|
||||
|
||||
g_main_loop_run (loop);
|
||||
return cbData.result;
|
||||
}
|
||||
|
||||
static int
|
||||
CreateItemInKeyring(char *keyring, int32_t itemType, char *display_name, char *secret, Attribute **attrs, int attrcnt)
|
||||
@ -37,7 +51,6 @@ CreateItemInKeyring(char *keyring, int32_t itemType, char *display_name, char *s
|
||||
OperationCompleted cbData;
|
||||
|
||||
int i;
|
||||
printf("ad:gk.c :In CreateItemInKeyring\n");
|
||||
printf("ad.gk.c : CreateItemInKeyring : Keyring %s, itemType %d displayname %s, secret %s \n",keyring,itemType, display_name,secret);
|
||||
cbData.OperationName = "Create Item";
|
||||
loop = g_main_loop_new (NULL, FALSE);
|
||||
|
@ -54,6 +54,8 @@ int GetItemInfo(char *keyring, int itemId, ItemInfo *info);
|
||||
int GetAttributeList(char *keyring, int itemId, GList **);
|
||||
int FreeAttributeList(GList *attrList);
|
||||
|
||||
int
|
||||
UnlockRing(char *keyring, char *password);
|
||||
int
|
||||
SetItemAttributes (char *keyring, guint32 item_id, Attribute **attrs, int length);
|
||||
int
|
||||
|
Loading…
Reference in New Issue
Block a user