Back to index

openldap  2.4.31
Functions
dn2entry.c File Reference
#include "portable.h"
#include <stdio.h>
#include <ac/string.h>
#include "back-mdb.h"

Go to the source code of this file.

Functions

int mdb_dn2entry (Operation *op, MDB_txn *tid, MDB_cursor *m2, struct berval *dn, Entry **e, int matched)

Function Documentation

int mdb_dn2entry ( Operation op,
MDB_txn tid,
MDB_cursor m2,
struct berval dn,
Entry **  e,
int  matched 
)

Definition at line 31 of file dn2entry.c.

{
       struct mdb_info *mdb = (struct mdb_info *) op->o_bd->be_private;
       int rc, rc2;
       ID id = NOID;
       struct berval mbv, nmbv;
       MDB_cursor *mc;

       Debug(LDAP_DEBUG_TRACE, "mdb_dn2entry(\"%s\")\n",
              dn->bv_val ? dn->bv_val : "", 0, 0 );

       *e = NULL;

       rc = mdb_dn2id( op, tid, m2, dn, &id, &mbv, &nmbv );
       if ( rc ) {
              if ( matched ) {
                     rc2 = mdb_cursor_open( tid, mdb->mi_id2entry, &mc );
                     if ( rc2 == MDB_SUCCESS ) {
                            rc2 = mdb_id2entry( op, mc, id, e );
                            mdb_cursor_close( mc );
                     }
              }

       } else {
              rc = mdb_cursor_open( tid, mdb->mi_id2entry, &mc );
              if ( rc == MDB_SUCCESS ) {
                     rc = mdb_id2entry( op, mc, id, e );
                     mdb_cursor_close(mc);
              }
       }
       if ( *e ) {
              (*e)->e_name = mbv;
              if ( rc == MDB_SUCCESS )
                     ber_dupbv_x( &(*e)->e_nname, dn, op->o_tmpmemctx );
              else
                     ber_dupbv_x( &(*e)->e_nname, &nmbv, op->o_tmpmemctx );
       }

       return rc;
}

Here is the call graph for this function:

Here is the caller graph for this function: