summaryrefslogtreecommitdiff
path: root/loginrec.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2010-11-05 10:52:37 +1100
committerDamien Miller <djm@mindrot.org>2010-11-05 10:52:37 +1100
commit34ee4204c6051f5f48113903750738e8e055a778 (patch)
tree9090ff610f7884e55b7c037cbcfbb02d96a40867 /loginrec.c
parent07331211949938b0dce95d6a8aae1500da9f5750 (diff)
- (djm) [loginrec.c loginrec.h] Use correct uid_t/pid_t types instead of
int. Should fix bz#1817 cleanly; ok dtucker@
Diffstat (limited to 'loginrec.c')
-rw-r--r--loginrec.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/loginrec.c b/loginrec.c
index 6f655cb16..95f14c46f 100644
--- a/loginrec.c
+++ b/loginrec.c
@@ -273,7 +273,7 @@ login_logout(struct logininfo *li)
273 * try to retrieve lastlog information from wtmp/wtmpx. 273 * try to retrieve lastlog information from wtmp/wtmpx.
274 */ 274 */
275unsigned int 275unsigned int
276login_get_lastlog_time(const int uid) 276login_get_lastlog_time(const uid_t uid)
277{ 277{
278 struct logininfo li; 278 struct logininfo li;
279 279
@@ -297,7 +297,7 @@ login_get_lastlog_time(const int uid)
297 * 0 on failure (will use OpenSSH's logging facilities for diagnostics) 297 * 0 on failure (will use OpenSSH's logging facilities for diagnostics)
298 */ 298 */
299struct logininfo * 299struct logininfo *
300login_get_lastlog(struct logininfo *li, const int uid) 300login_get_lastlog(struct logininfo *li, const uid_t uid)
301{ 301{
302 struct passwd *pw; 302 struct passwd *pw;
303 303
@@ -311,7 +311,8 @@ login_get_lastlog(struct logininfo *li, const int uid)
311 */ 311 */
312 pw = getpwuid(uid); 312 pw = getpwuid(uid);
313 if (pw == NULL) 313 if (pw == NULL)
314 fatal("%s: Cannot find account for uid %i", __func__, uid); 314 fatal("%s: Cannot find account for uid %ld", __func__,
315 (long)uid);
315 316
316 /* No MIN_SIZEOF here - we absolutely *must not* truncate the 317 /* No MIN_SIZEOF here - we absolutely *must not* truncate the
317 * username (XXX - so check for trunc!) */ 318 * username (XXX - so check for trunc!) */
@@ -335,7 +336,7 @@ login_get_lastlog(struct logininfo *li, const int uid)
335 * allocation fails, the program halts. 336 * allocation fails, the program halts.
336 */ 337 */
337struct 338struct
338logininfo *login_alloc_entry(int pid, const char *username, 339logininfo *login_alloc_entry(pid_t pid, const char *username,
339 const char *hostname, const char *line) 340 const char *hostname, const char *line)
340{ 341{
341 struct logininfo *newli; 342 struct logininfo *newli;
@@ -363,7 +364,7 @@ login_free_entry(struct logininfo *li)
363 * Returns: 1 364 * Returns: 1
364 */ 365 */
365int 366int
366login_init_entry(struct logininfo *li, int pid, const char *username, 367login_init_entry(struct logininfo *li, pid_t pid, const char *username,
367 const char *hostname, const char *line) 368 const char *hostname, const char *line)
368{ 369{
369 struct passwd *pw; 370 struct passwd *pw;
@@ -1496,7 +1497,7 @@ lastlog_openseek(struct logininfo *li, int *fd, int filemode)
1496 1497
1497 if (S_ISREG(st.st_mode)) { 1498 if (S_ISREG(st.st_mode)) {
1498 /* find this uid's offset in the lastlog file */ 1499 /* find this uid's offset in the lastlog file */
1499 offset = (off_t) ((long)li->uid * sizeof(struct lastlog)); 1500 offset = (off_t) ((u_long)li->uid * sizeof(struct lastlog));
1500 1501
1501 if (lseek(*fd, offset, SEEK_SET) != offset) { 1502 if (lseek(*fd, offset, SEEK_SET) != offset) {
1502 logit("%s: %s->lseek(): %s", __func__, 1503 logit("%s: %s->lseek(): %s", __func__,