]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Portability: Basic auth NIS helper depends on crypt()
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 22 Mar 2014 12:03:18 +0000 (06:03 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 22 Mar 2014 12:03:18 +0000 (06:03 -0600)
Detect crypt.h before permitting the helper to build.

Also, if crypt() function is missing build the helper to output BH code
with an error message instead of failing to build.

helpers/basic_auth/NIS/basic_nis_auth.cc
helpers/basic_auth/NIS/required.m4

index 3ba4b19585b6182ce23419239883b7dd0b10ed0f..b2f9a8bee3527494ca3b8bb2b0ace21ab610b83b 100644 (file)
@@ -65,9 +65,15 @@ main(int argc, char **argv)
         if (!nispasswd) {
             /* User does not exist */
             printf("ERR No such user\n");
+#if HAVE_CRYPT
         } else if (strcmp(nispasswd, (char *) crypt(passwd, nispasswd)) == 0) {
             /* All ok !, thanks... */
             printf("OK\n");
+#else
+        } else {
+            /* Password incorrect */
+            printf("BH message=\"Missing crypto capability\"\n");
+#endif
         } else {
             /* Password incorrect */
             printf("ERR Wrong password\n");
index 9d046673e63f65856736fabbbc3d28653383d449..64d3429af6b3fe5f1dddb8a217d24be328c897fa 100755 (executable)
@@ -1,4 +1,4 @@
-AC_CHECK_HEADERS([sys/types.h rpc/rpc.h rpcsvc/yp_prot.h],[BUILD_HELPER="NIS"],,AC_INCLUDES_DEFAULT([
+AC_CHECK_HEADERS([sys/types.h rpc/rpc.h rpcsvc/yp_prot.h crypt.h],[BUILD_HELPER="NIS"],,AC_INCLUDES_DEFAULT([
 #if HAVE_RPC_RPC_H
 #include <rpc/rpc.h>
 #endif