1.9 Multiple Tree Support

eDirectory Libraries for C provide multiple tree support. Your application can have the user log in to each tree, and then the libraries can manage the background authentication as the user accesses resources in each eDirectory tree.

Client applications and NLM applications use different methods.

The libraries supply the following functions for discovering eDirectory trees.

Function

Description

NWDSScanConnsForTrees

Scans existing connections and returns tree names.

NWDSScanForAvailableTrees

Scans the bindery of the specified connection and returns one tree name. To return multiple tree names, the function must be called multiple names.

NWDSReturnBlockOfAvailableTrees

Scans the bindery of the specified connection and returns the specified number of tree objects.

1.9.1 NLM Applications and Multiple Tree Identities

An NLM has a current user associated with each thread group. The eDirectory Libraries for C use the current user for background authentication. If an NLM needs to establish connections to multiple eDirectory trees or use multiple identities to log in to the same eDirectory tree, the NLM must manage the current user in the thread group structure. Two functions, NWDSGetCurrentUser and NWDSSetCurrentUser, allow this manipulation.

An NLM creates a new identity by first calling the NWDSSetCurrentUser function with identity parameter set to zero (0). This removes the current user from the thread group structure. The NLM then calls NWDSCreateContextHandle. The eDirectory libraries check the thread group structure for a current user. Since there isn't one, the eDirectory libraries create a new current user for the thread group. The last step is a call to NWDSLogin which authenticates and establishes credentials for this new user.

The NWDSGetCurrentUser function allows the NLM to get the current user information so that information can be saved and used again with that identity. The NWDSSetCurrentUser function allows that identity to be restored to a thread group.

If an NLM wants to switch between two or more users, the NLM must save and manage the user information for each user created. The eDirectory libraries do not save the user information for multiple users. They maintain only information about the current user in the thread group structure. If the NLM does not save and manage the information for multiple users, the information is lost. For step-by-step instructions for accessing multiple eDirectory trees, see Establishing Identities to Multiple eDirectory Trees—NLM Platform.

1.9.2 Client Applications and Multiple Tree Identities

Applications for Windows 95, Windows 98, and Windows NT establish identities to multiple eDirectory trees by manipulating the DCK_TREE_NAME key in the context handle.

For step-by-step instructions for accessing multiple eDirectory trees, see Establishing Identities to Multiple eDirectory Trees—Client Platforms.