From b984564dbdb38eaac38273cb636108d228398cb3 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 5 Feb 2007 12:30:40 +0000 Subject: [PATCH] Handle timeouts from ldap_result() --- libraries/libldap/add.c | 2 +- libraries/libldap/compare.c | 2 +- libraries/libldap/dds.c | 2 +- libraries/libldap/delete.c | 2 +- libraries/libldap/extended.c | 2 +- libraries/libldap/modify.c | 2 +- libraries/libldap/modrdn.c | 2 +- libraries/libldap/passwd.c | 2 +- libraries/libldap/sasl.c | 2 +- libraries/libldap/search.c | 2 +- libraries/libldap/whoami.c | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libraries/libldap/add.c b/libraries/libldap/add.c index 03d1adaabd..f36dfc8a0f 100644 --- a/libraries/libldap/add.c +++ b/libraries/libldap/add.c @@ -208,7 +208,7 @@ ldap_add_ext_s( if ( rc != LDAP_SUCCESS ) return( rc ); - if ( ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *) NULL, &res ) == -1 ) + if ( ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *) NULL, &res ) == -1 || !res ) return( ld->ld_errno ); return( ldap_result2error( ld, res, 1 ) ); diff --git a/libraries/libldap/compare.c b/libraries/libldap/compare.c index 2af680d891..0eb5155eb7 100644 --- a/libraries/libldap/compare.c +++ b/libraries/libldap/compare.c @@ -153,7 +153,7 @@ ldap_compare_ext_s( if ( rc != LDAP_SUCCESS ) return( rc ); - if ( ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *) NULL, &res ) == -1 ) + if ( ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *) NULL, &res ) == -1 || !res ) return( ld->ld_errno ); return( ldap_result2error( ld, res, 1 ) ); diff --git a/libraries/libldap/dds.c b/libraries/libldap/dds.c index bfaf9b7fb3..88ec16f4bd 100644 --- a/libraries/libldap/dds.c +++ b/libraries/libldap/dds.c @@ -142,7 +142,7 @@ ldap_refresh_s( if ( rc != LDAP_SUCCESS ) return rc; rc = ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *)NULL, &res ); - if( rc == -1 ) return ld->ld_errno; + if( rc == -1 || !res ) return ld->ld_errno; rc = ldap_parse_refresh( ld, res, newttl ); if( rc != LDAP_SUCCESS ) { diff --git a/libraries/libldap/delete.c b/libraries/libldap/delete.c index 52b7f2d80d..0e51608a68 100644 --- a/libraries/libldap/delete.c +++ b/libraries/libldap/delete.c @@ -120,7 +120,7 @@ ldap_delete_ext_s( if( rc != LDAP_SUCCESS ) return( ld->ld_errno ); - if ( ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *) NULL, &res ) == -1 ) + if ( ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *) NULL, &res ) == -1 || !res ) return( ld->ld_errno ); return( ldap_result2error( ld, res, 1 ) ); diff --git a/libraries/libldap/extended.c b/libraries/libldap/extended.c index 60ad3c92fe..644180de0e 100644 --- a/libraries/libldap/extended.c +++ b/libraries/libldap/extended.c @@ -138,7 +138,7 @@ ldap_extended_operation_s( return( rc ); } - if ( ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *) NULL, &res ) == -1 ) { + if ( ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *) NULL, &res ) == -1 || !res ) { return( ld->ld_errno ); } diff --git a/libraries/libldap/modify.c b/libraries/libldap/modify.c index f237b2426e..41b75e712d 100644 --- a/libraries/libldap/modify.c +++ b/libraries/libldap/modify.c @@ -201,7 +201,7 @@ ldap_modify_ext_s( LDAP *ld, LDAP_CONST char *dn, if ( rc != LDAP_SUCCESS ) return( rc ); - if ( ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *) NULL, &res ) == -1 ) + if ( ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *) NULL, &res ) == -1 || !res ) return( ld->ld_errno ); return( ldap_result2error( ld, res, 1 ) ); diff --git a/libraries/libldap/modrdn.c b/libraries/libldap/modrdn.c index b7c31ffb9f..bc3c8590d4 100644 --- a/libraries/libldap/modrdn.c +++ b/libraries/libldap/modrdn.c @@ -219,7 +219,7 @@ ldap_rename_s( rc = ldap_result( ld, msgid, LDAP_MSG_ALL, NULL, &res ); - if( rc == -1 ) { + if( rc == -1 || !res ) { return ld->ld_errno; } diff --git a/libraries/libldap/passwd.c b/libraries/libldap/passwd.c index 704e495b1a..b6caab5831 100644 --- a/libraries/libldap/passwd.c +++ b/libraries/libldap/passwd.c @@ -156,7 +156,7 @@ ldap_passwd_s( return rc; } - if ( ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *) NULL, &res ) == -1 ) { + if ( ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *) NULL, &res ) == -1 || !res ) { return ld->ld_errno; } diff --git a/libraries/libldap/sasl.c b/libraries/libldap/sasl.c index 5fc48e2155..0b02065c35 100644 --- a/libraries/libldap/sasl.c +++ b/libraries/libldap/sasl.c @@ -191,7 +191,7 @@ ldap_sasl_bind_s( } #endif - if ( ldap_result( ld, msgid, LDAP_MSG_ALL, NULL, &result ) == -1 ) { + if ( ldap_result( ld, msgid, LDAP_MSG_ALL, NULL, &result ) == -1 || !result ) { return( ld->ld_errno ); /* ldap_result sets ld_errno */ } diff --git a/libraries/libldap/search.c b/libraries/libldap/search.c index 0ff402ea69..a09b8301ca 100644 --- a/libraries/libldap/search.c +++ b/libraries/libldap/search.c @@ -385,7 +385,7 @@ ldap_search_s( == -1 ) return( ld->ld_errno ); - if ( ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *) NULL, res ) == -1 ) + if ( ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *) NULL, res ) == -1 || !res ) return( ld->ld_errno ); return( ldap_result2error( ld, *res, 0 ) ); diff --git a/libraries/libldap/whoami.c b/libraries/libldap/whoami.c index 851f6659f0..f77ebb5069 100644 --- a/libraries/libldap/whoami.c +++ b/libraries/libldap/whoami.c @@ -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, LDAP_MSG_ALL, (struct timeval *) NULL, &res ) == -1 ) { + if ( ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *) NULL, &res ) == -1 || !res ) { return ld->ld_errno; } -- 2.39.5