LDAP User Connection
Authenticator availability
Native (SRP) and Certificate (X.509) are the self-authenticating principal types every kS provides. Directory authenticators (the LDAP/Kerberos lineages, including the Windows and NIS samples) are build-dependent and not present in every shipped kS.
LDAP User Connection
The following example illustrates how to make a connection to a Key Server with a LDAP user.
Code Sample
See the C environment settings for details on setting the project environment.
< c_connect_ldap.cpp>
/****************************************************************************************
* c_connect_ldap.c
*
*
*
*****************************************************************************************/
#include <stdio.h>
#include "teagent_c.h"
void PrintError(const char * msg)
{
char szErr[1024];
uint32_t nLength = 1024;
uint32_t nCode = GetLastTEError(szErr, &nLength);
printf("%s Code = 0x%x, Message = %s\n", msg, nCode, szErr);
}
int main()
{
TE_HANDLE h;
char * szServerName = "localhost"; /* server name */
long lPort = 8888; /* port number */
char * szUserName = "cn=bob,o=emedna"; /* user name */
char * szPassword = "bob"; /* password */
/* Initialize the TE environment */
TEEnvInit();
/* Open a connection */
h = OpenConnectionWithLDAPUser(
TE_NORMAL_CONNECTION, /* connection type */
szServerName, /* TE server name */
lPort, /* TE server port */
szUserName, /* user name */
szPassword /* password */
);
if (h == 0)
{
PrintError("Connection error:");
}
else
printf("Connected to %s at %d as %s\n\n", szServerName, lPort, szUserName);
/* Close a connection */
CloseConnection(h);
printf("Disconnected from server\n\n");
/* Uninitialize the TE environment */
TEEnvClose();
return 0;
Output
Connected to localhost at 8888 as cn=bob,o=emedna
Disconnected from server