]> granicus.if.org Git - linux-pam/blobdiff - modules/pam_unix/pam_unix_passwd.c
Add missing ')'
[linux-pam] / modules / pam_unix / pam_unix_passwd.c
index 498a81c6ab179cedc15709c92118eeb391f7586b..9aae3b03de3531c5542fc3acaff620819b8ee400 100644 (file)
 #include <signal.h>
 #include <errno.h>
 #include <sys/wait.h>
+#include <sys/resource.h>
 
 #include <security/_pam_macros.h>
 
 /* indicate the following groups are defined */
 
-#define PAM_SM_PASSWORD
+#ifdef PAM_STATIC
+# include "pam_unix_static.h"
+#else
+# define PAM_SM_PASSWORD
+#endif
 
 #include <security/pam_modules.h>
 #include <security/pam_ext.h>
@@ -249,7 +254,8 @@ static int _unix_run_update_binary(pam_handle_t *pamh, unsigned int ctrl, const
 
        close(fds[0]);       /* close here to avoid possible SIGPIPE above */
        close(fds[1]);
-       rc=waitpid(child, &retval, 0);  /* wait for helper to complete */
+       /* wait for helper to complete: */
+       while ((rc=waitpid(child, &retval, 0)) < 0 && errno == EINTR);
        if (rc<0) {
          pam_syslog(pamh, LOG_ERR, "unix_update waitpid failed: %m");
          retval = PAM_AUTHTOK_ERR;
@@ -523,9 +529,8 @@ static int _pam_unix_approve_pass(pam_handle_t * pamh
        return retval;
 }
 
-
-PAM_EXTERN int pam_sm_chauthtok(pam_handle_t * pamh, int flags,
-                               int argc, const char **argv)
+int
+pam_sm_chauthtok(pam_handle_t *pamh, int flags, int argc, const char **argv)
 {
        unsigned int ctrl, lctrl;
        int retval;
@@ -797,7 +802,7 @@ PAM_EXTERN int pam_sm_chauthtok(pam_handle_t * pamh, int flags,
                tpass = create_password_hash(pamh, pass_new, ctrl, rounds);
                if (tpass == NULL) {
                        pam_syslog(pamh, LOG_CRIT,
-                               "out of memory for password");
+                               "crypt() failure or out of memory for password");
                        pass_new = pass_old = NULL;     /* tidy up */
                        unlock_pwdf();
                        return PAM_BUF_ERR;
@@ -823,17 +828,3 @@ PAM_EXTERN int pam_sm_chauthtok(pam_handle_t * pamh, int flags,
 
        return retval;
 }
-
-
-/* static module data */
-#ifdef PAM_STATIC
-struct pam_module _pam_unix_passwd_modstruct = {
-    "pam_unix_passwd",
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    pam_sm_chauthtok,
-};
-#endif