Bug 143878. Handle more than 100 secrets in GUI.
This commit is contained in:
@@ -41,6 +41,7 @@ namespace Novell.CASA
|
||||
private static int SSCS_CRED_TYPE_BASIC_F = 1;
|
||||
private static int USERNAME_LEN = 256;
|
||||
private static int PASSWORD_LEN = 128;
|
||||
private static bool USE_OBJECT_SERIALIZATION = true;
|
||||
|
||||
public NativeCalls()
|
||||
{
|
||||
@@ -979,57 +980,66 @@ namespace Novell.CASA
|
||||
SSCS_SH_SECRET_ID_LIST_T idList = new SSCS_SH_SECRET_ID_LIST_T();
|
||||
SSCS_EXT_T ext = new SSCS_EXT_T();
|
||||
|
||||
int numIDS = 100;
|
||||
StringCollection sc = null;
|
||||
int numIDS = 1024;
|
||||
StringCollection sc = new StringCollection(); //null;
|
||||
|
||||
// setup keychainid
|
||||
keyChainID.len = sKeyChainID.Length + 1;
|
||||
if (USE_OBJECT_SERIALIZATION)
|
||||
{
|
||||
sc = (StringCollection)MiCasaRequestReply.Send(MiCasaRequestReply.VERB_GET_SECRETIDS, null, null, null, sc);
|
||||
return sc;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
searchKey.srchKey = sSearchKey;
|
||||
searchKey.srchKeyLen = (uint)sSearchKey.Length;
|
||||
// setup keychainid
|
||||
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();
|
||||
// secretId.name = new char[512];
|
||||
SSCS_SH_SECRET_ID_T secretId = new SSCS_SH_SECRET_ID_T();
|
||||
// secretId.name = new char[512];
|
||||
|
||||
StringBuilder buffer3 = new StringBuilder( "content", 512 );
|
||||
buffer3.Append( (char)0 );
|
||||
buffer3.Append( '*', buffer3.Capacity - 8 );
|
||||
String tempStr = buffer3.ToString();
|
||||
idList.secretIDList = Marshal.AllocHGlobal(numIDS * Marshal.SizeOf(secretId));
|
||||
StringBuilder buffer3 = new StringBuilder( "content", 512 );
|
||||
buffer3.Append( (char)0 );
|
||||
buffer3.Append( '*', buffer3.Capacity - 8 );
|
||||
String tempStr = buffer3.ToString();
|
||||
idList.secretIDList = Marshal.AllocHGlobal(numIDS * Marshal.SizeOf(secretId));
|
||||
|
||||
|
||||
// make the call
|
||||
int rcode = miCASAEnumerateSecretIDs(
|
||||
context,
|
||||
keyChainID,
|
||||
ssFlags,
|
||||
searchKey,
|
||||
idList,
|
||||
ext);
|
||||
// make the call
|
||||
int rcode = miCASAEnumerateSecretIDs(
|
||||
context,
|
||||
keyChainID,
|
||||
ssFlags,
|
||||
searchKey,
|
||||
idList,
|
||||
ext);
|
||||
|
||||
if (idList.returnedIDs > 0)
|
||||
{
|
||||
sc = new StringCollection();
|
||||
if (idList.returnedIDs > 0)
|
||||
{
|
||||
sc = new StringCollection();
|
||||
|
||||
if (idList.returnedIDs != 100)
|
||||
{
|
||||
// enumerate returned list
|
||||
for (int i=0; i<idList.returnedIDs; i++)
|
||||
{
|
||||
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));
|
||||
if (idList.returnedIDs != numIDS)
|
||||
{
|
||||
// enumerate returned list
|
||||
for (int i=0; i<idList.returnedIDs; i++)
|
||||
{
|
||||
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));
|
||||
|
||||
// String st = new String(secretId.name,0,secretId.len - 1);
|
||||
String st = secretId.name;
|
||||
sc.Add(st);
|
||||
}
|
||||
// String st = new String(secretId.name,0,secretId.len - 1);
|
||||
String st = secretId.name;
|
||||
sc.Add(st);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Marshal.FreeHGlobal(idList.secretIDList);
|
||||
return sc;
|
||||
Marshal.FreeHGlobal(idList.secretIDList);
|
||||
return sc;
|
||||
}
|
||||
}
|
||||
|
||||
public void AddKeyChain(
|
||||
|
||||
Reference in New Issue
Block a user