[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: Antwort: Re: Antwort: OpenLDAP API
I figured it out. The os is raising SIGPIPE (write() to a broken socket)
and by default it terminates the program. I just needed to ignore the
signal or write a special handler for it.
I was wrong about the ldap postfix code, it looks fine in the latest
version. If proftp-ldap is crashing on broken ldap connections, this can
easily be corrected.
-Igor
On Tue, 2 Apr 2002, Igor Brezac wrote:
>
> True. However, ldap_unbind() should not produce an exception in this
> case. I read the postfix ldap code and they do not call ldap_unbind() in
> this case, they just call ldap_init again. This will cause a small memory
> leak whenver ldap server is restarted.
>
> -Igor
>
> On Tue, 2 Apr 2002 f.skale@mainwork.com wrote:
>
> >
> > I think that could be managed with ldap_perror() to deal with the
> > connection if the server is down.
> > If i don't put the perror line in, than there is an exception procuded by
> > the ldap library.
> > The same error occurs when you use proftp-ldap and enter the wrong
> > search-base.
> > Franz
> > ____________________________________________________
> > Franz Skale
> > mainwork information technology AG
> > IT-Services
> > Tech Gate Vienna
> > Donaucitystrasse 1
> > A-1220 Wien
> > Tel: +43 1 333 48 58-0
> > Fax: +43 1 333 48 58-24
> > e-mail: f.skale@mainwork.com
> > Internet: http://www.mainwork.com
> >
> >
> >
> > Igor Brezac
> > <igor@ipass.n An: <f.skale@mainwork.com>
> > et> Kopie: <OpenLdap-Software@OpenLDAP.com>
> > Thema: Re: Antwort: OpenLDAP API
> > 02.04.2002
> > 16:22
> >
> >
> >
> >
> >
> >
> >
> > Thanks for the response. This program works fine if the ldap server is
> > available at all times. Try to put a break right before ldap_search_st()
> > and stop the ldap server at that point.
> >
> > I am working on ldap based auth modules for saslauthd/saslv[12] and I am
> > testing the recovery from ldap server outages.
> >
> > -Igor
> >
> > On Tue, 2 Apr 2002 f.skale@mainwork.com wrote:
> >
> > >
> > > I tested the short program and it worked for me by modifying the base_dn
> > > and the search filter.
> > > Perhaps your ACL is so strong not to allow a anoymous simple bind.#
> > > Have you runed on debugging or other logging style ?
> > > You should supply a username and password to bind as manager or anything
> > > else.
> > >
> > > My ldap_simple_bind:
> > > rc = ldap_simple_bind_s(ldi, "cn=Manager,dc=mainwork,dc=nw", "secure");
> > >
> > > My filter:
> > > char *filter = "uid=Admin*";
> > >
> > > Output:
> > > DN: uid=Admin,ou=Admins,ou=Mainhost01,o=mainwork information technology
> > > AG,dc=mainwork,dc=nw
> > >
> > >
> > > Rgds Franz
> > >
> > >
> > >
> > > ____________________________________________________
> > > Franz Skale
> > > mainwork information technology AG
> > > IT-Services
> > > Tech Gate Vienna
> > > Donaucitystrasse 1
> > > A-1220 Wien
> > > Tel: +43 1 333 48 58-0
> > > Fax: +43 1 333 48 58-24
> > > e-mail: f.skale@mainwork.com
> > > Internet: http://www.mainwork.com
> > >
> > >
> > >
> > > Igor Brezac
> > > <igor@ipass.net> An:
> > <OpenLdap-Software@OpenLDAP.com>
> > > Gesendet von: Kopie:
> > > owner-openldap-software@Op Thema: OpenLDAP
> > API
> > > enLDAP.org
> > >
> > >
> > > 01.04.2002 16:56
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > I apologize for the duplicate message, I forgot to use the subject line.
> > >
> > > Hello,
> > >
> > > I use Solaris 8 and openldap 2.0.23. The following short program crashes
> > > on the ldap_unbind() call. I tried various different versions of this
> > > program without success. Am I doing something wrong here?
> > >
> > > Your help will be greatly appreciated.
> > >
> > > -Igor
> > >
> > > #include <sys/types.h>
> > > #include <stdlib.h>
> > >
> > > #include <lber.h>
> > > #include <ldap.h>
> > >
> > > int main() {
> > >
> > > int rc;
> > > LDAP *ldi;
> > > struct timeval tv;
> > > LDAPMessage *res = NULL;
> > > LDAPMessage *msg = NULL;
> > > char *dn;
> > > char *server = "ldap://10.1.1.197/";
> > > char *base_dn = "o=pb";
> > > char *filter = "uid=igor";
> > > char *attrs[] = {"dn",NULL};
> > >
> > >
> > > rc = ldap_initialize(&ldi, server);
> > > if (rc != LDAP_SUCCESS) {
> > > exit (2);
> > > }
> > >
> > > rc = ldap_simple_bind_s(ldi, "", "");
> > > if (rc != LDAP_SUCCESS) {
> > > exit (2);
> > > }
> > >
> > > // If the ldap server is no longer available at this point
> > >
> > > tv.tv_sec = 5;
> > > tv.tv_usec = 0;
> > > rc = ldap_search_st(ldi, base_dn, LDAP_SCOPE_SUBTREE, filter,
> > > (char **) attrs, 0, &tv, &res);
> > >
> > > if (rc != LDAP_SUCCESS) {
> > > ldap_get_option(ldi, LDAP_OPT_ERROR_NUMBER, &rc);
> > > printf("ldap_search_st() error %s\n",
> > ldap_err2string(rc));
> > > ldap_msgfree(res);
> > > ldap_unbind(ldi);
> > >
> > > // ldap_unbind will cause a dump here
> > >
> > > exit(2);
> > > }
> > >
> > > msg = ldap_first_entry(ldi, res);
> > > dn = ldap_get_dn(ldi, msg);
> > > printf("DN: %s\n", dn);
> > >
> > > ldap_msgfree(msg);
> > > free(dn);
> > > ldap_unbind_s(ldi);
> > > exit (1);
> > > }
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> >
> >
>
>