summaryrefslogtreecommitdiff
path: root/modules/pam_pwhistory/opasswd.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules/pam_pwhistory/opasswd.c')
-rw-r--r--modules/pam_pwhistory/opasswd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/pam_pwhistory/opasswd.c b/modules/pam_pwhistory/opasswd.c
index e6cf3469..77142f2c 100644
--- a/modules/pam_pwhistory/opasswd.c
+++ b/modules/pam_pwhistory/opasswd.c
@@ -49,7 +49,7 @@
#include <syslog.h>
#include <sys/stat.h>
-#if defined (HAVE_XCRYPT_H)
+#if defined HAVE_LIBXCRYPT
#include <xcrypt.h>
#elif defined (HAVE_CRYPT_H)
#include <crypt.h>
@@ -326,6 +326,9 @@ save_old_pass (pam_handle_t *pamh, const char *user, uid_t uid,
n = strlen (buf);
#endif /* HAVE_GETLINE / HAVE_GETDELIM */
+ if (n < 1)
+ break;
+
cp = buf;
save = strdup (buf); /* Copy to write the original data back. */
if (save == NULL)
@@ -336,9 +339,6 @@ save_old_pass (pam_handle_t *pamh, const char *user, uid_t uid,
goto error_opasswd;
}
- if (n < 1)
- break;
-
tmp = strchr (cp, '#'); /* remove comments */
if (tmp)
*tmp = '\0';