| Summary: | lastlog is not recorded with the big uid | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | Portable OpenSSH | Reporter: | jchadima | ||||||
| Component: | sshd | Assignee: | Assigned to nobody <unassigned-bugs> | ||||||
| Status: | CLOSED FIXED | ||||||||
| Severity: | normal | CC: | djm | ||||||
| Priority: | P2 | ||||||||
| Version: | 5.6p1 | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Attachments: |
|
||||||||
Created attachment 1924 [details]
Patch solving the problem
Created attachment 1946 [details]
/home/djm/sshd-loginrec-types.diff
use correct types for loginrec
correct types patch applied Move resolved bugs to CLOSED after 5.7 release |
Description of problem: lastlog is not recorded with the big uid (>2147483647). 1569 /* open the file (using filemode) and seek to the login entry */ 1570 static int 1571 lastlog_openseek(struct logininfo *li, int *fd, int filemode) 1572 { ... 1600 if (type == LL_FILE) { 1601 /* find this uid's offset in the lastlog file */ 1602 offset = (off_t) ((long)li->uid * sizeof(struct lastlog)); 1603 1604 if (lseek(*fd, offset, SEEK_SET) != offset) { 1605 logit("%s: %s->lseek(): %s", __func__, 1606 lastlog_file, strerror(errno)); 1607 return (0); 1608 } When uid is 2147483648, offset is 18446743446644326400 at line 1602. uid = 2147483648 (0x80000000) (long)uid = 18446744071562067968 (0xFFFFFFFF80000000) As a result, offset becomes so big value, lseek fails, and lastlog is not recorded. lseek(9, 18446743446644326400, SEEK_SET) = -1 EINVAL (Invalid argument)