add LDAP_OPT_DIAGNOSTIC_MESSAGE; replace deprecated option names

This commit is contained in:
Pierangelo Masarati 2006-10-14 17:04:17 +00:00
parent 387c21c7dd
commit 968da1cb14
12 changed files with 38 additions and 35 deletions

View File

@ -332,7 +332,7 @@ static int deletechildren(
char *dn = ldap_get_dn( ld, e );
if( dn == NULL ) {
ldap_get_option( ld, LDAP_OPT_ERROR_NUMBER, &rc );
ldap_get_option( ld, LDAP_OPT_RESULT_CODE, &rc );
tool_perror( "ldap_prune", rc, NULL, NULL, NULL, NULL );
ber_memfree( dn );
return rc;
@ -407,7 +407,7 @@ static int deletechildren(
char *dn = ldap_get_dn( ld, e );
if( dn == NULL ) {
ldap_get_option( ld, LDAP_OPT_ERROR_NUMBER, &rc );
ldap_get_option( ld, LDAP_OPT_RESULT_CODE, &rc );
tool_perror( "ldap_prune", rc, NULL, NULL, NULL, NULL );
ber_memfree( dn );
return rc;

View File

@ -363,7 +363,7 @@ main( int argc, char **argv )
}
error_msg = NULL;
ldap_get_option(ld, LDAP_OPT_ERROR_STRING, &error_msg);
ldap_get_option(ld, LDAP_OPT_DIAGNOSTIC_MESSAGE, &error_msg);
if ( error_msg != NULL ) {
if ( *error_msg != '\0' ) {
fprintf( rejfp, _(", additional info: %s"), error_msg );
@ -1158,7 +1158,7 @@ static int process_response(
}
if ( rc == -1 ) {
ldap_get_option( ld, LDAP_OPT_ERROR_NUMBER, &rc );
ldap_get_option( ld, LDAP_OPT_RESULT_CODE, &rc );
return rc;
}

View File

@ -22,7 +22,7 @@ LDAPException::LDAPException(int res_code, const string& err_string){
LDAPException::LDAPException(const LDAPAsynConnection *lc){
LDAP *l = lc->getSessionHandle();
ldap_get_option(l,LDAP_OPT_ERROR_NUMBER,&m_res_code);
ldap_get_option(l,LDAP_OPT_RESULT_CODE,&m_res_code);
const char *res_cstring = ldap_err2string(m_res_code);
if ( res_cstring ) {
m_res_string = string(res_cstring);
@ -30,7 +30,7 @@ LDAPException::LDAPException(const LDAPAsynConnection *lc){
m_res_string = "";
}
const char* err_string;
ldap_get_option(l,LDAP_OPT_ERROR_STRING,&err_string);
ldap_get_option(l,LDAP_OPT_DIAGNOSTIC_MESSAGE,&err_string);
if ( err_string ) {
m_res_string = string(err_string);
} else {

View File

@ -237,7 +237,7 @@ the library duplicates the corresponding string.
.B LDAP_OPT_RESULT_CODE
Sets/gets the LDAP result code associated to the handle.
This option was formerly known as
.BR LDAP_OPT_ERROR_NUMBER.
.BR LDAP_OPT_ERROR_NUMBER .
Both
.BR outvalue
and
@ -245,8 +245,10 @@ and
must be a
.BR "int *" .
.TP
.B LDAP_OPT_ERROR_STRING
.B LDAP_OPT_DIAGNOSTIC_MESSAGE
Sets/gets a string containing the error string associated to the LDAP handle.
This option was formerly known as
.BR LDAP_OPT_ERROR_STRING .
.BR outvalue
must be a
.BR "char **" ,

View File

@ -95,16 +95,17 @@ LDAP_BEGIN_DECL
#define LDAP_OPT_REFERRALS 0x0008
#define LDAP_OPT_RESTART 0x0009
/* 0x0a - 0x10 not defined */
#define LDAP_OPT_PROTOCOL_VERSION 0x0011
#define LDAP_OPT_SERVER_CONTROLS 0x0012
#define LDAP_OPT_CLIENT_CONTROLS 0x0013
#define LDAP_OPT_PROTOCOL_VERSION 0x0011
#define LDAP_OPT_SERVER_CONTROLS 0x0012
#define LDAP_OPT_CLIENT_CONTROLS 0x0013
/* 0x14 not defined */
#define LDAP_OPT_API_FEATURE_INFO 0x0015
#define LDAP_OPT_API_FEATURE_INFO 0x0015
/* 0x16 - 0x2f not defined */
#define LDAP_OPT_HOST_NAME 0x0030
#define LDAP_OPT_RESULT_CODE 0x0031
#define LDAP_OPT_ERROR_NUMBER LDAP_OPT_RESULT_CODE
#define LDAP_OPT_ERROR_STRING 0x0032
#define LDAP_OPT_RESULT_CODE 0x0031
#define LDAP_OPT_ERROR_NUMBER LDAP_OPT_RESULT_CODE
#define LDAP_OPT_DIAGNOSTIC_MESSAGE 0x0032
#define LDAP_OPT_ERROR_STRING LDAP_OPT_DIAGNOSTIC_MESSAGE
#define LDAP_OPT_MATCHED_DN 0x0033
/* 0x0034 - 0x3fff not defined */

View File

@ -242,7 +242,7 @@ ldap_get_option(
return LDAP_OPT_SUCCESS;
case LDAP_OPT_ERROR_NUMBER:
case LDAP_OPT_RESULT_CODE:
if(ld == NULL) {
/* bad param */
break;
@ -250,7 +250,7 @@ ldap_get_option(
* (int *) outvalue = ld->ld_errno;
return LDAP_OPT_SUCCESS;
case LDAP_OPT_ERROR_STRING:
case LDAP_OPT_DIAGNOSTIC_MESSAGE:
if(ld == NULL) {
/* bad param */
break;
@ -578,7 +578,7 @@ ldap_set_option(
lo->ldo_defbase = defbase;
} return LDAP_OPT_SUCCESS;
case LDAP_OPT_ERROR_STRING: {
case LDAP_OPT_DIAGNOSTIC_MESSAGE: {
const char *err = (const char *) invalue;
if(ld == NULL) {
@ -667,7 +667,7 @@ ldap_set_option(
case LDAP_OPT_SIZELIMIT:
case LDAP_OPT_TIMELIMIT:
case LDAP_OPT_PROTOCOL_VERSION:
case LDAP_OPT_ERROR_NUMBER:
case LDAP_OPT_RESULT_CODE:
case LDAP_OPT_DEBUG_LEVEL:
if(invalue == NULL) {
/* no place to set from */
@ -715,7 +715,7 @@ ldap_set_option(
lo->ldo_version = vers;
} return LDAP_OPT_SUCCESS;
case LDAP_OPT_ERROR_NUMBER: {
case LDAP_OPT_RESULT_CODE: {
int err = * (const int *) invalue;
if(ld == NULL) {

View File

@ -402,7 +402,7 @@ retry:;
break;
case -1:
ldap_get_option( msc->msc_ld, LDAP_OPT_ERROR_NUMBER,
ldap_get_option( msc->msc_ld, LDAP_OPT_RESULT_CODE,
&rs->sr_err );
snprintf( buf, sizeof( buf ),
@ -982,7 +982,7 @@ retry:;
goto retry;
case -1:
ldap_get_option( msc->msc_ld, LDAP_OPT_ERROR_NUMBER,
ldap_get_option( msc->msc_ld, LDAP_OPT_RESULT_CODE,
&rs->sr_err );
break;
@ -1055,7 +1055,7 @@ retry:;
rs->sr_err = LDAP_SUCCESS;
ldap_get_option( msc->msc_ld, LDAP_OPT_ERROR_NUMBER, &rs->sr_err );
ldap_get_option( msc->msc_ld, LDAP_OPT_RESULT_CODE, &rs->sr_err );
if ( rs->sr_err != LDAP_SUCCESS ) {
/*
* better check the type of error. In some cases
@ -1064,7 +1064,7 @@ retry:;
* positive result ...
*/
ldap_get_option( msc->msc_ld,
LDAP_OPT_ERROR_STRING, &xtext );
LDAP_OPT_DIAGNOSTIC_MESSAGE, &xtext );
if ( xtext != NULL && xtext [ 0 ] == '\0' ) {
ldap_memfree( xtext );
xtext = NULL;

View File

@ -207,7 +207,7 @@ meta_back_compare( Operation *op, SlapReply *rs )
/* we do not retry in this case;
* only for unique operations... */
ldap_get_option( msc->msc_ld,
LDAP_OPT_ERROR_NUMBER, &rs->sr_err );
LDAP_OPT_RESULT_CODE, &rs->sr_err );
rres = slap_map_api2result( rs );
rres = rc;
rc = -1;
@ -263,7 +263,7 @@ meta_back_compare( Operation *op, SlapReply *rs )
free( err );
}
ldap_get_option( msc->msc_ld,
LDAP_OPT_ERROR_STRING, &err );
LDAP_OPT_DIAGNOSTIC_MESSAGE, &err );
if ( match != NULL ) {
free( match );

View File

@ -988,7 +988,7 @@ really_bad:;
res = NULL;
if ( rs->sr_err != LDAP_SUCCESS ) {
ldap_get_option( msc->msc_ld,
LDAP_OPT_ERROR_NUMBER,
LDAP_OPT_RESULT_CODE,
&rs->sr_err );
sres = slap_map_api2result( rs );
candidates[ i ].sr_type = REP_RESULT;

View File

@ -215,8 +215,8 @@ op_ldap_add(
ri->ri_hostname, ri->ri_port, re->re_dn );
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);
ldap_get_option( ri->ri_ldp, LDAP_OPT_RESULT_CODE, &lderr);
ldap_get_option( ri->ri_ldp, LDAP_OPT_DIAGNOSTIC_MESSAGE, errmsg);
*errfree = 1;
} else {
@ -353,7 +353,7 @@ op_ldap_modify(
Debug( LDAP_DEBUG_ARGS, "replica %s:%d - modify dn \"%s\"\n",
ri->ri_hostname, ri->ri_port, re->re_dn );
rc = ldap_modify_s( ri->ri_ldp, re->re_dn, ldmarr );
ldap_get_option( ri->ri_ldp, LDAP_OPT_ERROR_STRING, errmsg);
ldap_get_option( ri->ri_ldp, LDAP_OPT_DIAGNOSTIC_MESSAGE, errmsg);
*errfree = 1;
}
free_ldmarr( ldmarr );
@ -379,7 +379,7 @@ op_ldap_delete(
Debug( LDAP_DEBUG_ARGS, "replica %s:%d - delete dn \"%s\"\n",
ri->ri_hostname, ri->ri_port, re->re_dn );
rc = ldap_delete_s( ri->ri_ldp, re->re_dn );
ldap_get_option( ri->ri_ldp, LDAP_OPT_ERROR_STRING, errmsg);
ldap_get_option( ri->ri_ldp, LDAP_OPT_DIAGNOSTIC_MESSAGE, errmsg);
*errfree = 1;
return( rc );
@ -512,8 +512,8 @@ op_ldap_modrdn(
/* Do the modrdn */
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);
ldap_get_option( ri->ri_ldp, LDAP_OPT_RESULT_CODE, &lderr);
ldap_get_option( ri->ri_ldp, LDAP_OPT_DIAGNOSTIC_MESSAGE, errmsg);
*errfree = 1;
return( lderr );
}

View File

@ -121,7 +121,7 @@ Ri_process(
case DO_LDAP_ERR_FATAL: {
/* Non-retryable error. Write rejection log. */
int ld_errno = 0;
ldap_get_option(ri->ri_ldp, LDAP_OPT_ERROR_NUMBER, &ld_errno);
ldap_get_option(ri->ri_ldp, LDAP_OPT_RESULT_CODE, &ld_errno);
write_reject( ri, re, ld_errno, errmsg );
/* Update status ... */
(void) sglob->st->st_update( sglob->st, ri->ri_stel, re );

View File

@ -235,7 +235,7 @@ tester_ldap_error( LDAP *ld, const char *fname, const char *msg )
ldap_get_option( ld, LDAP_OPT_RESULT_CODE, (void *)&err );
if ( err != LDAP_SUCCESS ) {
ldap_get_option( ld, LDAP_OPT_ERROR_STRING, (void *)&text );
ldap_get_option( ld, LDAP_OPT_DIAGNOSTIC_MESSAGE, (void *)&text );
}
fprintf( stderr, "%s: %s: %s (%d) %s %s\n",