#include <ictx.h>; int ictxRemoveExpiredIdContexts ( ictxStorageMech_t * storageMechanism, ictxError_t * errorInfo )
The ictxRemoveExpiredIdContexts() function removes all expired identity contexts that were stored using the designated storage mechanism.
Refer to storage mechanism for authority information. See ictxStorageMech--Identity Context Storage Mechanism Parameter.
The return value from the API.
The following example removes expired identity contexts. Note: Read the Code example disclaimer for important legal information.
#include <ictx.h> #include <string.h> int removeExpired() { int rc; ictxStorageMech_t storageMech; ictxError_t errorInfo; /*----------------------------------------------------------------*/ /* EIM variables */ /*----------------------------------------------------------------*/ char eimerr[200]; EimRC * err; EimHandle handle; char * ldapURL = "ldap://eimsystem:389/ibm-eimDomainName=myEimDomain,o=mycompany,c=us"; EimConnectInfo con; /*----------------------------------------------------------------*/ /* EIM Setup: For the storage mechanism we will use EIM so we */ /* need to get a connected EIM handle. */ /*----------------------------------------------------------------*/ /* EIM: Set up error structure for EIM use */ /*----------------------------------------------------------------*/ memset(eimerr,0x00,200); err = (EimRC *)eimerr; err->memoryProvidedByCaller = 200; /*----------------------------------------------------------------*/ /* EIM: Create a new eim handle using a specified URL */ /*----------------------------------------------------------------*/ if (0 != (rc = eimCreateHandle(&handle, ldapURL, err))) { . . . return -1; } /*----------------------------------------------------------------*/ /* EIM: Set up EIM connection information */ /*----------------------------------------------------------------*/ con.type = EIM_SIMPLE; con.creds.simpleCreds.protect = EIM_PROTECT_NO; con.creds.simpleCreds.bindDn = "cn=admin"; con.creds.simpleCreds.bindPw = "secret"; con.ssl = NULL; /*----------------------------------------------------------------*/ /* EIM: Connect to LDAP URL defined by handle with specified */ /* connection credentials */ /*----------------------------------------------------------------*/ if (0 != (rc = eimConnect(&handle, con, err))) { eimDestroyHandle(&handle, err); . . . return -1; } /*----------------------------------------------------------------*/ /* Set up authentication information */ /*----------------------------------------------------------------*/ storageMech.format = ICTX_STORAGE_MECH_EIM_0; storageMech.storageMech.format0.eimHandle = &handle; /*----------------------------------------------------------------*/ /* Retrieve authentication context */ /*----------------------------------------------------------------*/ if (0 != (rc = ictxRemovedExpiredIdContexts(&storageMech, &errorInfo))) { eimDestroyHandle(&handle, err); . . . return -1; } eimDestroyHandle(&handle, err); return 0; }
Top | Security APIs | APIs by category |