It was removed from PostgreSQL 8.4 sources.
dnl Checks for library functions.
AC_CHECK_FUNCS(strlcpy strlcat getpeereid getpeerucred basename)
-AC_SEARCH_LIBS(crypt, crypt, [], AC_MSG_ERROR([crypt not found]))
+AC_SEARCH_LIBS(crypt, crypt)
AC_SEARCH_LIBS(clock_gettime, rt)
AC_SEARCH_LIBS(getsockname, socket)
AC_SEARCH_LIBS(gethostbyname, nsl)
AC_SEARCH_LIBS(hstrerror, resolv)
+AC_CHECK_FUNCS(crypt)
dnl Find libevent
AC_MSG_CHECKING([for libevent])
#ifndef HAVE_BASENAME
const char *basename(const char *path);
#endif
+#ifndef HAVE_CRYPT
+#define crypt(p,s) (NULL)
+#endif
void change_user(const char *user);
return strcmp(user->passwd, passwd) == 0;
case AUTH_CRYPT:
correct = crypt(user->passwd, (char *)client->tmp_login_salt);
- return strcmp(correct, passwd) == 0;
+ return correct && strcmp(correct, passwd) == 0;
case AUTH_MD5:
if (strlen(passwd) != MD5_PASSWD_LEN)
return false;
cf_auth_type = AUTH_TRUST;
else if (strcasecmp(val, "plain") == 0)
cf_auth_type = AUTH_PLAIN;
+#ifdef HAVE_CRYPT
else if (strcasecmp(val, "crypt") == 0)
cf_auth_type = AUTH_CRYPT;
+#endif
else if (strcasecmp(val, "md5") == 0)
cf_auth_type = AUTH_MD5;
else {
memcpy(saltbuf, salt, 2);
saltbuf[2] = 0;
enc = crypt(user->passwd, saltbuf);
+ if (!enc) {
+ slog_warning(server, "crypt failed");
+ return false;
+ }
return send_password(server, enc);
}