From: Pierangelo Masarati Date: Sat, 14 Oct 2006 17:04:17 +0000 (+0000) Subject: add LDAP_OPT_DIAGNOSTIC_MESSAGE; replace deprecated option names X-Git-Tag: OPENLDAP_REL_ENG_2_3_MP~54 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=968da1cb147a20bd1e8e675107bdb3501f1c7008;p=openldap add LDAP_OPT_DIAGNOSTIC_MESSAGE; replace deprecated option names --- diff --git a/clients/tools/ldapdelete.c b/clients/tools/ldapdelete.c index 518140fac4..741c52dcdc 100644 --- a/clients/tools/ldapdelete.c +++ b/clients/tools/ldapdelete.c @@ -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; diff --git a/clients/tools/ldapmodify.c b/clients/tools/ldapmodify.c index c88bb07768..b33c93262e 100644 --- a/clients/tools/ldapmodify.c +++ b/clients/tools/ldapmodify.c @@ -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; } diff --git a/contrib/ldapc++/src/LDAPException.cpp b/contrib/ldapc++/src/LDAPException.cpp index c7b0c5689e..5be910bfef 100644 --- a/contrib/ldapc++/src/LDAPException.cpp +++ b/contrib/ldapc++/src/LDAPException.cpp @@ -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 { diff --git a/doc/man/man3/ldap_get_option.3 b/doc/man/man3/ldap_get_option.3 index 1820d9537c..567fb3459b 100644 --- a/doc/man/man3/ldap_get_option.3 +++ b/doc/man/man3/ldap_get_option.3 @@ -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 **" , diff --git a/include/ldap.h b/include/ldap.h index 9562b8c37f..b760374537 100644 --- a/include/ldap.h +++ b/include/ldap.h @@ -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 */ diff --git a/libraries/libldap/options.c b/libraries/libldap/options.c index eb13790b30..64525dca1c 100644 --- a/libraries/libldap/options.c +++ b/libraries/libldap/options.c @@ -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) { diff --git a/servers/slapd/back-meta/bind.c b/servers/slapd/back-meta/bind.c index 888f1c0d03..faf0526026 100644 --- a/servers/slapd/back-meta/bind.c +++ b/servers/slapd/back-meta/bind.c @@ -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; diff --git a/servers/slapd/back-meta/compare.c b/servers/slapd/back-meta/compare.c index 05ea183e0b..be48b0a03a 100644 --- a/servers/slapd/back-meta/compare.c +++ b/servers/slapd/back-meta/compare.c @@ -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 ); diff --git a/servers/slapd/back-meta/search.c b/servers/slapd/back-meta/search.c index f09421c934..68ad9f00ca 100644 --- a/servers/slapd/back-meta/search.c +++ b/servers/slapd/back-meta/search.c @@ -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; diff --git a/servers/slurpd/ldap_op.c b/servers/slurpd/ldap_op.c index 2f19e7939d..cf77dd6a08 100644 --- a/servers/slurpd/ldap_op.c +++ b/servers/slurpd/ldap_op.c @@ -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 ); } diff --git a/servers/slurpd/ri.c b/servers/slurpd/ri.c index e4b2637424..ac50de0267 100644 --- a/servers/slurpd/ri.c +++ b/servers/slurpd/ri.c @@ -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 ); diff --git a/tests/progs/slapd-common.c b/tests/progs/slapd-common.c index e5f1d41a01..b68b306228 100644 --- a/tests/progs/slapd-common.c +++ b/tests/progs/slapd-common.c @@ -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",