With these two patches, ldp.exe displays "No result present in message" and does not crash.
From: Alex Henrie alexhenrie24@gmail.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54690 --- dlls/wldap32/misc.c | 1 + dlls/wldap32/tests/parse.c | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/dlls/wldap32/misc.c b/dlls/wldap32/misc.c index 8c61d618bc9..05552bd6eed 100644 --- a/dlls/wldap32/misc.c +++ b/dlls/wldap32/misc.c @@ -98,6 +98,7 @@ ULONG CDECL WLDAP32_ldap_count_entries( LDAP *ld, WLDAP32_LDAPMessage *res ) { TRACE( "(%p, %p)\n", ld, res );
+ if (!res) return 0; if (!ld) return ~0u; return ldap_count_entries( CTX(ld), MSG(res) ); } diff --git a/dlls/wldap32/tests/parse.c b/dlls/wldap32/tests/parse.c index 8394d5eeeff..161a0672cdc 100644 --- a/dlls/wldap32/tests/parse.c +++ b/dlls/wldap32/tests/parse.c @@ -252,7 +252,13 @@ static void test_ldap_paged_search(void) ok( res != NULL, "expected res != NULL\n" ); ok( count == 0, "got %lu\n", count );
- count = ldap_count_entries( ld, res); + count = ldap_count_entries( NULL, NULL ); + ok( count == 0, "got %lu\n", count ); + count = ldap_count_entries( ld, NULL ); + ok( count == 0, "got %lu\n", count ); + count = ldap_count_entries( NULL, res ); + todo_wine ok( count == 1, "got %lu\n", count ); + count = ldap_count_entries( ld, res ); ok( count == 1, "got %lu\n", count );
entry = ldap_first_entry( ld, res);
From: Alex Henrie alexhenrie24@gmail.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54690 --- dlls/wldap32/parse.c | 2 ++ dlls/wldap32/tests/parse.c | 6 ++++++ 2 files changed, 8 insertions(+)
diff --git a/dlls/wldap32/parse.c b/dlls/wldap32/parse.c index 436d38d5c42..26e8de14c85 100644 --- a/dlls/wldap32/parse.c +++ b/dlls/wldap32/parse.c @@ -148,6 +148,7 @@ ULONG CDECL ldap_parse_resultA( LDAP *ld, WLDAP32_LDAPMessage *result, ULONG *re free );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR; + if (!result) return WLDAP32_LDAP_NO_RESULTS_RETURNED;
ret = ldap_parse_resultW( ld, result, retcode, &matchedW, &errorW, &referralsW, &serverctrlsW, free );
@@ -177,6 +178,7 @@ ULONG CDECL ldap_parse_resultW( LDAP *ld, WLDAP32_LDAPMessage *result, ULONG *re free );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR; + if (!result) return WLDAP32_LDAP_NO_RESULTS_RETURNED;
ret = map_error( ldap_parse_result( CTX(ld), MSG(result), (int *)retcode, &matchedU, &errorU, &referralsU, &serverctrlsU, free ) ); diff --git a/dlls/wldap32/tests/parse.c b/dlls/wldap32/tests/parse.c index 161a0672cdc..375acbbe776 100644 --- a/dlls/wldap32/tests/parse.c +++ b/dlls/wldap32/tests/parse.c @@ -68,6 +68,12 @@ static void test_ldap_parse_sort_control( LDAP *ld ) ok( !ret, "ldap_search_ext_sA failed %#lx\n", ret ); ok( res != NULL, "expected res != NULL\n" );
+ ret = ldap_parse_resultA( NULL, NULL, NULL, NULL, NULL, NULL, &server_ctrls, 0 ); + ok( ret == LDAP_PARAM_ERROR, "ldap_parse_resultA should fail, got %#lx\n", ret ); + ret = ldap_parse_resultA( NULL, res, NULL, NULL, NULL, NULL, &server_ctrls, 0 ); + ok( ret == LDAP_PARAM_ERROR, "ldap_parse_resultA should fail, got %#lx\n", ret ); + ret = ldap_parse_resultA( ld, NULL, NULL, NULL, NULL, NULL, &server_ctrls, 0 ); + ok( ret == LDAP_NO_RESULTS_RETURNED, "ldap_parse_resultA should fail, got %#lx\n", ret ); result = ~0u; ret = ldap_parse_resultA( ld, res, &result, NULL, NULL, NULL, &server_ctrls, 1 ); ok( !ret, "ldap_parse_resultA failed %#lx\n", ret );
This merge request was approved by Hans Leidekker.