Calling the function SmDirGetLastErrMsg() retrieves the last error message that resulted from a Directory API call.
If a user operation or directory operation fails, store the error message in szErrMsg, which is the third field of the instance handle structure. You can then call SmDirGetLastErrMsg() to retrieve the error message. The SiteMinder Policy Server also calls SmDirGetLastErrMsg() upon operation failure.
This function call is made for both the directory instance and the user instance. Either the directory instance handle or user instance handle can be passed through pInstanceHandle. Your code must determine which handle is passed and return the appropriate error message. See the sample code for an example.
After calling SmDirGetLastErrMsg(), the SiteMinder Policy Server calls SmDirFreeString() to free the error buffer.
Syntax
char* SM_EXTERN SmDirGetLastErrMsg ( const Sm_Api_Context_t* lpApiContext, void* pHandle, void* pInstanceHandle );
Parameter |
I/O |
Description |
---|---|---|
lpApiContext |
I |
Pointer to the API context structure. |
pHandle |
I |
The address of the pointer returned by SmDirInit(). |
pInstanceHandle |
I |
The addresses of a pointer to the user instance handle or directory instance handle. |
Returns
The last error message occurred during a directory operation or user operation.
Remarks
This function is called when you are searching for users or groups and the lookup (SmDirLookup()) fails.
Sample Code Information
In the sample code for SmDirValidateUserPolicyRelationship(), under the condition that the policy resolution is UserGroup, there is a call to the function chk_grp(). The third parameter of chk_grp() is an output parameter that returns szErrMsg in the user handle. If you then called SmDirGetLastErrMsg() and passed the user instance handle, you would get the value stored in szErrMsg.
Copyright © 2014 CA.
All rights reserved.
|
|