Skip to content
Snippets Groups Projects
Commit eb0421c4 authored by Pierangelo Masarati's avatar Pierangelo Masarati
Browse files

fix several schema checking issues; add rename specific statement for entry...

fix several schema checking issues; add rename specific statement for entry renaming without losing ID (helps e.g. in renaming referrals, otherwise referential integrity would prevent del/add because of referenced stuff in ldap_referrals and ldap_entry_objclasses); referrals need schemacheck off otherwise objectClass chain is invalid (they need to be attached to another objectClass by now; will address this later)
parent b4e37e51
No related branches found
No related tags found
No related merge requests found
...@@ -43,11 +43,13 @@ ...@@ -43,11 +43,13 @@
* - operational attributes * - operational attributes
* - empty attributes * - empty attributes
*/ */
#define backsql_opattr_skip(ad) \
(is_at_operational( (ad)->ad_type ) && (ad) != slap_schema.si_ad_ref )
#define backsql_attr_skip(ad, vals) \ #define backsql_attr_skip(ad, vals) \
( \ ( \
( (ad) == slap_schema.si_ad_objectClass \ ( (ad) == slap_schema.si_ad_objectClass \
&& (vals) && BER_BVISNULL( &((vals)[ 1 ]) ) ) \ && (vals) && BER_BVISNULL( &((vals)[ 1 ]) ) ) \
|| is_at_operational( (ad)->ad_type ) \ || backsql_opattr_skip( (ad) ) \
|| ( (vals) && BER_BVISNULL( &((vals)[ 0 ]) ) ) \ || ( (vals) && BER_BVISNULL( &((vals)[ 0 ]) ) ) \
) )
...@@ -316,7 +318,7 @@ backsql_modify_internal( ...@@ -316,7 +318,7 @@ backsql_modify_internal(
#if 0 #if 0
/* NOTE: some day we'll have to pass /* NOTE: some day we'll have to pass
* the normalized values as well */ * the normalized values as well */
BerVarray nvalues; BerVarray sm_nvalues;
#endif #endif
backsql_at_map_rec *at = NULL; backsql_at_map_rec *at = NULL;
struct berval *at_val; struct berval *at_val;
...@@ -951,7 +953,7 @@ backsql_add( Operation *op, SlapReply *rs ) ...@@ -951,7 +953,7 @@ backsql_add( Operation *op, SlapReply *rs )
unsigned long new_keyval = 0; unsigned long new_keyval = 0;
RETCODE rc; RETCODE rc;
backsql_oc_map_rec *oc = NULL; backsql_oc_map_rec *oc = NULL;
backsql_srch_info bsi; backsql_srch_info bsi = { 0 };
Entry p = { 0 }, *e = NULL; Entry p = { 0 }, *e = NULL;
Attribute *at, Attribute *at,
*at_objectClass = NULL; *at_objectClass = NULL;
......
...@@ -474,6 +474,7 @@ typedef struct backsql_info { ...@@ -474,6 +474,7 @@ typedef struct backsql_info {
*sql_at_query; *sql_at_query;
char *sql_insentry_stmt, char *sql_insentry_stmt,
*sql_delentry_stmt, *sql_delentry_stmt,
*sql_renentry_stmt,
*sql_delobjclasses_stmt, *sql_delobjclasses_stmt,
*sql_delreferrals_stmt; *sql_delreferrals_stmt;
char *sql_id_query; char *sql_id_query;
......
...@@ -34,7 +34,7 @@ backsql_bind( Operation *op, SlapReply *rs ) ...@@ -34,7 +34,7 @@ backsql_bind( Operation *op, SlapReply *rs )
SQLHDBC dbh = SQL_NULL_HDBC; SQLHDBC dbh = SQL_NULL_HDBC;
Entry e = { 0 }; Entry e = { 0 };
Attribute *a; Attribute *a;
backsql_srch_info bsi; backsql_srch_info bsi = { 0 };
AttributeName anlist[2]; AttributeName anlist[2];
int rc; int rc;
...@@ -101,10 +101,12 @@ backsql_bind( Operation *op, SlapReply *rs ) ...@@ -101,10 +101,12 @@ backsql_bind( Operation *op, SlapReply *rs )
} }
error_return:; error_return:;
(void)backsql_free_entryID( op, &bsi.bsi_base_id, 0 ); if ( !BER_BVISNULL( &bsi.bsi_base_id.eid_ndn ) ) {
(void)backsql_free_entryID( op, &bsi.bsi_base_id, 0 );
}
if ( bsi.bsi_e ) { if ( !BER_BVISNULL( &e.e_nname ) ) {
entry_clean( bsi.bsi_e ); entry_clean( &e );
} }
if ( bsi.bsi_attrs != NULL ) { if ( bsi.bsi_attrs != NULL ) {
......
...@@ -34,7 +34,7 @@ backsql_compare( Operation *op, SlapReply *rs ) ...@@ -34,7 +34,7 @@ backsql_compare( Operation *op, SlapReply *rs )
SQLHDBC dbh = SQL_NULL_HDBC; SQLHDBC dbh = SQL_NULL_HDBC;
Entry e = { 0 }; Entry e = { 0 };
Attribute *a = NULL; Attribute *a = NULL;
backsql_srch_info bsi; backsql_srch_info bsi = { 0 };
int rc; int rc;
AttributeName anlist[2], AttributeName anlist[2],
*anlistp = NULL; *anlistp = NULL;
...@@ -174,10 +174,12 @@ return_results:; ...@@ -174,10 +174,12 @@ return_results:;
rs->sr_ref = NULL; rs->sr_ref = NULL;
} }
(void)backsql_free_entryID( op, &bsi.bsi_base_id, 0 ); if ( !BER_BVISNULL( &bsi.bsi_base_id.eid_ndn ) ) {
(void)backsql_free_entryID( op, &bsi.bsi_base_id, 0 );
}
if ( bsi.bsi_e ) { if ( !BER_BVISNULL( &e.e_nname ) ) {
entry_clean( bsi.bsi_e ); entry_clean( &e );
} }
if ( bsi.bsi_attrs != NULL ) { if ( bsi.bsi_attrs != NULL ) {
......
...@@ -291,6 +291,21 @@ backsql_db_config( ...@@ -291,6 +291,21 @@ backsql_db_config(
Debug( LDAP_DEBUG_TRACE, "<==backsql_db_config(): " Debug( LDAP_DEBUG_TRACE, "<==backsql_db_config(): "
"delentry_stmt=%s\n", bi->sql_delentry_stmt, 0, 0 ); "delentry_stmt=%s\n", bi->sql_delentry_stmt, 0, 0 );
} else if ( !strcasecmp( argv[ 0 ], "renentry_stmt" ) ||
!strcasecmp( argv[ 0 ], "renentry_query" ) )
{
if ( argc < 2 ) {
Debug( LDAP_DEBUG_TRACE,
"<==backsql_db_config (%s line %d): "
"missing SQL statement "
"in \"renentry_stmt\" directive\n",
fname, lineno, 0 );
return 1;
}
bi->sql_renentry_stmt = ch_strdup( argv[ 1 ] );
Debug( LDAP_DEBUG_TRACE, "<==backsql_db_config(): "
"renentry_stmt=%s\n", bi->sql_renentry_stmt, 0, 0 );
} else if ( !strcasecmp( argv[ 0 ], "delobjclasses_stmt" ) || } else if ( !strcasecmp( argv[ 0 ], "delobjclasses_stmt" ) ||
!strcasecmp( argv[ 0 ], "delobjclasses_query" ) ) !strcasecmp( argv[ 0 ], "delobjclasses_query" ) )
{ {
......
...@@ -47,6 +47,12 @@ sql_back_initialize( ...@@ -47,6 +47,12 @@ sql_back_initialize(
bi->bi_controls = controls; bi->bi_controls = controls;
bi->bi_flags |=
#if 0
SLAP_BFLAG_INCREMENT |
#endif
SLAP_BFLAG_REFERRALS;
Debug( LDAP_DEBUG_TRACE,"==>sql_back_initialize()\n", 0, 0, 0 ); Debug( LDAP_DEBUG_TRACE,"==>sql_back_initialize()\n", 0, 0, 0 );
bi->bi_db_init = backsql_db_init; bi->bi_db_init = backsql_db_init;
...@@ -137,6 +143,7 @@ backsql_db_destroy( ...@@ -137,6 +143,7 @@ backsql_db_destroy(
free( bi->sql_at_query ); free( bi->sql_at_query );
free( bi->sql_insentry_stmt ); free( bi->sql_insentry_stmt );
free( bi->sql_delentry_stmt ); free( bi->sql_delentry_stmt );
free( bi->sql_renentry_stmt );
free( bi->sql_delobjclasses_stmt ); free( bi->sql_delobjclasses_stmt );
free( bi->sql_delreferrals_stmt ); free( bi->sql_delreferrals_stmt );
...@@ -375,6 +382,17 @@ backsql_db_open( ...@@ -375,6 +382,17 @@ backsql_db_open(
bi->sql_delentry_stmt = ch_strdup( backsql_def_delentry_stmt ); bi->sql_delentry_stmt = ch_strdup( backsql_def_delentry_stmt );
} }
if ( bi->sql_renentry_stmt == NULL ) {
Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
"entry deletion SQL statement not specified "
"(use \"renentry_stmt\" directive in slapd.conf)\n",
0, 0, 0 );
Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
"setting \"%s\" by default\n",
backsql_def_renentry_stmt, 0, 0 );
bi->sql_renentry_stmt = ch_strdup( backsql_def_renentry_stmt );
}
if ( bi->sql_delobjclasses_stmt == NULL ) { if ( bi->sql_delobjclasses_stmt == NULL ) {
Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): " Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
"objclasses deletion SQL statement not specified " "objclasses deletion SQL statement not specified "
......
...@@ -143,7 +143,6 @@ backsql_modify( Operation *op, SlapReply *rs ) ...@@ -143,7 +143,6 @@ backsql_modify( Operation *op, SlapReply *rs )
goto done; goto done;
} }
/* FIXME: need the whole entry (ITS#3480) */
if ( !acl_check_modlist( op, &m, op->oq_modify.rs_modlist ) ) { if ( !acl_check_modlist( op, &m, op->oq_modify.rs_modlist ) ) {
rs->sr_err = LDAP_INSUFFICIENT_ACCESS; rs->sr_err = LDAP_INSUFFICIENT_ACCESS;
e = &m; e = &m;
...@@ -153,7 +152,36 @@ backsql_modify( Operation *op, SlapReply *rs ) ...@@ -153,7 +152,36 @@ backsql_modify( Operation *op, SlapReply *rs )
rs->sr_err = backsql_modify_internal( op, rs, dbh, oc, rs->sr_err = backsql_modify_internal( op, rs, dbh, oc,
&bsi.bsi_base_id, &bsi.bsi_base_id,
op->oq_modify.rs_modlist ); op->oq_modify.rs_modlist );
if ( rs->sr_err != LDAP_SUCCESS ) {
e = &m;
goto do_transact;
}
if ( global_schemacheck ) {
char textbuf[ SLAP_TEXT_BUFLEN ] = { '\0' };
entry_clean( &m );
bsi.bsi_e = &m;
rs->sr_err = backsql_id2entry( &bsi, &bsi.bsi_base_id );
if ( rs->sr_err != LDAP_SUCCESS ) {
e = &m;
goto do_transact;
}
rs->sr_err = entry_schema_check( op->o_bd, &m,
NULL,
&rs->sr_text, textbuf, sizeof( textbuf ) );
if ( rs->sr_err != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE, " backsql_add(\"%s\"): "
"entry failed schema check -- aborting\n",
m.e_name.bv_val, 0, 0 );
e = NULL;
goto do_transact;
}
}
do_transact:;
/* /*
* Commit only if all operations succeed * Commit only if all operations succeed
*/ */
...@@ -182,10 +210,12 @@ done:; ...@@ -182,10 +210,12 @@ done:;
send_ldap_result( op, rs ); send_ldap_result( op, rs );
(void)backsql_free_entryID( op, &bsi.bsi_base_id, 0 ); if ( !BER_BVISNULL( &bsi.bsi_base_id.eid_ndn ) ) {
(void)backsql_free_entryID( op, &bsi.bsi_base_id, 0 );
}
if ( bsi.bsi_e != NULL ) { if ( !BER_BVISNULL( &m.e_nname ) ) {
entry_clean( bsi.bsi_e ); entry_clean( &m );
} }
if ( bsi.bsi_attrs != NULL ) { if ( bsi.bsi_attrs != NULL ) {
......
...@@ -291,32 +291,11 @@ backsql_modrdn( Operation *op, SlapReply *rs ) ...@@ -291,32 +291,11 @@ backsql_modrdn( Operation *op, SlapReply *rs )
Debug( LDAP_DEBUG_TRACE, " backsql_modrdn(): new entry dn is \"%s\"\n", Debug( LDAP_DEBUG_TRACE, " backsql_modrdn(): new entry dn is \"%s\"\n",
new_dn.bv_val, 0, 0 ); new_dn.bv_val, 0, 0 );
realnew_dn = new_dn;
Debug( LDAP_DEBUG_TRACE, " backsql_modrdn(): " if ( backsql_api_dn2odbc( op, rs, &realnew_dn ) ) {
"executing delentry_stmt\n", 0, 0, 0 ); Debug( LDAP_DEBUG_TRACE, " backsql_modrdn(\"%s\"): "
"backsql_api_dn2odbc(\"%s\") failed\n",
rc = backsql_Prepare( dbh, &sth, bi->sql_delentry_stmt, 0 ); op->o_req_dn.bv_val, realnew_dn.bv_val, 0 );
if ( rc != SQL_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE,
" backsql_modrdn(): "
"error preparing delentry_stmt\n", 0, 0, 0 );
backsql_PrintErrors( bi->sql_db_env, dbh,
sth, rc );
rs->sr_text = "SQL-backend error";
rs->sr_err = LDAP_OTHER;
e = NULL;
goto done;
}
rc = backsql_BindParamID( sth, 1, SQL_PARAM_INPUT, &e_id.eid_id );
if ( rc != SQL_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE,
" backsql_delete(): "
"error binding entry ID parameter "
"for objectClass %s\n",
oc->bom_oc->soc_cname.bv_val, 0, 0 );
backsql_PrintErrors( bi->sql_db_env, dbh, sth, rc );
SQLFreeStmt( sth, SQL_DROP ); SQLFreeStmt( sth, SQL_DROP );
rs->sr_text = "SQL-backend error"; rs->sr_text = "SQL-backend error";
...@@ -325,29 +304,14 @@ backsql_modrdn( Operation *op, SlapReply *rs ) ...@@ -325,29 +304,14 @@ backsql_modrdn( Operation *op, SlapReply *rs )
goto done; goto done;
} }
rc = SQLExecute( sth );
if ( rc != SQL_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE, " backsql_modrdn(): "
"failed to delete record from ldap_entries\n",
0, 0, 0 );
backsql_PrintErrors( bi->sql_db_env, dbh, sth, rc );
SQLFreeStmt( sth, SQL_DROP );
rs->sr_err = LDAP_OTHER;
rs->sr_text = "SQL-backend error";
e = NULL;
goto done;
}
SQLFreeStmt( sth, SQL_DROP );
Debug( LDAP_DEBUG_TRACE, " backsql_modrdn(): " Debug( LDAP_DEBUG_TRACE, " backsql_modrdn(): "
"executing insentry_stmt\n", 0, 0, 0 ); "executing renentry_stmt\n", 0, 0, 0 );
rc = backsql_Prepare( dbh, &sth, bi->sql_insentry_stmt, 0 ); rc = backsql_Prepare( dbh, &sth, bi->sql_renentry_stmt, 0 );
if ( rc != SQL_SUCCESS ) { if ( rc != SQL_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE, Debug( LDAP_DEBUG_TRACE,
" backsql_modrdn(): " " backsql_modrdn(): "
"error preparing insentry_stmt\n", 0, 0, 0 ); "error preparing renentry_stmt\n", 0, 0, 0 );
backsql_PrintErrors( bi->sql_db_env, dbh, backsql_PrintErrors( bi->sql_db_env, dbh,
sth, rc ); sth, rc );
...@@ -357,19 +321,6 @@ backsql_modrdn( Operation *op, SlapReply *rs ) ...@@ -357,19 +321,6 @@ backsql_modrdn( Operation *op, SlapReply *rs )
goto done; goto done;
} }
realnew_dn = new_dn;
if ( backsql_api_dn2odbc( op, rs, &realnew_dn ) ) {
Debug( LDAP_DEBUG_TRACE, " backsql_modrdn(\"%s\"): "
"backsql_api_dn2odbc(\"%s\") failed\n",
op->o_req_dn.bv_val, realnew_dn.bv_val, 0 );
SQLFreeStmt( sth, SQL_DROP );
rs->sr_text = "SQL-backend error";
rs->sr_err = LDAP_OTHER;
e = NULL;
goto done;
}
rc = backsql_BindParamBerVal( sth, 1, SQL_PARAM_INPUT, &realnew_dn ); rc = backsql_BindParamBerVal( sth, 1, SQL_PARAM_INPUT, &realnew_dn );
if ( rc != SQL_SUCCESS ) { if ( rc != SQL_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE, Debug( LDAP_DEBUG_TRACE,
...@@ -386,11 +337,11 @@ backsql_modrdn( Operation *op, SlapReply *rs ) ...@@ -386,11 +337,11 @@ backsql_modrdn( Operation *op, SlapReply *rs )
goto done; goto done;
} }
rc = backsql_BindParamInt( sth, 2, SQL_PARAM_INPUT, &e_id.eid_oc_id ); rc = backsql_BindParamID( sth, 2, SQL_PARAM_INPUT, &n_id.eid_id );
if ( rc != SQL_SUCCESS ) { if ( rc != SQL_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE, Debug( LDAP_DEBUG_TRACE,
" backsql_add_attr(): " " backsql_add_attr(): "
"error binding objectClass ID parameter for objectClass %s\n", "error binding parent ID parameter for objectClass %s\n",
oc->bom_oc->soc_cname.bv_val, 0, 0 ); oc->bom_oc->soc_cname.bv_val, 0, 0 );
backsql_PrintErrors( bi->sql_db_env, dbh, backsql_PrintErrors( bi->sql_db_env, dbh,
sth, rc ); sth, rc );
...@@ -402,11 +353,11 @@ backsql_modrdn( Operation *op, SlapReply *rs ) ...@@ -402,11 +353,11 @@ backsql_modrdn( Operation *op, SlapReply *rs )
goto done; goto done;
} }
rc = backsql_BindParamID( sth, 3, SQL_PARAM_INPUT, &n_id.eid_id ); rc = backsql_BindParamID( sth, 3, SQL_PARAM_INPUT, &e_id.eid_keyval );
if ( rc != SQL_SUCCESS ) { if ( rc != SQL_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE, Debug( LDAP_DEBUG_TRACE,
" backsql_add_attr(): " " backsql_add_attr(): "
"error binding parent ID parameter for objectClass %s\n", "error binding entry ID parameter for objectClass %s\n",
oc->bom_oc->soc_cname.bv_val, 0, 0 ); oc->bom_oc->soc_cname.bv_val, 0, 0 );
backsql_PrintErrors( bi->sql_db_env, dbh, backsql_PrintErrors( bi->sql_db_env, dbh,
sth, rc ); sth, rc );
...@@ -418,11 +369,11 @@ backsql_modrdn( Operation *op, SlapReply *rs ) ...@@ -418,11 +369,11 @@ backsql_modrdn( Operation *op, SlapReply *rs )
goto done; goto done;
} }
rc = backsql_BindParamID( sth, 4, SQL_PARAM_INPUT, &e_id.eid_keyval ); rc = backsql_BindParamID( sth, 4, SQL_PARAM_INPUT, &e_id.eid_id );
if ( rc != SQL_SUCCESS ) { if ( rc != SQL_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE, Debug( LDAP_DEBUG_TRACE,
" backsql_add_attr(): " " backsql_add_attr(): "
"error binding entry ID parameter for objectClass %s\n", "error binding ID parameter for objectClass %s\n",
oc->bom_oc->soc_cname.bv_val, 0, 0 ); oc->bom_oc->soc_cname.bv_val, 0, 0 );
backsql_PrintErrors( bi->sql_db_env, dbh, backsql_PrintErrors( bi->sql_db_env, dbh,
sth, rc ); sth, rc );
...@@ -437,7 +388,7 @@ backsql_modrdn( Operation *op, SlapReply *rs ) ...@@ -437,7 +388,7 @@ backsql_modrdn( Operation *op, SlapReply *rs )
rc = SQLExecute( sth ); rc = SQLExecute( sth );
if ( rc != SQL_SUCCESS ) { if ( rc != SQL_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE, " backsql_modrdn(): " Debug( LDAP_DEBUG_TRACE, " backsql_modrdn(): "
"could not insert ldap_entries record\n", 0, 0, 0 ); "could not rename ldap_entries record\n", 0, 0, 0 );
backsql_PrintErrors( bi->sql_db_env, dbh, sth, rc ); backsql_PrintErrors( bi->sql_db_env, dbh, sth, rc );
SQLFreeStmt( sth, SQL_DROP ); SQLFreeStmt( sth, SQL_DROP );
rs->sr_err = LDAP_OTHER; rs->sr_err = LDAP_OTHER;
...@@ -490,7 +441,34 @@ backsql_modrdn( Operation *op, SlapReply *rs ) ...@@ -490,7 +441,34 @@ backsql_modrdn( Operation *op, SlapReply *rs )
oc = backsql_id2oc( bi, e_id.eid_oc_id ); oc = backsql_id2oc( bi, e_id.eid_oc_id );
rs->sr_err = backsql_modify_internal( op, rs, dbh, oc, &e_id, mod ); rs->sr_err = backsql_modify_internal( op, rs, dbh, oc, &e_id, mod );
e = &r; if ( rs->sr_err != LDAP_SUCCESS ) {
e = &r;
goto done;
}
if ( global_schemacheck ) {
char textbuf[ SLAP_TEXT_BUFLEN ] = { '\0' };
entry_clean( &r );
bsi.bsi_e = &r;
rs->sr_err = backsql_id2entry( &bsi, &e_id );
if ( rs->sr_err != LDAP_SUCCESS ) {
e = &r;
goto done;
}
rs->sr_err = entry_schema_check( op->o_bd, &r,
NULL,
&rs->sr_text, textbuf, sizeof( textbuf ) );
if ( rs->sr_err != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE, " backsql_add(\"%s\"): "
"entry failed schema check -- aborting\n",
r.e_name.bv_val, 0, 0 );
e = NULL;
goto done;
}
}
done:; done:;
#ifdef SLAP_ACL_HONOR_DISCLOSE #ifdef SLAP_ACL_HONOR_DISCLOSE
......
...@@ -180,7 +180,7 @@ backsql_operational( ...@@ -180,7 +180,7 @@ backsql_operational(
&& !got[ BACKSQL_OP_ENTRYUUID ] && !got[ BACKSQL_OP_ENTRYUUID ]
&& attr_find( rs->sr_entry->e_attrs, slap_schema.si_ad_entryUUID ) == NULL ) && attr_find( rs->sr_entry->e_attrs, slap_schema.si_ad_entryUUID ) == NULL )
{ {
backsql_srch_info bsi; backsql_srch_info bsi = { 0 };
rc = backsql_init_search( &bsi, &rs->sr_entry->e_nname, rc = backsql_init_search( &bsi, &rs->sr_entry->e_nname,
LDAP_SCOPE_BASE, LDAP_SCOPE_BASE,
...@@ -197,6 +197,7 @@ backsql_operational( ...@@ -197,6 +197,7 @@ backsql_operational(
*ap = backsql_operational_entryUUID( bi, &bsi.bsi_base_id ); *ap = backsql_operational_entryUUID( bi, &bsi.bsi_base_id );
(void)backsql_free_entryID( op, &bsi.bsi_base_id, 0 ); (void)backsql_free_entryID( op, &bsi.bsi_base_id, 0 );
if ( bsi.bsi_attrs != NULL ) { if ( bsi.bsi_attrs != NULL ) {
op->o_tmpfree( bsi.bsi_attrs, op->o_tmpmemctx ); op->o_tmpfree( bsi.bsi_attrs, op->o_tmpmemctx );
} }
......
...@@ -224,6 +224,7 @@ extern char ...@@ -224,6 +224,7 @@ extern char
backsql_def_needs_select_oc_query[], backsql_def_needs_select_oc_query[],
backsql_def_at_query[], backsql_def_at_query[],
backsql_def_delentry_stmt[], backsql_def_delentry_stmt[],
backsql_def_renentry_stmt[],
backsql_def_insentry_stmt[], backsql_def_insentry_stmt[],
backsql_def_delobjclasses_stmt[], backsql_def_delobjclasses_stmt[],
backsql_def_delreferrals_stmt[], backsql_def_delreferrals_stmt[],
......
...@@ -1789,7 +1789,7 @@ backsql_search( Operation *op, SlapReply *rs ) ...@@ -1789,7 +1789,7 @@ backsql_search( Operation *op, SlapReply *rs )
base_entry = { 0 }; base_entry = { 0 };
int manageDSAit; int manageDSAit;
time_t stoptime = 0; time_t stoptime = 0;
backsql_srch_info bsi; backsql_srch_info bsi = { 0 };
backsql_entryID *eid = NULL; backsql_entryID *eid = NULL;
struct berval nbase = BER_BVNULL, struct berval nbase = BER_BVNULL,
realndn = BER_BVNULL; realndn = BER_BVNULL;
...@@ -2303,7 +2303,7 @@ backsql_entry_get( ...@@ -2303,7 +2303,7 @@ backsql_entry_get(
int rw, int rw,
Entry **ent ) Entry **ent )
{ {
backsql_srch_info bsi; backsql_srch_info bsi = { 0 };
SQLHDBC dbh = SQL_NULL_HDBC; SQLHDBC dbh = SQL_NULL_HDBC;
int rc; int rc;
SlapReply rs = { 0 }; SlapReply rs = { 0 };
...@@ -2331,7 +2331,9 @@ backsql_entry_get( ...@@ -2331,7 +2331,9 @@ backsql_entry_get(
dbh, op, &rs, at ? anlist : NULL, dbh, op, &rs, at ? anlist : NULL,
BACKSQL_ISF_GET_ENTRY ); BACKSQL_ISF_GET_ENTRY );
(void)backsql_free_entryID( op, &bsi.bsi_base_id, 0 ); if ( !BER_BVISNULL( &bsi.bsi_base_id.eid_ndn ) ) {
(void)backsql_free_entryID( op, &bsi.bsi_base_id, 0 );
}
if ( rc == LDAP_SUCCESS ) { if ( rc == LDAP_SUCCESS ) {
......
...@@ -48,6 +48,8 @@ char backsql_def_at_query[] = ...@@ -48,6 +48,8 @@ char backsql_def_at_query[] =
"param_order,expect_return,sel_expr_u FROM ldap_attr_mappings " "param_order,expect_return,sel_expr_u FROM ldap_attr_mappings "
"WHERE oc_map_id=?"; "WHERE oc_map_id=?";
char backsql_def_delentry_stmt[] = "DELETE FROM ldap_entries WHERE id=?"; char backsql_def_delentry_stmt[] = "DELETE FROM ldap_entries WHERE id=?";
char backsql_def_renentry_stmt[] =
"UPDATE ldap_entries SET dn=?,parent=?,keyval=? WHERE id=?";
char backsql_def_insentry_stmt[] = char backsql_def_insentry_stmt[] =
"INSERT INTO ldap_entries (dn,oc_map_id,parent,keyval) " "INSERT INTO ldap_entries (dn,oc_map_id,parent,keyval) "
"VALUES (?,?,?,?)"; "VALUES (?,?,?,?)";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment