Debug(LDAP_DEBUG_ARGS, "==> bdb_add: %s\n", e->e_dn, 0, 0);
Debug(LDAP_DEBUG_ARGS, "==> bdb_add: %s\n", e->e_dn, 0, 0);
/* check entry's schema */
rc = entry_schema_check( be, e, NULL, &text, textbuf, textlen );
if ( rc != LDAP_SUCCESS ) {
/* check entry's schema */
rc = entry_schema_check( be, e, NULL, &text, textbuf, textlen );
if ( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE,
"bdb_add: txn_begin failed: %s (%d)\n",
db_strerror(rc), rc, 0 );
Debug( LDAP_DEBUG_TRACE,
"bdb_add: txn_begin failed: %s (%d)\n",
db_strerror(rc), rc, 0 );
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
matched_dn, NULL, refs, NULL );
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
matched_dn, NULL, refs, NULL );
#ifdef BDB_SUBENTRIES
if ( is_entry_subentry( p ) ) {
/* parent is a subentry, don't allow add */
#ifdef BDB_SUBENTRIES
if ( is_entry_subentry( p ) ) {
/* parent is a subentry, don't allow add */
#ifdef BDB_ALIASES
if ( is_entry_alias( p ) ) {
/* parent is an alias, don't allow add */
#ifdef BDB_ALIASES
if ( is_entry_alias( p ) ) {
/* parent is an alias, don't allow add */
char *matched_dn = p->e_dn;
BerVarray refs = get_entry_referrals( be, conn, op, p );
char *matched_dn = p->e_dn;
BerVarray refs = get_entry_referrals( be, conn, op, p );
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
matched_dn, NULL, refs, NULL );
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
matched_dn, NULL, refs, NULL );
Debug( LDAP_DEBUG_TRACE, "bdb_add: %s denied\n",
pdn.bv_len == 0 ? "suffix" : "entry at root",
0, 0 );
Debug( LDAP_DEBUG_TRACE, "bdb_add: %s denied\n",
pdn.bv_len == 0 ? "suffix" : "entry at root",
0, 0 );
rc = LDAP_INSUFFICIENT_ACCESS;
text = "no parent, cannot add subentry";
goto return_results;;
rc = LDAP_INSUFFICIENT_ACCESS;
text = "no parent, cannot add subentry";
goto return_results;;
/* dn2id index */
rc = bdb_dn2id_add( be, ltid, &pdn, e );
if ( rc != 0 ) {
/* dn2id index */
rc = bdb_dn2id_add( be, ltid, &pdn, e );
if ( rc != 0 ) {
Debug( LDAP_DEBUG_TRACE, "bdb_add: dn2id_add failed: %s (%d)\n",
db_strerror(rc), rc, 0 );
Debug( LDAP_DEBUG_TRACE, "bdb_add: dn2id_add failed: %s (%d)\n",
db_strerror(rc), rc, 0 );
/* attribute indexes */
rc = bdb_index_entry_add( be, ltid, e, e->e_attrs );
if ( rc != LDAP_SUCCESS ) {
/* attribute indexes */
rc = bdb_index_entry_add( be, ltid, e, e->e_attrs );
if ( rc != LDAP_SUCCESS ) {
Debug(LDAP_DEBUG_TRACE, "bdb_add: added%s id=%08lx dn=\"%s\"\n",
op->o_noop ? " (no-op)" : "", e->e_id, e->e_dn );
Debug(LDAP_DEBUG_TRACE, "bdb_add: added%s id=%08lx dn=\"%s\"\n",
op->o_noop ? " (no-op)" : "", e->e_id, e->e_dn );
Debug( LDAP_DEBUG_TRACE, "bdb_add: %s : %s (%d)\n",
text, db_strerror(rc), rc );
Debug( LDAP_DEBUG_TRACE, "bdb_add: %s : %s (%d)\n",
text, db_strerror(rc), rc );