Moving micasa 1.5 trunk to Novell forge.

This commit is contained in:
Cameron (Kamran) Mashayekhi
2005-10-11 19:51:00 +00:00
parent 082db33275
commit efe0a5e13c
691 changed files with 116628 additions and 0 deletions

20
c_micasacache/Makefile Normal file
View File

@@ -0,0 +1,20 @@
#
# configure environment
#
TARGET = micasacache
include global.mak
include defaults.$(PLAT)
include rules.mak
BIN_NAME = $(TARGET)$(xtra).$(BIN)
LIB_NAME = $(TARGET)$(xtra).$(LIB)
#
# target object and source files
#
include objs.$(PLAT)
#
# targets
#
include target.cl

3
c_micasacache/link.lux Normal file
View File

@@ -0,0 +1,3 @@
LINK = $(AR) \
$(LIBDIR)$(XTRA)/lib$(TARGET).a \
$(OBJDIR)/*.$(O)

51
c_micasacache/link.w32 Normal file
View File

@@ -0,0 +1,51 @@
LINK_DEF_BLD = \
echo "$(addprefix $(OBJDIR),$(notdir $(OBJS)))" > $(LINKDEF);\
echo "$(MSC)lib/kernel32.lib" >> $(LINKDEF);\
echo "$(MSC)lib/msvcrt.lib" >> $(LINKDEF);\
echo "$(MSC)lib/advapi32.lib" >> $(LINKDEF);\
echo "$(MSC)lib/ole32.lib" >> $(LINKDEF);\
echo "/LIBPATH:$(MSC)lib" >> $(LINKDEF);\
echo "/DLL" >> $(LINKDEF);\
echo "/PDBTYPE:con" >> $(LINKDEF);\
echo "/OUT:$(BINDIR)$(basename $(notdir $@)).dll" >> $(LINKDEF);\
echo "/MAP:$(BINDIR)$(basename $(notdir $@)).map" >> $(LINKDEF);\
echo "/PDB:$(BINDIR)$(basename $(notdir $@)).pdb" >> $(LINKDEF);\
echo "/DEBUG" >> $(LINKDEF);\
echo "/DEBUGTYPE:BOTH" >> $(LINKDEF);\
echo "/MACHINE:IX86" >> $(LINKDEF);\
echo "/SUBSYSTEM:WINDOWS" >> $(LINKDEF);\
echo "/INCREMENTAL:NO" >> $(LINKDEF);\
echo "/VERSION:$(BLD_VER)" >> $(LINKDEF);\
echo "/FIXED:NO" >> $(LINKDEF);\
echo "/NODEFAULTLIB:libc" >> $(LINKDEF);\
echo "/NODEFAULTLIB:oldnames" >> $(LINKDEF);\
echo "/NODEFAULTLIB:comctl32" >> $(LINKDEF);\
echo "/NODEFAULTLIB:olepro32" >> $(LINKDEF);\
echo "/NODEFAULTLIB:oleaut32" >> $(LINKDEF);\
echo "/NODEFAULTLIB:wininet" >> $(LINKDEF);\
echo "/NODEFAULTLIB:uuid" >> $(LINKDEF);\
echo "/NODEFAULTLIB:user32" >> $(LINKDEF);\
echo "/NODEFAULTLIB:libcmt" >> $(LINKDEF);\
echo "/NODEFAULTLIB:libcmtd" >> $(LINKDEF);\
echo "/WARN:3" >> $(LINKDEF);\
echo "/OPT:REF" >> $(LINKDEF);\
echo "/EXPORT:sscs_CacheRemoveSecretStore">> $(LINKDEF);\
echo "/EXPORT:sscs_CacheEnumerateKeychainIDs">> $(LINKDEF);\
echo "/EXPORT:sscs_CacheAddKeychain">> $(LINKDEF);\
echo "/EXPORT:sscs_CacheRemoveKeychain">> $(LINKDEF);\
echo "/EXPORT:sscs_CacheEnumerateSecretIDs">> $(LINKDEF);\
echo "/EXPORT:sscs_CacheReadSecret">> $(LINKDEF);\
echo "/EXPORT:sscs_CacheWriteSecret">> $(LINKDEF);\
echo "/EXPORT:sscs_CacheRemoveSecret">> $(LINKDEF);\
echo "/EXPORT:sscs_CacheGetSecretStoreInfo">> $(LINKDEF);\
echo "/EXPORT:sscs_CacheGetKeychainInfo">> $(LINKDEF);\
echo "/EXPORT:sscs_LockCache">> $(LINKDEF);\
echo "/EXPORT:sscs_UnlockCache">> $(LINKDEF);\
echo "/EXPORT:sscs_CacheRemoveSecret">> $(LINKDEF);\
echo "/EXPORT:sscs_SetMasterPasscode">> $(LINKDEF);\
echo "/EXPORT:sscs_SetMasterPassword">> $(LINKDEF);\
echo "/EXPORT:sscs_IsSecretPersistent">> $(LINKDEF);\
echo "/EXPORT:sscs_CacheWriteKey">> $(LINKDEF);\
echo "/EXPORT:sscs_CacheReadKey">> $(LINKDEF);\
echo "/EXPORT:sscs_CacheCloseSecretStore">> $(LINKDEF);\
echo "/EXPORT:sscs_CacheOpenSecretStore">> $(LINKDEF);

View File

@@ -0,0 +1,52 @@
LINK_DEF_BLD = \
echo "$(addprefix $(OBJDIR),$(notdir $(OBJS)))" > $(LINKDEF);\
echo "$(MSC)lib/kernel32.lib" >> $(LINKDEF);\
echo "$(MSC)lib/msvcrt.lib" >> $(LINKDEF);\
echo "$(MSC)lib/user32.lib" >> $(LINKDEF);\
echo "$(MSC)lib/advapi32.lib" >> $(LINKDEF);\
echo "$(MSC)lib/ole32.lib" >> $(LINKDEF);\
echo "/LIBPATH:$(MSC)lib" >> $(LINKDEF);\
echo "/DLL" >> $(LINKDEF);\
echo "/PDBTYPE:con" >> $(LINKDEF);\
echo "/OUT:$(BINDIR)$(basename $(notdir $@)).dll" >> $(LINKDEF);\
echo "/MAP:$(BINDIR)$(basename $(notdir $@)).map" >> $(LINKDEF);\
echo "/PDB:$(BINDIR)$(basename $(notdir $@)).pdb" >> $(LINKDEF);\
echo "/DEBUG" >> $(LINKDEF);\
echo "/DEBUGTYPE:BOTH" >> $(LINKDEF);\
echo "/MACHINE:IX86" >> $(LINKDEF);\
echo "/SUBSYSTEM:WINDOWS" >> $(LINKDEF);\
echo "/INCREMENTAL:NO" >> $(LINKDEF);\
echo "/VERSION:$(BLD_VER)" >> $(LINKDEF);\
echo "/FIXED:NO" >> $(LINKDEF);\
echo "/NODEFAULTLIB:libc" >> $(LINKDEF);\
echo "/NODEFAULTLIB:oldnames" >> $(LINKDEF);\
echo "/NODEFAULTLIB:comctl32" >> $(LINKDEF);\
echo "/NODEFAULTLIB:olepro32" >> $(LINKDEF);\
echo "/NODEFAULTLIB:oleaut32" >> $(LINKDEF);\
echo "/NODEFAULTLIB:wininet" >> $(LINKDEF);\
echo "/NODEFAULTLIB:uuid" >> $(LINKDEF);\
echo "/NODEFAULTLIB:user32" >> $(LINKDEF);\
echo "/NODEFAULTLIB:libcmt" >> $(LINKDEF);\
echo "/NODEFAULTLIB:libcmtd" >> $(LINKDEF);\
echo "/WARN:3" >> $(LINKDEF);\
echo "/OPT:REF" >> $(LINKDEF);\
echo "/EXPORT:sscs_CacheRemoveSecretStore">> $(LINKDEF);\
echo "/EXPORT:sscs_CacheEnumerateKeychainIDs">> $(LINKDEF);\
echo "/EXPORT:sscs_CacheAddKeychain">> $(LINKDEF);\
echo "/EXPORT:sscs_CacheRemoveKeychain">> $(LINKDEF);\
echo "/EXPORT:sscs_CacheEnumerateSecretIDs">> $(LINKDEF);\
echo "/EXPORT:sscs_CacheReadSecret">> $(LINKDEF);\
echo "/EXPORT:sscs_CacheWriteSecret">> $(LINKDEF);\
echo "/EXPORT:sscs_CacheRemoveSecret">> $(LINKDEF);\
echo "/EXPORT:sscs_CacheGetSecretStoreInfo">> $(LINKDEF);\
echo "/EXPORT:sscs_CacheGetKeychainInfo">> $(LINKDEF);\
echo "/EXPORT:sscs_LockCache">> $(LINKDEF);\
echo "/EXPORT:sscs_UnlockCache">> $(LINKDEF);\
echo "/EXPORT:sscs_CacheRemoveSecret">> $(LINKDEF);\
echo "/EXPORT:sscs_SetMasterPasscode">> $(LINKDEF);\
echo "/EXPORT:sscs_SetMasterPassword">> $(LINKDEF);\
echo "/EXPORT:sscs_IsSecretPersistent">> $(LINKDEF);\
echo "/EXPORT:sscs_CacheWriteKey">> $(LINKDEF);\
echo "/EXPORT:sscs_CacheReadKey">> $(LINKDEF);\
echo "/EXPORT:sscs_CacheCloseSecretStore">> $(LINKDEF);\
echo "/EXPORT:sscs_CacheOpenSecretStore">> $(LINKDEF);

4
c_micasacache/objs.lux Normal file
View File

@@ -0,0 +1,4 @@
OBJS=\
sscs_unx_cache.$(O)\
sscs_unx_ipc_client.$(O)\
sscs_ipc.$(O)

5
c_micasacache/objs.w32 Normal file
View File

@@ -0,0 +1,5 @@
OBJS=\
sscs_unx_cache.$(O)\
sscs_unx_ipc_client.$(O)\
sscs_ipc.$(O)

244
c_micasacache/sscs_ipc.c Normal file
View File

@@ -0,0 +1,244 @@
#include "sscs_ipc.h"
#ifdef SSCS_WIN32_PLAT_F
#include "windows.h"
#define XTIER_RPC_PIPE TEXT("\\\\.\\PIPE\\SS_RPC_PIPE")
// global
int firstReadAfterWrite = 0;
#endif
/*
*/
#ifdef SSCS_LINUX_PLAT_F
int ipc_unx_create()
{
int retVal = 0;
struct sockaddr_un servAddr;
char path[MAX_SOCKET_PATH_LEN];
int sockFd = 0;
do
{
sockFd = socket(AF_UNIX,SOCK_STREAM,0);
if( sockFd < 0 )
{
retVal = sockFd;
break;
}
memset(&servAddr,0,sizeof(servAddr));
servAddr.sun_family = AF_UNIX;
strcpy(servAddr.sun_path,"/tmp/.novellCASA");
retVal = connect(sockFd,(struct sockaddr*)&servAddr, sizeof(servAddr));
if(retVal < 0 )
{
DMSG(("Connect fails : %s\n",strerror(errno)));
DMSG(("Closing socket : %d\n",sockFd));
close(sockFd);
break;
}
else
retVal = sockFd;
}while(0);
return retVal;
}
#else
void * ipc_win_create()
{
//#ifdef SSCS_WIN32_PLAT_F
// connect to the named Pipe
HANDLE hPipe = NULL;
int rcode;
DWORD mode = PIPE_READMODE_MESSAGE;
hPipe = CreateFile(
XTIER_RPC_PIPE,
GENERIC_READ | GENERIC_WRITE,
0,
NULL, //null,
OPEN_EXISTING,
0,
0);
if (hPipe == INVALID_HANDLE_VALUE)
{
rcode = GetLastError();
return 0;
}
return hPipe;
}
#endif
#ifdef SSCS_LINUX_PLAT_F
int ipc_unx_write(int fd, Byte *pData, int bytes)
{
int retVal = write(fd,pData,bytes);
if( retVal < 0 )
{
DMSG(("Write returns error : %d - %s\n",retVal, strerror(errno)));
}
return retVal;
//#endif
}
#else
int ipc_win_write(HANDLE hPipe, LPCVOID lpBuffer, DWORD bytesToWrite)
{
//#ifdef SSCS_WIN32_PLAT_F
BOOL rcode;
int icode;
DWORD lpBytesWritten = 0;
//LPCVOID msgLen = malloc(4);
// rcode = WaitNamedPipe(
// XTIER_RPC_PIPE,
// NMPWAIT_WAIT_FOREVER);
// the server expects us to first write the number of bytes in the msg we're about to write.
rcode = WriteFile(
hPipe,
(LPCVOID)&bytesToWrite,
4,
&lpBytesWritten,
NULL);
if (!rcode)
{
icode = GetLastError();
return 0;
}
// rcode = WaitNamedPipe(
// XTIER_RPC_PIPE,
// NMPWAIT_WAIT_FOREVER);
rcode = WriteFile(
hPipe,
lpBuffer, //LPCVOID lpBuffer,
bytesToWrite, //DWORD nNumberOfBytesToWrite,
&lpBytesWritten, // LPDWORD lpNumberOfBytesWritten,
NULL); //LPOVERLAPPED lpOverlapped
if (!rcode)
{
icode = GetLastError();
}
firstReadAfterWrite = 1;
return lpBytesWritten;
}
#endif
/*
*
*/
#ifdef SSCS_LINUX_PLAT_F
int ipc_unx_read(int fd, Byte *pData, int bytes)
{
int bytesToRead = 0; // Keep track of number of bytes to read
int bytesRead = 0; // Number of bytes read
int retVal = 0;
for(bytesToRead = bytes; bytesToRead;)
{
bytesRead = read(fd, pData, bytesToRead);
if(bytesRead < 0)
{
return -1;
}
bytesToRead -= bytesRead;
pData += bytesRead;
}
return bytesRead;
}
//#endif
#else
int ipc_win_read(HANDLE hPipe, LPVOID lpBuffer, DWORD numOfBytesToRead)
{
//#ifdef SSCS_WIN32_PLAT_F
BOOL rcode;
DWORD numBytesRead = 0;
LPVOID pMsgLen = malloc(4);
int icode;
if (firstReadAfterWrite)
{
firstReadAfterWrite = 0;
// server first sends the number of bytes that gets sent.
rcode = ReadFile(
hPipe, //HANDLE hFile,
pMsgLen, //LPVOID lpBuffer,
4, //numOfBytesToRead, //DWORD nNumberOfBytesToRead,
&numBytesRead, //LPDWORD lpNumberOfBytesRead,
NULL); //LPOVERLAPPED lpOverlapped
if (!rcode)
{
icode = GetLastError();
return 0;
}
}
rcode = ReadFile(
hPipe, //HANDLE hFile,
lpBuffer, //LPVOID lpBuffer,
numOfBytesToRead, //DWORD nNumberOfBytesToRead,
&numBytesRead, //LPDWORD lpNumberOfBytesRead,
NULL); //LPOVERLAPPED lpOverlapped
if (pMsgLen)
free(pMsgLen);
return numBytesRead;
}
#endif
#ifdef SSCS_LINUX_PLAT_F
int ipc_unx_close(int fd)
{
return close(fd);
}
#else
int ipc_win_close(HANDLE hPipe)
{
//#ifdef SSCS_WIN32_PLAT_F
BOOL rcode;
rcode = DisconnectNamedPipe(hPipe);
rcode = CloseHandle(hPipe);
return 0;
}
#endif

View File

@@ -0,0 +1,670 @@
#if defined(__cplusplus) || defined(c_plusplus)
extern "C"
{
#endif
#include <stdio.h>
#ifdef SSCS_WIN32_PLAT_F
#include <windows.h>
#include <sscs_ipc.h>
#endif
#include "sscs_cache.h"
/* Starts a session with the cache and returns a handle to the cache.
* Parametrs:
* secretStoreID
* (IN) Points to SecretStoreID structure.
*
* Return Values:
* returns a pointer to SecretStoreHandle structure.
*/
void* sscs_CacheOpenSecretStore
(
void *secretStoreID,
uint32_t ssFlags,
void *reserved
)
{
SSCS_SECRETSTORE_HANDLE_T *ssHandle = NULL;
SSCS_LINUX_SS_HANDLE_T *platHandle = NULL;
int32_t retVal = 0;
ssHandle = (SSCS_SECRETSTORE_HANDLE_T *)malloc(sizeof(SSCS_SECRETSTORE_HANDLE_T));
if(NULL == ssHandle)
{
return NULL;
}
platHandle = (SSCS_LINUX_SS_HANDLE_T *)malloc(sizeof(SSCS_LINUX_SS_HANDLE_T));
if(NULL == platHandle)
{
free(ssHandle);
return NULL;
}
memset(ssHandle,0,sizeof(SSCS_SECRETSTORE_HANDLE_T));
memset(platHandle,0,sizeof(SSCS_LINUX_SS_HANDLE_T));
ssHandle->platHandle = platHandle;
retVal = ipc_OpenSecretStore(secretStoreID,ssHandle);
if(retVal)
{
free(platHandle);
free(ssHandle);
return NULL;
}
return ssHandle;
}
/* Closes the secretstore and destroys the SecretStore context for that
* application.
*
* Parameters:
* ssHandle
* (IN) Handle returned by sscs_CacheOpenSecretStore function. This will have
* context information regarding the SecretStore.
*
*
* Return Values
*
*/
int32_t sscs_CacheCloseSecretStore
(
void *ssHandle,
uint32_t ssFlags,
void *reserved
)
{
int32_t retVal = 0;
SSCS_SECRETSTORE_HANDLE_T *ssHandleCopy = (SSCS_SECRETSTORE_HANDLE_T *)ssHandle;
if(ssHandleCopy->platHandle)
{
retVal = ipc_CloseSecretStore(ssHandleCopy, ssFlags);
free(ssHandleCopy->platHandle);
}
if(ssHandleCopy)
free(ssHandleCopy);
return retVal;
}
/* Removes all application defined keychains from the store. It also removes
* secrets stored in system defined keychains.
*
* Parameters:
* ssHandle
* (IN) Handle returned by sscs_CacheOpenSecretStore function. This will have
* context information regarding the SecretStore.
*
*
* Return Values:
*/
int32_t sscs_CacheRemoveSecretStore
(
void *ssHandle,
uint32_t ssFlags,
void *reserved
)
{
int32_t retVal = 0;
SSCS_SECRETSTORE_HANDLE_T *ssHandleCopy = (SSCS_SECRETSTORE_HANDLE_T *)ssHandle;
retVal = ipc_RemoveSecretStore(ssHandleCopy);
return retVal;
}
/* Enumerates key chain ids available in the store.
*
* Parameters:
* ssHandle
* (IN) Handle returned by sscs_CacheOpenSecretStore function. This will have
* context information regarding the SecretStore.
*
*
* kcIDList
* (OUT) Points to the key chain id enumeration structure. Points to
* KeyChainIDList structure.
*
* bytesRequired
* (OUT) Specifies the buffer requirement if it is not possible
* to copy KeyChain IDs in the buffer passed by the application.
*
* Return Values:
*
*/
int32_t sscs_CacheEnumerateKeychainIDs
(
void *ssHandle,
uint32_t ssFlags,
SSCS_SRCH_KEY_T *searchKey,
SSCS_KEYCHAIN_ID_LIST_T *kcIDList,
void *reserved
)
{
int32_t retVal = 0;
SSCS_SECRETSTORE_HANDLE_T *ssHandleCopy = (SSCS_SECRETSTORE_HANDLE_T *)ssHandle;
retVal = ipc_EnumerateKeychainIDs(ssHandleCopy,kcIDList);
return retVal;
}
/* Creates a new keychain in the store.
*
* Parameters:
* ssHandle
* (IN) Handle returned by sscs_CacheOpenSecretStore function. This will have
* context information regarding the SecretStore.
*
* ssFlags
* (IN) Can be a combination of follwing flags:
* SSCS_HIDDEN_LOCAL_KEY_CHAIN_F
* SSCS_SESSION_KEY_CHAIN_F
* SSCS_LOCAL_KEY_CHAIN_F
* SSCS_REMOTE_KEY_CHAIN_F
* SSCS_LOCAL_REMOTE_CHAIN_F
* SSCS_RESERVED1_KEY_CHAIN_F
* SSCS_RESERVED2_KEY_CHAIN_F
* keychainID
* (IN) Specifies the unique keychain ID within the secretstore.
*
*/
int32_t sscs_CacheAddKeychain
(
void *ssHandle,
uint32_t ssFlags,
SSCS_KEYCHAIN_ID_T *keychainID,
void *reserved
)
{
int32_t retVal = 0;
SSCS_SECRETSTORE_HANDLE_T *ssHandleCopy = (SSCS_SECRETSTORE_HANDLE_T *)ssHandle;
retVal = ipc_AddKeychain(ssHandleCopy,ssFlags,keychainID);
return retVal;
}
/* Removes the specified keychain from the store.
*
* Parameters:
* ssHandle
* (IN) Handle returned by sscs_CacheOpenSecretStore function. This will have
* context information regarding the SecretStore.
*
* keychainID
* (IN) Specifies the unique keychain ID within the secretstore.
*
* Return Values:
*/
int32_t sscs_CacheRemoveKeychain
(
void *ssHandle,
uint32_t ssFlags,
SSCS_KEYCHAIN_ID_T *keyChainID,
void *reserved
)
{
int32_t retVal = 0;
SSCS_SECRETSTORE_HANDLE_T *ssHandleCopy = (SSCS_SECRETSTORE_HANDLE_T *)ssHandle;
retVal = ipc_RemoveKeychain(ssHandleCopy,keyChainID);
return retVal;
}
/* Enumerates secret ids in a given keychain.
*
* Parameters:
* ssHandle
* (IN) Handle returned by sscs_CacheOpenSecretStore function. This will have
* context information regarding the SecretStore.
*
* keyChainID
* (IN) handle obtained during sscs_CacheOpenKeychain.
*
*
* secretIDList
* (OUT) Points to the secret id enumeration structure. Points to
* SecretIDList structure.
*
* bytesRequired
* (OUT) Specifies the buffer requirement if it is not possible
* to copy Secret IDs in the buffer passed by the application.
* Return Values:
*/
int32_t sscs_CacheEnumerateSecretIDs
(
void *ssHandle,
uint32_t ssFlags,
SSCS_KEYCHAIN_ID_T *keyChainID,
SSCS_SRCH_KEY_T *searchKey,
SSCS_SECRET_ID_LIST_T *secretIDList,
void *reserved
)
{
int32_t retVal = 0;
SSCS_SECRETSTORE_HANDLE_T *ssHandleCopy = (SSCS_SECRETSTORE_HANDLE_T *)ssHandle;
retVal = ipc_EnumerateSecretIDs(ssHandleCopy,keyChainID,secretIDList);
return retVal;
}
/* Reads Secret value for a given Secret ID in a given keychain.
*
* Parameters:
* ssHandle
* (IN) Handle returned by sscs_CacheOpenSecretStore function. This will have
* context information regarding the SecretStore.
*
* keyChainID
* (IN) KeyChainID where the specified SecretID stored.
*
* secretID
* (IN) Specifies the unique secret ID within the keychain. This data is
* encoded in SSCS_SECRET_ID_T.
*
* secretData
* (IN/OUT) Specifies the information of the secret stored w.r.t the secretID.
* Points to a SSCS_SECRET_T structure.
*
* epPassword
* (IN) Points to an optional field to pass in the Enhanced Protection Password
* for reading a secret.When the password is not present, you can pass in a NULL.
*
* bytesRequired
* (OUT) Specifies the buffer requirement if it is not possible
* to copy Secret data in the buffer passed by the application.
*
* Return Values :
*/
int32_t sscs_CacheReadSecret
(
void *ssHandle,
uint32_t ssFlags,
SSCS_KEYCHAIN_ID_T *keychainID,
SSCS_SECRET_ID_T *secretID,
SSCS_SECRET_T *secretData,
SSCS_PASSWORD_T *epPassword,
uint32_t *bytesRequired,
void *reserved
)
{
int32_t retVal = 0;
SSCS_SECRETSTORE_HANDLE_T *ssHandleCopy = (SSCS_SECRETSTORE_HANDLE_T *)ssHandle;
retVal = ipc_ReadSecret(ssHandleCopy,keychainID,secretID,secretData,epPassword,bytesRequired);
return retVal;
}
/* Writes Secret value for a given Secret ID in a given keychain.
*
* Parameters:
* ssHandle
* (IN) Handle returned by sscs_CacheOpenSecretStore function. This will have
* context information regarding the SecretStore.
*
* ssFlags
* (IN) ...
*
* keyChainID
* (IN) KeyChainID where the specified SecretID stored.
*
* secretID
* (IN) Specifies the unique secret ID within the keychain. This data is
* encoded in SSCS_SECRET_ID_T.
*
* secretData
* (IN) Specifies the information of the secret stored w.r.t the secretID.
* Points to a SSCS_SECRET_T structure.
*
*
* epPassword
* (IN) Points to an optional field to pass in the Enhanced Protection Password
* for reading a secret.When the password is not present, you can pass in a NULL.
*
*
*
* Return Values:
*/
int sscs_CacheWriteSecret
(
void *ssHandle,
uint32_t ssFlags,
SSCS_KEYCHAIN_ID_T *keyChainID,
SSCS_SECRET_ID_T *secretID,
SSCS_SECRET_T *secretData,
SSCS_PASSWORD_T *epPassword,
void *reserved
)
{
int32_t retVal = 0;
SSCS_SECRETSTORE_HANDLE_T *ssHandleCopy = (SSCS_SECRETSTORE_HANDLE_T *)ssHandle;
retVal = ipc_WriteSecret(ssHandleCopy,ssFlags,keyChainID,secretID,secretData,epPassword, reserved);
return retVal;
}
/* Removes Secret for a given Secret ID in a given keychain.
*
* Parameters:
* ssHandle
* (IN) Handle returned by sscs_CacheOpenSecretStore function. This will have
* context information regarding the SecretStore.
*
*
* keyChainID
* (IN) KeyChainID where the specified SecretID stored.
*
* secretID
* (IN) Specifies the unique secret ID within the keychain. This data is
* encoded in SSCS_SECRET_ID_T.
*
*
* epPassword
* (IN) Points to an optional field to pass in the Enhanced Protection Password
* for reading a secret.When the password is not present, you can pass in a NULL.
*
* Return Values:
*/
int32_t sscs_CacheRemoveSecret
(
void *ssHandle,
uint32_t ssFlags,
SSCS_KEYCHAIN_ID_T *keyChainID,
SSCS_SECRET_ID_T *secredID,
SSCS_PASSWORD_T *epPassword,
void *reserved
)
{
int32_t retVal = 0;
SSCS_SECRETSTORE_HANDLE_T *ssHandleCopy = (SSCS_SECRETSTORE_HANDLE_T *)ssHandle;
retVal = ipc_RemoveSecret(ssHandleCopy,keyChainID,secredID,epPassword);
return retVal;
}
/* Returns statistical information regarding the SecretStore and its Keychains.
*
* Parameters:
* ssHandle
* (IN) Handle returned by sscs_CacheOpenSecretStore function. This will have
* context with respect to the instance of open cache in it.
*
*
* ssInfo
* (OUT) This structure contains the statistical information regarding the
* SecretStore and its Keychains.
*
* Return Values:
*/
int32_t sscs_CacheGetSecretStoreInfo
(
void *ssHandle,
uint32_t ssFlags,
SSCS_SECRETSTORE_INFO_T *ssInfo,
void *reserved
)
{
int32_t retVal = 0;
SSCS_SECRETSTORE_HANDLE_T *ssHandleCopy = (SSCS_SECRETSTORE_HANDLE_T *)ssHandle;
retVal = ipc_GetSecretStoreInfo(ssHandleCopy,ssInfo);
return retVal;
}
/* Retrieves the statistical information regarding the target Keychain.
*
* Parameters:
* ssHandle
* (IN) Handle returned by sscs_CacheOpenSecretStore function. This will have
* context with respect to the instance of open cache in it.
*
* keyChainID
* (IN) KeyChainID where the specified SecretID stored.
*
*
* kcInfo
* (OUT) This structure contains the statistical information regarding the
* Keychain.
*
*
* Return Values:
*/
int32_t sscs_CacheGetKeychainInfo
(
void *ssHandle,
uint32_t ssFlags,
SSCS_KEYCHAIN_ID_T *keyChainID,
SSCS_KEYCHAIN_INFO_T *kcInfo,
void *reserved
)
{
int32_t retVal = 0;
SSCS_SECRETSTORE_HANDLE_T *ssHandleCopy = (SSCS_SECRETSTORE_HANDLE_T *)ssHandle;
retVal = ipc_GetKeychainInfo(ssHandleCopy,keyChainID,kcInfo);
return retVal;
}
/* This call locks that cache to prevent access until the MasterPassword is
* supplied.
*
* Parameters:
* ssHandle
* (IN) Handle returned by sscs_CacheOpenSecretStore function. This will have
* context with respect to the instance of open cache in it.
*
* Return Values :
*/
int32_t sscs_LockCache
(
void *ssHandle,
uint32_t ssFlags,
void *reserved
)
{
int32_t retVal = 0;
SSCS_SECRETSTORE_HANDLE_T *ssHandleCopy = (SSCS_SECRETSTORE_HANDLE_T *)ssHandle;
retVal = ipc_LockCache(ssHandleCopy);
return retVal;
}
/* This unlocks previously locked cache using the MasterPassword
*
* Parameters:
* ssHandle
* (IN) Handle returned by sscs_CacheOpenSecretStore function. This will have
* context with respect to the instance of open cache in it.
* masterPassword
*
* Return Values :
*/
int32_t sscs_UnlockCache
(
void *ssHandle,
uint32_t ssFlags,
SSCS_PASSCODE_T *passcode,
void *reserved
)
{
int32_t retVal = 0;
SSCS_SECRETSTORE_HANDLE_T *ssHandleCopy = (SSCS_SECRETSTORE_HANDLE_T *)ssHandle;
retVal = ipc_UnlockCache(ssHandle,passcode);
return retVal;
}
int32_t sscs_SetMasterPasscode
(
void *ssHandle,
SSCS_PASSCODE_T *passcode,
void *reserved
)
{
int32_t retVal = 0;
retVal = ipc_SetMasterPasscode(ssHandle,passcode);
return retVal;
}
int32_t sscs_SetMasterPassword
(
void *ssHandle,
SSCS_PASSWORD_T *password,
SSCS_HINT_T *hint,
void *reserved
)
{
int32_t retVal = 0;
retVal = ipc_SetMasterPassword(ssHandle,password,hint);
return retVal;
}
//#if 0
/* Writes A key-value for a given Secret ID in a given keychain.
*
* Parameters:
* ssHandle
* (IN) Handle returned by sscs_CacheOpenSecretStore function. This will have
* context information regarding the SecretStore.
*
* ssFlags
* (IN) ...
*
* keyChainID
* (IN) KeyChainID where the specified SecretID stored.
*
* secretID
* (IN) Specifies the unique secret ID within the keychain. This data is
* encoded in SSCS_SECRET_ID_T.
*
* secretData
* (IN) Specifies the information of the secret stored w.r.t the secretID.
* Points to a SSCS_SECRET_T structure.
*
*
* epPassword
* (IN) Points to an optional field to pass in the Enhanced Protection Password
* for reading a secret.When the password is not present, you can pass in a NULL.
*
*
*
* Return Values:
*/
int sscs_CacheWriteKey
(
void *ssHandle,
uint32_t ssFlags,
SSCS_KEYCHAIN_ID_T *keyChainID,
SSCS_SECRET_ID_T *secretID,
SS_UTF8_T *key,
uint32_t keyLen,
uint8_t *val,
uint32_t valLen,
SSCS_PASSWORD_T *epPassword,
void *reserved
)
{
int32_t retVal = 0;
SSCS_SECRETSTORE_HANDLE_T *ssHandleCopy = (SSCS_SECRETSTORE_HANDLE_T *)ssHandle;
retVal = ipc_WriteKey(ssHandleCopy,ssFlags,keyChainID,secretID,key,keyLen,val,valLen,epPassword, reserved);
return retVal;
}
/* Reads Secret value for a given Secret ID in a given keychain.
*
* Parameters:
* ssHandle
* (IN) Handle returned by sscs_CacheOpenSecretStore function. This will have
* context information regarding the SecretStore.
*
* keyChainID
* (IN) KeyChainID where the specified SecretID stored.
*
* secretID
* (IN) Specifies the unique secret ID within the keychain. This data is
* encoded in SSCS_SECRET_ID_T.
*
* secretData
* (IN/OUT) Specifies the information of the secret stored w.r.t the secretID.
* Points to a SSCS_SECRET_T structure.
*
* epPassword
* (IN) Points to an optional field to pass in the Enhanced Protection Password
* for reading a secret.When the password is not present, you can pass in a NULL.
*
* bytesRequired
* (OUT) Specifies the buffer requirement if it is not possible
* to copy Secret data in the buffer passed by the application.
*
* Return Values :
*/
int32_t sscs_CacheReadKey
(
void *ssHandle,
uint32_t ssFlags,
SSCS_KEYCHAIN_ID_T *keychainID,
SSCS_SECRET_ID_T *secretID,
SS_UTF8_T *key,
uint32_t keyLen,
uint8_t *val,
uint32_t valLen,
SSCS_PASSWORD_T *epPassword,
uint32_t *bytesRequired,
void *reserved
)
{
int32_t retVal = 0;
SSCS_SECRETSTORE_HANDLE_T *ssHandleCopy = (SSCS_SECRETSTORE_HANDLE_T *)ssHandle;
retVal = ipc_ReadKey(ssHandleCopy,keychainID,secretID,key,keyLen,val,valLen,epPassword,bytesRequired);
return retVal;
}
int sscs_IsSecretPersistent
(
void *ssHandle,
uint32_t ssFlags,
SSCS_KEYCHAIN_ID_T *keyChainID,
SSCS_SECRET_ID_T *secretID,
void *reserved
)
{
int32_t retVal = 0;
SSCS_SECRETSTORE_HANDLE_T *ssHandleCopy = (SSCS_SECRETSTORE_HANDLE_T *)ssHandle;
retVal = ipc_IsSecretPersistent(ssHandleCopy,ssFlags,keyChainID,secretID,reserved);
return retVal;
}
//#endif
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,79 @@
/******************************************************************************
%name: sscscache.rc %
%version: 1 %
%date_modified: Tue Apr 05 22:19:55 2005 %
*
* File Name: ssndk.rc
*
* Description: This is the win32 client version resource file.
*
* Author(s): Cameron Mashayekhi
*
* Modifier(s): None.
*
* Unpublished Copyright (c) (1998-2003) Novell, All Rights Reserved.
*
* THIS WORK IS SUBJECT TO U.S. AND INTERNATIONAL COPYRIGHT LAWS AND TREATIES.
* USE AND REDISTRIBUTION OF THIS WORK IS SUBJECT TO THE LICENSE AGREEMENT
* ACCOMPANYING THE SOFTWARE DEVELOPMENT KIT (SDK) THAT CONTAINS THIS WORK.
* PURSUANT TO THE SDK LICENSE AGREEMENT, NOVELL HEREBY GRANTS TO DEVELOPER A
* ROYALTY-FREE, NON-EXCLUSIVE LICENSE TO INCLUDE NOVELL'S SAMPLE CODE IN ITS
* PRODUCT. NOVELL GRANTS DEVELOPER WORLDWIDE DISTRIBUTION RIGHTS TO MARKET,
* DISTRIBUTE, OR SELL NOVELL'S SAMPLE CODE AS A COMPONENT OF DEVELOPER'S
* PRODUCTS. NOVELL SHALL HAVE NO OBLIGATIONS TO DEVELOPER OR DEVELOPER'S
* CUSTOMERS WITH RESPECT TO THIS CODE.
*
*****************************************************************************/
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
#include "ssbldver.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION WSS_BLD_NO
PRODUCTVERSION WSS_BLD_NO
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", SSS_WCLIENT_STRING "\0"
VALUE "CompanyName", SSS_COMPANY_STR "\0"
VALUE "FileDescription", SSS_NSSS_PR_STRING "\0"
VALUE "FileVersion", WSS_BLD_STR "\0"
VALUE "LegalCopyright", SSS_COPYRIGHT_STR "\0"
VALUE "LegalTrademarks", SSS_PATENT_STR "\0"
VALUE "OriginalFilename", SSS_NSSS_STR "\0"
VALUE "ProductName", SSS_PRODUCT_STR "\0"
VALUE "ProductVersion", GSS_BLD_STR "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC