VgwAuthenticateFreeFnc


Use the VgwAuthenticateFreeFnc function to release resources, such as memory for data structures stored in a certificate, acquired during authentication. The Verity engine calls your VgwAuthenticateFreeFnc function when freeing the resources for the user holding the certificate.


Syntax

VdkError VgwAuthenticateFreeFnc(
   VSecCertificate   vsecCert)

Arguments

 


vsecCert

VSecCertificate   A certificate handle.


Member Descriptions

For a description of the VSecCertificate structure, see VSecCertificateRec Members under the VgwAuthenticateFnc function.


Returns

This function must return one of the following error codes:

VdkSuccess for success

 

VdkError_* for a standard Verity Developer Kit API error as described in the Verity Developer’s Kit Programming Reference

 

VdkFail for a non-specific error

 


Discussion

In addition to the Verity engine calling your VgwAuthenticateFreeFnc function when freeing the user’s certificates, you can call VgwAuthenticateFreeFnc also; for example, if your VgwAuthenticateFnc function results in an error, you may need to free resources allocated in VgwAuthenticateFnc before terminating.

You should free your certificate, referenced by vsecCert, after first releasing all other resources referenced by the certificate.


Example

static VdkError
VDK_CALLBACK VgwAuthenticateFree(VSecCertificate pCert)
{
if (!pCert)
return VdkSuccess;

if (pCert->prState & TicketSticky) {

/****************************************
* set TicketInvalid if not ours to free
****************************************/

pCert->prState |= (TicketEmpty | TicketInvalid);
pCert->prState &= ~TicketValid;
} else {

/*************************************************************
* free the VDK certificate object created in VgwAuthenticate
*************************************************************/

free(pCert);
}
return VdkSuccess;
}