C H A P T E R 2

Working with Nodes

if ( dirStatus == eDSNoErr )

{

dirStatus = MyOpenDirNode( &nodeRef ); if ( dirStatus == eDSNoErr )

{

dsCloseDirNode( nodeRef );

}

}

if ( gDirRef != NULL )

{

dirStatus = dsCloseDirService( gDirRef );

}

}

long MyOpenDirNode ( tDirNodeReference *outNodeRef )

{

long dirStatus = eDSNoErr; char nodeName[ 256 ] = "\0"; tDataListPtr nodePath = NULL; printf( "Open Node : " ); fflush( stdout );

scanf( "%s", nodeName );

printf( "Opening: %s.\n", nodeName );

nodePath = dsBuildFromPath( gDirRef, nodeName, "/" ); if ( nodePath != NULL )

{

dirStatus = dsOpenDirNode( gDirRef, nodePath, outNodeRef ); if ( dirStatus == eDSNoErr )

{

printf( "Open succeeded. Node Reference = %lu\n", (unsigned long)outNodeRef );

}

else

{

printf( "Open node failed. Err = %ld\n", dirStatus );

}

}

dsDataListDeallocate( gDirRef, nodePath ); free( nodePath );

return( dirStatus ); } // MyOpenDirNode

Authenticating a User to a Node

To authenticate itself to the Open Directory for the purposes of reading, writing, or making changes to a node, an Open Directory client application calls dsDoDirNodeAuth. The dsDoDirNodeAuth function handles authentication methods that use one or more steps to complete the authentication process.

To determine the authentication methods that a node supports, call dsGetDirNodeInfo for the node and request the kDSNAttrAuthMethod attribute. For any particular user, some methods may not be supported. The available authentication methods depend on the authentication authority of the user that is being authenticated.

Authenticating a User to a Node

29

2007-01-08 © 2007 Apple Inc. All Rights Reserved.

Page 29
Image 29
Apple OS X manual Authenticating a User to a Node