use macros instead of numbers...

This commit is contained in:
Pierangelo Masarati 2005-12-13 20:11:26 +00:00
parent 73acecaf0f
commit fcda57e90f
26 changed files with 41 additions and 39 deletions

View file

@ -1003,7 +1003,7 @@ tool_bind( LDAP *ld )
}
}
if ( ldap_result( ld, msgid, 1, NULL, &result ) == -1 ) {
if ( ldap_result( ld, msgid, LDAP_MSG_ALL, NULL, &result ) == -1 ) {
tool_perror( "ldap_result", -1, NULL, NULL, NULL, NULL );
exit( EXIT_FAILURE );
}

View file

@ -1163,9 +1163,9 @@ static int process_response(
rc = ldap_result( ld, msgid,
#ifdef LDAP_GROUP_TRANSACTION
txn ? 0 : 1,
txn ? LDAP_MSG_ONE : LDAP_MSG_ALL,
#else
1,
LDAP_MSG_ALL,
#endif
&tv, &res );
if ( tool_check_abandon( ld, msgid ) ) {

View file

@ -198,7 +198,7 @@ ldap_add_ext_s(
if ( rc != LDAP_SUCCESS )
return( rc );
if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 )
if ( ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *) NULL, &res ) == -1 )
return( ld->ld_errno );
return( ldap_result2error( ld, res, 1 ) );

View file

@ -156,7 +156,7 @@ ldap_compare_ext_s(
if ( rc != LDAP_SUCCESS )
return( rc );
if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 )
if ( ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *) NULL, &res ) == -1 )
return( ld->ld_errno );
return( ldap_result2error( ld, res, 1 ) );

View file

@ -123,7 +123,7 @@ ldap_delete_ext_s(
if( rc != LDAP_SUCCESS )
return( ld->ld_errno );
if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 )
if ( ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *) NULL, &res ) == -1 )
return( ld->ld_errno );
return( ldap_result2error( ld, res, 1 ) );

View file

@ -140,7 +140,7 @@ ldap_extended_operation_s(
return( rc );
}
if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 ) {
if ( ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *) NULL, &res ) == -1 ) {
return( ld->ld_errno );
}

View file

@ -82,9 +82,9 @@ int ldap_grouping_create_s(
struct berval **retgrpcookiep,
struct berval **retgrpdatap )
{
int rc;
int msgid;
LDAPMessage *res;
int rc;
int msgid;
LDAPMessage *res;
Debug( LDAP_DEBUG_TRACE, "ldap_grouping_create_s\n", 0, 0, 0 );
@ -92,14 +92,14 @@ int ldap_grouping_create_s(
assert( LDAP_VALID( ld ) );
assert( grpoid != NULL || *grpoid == '\0' );
rc = ldap_grouping_create( ld, grpoid, grpdata,
rc = ldap_grouping_create( ld, grpoid, grpdata,
sctrls, cctrls, &msgid );
if ( rc != LDAP_SUCCESS ) {
return rc;
if ( rc != LDAP_SUCCESS ) {
return rc;
}
if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 ) {
return ld->ld_errno;
if ( ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *) NULL, &res ) == -1 ) {
return ld->ld_errno;
}
if ( retgrpcookiep != NULL ) *retgrpcookiep = NULL;
@ -116,7 +116,7 @@ int ldap_grouping_create_s(
return rc;
}
return( ldap_result2error( ld, res, 1 ) );
return( ldap_result2error( ld, res, 1 ) );
}
int ldap_grouping_end(

View file

@ -126,7 +126,7 @@ ldap_kerberos_bind1_s( LDAP *ld, LDAP_CONST char *dn )
return( ld->ld_errno );
/* wait for a result */
if ( ldap_result( ld, msgid, 1, (struct timeval *) 0, &res )
if ( ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *) 0, &res )
== -1 ) {
return( ld->ld_errno ); /* ldap_result sets ld_errno */
}
@ -205,7 +205,7 @@ ldap_kerberos_bind2_s( LDAP *ld, LDAP_CONST char *dn )
return( ld->ld_errno );
/* wait for a result */
if ( ldap_result( ld, msgid, 1, (struct timeval *) 0, &res )
if ( ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *) 0, &res )
== -1 ) {
return( ld->ld_errno ); /* ldap_result sets ld_errno */
}

