- if ((password[0] == '\0') && (pw_password[0] == '\0'))
- return 1;
-
- if (pw_password[0] != '\0')
- salt = pw_password;
- else
- salt = "xx";
-
-# ifdef HAVE_MD5_PASSWORDS
- if (is_md5_salt(salt))
- encrypted_password = md5_crypt(password, salt);
- else
- encrypted_password = crypt(password, salt);
-# else /* HAVE_MD5_PASSWORDS */
-# if defined(__hpux) && !defined(HAVE_SECUREWARE)
- if (iscomsec())
- encrypted_password = bigcrypt(password, salt);
- else
- encrypted_password = crypt(password, salt);
-# else
-# ifdef HAVE_SECUREWARE
- encrypted_password = bigcrypt(password, salt);
-# else
- encrypted_password = crypt(password, salt);
-# endif /* HAVE_SECUREWARE */
-# endif /* __hpux && !defined(HAVE_SECUREWARE) */
-# endif /* HAVE_MD5_PASSWORDS */
-
- /* Authentication is accepted if the encrypted passwords are identical. */
+ if (strcmp(pw_password, "") == 0 && strcmp(password, "") == 0)
+ return (1);
+
+ /* Encrypt the candidate password using the proper salt. */
+ encrypted_password = xcrypt(password,
+ (pw_password[0] && pw_password[1]) ? pw_password : "xx");
+
+ /*
+ * Authentication is accepted if the encrypted passwords
+ * are identical.
+ */