[PATCH] Core: fix build without libcrypt

Roman Arutyunyan arut at nginx.com
Mon Mar 18 12:13:00 UTC 2024


Hi Piotr,

On Wed, Feb 28, 2024 at 01:23:08AM +0000, Piotr Sikora via nginx-devel 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.

Can you provide an example of a system where this fix is needed?

> Signed-off-by: Piotr Sikora <piotr at aviatrix.com>
> 
> 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

--
Roman Arutyunyan


More information about the nginx-devel mailing list