View file

@ -197,7 +197,7 @@ ldap_modify_ext_s( LDAP *ld, LDAP_CONST char *dn,
if ( rc != LDAP_SUCCESS )
return( rc );
if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 )
if ( ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *) NULL, &res ) == -1 )
return( ld->ld_errno );
return( ldap_result2error( ld, res, 1 ) );

View file

@ -219,7 +219,7 @@ ldap_rename_s(
return rc;
}
rc = ldap_result( ld, msgid, 1, NULL, &res );
rc = ldap_result( ld, msgid, LDAP_MSG_ALL, NULL, &res );
if( rc == -1 ) {
return ld->ld_errno;

View file

@ -156,7 +156,7 @@ ldap_passwd_s(
return rc;
}
if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 ) {
if ( ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *) NULL, &res ) == -1 ) {
return ld->ld_errno;
}

View file

@ -196,7 +196,7 @@ ldap_sasl_bind_s(
}
#endif
if ( ldap_result( ld, msgid, 1, NULL, &result ) == -1 ) {
if ( ldap_result( ld, msgid, LDAP_MSG_ALL, NULL, &result ) == -1 ) {
return( ld->ld_errno ); /* ldap_result sets ld_errno */
}

View file

@ -138,7 +138,7 @@ ldap_search_ext_s(
return( rc );
}
rc = ldap_result( ld, msgid, 1, timeout, res );
rc = ldap_result( ld, msgid, LDAP_MSG_ALL, timeout, res );
if( rc <= 0 ) {
/* error(-1) or timeout(0) */
@ -331,7 +331,7 @@ ldap_search_st(
== -1 )
return( ld->ld_errno );
if ( ldap_result( ld, msgid, 1, timeout, res ) == -1 )
if ( ldap_result( ld, msgid, LDAP_MSG_ALL, timeout, res ) == -1 )
return( ld->ld_errno );
if ( ld->ld_errno == LDAP_TIMEOUT ) {
@ -359,7 +359,7 @@ ldap_search_s(
== -1 )
return( ld->ld_errno );
if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, res ) == -1 )
if ( ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *) NULL, res ) == -1 )
return( ld->ld_errno );
return( ldap_result2error( ld, *res, 0 ) );

View file

@ -88,7 +88,7 @@ ldap_whoami_s(
rc = ldap_whoami( ld, sctrls, cctrls, &msgid );
if ( rc != LDAP_SUCCESS ) return rc;
if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 ) {
if ( ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *) NULL, &res ) == -1 ) {
return ld->ld_errno;
}

View file

