]> granicus.if.org Git - linux-pam/commitdiff
Relevant BUGIDs: Red Hat bz 140451
authorTomas Mraz <tm@t8m.info>
Tue, 23 Nov 2004 12:53:19 +0000 (12:53 +0000)
committerTomas Mraz <tm@t8m.info>
Tue, 23 Nov 2004 12:53:19 +0000 (12:53 +0000)
Purpose of commit: bugfix

Commit summary:
---------------
Convert uid gid from passwd entry always as decimal. Test failure.

modules/pam_unix/pam_unix_passwd.c
modules/pam_unix/support.c

index 816668f5b2ea8731483bda26685113be8358178d..2ea57cc6d41f6df4ba42fb3362dfa5112296efac 100644 (file)
@@ -813,6 +813,12 @@ PAM_EXTERN int pam_sm_chauthtok(pam_handle_t * pamh, int flags,
        } else {
                struct passwd *pwd;
                _unix_getpwnam(pamh, user, 1, 1, &pwd);
+               if (pwd == NULL) {
+                       _log_err(LOG_DEBUG, pamh,
+                               "user \"%s\" has corrupted passwd entry",
+                               user);
+                       return PAM_USER_UNKNOWN;
+               }
                if (!_unix_shadowed(pwd) &&
                    (strchr(pwd->pw_passwd, '*') != NULL)) {
                        _log_err(LOG_DEBUG, pamh,
index 5b23b8e9784cf73e49c79bb21f722f3647a04427..5138a875492c0637ce2d2c4e24ff70575754d745 100644 (file)
@@ -390,14 +390,14 @@ int _unix_getpwnam(pam_handle_t *pamh, const char *name,
                }
                memset(*ret, '\0', buflen);
 
-               (*ret)->pw_uid = strtol(suid, &p, 0);
+               (*ret)->pw_uid = strtol(suid, &p, 10);
                if ((strlen(sgid) == 0) || (*p != '\0')) {
                        free(*ret);
                        *ret = NULL;
                        return matched;
                }
 
-               (*ret)->pw_gid = strtol(sgid, &p, 0);
+               (*ret)->pw_gid = strtol(sgid, &p, 10);
                if ((strlen(sgid) == 0) || (*p != '\0')) {
                        free(*ret);
                        *ret = NULL;