diff options
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | loginrec.c | 13 | ||||
-rw-r--r-- | loginrec.h | 12 |
3 files changed, 15 insertions, 12 deletions
@@ -1,4 +1,6 @@ | |||
1 | 20101105 | 1 | 20101105 |
2 | - (djm) [loginrec.c loginrec.h] Use correct uid_t/pid_t types instead of | ||
3 | int. Should fix bz#1817 cleanly; ok dtucker@ | ||
2 | - OpenBSD CVS Sync | 4 | - OpenBSD CVS Sync |
3 | - djm@cvs.openbsd.org 2010/09/22 12:26:05 | 5 | - djm@cvs.openbsd.org 2010/09/22 12:26:05 |
4 | [regress/Makefile regress/kextype.sh] | 6 | [regress/Makefile regress/kextype.sh] |
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 | */ |
275 | unsigned int | 275 | unsigned int |
276 | login_get_lastlog_time(const int uid) | 276 | login_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 | */ |
299 | struct logininfo * | 299 | struct logininfo * |
300 | login_get_lastlog(struct logininfo *li, const int uid) | 300 | login_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 | */ |
337 | struct | 338 | struct |
338 | logininfo *login_alloc_entry(int pid, const char *username, | 339 | logininfo *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 | */ |
365 | int | 366 | int |
366 | login_init_entry(struct logininfo *li, int pid, const char *username, | 367 | login_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__, |
diff --git a/loginrec.h b/loginrec.h index 84b486590..28923e781 100644 --- a/loginrec.h +++ b/loginrec.h | |||
@@ -63,8 +63,8 @@ struct logininfo { | |||
63 | char progname[LINFO_PROGSIZE]; /* name of program (for PAM) */ | 63 | char progname[LINFO_PROGSIZE]; /* name of program (for PAM) */ |
64 | int progname_null; | 64 | int progname_null; |
65 | short int type; /* type of login (LTYPE_*) */ | 65 | short int type; /* type of login (LTYPE_*) */ |
66 | int pid; /* PID of login process */ | 66 | pid_t pid; /* PID of login process */ |
67 | int uid; /* UID of this user */ | 67 | uid_t uid; /* UID of this user */ |
68 | char line[LINFO_LINESIZE]; /* tty/pty name */ | 68 | char line[LINFO_LINESIZE]; /* tty/pty name */ |
69 | char username[LINFO_NAMESIZE]; /* login username */ | 69 | char username[LINFO_NAMESIZE]; /* login username */ |
70 | char hostname[LINFO_HOSTSIZE]; /* remote hostname */ | 70 | char hostname[LINFO_HOSTSIZE]; /* remote hostname */ |
@@ -86,12 +86,12 @@ struct logininfo { | |||
86 | /** 'public' functions */ | 86 | /** 'public' functions */ |
87 | 87 | ||
88 | /* construct a new login entry */ | 88 | /* construct a new login entry */ |
89 | struct logininfo *login_alloc_entry(int pid, const char *username, | 89 | struct logininfo *login_alloc_entry(pid_t pid, const char *username, |
90 | const char *hostname, const char *line); | 90 | const char *hostname, const char *line); |
91 | /* free a structure */ | 91 | /* free a structure */ |
92 | void login_free_entry(struct logininfo *li); | 92 | void login_free_entry(struct logininfo *li); |
93 | /* fill out a pre-allocated structure with useful information */ | 93 | /* fill out a pre-allocated structure with useful information */ |
94 | int login_init_entry(struct logininfo *li, int pid, const char *username, | 94 | int login_init_entry(struct logininfo *li, pid_t pid, const char *username, |
95 | const char *hostname, const char *line); | 95 | const char *hostname, const char *line); |
96 | /* place the current time in a logininfo struct */ | 96 | /* place the current time in a logininfo struct */ |
97 | void login_set_current_time(struct logininfo *li); | 97 | void login_set_current_time(struct logininfo *li); |
@@ -117,9 +117,9 @@ void login_set_addr(struct logininfo *li, const struct sockaddr *sa, | |||
117 | * lastlog retrieval functions | 117 | * lastlog retrieval functions |
118 | */ | 118 | */ |
119 | /* lastlog *entry* functions fill out a logininfo */ | 119 | /* lastlog *entry* functions fill out a logininfo */ |
120 | struct logininfo *login_get_lastlog(struct logininfo *li, const int uid); | 120 | struct logininfo *login_get_lastlog(struct logininfo *li, const uid_t uid); |
121 | /* lastlog *time* functions return time_t equivalent (uint) */ | 121 | /* lastlog *time* functions return time_t equivalent (uint) */ |
122 | unsigned int login_get_lastlog_time(const int uid); | 122 | unsigned int login_get_lastlog_time(const uid_t uid); |
123 | 123 | ||
124 | /* produce various forms of the line filename */ | 124 | /* produce various forms of the line filename */ |
125 | char *line_fullname(char *dst, const char *src, u_int dstsize); | 125 | char *line_fullname(char *dst, const char *src, u_int dstsize); |