FW: ldap_sasl_interactive_bind_s: Can't contact LDAP server

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Title: FW: ldap_sasl_interactive_bind_s: Can't contact LDAP server

Ne ideas???

 -----Original Message-----
From:   Gagan Puri 
Sent:   Monday, March 10, 2003 2:54 PM
To:     Ajay Bansal
Subject:        ldap_sasl_interactive_bind_s: Can't contact LDAP server
Importance:     High

Hi all,

I have wriiten a program that fetches fax no. from the ldap user directory.  I am compiling this program using ldap sdk 5.08 on Linux 7.3 box. I am using gcc 3.2.1. The compile line is as below:

g++ -o ldapsearch -I/home//nsldap/5.08/Linux/include -L/home//nsldap/5.08/Linux/lib -lldap50 -lssldap50 -lssl3 -lprldap50 ldap_search.cpp

The program is getting compiled properly.

When i run the program I get following error:
ldap_sasl_interactive_bind_s: Can't contact LDAP server

What could be the problem??? Nprogram works fine on other unxi machines

The sample program is given as below:

#include<stdio.h>
#include<ldap.h>
#include<ldap_ssl.h>

int main()
{
    LDAP *ld;
    LDAPMessage *result, *e;
    char **vals;
    char *attrs[2];
    int i;

   
    if( (ld = ldap_init("192.168.122.118",5555)) == NULL )
    {
        perror("ldap_init");
        return(1);
    }

    if(ldap_simple_bind_s(ld,"cn=Directory Manager","abc")!=LDAP_SUCCESS)
    {
        ldap_perror(ld,"ldap_simple_bind_s");
        return(1);
    }
    attrs[0] = "faxnumber";
    attrs[1] = NULL;
    if(ldap_search_s(ld,"uid=gagan puri,ou=people,dc=ad,dc=infosys,dc=com",LDAP_SCOPE_BASE,"(objectclass=*)",attrs,0,&result) != LDAP_SUCCESS)

    {
        ldap_perror(ld,"ldap_search_s");
        return(1);
    }

    if((e=ldap_first_entry(ld,result)) !=NULL)
    {
        if((vals=ldap_get_values(ld,e,"faxnumber"))!=NULL)
        {
            for(i=0;vals[i] != NULL; i++)
            {
                printf("%s\n",vals[i]);
            }
            ldap_value_free(vals);
        }
    }
    ldap_msgfree(result);
    ldap_unbind(ld);
    return(0);
}

Kindly advise,
Gagan


[Index of Archives]     [Kernel Newbies]     [Red Hat General]     [Fedora]     [Red Hat Install]     [Linux Kernel Development]     [Yosemite News]

  Powered by Linux