ftp://ftp.krokus.ru/pub/OpenBSD/distfiles/xscreensaver-5.01.tar.gz
[xscreensaver] / driver / passwd-pam.c
index 52347aad5f3fcd10e7e00e5545f48cfaea1be149..a4b132123f7c8ce63078961b80617466efef6a54 100644 (file)
@@ -89,6 +89,8 @@ struct pam_closure {
   Bool verbose_p;
 };
 
+Bool pam_passwd_valid_p (const char *typed_passwd, Bool verbose_p);
+Bool pam_priv_init (int argc, char **argv, Bool verbose_p);
 
 #ifdef HAVE_PAM_FAIL_DELAY
    /* We handle delays ourself.*/
@@ -286,6 +288,7 @@ pam_passwd_valid_p (const char *typed_passwd, Bool verbose_p)
       goto DONE;
     }
 
+#ifdef ALLOW_ROOT_PASSWD
   /* If that didn't work, set the user to root, and try to authenticate again.
    */
   if (user) free (user);
@@ -308,6 +311,8 @@ pam_passwd_valid_p (const char *typed_passwd, Bool verbose_p)
     fprintf (stderr, "%s:   pam_authenticate (...) ==> %d (%s)\n",
              blurb(), status, PAM_STRERROR(pamh, status));
 
+#endif /* ALLOW_ROOT_PASSWD */
+
  DONE:
   if (user) free (user);
   if (pamh)
@@ -339,7 +344,11 @@ pam_priv_init (int argc, char **argv, Bool verbose_p)
   const char file2[] = "/etc/pam.conf";
   struct stat st;
 
-  if (stat (dir, &st) == 0 && st.st_mode & S_IFDIR)
+# ifndef S_ISDIR
+#  define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
+# endif
+
+  if (stat (dir, &st) == 0 && S_ISDIR(st.st_mode))
     {
       if (stat (file, &st) != 0)
         fprintf (stderr,