Previous Topic: SmDirGetUserRoles()

Next Topic: SmDirInitDirInstance()

SmDirInit()

SmDirInit() is called when SiteMinder initializes the directory services provider for the custom namespace.

This function is called once before any other Directory API functions are called. The function returns the address of a pointer to the handle for the directory. The handle is passed in all subsequent function calls.

Once the administration process starts, the SiteMinder Policy Server calls SmDirInit() the first time you perform any task for which the custom directory provider is required.

For example, if you were to start the Policy Server, then immediately view the properties of a user directory with a Custom namespace, the SiteMinder Policy Server would call SmDirInit(), then call SmDirInitDirInstance().

Syntax

int SM_EXTERN SmDirInit (
   const Sm_Api_Context_t*  lpApiContext,
   void**                   ppHandle,
   const char*              lpszParameter
);

Parameter

I/O

Description

lpApiContext

I

Pointer to the API context structure.

ppHandle

O

The address of a pointer to the handle for the Directory API. This parameter is initialized in the call to SmDirInit() and is passed to all subsequent function calls.

For example, if you were using SmDirInit() to load a shared library on the directory side, you could use ppHandle to store function pointers to all the functions in that shared library.

lpszParameter

I

The null-terminated string specified in the Parameter field of the SiteMinder User Directory Dialog box.

Returns

Returns 0 if successful or -1 if not successful.

Remarks

Instantiate ProviderHandle_t when SmDirInit() is called. This handle is then passed to almost all subsequent functions. The same value need not be carried through the entire process. You are permitted to change the value.

Release ProviderHandle_t when SmDirRelease() is called.

You could use SmDirInit() to load another shared library. The vendor of the directory containing your data may provide an interface that you can implement by building a shared library. You could use SmDirInit() to load that shared library by placing the path to the shared library in the Parameter field on the Directory Setup tab of the User Directory Dialog box. The string entered in the Parameter field is passed to lpszParameter in calls to SmDirInit() and SmDirInitDirInstance().

Note: The string entered in the Parameter field is also passed to lpszSearchRoot in calls to SmDirSearch() and SmDirSearchCount(). If your code for SmDirInit() needs to use lpszParameter and your code for the search functions needs a search root, you will have to parse the string from the Parameter field.


Copyright © 2010 CA. All rights reserved. Email CA about this topic