[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: OT: Please help debuging problems with smba3

At 05:23 AM 1/12/2005, Harry Rüter wrote:
>Hi list,
>i'm having serious problems configuring
>Samba-3.0.10 as PDC together with openldap 2.2.20.
>Sure this has obviously nothing to do with
>openldap itself, as this - i think - works well.

For help on the Samba particulars, I suggest you
post to the Samba list.  However, your questions about
how certain OpenLDAP client library functions behave is
actually quite on topic.  You, however, just need to
bridge the gap of knowledge... (don't expect anyone here
to know anything about Samba).

>So, i'm trying to find out what's wrong in the samba-code,
>and i set some DEBUG statements in the smaba-sources.

Have you verified that the operations you think the code
is performing can be performed using OpenLDAP command line

For instance, if you are having trouble with simple bind,
is it just with the code or can you reproduce the problem
with ldapwhoami(1) or ldapsearch(1)?

>The code i'm working with is (sorry, wrapped because of the mailer):
>rc = ldap_simple_bind_s(ldap_struct, ldap_dn, ldap_secret);

How was ldap_struct declared and initialized?

>if (rc != LDAP_SUCCESS)
>  char *ld_error = NULL;
>  ldap_get_option(ldap_state->ldap_struct, LDAP_OPT_ERROR_STRING,
>                                &ld_error);
>  DEBUG(ldap_state->num_failures ? 2 : 0,
>                   ("failed to bind to server with dn= %s Error:%s\n\t%s\n",
>                               ldap_dn ? ldap_dn : "(unknown)", ldap_err2string(rc),
>                               ld_error ? ld_error : "(unknown)"));

It makes no sense to call ldap_err2string with rc, as rc is not an
error number, -1 here is just an error indicator.  One has to use
ldap_get_option w/ LDAP_OPT_ERROR_NUMBER to get the actual error
number.  Or use the ldap_sasl_bind_s(3) (w/ LDAP_SASL_SIMPLE for
simple bind) as this call does return the error number.

See draft-ietf-ldapext-ldap-c-api for details here.

>                DEBUG(0, ("smbldap_connect_system  ERROR: rc=%d\"\n",rc));
>                SAFE_FREE(ld_error);
>                ldap_state->num_failures++;
>                return rc;
>        }
>It shows the following terminal-output
>when testing the nonworking program :
>failed to bind to server with dn= cn=ldapmanager,dc=hrnet,dc=de Error: Can't contact LDAP server
>        (unknown)
>smbldap_connect_system  ERROR: rc=-1"
>Error = -1 means, the LDAP-server is down,
>which is not true, as tests with ldapsearch

see above comments regarding -1.

>So i try to find out the reason why the call
>rc = ldap_simple_bind_s(ldap_struct, ldap_dn, ldap_secret);
>doesn't work.
>I made debuging statements which showed that
>ldap_dn = cn=ldapmanager,dc=hrnet,dc=de
>ldap_secret = secret
>which is correct.

>Now i wanna know, what's in  ldap_struct,
>but i can't find the type-definition of this struct.

It's opaque by design.

>So, and here's my request,
>could someone send the definition of this struct,
>so i can use it in further debug-statements.

You can look in the internal headers for its definition.

-- Kurt