Connecting to LDAP via Directory Services
Connecting to LDAP via Directory Services
- Subject: Connecting to LDAP via Directory Services
- From: "Alexander F. Hartner" <email@hidden>
- Date: Thu, 8 Apr 2004 21:43:15 +0200
I am trying to connect to LDAP via the following sample code. When I
run it I get error -14008 which is eDSNodeNotFound 14008 Specified
node could not be found. I guess that my path is formed incorrectly. I
searched just about everywhere, but I can't find any documentation on
how I must specify the path to be able to connect to ldap.
Any suggestions welcome
Alex
#import "LDAPBrowserController.h"
#import <stdio.h>
#import <DirectoryService/DirectoryService.h>
@implementation LDAPBrowserController
long MyOpenDirNode ( tDirNodeReference *outNodeRef, tDirReference
*gDirRef)
{
long dirStatus = eDSNoErr;
char nodeName[ 256 ] = "
ldap://bumblebee:389\0";
tDataListPtr nodePath = NULL;
printf( "Open Directory Node : " );
fflush( stdout );
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 );
}
}
return( dirStatus );
}
- (IBAction)go:(id)sender
{
printf("GO \n");
long dirStatus = eDSNoErr;
tDirNodeReference nodeRef = NULL;
tDirReference gDirRef;
dirStatus = dsOpenDirService( &gDirRef );
if ( dirStatus == eDSNoErr )
{
dirStatus = MyOpenDirNode( &nodeRef, &gDirRef );
if ( dirStatus == eDSNoErr )
{
dsCloseDirNode( nodeRef );
}
}
if ( gDirRef != NULL )
{
dirStatus = dsCloseDirService( gDirRef );
}
}
@end
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.