]> git.feebdaed.xyz Git - 0xmirror/nginx.git/commitdiff
Core: fix build without libcrypt.
authorPiotr Sikora <piotr@aviatrix.com>
Wed, 12 Feb 2025 08:40:58 +0000 (10:40 +0200)
committerRoman Arutyunyan <arutyunyan.roman@gmail.com>
Tue, 18 Feb 2025 13:18:10 +0000 (16:18 +0300)
libcrypt is no longer part of glibc, so it might not be available.

Signed-off-by: Piotr Sikora <piotr@aviatrix.com>
auto/unix
src/os/unix/ngx_linux_config.h
src/os/unix/ngx_user.c

index f29e69c612dccf006bf2bc2da20632e42d24de6e..8bd1b1370dd6887fdad4028669a731ddfae162ad 100644 (file)
--- a/auto/unix
+++ b/auto/unix
@@ -150,7 +150,7 @@ fi
 
 
 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 @@ ngx_feature_test="crypt(\"test\", \"salt\");"
 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=
index 88fef47cefebab26cfa3c343fb1131a74235532d..d99358c93f3e6a424fbe102b30afa4459e156f74 100644 (file)
@@ -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>
 #include <ngx_auto_config.h>
 
 
+#if (NGX_HAVE_CRYPT_H)
+#include <crypt.h>
+#endif
+
+
 #if (NGX_HAVE_POSIX_SEM)
 #include <semaphore.h>
 #endif
index b3d81d07b72a6aaff003106fb2b0f59121ba4f43..8c769ed9322e46a1ddcd0612d360536053d52cce 100644 (file)
@@ -41,7 +41,7 @@ ngx_libc_crypt(ngx_pool_t *pool, u_char *key, u_char *salt, u_char **encrypted)
     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)
@@ -71,6 +71,14 @@ ngx_libc_crypt(ngx_pool_t *pool, u_char *key, u_char *salt, u_char **encrypted)
     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 */