]> granicus.if.org Git - linux-pam/blobdiff - modules/pam_unix/pam_unix_auth.c
Relevant BUGIDs:
[linux-pam] / modules / pam_unix / pam_unix_auth.c
index 41b55c27e4715cb44a82785dc79c694b7b4cb947..dfedd608b84086eb9fa11416065f1883ca082132 100644 (file)
@@ -48,6 +48,7 @@
 #include <ctype.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <syslog.h>
 
 /* indicate the following groups are defined */
 
 #define _PAM_EXTERN_FUNCTIONS
 #include <security/_pam_macros.h>
 #include <security/pam_modules.h>
-
-#ifndef LINUX_PAM
-#include <security/pam_appl.h>
-#endif                         /* LINUX_PAM */
+#include <security/pam_ext.h>
 
 #include "support.h"
 
@@ -113,7 +111,7 @@ PAM_EXTERN int pam_sm_authenticate(pam_handle_t * pamh, int flags
 
        D(("called."));
 
-       ctrl = _set_ctrl(pamh, flags, NULL, argc, argv);
+       ctrl = _set_ctrl(pamh, flags, NULL, NULL, argc, argv);
 
        /* Get a few bytes so we can pass our return value to
           pam_sm_setcred(). */
@@ -126,12 +124,11 @@ PAM_EXTERN int pam_sm_authenticate(pam_handle_t * pamh, int flags
        if (retval == PAM_SUCCESS) {
                /*
                 * Various libraries at various times have had bugs related to
-                * '+' or '-' as the first character of a user name. Don't take
-                * any chances here. Require that the username starts with an
-                * alphanumeric character.
+                * '+' or '-' as the first character of a user name. Don't
+                * allow this characters here.
                 */
-               if (name == NULL || !isalnum(*name)) {
-                       _log_err(LOG_ERR, pamh, "bad username [%s]", name);
+               if (name == NULL || name[0] == '-' || name[0] == '+') {
+                       pam_syslog(pamh, LOG_ERR, "bad username [%s]", name);
                        retval = PAM_USER_UNKNOWN;
                        AUTH_RETURN;
                }
@@ -163,8 +160,8 @@ PAM_EXTERN int pam_sm_authenticate(pam_handle_t * pamh, int flags
                                     ,_UNIX_AUTHTOK, &p);
        if (retval != PAM_SUCCESS) {
                if (retval != PAM_CONV_AGAIN) {
-                       _log_err(LOG_CRIT, pamh, "auth could not identify password for [%s]"
-                                ,name);
+                       pam_syslog(pamh, LOG_CRIT,
+                           "auth could not identify password for [%s]", name);
                } else {
                        D(("conversation function is not ready yet"));
                        /*