[gnutls-devel] GnuTLS | Compression broken in gnutls-3.8.4 on Darwin (at least) (#1546)

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Thu Apr 18 03:51:33 CEST 2024



David Bohman created an issue: https://gitlab.com/gnutls/gnutls/-/issues/1546



## Description of problem:

The change in 7f45a942 does not work on Darwin, since `dlopen("libz.so.1", ...)` will not find the dynamic library. On Darwin, you need `dlopen("libz.dylib", ...)`, so you are going to need to pass the correct string to `dlopen` on different operating systems. I found this by inspecting the code in `gnutls-3.8.4` and writing a test program in order to demonstrate it.

## Version of gnutls used:

3.8.4

## Distributor of gnutls (e.g., Ubuntu, Fedora, RHEL)

Self compile.

## How reproducible:

Here is the test program I used:

```
#include <stdlib.h>
#include <unistd.h>

#include <stdio.h>

#include <dlfcn.h>

int
main(
    int     argc,
    char    *argv[])
{
    void    *dl;

    if (argc > 1) {
        dl = dlopen(argv[1], RTLD_NOW | RTLD_GLOBAL);
        if (dl != NULL) {
            fprintf(stderr, "Success!\n");
            pause();
        }
    }

    exit(1);
}
```

## Actual results:

Failure when `libz.so.1` is passed as arg 1 to the test program. For success, I had to pass in `libz.dylib`.

Here is the code fragment from `lib/compress.c`:

```
    if ((_zlib_handle = dlopen("libz.so.1", RTLD_NOW | RTLD_GLOBAL)) ==
	NULL)
	goto error;
```

## Expected results:

I expected the library to be loaded correctly.

See #1539

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/issues/1546
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20240418/2f09036f/attachment.html>


More information about the Gnutls-devel mailing list