]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#8905 clients: fixup connect fail message master 859/head
authorHoward Chu <hyc@openldap.org>
Fri, 10 Apr 2026 16:46:03 +0000 (17:46 +0100)
committerQuanah Gibson-Mount <quanah@openldap.org>
Fri, 10 Apr 2026 21:48:39 +0000 (21:48 +0000)
clients/tools/common.c

index d0dc2a48f1ec6cb3e16cbc26fa8c7549006acb7e..4b913dd30679282b8498e5def27a20bcf3f5d636 100644 (file)
@@ -1415,9 +1415,14 @@ dnssrv_free:;
 
                rc = ldap_connect( ld );
                if( rc != LDAP_SUCCESS ) {
 
                rc = ldap_connect( ld );
                if( rc != LDAP_SUCCESS ) {
-                       fprintf( stderr,
-                               "Could not connect to URI=%s ", ldapuri );
-                       tool_perror2( ld, "" );
+                       static const char connectErr[] = "Could not connect to URI";
+                       char *msg = malloc( strlen( ldapuri ) + sizeof(connectErr) + 2 );
+                       if ( msg )
+                               sprintf(msg, "%s=%s", connectErr, ldapuri );
+                       else
+                               msg = connectErr;
+                       tool_perror2( ld, msg );
+                       if ( msg != connectErr ) free( msg );
                        tool_exit( ld, EXIT_FAILURE );
                }
 
                        tool_exit( ld, EXIT_FAILURE );
                }