summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Mraz <tm@t8m.info>2004-11-23 12:53:19 +0000
committerTomas Mraz <tm@t8m.info>2004-11-23 12:53:19 +0000
commit057f97683708a55269cc57394edac8a657c8eaff (patch)
tree423321ea01d42a49176dab9b999ebe9b362b15b0
parent5be588e2c8c19bca629393352661a02840f004c8 (diff)
Relevant BUGIDs: Red Hat bz 140451
Purpose of commit: bugfix Commit summary: --------------- Convert uid gid from passwd entry always as decimal. Test failure.
-rw-r--r--modules/pam_unix/pam_unix_passwd.c6
-rw-r--r--modules/pam_unix/support.c4
2 files changed, 8 insertions, 2 deletions
diff --git a/modules/pam_unix/pam_unix_passwd.c b/modules/pam_unix/pam_unix_passwd.c
index 816668f5..2ea57cc6 100644
--- a/modules/pam_unix/pam_unix_passwd.c
+++ b/modules/pam_unix/pam_unix_passwd.c
@@ -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,
diff --git a/modules/pam_unix/support.c b/modules/pam_unix/support.c
index 5b23b8e9..5138a875 100644
--- a/modules/pam_unix/support.c
+++ b/modules/pam_unix/support.c
@@ -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;