@ -851,7 +851,7 @@ ldap_back_op_result(
retry:;
/* if result parsing fails, note the failure reason */
rc = ldap_result( lc->lc_ld, msgid, 1, &tv, &res );
rc = ldap_result( lc->lc_ld, msgid, LDAP_MSG_ALL, &tv, &res );
switch ( rc ) {
case 0:
if ( timeout ) {

View file

@ -1280,7 +1280,7 @@ ldap_back_exop_whoami(
retry:
rs->sr_err = ldap_whoami( lc->lc_ld, ctrls, NULL, &msgid );
if ( rs->sr_err == LDAP_SUCCESS ) {
if ( ldap_result( lc->lc_ld, msgid, 1, NULL, &res ) == -1 ) {
if ( ldap_result( lc->lc_ld, msgid, LDAP_MSG_ALL, NULL, &res ) == -1 ) {
ldap_get_option( lc->lc_ld, LDAP_OPT_ERROR_NUMBER,
&rs->sr_err );
if ( rs->sr_err == LDAP_SERVER_DOWN && doretry ) {

View file

@ -122,7 +122,7 @@ retry:
op->o_ctrls, NULL, &msgid );
if ( rc == LDAP_SUCCESS ) {
if ( ldap_result( lc->lc_ld, msgid, 1, NULL, &res ) == -1 ) {
if ( ldap_result( lc->lc_ld, msgid, LDAP_MSG_ALL, NULL, &res ) == -1 ) {
ldap_get_option( lc->lc_ld, LDAP_OPT_ERROR_NUMBER, &rc );
ldap_back_freeconn( op, lc, 0 );
lc = NULL;

View file

@ -258,7 +258,7 @@ retry:
* but this is necessary for version matching, and for ACL processing.
*/
for ( rc = 0; rc != -1; rc = ldap_result( lc->lc_ld, msgid, 0, &tv, &res ) )
for ( rc = 0; rc != -1; rc = ldap_result( lc->lc_ld, msgid, LDAP_MSG_ONE, &tv, &res ) )
{
/* check for abandon */
if ( op->o_abandon ) {

View file

@ -186,7 +186,7 @@ retry:;
rs->sr_err = LDAP_OTHER;
rc = ldap_result( mc->mc_conns[ candidate ].msc_ld,
msgid, LDAP_MSG_ONE, tvp, &res );
msgid, LDAP_MSG_ALL, tvp, &res );
switch ( rc ) {
case -1:
send_ldap_result( op, rs );

View file

@ -343,7 +343,7 @@ rebind:;
*/
retry:;
tv = mt->mt_bind_timeout;
switch ( ldap_result( msc->msc_ld, msgid, 0, &tv, &res ) ) {
switch ( ldap_result( msc->msc_ld, msgid, LDAP_MSG_ALL, &tv, &res ) ) {
case 0:
snprintf( buf, sizeof( buf ),
"ldap_result=0 nretries=%d%s\n",
@ -499,7 +499,7 @@ rebind:;
*/
retry:;
tv = mt->mt_bind_timeout;
switch ( ldap_result( msc->msc_ld, msgid, 0, &tv, &res ) ) {
switch ( ldap_result( msc->msc_ld, msgid, LDAP_MSG_ALL, &tv, &res ) ) {
case 0:
snprintf( buf, sizeof( buf ),
"ldap_result=0 nretries=%d%s",

View file

@ -185,7 +185,7 @@ meta_back_compare( Operation *op, SlapReply *rs )
}
lrc = ldap_result( msc->msc_ld, msgid[ i ],
0, &tv, &res );
LDAP_MSG_ALL, &tv, &res );
if ( lrc == 0 ) {
assert( res == NULL );

View file

@ -84,7 +84,7 @@ retry:;
rs->sr_err = LDAP_OTHER;
rc = ldap_result( mc->mc_conns[ candidate ].msc_ld,
msgid, LDAP_MSG_ONE, tvp, &res );
msgid, LDAP_MSG_ALL, tvp, &res );
switch ( rc ) {
case -1:
rs->sr_err = LDAP_OTHER;

View file

@ -194,7 +194,7 @@ retry:;
rs->sr_err = LDAP_OTHER;
rc = ldap_result( mc->mc_conns[ candidate ].msc_ld,
msgid, LDAP_MSG_ONE, tvp, &res );
msgid, LDAP_MSG_ALL, tvp, &res );
switch ( rc ) {
case -1:
rc = -1;

View file

@ -125,7 +125,7 @@ retry:;
rs->sr_err = LDAP_OTHER;
rc = ldap_result( mc->mc_conns[ candidate ].msc_ld,
msgid, LDAP_MSG_ONE, tvp, &res );
msgid, LDAP_MSG_ALL, tvp, &res );
switch ( rc ) {
case -1:
break;

View file

@ -389,7 +389,7 @@ meta_back_search( Operation *op, SlapReply *rs )
*/
get_result:;
rc = ldap_result( msc->msc_ld, candidates[ i ].sr_msgid,
0, &tv, &res );
LDAP_MSG_ONE, &tv, &res );
if ( rc == 0 ) {
/* FIXME: res should not need to be freed */

View file

@ -181,6 +181,7 @@ retry:;
rc = ldap_bind_s( ld, manager, passwd, LDAP_AUTH_SIMPLE );
if ( rc != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_bind" );
ldap_unbind_ext( ld, NULL, NULL );
switch ( rc ) {
case LDAP_BUSY:
case LDAP_UNAVAILABLE:
@ -205,6 +206,7 @@ retry:;
filter, attrs, 0, &res );
if ( rc != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_search" );
ldap_unbind_ext( ld, NULL, NULL );
if ( rc == LDAP_BUSY && do_retry > 0 ) {
do_retry--;
goto retry;
@ -219,5 +221,5 @@ retry:;
fprintf( stderr, " PID=%ld - Search done (%d).\n", (long) pid, rc );
ldap_unbind( ld );
ldap_unbind_ext( ld, NULL, NULL );
}