/* Forward references */
static struct berval **make_singlevalued_berval LDAP_P(( char *, int ));
-static int op_ldap_add LDAP_P(( Ri *, Re *, char ** ));
-static int op_ldap_modify LDAP_P(( Ri *, Re *, char ** ));
-static int op_ldap_delete LDAP_P(( Ri *, Re *, char ** ));
-static int op_ldap_modrdn LDAP_P(( Ri *, Re *, char ** ));
+static int op_ldap_add LDAP_P(( Ri *, Re *, char **, int * ));
+static int op_ldap_modify LDAP_P(( Ri *, Re *, char **, int * ));
+static int op_ldap_delete LDAP_P(( Ri *, Re *, char **, int * ));
+static int op_ldap_modrdn LDAP_P(( Ri *, Re *, char **, int * ));
static LDAPMod *alloc_ldapmod LDAP_P(( void ));
static void free_ldapmod LDAP_P(( LDAPMod * ));
static void free_ldmarr LDAP_P(( LDAPMod ** ));
do_ldap(
Ri *ri,
Re *re,
- char **errmsg
+ char **errmsg,
+ int *errfree
)
{
int retry = 2;
*errmsg = NULL;
+ *errfree = 0;
do {
int lderr;
switch ( re->re_changetype ) {
case T_ADDCT:
- lderr = op_ldap_add( ri, re, errmsg );
+ lderr = op_ldap_add( ri, re, errmsg, errfree );
if ( lderr != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ERR, "do_ldap: "
break;
case T_MODIFYCT:
- lderr = op_ldap_modify( ri, re, errmsg );
+ lderr = op_ldap_modify( ri, re, errmsg, errfree );
if ( lderr != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ERR, "do_ldap: "
break;
case T_DELETECT:
- lderr = op_ldap_delete( ri, re, errmsg );
+ lderr = op_ldap_delete( ri, re, errmsg, errfree );
if ( lderr != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ERR, "do_ldap: "
break;
case T_MODRDNCT:
- lderr = op_ldap_modrdn( ri, re, errmsg );
+ lderr = op_ldap_modrdn( ri, re, errmsg, errfree );
if ( lderr != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ERR, "do_ldap: "
op_ldap_add(
Ri *ri,
Re *re,
- char **errmsg
+ char **errmsg,
+ int *errfree
)
{
Mi *mi;
rc = ldap_add_s( ri->ri_ldp, re->re_dn, ldmarr );
ldap_get_option( ri->ri_ldp, LDAP_OPT_ERROR_NUMBER, &lderr);
+ ldap_get_option( ri->ri_ldp, LDAP_OPT_ERROR_STRING, errmsg);
+ *errfree = 1;
} else {
*errmsg = "No modifications to do";
op_ldap_modify(
Ri *ri,
Re *re,
- char **errmsg
+ char **errmsg,
+ int *errfree
)
{
Mi *mi;
ri->ri_hostname, ri->ri_port, re->re_dn );
#endif
rc = ldap_modify_s( ri->ri_ldp, re->re_dn, ldmarr );
+ ldap_get_option( ri->ri_ldp, LDAP_OPT_ERROR_STRING, errmsg);
+ *errfree = 1;
}
free_ldmarr( ldmarr );
return( rc );
op_ldap_delete(
Ri *ri,
Re *re,
- char **errmsg
+ char **errmsg,
+ int *errfree
)
{
int rc;
ri->ri_hostname, ri->ri_port, re->re_dn );
#endif
rc = ldap_delete_s( ri->ri_ldp, re->re_dn );
+ ldap_get_option( ri->ri_ldp, LDAP_OPT_ERROR_STRING, errmsg);
+ *errfree = 1;
return( rc );
}
op_ldap_modrdn(
Ri *ri,
Re *re,
- char **errmsg
+ char **errmsg,
+ int *errfree
)
{
int rc = 0;
rc = ldap_rename2_s( ri->ri_ldp, re->re_dn, newrdn, newsup, drdnflag );
ldap_get_option( ri->ri_ldp, LDAP_OPT_ERROR_NUMBER, &lderr);
+ ldap_get_option( ri->ri_ldp, LDAP_OPT_ERROR_STRING, errmsg);
+ *errfree = 1;
return( lderr );
}