From 40bfaaed40ba831cacc3d74b8c2f216249c141ec Mon Sep 17 00:00:00 2001 From: Tomas Mraz Date: Wed, 30 Mar 2005 10:42:54 +0000 Subject: Relevant BUGIDs: Purpose of commit: bugfix Commit summary: --------------- Fix wrong allocation in _pammodutil_gr* functions. Raise the limit on allocated memory size. Don't retry call if not ERANGE or EINTR --- modules/pammodutil/modutil_getspnam.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'modules/pammodutil/modutil_getspnam.c') diff --git a/modules/pammodutil/modutil_getspnam.c b/modules/pammodutil/modutil_getspnam.c index 325cfd33..72fa29ee 100644 --- a/modules/pammodutil/modutil_getspnam.c +++ b/modules/pammodutil/modutil_getspnam.c @@ -61,6 +61,7 @@ struct spwd *_pammodutil_getspnam(pam_handle_t *pamh, const char *user) buffer = new_buffer; /* make the re-entrant call to get the spwd structure */ + errno = 0; status = getspnam_r(user, buffer, sizeof(struct spwd) + (char *) buffer, length, &result); @@ -109,9 +110,12 @@ struct spwd *_pammodutil_getspnam(pam_handle_t *pamh, const char *user) free(buffer); return NULL; - } + } else if (errno != ERANGE && errno != EINTR) { + /* no sense in repeating the call */ + break; + } - length <<= 1; + length <<= 2; } while (length < PWD_ABSURD_PWD_LENGTH); -- cgit v1.2.3