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

backend - base entry



Hi all!

Need some urgent help.

I am developing an OpenLDAP custom backend to a COM/DCOM based database
server, and I've run into the following problem:

When sending replies back (from the OpenLDAP server to a mail client), I
  could not figure out how to obtain the LDAP entry structure
corresponding to the base of the search, in order to be able to append
attributes to it and reply to the client.

A concrete example:
==================

Below are two snippets of code that ilustrate the problem. They try to build
and send
a dummy entry in response to a client's request.
The base of the search is:  dc=company,dc=de

The first snippet builds a subentry ("cn=luzar") of the base
("dc=company,dc=de"), attaches some
attributes and sends the whole stuff back to the client. And it works!

                // creating a subentry
                Entry           *mye = (slap_entry*) ch_calloc( 1,
sizeof(Entry) );
                mye->e_dn = "cn=luzar,dc=company,dc=de";
                mye->e_ndn = strdup( mye->e_dn );
                (void) dn_normalize( mye->e_ndn );
                mye->e_attrs = NULL;
                mye->e_private = NULL;

                //-------------------------------------- mail Attr.
                val1 = ber_bvstr("luzar@company.de");
                rc = slap_str2ad( "mail", &ad_cN, &text );
                vals[0] = val1;
                vals[1] = NULL;
                attr_merge( mye, ad_cN, vals );
                //-------------------------------------- sending the entry
                send_search_entry       ( be, conn, op, mye, attrs,
attrsonly, NULL );


The second snippet builds an entry that corresponds to the base of the
search, attaches some attribute to it
and sends the structure back to the client.

                // creating a baseentry
                Entry           *mye = (slap_entry*) ch_calloc( 1,
sizeof(Entry) );
                mye->e_dn = "dc=company,dc=de";
                mye->e_ndn = strdup( mye->e_dn );
                (void) dn_normalize( mye->e_ndn );
                mye->e_attrs = NULL;
                mye->e_private = NULL;

                //-------------------------------------- mail
                val1 = ber_bvstr("contact@company.de");
                rc = slap_str2ad( "mail", &ad_cN, &text );
                vals[0] = val1;
                vals[1] = NULL;
                attr_merge( mye, ad_cN, vals )

                //-------------------------------------- sending the entry
                send_search_entry       ( be, conn, op, mye, attrs,
attrsonly, NULL );


 HERE'S MY PROBLEM!!!! The entry is sent as if it were a subentry of the
base ("dc=company,dc=de"), and
 the attributes are attached to the subentry instead of being attached to
the entry itself.

 HOW CAN I ATTACH ATTRIBUTES TO THE BASE ENTRY OF A SEARCH AND NOT TO ONE OF
ITS SUBENTRIES?

 Thanks!!!!!!!!

Sven Luzar
Stiftung Forschungszentrum für Informatik
Haid und Neu Straße 10-14
76131 Karlsruhe

EMail:          luzar@fzi.de
Homepage:       http://www.fzi.de