[PATCH] Core: fix build without libcrypt

Sergey Kandaurov pluknet at nginx.com
Mon Mar 18 14:55:50 UTC 2024


> On 28 Feb 2024, at 05:23, Piotr Sikora via nginx-devel <nginx-devel at nginx.org> wrote:
> 
> # HG changeset patch
> # User Piotr Sikora <piotr at aviatrix.com>
> # Date 1708977637 0
> #      Mon Feb 26 20:00:37 2024 +0000
> # Branch patch013
> # Node ID cdc173477ea99fd6c952a85e5cd11db66452076a
> # Parent  04e3155b3b9651fee708898aaf82ac35532806ee
> Core: fix build without libcrypt.
> 
> libcrypt is no longer part of glibc, so it might not be available.
> 
> Signed-off-by: Piotr Sikora <piotr at aviatrix.com>

In popular RPM- and Debian-based Linux distributions with glibc 2.38,
libcrypt.so is now indeed installed in a separate package.
However, it appears that this package is critical and provides
dependency either for systemd or libc, which cannot be removed.
So, I don't see so far, how nginx is affected in practice.

> 
> diff -r 04e3155b3b96 -r cdc173477ea9 auto/unix
> --- a/auto/unix Mon Feb 26 20:00:35 2024 +0000
> +++ b/auto/unix Mon Feb 26 20:00:37 2024 +0000
> @@ -150,7 +150,7 @@
> 
> 
> ngx_feature="crypt()"
> -ngx_feature_name=
> +ngx_feature_name="NGX_HAVE_CRYPT"
> ngx_feature_run=no
> ngx_feature_incs=
> ngx_feature_path=
> @@ -162,7 +162,7 @@
> if [ $ngx_found = no ]; then
> 
>     ngx_feature="crypt() in libcrypt"
> -    ngx_feature_name=
> +    ngx_feature_name="NGX_HAVE_CRYPT"
>     ngx_feature_run=no
>     ngx_feature_incs=
>     ngx_feature_path=
> diff -r 04e3155b3b96 -r cdc173477ea9 src/os/unix/ngx_linux_config.h
> --- a/src/os/unix/ngx_linux_config.h Mon Feb 26 20:00:35 2024 +0000
> +++ b/src/os/unix/ngx_linux_config.h Mon Feb 26 20:00:37 2024 +0000
> @@ -52,7 +52,6 @@
> #include <malloc.h>             /* memalign() */
> #include <limits.h>             /* IOV_MAX */
> #include <sys/ioctl.h>
> -#include <crypt.h>
> #include <sys/utsname.h>        /* uname() */
> 
> #include <dlfcn.h>
> @@ -61,6 +60,11 @@
> #include <ngx_auto_config.h>
> 
> 
> +#if (NGX_HAVE_CRYPT_H)
> +#include <crypt.h>
> +#endif
> +
> +
> #if (NGX_HAVE_POSIX_SEM)
> #include <semaphore.h>
> #endif
> diff -r 04e3155b3b96 -r cdc173477ea9 src/os/unix/ngx_user.c
> --- a/src/os/unix/ngx_user.c Mon Feb 26 20:00:35 2024 +0000
> +++ b/src/os/unix/ngx_user.c Mon Feb 26 20:00:37 2024 +0000
> @@ -44,7 +44,7 @@
>     return NGX_ERROR;
> }
> 
> -#else
> +#elif (NGX_HAVE_CRYPT)
> 
> ngx_int_t
> ngx_libc_crypt(ngx_pool_t *pool, u_char *key, u_char *salt, u_char **encrypted)
> @@ -76,6 +76,14 @@
>     return NGX_ERROR;
> }
> 
> +#else
> +
> +ngx_int_t
> +ngx_libc_crypt(ngx_pool_t *pool, u_char *key, u_char *salt, u_char **encrypted)
> +{
> +    return NGX_ERROR;
> +}
> +
> #endif
> 
> #endif /* NGX_CRYPT */
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> https://mailman.nginx.org/mailman/listinfo/nginx-devel

-- 
Sergey Kandaurov


More information about the nginx-devel mailing list