Bug 143878. Handle more than 100 secrets in GUI.
This commit is contained in:
parent
6055982262
commit
526c3d0706
@ -1,3 +1,8 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Sat Jan 28 20:22:59 MST 2006 - jnorman@novell.com
|
||||||
|
|
||||||
|
- Bug 143878. Handle more than 100 secrets in GUI.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sat Jan 28 20:12:59 MST 2006 - jnorman@novell.com
|
Sat Jan 28 20:12:59 MST 2006 - jnorman@novell.com
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@ namespace Novell.CASA.MiCasa.Communication
|
|||||||
public const int VERB_READ_KEY = 16;
|
public const int VERB_READ_KEY = 16;
|
||||||
public const int VERB_GET_KEY_LIST = 17;
|
public const int VERB_GET_KEY_LIST = 17;
|
||||||
public const int VERB_RESET_MASTER_PASSWORD = 18;
|
public const int VERB_RESET_MASTER_PASSWORD = 18;
|
||||||
|
public const int VERB_GET_SECRETIDS = 19;
|
||||||
|
|
||||||
public const int VERB_DUMP_LINKED_KEYS = 96;
|
public const int VERB_DUMP_LINKED_KEYS = 96;
|
||||||
public const int VERB_CREATE_TEST_SECRETS = 97;
|
public const int VERB_CREATE_TEST_SECRETS = 97;
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using System.Collections.Specialized;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using sscs.verbs;
|
using sscs.verbs;
|
||||||
@ -210,6 +211,10 @@ namespace sscs.verbs
|
|||||||
{
|
{
|
||||||
return DoResetMasterPassword(ssStore, wo);
|
return DoResetMasterPassword(ssStore, wo);
|
||||||
}
|
}
|
||||||
|
case MiCasaRequestReply.VERB_GET_SECRETIDS:
|
||||||
|
{
|
||||||
|
return DoGetSecretIDs(ssStore, wo);
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
@ -227,6 +232,41 @@ namespace sscs.verbs
|
|||||||
return wo;
|
return wo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private WrappedObject DoGetSecretIDs(SecretStore ssStore, WrappedObject wo)
|
||||||
|
{
|
||||||
|
if (!ssStore.IsStoreLocked())
|
||||||
|
{
|
||||||
|
// look up keychain
|
||||||
|
string sKeyChainID = wo.GetKeychainID();
|
||||||
|
if (sKeyChainID != null)
|
||||||
|
{
|
||||||
|
KeyChain kc = ssStore.GetKeyChain(sKeyChainID);
|
||||||
|
if (kc != null)
|
||||||
|
{
|
||||||
|
StringCollection sc = (StringCollection)wo.GetObject();
|
||||||
|
if (sc != null)
|
||||||
|
{
|
||||||
|
IDictionaryEnumerator etor = (IDictionaryEnumerator)kc.GetAllSecrets();
|
||||||
|
while(etor.MoveNext())
|
||||||
|
{
|
||||||
|
sc.Add((string)etor.Key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wo.SetError(constants.RetCodes.FAILURE, "KeyChain not found");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wo.SetError(constants.RetCodes.FAILURE, "Store locked");
|
||||||
|
}
|
||||||
|
|
||||||
|
return wo;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private WrappedObject DoRemoveAllSecrets(SecretStore ssStore, WrappedObject wo)
|
private WrappedObject DoRemoveAllSecrets(SecretStore ssStore, WrappedObject wo)
|
||||||
{
|
{
|
||||||
|
@ -41,6 +41,7 @@ namespace Novell.CASA
|
|||||||
private static int SSCS_CRED_TYPE_BASIC_F = 1;
|
private static int SSCS_CRED_TYPE_BASIC_F = 1;
|
||||||
private static int USERNAME_LEN = 256;
|
private static int USERNAME_LEN = 256;
|
||||||
private static int PASSWORD_LEN = 128;
|
private static int PASSWORD_LEN = 128;
|
||||||
|
private static bool USE_OBJECT_SERIALIZATION = true;
|
||||||
|
|
||||||
public NativeCalls()
|
public NativeCalls()
|
||||||
{
|
{
|
||||||
@ -979,57 +980,66 @@ namespace Novell.CASA
|
|||||||
SSCS_SH_SECRET_ID_LIST_T idList = new SSCS_SH_SECRET_ID_LIST_T();
|
SSCS_SH_SECRET_ID_LIST_T idList = new SSCS_SH_SECRET_ID_LIST_T();
|
||||||
SSCS_EXT_T ext = new SSCS_EXT_T();
|
SSCS_EXT_T ext = new SSCS_EXT_T();
|
||||||
|
|
||||||
int numIDS = 100;
|
int numIDS = 1024;
|
||||||
StringCollection sc = null;
|
StringCollection sc = new StringCollection(); //null;
|
||||||
|
|
||||||
// setup keychainid
|
if (USE_OBJECT_SERIALIZATION)
|
||||||
keyChainID.len = sKeyChainID.Length + 1;
|
{
|
||||||
|
sc = (StringCollection)MiCasaRequestReply.Send(MiCasaRequestReply.VERB_GET_SECRETIDS, null, null, null, sc);
|
||||||
|
return sc;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
searchKey.srchKey = sSearchKey;
|
// setup keychainid
|
||||||
searchKey.srchKeyLen = (uint)sSearchKey.Length;
|
keyChainID.len = sKeyChainID.Length + 1;
|
||||||
|
|
||||||
|
searchKey.srchKey = sSearchKey;
|
||||||
|
searchKey.srchKeyLen = (uint)sSearchKey.Length;
|
||||||
|
|
||||||
idList.returnedIDs = (uint)numIDS;
|
idList.returnedIDs = (uint)numIDS;
|
||||||
|
|
||||||
SSCS_SH_SECRET_ID_T secretId = new SSCS_SH_SECRET_ID_T();
|
SSCS_SH_SECRET_ID_T secretId = new SSCS_SH_SECRET_ID_T();
|
||||||
// secretId.name = new char[512];
|
// secretId.name = new char[512];
|
||||||
|
|
||||||
StringBuilder buffer3 = new StringBuilder( "content", 512 );
|
StringBuilder buffer3 = new StringBuilder( "content", 512 );
|
||||||
buffer3.Append( (char)0 );
|
buffer3.Append( (char)0 );
|
||||||
buffer3.Append( '*', buffer3.Capacity - 8 );
|
buffer3.Append( '*', buffer3.Capacity - 8 );
|
||||||
String tempStr = buffer3.ToString();
|
String tempStr = buffer3.ToString();
|
||||||
idList.secretIDList = Marshal.AllocHGlobal(numIDS * Marshal.SizeOf(secretId));
|
idList.secretIDList = Marshal.AllocHGlobal(numIDS * Marshal.SizeOf(secretId));
|
||||||
|
|
||||||
|
|
||||||
// make the call
|
// make the call
|
||||||
int rcode = miCASAEnumerateSecretIDs(
|
int rcode = miCASAEnumerateSecretIDs(
|
||||||
context,
|
context,
|
||||||
keyChainID,
|
keyChainID,
|
||||||
ssFlags,
|
ssFlags,
|
||||||
searchKey,
|
searchKey,
|
||||||
idList,
|
idList,
|
||||||
ext);
|
ext);
|
||||||
|
|
||||||
if (idList.returnedIDs > 0)
|
if (idList.returnedIDs > 0)
|
||||||
{
|
{
|
||||||
sc = new StringCollection();
|
sc = new StringCollection();
|
||||||
|
|
||||||
if (idList.returnedIDs != 100)
|
if (idList.returnedIDs != numIDS)
|
||||||
{
|
{
|
||||||
// enumerate returned list
|
// enumerate returned list
|
||||||
for (int i=0; i<idList.returnedIDs; i++)
|
for (int i=0; i<idList.returnedIDs; i++)
|
||||||
{
|
{
|
||||||
IntPtr temp = new IntPtr(idList.secretIDList.ToInt32() + (i * Marshal.SizeOf(secretId)));
|
IntPtr temp = new IntPtr(idList.secretIDList.ToInt32() + (i * Marshal.SizeOf(secretId)));
|
||||||
secretId = (SSCS_SH_SECRET_ID_T)Marshal.PtrToStructure(temp, typeof(SSCS_SH_SECRET_ID_T));
|
secretId = (SSCS_SH_SECRET_ID_T)Marshal.PtrToStructure(temp, typeof(SSCS_SH_SECRET_ID_T));
|
||||||
|
|
||||||
// String st = new String(secretId.name,0,secretId.len - 1);
|
// String st = new String(secretId.name,0,secretId.len - 1);
|
||||||
String st = secretId.name;
|
String st = secretId.name;
|
||||||
sc.Add(st);
|
sc.Add(st);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Marshal.FreeHGlobal(idList.secretIDList);
|
Marshal.FreeHGlobal(idList.secretIDList);
|
||||||
return sc;
|
return sc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddKeyChain(
|
public void AddKeyChain(
|
||||||
|
Loading…
Reference in New Issue
Block a user